hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e18cca9f941af6e7e5eb334ee160ca73313973a
590
java
Java
app/src/main/java/com/example/kiran/instagram/Picture.java
kkanchamreddy/InstagramClone
e7b0fba72e3063f2c3be59c4bebf38430785137f
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/kiran/instagram/Picture.java
kkanchamreddy/InstagramClone
e7b0fba72e3063f2c3be59c4bebf38430785137f
[ "Apache-2.0" ]
1
2015-12-07T05:00:22.000Z
2015-12-07T07:42:04.000Z
app/src/main/java/com/example/kiran/instagram/Picture.java
kkanchamreddy/InstagramClone
e7b0fba72e3063f2c3be59c4bebf38430785137f
[ "Apache-2.0" ]
null
null
null
22.692308
88
0.677966
10,540
package com.example.kiran.instagram; /** * Created by kiran on 12/1/15. */ public class Picture { public String imageUrl; public String userName; public String caption; public String likeCount; public String userProfilePic; public Picture(String imageUrl, String userName, String caption, String likeCount) { this.imageUrl = imageUrl; this.userName = userName; this.caption = caption; this.likeCount = likeCount; } public void setUserProfilePicture(String profilePic) { this.userProfilePic = profilePic; } }
3e18ccdc6862f3d2fa0c6af259ea258b9d144583
509
java
Java
core-ui/src/main/java/com/apachetune/core/ui/ToolBarManager.java
progmonster/ApacheTune
85ecd442ac2814115aee7969d52605dfd5565f11
[ "MIT" ]
null
null
null
core-ui/src/main/java/com/apachetune/core/ui/ToolBarManager.java
progmonster/ApacheTune
85ecd442ac2814115aee7969d52605dfd5565f11
[ "MIT" ]
1
2022-01-21T23:32:03.000Z
2022-01-21T23:32:03.000Z
core-ui/src/main/java/com/apachetune/core/ui/ToolBarManager.java
progmonster/ApacheTune
85ecd442ac2814115aee7969d52605dfd5565f11
[ "MIT" ]
null
null
null
28.5
116
0.736842
10,541
package com.apachetune.core.ui; /** * FIXDOC * * @author <a href="mailto:dycjh@example.com">Aleksey V. Katorgin</a> * @version 1.0 */ public interface ToolBarManager { void initialize(); void addActionGroup(String groupId, com.apachetune.core.ui.actions.Action... actions); void addActionGroupAfter(String groupId, String afterGroupId, com.apachetune.core.ui.actions.Action... actions); void addToActionGroup(String actionGroupId, com.apachetune.core.ui.actions.Action... actions); }
3e18cd3b0ec09e5e91fd3a281ba17b7f77398db8
422
java
Java
L11SpringBoot/src/main/java/cn/edu/zucc/pb/boot/MyService.java
pengrobin/javaee-zucc
748688b978d3a3f3964b4399f6092dbda2951d31
[ "MIT" ]
17
2020-02-23T12:36:06.000Z
2020-05-31T18:06:18.000Z
L11SpringBoot/src/main/java/cn/edu/zucc/pb/boot/MyService.java
pengrobin/javaee-zucc
748688b978d3a3f3964b4399f6092dbda2951d31
[ "MIT" ]
null
null
null
L11SpringBoot/src/main/java/cn/edu/zucc/pb/boot/MyService.java
pengrobin/javaee-zucc
748688b978d3a3f3964b4399f6092dbda2951d31
[ "MIT" ]
7
2020-03-06T00:08:23.000Z
2020-06-17T08:29:56.000Z
18.347826
70
0.668246
10,542
package cn.edu.zucc.pb.boot; import org.springframework.stereotype.Component; /** * @author pengbin * @version 1.0 * @date 2020-05-02 17:47 */ @Component public class MyService { private String configValue; public MyService(MyConfig config){ this.configValue = config.getConfig(); } public void doSomething(){ System.out.printf("do task with config of %s\n", configValue); } }
3e18cd48cd498cc5f12a3ff1065f1e1aa1334a48
1,584
java
Java
rs3 files/Server/src/com/rs/game/npc/combat/impl/CockatriceCombat.java
emcry666/project-scape
827d213f129a9fd266cf42e7412402609191c484
[ "Apache-2.0" ]
null
null
null
rs3 files/Server/src/com/rs/game/npc/combat/impl/CockatriceCombat.java
emcry666/project-scape
827d213f129a9fd266cf42e7412402609191c484
[ "Apache-2.0" ]
null
null
null
rs3 files/Server/src/com/rs/game/npc/combat/impl/CockatriceCombat.java
emcry666/project-scape
827d213f129a9fd266cf42e7412402609191c484
[ "Apache-2.0" ]
null
null
null
37.714286
98
0.757576
10,543
package com.rs.game.npc.combat.impl; import com.rs.game.Animation; import com.rs.game.Entity; import com.rs.game.Graphics; import com.rs.game.Projectile; import com.rs.game.World; import com.rs.game.npc.NPC; import com.rs.game.npc.combat.CombatScript; import com.rs.game.npc.combat.NPCCombatDefinitions; import com.rs.game.player.Player; import com.rs.game.player.content.Combat; import com.rs.game.player.content.Slayer; import com.rs.utils.Utils; public class CockatriceCombat extends CombatScript { @Override public Object[] getKeys() { return new Object[] { 1620 }; } @Override public int attack(NPC npc, final Entity target) { NPCCombatDefinitions def = npc.getCombatDefinitions(); Projectile projectile = World.sendProjectileNew(npc, target, 1468, 34, 14, 35, 3, 0, 0); int endTime = Utils.projectileTimeToCycles(projectile.getEndTime()) - 1; if (!Slayer.hasReflectiveEquipment(target)) { Player targetPlayer = (Player) target; int randomSkill = Combat.COMBAT_SKILLS[Utils.random(Combat.COMBAT_SKILLS.length)]; int currentLevel = targetPlayer.getSkills().getLevel(randomSkill); targetPlayer.getSkills().set(randomSkill, currentLevel < 3 ? 0 : currentLevel / 4); npc.setNextAnimation(new Animation(7766)); npc.setNextGraphics(new Graphics(1467)); delayHit(npc, endTime, target, getMagicHit(npc, targetPlayer.getMaxHitpoints() / 11)); } else delayHit(npc, endTime, target, getMagicHit(npc, getMaxHit(npc, npc.getAttackStyle(), target))); npc.setNextAnimation(new Animation(def.getAttackEmote())); return npc.getAttackSpeed(); } }
3e18cd6a9b9b671b21682b8a6498430acbe43a6b
517
java
Java
competence-portlet/liferay/src/main/java/uzuzjmd/competence/liferay/LiferayContextFactory.java
University-of-Potsdam-MM/COMPBASE
7ca7a4358a9bd947437fb65e62224789c60dc431
[ "MIT" ]
null
null
null
competence-portlet/liferay/src/main/java/uzuzjmd/competence/liferay/LiferayContextFactory.java
University-of-Potsdam-MM/COMPBASE
7ca7a4358a9bd947437fb65e62224789c60dc431
[ "MIT" ]
null
null
null
competence-portlet/liferay/src/main/java/uzuzjmd/competence/liferay/LiferayContextFactory.java
University-of-Potsdam-MM/COMPBASE
7ca7a4358a9bd947437fb65e62224789c60dc431
[ "MIT" ]
null
null
null
21.541667
86
0.773694
10,544
package uzuzjmd.competence.liferay; import java.io.Serializable; import uzuzjmd.competence.gui.client.LmsContextFactory; public class LiferayContextFactory extends LmsContextFactory implements Serializable { /** * */ private static final long serialVersionUID = 1L; public LiferayContextFactory() { } public LiferayContextFactory(int courseId, String serverUrl, String evidenceServerUrl, String role, String userName) { super(courseId, serverUrl, evidenceServerUrl, role, userName); } }
3e18ce22aa8b167acb9662584c65052d2229e887
3,792
java
Java
yoko-spec-corba/src/main/java/org/omg/GIOP/MessageHeader_1_1Helper.java
ngmr/yoko
bd53a16c1a7eb1b2ae1ccc4ded7e0404b185c34c
[ "Apache-2.0" ]
2
2015-07-29T22:53:39.000Z
2021-11-10T15:02:08.000Z
yoko-spec-corba/src/main/java/org/omg/GIOP/MessageHeader_1_1Helper.java
ngmr/yoko
bd53a16c1a7eb1b2ae1ccc4ded7e0404b185c34c
[ "Apache-2.0" ]
32
2021-03-11T18:36:39.000Z
2021-10-05T11:25:15.000Z
yoko-spec-corba/src/main/java/org/omg/GIOP/MessageHeader_1_1Helper.java
ngmr/yoko
bd53a16c1a7eb1b2ae1ccc4ded7e0404b185c34c
[ "Apache-2.0" ]
15
2015-12-07T03:17:39.000Z
2021-11-10T15:01:53.000Z
34.162162
105
0.641878
10,545
/* * 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.omg.GIOP; // // IDL:omg.org/GIOP/MessageHeader_1_1:1.0 // final public class MessageHeader_1_1Helper { public static void insert(org.omg.CORBA.Any any, MessageHeader_1_1 val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static MessageHeader_1_1 extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return read(any.create_input_stream()); else throw new org.omg.CORBA.BAD_OPERATION(); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[5]; members[0] = new org.omg.CORBA.StructMember(); members[0].name = "magic"; members[0].type = orb.create_array_tc(4, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char)); members[1] = new org.omg.CORBA.StructMember(); members[1].name = "GIOP_version"; members[1].type = VersionHelper.type(); members[2] = new org.omg.CORBA.StructMember(); members[2].name = "flags"; members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_octet); members[3] = new org.omg.CORBA.StructMember(); members[3].name = "message_type"; members[3].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_octet); members[4] = new org.omg.CORBA.StructMember(); members[4].name = "message_size"; members[4].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong); typeCode_ = orb.create_struct_tc(id(), "MessageHeader_1_1", members); } return typeCode_; } public static String id() { return "IDL:omg.org/GIOP/MessageHeader_1_1:1.0"; } public static MessageHeader_1_1 read(org.omg.CORBA.portable.InputStream in) { MessageHeader_1_1 _ob_v = new MessageHeader_1_1(); int len0 = 4; _ob_v.magic = new char[len0]; in.read_char_array(_ob_v.magic, 0, len0); _ob_v.GIOP_version = VersionHelper.read(in); _ob_v.flags = in.read_octet(); _ob_v.message_type = in.read_octet(); _ob_v.message_size = in.read_ulong(); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, MessageHeader_1_1 val) { int len0 = val.magic.length; if(len0 != 4) throw new org.omg.CORBA.MARSHAL(); out.write_char_array(val.magic, 0, len0); VersionHelper.write(out, val.GIOP_version); out.write_octet(val.flags); out.write_octet(val.message_type); out.write_ulong(val.message_size); } }
3e18ce5d40e52030983b1fb918510ce0892e3c0f
9,950
java
Java
aws-java-sdk-simpleworkflow/src/main/java/com/amazonaws/services/simpleworkflow/model/LambdaFunctionFailedEventAttributes.java
erbrito/aws-java-sdk
853b7e82d708465aca43c6013ab1221ce4d50852
[ "Apache-2.0" ]
1
2019-02-08T15:23:16.000Z
2019-02-08T15:23:16.000Z
aws-java-sdk-simpleworkflow/src/main/java/com/amazonaws/services/simpleworkflow/model/LambdaFunctionFailedEventAttributes.java
erbrito/aws-java-sdk
853b7e82d708465aca43c6013ab1221ce4d50852
[ "Apache-2.0" ]
1
2020-09-21T09:46:45.000Z
2020-09-21T09:46:45.000Z
aws-java-sdk-simpleworkflow/src/main/java/com/amazonaws/services/simpleworkflow/model/LambdaFunctionFailedEventAttributes.java
erbrito/aws-java-sdk
853b7e82d708465aca43c6013ab1221ce4d50852
[ "Apache-2.0" ]
null
null
null
33.389262
137
0.62201
10,546
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.simpleworkflow.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * Provides details for the <code>LambdaFunctionFailed</code> event. * </p> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class LambdaFunctionFailedEventAttributes implements Serializable, Cloneable { /** * <p> * The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function was * scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up * to this event. * </p> */ private Long scheduledEventId; /** * <p> * The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. * </p> */ private Long startedEventId; /** * <p> * The reason provided for the failure (if any). * </p> */ private String reason; /** * <p> * The details of the failure (if any). * </p> */ private String details; /** * <p> * The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function was * scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up * to this event. * </p> * * @param scheduledEventId * The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function * was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events * leading up to this event. */ public void setScheduledEventId(Long scheduledEventId) { this.scheduledEventId = scheduledEventId; } /** * <p> * The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function was * scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up * to this event. * </p> * * @return The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function * was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events * leading up to this event. */ public Long getScheduledEventId() { return this.scheduledEventId; } /** * <p> * The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function was * scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up * to this event. * </p> * * @param scheduledEventId * The ID of the <code>LambdaFunctionScheduled</code> event that was recorded when this AWS Lambda function * was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events * leading up to this event. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionFailedEventAttributes withScheduledEventId(Long scheduledEventId) { setScheduledEventId(scheduledEventId); return this; } /** * <p> * The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. * </p> * * @param startedEventId * The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. */ public void setStartedEventId(Long startedEventId) { this.startedEventId = startedEventId; } /** * <p> * The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. * </p> * * @return The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. */ public Long getStartedEventId() { return this.startedEventId; } /** * <p> * The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. * </p> * * @param startedEventId * The ID of the <code>LambdaFunctionStarted</code> event recorded in the history. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionFailedEventAttributes withStartedEventId(Long startedEventId) { setStartedEventId(startedEventId); return this; } /** * <p> * The reason provided for the failure (if any). * </p> * * @param reason * The reason provided for the failure (if any). */ public void setReason(String reason) { this.reason = reason; } /** * <p> * The reason provided for the failure (if any). * </p> * * @return The reason provided for the failure (if any). */ public String getReason() { return this.reason; } /** * <p> * The reason provided for the failure (if any). * </p> * * @param reason * The reason provided for the failure (if any). * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionFailedEventAttributes withReason(String reason) { setReason(reason); return this; } /** * <p> * The details of the failure (if any). * </p> * * @param details * The details of the failure (if any). */ public void setDetails(String details) { this.details = details; } /** * <p> * The details of the failure (if any). * </p> * * @return The details of the failure (if any). */ public String getDetails() { return this.details; } /** * <p> * The details of the failure (if any). * </p> * * @param details * The details of the failure (if any). * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionFailedEventAttributes withDetails(String details) { setDetails(details); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getScheduledEventId() != null) sb.append("ScheduledEventId: ").append(getScheduledEventId()).append(","); if (getStartedEventId() != null) sb.append("StartedEventId: ").append(getStartedEventId()).append(","); if (getReason() != null) sb.append("Reason: ").append(getReason()).append(","); if (getDetails() != null) sb.append("Details: ").append(getDetails()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof LambdaFunctionFailedEventAttributes == false) return false; LambdaFunctionFailedEventAttributes other = (LambdaFunctionFailedEventAttributes) obj; if (other.getScheduledEventId() == null ^ this.getScheduledEventId() == null) return false; if (other.getScheduledEventId() != null && other.getScheduledEventId().equals(this.getScheduledEventId()) == false) return false; if (other.getStartedEventId() == null ^ this.getStartedEventId() == null) return false; if (other.getStartedEventId() != null && other.getStartedEventId().equals(this.getStartedEventId()) == false) return false; if (other.getReason() == null ^ this.getReason() == null) return false; if (other.getReason() != null && other.getReason().equals(this.getReason()) == false) return false; if (other.getDetails() == null ^ this.getDetails() == null) return false; if (other.getDetails() != null && other.getDetails().equals(this.getDetails()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getScheduledEventId() == null) ? 0 : getScheduledEventId().hashCode()); hashCode = prime * hashCode + ((getStartedEventId() == null) ? 0 : getStartedEventId().hashCode()); hashCode = prime * hashCode + ((getReason() == null) ? 0 : getReason().hashCode()); hashCode = prime * hashCode + ((getDetails() == null) ? 0 : getDetails().hashCode()); return hashCode; } @Override public LambdaFunctionFailedEventAttributes clone() { try { return (LambdaFunctionFailedEventAttributes) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
3e18cf4ce281038f9532300da6563c9e31c0a0ff
922
java
Java
src/main/java/fr/aumgn/bukkitutils/geom/direction/Face.java
christopherferreira19/BukkitUtils
b95bd11dbe1dcf9fad760eb68eb623f195c706c8
[ "MIT" ]
1
2018-07-12T09:00:45.000Z
2018-07-12T09:00:45.000Z
src/main/java/fr/aumgn/bukkitutils/geom/direction/Face.java
christopherferreira19/BukkitUtils
b95bd11dbe1dcf9fad760eb68eb623f195c706c8
[ "MIT" ]
null
null
null
src/main/java/fr/aumgn/bukkitutils/geom/direction/Face.java
christopherferreira19/BukkitUtils
b95bd11dbe1dcf9fad760eb68eb623f195c706c8
[ "MIT" ]
2
2015-04-19T10:34:58.000Z
2016-05-10T11:42:35.000Z
20.954545
62
0.623644
10,547
package fr.aumgn.bukkitutils.geom.direction; import fr.aumgn.bukkitutils.geom.Vector; import fr.aumgn.bukkitutils.geom.Vector2D; import org.apache.commons.lang.Validate; public final class Face extends AbstractDirection { private static boolean done = false; private final float yaw; private final float pitch; private final Vector vector; public Face(float yaw, float pitch, int x, int y, int z) { Validate.isTrue(!done); this.yaw = yaw; this.pitch = pitch; this.vector = new Vector(x, y, z); } public static void done() { done = true; } @Override public float getYaw() { return yaw; } @Override public float getPitch() { return pitch; } @Override public Vector2D getVector2D() { return vector.to2D(); } @Override public Vector getVector() { return vector; } }
3e18cf9cffe7a0aafae83358bcb1f15a9d372777
6,306
java
Java
prototype/txl-psns/psns-presentation/src/main/java/com/txlpsns/presentation/controller/TXLPsnsController.java
lucaslouca/distributed-system-tmf-model-b
aaa9c6c3a7d03f5deba16f812a442599eba4f3e7
[ "MIT" ]
null
null
null
prototype/txl-psns/psns-presentation/src/main/java/com/txlpsns/presentation/controller/TXLPsnsController.java
lucaslouca/distributed-system-tmf-model-b
aaa9c6c3a7d03f5deba16f812a442599eba4f3e7
[ "MIT" ]
null
null
null
prototype/txl-psns/psns-presentation/src/main/java/com/txlpsns/presentation/controller/TXLPsnsController.java
lucaslouca/distributed-system-tmf-model-b
aaa9c6c3a7d03f5deba16f812a442599eba4f3e7
[ "MIT" ]
null
null
null
38.687117
135
0.695687
10,548
package com.txlpsns.presentation.controller; import com.txlcommon.domain.psn.TXLPsnType; import com.txlcommon.domain.psn.TXLPsn; import com.txlcommon.presentation.dto.TXLPsnDTO; import com.txlcommon.presentation.dto.TXLPsnTypeDTO; import com.txlpsns.api.TXLPsnDoesNotExistException; import com.txlpsns.api.TXLPsnService; import com.txlpsns.domain.TXLPsnTuple; import com.txlpsns.presentation.dto.TXLPsnTupleDTO; import org.modelmapper.Converter; import org.modelmapper.ModelMapper; import org.modelmapper.spi.MappingContext; import org.springframework.http.MediaType; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; @RequestMapping("/rest") public class TXLPsnsController { TXLPsnService psnService; private ModelMapper modelMapper; public void setPsnService(TXLPsnService psnService) { this.psnService = psnService; } /** * Init method. */ @PostConstruct public void init() { modelMapper = new ModelMapper(); // TXLPsnTypeDTO -> TXLPsnType modelMapper.createTypeMap(TXLPsnTypeDTO.class, TXLPsnType.class).setConverter(new Converter<TXLPsnTypeDTO, TXLPsnType>() { public TXLPsnType convert(MappingContext<TXLPsnTypeDTO, TXLPsnType> context) { return TXLPsnType.valueOf(context.getSource().getName()); } }); // TXLPsnType -> TXLPsnTypeDTO modelMapper.createTypeMap(TXLPsnType.class, TXLPsnTypeDTO.class).setConverter(new Converter<TXLPsnType, TXLPsnTypeDTO>() { public TXLPsnTypeDTO convert(MappingContext<TXLPsnType, TXLPsnTypeDTO> context) { return new TXLPsnTypeDTO(context.getSource()); } }); } /** * Resolve a given pseudonym. From PSN1 -> PSN2 or PSN2 -> PSN1, depending on where we come from. * For instance a TXLCase holds a client profile pseudonym of type PSN1 that needs to be resolved to a * pseudonym of type PSN2 which is the pseudonym of the client profile in IDAT. Here we come from VDAT and want to * fetch something in IDAT (PSN1 -> PSN2). * * Another example would be fetching the cases of a client with EID (PSN1) in IDAT. The EID (PSN1) needs to be * resolved to PSN2(s), which are the pseudonyms of TXLCases in VDAT. Here we come from IDAT and want to fetch * something in VDAT. Again this is a PSN1 -> PSN2 resolving. * * Another example is the case when we have an existing client profile (IDAT) that has a pseudonym (PSN2), that * we want to assign to a new case. Here we need to know the PSN1 counterpart so that we can assign it to the * case.clientProfilePsnToBeResolved property of the TXLCase in VDAT. For that we ask the PSNS to resolve a pseudonym * of type PSN2 and give us the PSN1 counterpart. The PSNS will return an array of counterparts, but it will optimally * contain only one pseudonym of type PSN1. This is a PSN2 -> PSN1 resolving. * * * @param request * @param response * @param psnDto the pseudonym that needs to be resolved. * @return a list of counterpart pseudonyms */ @ResponseBody @RequestMapping(value = "/resolve", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(readOnly = true) public List<TXLPsnDTO> resolve(HttpServletRequest request, HttpServletResponse response, @RequestBody TXLPsnDTO psnDto) { List<TXLPsnDTO> result = new ArrayList<TXLPsnDTO>(); try { TXLPsn psn = modelMapper.map(psnDto, TXLPsn.class); List<TXLPsn> resolvedPsns = psnService.resolvePsn(psn); for (TXLPsn resolvedPsn : resolvedPsns) { result.add(modelMapper.map(resolvedPsn, TXLPsnDTO.class)); } } catch (TXLPsnDoesNotExistException e) { e.printStackTrace(); } return result; } /** * Create a new counterpart pseudonym and return it. * * @param request * @param response * @param psnDto the pseudonym fir which we need a counterpart. * @return the newly created pseudonym. */ @ResponseBody @RequestMapping(value = "/addCounterpart", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public TXLPsnDTO addCounterpartPsnForPsn(HttpServletRequest request, HttpServletResponse response, @RequestBody TXLPsnDTO psnDto) { TXLPsnDTO result = null; try { TXLPsn psn = modelMapper.map(psnDto, TXLPsn.class); TXLPsn counterpartPsn = psnService.addCounterpartPsnForPsn(psn); result = modelMapper.map(counterpartPsn, TXLPsnDTO.class); } catch (TXLPsnDoesNotExistException e) { e.printStackTrace(); } return result; } /** * Create a new pseydonym tuple and return it. * * @param request * @param response * @return the newly generated pseudonym tuple. */ @ResponseBody @RequestMapping(value = "/createTuple", method = RequestMethod.POST) public TXLPsnTupleDTO createPsnTuple(HttpServletRequest request, HttpServletResponse response) { TXLPsnTupleDTO result; TXLPsnTuple psnTuple = psnService.createPsnTuple(); result = modelMapper.map(psnTuple, TXLPsnTupleDTO.class); return result; } /** * Create a new non persisted pseudonym. * * @param request * @param response * @param typeDto the type of pseudonym to create * @return the newly created pseudonym. */ @ResponseBody @RequestMapping(value = "/createPsn", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public TXLPsnDTO createPsn(HttpServletRequest request, HttpServletResponse response, @RequestBody TXLPsnTypeDTO typeDto) { TXLPsnDTO result; TXLPsn counterpartPsn = psnService.createPsn(modelMapper.map(typeDto, TXLPsnType.class)); result = modelMapper.map(counterpartPsn, TXLPsnDTO.class); return result; } }
3e18cfeddd24a2e7fff1e77ddfe640cadcc0bb19
1,934
java
Java
src/main/java/es/udc/fic/ginecologia/form/UserListElem.java
SergioCortizo/sistema-gestion-pacientes-ginecologia
e2b4c518b30f6eaff26ea681afef3a8939349e25
[ "MIT" ]
null
null
null
src/main/java/es/udc/fic/ginecologia/form/UserListElem.java
SergioCortizo/sistema-gestion-pacientes-ginecologia
e2b4c518b30f6eaff26ea681afef3a8939349e25
[ "MIT" ]
null
null
null
src/main/java/es/udc/fic/ginecologia/form/UserListElem.java
SergioCortizo/sistema-gestion-pacientes-ginecologia
e2b4c518b30f6eaff26ea681afef3a8939349e25
[ "MIT" ]
null
null
null
18.960784
106
0.679421
10,549
package es.udc.fic.ginecologia.form; import java.time.format.DateTimeFormatter; import java.util.Set; import es.udc.fic.ginecologia.model.Role; import es.udc.fic.ginecologia.model.User; public class UserListElem { private Integer id; private String name; private String username; private String email; private boolean enabled; private String discharge_date; private Set<Role> roles; public UserListElem(User user) { this.name = user.getName(); this.username = user.getUsername(); this.email = user.getEmail(); this.enabled = user.isEnabled(); this.id = user.getId(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"); this.discharge_date = user.getDischarge_date().format(formatter); this.roles = user.getRoles(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getDischarge_date() { return discharge_date; } public void setDischarge_date(String discharge_date) { this.discharge_date = discharge_date; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Override public String toString() { return "UserListElem [id=" + id + ", name=" + name + ", username=" + username + ", email=" + email + ", enabled=" + enabled + ", discharge_date=" + discharge_date.toString() + ", roles=" + roles + "]"; } }
3e18d034c4ed7f682b77774da8475b2ba21a7a1d
945
java
Java
elasticsearch-demo/src/main/java/com/elasticsearch/demo/vo/Student.java
huluobo11/demo-collection
35d859decb0295a56abaaea06d92655afc40ddb4
[ "MIT" ]
2
2019-05-05T08:16:14.000Z
2019-11-12T16:37:58.000Z
elasticsearch-demo/src/main/java/com/elasticsearch/demo/vo/Student.java
huluobo11/demo-collection
35d859decb0295a56abaaea06d92655afc40ddb4
[ "MIT" ]
15
2020-02-28T01:28:35.000Z
2022-03-31T20:41:05.000Z
elasticsearch-demo/src/main/java/com/elasticsearch/demo/vo/Student.java
huluobo11/demo-collection
35d859decb0295a56abaaea06d92655afc40ddb4
[ "MIT" ]
null
null
null
23.625
74
0.742857
10,550
package com.elasticsearch.demo.vo; import lombok.Data; import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; import java.io.Serializable; @Data @Accessors(chain = true) @Document(indexName = "school", type = "_doc") // indexName为ES索引名,type为文档名 public class Student implements Serializable { /* id标识 type字段类型 index="true",代表是否开启索引,默认开启 analyzer="ik_max_word"代表搜索的时候是如何分词匹配,为IK分词器最细颗粒度 searchAnalyzer = "ik_max_word"搜索分词的类型 */ // @Id private String id; @Field(type = FieldType.Keyword) private String name; private Integer age; @Field(type = FieldType.Double) private Double score; @Field(type = FieldType.Text) private String info; }
3e18d0e0550f3412604e21d20e04ec9056b5fa44
1,351
java
Java
src/test/java/com/github/zhangyingwei/solid/items/pipline/CapitalizeSolidMethodTest.java
zhangyingwei/Solid
4aa137379e6e6ff4537bec19cecd0cf3697acfdf
[ "Apache-2.0" ]
4
2018-07-06T09:34:28.000Z
2019-07-29T14:49:38.000Z
src/test/java/com/github/zhangyingwei/solid/items/pipline/CapitalizeSolidMethodTest.java
zhangyingwei/Solid
4aa137379e6e6ff4537bec19cecd0cf3697acfdf
[ "Apache-2.0" ]
null
null
null
src/test/java/com/github/zhangyingwei/solid/items/pipline/CapitalizeSolidMethodTest.java
zhangyingwei/Solid
4aa137379e6e6ff4537bec19cecd0cf3697acfdf
[ "Apache-2.0" ]
2
2022-02-11T08:02:44.000Z
2022-02-18T01:13:04.000Z
39.735294
102
0.733531
10,551
package com.github.zhangyingwei.solid.items.pipline; import com.github.zhangyingwei.solid.config.SolidConfiguration; import com.github.zhangyingwei.solid.config.StringTemplateResourceLoader; import com.github.zhangyingwei.solid.template.Template; import com.github.zhangyingwei.solid.template.TemplateResolver; import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.*; public class CapitalizeSolidMethodTest { @Test public void test1() { String templateString = "{{ \"title\" | capitalize }}"; SolidConfiguration configuration = new SolidConfiguration(new StringTemplateResourceLoader()); TemplateResolver builder = new TemplateResolver(configuration); Template template = builder.resolve(templateString); System.out.println(template.render()); Assert.assertEquals(template.render(), "Title"); } @Test public void test2() { String templateString = "{{ \"my great title\" | capitalize }}"; SolidConfiguration configuration = new SolidConfiguration(new StringTemplateResourceLoader()); TemplateResolver builder = new TemplateResolver(configuration); Template template = builder.resolve(templateString); System.out.println(template.render()); Assert.assertEquals(template.render(), "My great title"); } }
3e18d1b15233ad8cc7d9012ff06da1b70397720b
1,734
java
Java
spring-data-gigaspaces/src/test/java/org/springframework/data/gigaspaces/integration/document/PersonDocumentRepository.java
devonfw-forge/mts-gigaspaces
883badabc21c39ec3e6c5305ef07a56ffc4b3aa9
[ "Apache-2.0" ]
null
null
null
spring-data-gigaspaces/src/test/java/org/springframework/data/gigaspaces/integration/document/PersonDocumentRepository.java
devonfw-forge/mts-gigaspaces
883badabc21c39ec3e6c5305ef07a56ffc4b3aa9
[ "Apache-2.0" ]
null
null
null
spring-data-gigaspaces/src/test/java/org/springframework/data/gigaspaces/integration/document/PersonDocumentRepository.java
devonfw-forge/mts-gigaspaces
883badabc21c39ec3e6c5305ef07a56ffc4b3aa9
[ "Apache-2.0" ]
null
null
null
33.346154
104
0.743368
10,552
package org.springframework.data.gigaspaces.integration.document; import org.springframework.data.gigaspaces.model.PersonDocument; import org.springframework.data.gigaspaces.repository.GigaspacesDocumentRepository; import org.springframework.data.gigaspaces.repository.Query; import org.springframework.data.gigaspaces.repository.SpaceDocumentName; import org.springframework.data.gigaspaces.repository.query.Projection; import java.util.List; @SpaceDocumentName(PersonDocument.TYPE_NAME) public interface PersonDocumentRepository extends GigaspacesDocumentRepository<PersonDocument, String> { @Query("name = ?") List<PersonDocument> findByName(String name); @Query("age = ?") List<PersonDocument> findByAge(Integer age); @Query("name = ? and age = ?") List<PersonDocument> findByNameAndAge(String name, Integer age); @Query("name = ? or age = ?") List<PersonDocument> findByNameOrAge(String name, Integer age); @Query("spouse.name = ?") List<PersonDocument> findBySpouseName(String name); @Query("customField = ?") List<PersonDocument> findByCustomField(String value); @Query("age = ? order by id asc") List<PersonDocument> findByAgeSortedById(Integer age); @Query("age = ?") List<PersonDocument> findByAge(Integer age, Projection projection); @Query("age between ? and ?") List<PersonDocument> findByAgeBetween(Integer minAge, Integer maxAge); @Query("active = 'true'") List<PersonDocument> findByActiveTrue(); @Query("name in (?)") List<PersonDocument> findByNameIn(List<String> names); @Query("name rlike ?") List<PersonDocument> findByNameRegex(String regex); List<PersonDocument> findBySpouseAge(Integer age); }
3e18d1e2a982cec4cb1fd3f9e98aab761af4d79d
3,665
java
Java
annotation-processor/src/main/java/cd/go/jrepresenter/apt/models/PropertyAnnotationBuilder.java
gocd/jrepresenter
814ef8f3329a9ecfd1ac51a0a3a494c70b2364d9
[ "Apache-2.0" ]
null
null
null
annotation-processor/src/main/java/cd/go/jrepresenter/apt/models/PropertyAnnotationBuilder.java
gocd/jrepresenter
814ef8f3329a9ecfd1ac51a0a3a494c70b2364d9
[ "Apache-2.0" ]
null
null
null
annotation-processor/src/main/java/cd/go/jrepresenter/apt/models/PropertyAnnotationBuilder.java
gocd/jrepresenter
814ef8f3329a9ecfd1ac51a0a3a494c70b2364d9
[ "Apache-2.0" ]
2
2017-12-14T04:03:19.000Z
2018-01-15T12:28:33.000Z
33.623853
237
0.741064
10,553
/* * Copyright 2018 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cd.go.jrepresenter.apt.models; import com.squareup.javapoet.TypeName; public final class PropertyAnnotationBuilder { protected RepresenterAnnotation parent; protected boolean embedded; protected boolean renderNull = true; protected Attribute modelAttribute; protected Attribute jsonAttribute; protected TypeName representerClassName; protected TypeName serializerClassName; protected TypeName deserializerClassName; protected TypeName getterClassName; protected TypeName setterClassName; protected TypeName skipParse; protected TypeName skipRender; private PropertyAnnotationBuilder() { } public static PropertyAnnotationBuilder aPropertyAnnotation() { return new PropertyAnnotationBuilder(); } public PropertyAnnotationBuilder withParent(RepresenterAnnotation parent) { this.parent = parent; return this; } public PropertyAnnotationBuilder withEmbedded(boolean embedded) { this.embedded = embedded; return this; } public PropertyAnnotationBuilder withRenderNull(boolean renderNull) { this.renderNull = renderNull; return this; } public PropertyAnnotationBuilder withModelAttribute(Attribute modelAttribute) { this.modelAttribute = modelAttribute; return this; } public PropertyAnnotationBuilder withJsonAttribute(Attribute jsonAttribute) { this.jsonAttribute = jsonAttribute; return this; } public PropertyAnnotationBuilder withRepresenterClassName(TypeName representerClassName) { this.representerClassName = representerClassName; return this; } public PropertyAnnotationBuilder withSerializerClassName(TypeName serializerClassName) { this.serializerClassName = serializerClassName; return this; } public PropertyAnnotationBuilder withDeserializerClassName(TypeName deserializerClassName) { this.deserializerClassName = deserializerClassName; return this; } public PropertyAnnotationBuilder withGetterClassName(TypeName getterClassName) { this.getterClassName = getterClassName; return this; } public PropertyAnnotationBuilder withSetterClassName(TypeName setterClassName) { this.setterClassName = setterClassName; return this; } public PropertyAnnotationBuilder withSkipParse(TypeName skipParse) { this.skipParse = skipParse; return this; } public PropertyAnnotationBuilder withSkipRender(TypeName skipRender) { this.skipRender = skipRender; return this; } public PropertyAnnotation build() { PropertyAnnotation propertyAnnotation = new PropertyAnnotation(modelAttribute, jsonAttribute, serializerClassName, deserializerClassName, representerClassName, getterClassName, setterClassName, skipParse, skipRender, renderNull); propertyAnnotation.setParent(parent); propertyAnnotation.setEmbedded(embedded); return propertyAnnotation; } }
3e18d1f602e659a8165bdb3b64495a874bcb0783
210,571
java
Java
java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
kyowill/derby-10.0.2.1
b30dddf5248b603291bdf509ba6b10efe6999609
[ "Apache-2.0" ]
null
null
null
java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
kyowill/derby-10.0.2.1
b30dddf5248b603291bdf509ba6b10efe6999609
[ "Apache-2.0" ]
null
null
null
java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
kyowill/derby-10.0.2.1
b30dddf5248b603291bdf509ba6b10efe6999609
[ "Apache-2.0" ]
null
null
null
29.376535
138
0.682896
10,554
/* Derby - Class org.apache.derby.impl.drda.DRDAConnThread Copyright 2001, 2004 The Apache Software Foundation or its licensors, as applicable. 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. */ /** * This class translates DRDA protocol from an application requester to JDBC * for Cloudscape and then translates the results from Cloudscape to DRDA * for return to the application requester. * @author ge, marsden, peachey */ package org.apache.derby.impl.drda; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.FileInputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.*; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.DataTruncation; import java.sql.DriverManager; import java.sql.Connection; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.CallableStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Types; import java.sql.Blob; import java.sql.Clob; import java.util.Properties; import java.util.Enumeration; import java.util.Vector; import java.util.ArrayList; import java.util.Date; import java.math.BigDecimal; import org.apache.derby.iapi.tools.i18n.LocalizedResource; import org.apache.derby.iapi.reference.SQLState; import org.apache.derby.iapi.reference.Attribute; import org.apache.derby.iapi.reference.DB2Limit; import org.apache.derby.iapi.error.ExceptionSeverity; import org.apache.derby.impl.jdbc.Util; import org.apache.derby.impl.jdbc.EmbedSQLException; import org.apache.derby.impl.jdbc.EmbedSQLWarning; import org.apache.derby.impl.jdbc.EmbedStatement; import org.apache.derby.impl.jdbc.EmbedPreparedStatement; import org.apache.derby.impl.jdbc.EmbedParameterSetMetaData; import org.apache.derby.impl.jdbc.EmbedConnection; import org.apache.derby.iapi.reference.JDBC30Translation; import org.apache.derby.iapi.services.info.JVMInfo; import org.apache.derby.iapi.services.sanity.SanityManager; import org.apache.derby.iapi.services.stream.HeaderPrintWriter; import org.apache.derby.iapi.services.monitor.Monitor; public class DRDAConnThread extends Thread { private static final String leftBrace = "{"; private static final String rightBrace = "}"; private static final byte NULL_VALUE = (byte)0xff; private static final String SYNTAX_ERR = "42X01"; // Manager Level 3 constant. private static final int MGRLVL_3 = 0x03; // Manager Level 4 constant. private static final int MGRLVL_4 = 0x04; // Manager Level 5 constant. private static final int MGRLVL_5 = 0x05; // Manager level 6 constant. private static final int MGRLVL_6 = 0x06; // Manager Level 7 constant. private static final int MGRLVL_7 = 0x07; // Commit or rollback UOWDSP values private static final int COMMIT = 1; private static final int ROLLBACK = 2; protected CcsidManager ccsidManager = new EbcdicCcsidManager(); private int correlationID; private InputStream sockis; private OutputStream sockos; private DDMReader reader; private DDMWriter writer; private static int [] ACCRDB_REQUIRED = {CodePoint.RDBACCCL, CodePoint.CRRTKN, CodePoint.PRDID, CodePoint.TYPDEFNAM, CodePoint.TYPDEFOVR}; private static int MAX_REQUIRED_LEN = 5; private int currentRequiredLength = 0; private int [] required = new int[MAX_REQUIRED_LEN]; private DB2jServerImpl server; // server who created me private Session session; // information about the session private long timeSlice; // time slice for this thread private Object timeSliceSync = new Object(); // sync object for updating time slice private boolean logConnections; // log connections to databases private boolean sendWarningsOnCNTQRY = false; // Send Warnings for SELECT if true private Object logConnectionsSync = new Object(); // sync object for log connect private boolean close; // end this thread private Object closeSync = new Object(); // sync object for parent to close us down private static HeaderPrintWriter logStream; private AppRequester appRequester; // pointer to the application requester // for the session being serviced private Database database; // pointer to the current database private int sqlamLevel; // SQLAM Level - determines protocol // manager processing private Vector unknownManagers; private Vector knownManagers; private Vector errorManagers; private Vector errorManagersLevel; // database accessed failed private SQLException databaseAccessException; // these fields are needed to feed back to jcc about a statement/procedure's PKGNAMCSN private String rdbnam; private String rdbcolid; private String pkgid; private String pkgcnstknStr; private int secnumber; // this flag is for an execute statement/procedure which actually returns a result set; // do not commit the statement, otherwise result set is closed // for decryption private static DecryptionManager decryptionManager; // public key generated by Deffie-Hellman algorithm, to be passed to the encrypter, // as well as used to initialize the cipher private byte[] myPublicKey; // constructor /** * Create a new Thread for processing session requests * * @param session Session requesting processing * @param server Server starting thread * @param timeSlice timeSlice for thread * @param logConnections **/ public DRDAConnThread(Session session, DB2jServerImpl server, long timeSlice, boolean logConnections) { super(); // Create a more meaningful name for this thread (but preserve its // thread id from the default name). DB2jServerImpl.setUniqueThreadName(this, "DRDAConnThread"); this.session = session; this.server = server; this.timeSlice = timeSlice; this.logConnections = logConnections; initialize(); } /** * Main routine for thread, loops until the thread is closed * Gets a session, does work for the session */ public void run() { if (SanityManager.DEBUG) trace("Starting new connection thread"); Session prevSession; while(!closed()) { // get a new session prevSession = session; session = server.getNextSession(session); if (session == null) close(); if (closed()) break; if (session != prevSession) { initializeForSession(); } try { long timeStart = System.currentTimeMillis(); switch (session.state) { case Session.INIT: sessionInitialState(); if (session == null) break; case Session.ATTEXC: long currentTimeSlice; do { processCommands(); currentTimeSlice = getTimeSlice(); } while ((currentTimeSlice == 0) || (System.currentTimeMillis() - timeStart < currentTimeSlice)); break; default: // this is an error agentError("Session in invalid state:" + session.state); } } catch (Exception e) { if (e instanceof DRDAProtocolException && ((DRDAProtocolException)e).isDisconnectException()) { // client went away - this is O.K. here closeSession(); } else { handleException(e); } } } if (SanityManager.DEBUG) trace("Ending connection thread"); server.getThreadList().removeElement(this); } /** * Get input stream * * @return input stream */ protected InputStream getInputStream() { return sockis; } /** * Get output stream * * @return output stream */ protected OutputStream getOutputStream() { return sockos; } /** * Get correlation id * * @return correlation id */ protected int getCorrelationID () { return correlationID; } /** * Get session we are working on * * @return session */ protected Session getSession() { return session; } /** * Get Database we are working on * * @return database */ protected Database getDatabase() { return database; } /** * Get server * * @return server */ protected DB2jServerImpl getServer() { return server; } /** * Get correlation token * * @return crrtkn */ protected byte[] getCrrtkn() { if (database != null) return database.crrtkn; return null; } /** * Get database name * * @return database name */ protected String getDbName() { if (database != null) return database.dbName; return null; } /** * Close DRDA connection thread */ protected void close() { synchronized (closeSync) { close = true; } } /** * Set logging of connections * * @param value value to set for logging connections */ protected void setLogConnections(boolean value) { synchronized(logConnectionsSync) { logConnections = value; } } /** * Set time slice value * * @param value new value for time slice */ protected void setTimeSlice(long value) { synchronized(timeSliceSync) { timeSlice = value; } } /** * Indicate a communications failure * * @param arg1 - info about the communications failure * @param arg2 - info about the communications failure * @param arg3 - info about the communications failure * @param arg4 - info about the communications failure * * @exception DRDAProtocolException disconnect exception always thrown */ protected void markCommunicationsFailure(String arg1, String arg2, String arg3, String arg4) throws DRDAProtocolException { Object[] oa = {arg1,arg2,arg3,arg4}; throw DRDAProtocolException.newDisconnectException(this,oa); } /** * Syntax error * * @param errcd Error code * @param cpArg code point value * @exception DRDAProtocolException */ protected void throwSyntaxrm(int errcd, int cpArg) throws DRDAProtocolException { throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_SYNTAXRM, this, cpArg, errcd); } /** * Agent error - something very bad happened * * @param msg Message describing error * * @exception DRDAProtocolException newAgentError always thrown */ protected void agentError(String msg) throws DRDAProtocolException { String dbname = null; if (database != null) dbname = database.dbName; throw DRDAProtocolException.newAgentError(this, CodePoint.SVRCOD_PRMDMG, dbname, msg); } /** * Missing code point * * @param codePoint code point value * @exception DRDAProtocolException */ protected void missingCodePoint(int codePoint) throws DRDAProtocolException { throwSyntaxrm(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND, codePoint); } /** * Print a line to the DB2j log * * @param dbname database name * @param drdaID DRDA identifier * @param msg message */ protected static void println2Log(String dbname, String drdaID, String msg) { if (logStream == null) logStream = Monitor.getStream(); if (dbname != null) { int endOfName = dbname.indexOf(';'); if (endOfName != -1) dbname = dbname.substring(0, endOfName); } logStream.printlnWithHeader("(DATABASE = " + dbname + "), (DRDAID = " + drdaID + "), " + msg); } /** * Write RDBNAM * * @param rdbnam database name * @exception DRDAProtocolException */ protected void writeRDBNAM(String rdbnam) throws DRDAProtocolException { int len = rdbnam.length(); if (len < CodePoint.RDBNAM_LEN) len = CodePoint.RDBNAM_LEN; writer.writeScalarHeader(CodePoint.RDBNAM, len); try { writer.writeScalarPaddedBytes(rdbnam.getBytes(server.DEFAULT_ENCODING), len, server.SPACE_CHAR); } catch (UnsupportedEncodingException e) { agentError("Unsupported coding exception for server encoding " + server.DEFAULT_ENCODING); } } /*************************************************************************** * Private methods ***************************************************************************/ /** * Initialize class */ private void initialize() { // set input and output sockets // this needs to be done before creating reader sockis = session.sessionInput; sockos = session.sessionOutput; reader = new DDMReader(this, session.dssTrace); writer = new DDMWriter(ccsidManager, this, session.dssTrace); } /** * Initialize for a new session */ private void initializeForSession() { // set input and output sockets sockis = session.sessionInput; sockos = session.sessionOutput; // intialize reader and writer reader.initialize(this, session.dssTrace); writer.reset(session.dssTrace); // initialize local pointers to session info database = session.database; appRequester = session.appRequester; // set sqlamLevel if (session.state == Session.ATTEXC) sqlamLevel = appRequester.getManagerLevel(CodePoint.SQLAM); } /** * In initial state for a session, * determine whether this is a command * session or a DRDA protocol session. A command session is for changing * the configuration of the Net server, e.g., turning tracing on * If it is a command session, process the command and close the session. * If it is a DRDA session, exchange server attributes and change session * state. */ private void sessionInitialState() throws Exception { // process NetworkServerControl commands - if it is not either valid protocol let the // DRDA error handling handle it if (reader.isCmd()) { try { server.processCommands(reader, writer, session); // reset reader and writer reader.initialize(this, null); writer.reset(null); closeSession(); } catch (Throwable t) { if (t instanceof InterruptedException) throw (InterruptedException)t; else { server.consoleExceptionPrintTrace(t); } } } else { // exchange attributes with application requester if (exchangeServerAttributes()) session.state = Session.ATTEXC; else closeSession(); } } /** * Process DRDA commands we can receive once server attributes have been * exchanged. * * @exception DRDAProtocolException */ private void processCommands() throws DRDAProtocolException { DRDAStatement stmt = null; int updateCount = 0; boolean PRPSQLSTTfailed = false; do { correlationID = reader.readDssHeader(); int codePoint = reader.readLengthAndCodePoint(); int writerMark = writer.markDSSClearPoint(); switch(codePoint) { case CodePoint.CNTQRY: try{ stmt = parseCNTQRY(); if (stmt != null) { writeQRYDTA(stmt); if (stmt.rsIsClosed()) { writeENDQRYRM(CodePoint.SVRCOD_WARNING); writeNullSQLCARDobject(); } // Send any warnings if JCC can handle them checkWarning(null, null, stmt.getResultSet(), 0, false, sendWarningsOnCNTQRY); } } catch(SQLException e) { if (stmt != null) { // if we got a SQLException we need to clean up and // close the statement Beetle 4758 writer.clearDSSesBackToMark(writerMark); if (! stmt.rsIsClosed()) { try { stmt.rsClose(); } catch (SQLException ec) { if (SanityManager.DEBUG) trace("Warning: Error closing statement"); } writeABNUOWRM(); writeSQLCARD(e,CodePoint.SVRCOD_ERROR,0,0); } } else { writeSQLCARDs(e, 0); } errorInChain(e); } break; case CodePoint.EXCSQLIMM: try { updateCount = parseEXCSQLIMM(); // RESOLVE: checking updateCount is not sufficient // since it will be 0 for creates, we need to know when // any logged changes are made to the database // Not getting this right for JCC is probably O.K., this // will probably be a problem for ODBC and XA // The problem is that JDBC doesn't provide this information // so we would have to expand the JDBC API or call a // builtin method to check(expensive) // For now we will assume that every execute immediate // does an update (that is the most conservative thing) if (database.RDBUPDRM_sent == false) { writeRDBUPDRM(); } // we need to set update count in SQLCARD checkWarning(null, database.getDefaultStatement().getStatement(), null, updateCount, true, true); } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); writeSQLCARDs(e, 0); errorInChain(e); } break; case CodePoint.EXCSQLSET: try { if (parseEXCSQLSET()) // all went well. writeSQLCARDs(null,0); } catch (SQLWarning w) { writeSQLCARD(w, CodePoint.SVRCOD_WARNING, 0, 0); } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); writeSQLCARDs(e, 0); errorInChain(e); } break; case CodePoint.PRPSQLSTT: int sqldaType; PRPSQLSTTfailed = false; try { database.getConnection().clearWarnings(); sqldaType = parsePRPSQLSTT(); if (sqldaType > 0) // do write SQLDARD writeSQLDARD(database.getCurrentStatement(), (sqldaType == CodePoint.TYPSQLDA_LIGHT_OUTPUT), database.getConnection().getWarnings()); else checkWarning(database.getConnection(), null, null, 0, true, true); } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); writeSQLCARDs(e, 0, true); PRPSQLSTTfailed = true; errorInChain(e); } break; case CodePoint.OPNQRY: PreparedStatement ps = null; try { if (PRPSQLSTTfailed) { // read the command objects // for ps with parameter // Skip objects/parameters skipRemainder(true); // If we failed to prepare, then we fail // to open, which means OPNQFLRM. writeOPNQFLRM(null); break; } String pkgnamcsn = parseOPNQRY(); if (pkgnamcsn != null) { stmt = database.getDRDAStatement(pkgnamcsn); ps = stmt.getPreparedStatement(); ps.clearWarnings(); stmt.execute(); writeOPNQRYRM(false, stmt); checkWarning(null, ps, null, 0, false, true); writeQRYDSC(stmt, false); // We could send QRYDTA here if there's no LOB data // in the result set, and if we are using LMTBLKPRC, as // allowed by drda spec, as an option. stmt.rsSuspend(); } } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); try { // Try to cleanup if we hit an error. if (ps != null) ps.close(); writeOPNQFLRM(e); } catch (SQLException pse) {} errorInChain(e); } break; case CodePoint.RDBCMM: try { if (SanityManager.DEBUG) trace("Received commit"); if (!database.getConnection().getAutoCommit()) { database.getConnection().clearWarnings(); database.commit(); writeENDUOWRM(COMMIT); checkWarning(database.getConnection(), null, null, 0, true, true); } // we only want to write one of these per transaction // so set to false in preparation for next command database.RDBUPDRM_sent = false; } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); // Even in case of error, we have to write the ENDUOWRM. writeENDUOWRM(COMMIT); writeSQLCARDs(e, 0); errorInChain(e); } break; case CodePoint.RDBRLLBCK: try { if (SanityManager.DEBUG) trace("Received rollback"); database.getConnection().clearWarnings(); database.rollback(); writeENDUOWRM(ROLLBACK); checkWarning(database.getConnection(), null, null, 0, true, true); // we only want to write one of these per transaction // so set to false in preparation for next command database.RDBUPDRM_sent = false; } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); // Even in case of error, we have to write the ENDUOWRM. writeENDUOWRM(ROLLBACK); writeSQLCARDs(e, 0); errorInChain(e); } break; case CodePoint.CLSQRY: try{ stmt = parseCLSQRY(); stmt.rsClose(); writeSQLCARDs(null, 0); } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); writeSQLCARDs(e, 0); errorInChain(e); } break; case CodePoint.EXCSAT: parseEXCSAT2(); writeEXCSATRD(); break; /* since we don't support sqlj, we won't get bind commands from jcc, we * might get it from ccc; just skip them. */ case CodePoint.BGNBND: reader.skipBytes(); writeSQLCARDs(null, 0); break; case CodePoint.BNDSQLSTT: reader.skipBytes(); parseSQLSTTDss(); writeSQLCARDs(null, 0); break; case CodePoint.SQLSTTVRB: // optional reader.skipBytes(); break; case CodePoint.ENDBND: reader.skipBytes(); writeSQLCARDs(null, 0); break; case CodePoint.DSCSQLSTT: if (PRPSQLSTTfailed) { reader.skipBytes(); writeSQLCARDs(null, 0); break; } try { boolean rtnOutput = parseDSCSQLSTT(); writeSQLDARD(database.getCurrentStatement(), rtnOutput, null); } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); server.consoleExceptionPrint(e); try { writeSQLDARD(database.getCurrentStatement(), true, e); } catch (SQLException e2) { // should not get here since doing nothing with ps agentError("Why am I getting another SQLException?"); } errorInChain(e); } break; case CodePoint.EXCSQLSTT: if (PRPSQLSTTfailed) { // Skip parameters too if they are chained Beetle 4867 skipRemainder(true); writeSQLCARDs(null, 0); break; } try { parseEXCSQLSTT(); DRDAStatement curStmt = database.getCurrentStatement(); if (curStmt != null) curStmt.rsSuspend(); } catch (SQLException e) { writer.clearDSSesBackToMark(writerMark); if (SanityManager.DEBUG) { server.consoleExceptionPrint(e); } writeSQLCARDs(e, 0); errorInChain(e); } break; default: codePointNotSupported(codePoint); } // Set the correct chaining bits for whatever // reply DSS(es) we just wrote. If we've reached // the end of the chain, this method will send // the DSS(es) across. finalizeChain(); } while (reader.isChainedWithSameID() || reader.isChainedWithDiffID()); } /** * If there's a severe error in the DDM chain, and if the header indicates * "terminate chain on error", we stop processing further commands in the chain * nor do we send any reply for them. In accordance to this, a SQLERRRM message * indicating the severe error must have been sent! (otherwise application requestor, * such as JCC, would not terminate the receiving of chain replies.) * * Each DRDA command is processed independently. DRDA defines no interdependencies * across chained commands. A command is processed the same when received within * a set of chained commands or received separately. The chaining was originally * defined as a way to save network costs. * * @param the SQLException raised * @exception DRDAProtocolException */ private void errorInChain(SQLException e) throws DRDAProtocolException { if (reader.terminateChainOnErr() && (getExceptionSeverity(e) > CodePoint.SVRCOD_ERROR)) { if (SanityManager.DEBUG) trace("terminating the chain on error..."); skipRemainder(false); } } /** * Exchange server attributes with application requester * * @return true if the session was started successfully; false otherwise * @exception DRDAProtocolException, SQLException */ private boolean exchangeServerAttributes() throws DRDAProtocolException, SQLException { int codePoint; boolean sessionOK = true; correlationID = reader.readDssHeader(); if (SanityManager.DEBUG) { if (correlationID == 0) { SanityManager.THROWASSERT( "Unexpected value for correlationId = " + correlationID); } } codePoint = reader.readLengthAndCodePoint(); // The first code point in the exchange of attributes must be EXCSAT if (codePoint != CodePoint.EXCSAT) { //Throw PRCCNVRM throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_PRCCNVRM, this, codePoint, CodePoint.PRCCNVCD_EXCSAT_FIRST_AFTER_CONN); } // set up a new Application Requester to store information about the // application requester for this session appRequester = new AppRequester(); parseEXCSAT(); writeEXCSATRD(); finalizeChain(); //we may have to do the access security more than once if we don't //provide the requested security mechanism or we run into errors //if we don't know the requested security mechanism //we'll send our known security mechanisms and the requester will pick //if he picks one that requires a security token then another ACCSEC //will flow int securityCheckCode = 0; boolean notdone = true; while (notdone) { correlationID = reader.readDssHeader(); codePoint = reader.readLengthAndCodePoint(); verifyInOrderACCSEC_SECCHK(codePoint,CodePoint.ACCSEC); securityCheckCode = parseACCSEC(); // need security token if (securityCheckCode == 0 && database.securityMechanism == CodePoint.SECMEC_EUSRIDPWD && database.publicKeyIn == null) securityCheckCode = CodePoint.SECCHKCD_SECTKNMISSING; // shouldn't have security token if (securityCheckCode == 0 && database.securityMechanism == CodePoint.SECMEC_USRIDPWD && database.publicKeyIn != null) securityCheckCode = CodePoint.SECCHKCD_SECTKNMISSING; if (SanityManager.DEBUG) trace("** ACCSECRD securityCheckCode is: "+securityCheckCode); writeACCSECRD(securityCheckCode); // everything is O.K., we're done if (securityCheckCode == 0) { notdone = false; } } correlationID = reader.readDssHeader(); codePoint = reader.readLengthAndCodePoint(); verifyInOrderACCSEC_SECCHK(codePoint,CodePoint.SECCHK); securityCheckCode = parseSECCHK(); if (SanityManager.DEBUG) trace("*** SECCHKRM securityCheckCode is: "+securityCheckCode); writeSECCHKRM(securityCheckCode); //at this point if the security check failed, we're done, the session failed if (securityCheckCode != 0) { return false; } correlationID = reader.readDssHeader(); codePoint = reader.readLengthAndCodePoint(); verifyRequiredObject(codePoint,CodePoint.ACCRDB); int svrcod = parseACCRDB(); //if earlier we couldn't access the database if (databaseAccessException != null) { //if the Database was not found we will try DS int failureType = getRdbAccessErrorCodePoint(); if (failureType == CodePoint.RDBNFNRM || failureType == CodePoint.RDBATHRM) { writeRDBfailure(failureType); writeSQLCARD(databaseAccessException, CodePoint.SVRCOD_ERROR,0,0); } else { writeRDBfailure(CodePoint.RDBAFLRM); // RDBAFLRM requires TYPDEFNAM and TYPDEFOVR writer.createDssObject(); writer.writeScalarString(CodePoint.TYPDEFNAM, CodePoint.TYPDEFNAM_QTDSQLASC); writeTYPDEFOVR(); writer.endDss(); // Finally, per DDM spec, "an SQLCARD always follows // the RDBAFLRM". writeSQLCARD(databaseAccessException, CodePoint.SVRCOD_ERROR,0,0); } // Ignore anything that was chained to the ACCRDB. skipRemainder(false); // Finalize chain state for whatever we wrote in // response to ACCRDB. finalizeChain(); return false; } else if (database.accessCount > 1 ) // already in conversation with database { writeRDBfailure(CodePoint.RDBACCRM); // Ignore anything that was chained to the ACCRDB. skipRemainder(false); // Finalize chain state for RDBACCRM finalizeChain(); return false; } else // everything is fine writeACCRDBRM(svrcod); // compare this application requester with previously stored // application requesters and if we have already seen this one // use stored application requester session.appRequester = server.getAppRequester(appRequester); return sessionOK; } /** * Write RDB Failure * * Instance Variables * SVRCOD - Severity Code - required * RDBNAM - Relational Database name - required * SRVDGN - Server Diagnostics - optional (not sent for now) * * @param codePoint codepoint of failure */ private void writeRDBfailure(int codePoint) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(codePoint); writer.writeScalar2Bytes(CodePoint.SVRCOD, CodePoint.SVRCOD_ERROR); writeRDBNAM(database.dbName); writer.endDdmAndDss(); } /* Check the database access exception and return the appropriate error codepoint. RDBNFNRM - Database not found RDBATHRM - Not Authorized RDBAFLRM - Access failure @return RDB Access codepoint */ private int getRdbAccessErrorCodePoint() { String sqlState = databaseAccessException.getSQLState(); if (sqlState.regionMatches(0,SQLState.DATABASE_NOT_FOUND,0,5) | sqlState.regionMatches(0,SQLState.NO_SUCH_DATABASE,0,5)) return CodePoint.RDBNFNRM; else if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5) || sqlState.regionMatches(0,SQLState.AUTH_INVALID_USER_NAME,0,5)) return CodePoint.RDBATHRM; else return CodePoint.RDBAFLRM; } /** * Verify userId and password * * Username and password is verified by making a connection to the * database * * @return security check code, 0 is O.K. * @exception DRDAProtocolException */ private int verifyUserIdPassword() throws DRDAProtocolException { databaseAccessException = null; int retSecChkCode = 0; String realName = database.dbName; //first strip off properties int endOfName = realName.indexOf(';'); if (endOfName != -1) realName = realName.substring(0, endOfName); retSecChkCode = getConnFromDatabaseName(); return retSecChkCode; } /** * Get connection from a database name * * Username and password is verified by making a connection to the * database * * @return security check code, 0 is O.K. * @exception DRDAProtocolException */ private int getConnFromDatabaseName() throws DRDAProtocolException { Properties p = new Properties(); databaseAccessException = null; p.put(Attribute.USERNAME_ATTR, database.userId); p.put(Attribute.PASSWORD_ATTR, database.password); //if we haven't got the correlation token yet, use session number for drdaID if (session.drdaID == null) session.drdaID = leftBrace + session.connNum + rightBrace; p.put(Attribute.DRDAID_ATTR, session.drdaID); try { Connection conn = server.cloudscapeDriver.connect(Attribute.PROTOCOL + database.dbName, p); conn.setAutoCommit(false); database.setConnection(conn); } catch (SQLException se) { String sqlState = se.getSQLState(); // need to set the security check code based on the reason the connection // was denied, Cloudscape doesn't say whether the userid or password caused // the problem, so we will just return userid invalid databaseAccessException = se; for (; se != null; se = se.getNextException()) { if (SanityManager.DEBUG) trace(se.getMessage()); println2Log(database.dbName, session.drdaID, se.getMessage()); } if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) return CodePoint.SECCHKCD_USERIDINVALID; return 0; } catch (Exception e) { // If cloudscape has shut down for some reason, // we will send an agent error and then try to // get the driver loaded again. We have to get // rid of the client first in case they are holding // the DriverManager lock. println2Log(database.dbName, session.drdaID, "Driver not loaded" + e.getMessage()); try { agentError("Driver not loaded"); } catch (DRDAProtocolException dpe) { // Retry starting the server before rethrowing // the protocol exception. Then hopfully all // will be well when they try again. try { server.startDB2j(); } catch (Exception re) { println2Log(database.dbName, session.drdaID, "Failed attempt to reload driver " +re.getMessage() ); } throw dpe; } } // Everything worked so log connection to the database. if (getLogConnections()) println2Log(database.dbName, session.drdaID, "Cloudscape Network Server connected to database " + database.dbName); return 0; } /** * Parses EXCSAT (Exchange Server Attributes) * Instance variables * EXTNAM(External Name) - optional * MGRLVLLS(Manager Levels) - optional * SPVNAM(Supervisor Name) - optional * SRVCLSNM(Server Class Name) - optional * SRVNAM(Server Name) - optional, ignorable * SRVRLSLV(Server Product Release Level) - optional, ignorable * * @exception DRDAProtocolException */ private void parseEXCSAT() throws DRDAProtocolException { int codePoint; String strVal; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.EXTNAM: appRequester.extnam = reader.readString(); if (SanityManager.DEBUG) trace("extName = " + appRequester.extnam); if (appRequester.extnam.length() > CodePoint.MAX_NAME) tooBig(CodePoint.EXTNAM); break; // optional case CodePoint.MGRLVLLS: parseMGRLVLLS(1); break; // optional case CodePoint.SPVNAM: appRequester.spvnam = reader.readString(); // This is specified as a null parameter so length should // be zero if (appRequester.spvnam != null) badObjectLength(CodePoint.SPVNAM); break; // optional case CodePoint.SRVNAM: appRequester.srvnam = reader.readString(); if (SanityManager.DEBUG) trace("serverName = " + appRequester.srvnam); if (appRequester.srvnam.length() > CodePoint.MAX_NAME) tooBig(CodePoint.SRVNAM); break; // optional case CodePoint.SRVRLSLV: appRequester.srvrlslv = reader.readString(); if (SanityManager.DEBUG) trace("serverlslv = " + appRequester.srvrlslv); if (appRequester.srvrlslv.length() > CodePoint.MAX_NAME) tooBig(CodePoint.SRVRLSLV); break; // optional case CodePoint.SRVCLSNM: appRequester.srvclsnm = reader.readString(); if (SanityManager.DEBUG) trace("serverClassName = " + appRequester.srvclsnm); if (appRequester.srvclsnm.length() > CodePoint.MAX_NAME) tooBig(CodePoint.SRVCLSNM); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } } /** * Parses EXCSAT2 (Exchange Server Attributes) * Instance variables * EXTNAM(External Name) - optional * MGRLVLLS(Manager Levels) - optional * SPVNAM(Supervisor Name) - optional * SRVCLSNM(Server Class Name) - optional * SRVNAM(Server Name) - optional, ignorable * SRVRLSLV(Server Product Release Level) - optional, ignorable * * @exception DRDAProtocolException * * This parses a second occurrence of an EXCSAT command * The target must ignore the values for extnam, srvclsnm, srvnam and srvrlslv. * I am also going to ignore spvnam since it should be null anyway. * Only new managers can be added. */ private void parseEXCSAT2() throws DRDAProtocolException { int codePoint; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.EXTNAM: case CodePoint.SRVNAM: case CodePoint.SRVRLSLV: case CodePoint.SRVCLSNM: case CodePoint.SPVNAM: reader.skipBytes(); break; // optional case CodePoint.MGRLVLLS: parseMGRLVLLS(2); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } } /** * Parse manager levels * Instance variables * MGRLVL - repeatable, required * CODEPOINT * CCSIDMGR - CCSID Manager * CMNAPPC - LU 6.2 Conversational Communications Manager * CMNSYNCPT - SNA LU 6.2 SyncPoint Conversational Communications Manager * CMNTCPIP - TCP/IP Communication Manager * DICTIONARY - Dictionary * RDB - Relational Database * RSYNCMGR - Resynchronization Manager * SECMGR - Security Manager * SQLAM - SQL Application Manager * SUPERVISOR - Supervisor * SYNCPTMGR - Sync Point Manager * VALUE * * On the second appearance of this codepoint, it can only add managers * * @param time 1 for first time this is seen, 2 for subsequent ones * @exception DRDAProtocolException * */ private void parseMGRLVLLS(int time) throws DRDAProtocolException { int manager, managerLevel; int currentLevel; // set up vectors to keep track of manager information unknownManagers = new Vector(); knownManagers = new Vector(); errorManagers = new Vector(); errorManagersLevel = new Vector(); if (SanityManager.DEBUG) trace("Manager Levels"); while (reader.moreDdmData()) { manager = reader.readNetworkShort(); managerLevel = reader.readNetworkShort(); if (CodePoint.isKnownManager(manager)) { knownManagers.addElement(new Integer(manager)); //if the manager level hasn't been set, set it currentLevel = appRequester.getManagerLevel(manager); if (currentLevel == appRequester.MGR_LEVEL_UNKNOWN) appRequester.setManagerLevel(manager, managerLevel); else { //if the level is still the same we'll ignore it if (currentLevel != managerLevel) { //keep a list of conflicting managers errorManagers.addElement(new Integer(manager)); errorManagersLevel.addElement(new Integer (managerLevel)); } } } else unknownManagers.addElement(new Integer(manager)); if (SanityManager.DEBUG) trace("Manager = " + java.lang.Integer.toHexString(manager) + " ManagerLevel " + managerLevel); } sqlamLevel = appRequester.getManagerLevel(CodePoint.SQLAM); // did we have any errors if (errorManagers.size() > 0) { Object [] oa = new Object[errorManagers.size()*2]; int j = 0; for (int i = 0; i < errorManagers.size(); i++) { oa[j++] = errorManagers.elementAt(i); oa[j++] = errorManagersLevel.elementAt(i); } throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_MGRLVLRM, this, 0, 0, oa); } } /** * Write reply to EXCSAT command * Instance Variables * EXTNAM - External Name (optional) * MGRLVLLS - Manager Level List (optional) * SRVCLSNM - Server Class Name (optional) - used by JCC * SRVNAM - Server Name (optional) * SRVRLSLV - Server Product Release Level (optional) * * @exception DRDAProtocolException */ private void writeEXCSATRD() throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.EXCSATRD); writer.writeScalarString(CodePoint.EXTNAM, server.att_extnam); //only reply with manager levels if we got sent some if (knownManagers != null && knownManagers.size() > 0) writeMGRLEVELS(); writer.writeScalarString(CodePoint.SRVCLSNM, server.att_srvclsnm); writer.writeScalarString(CodePoint.SRVNAM, server.ATT_SRVNAM); writer.writeScalarString(CodePoint.SRVRLSLV, server.att_srvrlslv); writer.endDdmAndDss(); } /** * Write manager levels * The target server must not provide information for any target * managers unless the source explicitly requests it. * For each manager class, if the target server's support level * is greater than or equal to the source server's level, then the source * server's level is returned for that class if the target server can operate * at the source's level; otherwise a level 0 is returned. If the target * server's support level is less than the source server's level, the * target server's level is returned for that class. If the target server * does not recognize the code point of a manager class or does not support * that class, it returns a level of 0. The target server then waits * for the next command or for the source server to terminate communications. * When the source server receives EXCSATRD, it must compare each of the entries * in the mgrlvlls parameter it received to the corresponding entries in the mgrlvlls * parameter it sent. If any level mismatches, the source server must decide * whether it can use or adjust to the lower level of target support for that manager * class. There are no architectural criteria for making this decision. * The source server can terminate communications or continue at the target * servers level of support. It can also attempt to use whatever * commands its user requests while receiving error reply messages for real * functional mismatches. * The manager levels the source server specifies or the target server * returns must be compatible with the manager-level dependencies of the specified * manangers. Incompatible manager levels cannot be specified. * Instance variables * MGRLVL - repeatable, required * CODEPOINT * CCSIDMGR - CCSID Manager * CMNAPPC - LU 6.2 Conversational Communications Manager * CMNSYNCPT - SNA LU 6.2 SyncPoint Conversational Communications Manager * CMNTCPIP - TCP/IP Communication Manager * DICTIONARY - Dictionary * RDB - Relational Database * RSYNCMGR - Resynchronization Manager * SECMGR - Security Manager * SQLAM - SQL Application Manager * SUPERVISOR - Supervisor * SYNCPTMGR - Sync Point Manager * XAMGR - XA manager * VALUE */ private void writeMGRLEVELS() throws DRDAProtocolException { int manager; int appLevel; int serverLevel; writer.startDdm(CodePoint.MGRLVLLS); for (int i = 0; i < knownManagers.size(); i++) { manager = ((Integer)knownManagers.elementAt(i)).intValue(); appLevel = appRequester.getManagerLevel(manager); serverLevel = server.getManagerLevel(manager); if (serverLevel >= appLevel) { //Note appLevel has already been set to 0 if we can't support //the original app Level writer.writeCodePoint4Bytes(manager, appLevel); } else { writer.writeCodePoint4Bytes(manager, serverLevel); // reset application manager level to server level appRequester.setManagerLevel(manager, serverLevel); } } // write 0 for all unknown managers for (int i = 0; i < unknownManagers.size(); i++) { manager = ((Integer)unknownManagers.elementAt(i)).intValue(); writer.writeCodePoint4Bytes(manager, 0); } writer.endDdm(); } /** * Parse Access Security * * If the target server supports the SECMEC requested by the application requester * then a single value is returned and it is identical to the SECMEC value * in the ACCSEC command. If the target server does not support the SECMEC * requested, then one or more values are returned and the application requester * must choose one of these values for the security mechanism. * We currently support * - user id and password (default for JCC) * - encrypted user id and password * * Instance variables * SECMGRNM - security manager name - optional * SECMEC - security mechanism - required * RDBNAM - relational database name - optional * SECTKN - security token - optional, (required if sec mech. needs it) * * @return security check code - 0 if everything O.K. */ private int parseACCSEC() throws DRDAProtocolException { int securityCheckCode = 0; int securityMechanism = 0; byte [] publicKeyIn = null; reader.markCollection(); int codePoint = reader.getCodePoint(); while (codePoint != -1) { switch(codePoint) { //optional case CodePoint.SECMGRNM: // this is defined to be 0 length if (reader.getDdmLength() != 0) badObjectLength(CodePoint.SECMGRNM); break; //required case CodePoint.SECMEC: checkLength(CodePoint.SECMEC, 2); securityMechanism = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("Security mechanism = " + securityMechanism); if (securityMechanism != server.DEFAULT_SECURITY_MECHANISM) { //this is the only other one we understand if (securityMechanism != CodePoint.SECMEC_EUSRIDPWD) securityCheckCode = CodePoint.SECCHKCD_NOTSUPPORTED; else { try { if (decryptionManager == null) decryptionManager = new DecryptionManager(); myPublicKey = decryptionManager.obtainPublicKey(); } catch (SQLException e) { println2Log(null, session.drdaID, e.getMessage()); // Local security service non-retryable error. securityCheckCode = CodePoint.SECCHKCD_0A; } } } break; //optional (currently required for Cloudscape - may need to revisit) case CodePoint.RDBNAM: String dbname = parseRDBNAM(); Database d = session.getDatabase(dbname); if (d == null) addDatabase(dbname); else database = d; break; //optional - depending on security Mechanism case CodePoint.SECTKN: publicKeyIn = reader.readBytes(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } // check for required CodePoint's if (securityMechanism == 0) missingCodePoint(CodePoint.SECMEC); // RESOLVE - when we look further into security we might want to // handle this part of the protocol at the session level without // requiring a database for when authentication is used but there // is no database level security if (database == null) missingCodePoint(CodePoint.RDBNAM); database.securityMechanism = securityMechanism; database.publicKeyIn = publicKeyIn; return securityCheckCode; } /** * Parse OPNQRY * Instance Variables * RDBNAM - relational database name - optional * PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required * QRYBLKSZ - Query Block Size - required * QRYBLKCTL - Query Block Protocol Control - optional * MAXBLKEXT - Maximum Number of Extra Blocks - optional - default value 0 * OUTOVROPT - Output Override Option * QRYROWSET - Query Rowset Size - optional - level 7 * MONITOR - Monitor events - optional. * * @return package name consistency token * @exception DRDAProtocolException */ private String parseOPNQRY() throws DRDAProtocolException, SQLException { String pkgnamcsn = null; boolean gotQryblksz = false; int blksize = 0; int qryblkctl = CodePoint.QRYBLKCTL_DEFAULT; int maxblkext = CodePoint.MAXBLKEXT_DEFAULT; int qryrowset = CodePoint.QRYROWSET_DEFAULT; int qryclsimp = CodePoint.QRYCLSIMP_DEFAULT; int outovropt = CodePoint.OUTOVRFRS; reader.markCollection(); int codePoint = reader.getCodePoint(); while (codePoint != -1) { switch(codePoint) { //optional case CodePoint.RDBNAM: setDatabase(CodePoint.OPNQRY); break; //required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); break; //required case CodePoint.QRYBLKSZ: blksize = parseQRYBLKSZ(); gotQryblksz = true; break; //optional case CodePoint.QRYBLKCTL: qryblkctl = reader.readNetworkShort(); //The only type of query block control we can specify here //is forced fixed row if (qryblkctl != CodePoint.FRCFIXROW) invalidCodePoint(qryblkctl); if (SanityManager.DEBUG) trace("!!qryblkctl = "+Integer.toHexString(qryblkctl)); gotQryblksz = true; break; //optional case CodePoint.MAXBLKEXT: maxblkext = reader.readSignedNetworkShort(); if (SanityManager.DEBUG) trace("maxblkext = "+maxblkext); break; // optional case CodePoint.OUTOVROPT: outovropt = parseOUTOVROPT(); break; //optional case CodePoint.QRYROWSET: //Note minimum for OPNQRY is 0 qryrowset = parseQRYROWSET(0); break; case CodePoint.QRYCLSIMP: // Implicitly close non-scrollable cursor qryclsimp = parseQRYCLSIMP(); break; case CodePoint.QRYCLSRLS: // Ignore release of read locks. Nothing we can do here parseQRYCLSRLS(); break; case CodePoint.QRYOPTVAL: // optimize for n rows. Not supported by cloudscape(ignore) parseQRYOPTVAL(); break; // optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } // check for required variables if (pkgnamcsn == null) missingCodePoint(CodePoint.PKGNAMCSN); if (!gotQryblksz) missingCodePoint(CodePoint.QRYBLKSZ); // get the statement we are opening DRDAStatement stmt = database.getDRDAStatement(pkgnamcsn); if (stmt == null) { //XXX should really throw a SQL Exception here invalidValue(CodePoint.PKGNAMCSN); } // check that this statement is not already open // commenting this check out for now // it turns out that JCC doesn't send a close if executeQuery is // done again without closing the previous result set // this check can't be done since the second executeQuery should work //if (stmt.state != DRDAStatement.NOT_OPENED) //{ // writeQRYPOPRM(); // pkgnamcsn = null; //} //else //{ stmt.setOPNQRYOptions(blksize,qryblkctl,maxblkext,outovropt, qryrowset, qryclsimp); //} // read the command objects // for ps with parameter if (reader.isChainedWithSameID()) { if (SanityManager.DEBUG) trace("&&&&&& parsing SQLDTA"); parseOPNQRYobjects(stmt); } return pkgnamcsn; } /** * Parse OPNQRY objects * Objects * TYPDEFNAM - Data type definition name - optional * TYPDEFOVR - Type defintion overrides - optional * SQLDTA- SQL Program Variable Data - optional * * If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects * sent with the statement. Once the statement is over, the default values * sent in the ACCRDB are once again in effect. If no values are supplied, * the values sent in the ACCRDB are used. * Objects may follow in one DSS or in several DSS chained together. * * @exception DRDAProtocolException, SQLException */ private void parseOPNQRYobjects(DRDAStatement stmt) throws DRDAProtocolException, SQLException { int codePoint; do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint(); switch(codePoint) { // optional case CodePoint.TYPDEFNAM: setStmtOrDbByteOrder(false, stmt, parseTYPDEFNAM()); break; // optional case CodePoint.TYPDEFOVR: parseTYPDEFOVR(stmt); break; // optional case CodePoint.SQLDTA: parseSQLDTA(stmt); break; // optional case CodePoint.EXTDTA: readAndSetAllExtParams(stmt); break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); } /** * Parse OUTOVROPT - this indicates whether output description can be * overridden on just the first CNTQRY or on any CNTQRY * * @return output override option * @exception DRDAProtocolException */ private int parseOUTOVROPT() throws DRDAProtocolException { checkLength(CodePoint.OUTOVROPT, 1); int outovropt = reader.readUnsignedByte(); if (SanityManager.DEBUG) trace("output override option: "+outovropt); if (outovropt != CodePoint.OUTOVRFRS && outovropt != CodePoint.OUTOVRANY) invalidValue(CodePoint.OUTOVROPT); return outovropt; } /** * Parse QRYBLSZ - this gives the maximum size of the query blocks that * can be returned to the requester * * @return query block size * @exception DRDAProtocolException */ private int parseQRYBLKSZ() throws DRDAProtocolException { checkLength(CodePoint.QRYBLKSZ, 4); int blksize = reader.readNetworkInt(); if (SanityManager.DEBUG) trace("qryblksz = "+blksize); if (blksize < CodePoint.QRYBLKSZ_MIN || blksize > CodePoint.QRYBLKSZ_MAX) invalidValue(CodePoint.QRYBLKSZ); return blksize; } /** * Parse QRYROWSET - this is the number of rows to return * * @param minVal - minimum value * @return query row set size * @exception DRDAProtocolException */ private int parseQRYROWSET(int minVal) throws DRDAProtocolException { checkLength(CodePoint.QRYROWSET, 4); int qryrowset = reader.readNetworkInt(); if (SanityManager.DEBUG) trace("qryrowset = " + qryrowset); if (qryrowset < minVal || qryrowset > CodePoint.QRYROWSET_MAX) invalidValue(CodePoint.QRYROWSET); return qryrowset; } /** Parse a QRYCLSIMP - Implicitly close non-scrollable cursor * after end of data. * @return true to close on end of data */ private int parseQRYCLSIMP() throws DRDAProtocolException { checkLength(CodePoint.QRYCLSIMP, 1); int qryclsimp = reader.readUnsignedByte(); if (SanityManager.DEBUG) trace ("qryclsimp = " + qryclsimp); if (qryclsimp != CodePoint.QRYCLSIMP_SERVER_CHOICE && qryclsimp != CodePoint.QRYCLSIMP_YES && qryclsimp != CodePoint.QRYCLSIMP_NO ) invalidValue(CodePoint.QRYCLSIMP); return qryclsimp; } private int parseQRYCLSRLS() throws DRDAProtocolException { reader.skipBytes(); return 0; } private int parseQRYOPTVAL() throws DRDAProtocolException { reader.skipBytes(); return 0; } /** * Write a QRYPOPRM - Query Previously opened * Instance Variables * SVRCOD - Severity Code - required - 8 ERROR * RDBNAM - Relational Database Name - required * PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required * * @exception DRDAProtocolException */ private void writeQRYPOPRM() throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.QRYPOPRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, CodePoint.SVRCOD_ERROR); writeRDBNAM(database.dbName); writePKGNAMCSN(); writer.endDdmAndDss(); } /** * Write a QRYNOPRM - Query Not Opened * Instance Variables * SVRCOD - Severity Code - required - 4 Warning 8 ERROR * RDBNAM - Relational Database Name - required * PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required * * @param svrCod Severity Code * @exception DRDAProtocolException */ private void writeQRYNOPRM(int svrCod) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.QRYNOPRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, svrCod); writeRDBNAM(database.dbName); writePKGNAMCSN(); writer.endDdmAndDss(); } /** * Write a OPNQFLRM - Open Query Failure * Instance Variables * SVRCOD - Severity Code - required - 8 ERROR * RDBNAM - Relational Database Name - required * * @param e Exception describing failure * * @exception DRDAProtocolException */ private void writeOPNQFLRM(SQLException e) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.OPNQFLRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, CodePoint.SVRCOD_ERROR); writeRDBNAM(database.dbName); writer.endDdm(); writer.startDdm(CodePoint.SQLCARD); writeSQLCAGRP(e, getSqlCode(getExceptionSeverity(e)), 0, 0); writer.endDdmAndDss(); } /** * Write PKGNAMCSN * Instance Variables * NAMESYMDR - database name - not validated * RDBCOLID - RDB Collection Identifier * PKGID - RDB Package Identifier * PKGCNSTKN - RDB Package Consistency Token * PKGSN - RDB Package Section Number * * There are two possible formats, fixed and extended which includes length * information for the strings * * @exception throws DRDAProtocolException */ private void writePKGNAMCSN(String pkgcnstknStr) throws DRDAProtocolException { writer.startDdm(CodePoint.PKGNAMCSN); if (rdbcolid.length() == CodePoint.RDBCOLID_LEN && rdbnam.length() <= CodePoint.RDBNAM_LEN) { //fixed format writer.writeScalarPaddedString(rdbnam, CodePoint.RDBNAM_LEN); writer.writeScalarPaddedString(rdbcolid, CodePoint.RDBCOLID_LEN); writer.writeScalarPaddedString(pkgid, CodePoint.PKGID_LEN); writer.writeScalarPaddedString(pkgcnstknStr, CodePoint.PKGCNSTKN_LEN); writer.writeShort(secnumber); } else // extended format { writer.writeShort(rdbnam.length()); writer.writeScalarPaddedString(rdbnam, rdbnam.length()); writer.writeShort(rdbcolid.length()); writer.writeScalarPaddedString(rdbcolid, rdbcolid.length()); writer.writeShort(pkgid.length()); writer.writeScalarPaddedString(pkgid, pkgid.length()); writer.writeScalarPaddedString(pkgcnstknStr, CodePoint.PKGCNSTKN_LEN); writer.writeShort(secnumber); } writer.endDdm(); } private void writePKGNAMCSN() throws DRDAProtocolException { writePKGNAMCSN(pkgcnstknStr); } /** * Parse CNTQRY - Continue Query * Instance Variables * RDBNAM - Relational Database Name - optional * PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required * QRYBLKSZ - Query Block Size - required * QRYRELSCR - Query Relative Scrolling Action - optional * QRYSCRORN - Query Scroll Orientation - optional - level 7 * QRYROWNBR - Query Row Number - optional * QRYROWSNS - Query Row Sensitivity - optional - level 7 * QRYBLKRST - Query Block Reset - optional - level 7 * QRYRTNDTA - Query Returns Data - optional - level 7 * QRYROWSET - Query Rowset Size - optional - level 7 * QRYRFRTBL - Query Refresh Answer Set Table - optional * NBRROW - Number of Fetch or Insert Rows - optional * MAXBLKEXT - Maximum number of extra blocks - optional * RTNEXTDTA - Return of EXTDTA Option - optional * MONITOR - Monitor events - optional. * * @return DRDAStatement we are continuing * @exception DRDAProtocolException, SQLException */ private DRDAStatement parseCNTQRY() throws DRDAProtocolException, SQLException { byte val; String pkgnamcsn = null; boolean gotQryblksz = false; boolean qryrelscr = true; long qryrownbr = 1; boolean qryrfrtbl = false; int nbrrow = 1; int blksize = 0; int maxblkext = -1; long qryinsid; boolean gotQryinsid = false; int qryscrorn = CodePoint.QRYSCRREL; boolean qryrowsns = false; boolean gotQryrowsns = false; boolean qryblkrst = false; boolean qryrtndta = true; int qryrowset = CodePoint.QRYROWSET_DEFAULT; int rtnextdta = CodePoint.RTNEXTROW; reader.markCollection(); int codePoint = reader.getCodePoint(); while (codePoint != -1) { switch(codePoint) { //optional case CodePoint.RDBNAM: setDatabase(CodePoint.CNTQRY); break; //required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); break; //required case CodePoint.QRYBLKSZ: blksize = parseQRYBLKSZ(); gotQryblksz = true; break; //optional case CodePoint.QRYRELSCR: qryrelscr = readBoolean(CodePoint.QRYRELSCR); if (SanityManager.DEBUG) trace("qryrelscr = "+qryrelscr); break; //optional case CodePoint.QRYSCRORN: checkLength(CodePoint.QRYSCRORN, 1); qryscrorn = reader.readUnsignedByte(); if (SanityManager.DEBUG) trace("qryscrorn = "+qryscrorn); switch (qryscrorn) { case CodePoint.QRYSCRREL: case CodePoint.QRYSCRABS: case CodePoint.QRYSCRAFT: case CodePoint.QRYSCRBEF: break; default: invalidValue(CodePoint.QRYSCRORN); } break; //optional case CodePoint.QRYROWNBR: checkLength(CodePoint.QRYROWNBR, 8); qryrownbr = reader.readNetworkLong(); if (SanityManager.DEBUG) trace("qryrownbr = "+qryrownbr); break; //optional case CodePoint.QRYROWSNS: checkLength(CodePoint.QRYROWSNS, 1); qryrowsns = readBoolean(CodePoint.QRYROWSNS); if (SanityManager.DEBUG) trace("qryrowsns = "+qryrowsns); gotQryrowsns = true; break; //optional case CodePoint.QRYBLKRST: checkLength(CodePoint.QRYBLKRST, 1); qryblkrst = readBoolean(CodePoint.QRYBLKRST); if (SanityManager.DEBUG) trace("qryblkrst = "+qryblkrst); break; //optional case CodePoint.QRYRTNDTA: qryrtndta = readBoolean(CodePoint.QRYRTNDTA); if (SanityManager.DEBUG) trace("qryrtndta = "+qryrtndta); break; //optional case CodePoint.QRYROWSET: //Note minimum for CNTQRY is 1 qryrowset = parseQRYROWSET(1); if (SanityManager.DEBUG) trace("qryrowset = "+qryrowset); break; //optional case CodePoint.QRYRFRTBL: qryrfrtbl = readBoolean(CodePoint.QRYRFRTBL); if (SanityManager.DEBUG) trace("qryrfrtbl = "+qryrfrtbl); break; //optional case CodePoint.NBRROW: checkLength(CodePoint.NBRROW, 4); nbrrow = reader.readNetworkInt(); if (SanityManager.DEBUG) trace("nbrrow = "+nbrrow); break; //optional case CodePoint.MAXBLKEXT: checkLength(CodePoint.MAXBLKEXT, 2); maxblkext = reader.readSignedNetworkShort(); if (SanityManager.DEBUG) trace("maxblkext = "+maxblkext); break; //optional case CodePoint.RTNEXTDTA: checkLength(CodePoint.RTNEXTDTA, 1); rtnextdta = reader.readUnsignedByte(); if (rtnextdta != CodePoint.RTNEXTROW && rtnextdta != CodePoint.RTNEXTALL) invalidValue(CodePoint.RTNEXTDTA); if (SanityManager.DEBUG) trace("rtnextdta = "+rtnextdta); break; // required for SQLAM >= 7 case CodePoint.QRYINSID: checkLength(CodePoint.QRYINSID, 8); qryinsid = reader.readNetworkLong(); gotQryinsid = true; if (SanityManager.DEBUG) trace("qryinsid = "+qryinsid); break; // optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } // check for required variables if (pkgnamcsn == null) missingCodePoint(CodePoint.PKGNAMCSN); if (!gotQryblksz) missingCodePoint(CodePoint.QRYBLKSZ); if (sqlamLevel >= MGRLVL_7 && !gotQryinsid) missingCodePoint(CodePoint.QRYINSID); // get the statement we are continuing DRDAStatement stmt = database.getDRDAStatement(pkgnamcsn); if (stmt == null) { //XXX should really throw a SQL Exception here invalidValue(CodePoint.CNTQRY); } if (stmt.rsIsClosed()) { writeQRYNOPRM(CodePoint.SVRCOD_ERROR); skipRemainder(true); return null; } stmt.setQueryOptions(blksize,qryrelscr,qryrownbr,qryrfrtbl,nbrrow,maxblkext, qryscrorn,qryrowsns,qryblkrst,qryrtndta,qryrowset, rtnextdta); if (reader.isChainedWithSameID()) parseCNTQRYobjects(stmt); return stmt; } /** * Skip remainder of current DSS and all chained DSS'es * * @param onlySkipSameIds True if we _only_ want to skip DSS'es * that are chained with the SAME id as the current DSS. * False means skip ALL chained DSSes, whether they're * chained with same or different ids. * @exception DRDAProtocolException */ private void skipRemainder(boolean onlySkipSameIds) throws DRDAProtocolException { reader.skipDss(); while (reader.isChainedWithSameID() || (!onlySkipSameIds && reader.isChainedWithDiffID())) { reader.readDssHeader(); reader.skipDss(); } } /** * Parse CNTQRY objects * Instance Variables * OUTOVR - Output Override Descriptor - optional * * @param stmt DRDA statement we are working on * @exception DRDAProtocolException */ private void parseCNTQRYobjects(DRDAStatement stmt) throws DRDAProtocolException, SQLException { int codePoint; do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint(); switch(codePoint) { // optional case CodePoint.OUTOVR: parseOUTOVR(stmt); break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); } /** * Parse OUTOVR - Output Override Descriptor * This specifies the output format for data to be returned as output to a SQL * statement or as output from a query. * * @param stmt DRDA statement this applies to * @exception DRDAProtocolException */ private void parseOUTOVR(DRDAStatement stmt) throws DRDAProtocolException, SQLException { boolean first = true; int numVars; int dtaGrpLen; int tripType; int tripId; int precision; int start = 0; while (true) { dtaGrpLen = reader.readUnsignedByte(); tripType = reader.readUnsignedByte(); tripId = reader.readUnsignedByte(); // check if we have reached the end of the data if (tripType == FdocaConstants.RLO_TRIPLET_TYPE) { //read last part of footer reader.skipBytes(); break; } numVars = (dtaGrpLen - 3) / 3; if (SanityManager.DEBUG) trace("num of vars is: "+numVars); int[] outovr_drdaType = null; if (first) { outovr_drdaType = new int[numVars]; first = false; } else { int[] oldoutovr_drdaType = stmt.getOutovr_drdaType(); int oldlen = oldoutovr_drdaType.length; // create new array and copy over already read stuff outovr_drdaType = new int[oldlen + numVars]; System.arraycopy(oldoutovr_drdaType, 0, outovr_drdaType,0, oldlen); start = oldlen; } for (int i = start; i < numVars + start; i++) { outovr_drdaType[i] = reader.readUnsignedByte(); if (SanityManager.DEBUG) trace("drdaType is: "+ outovr_drdaType[i]); precision = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("drdaLength is: "+precision); outovr_drdaType[i] |= (precision << 8); } stmt.setOutovr_drdaType(outovr_drdaType); } } /** * Write OPNQRYRM - Open Query Complete * Instance Variables * SVRCOD - Severity Code - required * QRYPRCTYP - Query Protocol Type - required * SQLCSRHLD - Hold Cursor Position - optional * QRYATTSCR - Query Attribute for Scrollability - optional - level 7 * QRYATTSNS - Query Attribute for Sensitivity - optional - level 7 * QRYATTUPD - Query Attribute for Updatability -optional - level 7 * QRYINSID - Query Instance Identifier - required - level 7 * SRVDGN - Server Diagnostic Information - optional * * @param isDssObject - return as a DSS object (part of a reply) * @param stmt - DRDA statement we are processing * * @exception DRDAProtocolException */ private void writeOPNQRYRM(boolean isDssObject, DRDAStatement stmt) throws DRDAProtocolException, SQLException { if (SanityManager.DEBUG) trace("WriteOPNQRYRM"); if (isDssObject) writer.createDssObject(); else writer.createDssReply(); writer.startDdm(CodePoint.OPNQRYRM); writer.writeScalar2Bytes(CodePoint.SVRCOD,CodePoint.SVRCOD_INFO); // There is currently a problem specifying LMTBLKPRC for LOBs with JCC // JCC will throw an ArrayOutOfBounds exception. Once this is fixed, we // don't need to pass the two arguments for getQryprctyp. int prcType = stmt.getQryprctyp(); if (SanityManager.DEBUG) trace("sending QRYPRCTYP: " + prcType); writer.writeScalar2Bytes(CodePoint.QRYPRCTYP, prcType); //pass the SQLCSRHLD codepoint only if statement has hold cursors over commit set if (stmt.withHoldCursor == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) writer.writeScalar1Byte(CodePoint.SQLCSRHLD, CodePoint.TRUE); if (sqlamLevel >= MGRLVL_7) { writer.writeScalarHeader(CodePoint.QRYINSID, 8); //This is implementer defined. DB2 uses this for the nesting level //of the query. A query from an application would be nesting level 0, //from a stored procedure, nesting level 1, from a recursive call of //a stored procedure, nesting level 2, etc. writer.writeInt(0); //This is a unique sequence number per session writer.writeInt(session.qryinsid++); //Write the scroll attributes if they are set if (stmt.getScrollType() != 0) { writer.writeScalar1Byte(CodePoint.QRYATTSCR, CodePoint.TRUE); //Cloudscape only supports insensitive scroll cursors writer.writeScalar1Byte(CodePoint.QRYATTSNS, CodePoint.QRYINS); //Cloudscape only supports read only scrollable cursors writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYRDO); } else { if (stmt.getConcurType() == ResultSet.CONCUR_UPDATABLE) writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYUPD); else writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYRDO); } } writer.endDdmAndDss (); } /** * Write ENDQRYRM - query process has terminated in such a manner that the * query or result set is now closed. It cannot be resumed with the CNTQRY * command or closed with the CLSQRY command * @param srvCod Severity code - WARNING or ERROR * @exception DRDAProtocolException */ private void writeENDQRYRM(int svrCod) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.ENDQRYRM); writer.writeScalar2Bytes(CodePoint.SVRCOD,svrCod); writer.endDdmAndDss(); } /** * Write ABNUOWRM - query process has terminated in an error condition * such as deadlock or lock timeout. * Severity code is always error * * @exception DRDAProtocolException */ private void writeABNUOWRM() throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.ABNUOWRM); writer.writeScalar2Bytes(CodePoint.SVRCOD,CodePoint.SVRCOD_ERROR); writeRDBNAM(database.dbName); writer.endDdmAndDss(); } /** * Parse database name * * @return database name * * @exception DRDAProtocolException */ private String parseRDBNAM() throws DRDAProtocolException { String name; byte [] rdbName = reader.readBytes(); if (rdbName.length == 0) { // throw RDBNFNRM rdbNotFound(null); } //SQLAM level 7 allows db name up to 255, level 6 fixed len 18 if (rdbName.length < CodePoint.RDBNAM_LEN || rdbName.length > CodePoint.MAX_NAME) badObjectLength(CodePoint.RDBNAM); name = reader.convertBytes(rdbName); // trim trailing blanks from the database name name = name.trim(); if (SanityManager.DEBUG) trace("RdbName " + name); return name; } /** * Write ACCSECRD * If the security mechanism is known, we just send it back along with * the security token if encryption is going to be used. * If the security mechanism is not known, we send a list of the ones * we know. * Instance Variables * SECMEC - security mechanism - required * SECTKN - security token - optional (required if security mechanism * uses encryption) * SECCHKCD - security check code - error occurred in processing ACCSEC * * @param securityCheckCode * * @exception DRDAProtocolException */ private void writeACCSECRD(int securityCheckCode) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.ACCSECRD); if (securityCheckCode != CodePoint.SECCHKCD_NOTSUPPORTED) writer.writeScalar2Bytes(CodePoint.SECMEC, database.securityMechanism); else { // these are the ones we know about writer.writeScalar2Bytes(CodePoint.SECMEC, CodePoint.SECMEC_USRIDPWD); writer.writeScalar2Bytes(CodePoint.SECMEC, CodePoint.SECMEC_EUSRIDPWD); } if (securityCheckCode != 0) { writer.writeScalar1Byte(CodePoint.SECCHKCD, securityCheckCode); } else { // we need to send back the key if encryption is being used if (database.securityMechanism == CodePoint.SECMEC_EUSRIDPWD) writer.writeScalarBytes(CodePoint.SECTKN, myPublicKey); } writer.endDdmAndDss (); if (securityCheckCode != 0) { // then we have an error and so can ignore the rest of the // DSS request chain. skipRemainder(false); } finalizeChain(); } /** * Parse security check * Instance Variables * SECMGRNM - security manager name - optional, ignorable * SECMEC - security mechanism - required * SECTKN - security token - optional, (required if encryption used) * PASSWORD - password - optional, (required if security mechanism uses it) * NEWPASSWORD - new password - optional, (required if sec mech. uses it) * USRID - user id - optional, (required if sec mec. uses it) * RDBNAM - database name - optional (required if databases can have own sec.) * * * @return security check code * @exception DRDAProtocolException */ private int parseSECCHK() throws DRDAProtocolException { int codePoint, securityCheckCode = 0; int securityMechanism = 0; databaseAccessException = null; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { //optional, ignorable case CodePoint.SECMGRNM: reader.skipBytes(); break; //required case CodePoint.SECMEC: checkLength(CodePoint.SECMEC, 2); securityMechanism = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("Security mechanism = " + securityMechanism); //RESOLVE - spec is not clear on what should happen //in this case if (securityMechanism != database.securityMechanism) invalidValue(CodePoint.SECMEC); break; //optional - depending on security Mechanism case CodePoint.SECTKN: if (database.securityMechanism != CodePoint.SECMEC_EUSRIDPWD) { securityCheckCode = CodePoint.SECCHKCD_SECTKNMISSING; reader.skipBytes(); } else if (database.decryptedUserId == null) { try { database.decryptedUserId = reader.readEncryptedString(decryptionManager, database.securityMechanism, myPublicKey, database.publicKeyIn); } catch (SQLException se) { println2Log(database.dbName, session.drdaID, se.getMessage()); if (securityCheckCode == 0) securityCheckCode = CodePoint.SECCHKCD_13; //userid invalid } database.userId = database.decryptedUserId; if (SanityManager.DEBUG) trace("**decrypted userid is: "+database.userId); } else if (database.decryptedPassword == null) { try { database.decryptedPassword = reader.readEncryptedString(decryptionManager, database.securityMechanism, myPublicKey, database.publicKeyIn); } catch (SQLException se) { println2Log(database.dbName, session.drdaID, se.getMessage()); if (securityCheckCode == 0) securityCheckCode = CodePoint.SECCHKCD_0F; //password invalid } database.password = database.decryptedPassword; if (SanityManager.DEBUG) trace("**decrypted password is: "+database.password); } else { tooMany(CodePoint.SECTKN); } break; //optional - depending on security Mechanism case CodePoint.PASSWORD: database.password = reader.readString(); if (SanityManager.DEBUG) trace("PASSWORD " + database.password); break; //optional - depending on security Mechanism //we are not supporting this method so we'll skip bytes case CodePoint.NEWPASSWORD: reader.skipBytes(); break; //optional - depending on security Mechanism case CodePoint.USRID: database.userId = reader.readString(); if (SanityManager.DEBUG) trace("USERID " + database.userId); break; //optional - depending on security Mechanism case CodePoint.RDBNAM: String dbname = parseRDBNAM(); if (database != null) { if (!database.dbName.equals(dbname)) rdbnamMismatch(CodePoint.SECCHK); } else { // we should already have added the database in ACCSEC // added code here in case we make the SECMEC session rather // than database wide addDatabase(dbname); } break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } // check for SECMEC which is required if (securityMechanism == 0) missingCodePoint(CodePoint.SECMEC); //check if we have a userid and password when we need it if (securityCheckCode == 0 && database.securityMechanism == CodePoint.SECMEC_USRIDPWD) { if (database.userId == null) securityCheckCode = CodePoint.SECCHKCD_USERIDMISSING; else if (database.password == null) securityCheckCode = CodePoint.SECCHKCD_PASSWORDMISSING; //Note, we'll ignore encryptedUserId and encryptedPassword if they //are also set } if (securityCheckCode == 0 && database.securityMechanism == CodePoint.SECMEC_EUSRIDPWD) { if (database.decryptedUserId == null) securityCheckCode = CodePoint.SECCHKCD_USERIDMISSING; else if (database.decryptedPassword == null) securityCheckCode = CodePoint.SECCHKCD_PASSWORDMISSING; } // RESOLVE - when we do security we need to decrypt encrypted userid & password // before proceeding // verify userid and password, if we haven't had any errors thus far. if ((securityCheckCode == 0) && (databaseAccessException == null)) { securityCheckCode = verifyUserIdPassword(); } return securityCheckCode; } /** * Write security check reply * Instance variables * SVRCOD - serverity code - required * SECCHKCD - security check code - required * SECTKN - security token - optional, ignorable * SVCERRNO - security service error number * SRVDGN - Server Diagnostic Information * * @exception DRDAProtocolException */ private void writeSECCHKRM(int securityCheckCode) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.SECCHKRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, svrcodFromSecchkcd(securityCheckCode)); writer.writeScalar1Byte(CodePoint.SECCHKCD, securityCheckCode); writer.endDdmAndDss (); if (securityCheckCode != 0) { // then we have an error and are going to end up ignoring the rest // of the DSS request chain. skipRemainder(false); } finalizeChain(); } /** * Calculate SVRCOD value from SECCHKCD * * @param securityCheckCode * @return SVRCOD value */ private int svrcodFromSecchkcd(int securityCheckCode) { if (securityCheckCode == 0 || securityCheckCode == 2 || securityCheckCode == 5 || securityCheckCode == 8) return CodePoint.SVRCOD_INFO; else return CodePoint.SVRCOD_ERROR; } /** * Parse access RDB * Instance variables * RDBACCCL - RDB Access Manager Class - required must be SQLAM * CRRTKN - Correlation Token - required * RDBNAM - Relational database name -required * PRDID - Product specific identifier - required * TYPDEFNAM - Data Type Definition Name -required * TYPDEFOVR - Type definition overrides -required * RDBALWUPD - RDB Allow Updates optional * PRDDTA - Product Specific Data - optional - ignorable * STTDECDEL - Statement Decimal Delimiter - optional * STTSTRDEL - Statement String Delimiter - optional * TRGDFTRT - Target Default Value Return - optional * * @return severity code * * @exception DRDAProtocolException */ private int parseACCRDB() throws DRDAProtocolException { int codePoint; int svrcod = 0; copyToRequired(ACCRDB_REQUIRED); reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { //required case CodePoint.RDBACCCL: checkLength(CodePoint.RDBACCCL, 2); int sqlam = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("RDBACCCL = " + sqlam); // required to be SQLAM if (sqlam != CodePoint.SQLAM) invalidValue(CodePoint.RDBACCCL); removeFromRequired(CodePoint.RDBACCCL); break; //required case CodePoint.CRRTKN: database.crrtkn = reader.readBytes(); if (SanityManager.DEBUG) trace("crrtkn " + convertToHexString(database.crrtkn)); removeFromRequired(CodePoint.CRRTKN); int l = database.crrtkn.length; if (l > CodePoint.MAX_NAME) tooBig(CodePoint.CRRTKN); // the format of the CRRTKN is defined in the DRDA reference // x.yz where x is 1 to 8 bytes (variable) // y is 1 to 8 bytes (variable) // x is 6 bytes fixed // size is variable between 9 and 23 if (l < 9 || l > 23) invalidValue(CodePoint.CRRTKN); byte[] part1 = new byte[l - 6]; for (int i = 0; i < part1.length; i++) part1[i] = database.crrtkn[i]; long time = SignedBinary.getLong(database.crrtkn, l-8, SignedBinary.BIG_ENDIAN); // as "long" as unique session.drdaID = reader.convertBytes(part1) + time + leftBrace + session.connNum + rightBrace; if (SanityManager.DEBUG) trace("******************************************drdaID is: " + session.drdaID); EmbedConnection conn = (EmbedConnection)(database.getConnection()); if (conn != null) conn.setDrdaID(session.drdaID); break; //required case CodePoint.RDBNAM: String dbname = parseRDBNAM(); if (database != null) { if (!database.dbName.equals(dbname)) rdbnamMismatch(CodePoint.ACCRDB); } else { //first time we have seen a database name Database d = session.getDatabase(dbname); if (d == null) addDatabase(dbname); else { database = d; database.accessCount++; } } removeFromRequired(CodePoint.RDBNAM); break; //required case CodePoint.PRDID: appRequester.setClientVersion(reader.readString()); if (SanityManager.DEBUG) trace("prdId " + appRequester.prdid); if (appRequester.prdid.length() > CodePoint.PRDID_MAX) tooBig(CodePoint.PRDID); /* If JCC version is 1.5 or later, send SQLWarning on CNTQRY */ if ((appRequester.getClientType() == appRequester.JCC_CLIENT) && (appRequester.greaterThanOrEqualTo(1, 5, 0))) { sendWarningsOnCNTQRY = true; } else sendWarningsOnCNTQRY = false; removeFromRequired(CodePoint.PRDID); break; //required case CodePoint.TYPDEFNAM: setStmtOrDbByteOrder(true, null, parseTYPDEFNAM()); removeFromRequired(CodePoint.TYPDEFNAM); break; //required case CodePoint.TYPDEFOVR: parseTYPDEFOVR(null); removeFromRequired(CodePoint.TYPDEFOVR); break; //optional case CodePoint.RDBALWUPD: checkLength(CodePoint.RDBALWUPD, 1); database.rdbAllowUpdates = readBoolean(CodePoint.RDBALWUPD); if (SanityManager.DEBUG) trace("rdbAllowUpdates = "+database.rdbAllowUpdates); break; //optional, ignorable case CodePoint.PRDDTA: // check that it fits in maximum but otherwise ignore for now if (reader.getDdmLength() > CodePoint.MAX_NAME) tooBig(CodePoint.PRDDTA); reader.skipBytes(); break; case CodePoint.TRGDFTRT: byte b = reader.readByte(); if (b == 0xF1) database.sendTRGDFTRT = true; break; //optional - not used in JCC so skip for now case CodePoint.STTDECDEL: case CodePoint.STTSTRDEL: codePointNotSupported(codePoint); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } checkRequired(CodePoint.ACCRDB); // check that we can support the double-byte and mixed-byte CCSIDS // set svrcod to warning if they are not supported if ((database.ccsidDBC != 0 && !server.supportsCCSID(database.ccsidDBC)) || (database.ccsidMBC != 0 && !server.supportsCCSID(database.ccsidMBC))) svrcod = CodePoint.SVRCOD_WARNING; return svrcod; } /** * Parse TYPDEFNAM * * @return typdefnam * @exception DRDAProtocolException */ private String parseTYPDEFNAM() throws DRDAProtocolException { String typDefNam = reader.readString(); if (SanityManager.DEBUG) trace("typeDefName " + typDefNam); if (typDefNam.length() > CodePoint.MAX_NAME) tooBig(CodePoint.TYPDEFNAM); checkValidTypDefNam(typDefNam); // check if the typedef is one we support if (!typDefNam.equals(CodePoint.TYPDEFNAM_QTDSQLASC) && !typDefNam.equals(CodePoint.TYPDEFNAM_QTDSQLJVM) && !typDefNam.equals(CodePoint.TYPDEFNAM_QTDSQLX86)) valueNotSupported(CodePoint.TYPDEFNAM); return typDefNam; } /** * Set a statement or the database' byte order, depending on the arguments * * @param setDatabase if true, set database' byte order, otherwise set statement's * @param stmt DRDAStatement, used when setDatabase is false * @param typDefNam TYPDEFNAM value */ private void setStmtOrDbByteOrder(boolean setDatabase, DRDAStatement stmt, String typDefNam) { int byteOrder = (typDefNam.equals(CodePoint.TYPDEFNAM_QTDSQLX86) ? SignedBinary.LITTLE_ENDIAN : SignedBinary.BIG_ENDIAN); if (setDatabase) { database.typDefNam = typDefNam; database.byteOrder = byteOrder; } else { stmt.typDefNam = typDefNam; stmt.byteOrder = byteOrder; } } /** * Write Access to RDB Completed * Instance Variables * SVRCOD - severity code - 0 info, 4 warning -required * PRDID - product specific identifier -required * TYPDEFNAM - type definition name -required * TYPDEFOVR - type definition overrides - required * RDBINTTKN - token which can be used to interrupt DDM commands - optional * CRRTKN - correlation token - only returned if we didn't get one from requester * SRVDGN - server diagnostic information - optional * PKGDFTCST - package default character subtype - optional * USRID - User ID at the target system - optional * SRVLST - Server List * * @exception DRDAProtocolException */ private void writeACCRDBRM(int svrcod) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.ACCRDBRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, svrcod); writer.writeScalarString(CodePoint.PRDID, server.prdId); //TYPDEFNAM -required - JCC doesn't support QTDSQLJVM so for now we // just use ASCII, though we should eventually be able to use QTDSQLJVM // at level 7 writer.writeScalarString(CodePoint.TYPDEFNAM, CodePoint.TYPDEFNAM_QTDSQLASC); writeTYPDEFOVR(); writer.endDdmAndDss (); finalizeChain(); } private void writeTYPDEFOVR() throws DRDAProtocolException { //TYPDEFOVR - required - only single byte and mixed byte are specified writer.startDdm(CodePoint.TYPDEFOVR); writer.writeScalar2Bytes(CodePoint.CCSIDSBC, server.CCSIDSBC); writer.writeScalar2Bytes(CodePoint.CCSIDMBC, server.CCSIDMBC); // PKGDFTCST - Send character subtype and userid if requested if (database.sendTRGDFTRT) { // default to multibyte character writer.startDdm(CodePoint.PKGDFTCST); writer.writeShort(CodePoint.CSTMBCS); writer.endDdm(); // userid writer.startDdm(CodePoint.USRID); writer.writeString(database.userId); writer.endDdm(); } writer.endDdm(); } /** * Parse Type Defintion Overrides * TYPDEF Overrides specifies the Coded Character SET Identifiers (CCSIDs) * that are in a named TYPDEF. * Instance Variables * CCSIDSBC - CCSID for Single-Byte - optional * CCSIDDBC - CCSID for Double-Byte - optional * CCSIDMBC - CCSID for Mixed-byte characters -optional * * @param st Statement this TYPDEFOVR applies to * * @exception DRDAProtocolException */ private void parseTYPDEFOVR(DRDAStatement st) throws DRDAProtocolException { int codePoint; int ccsidSBC = 0; int ccsidDBC = 0; int ccsidMBC = 0; String ccsidSBCEncoding = null; String ccsidDBCEncoding = null; String ccsidMBCEncoding = null; reader.markCollection(); codePoint = reader.getCodePoint(); // at least one of the following instance variable is required // if the TYPDEFOVR is specified in a command object if (codePoint == -1 && st != null) missingCodePoint(CodePoint.CCSIDSBC); while (codePoint != -1) { switch (codePoint) { case CodePoint.CCSIDSBC: checkLength(CodePoint.CCSIDSBC, 2); ccsidSBC = reader.readNetworkShort(); try { ccsidSBCEncoding = CharacterEncodings.getJavaEncoding(ccsidSBC); } catch (Exception e) { valueNotSupported(CodePoint.CCSIDSBC); } if (SanityManager.DEBUG) trace("ccsidsbc = " + ccsidSBC + " encoding = " + ccsidSBCEncoding); break; case CodePoint.CCSIDDBC: checkLength(CodePoint.CCSIDDBC, 2); ccsidDBC = reader.readNetworkShort(); try { ccsidDBCEncoding = CharacterEncodings.getJavaEncoding(ccsidDBC); } catch (Exception e) { // we write a warning later for this so no error // unless for a statement ccsidDBCEncoding = null; if (st != null) valueNotSupported(CodePoint.CCSIDSBC); } if (SanityManager.DEBUG) trace("ccsiddbc = " + ccsidDBC + " encoding = " + ccsidDBCEncoding); break; case CodePoint.CCSIDMBC: checkLength(CodePoint.CCSIDMBC, 2); ccsidMBC = reader.readNetworkShort(); try { ccsidMBCEncoding = CharacterEncodings.getJavaEncoding(ccsidMBC); } catch (Exception e) { // we write a warning later for this so no error ccsidMBCEncoding = null; if (st != null) valueNotSupported(CodePoint.CCSIDMBC); } if (SanityManager.DEBUG) trace("ccsidmbc = " + ccsidMBC + " encoding = " + ccsidMBCEncoding); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } if (st == null) { if (ccsidSBC != 0) { database.ccsidSBC = ccsidSBC; database.ccsidSBCEncoding = ccsidSBCEncoding; } if (ccsidDBC != 0) { database.ccsidDBC = ccsidDBC; database.ccsidDBCEncoding = ccsidDBCEncoding; } if (ccsidMBC != 0) { database.ccsidMBC = ccsidMBC; database.ccsidMBCEncoding = ccsidMBCEncoding; } } else { if (ccsidSBC != 0) { st.ccsidSBC = ccsidSBC; st.ccsidSBCEncoding = ccsidSBCEncoding; } if (ccsidDBC != 0) { st.ccsidDBC = ccsidDBC; st.ccsidDBCEncoding = ccsidDBCEncoding; } if (ccsidMBC != 0) { st.ccsidMBC = ccsidMBC; st.ccsidMBCEncoding = ccsidMBCEncoding; } } } /** * Parse PRPSQLSTT - Prepare SQL Statement * Instance Variables * RDBNAM - Relational Database Name - optional * PKGNAMCAN - RDB Package Name, Consistency Token, and Section Number - required * RTNSQLDA - Return SQL Descriptor Area - optional * MONITOR - Monitor events - optional. * * @return return 0 - don't return sqlda, 1 - return input sqlda, * 2 - return output sqlda * @exception DRDAProtocolException, SQLException */ private int parsePRPSQLSTT() throws DRDAProtocolException,SQLException { int codePoint; boolean rtnsqlda = false; boolean rtnOutput = true; // Return output SQLDA is default String typdefnam; String pkgnamcsn = null; DRDAStatement stmt = null; Database databaseToSet = null; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.RDBNAM: setDatabase(CodePoint.PRPSQLSTT); databaseToSet = database; break; // required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); break; //optional case CodePoint.RTNSQLDA: // Return SQLDA with description of statement rtnsqlda = readBoolean(CodePoint.RTNSQLDA); break; //optional case CodePoint.TYPSQLDA: rtnOutput = parseTYPSQLDA(); break; //optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } stmt = database.newDRDAStatement(pkgnamcsn); String sqlStmt = parsePRPSQLSTTobjects(stmt); if (databaseToSet != null) stmt.setDatabase(database); stmt.explicitPrepare(sqlStmt); // set the statement as the current statement database.setCurrentStatement(stmt); if (!rtnsqlda) return 0; else if (rtnOutput) return 2; else return 1; } /** * Parse PRPSQLSTT objects * Objects * TYPDEFNAM - Data type definition name - optional * TYPDEFOVR - Type defintion overrides - optional * SQLSTT - SQL Statement required * SQLATTR - Cursor attributes on prepare - optional - level 7 * * If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects * sent with the statement. Once the statement is over, the default values * sent in the ACCRDB are once again in effect. If no values are supplied, * the values sent in the ACCRDB are used. * Objects may follow in one DSS or in several DSS chained together. * * @return SQL statement * @exception DRDAProtocolException, SQLException */ private String parsePRPSQLSTTobjects(DRDAStatement stmt) throws DRDAProtocolException, SQLException { String sqlStmt = null; int codePoint; do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint(); switch(codePoint) { // required case CodePoint.SQLSTT: sqlStmt = parseEncodedString(); if (SanityManager.DEBUG) trace("sqlStmt = " + sqlStmt); break; // optional case CodePoint.TYPDEFNAM: setStmtOrDbByteOrder(false, stmt, parseTYPDEFNAM()); break; // optional case CodePoint.TYPDEFOVR: parseTYPDEFOVR(stmt); break; // optional case CodePoint.SQLATTR: parseSQLATTR(stmt); break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); if (sqlStmt == null) missingCodePoint(CodePoint.SQLSTT); return sqlStmt; } /** * Parse TYPSQLDA - Type of the SQL Descriptor Area * * @return true if for output; false otherwise * @exception DRDAProtocolException */ private boolean parseTYPSQLDA() throws DRDAProtocolException { checkLength(CodePoint.TYPSQLDA, 1); byte sqldaType = reader.readByte(); if (SanityManager.DEBUG) trace("typSQLDa " + sqldaType); if (sqldaType == CodePoint.TYPSQLDA_STD_OUTPUT || sqldaType == CodePoint.TYPSQLDA_LIGHT_OUTPUT || sqldaType == CodePoint.TYPSQLDA_X_OUTPUT) return true; else if (sqldaType == CodePoint.TYPSQLDA_STD_INPUT || sqldaType == CodePoint.TYPSQLDA_LIGHT_INPUT || sqldaType == CodePoint.TYPSQLDA_X_INPUT) return false; else invalidValue(CodePoint.TYPSQLDA); // shouldn't get here but have to shut up compiler return false; } /** * Parse SQLATTR - Cursor attributes on prepare * This is an encoded string. Can have combination of following, eg INSENSITIVE SCROLL WITH HOLD * Possible strings are * SENSITIVE DYNAMIC SCROLL [FOR UPDATE] * SENSITIVE STATIC SCROLL [FOR UPDATE] * INSENSITIVE SCROLL * FOR UPDATE * WITH HOLD * * @param stmt DRDAStatement * @exception DRDAProtocolException */ protected void parseSQLATTR(DRDAStatement stmt) throws DRDAProtocolException { String attrs = parseEncodedString(); if (SanityManager.DEBUG) trace("sqlattr = '" + attrs+"'"); //let Cloudscape handle any errors in the types it doesn't support //just set the attributes boolean insensitive = false; boolean validAttribute = false; if (attrs.indexOf("INSENSITIVE SCROLL") != -1 || attrs.indexOf("SCROLL INSENSITIVE") != -1) //CLI { stmt.scrollType = ResultSet.TYPE_SCROLL_INSENSITIVE; stmt.concurType = ResultSet.CONCUR_READ_ONLY; insensitive = true; validAttribute = true; } if ((attrs.indexOf("SENSITIVE DYNAMIC SCROLL") != -1) || (attrs.indexOf("SENSITIVE STATIC SCROLL") != -1)) { stmt.scrollType = ResultSet.TYPE_SCROLL_SENSITIVE; validAttribute = true; } if ((attrs.indexOf("FOR UPDATE") != -1)) { validAttribute = true; if (!insensitive) stmt.concurType = ResultSet.CONCUR_UPDATABLE; } if (attrs.indexOf("WITH HOLD") != -1) { stmt.withHoldCursor = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT; validAttribute = true; } if (!validAttribute) { invalidValue(CodePoint.SQLATTR); } } /** * Parse DSCSQLSTT - Describe SQL Statement previously prepared * Instance Variables * TYPSQLDA - sqlda type expected (output or input) * RDBNAM - relational database name - optional * PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required * MONITOR - Monitor events - optional. * * @return expect "output sqlda" or not * @exception DRDAProtocolException, SQLException */ private boolean parseDSCSQLSTT() throws DRDAProtocolException,SQLException { int codePoint; boolean rtnOutput = true; // default String pkgnamcsn = null; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.TYPSQLDA: rtnOutput = parseTYPSQLDA(); break; // optional case CodePoint.RDBNAM: setDatabase(CodePoint.DSCSQLSTT); break; // required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); DRDAStatement stmt = database.getDRDAStatement(pkgnamcsn); if (stmt == null) { invalidValue(CodePoint.PKGNAMCSN); } break; //optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } if (pkgnamcsn == null) missingCodePoint(CodePoint.PKGNAMCSN); return rtnOutput; } /** * Parse EXCSQLSTT - Execute non-cursor SQL Statement previously prepared * Instance Variables * RDBNAM - relational database name - optional * PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required * OUTEXP - Output expected * NBRROW - Number of rows to be inserted if it's an insert * PRCNAM - procedure name if specified by host variable, not needed for Cloudscape * QRYBLKSZ - query block size * MAXRSLCNT - max resultset count * MAXBLKEXT - Max number of extra blocks * RSLSETFLG - resultset flag * RDBCMTOK - RDB Commit Allowed - optional * OUTOVROPT - output override option * QRYROWSET - Query Rowset Size - Level 7 * MONITOR - Monitor events - optional. * * @exception DRDAProtocolException, SQLException */ private void parseEXCSQLSTT() throws DRDAProtocolException,SQLException { int codePoint; String strVal; reader.markCollection(); codePoint = reader.getCodePoint(); boolean outputExpected = false; String pkgnamcsn = null; int numRows = 1; // default value int blkSize = 0; int maxrslcnt = 0; // default value int maxblkext = CodePoint.MAXBLKEXT_DEFAULT; int qryrowset = CodePoint.QRYROWSET_DEFAULT; int outovropt = CodePoint.OUTOVRFRS; byte [] rslsetflg = null; String procName = null; while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.RDBNAM: setDatabase(CodePoint.EXCSQLSTT); break; // required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); break; // optional case CodePoint.OUTEXP: outputExpected = readBoolean(CodePoint.OUTEXP); if (SanityManager.DEBUG) trace("outexp = "+ outputExpected); break; // optional case CodePoint.NBRROW: checkLength(CodePoint.NBRROW, 4); numRows = reader.readNetworkInt(); if (SanityManager.DEBUG) trace("# of rows: "+numRows); break; // optional case CodePoint.PRCNAM: procName = reader.readString(); if (SanityManager.DEBUG) trace("Procedure Name = " + procName); break; // optional case CodePoint.QRYBLKSZ: blkSize = parseQRYBLKSZ(); break; // optional case CodePoint.MAXRSLCNT: // this is the maximum result set count // values are 0 - requester is not capabable of receiving result // sets as reply data in the response to EXCSQLSTT // -1 - requester is able to receive all result sets checkLength(CodePoint.MAXRSLCNT, 2); maxrslcnt = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("max rs count: "+maxrslcnt); break; // optional case CodePoint.MAXBLKEXT: // number of extra qury blocks of answer set data per result set // 0 - no extra query blocks // -1 - can receive entire result set checkLength(CodePoint.MAXBLKEXT, 2); maxblkext = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("max extra blocks: "+maxblkext); break; // optional case CodePoint.RSLSETFLG: //Result set flags rslsetflg = reader.readBytes(); for (int i=0;i<rslsetflg.length;i++) if (SanityManager.DEBUG) trace("rslsetflg: "+rslsetflg[i]); break; // optional case CodePoint.RDBCMTOK: parseRDBCMTOK(); break; // optional case CodePoint.OUTOVROPT: outovropt = parseOUTOVROPT(); break; // optional case CodePoint.QRYROWSET: //Note minimum for OPNQRY is 0, we'll assume it is the same //for EXCSQLSTT though the standard doesn't say qryrowset = parseQRYROWSET(0); break; //optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } if (pkgnamcsn == null) missingCodePoint(CodePoint.PKGNAMCSN); DRDAStatement stmt; boolean needPrepareCall = false; stmt = database.getDRDAStatement(pkgnamcsn); boolean isProcedure = (procName !=null || (stmt != null && stmt.wasExplicitlyPrepared() && stmt.isCall)); if (isProcedure) // stored procedure call { if ( stmt == null || !(stmt.wasExplicitlyPrepared())) { stmt = database.newDRDAStatement(pkgnamcsn); stmt.setQryprctyp(CodePoint.QRYBLKCTL_DEFAULT); needPrepareCall = true; } stmt.procName = procName; stmt.outputExpected = outputExpected; } else { // we can't find the statement if (stmt == null) { invalidValue(CodePoint.PKGNAMCSN); } stmt.setQryprctyp(CodePoint.QRYBLKCTL_DEFAULT); } stmt.nbrrow = numRows; stmt.qryrowset = qryrowset; stmt.blksize = blkSize; stmt.maxblkext = maxblkext; stmt.maxrslcnt = maxrslcnt; stmt.outovropt = outovropt; stmt.rslsetflg = rslsetflg; // set the statement as the current statement database.setCurrentStatement(stmt); if (reader.isChainedWithSameID()) parseEXCSQLSTTobjects(stmt); else if (isProcedure && (needPrepareCall)) { // if we had parameters the callable statement would // be prepared with parseEXCQLSTTobjects, otherwise we // have to do it here String prepareString = "call " + stmt.procName +"()"; if (SanityManager.DEBUG) trace ("$$$prepareCall is: "+prepareString); database.getConnection().clearWarnings(); CallableStatement cs = (CallableStatement) stmt.prepare(prepareString); } stmt.ps.clearWarnings(); boolean hasResultSet = stmt.execute(); ResultSet rs = null; if (hasResultSet) { rs = stmt.getResultSet(); } // temp until ps.execute() return value fixed hasResultSet = (rs != null); int numResults = 0; if (hasResultSet) { numResults = stmt.getNumResultSets(); writeRSLSETRM(stmt); } // First of all, we send if there really are output params. Otherwise // CLI (.Net driver) fails. DRDA spec (page 151,152) says send SQLDTARD // if server has output param data to send. boolean sendSQLDTARD = stmt.hasOutputParams() && outputExpected; if (isProcedure) { if (sendSQLDTARD) { writer.createDssObject(); writer.startDdm(CodePoint.SQLDTARD); writer.startDdm(CodePoint.FDODSC); writeQRYDSC(stmt, true); writer.endDdm(); writer.startDdm(CodePoint.FDODTA); writeFDODTA(stmt); writer.endDdm(); writer.endDdmAndDss(); } else if (hasResultSet) // DRDA spec says that we MUST return either an // SQLDTARD or an SQLCARD--the former when we have // output parameters, the latter when we don't. // If we have a result set, then we have to write // the SQLCARD _now_, since it is expected before // we send the result set info below; if we don't // have a result set and we don't send SQLDTARD, // then we can wait until we reach the call to // checkWarning() below, which will write an // SQLCARD for us. writeNullSQLCARDobject(); } //We need to marke that params are finished so that we know we // are ready to send resultset info. stmt.finishParams(); PreparedStatement ps = stmt.getPreparedStatement(); int rsNum = 0; do { if (hasResultSet) { stmt.setCurrentDrdaResultSet(rsNum); //indicate that we are going to return data stmt.setQryrtndta(true); if (! isProcedure) checkWarning(null, ps, null, -1, true, true); if (rsNum == 0) writeSQLRSLRD(stmt); writeOPNQRYRM(true, stmt); writeSQLCINRD(stmt); writeQRYDSC(stmt, false); stmt.rsSuspend(); /* Currently, if LMTBLKPRC is used, a pre-condition is that no lob columns. * But in the future, when we do support LOB in LMTBLKPRC, the drda spec still * does not allow LOB to be sent with OPNQRYRM. So this "if" here will have * to add "no lob columns". */ if (stmt.getQryprctyp() == CodePoint.LMTBLKPRC) writeQRYDTA(stmt); } else if (! sendSQLDTARD) { int updateCount = ps.getUpdateCount(); if (false && (database.RDBUPDRM_sent == false) && ! isProcedure) { writeRDBUPDRM(); } checkWarning(database.getConnection(), stmt.ps, null, updateCount, true, true); } } while(hasResultSet && (++rsNum < numResults)); return; // we are done } /** * Parse RDBCMTOK - tells the database whether to allow commits or rollbacks * to be executed as part of the command * Since we don't have a SQL commit or rollback command, we will just ignore * this for now * * @exception DRDAProtocolException */ private void parseRDBCMTOK() throws DRDAProtocolException { boolean rdbcmtok = readBoolean(CodePoint.RDBCMTOK); if (SanityManager.DEBUG) trace("rdbcmtok = " + rdbcmtok); } /** * Parse EXCSQLSTT command objects * Command Objects * TYPDEFNAM - Data Type Definition Name - optional * TYPDEFOVR - TYPDEF Overrides -optional * SQLDTA - optional, variable data, specified if prpared statement has input parameters * EXTDTA - optional, externalized FD:OCA data * OUTOVR - output override descriptor, not allowed for stored procedure calls * * If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects * sent with the statement. Once the statement is over, the default values * sent in the ACCRDB are once again in effect. If no values are supplied, * the values sent in the ACCRDB are used. * Objects may follow in one DSS or in several DSS chained together. * * @param the DRDAStatement to execute * @exception DRDAProtocolException, SQLException */ private void parseEXCSQLSTTobjects(DRDAStatement stmt) throws DRDAProtocolException, SQLException { int codePoint; boolean gotSQLDTA = false, typeDefChanged = false; do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint(); switch(codePoint) { // optional case CodePoint.TYPDEFNAM: setStmtOrDbByteOrder(false, stmt, parseTYPDEFNAM()); typeDefChanged = true; break; // optional case CodePoint.TYPDEFOVR: parseTYPDEFOVR(stmt); typeDefChanged = true; break; // required case CodePoint.SQLDTA: parseSQLDTA(stmt); gotSQLDTA = true; break; // optional case CodePoint.EXTDTA: readAndSetAllExtParams(stmt); break; // optional case CodePoint.OUTOVR: parseOUTOVR(stmt); break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); // SQLDTA is required if (! gotSQLDTA) missingCodePoint(CodePoint.SQLDTA); if (typeDefChanged) stmt.setTypDefValues(); } /** * Write SQLCINRD - result set column information * * @exception DRDAProtocolException, SQLException */ private void writeSQLCINRD(DRDAStatement stmt) throws DRDAProtocolException,SQLException { ResultSet rs = null; PreparedStatement ps = stmt.getPreparedStatement(); if (!stmt.needsToSendParamData) rs = stmt.getResultSet(); writer.createDssObject(); writer.startDdm(CodePoint.SQLCINRD); if (sqlamLevel >= MGRLVL_7) writeSQLDHROW (stmt); ResultSetMetaData rsmeta = rs.getMetaData(); int ncols = rsmeta.getColumnCount(); writer.writeShort(ncols); // num of columns if (sqlamLevel >= MGRLVL_7) { for (int i = 0; i < ncols; i++) writeSQLDAGRP (rsmeta, null, i, true); } else { for (int i = 0; i < ncols; i++) { writeVCMorVCS(rsmeta.getColumnName(i+1)); writeVCMorVCS(rsmeta.getColumnLabel(i+1)); writeVCMorVCS(null); } } writer.endDdmAndDss(); } /** * Write SQLRSLRD - result set reply data * * @exception DRDAProtocolException, SQLException */ private void writeSQLRSLRD(DRDAStatement stmt) throws DRDAProtocolException,SQLException { EmbedPreparedStatement ps = (EmbedPreparedStatement) stmt.getPreparedStatement(); int numResults = stmt.getNumResultSets(); writer.createDssObject(); writer.startDdm(CodePoint.SQLRSLRD); writer.writeShort(numResults); // num of result sets for (int i = 0; i < numResults; i ++) { writer.writeInt(i); // rsLocator writeVCMorVCS(stmt.getResultSetCursorName(i)); writer.writeInt(1); // num of rows XXX resolve, it doesn't matter for now } writer.endDdmAndDss(); } /** * Write RSLSETRM * Instance variables * SVRCOD - Severity code - Information only - required * PKGSNLST - list of PKGNAMCSN -required * SRVDGN - Server Diagnostic Information -optional * * @exception DRDAProtocolException, SQLException */ private void writeRSLSETRM(DRDAStatement stmt) throws DRDAProtocolException,SQLException { int numResults = stmt.getNumResultSets(); writer.createDssReply(); writer.startDdm(CodePoint.RSLSETRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, 0); writer.startDdm(CodePoint.PKGSNLST); for (int i = 0; i < numResults; i++) writePKGNAMCSN(stmt.getResultSetPkgcnstknStr(i)); writer.endDdm(); writer.endDdmAndDss(); } /** * Parse SQLDTA - SQL program variable data * and handle exception. * @see parseSQLDTA_work */ private void parseSQLDTA(DRDAStatement stmt) throws DRDAProtocolException,SQLException { try { parseSQLDTA_work(stmt); } catch (SQLException se) { skipRemainder(false); throw se; } } /** * Parse SQLDTA - SQL program variable data * Instance Variables * FDODSC - FD:OCA data descriptor - required * FDODTA - FD:OCA data - optional * * @exception DRDAProtocolException, SQLException */ private void parseSQLDTA_work(DRDAStatement stmt) throws DRDAProtocolException,SQLException { String strVal; PreparedStatement ps = stmt.getPreparedStatement(); int codePoint; EmbedParameterSetMetaData pmeta = null; Vector paramDrdaTypes = new Vector(); Vector paramLens = new Vector(); ArrayList paramExtPositions = null; int numVars = 0; boolean rtnParam = false; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // required case CodePoint.FDODSC: while (reader.getDdmLength() > 6) //we get parameter info til last 6 byte { int dtaGrpLen = reader.readUnsignedByte(); int numVarsInGrp = (dtaGrpLen - 3) / 3; if (SanityManager.DEBUG) trace("num of vars in this group is: "+numVarsInGrp); reader.readByte(); // tripletType reader.readByte(); // id for (int j = 0; j < numVarsInGrp; j++) { paramDrdaTypes.addElement(new Byte(reader.readByte())); if (SanityManager.DEBUG) trace("drdaType is: "+ "0x" + Integer.toHexString(((Byte ) paramDrdaTypes.lastElement()).byteValue())); int drdaLength = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("drdaLength is: "+drdaLength); paramLens.addElement(new Integer(drdaLength)); } } numVars = paramDrdaTypes.size(); if (SanityManager.DEBUG) trace("numVars = " + numVars); if (ps == null) // it is a CallableStatement under construction { String marks = "(?"; // construct parameter marks for (int i = 1; i < numVars; i++) marks += ", ?"; String prepareString = "call " + stmt.procName + marks + ")"; if (SanityManager.DEBUG) trace ("$$ prepareCall is: "+prepareString); CallableStatement cs = null; try { cs = (CallableStatement) stmt.prepare(prepareString); stmt.registerAllOutParams(); } catch (SQLException se) { if (! stmt.outputExpected || (!se.getSQLState().equals(SQLState.LANG_NO_METHOD_FOUND))) throw se; if (SanityManager.DEBUG) trace("****** second try with return parameter..."); // Save first SQLException most likely suspect if (numVars == 1) prepareString = "? = call " + stmt.procName +"()"; else prepareString = "? = call " + stmt.procName +"("+marks.substring(3) + ")"; if (SanityManager.DEBUG) trace ("$$ prepareCall is: "+prepareString); try { cs = (CallableStatement) stmt.prepare(prepareString); } catch (SQLException se2) { // The first exception is the most likely suspect throw se; } rtnParam = true; } ps = cs; } pmeta = ((EmbedPreparedStatement) ps).getEmbedParameterSetMetaData(); reader.readBytes(6); // descriptor footer break; // optional case CodePoint.FDODTA: reader.readByte(); // row indicator for (int i = 0; i < numVars; i++) { if ((((Byte)paramDrdaTypes.elementAt(i)).byteValue() & 0x1) == 0x1) // nullable { int nullData = reader.readUnsignedByte(); if ((nullData & 0xFF) == FdocaConstants.NULL_DATA) { if (SanityManager.DEBUG) trace("******param null"); if (pmeta.getParameterMode(i + 1) != JDBC30Translation.PARAMETER_MODE_OUT ) ps.setNull(i+1, pmeta.getParameterType(i+1)); if (stmt.isOutputParam(i+1)) stmt.registerOutParam(i+1); continue; } } // not null, read and set it paramExtPositions = readAndSetParams(i, stmt, ((Byte)paramDrdaTypes.elementAt(i)).byteValue(), pmeta, paramExtPositions, ((Integer)(paramLens.elementAt(i))).intValue()); } stmt.cliParamExtPositions = paramExtPositions; stmt.cliParamDrdaTypes = paramDrdaTypes; stmt.cliParamLens = paramLens; break; case CodePoint.EXTDTA: readAndSetAllExtParams(stmt); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } } private int getByteOrder() { DRDAStatement stmt = database.getCurrentStatement(); return ((stmt != null && stmt.typDefNam != null) ? stmt.byteOrder : database.byteOrder); } /** * Read different types of input parameters and set them in PreparedStatement * @param i index of the parameter * @param stmt drda statement * @param drdaType drda type of the parameter * @param pmeta parameter meta data * @param paramExtPositions ArrayList of parameters with extdta * @param paramLenNumBytes Number of bytes for encoding LOB Length * * @return updated paramExtPositions * @exception DRDAProtocolException, SQLException */ private ArrayList readAndSetParams(int i, DRDAStatement stmt, int drdaType, EmbedParameterSetMetaData pmeta, ArrayList paramExtPositions, int paramLenNumBytes) throws DRDAProtocolException, SQLException { PreparedStatement ps = stmt.getPreparedStatement(); // mask out null indicator drdaType = ((drdaType | 0x01) & 0x000000ff); if (ps instanceof CallableStatement) { if (stmt.isOutputParam(i+1)) { CallableStatement cs = (CallableStatement) ps; cs.registerOutParameter(i+1, stmt.getOutputParamType(i+1)); } } switch (drdaType) { case FdocaConstants.DRDA_TYPE_NSMALL: { short paramVal = (short) reader.readShort(getByteOrder()); if (SanityManager.DEBUG) trace("short parameter value is: "+paramVal); // DB2 does not have a BOOLEAN java.sql.bit type, it's sent as small if (pmeta.getParameterType(i+1) == JDBC30Translation.BOOLEAN) ps.setBoolean(i+1, (paramVal == 1)); else ps.setShort(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NINTEGER: { int paramVal = reader.readInt(getByteOrder()); if (SanityManager.DEBUG) trace("integer parameter value is: "+paramVal); ps.setInt(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NINTEGER8: { long paramVal = reader.readLong(getByteOrder()); if (SanityManager.DEBUG) trace("parameter value is: "+paramVal); ps.setLong(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NFLOAT4: { float paramVal = reader.readFloat(getByteOrder()); if (SanityManager.DEBUG) trace("parameter value is: "+paramVal); ps.setFloat(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NFLOAT8: { double paramVal = reader.readDouble(getByteOrder()); if (SanityManager.DEBUG) trace("nfloat8 parameter value is: "+paramVal); ps.setDouble(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NDECIMAL: { int precision = (paramLenNumBytes >> 8) & 0xff; int scale = paramLenNumBytes & 0xff; BigDecimal paramVal = reader.readBigDecimal(precision, scale); if (SanityManager.DEBUG) trace("ndecimal parameter value is: "+paramVal); ps.setBigDecimal(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NDATE: { String paramVal = reader.readStringData(10).trim(); //parameter may be char value if (SanityManager.DEBUG) trace("ndate parameter value is: \""+paramVal+"\""); ps.setDate(i+1, java.sql.Date.valueOf(paramVal)); break; } case FdocaConstants.DRDA_TYPE_NTIME: { String paramVal = reader.readStringData(8).trim(); //parameter may be char value if (SanityManager.DEBUG) trace("ntime parameter value is: "+paramVal); ps.setTime(i+1, java.sql.Time.valueOf(paramVal)); break; } case FdocaConstants.DRDA_TYPE_NTIMESTAMP: { // DB2 represents ts with 26 chars, and a slightly different format than Java standard // we do the conversion and pad 3 digits for nano seconds. String paramVal = reader.readStringData(26).trim(); //parameter may be char value if (SanityManager.DEBUG) trace("ntimestamp parameter value is: "+paramVal); String tsString = paramVal.substring(0,10)+" "+paramVal.substring(11,19).replace('.', ':')+paramVal.substring(19)+"000"; if (SanityManager.DEBUG) trace("tsString is: "+tsString); ps.setTimestamp(i+1, java.sql.Timestamp.valueOf(tsString)); break; } case FdocaConstants.DRDA_TYPE_NCHAR: case FdocaConstants.DRDA_TYPE_NVARCHAR: case FdocaConstants.DRDA_TYPE_NLONG: case FdocaConstants.DRDA_TYPE_NVARMIX: case FdocaConstants.DRDA_TYPE_NLONGMIX: { String paramVal = reader.readLDStringData(stmt.ccsidMBCEncoding); if (SanityManager.DEBUG) trace("char/varchar parameter value is: "+paramVal); ps.setString(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NFIXBYTE: { byte[] paramVal = reader.readBytes(); if (SanityManager.DEBUG) trace("fix bytes parameter value is: "+new String(paramVal)); ps.setBytes(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NVARBYTE: case FdocaConstants.DRDA_TYPE_NLONGVARBYTE: { int length = reader.readNetworkShort(); //protocol control data always follows big endian if (SanityManager.DEBUG) trace("===== binary param length is: " + length); byte[] paramVal = reader.readBytes(length); ps.setBytes(i+1, paramVal); break; } case FdocaConstants.DRDA_TYPE_NLOBBYTES: case FdocaConstants.DRDA_TYPE_NLOBCMIXED: case FdocaConstants.DRDA_TYPE_NLOBCSBCS: case FdocaConstants.DRDA_TYPE_NLOBCDBCS: { long length = readLobLength(paramLenNumBytes); if (length != 0) //can be -1 for CLI if "data at exec" mode, see clifp/exec test { if (paramExtPositions == null) paramExtPositions = new ArrayList(); paramExtPositions.add(new Integer(i)); } else /* empty */ { if (drdaType == FdocaConstants.DRDA_TYPE_NLOBBYTES) ps.setBytes(i+1, new byte[0]); else ps.setString(i+1, ""); } break; } default: { String paramVal = reader.readLDStringData(stmt.ccsidMBCEncoding); if (SanityManager.DEBUG) trace("default type parameter value is: "+paramVal); ps.setObject(i+1, paramVal); } } return paramExtPositions; } private long readLobLength(int extLenIndicator) throws DRDAProtocolException { switch (extLenIndicator) { case 0x8002: return (long) reader.readNetworkShort(); case 0x8004: return (long) reader.readNetworkInt(); case 0x8006: return (long) reader.readNetworkSixByteLong(); case 0x8008: return (long) reader.readNetworkLong(); default: throwSyntaxrm(CodePoint.SYNERRCD_INCORRECT_EXTENDED_LEN, extLenIndicator); return 0L; } } private void readAndSetAllExtParams(DRDAStatement stmt) throws SQLException, DRDAProtocolException { int numExt = stmt.cliParamExtPositions.size(); for (int i = 0; i < stmt.cliParamExtPositions.size(); i++) { int paramPos = ((Integer) (stmt.cliParamExtPositions).get(i)).intValue(); readAndSetExtParam(paramPos, stmt, ((Byte)stmt.cliParamDrdaTypes.elementAt(paramPos)).intValue(),((Integer)(stmt.cliParamLens.elementAt(paramPos))).intValue()); // Each extdta in it's own dss if (i < numExt -1) { correlationID = reader.readDssHeader(); int codePoint = reader.readLengthAndCodePoint(); } } } /** * Read different types of input parameters and set them in PreparedStatement * @param i index of the parameter * @param ps associated ps * @param drdaType drda type of the parameter * * @exception DRDAProtocolException, SQLException */ private void readAndSetExtParam( int i, DRDAStatement stmt, int drdaType, int extLen) throws DRDAProtocolException, SQLException { PreparedStatement ps = stmt.getPreparedStatement(); drdaType = (drdaType & 0x000000ff); // need unsigned value boolean checkNullability = false; if (sqlamLevel >= MGRLVL_7 && FdocaConstants.isNullable(drdaType)) checkNullability = true; try { byte[] paramBytes = reader.getExtData(checkNullability); String paramString = null; switch (drdaType) { case FdocaConstants.DRDA_TYPE_LOBBYTES: case FdocaConstants.DRDA_TYPE_NLOBBYTES: if (SanityManager.DEBUG) trace("parameter value is: "+paramBytes); ps.setBytes(i+1, paramBytes); break; case FdocaConstants.DRDA_TYPE_LOBCSBCS: case FdocaConstants.DRDA_TYPE_NLOBCSBCS: paramString = new String(paramBytes, stmt.ccsidSBCEncoding); if (SanityManager.DEBUG) trace("parameter value is: "+ paramString); ps.setString(i+1,paramString); break; case FdocaConstants.DRDA_TYPE_LOBCDBCS: case FdocaConstants.DRDA_TYPE_NLOBCDBCS: paramString = new String(paramBytes, stmt.ccsidDBCEncoding ); if (SanityManager.DEBUG) trace("parameter value is: "+ paramString); ps.setString(i+1,paramString); break; case FdocaConstants.DRDA_TYPE_LOBCMIXED: case FdocaConstants.DRDA_TYPE_NLOBCMIXED: paramString = new String(paramBytes, stmt.ccsidMBCEncoding); if (SanityManager.DEBUG) trace("parameter value is: "+ paramString); ps.setString(i+1,paramString); break; default: invalidValue(drdaType); } } catch (java.io.UnsupportedEncodingException e) { throw new SQLException (e.getMessage()); } } /** * Parse EXCSQLIMM - Execute Immediate Statement * Instance Variables * RDBNAM - relational database name - optional * PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required * RDBCMTOK - RDB Commit Allowed - optional * MONITOR - Monitor Events - optional * * Command Objects * TYPDEFNAM - Data Type Definition Name - optional * TYPDEFOVR - TYPDEF Overrides -optional * SQLSTT - SQL Statement -required * * @return update count * @exception DRDAProtocolException, SQLException */ private int parseEXCSQLIMM() throws DRDAProtocolException,SQLException { int codePoint; reader.markCollection(); String pkgnamcsn = null; codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.RDBNAM: setDatabase(CodePoint.EXCSQLIMM); break; // required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); break; case CodePoint.RDBCMTOK: parseRDBCMTOK(); break; //optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } DRDAStatement drdaStmt = database.getDefaultStatement(pkgnamcsn); // initialize statement for reuse drdaStmt.initialize(); String sqlStmt = parseEXECSQLIMMobjects(); drdaStmt.getStatement().clearWarnings(); int updCount = drdaStmt.getStatement().executeUpdate(sqlStmt); return updCount; } /** * Parse EXCSQLSET - Execute Set SQL Environment * Instance Variables * RDBNAM - relational database name - optional * PKGNAMCT - RDB Package Name, Consistency Token - optional * MONITOR - Monitor Events - optional * * Command Objects * TYPDEFNAM - Data Type Definition Name - required * TYPDEFOVR - TYPDEF Overrides - required * SQLSTT - SQL Statement - required (at least one; may be more) * * @exception DRDAProtocolException, SQLException */ private boolean parseEXCSQLSET() throws DRDAProtocolException,SQLException { int codePoint; reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.RDBNAM: setDatabase(CodePoint.EXCSQLSET); break; // optional case CodePoint.PKGNAMCT: // we are going to ignore this for EXCSQLSET // since we are just going to reuse an existing statement String pkgnamct = parsePKGNAMCT(); break; // optional case CodePoint.MONITOR: parseMONITOR(); break; // required case CodePoint.PKGNAMCSN: // we are going to ignore this for EXCSQLSET. // since we are just going to reuse an existing statement. // NOTE: This codepoint is not in the DDM spec for 'EXCSQLSET', // but since it DOES get sent by jcc1.2, we have to have // a case for it... String pkgnamcsn = parsePKGNAMCSN(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } parseEXCSQLSETobjects(); return true; } /** * Parse EXCSQLIMM objects * Objects * TYPDEFNAM - Data type definition name - optional * TYPDEFOVR - Type defintion overrides * SQLSTT - SQL Statement required * * If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects * sent with the statement. Once the statement is over, the default values * sent in the ACCRDB are once again in effect. If no values are supplied, * the values sent in the ACCRDB are used. * Objects may follow in one DSS or in several DSS chained together. * * @return SQL Statement * @exception DRDAProtocolException, SQLException */ private String parseEXECSQLIMMobjects() throws DRDAProtocolException, SQLException { String sqlStmt = null; int codePoint; DRDAStatement stmt = database.getDefaultStatement(); do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint(); switch(codePoint) { // optional case CodePoint.TYPDEFNAM: setStmtOrDbByteOrder(false, stmt, parseTYPDEFNAM()); break; // optional case CodePoint.TYPDEFOVR: parseTYPDEFOVR(stmt); break; // required case CodePoint.SQLSTT: sqlStmt = parseEncodedString(); if (SanityManager.DEBUG) trace("sqlStmt = " + sqlStmt); break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); // SQLSTT is required if (sqlStmt == null) missingCodePoint(CodePoint.SQLSTT); return sqlStmt; } /** * Parse EXCSQLSET objects * Objects * TYPDEFNAM - Data type definition name - optional * TYPDEFOVR - Type defintion overrides - optional * SQLSTT - SQL Statement - required (a list of at least one) * * Objects may follow in one DSS or in several DSS chained together. * * @return Count of updated rows. * @exception DRDAProtocolException, SQLException */ private void parseEXCSQLSETobjects() throws DRDAProtocolException, SQLException { boolean gotSqlStt = false; boolean hadUnrecognizedStmt = false; String sqlStmt = null; int codePoint; DRDAStatement drdaStmt = database.getDefaultStatement(); drdaStmt.initialize(); do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint(); switch(codePoint) { // optional case CodePoint.TYPDEFNAM: setStmtOrDbByteOrder(false, drdaStmt, parseTYPDEFNAM()); break; // optional case CodePoint.TYPDEFOVR: parseTYPDEFOVR(drdaStmt); break; // required case CodePoint.SQLSTT: sqlStmt = parseEncodedString(); if (sqlStmt != null) // then we have at least one SQL Statement. gotSqlStt = true; if (canIgnoreStmt(sqlStmt)) { // We _know_ Cloudscape doesn't recognize this // statement; don't bother trying to execute it. // NOTE: at time of writing, this only applies // to "SET CLIENT" commands, and it was decided // that throwing a Warning for these commands // would confuse people, so even though the DDM // spec says to do so, we choose not to (but // only for SET CLIENT cases). If this changes // at some point in the future, simply remove // the follwing line; we will then throw a // warning. // hadUnrecognizedStmt = true; break; } if (SanityManager.DEBUG) trace("sqlStmt = " + sqlStmt); // initialize statement for reuse drdaStmt.initialize(); drdaStmt.getStatement().clearWarnings(); try { drdaStmt.getStatement().executeUpdate(sqlStmt); } catch (SQLException e) { // if this is a syntax error, then we take it // to mean that the given SET statement is not // recognized; take note (so we can throw a // warning later), but don't interfere otherwise. if (e.getSQLState().equals(SYNTAX_ERR)) hadUnrecognizedStmt = true; else // something else; assume it's serious. throw e; } break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); // SQLSTT is required. if (!gotSqlStt) missingCodePoint(CodePoint.SQLSTT); // Now that we've processed all SET statements (assuming no // severe exceptions), check for warnings and, if we had any, // note this in the SQLCARD reply object (but DON'T cause the // EXCSQLSET statement to fail). if (hadUnrecognizedStmt) { SQLWarning warn = new SQLWarning("One or more SET statements " + "not recognized.", "01000"); throw warn; } // end if. return; } private boolean canIgnoreStmt(String stmt) { if (stmt.indexOf("SET CLIENT") != -1) return true; return false; } /** * Write RDBUPDRM * Instance variables * SVRCOD - Severity code - Information only - required * RDBNAM - Relational database name -required * SRVDGN - Server Diagnostic Information -optional * * @exception DRDAProtocolException */ private void writeRDBUPDRM() throws DRDAProtocolException { database.RDBUPDRM_sent = true; writer.createDssReply(); writer.startDdm(CodePoint.RDBUPDRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, CodePoint.SVRCOD_INFO); writeRDBNAM(database.dbName); writer.endDdmAndDss(); } private String parsePKGNAMCT() throws DRDAProtocolException { reader.skipBytes(); return null; } /** * Parse PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number * Instance Variables * NAMESYMDR - database name - not validated * RDBCOLID - RDB Collection Identifier * PKGID - RDB Package Identifier * PKGCNSTKN - RDB Package Consistency Token * PKGSN - RDB Package Section Number * * @exception throws DRDAProtocolException */ private String parsePKGNAMCSN() throws DRDAProtocolException { rdbnam = null; rdbcolid = null; pkgid = null; secnumber = 0; if (reader.getDdmLength() == CodePoint.PKGNAMCSN_LEN) { // This is a scalar object with the following fields rdbnam = reader.readString(CodePoint.RDBNAM_LEN); if (SanityManager.DEBUG) trace("rdbnam = " + rdbnam); rdbcolid = reader.readString(CodePoint.RDBCOLID_LEN); if (SanityManager.DEBUG) trace("rdbcolid = " + rdbcolid); pkgid = reader.readString(CodePoint.PKGID_LEN); if (SanityManager.DEBUG) trace("pkgid = " + pkgid); // we need to use the same UCS2 encoding, as this can be // bounced back to jcc (or keep the byte array) pkgcnstknStr = reader.readString(CodePoint.PKGCNSTKN_LEN); if (SanityManager.DEBUG) trace("pkgcnstkn = " + pkgcnstknStr); secnumber = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("secnumber = " + secnumber); } else // extended format { int length = reader.readNetworkShort(); if (length < CodePoint.RDBNAM_LEN || length > CodePoint.MAX_NAME) badObjectLength(CodePoint.RDBNAM); rdbnam = reader.readString(length); if (SanityManager.DEBUG) trace("rdbnam = " + rdbnam); //RDBCOLID can be variable length in this format length = reader.readNetworkShort(); rdbcolid = reader.readString(length); if (SanityManager.DEBUG) trace("rdbcolid = " + rdbcolid); length = reader.readNetworkShort(); if (length != CodePoint.PKGID_LEN) badObjectLength(CodePoint.PKGID); pkgid = reader.readString(CodePoint.PKGID_LEN); if (SanityManager.DEBUG) trace("pkgid = " + pkgid); pkgcnstknStr = reader.readString(CodePoint.PKGCNSTKN_LEN); if (SanityManager.DEBUG) trace("pkgcnstkn = " + pkgcnstknStr); secnumber = reader.readNetworkShort(); if (SanityManager.DEBUG) trace("secnumber = " + secnumber); } // Note: This string is parsed by DRDAStatement.buildDB2CursorName() return rdbnam + " " + rdbcolid + " " + pkgid + " " + secnumber + " " + pkgcnstknStr; } /** * Parse SQLSTT Dss * @exception DRDAProtocolException */ private String parseSQLSTTDss() throws DRDAProtocolException { correlationID = reader.readDssHeader(); int codePoint = reader.readLengthAndCodePoint(); String strVal = parseEncodedString(); if (SanityManager.DEBUG) trace("SQL Statement = " + strVal); return strVal; } /** * Parse an encoded data string from the Application Requester * * @return string value * @exception DRDAProtocolException */ private String parseEncodedString() throws DRDAProtocolException { if (sqlamLevel < 7) return parseVCMorVCS(); else return parseNOCMorNOCS(); } /** * Parse variable character mixed byte or variable character single byte * Format * I2 - VCM Length * N bytes - VCM value * I2 - VCS Length * N bytes - VCS value * Only 1 of VCM length or VCS length can be non-zero * * @return string value */ private String parseVCMorVCS() throws DRDAProtocolException { String strVal = null; int vcm_length = reader.readNetworkShort(); if (vcm_length > 0) strVal = parseCcsidMBC(vcm_length); int vcs_length = reader.readNetworkShort(); if (vcs_length > 0) { if (strVal != null) agentError ("Both VCM and VCS have lengths > 0"); strVal = parseCcsidSBC(vcs_length); } return strVal; } /** * Parse nullable character mixed byte or nullable character single byte * Format * 1 byte - null indicator * I4 - mixed character length * N bytes - mixed character string * 1 byte - null indicator * I4 - single character length * N bytes - single character length string * * @return string value * @exception DRDAProtocolException */ private String parseNOCMorNOCS() throws DRDAProtocolException { byte nocm_nullByte = reader.readByte(); String strVal = null; int length; if (nocm_nullByte != NULL_VALUE) { length = reader.readNetworkInt(); strVal = parseCcsidMBC(length); } byte nocs_nullByte = reader.readByte(); if (nocs_nullByte != NULL_VALUE) { if (strVal != null) agentError("Both CM and CS are non null"); length = reader.readNetworkInt(); strVal = parseCcsidSBC(length); } return strVal; } /** * Parse mixed character string * * @return string value * @exception DRDAProtocolException */ private String parseCcsidMBC(int length) throws DRDAProtocolException { String strVal = null; DRDAStatement currentStatement; currentStatement = database.getCurrentStatement(); if (currentStatement == null) { currentStatement = database.getDefaultStatement(); currentStatement.initialize(); } String ccsidMBCEncoding = currentStatement.ccsidMBCEncoding; if (length == 0) return null; byte [] byteStr = reader.readBytes(length); if (ccsidMBCEncoding != null) { try { strVal = new String(byteStr, 0, length, ccsidMBCEncoding); } catch (UnsupportedEncodingException e) { agentError("Unsupported encoding " + ccsidMBCEncoding + "in parseCcsidMBC"); } } else agentError("Attempt to decode mixed byte string without CCSID being set"); return strVal; } /** * Parse single byte character string * * @return string value * @exception DRDAProtocolException */ private String parseCcsidSBC(int length) throws DRDAProtocolException { String strVal = null; String ccsidSBCEncoding = database.getCurrentStatement().ccsidSBCEncoding; if (length == 0) return null; byte [] byteStr = reader.readBytes(length); if (ccsidSBCEncoding != null) { try { strVal = new String(byteStr, 0, length, ccsidSBCEncoding); } catch (UnsupportedEncodingException e) { agentError("Unsupported encoding " + ccsidSBCEncoding + "in parseCcsidSBC"); } } else agentError("Attempt to decode single byte string without CCSID being set"); return strVal; } /** * Parse CLSQRY * Instance Variables * RDBNAM - relational database name - optional * PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required * QRYINSID - Query Instance Identifier - required - level 7 * MONITOR - Monitor events - optional. * * @return DRDAstatement being closed * @exception DRDAProtocolException, SQLException */ private DRDAStatement parseCLSQRY() throws DRDAProtocolException, SQLException { String pkgnamcsn = null; reader.markCollection(); long qryinsid = 0; boolean gotQryinsid = false; int codePoint = reader.getCodePoint(); while (codePoint != -1) { switch (codePoint) { // optional case CodePoint.RDBNAM: setDatabase(CodePoint.CLSQRY); break; // required case CodePoint.PKGNAMCSN: pkgnamcsn = parsePKGNAMCSN(); break; case CodePoint.QRYINSID: qryinsid = reader.readNetworkLong(); gotQryinsid = true; break; // optional case CodePoint.MONITOR: parseMONITOR(); break; default: invalidCodePoint(codePoint); } codePoint = reader.getCodePoint(); } // check for required variables if (pkgnamcsn == null) missingCodePoint(CodePoint.PKGNAMCSN); if (sqlamLevel >= MGRLVL_7 && !gotQryinsid) missingCodePoint(CodePoint.QRYINSID); DRDAStatement stmt = database.getDRDAStatement(pkgnamcsn); if (stmt == null) { //XXX should really throw a SQL Exception here invalidValue(CodePoint.PKGNAMCSN); } if (stmt.wasExplicitlyClosed()) { // JCC still sends a CLSQRY even though we have // implicitly closed the resultSet. // Then complains if we send the writeQRYNOPRM // So for now don't send it // Also metadata calls seem to get bound to the same // PGKNAMCSN, so even for explicit closes we have // to ignore. //writeQRYNOPRM(CodePoint.SVRCOD_ERROR); pkgnamcsn = null; } stmt.CLSQRY(); return stmt; } /** * Parse MONITOR * DRDA spec says this is optional. Since we * don't currently support it, we just ignore. */ private void parseMONITOR() throws DRDAProtocolException { // Just ignore it. reader.skipBytes(); return; } private void writeSQLCARDs(SQLException e, int updateCount) throws DRDAProtocolException { writeSQLCARDs(e, updateCount, false); } private void writeSQLCARDs(SQLException e, int updateCount, boolean sendSQLERRRM) throws DRDAProtocolException { int severity = CodePoint.SVRCOD_INFO; if (e == null) { writeSQLCARD(e,severity, updateCount, 0); return; } // instead of writing a chain of sql error or warning, we send the first one, this is // jcc/db2 limitation, see beetle 4629 // If it is a real SQL Error write a SQLERRRM first severity = getExceptionSeverity(e); if (sendSQLERRRM || (severity > CodePoint.SVRCOD_ERROR)) { writeSQLERRRM(severity); } writeSQLCARD(e,severity, updateCount, 0); } private int getSqlCode(int severity) { if (severity == CodePoint.SVRCOD_WARNING) // warning return 100; //CLI likes it else if (severity == CodePoint.SVRCOD_INFO) return 0; else return -1; } private void writeSQLCARD(SQLException e,int severity, int updateCount, long rowCount ) throws DRDAProtocolException { writer.createDssObject(); writer.startDdm(CodePoint.SQLCARD); writeSQLCAGRP(e, getSqlCode(severity), updateCount, rowCount); writer.endDdmAndDss(); // If we have a shutdown exception, restart the server. if (e != null) { String sqlState = e.getSQLState(); if (sqlState.regionMatches(0, SQLState.CLOUDSCAPE_SYSTEM_SHUTDOWN, 0, 5)) { // then we're here because of a shutdown exception; // "clean up" by restarting the server. try { server.startDB2j(); } catch (Exception restart) // any error messages should have already been printed, // so we ignore this exception here. {} } } } /** * Write a null SQLCARD as an object * * @exception DRDAProtocolException */ private void writeNullSQLCARDobject() throws DRDAProtocolException { writer.createDssObject(); writer.startDdm(CodePoint.SQLCARD); writeSQLCAGRP(null, 0, 0, 0); writer.endDdmAndDss(); } /** * Write SQLERRRM * * Instance Variables * SVRCOD - Severity Code - required * * @param severity severity of error * * @exception DRDAProtocolException */ private void writeSQLERRRM(int severity) throws DRDAProtocolException { writer.createDssReply(); writer.startDdm(CodePoint.SQLERRRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, severity); writer.endDdmAndDss (); } /** * Translate from Cloudscape exception severity to SVRCOD * * @param e SQLException */ private int getExceptionSeverity (SQLException e) { int severity= CodePoint.SVRCOD_INFO; if (e == null) return severity; int ec = e.getErrorCode(); switch (ec) { case ExceptionSeverity.STATEMENT_SEVERITY: case ExceptionSeverity.TRANSACTION_SEVERITY: severity = CodePoint.SVRCOD_ERROR; break; case ExceptionSeverity.WARNING_SEVERITY: severity = CodePoint.SVRCOD_WARNING; break; case ExceptionSeverity.SESSION_SEVERITY: case ExceptionSeverity.DATABASE_SEVERITY: case ExceptionSeverity.SYSTEM_SEVERITY: severity = CodePoint.SVRCOD_SESDMG; break; default: String sqlState = e.getSQLState(); if (sqlState != null && sqlState.startsWith("01")) // warning severity = CodePoint.SVRCOD_WARNING; else severity = CodePoint.SVRCOD_ERROR; } return severity; } /** * Write SQLCAGRP * * SQLCAGRP : FDOCA EARLY GROUP * SQL Communcations Area Group Description * * FORMAT FOR SQLAM <= 6 * SQLCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLSTATE; DRDA TYPE FCS; ENVLID 0x30; Length Override 5 * SQLERRPROC; DRDA TYPE FCS; ENVLID 0x30; Length Override 8 * SQLCAXGRP; DRDA TYPE N-GDA; ENVLID 0x52; Length Override 0 * * FORMAT FOR SQLAM >= 7 * SQLCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLSTATE; DRDA TYPE FCS; ENVLID 0x30; Length Override 5 * SQLERRPROC; DRDA TYPE FCS; ENVLID 0x30; Length Override 8 * SQLCAXGRP; DRDA TYPE N-GDA; ENVLID 0x52; Length Override 0 * SQLDIAGGRP; DRDA TYPE N-GDA; ENVLID 0x56; Length Override 0 * * @param e SQLException encountered * @param sqlcode sqlcode * * @exception DRDAProtocolException */ private void writeSQLCAGRP(SQLException e, int sqlcode, int updateCount, long rowCount) throws DRDAProtocolException { String sqlerrmc; String sqlState; String severeExceptionInfo = null; SQLException nextException = null; if (rowCount < 0 && updateCount < 0) { writer.writeByte(CodePoint.NULLDATA); return; } if (e == null) { sqlerrmc = null; sqlState = " "; // set to 5 blanks when no error } else { if (sqlcode < 0) { if (SanityManager.DEBUG && server.debugOutput) { trace("handle SQLException here"); trace("reason is: "+e.getMessage()); trace("SQLState is: "+e.getSQLState()); trace("vendorCode is: "+e.getErrorCode()); trace("nextException is: "+e.getNextException()); server.consoleExceptionPrint(e); trace("wrapping SQLException into SQLCARD..."); } } sqlState = e.getSQLState(); if (e instanceof EmbedSQLException) { EmbedSQLException ce = (EmbedSQLException) e; boolean severeException = (ce.getErrorCode() >= ExceptionSeverity.SESSION_SEVERITY); /* we need messageId to retrieve the localized message, just using * sqlstate may not be easy, because it is the messageId that we * used as key in the property file, for many sqlstates, they are * just the first 5 characters of the corresponding messageId. * We append messageId as the last element of sqlerrmc. We can't * send messageId in the place of sqlstate because jcc expects only * 5 chars for sqlstate. */ sqlerrmc = ""; byte[] sep = {20}; // use it as separator of sqlerrmc tokens byte[] errSep = {20, 20, 20}; // mark between exceptions String separator = new String(sep); String errSeparator = new String(errSep); String dbname = null; if (database != null) dbname = database.dbName; do { String messageId = ce.getMessageId(); // arguments are variable part of a message Object[] args = ce.getArguments(); for (int i = 0; args != null && i < args.length; i++) sqlerrmc += args[i].toString() + separator; // Severe exceptions need to be logged in the error log // also log location and non-localized message will be // returned to client as appended arguments if (severeException) { if (severeExceptionInfo == null) severeExceptionInfo = ""; severeExceptionInfo += ce.getMessage() + separator; println2Log(dbname, session.drdaID, ce.getMessage()); } sqlerrmc += messageId; //append MessageId e = ce.getNextException(); if (e != null) { if (e instanceof EmbedSQLException) { ce = (EmbedSQLException)e; sqlerrmc += errSeparator + ce.getSQLState() + ":"; } else { sqlerrmc += errSeparator + e.getSQLState() + ":"; ce = null; } } else ce = null; } while (ce != null); if (severeExceptionInfo != null) { severeExceptionInfo += "(" + "server log:" + server.getErrorLogLocation() + ")" ; sqlerrmc += separator + severeExceptionInfo; } } else sqlerrmc = e.getMessage(); } // Truncate the sqlerrmc to a length that the client can support. int maxlen = (sqlerrmc == null) ? -1 : Math.min(sqlerrmc.length(), appRequester.supportedMessageParamLength()); if ((maxlen >= 0) && (sqlerrmc.length() > maxlen)) // have to truncate so the client can handle it. sqlerrmc = sqlerrmc.substring(0, maxlen); //null indicator writer.writeByte(0); // SQLCODE writer.writeInt(sqlcode); // SQLSTATE writer.writeString(sqlState); // SQLERRPROC writer.writeString(server.prdId); // SQLCAXGRP writeSQLCAXGRP(updateCount, rowCount, sqlerrmc, nextException); } /** * Write SQLCAXGRP * * SQLCAXGRP : EARLY FDOCA GROUP * SQL Communications Area Exceptions Group Description * * FORMAT FOR SQLAM <= 6 * SQLRDBNME; DRDA TYPE FCS; ENVLID 0x30; Length Override 18 * SQLERRD1; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD2; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD3; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD4; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD5; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD6; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLWARN0; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN1; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN2; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN3; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN4; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN5; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN6; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN7; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN8; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN9; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARNA; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLERRMSG_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 70 * SQLERRMSG_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 70 * * FORMAT FOR SQLAM >= 7 * SQLERRD1; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD2; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD3; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD4; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD5; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLERRD6; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLWARN0; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN1; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN2; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN3; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN4; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN5; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN6; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN7; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN8; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARN9; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLWARNA; DRDA TYPE FCS; ENVLID 0x30; Length Override 1 * SQLRDBNAME; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 * SQLERRMSG_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 70 * SQLERRMSG_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 70 * @param e SQLException encountered * @param sqlcode sqlcode * * @exception DRDAProtocolException */ private void writeSQLCAXGRP(int updateCount, long rowCount, String sqlerrmc, SQLException nextException) throws DRDAProtocolException { writer.writeByte(0); // SQLCAXGRP INDICATOR if (sqlamLevel < 7) { writeRDBNAM(database.dbName); writeSQLCAERRWARN(updateCount, rowCount); } else { // SQL ERRD1 - D6, WARN0-WARNA (35 bytes) writeSQLCAERRWARN(updateCount, rowCount); writer.writeShort(0); //CCC on Win does not take RDBNAME } writeVCMorVCS(sqlerrmc); if (sqlamLevel >=7) writeSQLDIAGGRP(nextException); } /** * Write the ERR and WARN part of the SQLCA * * @param updateCount * @param rowCount */ private void writeSQLCAERRWARN(int updateCount, long rowCount) { // SQL ERRD1 - ERRD2 - row Count writer.writeInt((int)((rowCount>>>32))); writer.writeInt((int)(rowCount & 0x0000000ffffffffL)); // SQL ERRD3 - updateCount writer.writeInt(updateCount); // SQL ERRD4 - D6 (12 bytes) byte[] byteArray = new byte[1]; byteArray[0] = 0; writer.writeScalarPaddedBytes(byteArray, 12, (byte) 0); // WARN0-WARNA (11 bytes) byteArray[0] = ' '; //CLI tests need this to be blank writer.writeScalarPaddedBytes(byteArray, 11, (byte) ' '); } /** * Write SQLDIAGGRP: SQL Diagnostics Group Description - Identity 0xD1 * Nullable Group * SQLDIAGSTT; DRDA TYPE N-GDA; ENVLID 0xD3; Length Override 0 * SQLDIAGCN; DRFA TYPE N-RLO; ENVLID 0xF6; Length Override 0 * SQLDIAGCI; DRDA TYPE N-RLO; ENVLID 0xF5; Length Override 0 */ private void writeSQLDIAGGRP(SQLException nextException) throws DRDAProtocolException { writer.writeByte(CodePoint.NULLDATA); return; /** * TODO: Enable the following code when JCC can support SQLDIAGGRP * for all SQLCARD accesses. Commented out for now. */ /* if (nextException == null) { writer.writeByte(CodePoint.NULLDATA); return; } writeSQLDIAGSTT(); writeSQLDIAGCI(nextException); writeSQLDIAGCN(); */ } /* * writeSQLDIAGSTT: Write NULLDATA for now */ private void writeSQLDIAGSTT() throws DRDAProtocolException { writer.writeByte(CodePoint.NULLDATA); return; } /** * writeSQLDIAGCI: SQL Diagnostics Condition Information Array - Identity 0xF5 * SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1 * SQLDCIROW; ROW LID 0xE5; ELEMENT TAKEN 0(all); REP FACTOR 0(all) */ private void writeSQLDIAGCI(SQLException nextException) throws DRDAProtocolException { SQLException se = nextException; long rowNum = 1; /* Write the number of next exceptions to expect */ writeSQLNUMROW(se); while (se != null) { String sqlState = se.getSQLState(); int sqlCode = getSqlCode(getExceptionSeverity(se)); String sqlerrmc = ""; byte[] sep = {20}; // use it as separator of sqlerrmc tokens String separator = new String(sep); // arguments are variable part of a message Object[] args = ((EmbedSQLException)se).getArguments(); for (int i = 0; args != null && i < args.length; i++) sqlerrmc += args[i].toString() + separator; String dbname = null; if (database != null) dbname = database.dbName; writeSQLDCROW(rowNum++, sqlCode, sqlState, dbname, sqlerrmc); se = se.getNextException(); } writer.writeByte(CodePoint.NULLDATA); return; } /** * writeSQLNUMROW: Writes SQLNUMROW : FDOCA EARLY ROW * SQL Number of Elements Row Description * FORMAT FOR SQLAM LEVELS * SQLNUMGRP; GROUP LID 0x58; ELEMENT TAKEN 0(all); REP FACTOR 1 */ private void writeSQLNUMROW(SQLException nextException) throws DRDAProtocolException { writeSQLNUMGRP(nextException); } /** * writeSQLNUMGRP: Writes SQLNUMGRP : FDOCA EARLY GROUP * SQL Number of Elements Group Description * FORMAT FOR ALL SQLAM LEVELS * SQLNUM; DRDA TYPE I2; ENVLID 0x04; Length Override 2 */ private void writeSQLNUMGRP(SQLException nextException) throws DRDAProtocolException { int i=0; SQLException se; /* Count the number of chained exceptions to be sent */ for (se = nextException; se != null; se = se.getNextException()) i++; writer.writeInt(i); } /** * writeSQLDCROW: SQL Diagnostics Condition Row - Identity 0xE5 * SQLDCGRP; GROUP LID 0xD5; ELEMENT TAKEN 0(all); REP FACTOR 1 */ private void writeSQLDCROW(long rowNum, int sqlCode, String sqlState, String dbname, String sqlerrmc) throws DRDAProtocolException { writeSQLDCGRP(rowNum, sqlCode, sqlState, dbname, sqlerrmc); } /** * writeSQLDCGRP: SQL Diagnostics Condition Group Description * * SQLDCCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCSTATE; DRDA TYPE FCS; ENVLID Ox30; Lengeh Override 5 * SQLDCREASON; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCLINEN; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCROWN; DRDA TYPE FD; ENVLID 0x0E; Lengeh Override 31 * SQLDCER01; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCER02; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCER03; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCER04; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCPART; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCPPOP; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLDCMSGID; DRDA TYPE FCS; ENVLID 0x30; Length Override 10 * SQLDCMDE; DRDA TYPE FCS; ENVLID 0x30; Length Override 8 * SQLDCPMOD; DRDA TYPE FCS; ENVLID 0x30; Length Override 5 * SQLDCRDB; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 * SQLDCTOKS; DRDA TYPE N-RLO; ENVLID 0xF7; Length Override 0 * SQLDCMSG_m; DRDA TYPE NVMC; ENVLID 0x3F; Length Override 32672 * SQLDCMSG_S; DRDA TYPE NVCS; ENVLID 0x33; Length Override 32672 * SQLDCCOLN_m; DRDA TYPE NVCM ; ENVLID 0x3F; Length Override 255 * SQLDCCOLN_s; DRDA TYPE NVCS; ENVLID 0x33; Length Override 255 * SQLDCCURN_m; DRDA TYPE NVCM; ENVLID 0x3F; Length Override 255 * SQLDCCURN_s; DRDA TYPE NVCS; ENVLID 0x33; Length Override 255 * SQLDCPNAM_m; DRDA TYPE NVCM; ENVLID 0x3F; Length Override 255 * SQLDCPNAM_s; DRDA TYPE NVCS; ENVLID 0x33; Length Override 255 * SQLDCXGRP; DRDA TYPE N-GDA; ENVLID 0xD3; Length Override 1 */ private void writeSQLDCGRP(long rowNum, int sqlCode, String sqlState, String dbname, String sqlerrmc) throws DRDAProtocolException { // SQLDCCODE writer.writeInt(sqlCode); // SQLDCSTATE writer.writeString(sqlState); writer.writeInt(0); // REASON_CODE writer.writeInt(0); // LINE_NUMBER writer.writeLong(rowNum); // ROW_NUMBER byte[] byteArray = new byte[1]; writer.writeScalarPaddedBytes(byteArray, 47, (byte) 0); writer.writeShort(0); // CCC on Win does not take RDBNAME writer.writeByte(CodePoint.NULLDATA); // MESSAGE_TOKENS writer.writeLDString(sqlerrmc); // MESSAGE_TEXT writeVCMorVCS(null); // COLUMN_NAME writeVCMorVCS(null); // PARAMETER_NAME writeVCMorVCS(null); // EXTENDED_NAME writer.writeByte(CodePoint.NULLDATA); // SQLDCXGRP } /* * writeSQLDIAGCN: Write NULLDATA for now */ private void writeSQLDIAGCN() throws DRDAProtocolException { writer.writeByte(CodePoint.NULLDATA); return; } /** * Write SQLDARD * * SQLDARD : FDOCA EARLY ARRAY * SQL Descriptor Area Row Description with SQL Communications Area * * FORMAT FOR SQLAM <= 6 * SQLCARD; ROW LID 0x64; ELEMENT TAKEN 0(all); REP FACTOR 1 * SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1 * SQLDAROW; ROW LID 0x60; ELEMENT TAKEN 0(all); REP FACTOR 0(all) * * FORMAT FOR SQLAM >= 7 * SQLCARD; ROW LID 0x64; ELEMENT TAKEN 0(all); REP FACTOR 1 * SQLDHROW; ROW LID 0xE0; ELEMENT TAKEN 0(all); REP FACTOR 1 * SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1 * * @param ps prepared statement * * @exception DRDAProtocolException, SQLException */ private void writeSQLDARD(DRDAStatement stmt, boolean rtnOutput, SQLException e) throws DRDAProtocolException, SQLException { PreparedStatement ps = stmt.getPreparedStatement(); ResultSetMetaData rsmeta = ps.getMetaData(); EmbedParameterSetMetaData pmeta = ((EmbedPreparedStatement) ps).getEmbedParameterSetMetaData(); int numElems = 0; if (e == null || e instanceof SQLWarning) { if (rtnOutput && (rsmeta != null)) numElems = rsmeta.getColumnCount(); else if ((! rtnOutput) && (pmeta != null)) numElems = pmeta.getParameterCount(); } writer.createDssObject(); // all went well we will just write a null SQLCA writer.startDdm(CodePoint.SQLDARD); writeSQLCAGRP(e, getSqlCode(getExceptionSeverity(e)), 0, 0); if (sqlamLevel >= MGRLVL_7) writeSQLDHROW (stmt); //SQLNUMROW if (SanityManager.DEBUG) trace("num Elements = " + numElems); writer.writeShort(numElems); for (int i=0; i < numElems; i++) writeSQLDAGRP (rsmeta, pmeta, i, rtnOutput); writer.endDdmAndDss(); } /** * Write QRYDSC - Query Answer Set Description * * @param stmt associated statement * @param FDODSConly simply the FDODSC, without the wrap * * Instance Variables * SQLDTAGRP - required * * Only 84 columns can be sent in a single QRYDSC. If there are more columns * they must be sent in subsequent QRYDSC. * If the QRYDSC will not fit into the current block, as many columns as can * fit are sent and then the remaining are sent in the following blocks. * @param stmt DRDAStatement we are working on * @exception DRDAProtocolException, SQLException */ private void writeQRYDSC(DRDAStatement stmt, boolean FDODSConly) throws DRDAProtocolException, SQLException { ResultSet rs = null; ResultSetMetaData rsmeta = null; EmbedParameterSetMetaData pmeta = null; if (!stmt.needsToSendParamData) rs = stmt.getResultSet(); if (rs == null) // this is a CallableStatement, use parameter meta data pmeta = ((EmbedPreparedStatement) stmt.ps).getEmbedParameterSetMetaData(); else rsmeta = rs.getMetaData(); int numCols = (rsmeta != null ? rsmeta.getColumnCount() : pmeta.getParameterCount()); int numGroups = 1; int colStart = 1; int colEnd = numCols; int blksize = stmt.getBlksize() > 0 ? stmt.getBlksize() : CodePoint.QRYBLKSZ_MAX; // check for remaining space in current query block // Need to mod with blksize so remaining doesn't go negative. 4868 int remaining = blksize - (writer.getOffset() % blksize) - (3 + FdocaConstants.SQLCADTA_SQLDTARD_RLO_SIZE); // calcuate how may columns can be sent in the current query block int firstcols = remaining/FdocaConstants.SQLDTAGRP_COL_DSC_SIZE; // check if it doesn't all fit into the first block and // under FdocaConstants.MAX_VARS_IN_NGDA if (firstcols < numCols || numCols > FdocaConstants.MAX_VARS_IN_NGDA) { // we are limited to FdocaConstants.MAX_VARS_IN_NGDA if (firstcols > FdocaConstants.MAX_VARS_IN_NGDA) { if (SanityManager.DEBUG) SanityManager.ASSERT(numCols > FdocaConstants.MAX_VARS_IN_NGDA, "Number of columns " + numCols + " is less than MAX_VARS_IN_NGDA"); numGroups = numCols/FdocaConstants.MAX_VARS_IN_NGDA; // some left over if (FdocaConstants.MAX_VARS_IN_NGDA * numGroups < numCols) numGroups++; colEnd = FdocaConstants.MAX_VARS_IN_NGDA; } else { colEnd = firstcols; numGroups += (numCols-firstcols)/FdocaConstants.MAX_VARS_IN_NGDA; if (FdocaConstants.MAX_VARS_IN_NGDA * numGroups < numCols) numGroups++; } } if (! FDODSConly) { writer.createDssObject(); writer.startDdm(CodePoint.QRYDSC); } for (int i = 0; i < numGroups; i++) { writeSQLDTAGRP(stmt, rsmeta, pmeta, colStart, colEnd, (i == 0 ? true : false)); colStart = colEnd + 1; // 4868 - Limit range to MAX_VARS_IN_NGDA (used to have extra col) colEnd = colEnd + FdocaConstants.MAX_VARS_IN_NGDA; if (colEnd > numCols) colEnd = numCols; } writer.writeBytes(FdocaConstants.SQLCADTA_SQLDTARD_RLO); if (! FDODSConly) writer.endDdmAndDss(); } /** * Write SQLDTAGRP * SQLDAGRP : Late FDOCA GROUP * SQL Data Value Group Descriptor * LENGTH - length of the SQLDTAGRP * TRIPLET_TYPE - NGDA for first, CPT for following * ID - SQLDTAGRP_LID for first, NULL_LID for following * For each column * DRDA TYPE * LENGTH OVERRIDE * For numeric/decimal types * PRECISON * SCALE * otherwise * LENGTH or DISPLAY_WIDTH * * @param stmt drda statement * @param rsmeta resultset meta data * @param pmeta parameter meta data for CallableStatement * @param colStart starting column for group to send * @param colEnd end column to send * @param first is this the first group * * @exception DRDAProtocolException, SQLException */ private void writeSQLDTAGRP(DRDAStatement stmt, ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int colStart, int colEnd, boolean first) throws DRDAProtocolException, SQLException { int length = (FdocaConstants.SQLDTAGRP_COL_DSC_SIZE * ((colEnd+1) - colStart)) + 3; writer.writeByte(length); if (first) { writer.writeByte(FdocaConstants.NGDA_TRIPLET_TYPE); writer.writeByte(FdocaConstants.SQLDTAGRP_LID); } else { //continued writer.writeByte(FdocaConstants.CPT_TRIPLET_TYPE); writer.writeByte(FdocaConstants.NULL_LID); } boolean hasRs = (rsmeta != null); // if don't have result, then we look at parameter meta for (int i = colStart; i <= colEnd; i++) { boolean nullable = (hasRs ? (rsmeta.isNullable(i) == rsmeta.columnNullable) : (pmeta.isNullable(i) == JDBC30Translation.PARAMETER_NULLABLE)); int colType = (hasRs ? rsmeta.getColumnType(i) : pmeta.getParameterType(i)); int[] outlen = {-1}; int drdaType = (hasRs ?FdocaConstants.mapJdbcTypeToDrdaType(colType,nullable,outlen): stmt.getParamDRDAType(i)); boolean isDecimal = ((drdaType | 1) == FdocaConstants.DRDA_TYPE_NDECIMAL); int precision = 0, scale = 0; if (hasRs) { precision = rsmeta.getPrecision(i); scale = rsmeta.getScale(i); stmt.setRsDRDAType(i,drdaType); stmt.setRsPrecision(i, precision); stmt.setRsScale(i,scale); } else if (isDecimal) { if (stmt.isOutputParam(i)) ((CallableStatement) stmt.ps).registerOutParameter(i,Types.DECIMAL); precision = pmeta.getPrecision(i); scale = pmeta.getScale(i); } if (SanityManager.DEBUG) trace("jdbcType=" + colType + " \tdrdaType=" + Integer.toHexString(drdaType)); // Length or precision and scale for decimal values. writer.writeByte(drdaType); if (isDecimal) { writer.writeByte(precision); writer.writeByte(scale); } else if (outlen[0] != -1) writer.writeShort(outlen[0]); else if (hasRs) writer.writeShort(rsmeta.getColumnDisplaySize(i)); else writer.writeShort(stmt.getParamLen(i)); } } //pass PreparedStatement here so we can send correct holdability on the wire for jdk1.3 and higher //For jdk1.3, we provide hold cursor support through reflection. private void writeSQLDHROW (DRDAStatement stmt) throws DRDAProtocolException,SQLException { ResultSet rs = null; EmbedStatement rsstmt; if (!stmt.needsToSendParamData) rs = stmt.getResultSet(); if (rs != null) rsstmt = (EmbedStatement) rs.getStatement(); else rsstmt = (EmbedStatement) stmt.getPreparedStatement(); if (JVMInfo.JDK_ID < 2) //write null indicator for SQLDHROW because there is no holdability support prior to jdk1.3 { writer.writeByte(CodePoint.NULLDATA); return; } writer.writeByte(0); // SQLDHROW INDICATOR //SQLDHOLD writer.writeShort(rsstmt.getResultSetHoldability()); //SQLDRETURN writer.writeShort(0); //SQLDSCROLL writer.writeShort(0); //SQLDSENSITIVE writer.writeShort(0); //SQLDFCODE writer.writeShort(0); //SQLDKEYTYPE writer.writeShort(0); //SQLRDBNAME writer.writeShort(0); //CCC on Windows somehow does not take any dbname //SQLDSCHEMA writeVCMorVCS(null); } /** * Write QRYDTA - Query Answer Set Data * Contains some or all of the answer set data resulting from a query * returns true if there is more data, false if we reached the end * Instance Variables * Byte string * * @param stmt DRDA statement we are processing * @exception DRDAProtocolException, SQLException */ private void writeQRYDTA (DRDAStatement stmt) throws DRDAProtocolException, SQLException { boolean getMoreData = true; boolean sentExtData = false; int startOffset = writer.getOffset(); writer.createDssObject(); if (SanityManager.DEBUG) trace("Write QRYDTA"); writer.startDdm(CodePoint.QRYDTA); while(getMoreData) { sentExtData = false; getMoreData = writeFDODTA(stmt); if (stmt.getExtDtaObjects() != null) { writer.endDdmAndDss(); writeEXTDTA(stmt); getMoreData=false; sentExtData = true; } // if we don't have enough room for a row of the // last row's size, don't try to cram it in. // It would get split up but it is not very efficient. if (getMoreData == true) { int endOffset = writer.getOffset(); int rowsize = endOffset- startOffset; if ((stmt.getBlksize() - endOffset ) < rowsize) getMoreData = false; } } // If we sent extDta we will rely on // writeScalarStream to end the dss with the proper chaining. // otherwise end it here. if (! sentExtData) writer.endDdmAndDss(); if( (!stmt.hasdata()) && stmt.getQryclsimp() != CodePoint.QRYCLSIMP_NO && stmt.getQryprctyp() != CodePoint.LMTBLKPRC) stmt.rsClose(); } private boolean writeFDODTA (DRDAStatement stmt) throws DRDAProtocolException, SQLException { boolean hasdata = false; int blksize = stmt.getBlksize() > 0 ? stmt.getBlksize() : CodePoint.QRYBLKSZ_MAX; long rowCount = 0; ResultSet rs =null; boolean moreData = (stmt.getQryprctyp() == CodePoint.LMTBLKPRC); int numCols; if (!stmt.needsToSendParamData) { rs = stmt.getResultSet(); } if (rs != null) { numCols = stmt.getNumRsCols(); if (stmt.getScrollType() != 0) hasdata = positionCursor(stmt, rs); else hasdata = rs.next(); } else // it's for a CallableStatement { hasdata = stmt.hasOutputParams(); numCols = stmt.getNumParams(); } do { if (!hasdata) { doneData(stmt, rs); moreData = false; return moreData; } // Send ResultSet warnings if there are any SQLWarning sqlw = (rs != null)? rs.getWarnings(): null; if (sqlw == null) writeSQLCAGRP(null, 0, -1, -1); else writeSQLCAGRP(sqlw, sqlw.getErrorCode(), 1, -1); // if we were asked not to return data, mark QRYDTA null; do not // return yet, need to make rowCount right boolean noRetrieveRS = (rs != null && !stmt.getQryrtndta()); if (noRetrieveRS) writer.writeByte(0xFF); //QRYDTA null indicator: IS NULL else writer.writeByte(0); //QRYDTA null indicator: not null for (int i = 1; i <= numCols; i++) { if (noRetrieveRS) break; int drdaType; int ndrdaType; int precision; int scale; Object val = null; boolean valNull; if (rs != null) { drdaType = stmt.getRsDRDAType(i) & 0xff; precision = stmt.getRsPrecision(i); scale = stmt.getRsScale(i); ndrdaType = drdaType | 1; if (SanityManager.DEBUG) trace("!!drdaType = " + java.lang.Integer.toHexString(drdaType) + "precision = " + precision +" scale = " + scale); switch (ndrdaType) { case FdocaConstants.DRDA_TYPE_NLOBBYTES: writeFdocaVal(i,rs.getBlob(i),drdaType, precision,scale,rs.wasNull(),stmt); break; case FdocaConstants.DRDA_TYPE_NLOBCMIXED: writeFdocaVal(i,rs.getClob(i),drdaType, precision,scale,rs.wasNull(),stmt); break; case FdocaConstants.DRDA_TYPE_NINTEGER: int ival = rs.getInt(i); valNull = rs.wasNull(); if (SanityManager.DEBUG) trace("====== writing int: "+ ival + " is null: " + valNull); writeNullability(drdaType,valNull); if (! valNull) writer.writeInt(ival); break; case FdocaConstants.DRDA_TYPE_NSMALL: short sval = rs.getShort(i); valNull = rs.wasNull(); if (SanityManager.DEBUG) trace("====== writing small: "+ sval + " is null: " + valNull); writeNullability(drdaType,valNull); if (! valNull) writer.writeShort(sval); break; case FdocaConstants.DRDA_TYPE_NINTEGER8: long lval = rs.getLong(i); valNull = rs.wasNull(); if (SanityManager.DEBUG) trace("====== writing long: "+ lval + " is null: " + valNull); writeNullability(drdaType,valNull); if (! valNull) writer.writeLong(lval); break; case FdocaConstants.DRDA_TYPE_NFLOAT4: float fval = rs.getFloat(i); valNull = rs.wasNull(); if (SanityManager.DEBUG) trace("====== writing float: "+ fval + " is null: " + valNull); writeNullability(drdaType,valNull); if (! valNull) writer.writeFloat(fval); break; case FdocaConstants.DRDA_TYPE_NFLOAT8: double dval = rs.getDouble(i); valNull = rs.wasNull(); if (SanityManager.DEBUG) trace("====== writing double: "+ dval + " is null: " + valNull); writeNullability(drdaType,valNull); if (! valNull) writer.writeDouble(dval); break; case FdocaConstants.DRDA_TYPE_NCHAR: case FdocaConstants.DRDA_TYPE_NVARCHAR: case FdocaConstants.DRDA_TYPE_NVARMIX: case FdocaConstants.DRDA_TYPE_NLONG: case FdocaConstants.DRDA_TYPE_NLONGMIX: String valStr = rs.getString(i); if (SanityManager.DEBUG) trace("====== writing char/varchar/mix :"+ valStr + ":"); writeFdocaVal(i, valStr, drdaType, precision,scale,rs.wasNull(),stmt); break; default: writeFdocaVal(i, rs.getObject(i),drdaType, precision,scale,rs.wasNull(),stmt); } } else { drdaType = stmt.getParamDRDAType(i) & 0xff; precision = stmt.getParamPrecision(i); scale = stmt.getParamScale(i); ndrdaType = drdaType | 1; if (stmt.isOutputParam(i)) { if (SanityManager.DEBUG) trace("***getting Object "+i); val = ((CallableStatement) stmt.ps).getObject(i); valNull = (val == null); writeFdocaVal(i,val,drdaType,precision, scale, valNull,stmt); } else writeFdocaVal(i,null,drdaType,precision,scale,true,stmt); } } // does all this fit in one QRYDTA if (writer.getOffset() >= blksize) { splitQRYDTA(stmt, blksize); moreData = false; } if (rs == null) return moreData; //get the next row rowCount++; if (rowCount < stmt.getQryrowset()) { hasdata = rs.next(); } /*(1) scrollable we return at most a row set; OR (2) no retrieve data */ else if (stmt.getScrollType() != 0 || noRetrieveRS) moreData=false; } while (hasdata && rowCount < stmt.getQryrowset()); // add rowCount to statement row count // for non scrollable cursors if (stmt.getScrollType() == 0) stmt.rowCount += rowCount; if (!hasdata) { doneData(stmt, rs); moreData=false; } if (stmt.getScrollType() == 0) stmt.setHasdata(hasdata); return moreData; } /** * Split QRYDTA into blksize chunks * * @param stmt DRDA statment * @param blksize size of query block * * @exception SQLException, DRDAProtocolException */ private void splitQRYDTA(DRDAStatement stmt, int blksize) throws SQLException, DRDAProtocolException { // make copy of extra data byte [] temp = writer.copyDataToEnd(blksize); // truncate to end of blocksize writer.setOffset(blksize); int remain = temp.length; int start = 0; int dataLen = blksize - 10; //DSS header + QRYDTA and length while (remain > 0) { // finish off query block and send writer.endDdmAndDss(); finalizeChain(); // read CNTQRY - not sure why JCC sends this correlationID = reader.readDssHeader(); int codePoint = reader.readLengthAndCodePoint(); DRDAStatement contstmt = parseCNTQRY(); if (stmt != contstmt) agentError("continued query stmt not the same"); // start a new query block for the next row writer.createDssObject(); writer.startDdm(CodePoint.QRYDTA); // write out remaining data if (remain > blksize) { writer.writeBytes(temp, start, dataLen); remain -= dataLen; //DSS header + QRYDTA and length start += dataLen; } else { writer.writeBytes(temp, start, remain); remain = 0; } } } /** * Done data * Send SQLCARD for the end of the data * * @param stmt DRDA statement * @param rs Result set * @exception DRDAProtocolException,SQLException */ private void doneData(DRDAStatement stmt, ResultSet rs) throws DRDAProtocolException, SQLException { if (SanityManager.DEBUG) trace("*****NO MORE DATA!!"); int blksize = stmt.getBlksize() > 0 ? stmt.getBlksize() : CodePoint.QRYBLKSZ_MAX; if (rs != null) { if (stmt.getScrollType() != 0) { // for scrollable cursors - calculate the row count // since we may not have gone through each row rs.last(); stmt.rowCount = rs.getRow(); //reposition after last rs.afterLast(); } else // non-scrollable cursor { // for QRYCLSIMP_YES or SERVER_CHOICE close the rs int qryclsimp = stmt.getQryclsimp(); if (qryclsimp != CodePoint.QRYCLSIMP_NO && //For LMTBLKPRC, we reach the end early, but cursor should //not be closed prematurely. stmt.getQryprctyp() != CodePoint.LMTBLKPRC) { stmt.rsClose(); stmt.rsSuspend(); } } } // For scrollable cursor's QRYSCRAFT, when we reach here, DRDA spec says sqlstate // is 00000, sqlcode is not mentioned. But DB2 CLI code expects sqlcode to be 0. // We return sqlcode 0 in this case, as the DB2 server does. boolean isQRYSCRAFT = (stmt.getQryscrorn() == CodePoint.QRYSCRAFT); // sqlstate 02000 for end of data. // RESOLVE: Need statics for sqlcodes. writeSQLCAGRP(new SQLException("End of Data", (isQRYSCRAFT ? "00000" : "02000")), (isQRYSCRAFT ? 0 : 100), 0, stmt.rowCount); writer.writeByte(CodePoint.NULLDATA); // does all this fit in one QRYDTA if (writer.getOffset() >= blksize) { splitQRYDTA(stmt, blksize); } } /** * Position cursor for insensitive scrollable cursors * * @param stmt DRDA statement * @param rs Result set */ private boolean positionCursor(DRDAStatement stmt, ResultSet rs) throws SQLException, DRDAProtocolException { boolean retval = false; switch (stmt.getQryscrorn()) { case CodePoint.QRYSCRREL: //we aren't on a row - go to first row //JCC seems to use relative 1 to get to the first row //JDBC doesn't allow you to use relative unless you are on //a valid row so we cheat here. if (rs.isBeforeFirst() || rs.isAfterLast()) retval = rs.first(); else retval = rs.relative((int)stmt.getQryrownbr()); break; case CodePoint.QRYSCRABS: // JCC uses an absolute value of 0 which is not allowed in JDBC // We translate it into beforeFirst which seems to work. if (stmt.getQryrownbr() == 0) { rs.beforeFirst(); retval = false; } else { retval = rs.absolute((int)stmt.getQryrownbr()); } break; case CodePoint.QRYSCRAFT: rs.afterLast(); retval = false; break; case CodePoint.QRYSCRBEF: rs.beforeFirst(); retval = false; break; default: agentError("Invalid value for cursor orientation "+ stmt.getQryscrorn()); } return retval; } /** * Write SQLDAGRP * SQLDAGRP : EARLY FDOCA GROUP * SQL Data Area Group Description * * FORMAT FOR SQLAM <= 6 * SQLPRECISION; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLSCALE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLLENGTH; DRDA TYPE I4; ENVLID 0x02; Length Override 4 * SQLTYPE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLCCSID; DRDA TYPE FB; ENVLID 0x26; Length Override 2 * SQLNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30 * SQLNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30 * SQLLABEL_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30 * SQLLABEL_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30 * SQLCOMMENTS_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 254 * SQLCOMMENTS_m; DRDA TYPE VCS; ENVLID 0x32; Length Override 254 * * FORMAT FOR SQLAM == 6 * SQLPRECISION; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLSCALE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLLENGTH; DRDA TYPE I8; ENVLID 0x16; Length Override 8 * SQLTYPE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLCCSID; DRDA TYPE FB; ENVLID 0x26; Length Override 2 * SQLNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30 * SQLNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30 * SQLLABEL_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30 * SQLLABEL_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30 * SQLCOMMENTS_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 254 * SQLCOMMENTS_m; DRDA TYPE VCS; ENVLID 0x32; Length Override 254 * SQLUDTGRP; DRDA TYPE N-GDA; ENVLID 0x51; Length Override 0 * * FORMAT FOR SQLAM >= 7 * SQLPRECISION; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLSCALE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLLENGTH; DRDA TYPE I8; ENVLID 0x16; Length Override 8 * SQLTYPE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 * SQLCCSID; DRDA TYPE FB; ENVLID 0x26; Length Override 2 * SQLDOPTGRP; DRDA TYPE N-GDA; ENVLID 0xD2; Length Override 0 * * @param rsmeta resultset meta data * @param pmeta parameter meta data * @param elemNum column number we are returning (in case of result set), or, * parameter number (in case of parameter) * @param rtnOutput whether this is for a result set * * @exception DRDAProtocolException, SQLException */ private void writeSQLDAGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int elemNum, boolean rtnOutput) throws DRDAProtocolException, SQLException { //jdbc uses offset of 1 int jdbcElemNum = elemNum +1; // length to be retreived as output parameter int[] outlen = {-1}; int elemType = rtnOutput ? rsmeta.getColumnType(jdbcElemNum) : pmeta.getParameterType(jdbcElemNum); int precision = rtnOutput ? rsmeta.getPrecision(jdbcElemNum) : pmeta.getPrecision(jdbcElemNum); if (precision > FdocaConstants.NUMERIC_MAX_PRECISION) precision = FdocaConstants.NUMERIC_MAX_PRECISION; // 2-byte precision writer.writeShort(precision); // 2-byte scale int scale = (rtnOutput ? rsmeta.getScale(jdbcElemNum) : pmeta.getScale(jdbcElemNum)); writer.writeShort(scale); boolean nullable = rtnOutput ? (rsmeta.isNullable(jdbcElemNum) == ResultSetMetaData.columnNullable) : (pmeta.isNullable(jdbcElemNum) == JDBC30Translation.PARAMETER_NULLABLE); int sqlType = SQLTypes.mapJdbcTypeToDB2SqlType(elemType, nullable, outlen); if (outlen[0] == -1) //some types not set { switch (elemType) { case Types.DECIMAL: case Types.NUMERIC: scale = rtnOutput ? rsmeta.getScale(jdbcElemNum) : pmeta.getScale(jdbcElemNum); outlen[0] = ((precision <<8) | (scale <<0)); if (SanityManager.DEBUG) trace("\n\nprecision =" +precision + " scale =" + scale); break; default: outlen[0] = Math.min(FdocaConstants.LONGVARCHAR_MAX_LEN, (rtnOutput ? rsmeta.getColumnDisplaySize(jdbcElemNum) : pmeta.getPrecision(jdbcElemNum))); } } switch (elemType) { case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BLOB: //for CLI describe to be correct case Types.CLOB: outlen[0] = (rtnOutput ? rsmeta.getPrecision(jdbcElemNum) : pmeta.getPrecision(jdbcElemNum)); } if (SanityManager.DEBUG) trace("SQLDAGRP len =" + java.lang.Integer.toHexString(outlen[0]) + "for type:" + elemType); // 8 or 4 byte sqllength if (sqlamLevel >= MGRLVL_6) writer.writeLong(outlen[0]); else writer.writeInt(outlen[0]); String typeName = rtnOutput ? rsmeta.getColumnTypeName(jdbcElemNum) : pmeta.getParameterTypeName(jdbcElemNum); if (SanityManager.DEBUG) trace("jdbcType =" + typeName + " sqlType =" + sqlType + "len =" +outlen[0]); writer.writeShort(sqlType); // CCSID // CCSID should be 0 for Binary Types. if (elemType == java.sql.Types.CHAR || elemType == java.sql.Types.VARCHAR || elemType == java.sql.Types.LONGVARCHAR || elemType == java.sql.Types.CLOB) writer.writeScalar2Bytes(1208); else writer.writeScalar2Bytes(0); if (sqlamLevel < MGRLVL_7) { //SQLName writeVCMorVCS(rtnOutput ? rsmeta.getColumnName(jdbcElemNum) : null); //SQLLabel writeVCMorVCS(null); //SQLComments writeVCMorVCS(null); if (sqlamLevel == MGRLVL_6) writeSQLUDTGRP(rsmeta, pmeta, jdbcElemNum, rtnOutput); } else { writeSQLDOPTGRP(rsmeta, pmeta, jdbcElemNum, rtnOutput); } } /** * Write variable character mixed byte or single byte * The preference is to write mixed byte if it is defined for the server, * since that is our default and we don't allow it to be changed, we always * write mixed byte. * * @param s string to write * @exception DRDAProtocolException */ private void writeVCMorVCS(String s) throws DRDAProtocolException { //Write only VCM and 0 length for VCS if (s == null) { writer.writeShort(0); writer.writeShort(0); return; } // VCM writer.writeLDString(s); // VCS writer.writeShort(0); } private void writeSQLUDTGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int jdbcElemNum, boolean rtnOutput) throws DRDAProtocolException,SQLException { writer.writeByte(CodePoint.NULLDATA); } private void writeSQLDOPTGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int jdbcElemNum, boolean rtnOutput) throws DRDAProtocolException,SQLException { writer.writeByte(0); //SQLUNAMED writer.writeShort(0); //SQLName writeVCMorVCS(rtnOutput ? rsmeta.getColumnName(jdbcElemNum) : null); //SQLLabel writeVCMorVCS(null); //SQLComments writeVCMorVCS(null); //SQLDUDTGRP writeSQLUDTGRP(rsmeta, pmeta, jdbcElemNum, rtnOutput); //SQLDXGRP writeSQLDXGRP(rsmeta, pmeta, jdbcElemNum, rtnOutput); } private void writeSQLDXGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int jdbcElemNum, boolean rtnOutput) throws DRDAProtocolException,SQLException { // Null indicator indicates we have data writer.writeByte(0); // SQLXKEYMEM; DRDA TYPE I2; ENVLID 0x04; Length Override 2 // Hard to get primary key info. Send 0 for now writer.writeShort(0); // SQLXUPDATEABLE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 writer.writeShort(rtnOutput ? rsmeta.isWritable(jdbcElemNum) : false); // SQLXGENERATED; DRDA TYPE I2; ENVLID 0x04; Length Override 2 if (rtnOutput && rsmeta.isAutoIncrement(jdbcElemNum)) writer.writeShort(2); else writer.writeShort(0); // SQLXPARMMODE; DRDA TYPE I2; ENVLID 0x04; Length Override 2 if (pmeta != null && !rtnOutput) { int mode = pmeta.getParameterMode(jdbcElemNum); if (mode == JDBC30Translation.PARAMETER_MODE_UNKNOWN) { // For old style callable statements. We assume in/out if it // is an output parameter. int type = DRDAStatement.getOutputParameterTypeFromClassName( pmeta.getParameterClassName(jdbcElemNum)); if (type != DRDAStatement.NOT_OUTPUT_PARAM) mode = JDBC30Translation.PARAMETER_MODE_IN_OUT; } writer.writeShort(mode); } else { writer.writeShort(0); } // SQLXRDBNAM; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 // JCC uses this as the catalog name so we will send null. writer.writeShort(0); // SQLXCORNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255 // SQLXCORNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 writeVCMorVCS(null); // SQLXBASENAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255 // SQLXBASENAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 writeVCMorVCS(rtnOutput ? rsmeta.getTableName(jdbcElemNum) : null); // SQLXSCHEMA_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255 // SQLXSCHEMA_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 writeVCMorVCS(rtnOutput ? rsmeta.getSchemaName(jdbcElemNum): null); // SQLXNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255 // SQLXNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255 writeVCMorVCS(rtnOutput ? rsmeta.getColumnName(jdbcElemNum): null); } /** * Write Fdoca Value to client * @param index Index of column being returned * @param val Value to write to client * @param drdaType FD:OCA DRDA Type from FdocaConstants * @param precision Precision * @param stmt Statement being processed * * @exception DRDAProtocolException * @exception SQLException * * @see FdocaConstants */ protected void writeFdocaVal(int index, Object val, int drdaType, int precision, int scale, boolean valNull, DRDAStatement stmt) throws DRDAProtocolException, SQLException { writeNullability(drdaType,valNull); if (! valNull) { int ndrdaType = drdaType | 1; long valLength = 0; switch (ndrdaType) { case FdocaConstants.DRDA_TYPE_NSMALL: // DB2 does not have a BOOLEAN java.sql.bit type, // so we need to send it as a small if (val instanceof Boolean) { writer.writeShort(((Boolean) val).booleanValue()); } else if (val instanceof Short) writer.writeShort(((Short) val).shortValue()); else if (val instanceof Byte) writer.writeShort(((Byte) val).byteValue()); else writer.writeShort(((Integer) val).shortValue()); break; case FdocaConstants.DRDA_TYPE_NINTEGER: writer.writeInt(((Integer) val).intValue()); break; case FdocaConstants.DRDA_TYPE_NINTEGER8: writer.writeLong(((Long) val).longValue()); break; case FdocaConstants.DRDA_TYPE_NFLOAT4: writer.writeFloat(((Float) val).floatValue()); break; case FdocaConstants.DRDA_TYPE_NFLOAT8: writer.writeDouble(((Double) val).doubleValue()); break; case FdocaConstants.DRDA_TYPE_NDECIMAL: if (precision == 0) precision = FdocaConstants.NUMERIC_DEFAULT_PRECISION; BigDecimal bd = (java.math.BigDecimal) val; writer.writeBigDecimal(bd,precision,scale); break; case FdocaConstants.DRDA_TYPE_NDATE: writer.writeString(((java.sql.Date) val).toString()); break; case FdocaConstants.DRDA_TYPE_NTIME: writer.writeString(((java.sql.Time) val).toString()); break; case FdocaConstants.DRDA_TYPE_NTIMESTAMP: // we need to send it in a slightly different format, and pad it // up to or truncate it into 26 chars String ts1 = ((java.sql.Timestamp) val).toString(); String ts2 = ts1.replace(' ','-').replace(':','.'); int tsLen = ts2.length(); if (tsLen < 26) { for (int i = 0; i < 26-tsLen; i++) ts2 += "0"; } else if (tsLen > 26) ts2 = ts2.substring(0,26); writer.writeString(ts2); break; case FdocaConstants.DRDA_TYPE_NCHAR: writer.writeString(((String) val).toString()); break; case FdocaConstants.DRDA_TYPE_NVARCHAR: case FdocaConstants.DRDA_TYPE_NVARMIX: case FdocaConstants.DRDA_TYPE_NLONG: case FdocaConstants.DRDA_TYPE_NLONGMIX: //WriteLDString and generate warning if truncated // which will be picked up by checkWarning() writer.writeLDString(val.toString(), index); break; case FdocaConstants.DRDA_TYPE_NLOBBYTES: // do not send EXTDTA for lob of length 0, beetle 5967 valLength = ((Blob) val).length(); if (valLength > 0) stmt.addExtDtaObject(val, index); writer.writeExtendedLength (valLength); break; case FdocaConstants.DRDA_TYPE_NLOBCMIXED: valLength = ((Clob) val).length(); // do not send EXTDTA for lob of length 0, beetle 5967 if (valLength > 0) stmt.addExtDtaObject(val,index); writer.writeExtendedLength(valLength); break; case FdocaConstants.DRDA_TYPE_NFIXBYTE: writer.writeBytes((byte[]) val); break; case FdocaConstants.DRDA_TYPE_NVARBYTE: case FdocaConstants.DRDA_TYPE_NLONGVARBYTE: writer.writeLDBytes((byte[]) val, index); break; default: if (SanityManager.DEBUG) trace("ndrdaType is: "+ndrdaType); writer.writeLDString(val.toString(), index); } } } /** * write nullability if this is a nullable drdatype and FDOCA null * value if appropriate * @param drdaType FDOCA type * @param valNull true if this is a null value. False otherwise * **/ private void writeNullability(int drdaType, boolean valNull) { if(FdocaConstants.isNullable(drdaType)) { if (valNull) writer.writeByte(FdocaConstants.NULL_DATA); else { writer.writeByte(FdocaConstants.INDICATOR_NULLABLE); } } } /** * Methods to keep track of required codepoints */ /** * Copy a list of required code points to template for checking * * @param req list of required codepoints */ private void copyToRequired(int [] req) { currentRequiredLength = req.length; if (currentRequiredLength > required.length) required = new int[currentRequiredLength]; for (int i = 0; i < req.length; i++) required[i] = req[i]; } /** * Remove codepoint from required list * * @param codePoint - code point to be removed */ private void removeFromRequired(int codePoint) { for (int i = 0; i < currentRequiredLength; i++) if (required[i] == codePoint) required[i] = 0; } /** * Check whether we have seen all the required code points * * @param codePoint code point for which list of code points is required */ private void checkRequired(int codePoint) throws DRDAProtocolException { int firstMissing = 0; for (int i = 0; i < currentRequiredLength; i++) { if (required[i] != 0) { firstMissing = required[i]; break; } } if (firstMissing != 0) missingCodePoint(firstMissing); } /** * Error routines */ /** * Seen too many of this code point * * @param codePoint code point which has been duplicated * * @exception DRDAProtocolException */ private void tooMany(int codePoint) throws DRDAProtocolException { throwSyntaxrm(CodePoint.SYNERRCD_TOO_MANY, codePoint); } /** * Object too big * * @param codePoint code point with too big object * @exception DRDAProtocolException */ private void tooBig(int codePoint) throws DRDAProtocolException { throwSyntaxrm(CodePoint.SYNERRCD_TOO_BIG, codePoint); } /** * Object length not allowed * * @param codePoint code point with bad object length * @exception DRDAProtocolException */ private void badObjectLength(int codePoint) throws DRDAProtocolException { throwSyntaxrm(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED, codePoint); } /** * RDB not found * * @param rdbnam name of database * @exception DRDAProtocolException */ private void rdbNotFound(String rdbnam) throws DRDAProtocolException { Object[] oa = {rdbnam}; throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_RDBNFNRM, this,0, DRDAProtocolException.NO_ASSOC_ERRCD, oa); } /** * Invalid value for this code point * * @param codePoint code point value * @exception DRDAProtocolException */ private void invalidValue(int codePoint) throws DRDAProtocolException { throwSyntaxrm(CodePoint.SYNERRCD_REQ_VAL_NOT_FOUND, codePoint); } /** * Invalid codepoint for this command * * @param codePoint code point value * * @exception DRDAProtocolException */ private void invalidCodePoint(int codePoint) throws DRDAProtocolException { throwSyntaxrm(CodePoint.SYNERRCD_INVALID_CP_FOR_CMD, codePoint); } /** * Don't support this code point * * @param codePoint code point value * @exception DRDAProtocolException */ private void codePointNotSupported(int codePoint) throws DRDAProtocolException { throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_CMDNSPRM, this,codePoint, DRDAProtocolException.NO_ASSOC_ERRCD); } /** * Don't support this value * * @param codePoint code point value * @exception DRDAProtocolException */ private void valueNotSupported(int codePoint) throws DRDAProtocolException { throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_VALNSPRM, this,codePoint, DRDAProtocolException.NO_ASSOC_ERRCD); } /** * Verify that the code point is the required code point * * @param codePoint code point we have * @param reqCodePoint code point required at this time * * @exception DRDAProtocolException */ private void verifyRequiredObject(int codePoint, int reqCodePoint) throws DRDAProtocolException { if (codePoint != reqCodePoint ) { throwSyntaxrm(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND,codePoint); } } /** * Verify that the code point is in the right order * * @param codePoint code point we have * @param reqCodePoint code point required at this time * * @exception DRDAProtocolException */ private void verifyInOrderACCSEC_SECCHK(int codePoint, int reqCodePoint) throws DRDAProtocolException { if (codePoint != reqCodePoint ) { throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_PRCCNVRM, this, codePoint, CodePoint.PRCCNVCD_ACCSEC_SECCHK_WRONG_STATE); } } /** * Database name given under code point doesn't match previous database names * * @param codepoint codepoint where the mismatch occurred * * @exception DRDAProtocolException */ private void rdbnamMismatch(int codePoint) throws DRDAProtocolException { throw new DRDAProtocolException(DRDAProtocolException.DRDA_Proto_PRCCNVRM, this, codePoint, CodePoint.PRCCNVCD_RDBNAM_MISMATCH); } /** * Close the current session */ private void closeSession() { if (session == null) return; server.removeFromSessionTable(session.connNum); try { session.close(); } catch (SQLException se) { // If something went wrong closing down the session. // Print an error to the console and close this //thread. (6013) sendUnexpectedException(se); close(); } finally { session = null; database = null; appRequester=null; sockis = null; sockos=null; databaseAccessException=null; } } /** * Handle Exceptions - write error protocol if appropriate and close session * or thread as appropriate */ private void handleException(Exception e) { String dbname = null; if (database != null) dbname = database.dbName; // protocol error - write error message and close session if (e instanceof DRDAProtocolException) { try { DRDAProtocolException de = (DRDAProtocolException) e; println2Log(dbname,session.drdaID, e.getMessage()); server.consoleExceptionPrintTrace(e); reader.clearBuffer(); de.write(writer); finalizeChain(); closeSession(); close(); } catch (DRDAProtocolException ioe) { // There may be an IO exception in the write. println2Log(dbname,session.drdaID, e.getMessage()); server.consoleExceptionPrintTrace(ioe); closeSession(); close(); } } else { // something unexpected happened so let's kill this thread sendUnexpectedException(e); server.consoleExceptionPrintTrace(e); closeSession(); close(); } } /** * Send unpexpected error to the client * @param e Exception to be sent */ private void sendUnexpectedException(Exception e) { DRDAProtocolException unExpDe; String dbname = null; try { if (database != null) dbname = database.dbName; println2Log(dbname,session.drdaID, e.getMessage()); server.consoleExceptionPrintTrace(e); unExpDe = DRDAProtocolException.newAgentError(this, CodePoint.SVRCOD_PRMDMG, dbname, e.getMessage()); reader.clearBuffer(); unExpDe.write(writer); finalizeChain(); } catch (DRDAProtocolException nde) { // we can't tell the client, but we tried. } } /** * Test if DRDA connection thread is closed * * @return true if close; false otherwise */ private boolean closed() { synchronized (closeSync) { return close; } } /** * Get whether connections are logged * * @return true if connections are being logged; false otherwise */ private boolean getLogConnections() { synchronized(logConnectionsSync) { return logConnections; } } /** * Get time slice value for length of time to work on a session * * @return time slice */ private long getTimeSlice() { synchronized(timeSliceSync) { return timeSlice; } } /** * Send string to console * * @param value - value to print on console */ protected void trace(String value) { if (SanityManager.DEBUG && server.debugOutput == true) server.consoleMessage(value); } /*** * Show runtime memory * ***/ public static void showmem() { Runtime rt = null; Date d = null; rt = Runtime.getRuntime(); rt.gc(); d = new Date(); System.out.println("total memory: " + rt.totalMemory() + " free: " + rt.freeMemory() + " " + d.toString()); } /** * convert byte array to a Hex string * * @param buf buffer to convert * @return hex string representation of byte array */ private String convertToHexString(byte [] buf) { StringBuffer str = new StringBuffer(); str.append("0x"); String val; int byteVal; for (int i = 0; i < buf.length; i++) { byteVal = buf[i] & 0xff; val = Integer.toHexString(byteVal); if (val.length() < 2) str.append("0"); str.append(val); } return str.toString(); } /** * check that the given typdefnam is acceptable * * @param typdefnam * * @exception DRDAProtocolException */ private void checkValidTypDefNam(String typdefnam) throws DRDAProtocolException { if (typdefnam.equals("QTDSQL370")) return; if (typdefnam.equals("QTDSQL400")) return; if (typdefnam.equals("QTDSQLX86")) return; if (typdefnam.equals("QTDSQLASC")) return; if (typdefnam.equals("QTDSQLVAX")) return; if (typdefnam.equals("QTDSQLJVM")) return; invalidValue(CodePoint.TYPDEFNAM); } /** * Check that the length is equal to the required length for this codepoint * * @param codepoint codepoint we are checking * @param reqlen required length * * @exception DRDAProtocolException */ private void checkLength(int codepoint, int reqlen) throws DRDAProtocolException { long len = reader.getDdmLength(); if (len < reqlen) badObjectLength(codepoint); else if (len > reqlen) tooBig(codepoint); } /** * Read and check a boolean value * * @param codepoint codePoint to be used in error reporting * @return true or false depending on boolean value read * * @exception DRDAProtocolException */ private boolean readBoolean(int codepoint) throws DRDAProtocolException { checkLength(codepoint, 1); byte val = reader.readByte(); if (val == CodePoint.TRUE) return true; else if (val == CodePoint.FALSE) return false; else invalidValue(codepoint); return false; //to shut the compiler up } /** * Add a database to the current session * */ private void addDatabase(String dbname) { Database db = new Database(dbname); session.addDatabase(db); session.database = db; database = db; } /** * Set the current database * * @param codePoint codepoint we are processing * * @exception DRDAProtocolException */ private void setDatabase(int codePoint) throws DRDAProtocolException { String rdbnam = parseRDBNAM(); // using same database so we are done if (database != null && database.dbName.equals(rdbnam)) return; Database d = session.getDatabase(rdbnam); if (d == null) rdbnamMismatch(codePoint); else database = d; session.database = d; } /** * Write ENDUOWRM * Instance Variables * SVCOD - severity code - WARNING - required * UOWDSP - Unit of Work Disposition - required * RDBNAM - Relational Database name - optional * SRVDGN - Server Diagnostics information - optional * * @param opType - operation type 1 - commit, 2 -rollback */ private void writeENDUOWRM(int opType) { writer.createDssReply(); writer.startDdm(CodePoint.ENDUOWRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, CodePoint.SVRCOD_WARNING); writer.writeScalar1Byte(CodePoint.UOWDSP, opType); writer.endDdmAndDss(); } void writeEXTDTA (DRDAStatement stmt) throws SQLException, DRDAProtocolException { ArrayList extdtaValues = stmt.getExtDtaObjects(); // build the EXTDTA data, if necessary if (extdtaValues == null) return; boolean chainFlag, chainedWithSameCorrelator; boolean writeNullByte = false; for (int i = 0; i < extdtaValues.size(); i++) { // is this the last EXTDTA to be built? if (i != extdtaValues.size() - 1) { // no chainFlag = true; chainedWithSameCorrelator = true; } else { // yes chainFlag = false; //last blob DSS stream itself is NOT chained with the NEXT DSS chainedWithSameCorrelator = false; } if (sqlamLevel >= MGRLVL_7) if (stmt.isExtDtaValueNullable(i)) writeNullByte = true; Object o = extdtaValues.get(i); if (o instanceof Blob) { Blob b = (Blob) o; long blobLength = b.length(); writer.writeScalarStream (chainedWithSameCorrelator, CodePoint.EXTDTA, (int) Math.min(blobLength, Integer.MAX_VALUE), b.getBinaryStream (), writeNullByte); } else if (o instanceof Clob) { Clob c = (Clob) o; long[] outlen = {-1}; ByteArrayInputStream unicodeStream = convertClobToUnicodeStream(c, outlen); writer.writeScalarStream (chainedWithSameCorrelator, CodePoint.EXTDTA, (int) Math.min(outlen[0], Integer.MAX_VALUE), unicodeStream, writeNullByte); } else if (o instanceof byte[]) { byte[] b = (byte []) o; writer.writeScalarStream (chainedWithSameCorrelator, CodePoint.EXTDTA, (int) b.length, new ByteArrayInputStream(b), writeNullByte); } } // reset extdtaValues after sending stmt.clearExtDtaObjects(); } private java.io.ByteArrayInputStream convertClobToUnicodeStream ( Clob c, long outlen[]) throws SQLException { java.io.Reader characterStream = c.getCharacterStream(); // Extract all the characters and write into a StringWriter. java.io.StringWriter sw = new java.io.StringWriter (); try { int read = characterStream.read(); while (read != -1) { sw.write(read); read = characterStream.read(); } } catch (java.io.IOException e) { throw new SQLException (e.getMessage()); } // Extract the String from the StringWriter and extract the UTF-8 bytes. String string = sw.toString(); byte[] utf8Bytes = null; try { utf8Bytes = string.getBytes("UTF-8"); } catch (java.io.UnsupportedEncodingException e) { throw new SQLException (e.getMessage()); } // Create a new ByteArrayInputStream based on the bytes. outlen[0]= utf8Bytes.length; return new java.io.ByteArrayInputStream (utf8Bytes); } /** * Check SQLWarning and write SQLCARD as needed. * * @param conn connection to check * @param stmt statement to check * @param rs result set to check * @param updateCount update count to include in SQLCARD * @param alwaysSend whether always send SQLCARD regardless of * the existance of warnings * @param sendWarn whether to send any warnings or not. * * @exception DRDAProtocolException */ private void checkWarning(Connection conn, Statement stmt, ResultSet rs, int updateCount, boolean alwaysSend, boolean sendWarn) throws DRDAProtocolException, SQLException { // instead of writing a chain of sql warning, we send the first one, this is // jcc/db2 limitation, see beetle 4629 SQLWarning warning = null; SQLWarning reportWarning = null; try { if (stmt != null) { warning = stmt.getWarnings(); if (warning != null) { stmt.clearWarnings(); reportWarning = warning; } } if (rs != null) { warning = rs.getWarnings(); if (warning != null) { rs.clearWarnings(); if (reportWarning == null) reportWarning = warning; } } if (conn != null) { warning = conn.getWarnings(); if (warning != null) { conn.clearWarnings(); if (reportWarning == null) reportWarning = warning; } } } catch (SQLException se) { if (SanityManager.DEBUG) trace("got SQLException while trying to get warnings."); } if ((alwaysSend || reportWarning != null) && sendWarn) writeSQLCARDs(reportWarning, updateCount); } protected String buildRuntimeInfo(String indent, LocalizedResource localLangUtil ) { String s =""; if (session == null) return s; else s += session.buildRuntimeInfo("", localLangUtil); s += "\n"; return s; } /** * Finalize the current DSS chain and send it if * needed. */ private void finalizeChain() throws DRDAProtocolException { writer.finalizeChain(reader.getCurrChainState(), getOutputStream()); return; } }
3e18d2089437f235a09bbbbf1db64db402344888
334
java
Java
qulice-checkstyle/src/test/resources/com/qulice/checkstyle/TooLongLines.java
carlosmiranda/qulice
7adfc0622043d6ab7e5f33a53563a8553d4613f5
[ "BSD-3-Clause" ]
null
null
null
qulice-checkstyle/src/test/resources/com/qulice/checkstyle/TooLongLines.java
carlosmiranda/qulice
7adfc0622043d6ab7e5f33a53563a8553d4613f5
[ "BSD-3-Clause" ]
null
null
null
qulice-checkstyle/src/test/resources/com/qulice/checkstyle/TooLongLines.java
carlosmiranda/qulice
7adfc0622043d6ab7e5f33a53563a8553d4613f5
[ "BSD-3-Clause" ]
null
null
null
20.8125
85
0.687688
10,555
/** * Hello. */ package foo.bar; /** * Very long lines. * @deprecated Very very very very very very very very very very very long reason. * @version $Id$ * @author John Smith (lyhxr@example.com) */ @Deprecated public class TooLongLines { // @deprecated is used here because of very very very very very very long reason. }
3e18d2c0e411a454b81d60c0768fe853e404a847
2,321
java
Java
services/iam/src/main/java/com/huaweicloud/sdk/iam/v3/model/CreateTemporaryAccessKeyByTokenResponse.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
50
2020-05-18T11:35:20.000Z
2022-03-15T02:07:05.000Z
services/iam/src/main/java/com/huaweicloud/sdk/iam/v3/model/CreateTemporaryAccessKeyByTokenResponse.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
45
2020-07-06T03:34:12.000Z
2022-03-31T09:41:54.000Z
services/iam/src/main/java/com/huaweicloud/sdk/iam/v3/model/CreateTemporaryAccessKeyByTokenResponse.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
27
2020-05-28T11:08:44.000Z
2022-03-30T03:30:37.000Z
29.379747
106
0.658768
10,556
package com.huaweicloud.sdk.iam.v3.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.huaweicloud.sdk.core.SdkResponse; import java.util.Objects; import java.util.function.Consumer; /** Response Object */ public class CreateTemporaryAccessKeyByTokenResponse extends SdkResponse { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "credential") private Credential credential; public CreateTemporaryAccessKeyByTokenResponse withCredential(Credential credential) { this.credential = credential; return this; } public CreateTemporaryAccessKeyByTokenResponse withCredential(Consumer<Credential> credentialSetter) { if (this.credential == null) { this.credential = new Credential(); credentialSetter.accept(this.credential); } return this; } /** Get credential * * @return credential */ public Credential getCredential() { return credential; } public void setCredential(Credential credential) { this.credential = credential; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreateTemporaryAccessKeyByTokenResponse createTemporaryAccessKeyByTokenResponse = (CreateTemporaryAccessKeyByTokenResponse) o; return Objects.equals(this.credential, createTemporaryAccessKeyByTokenResponse.credential); } @Override public int hashCode() { return Objects.hash(credential); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateTemporaryAccessKeyByTokenResponse {\n"); sb.append(" credential: ").append(toIndentedString(credential)).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 "); } }
3e18d2c1b54acb33e9389bb346d8160697b44ddd
1,542
java
Java
modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java
andyglick/apache-geronimo-xbean
9836399660856485440d747c74d8c69875c77a89
[ "Apache-2.0" ]
null
null
null
modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java
andyglick/apache-geronimo-xbean
9836399660856485440d747c74d8c69875c77a89
[ "Apache-2.0" ]
null
null
null
modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java
andyglick/apache-geronimo-xbean
9836399660856485440d747c74d8c69875c77a89
[ "Apache-2.0" ]
null
null
null
29.653846
78
0.667315
10,557
/** * * Copyright 2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.geronimo.interop.rmi.iiop; public class ObjectRefHelper implements ObjectHelper { public static ObjectRefHelper getInstance(Class theClass) { return new ObjectRefHelper(); } public Object read(ObjectInputStream input) { return input._cdrInput.read_Object(); } public void write(ObjectOutputStream output, Object value) { if (value == null || value instanceof ObjectRef) { output._cdrOutput.write_Object((org.omg.CORBA.Object)value); } else if (value instanceof RemoteInterface) { RemoteInterface remote = (RemoteInterface)value; ObjectRef objectRef = remote.getObjectRef(); output._cdrOutput.write_Object(objectRef); } else { throw new IllegalArgumentException("class = " + value.getClass()); } } }
3e18d30ade2bb31ad58294448e69ae38349f1f93
3,110
java
Java
src/main/java/llnl/gnem/apps/detection/sdBuilder/templateDisplay/projections/DetectorProjection.java
LLNL/DFTT
935f3b79314486d07a11b37bbfaff9bf2a82683e
[ "MIT" ]
null
null
null
src/main/java/llnl/gnem/apps/detection/sdBuilder/templateDisplay/projections/DetectorProjection.java
LLNL/DFTT
935f3b79314486d07a11b37bbfaff9bf2a82683e
[ "MIT" ]
null
null
null
src/main/java/llnl/gnem/apps/detection/sdBuilder/templateDisplay/projections/DetectorProjection.java
LLNL/DFTT
935f3b79314486d07a11b37bbfaff9bf2a82683e
[ "MIT" ]
null
null
null
30.194175
128
0.633441
10,558
/* * #%L * Detection Framework (Release) * %% * Copyright (C) 2015 - 2020 Lawrence Livermore National Laboratory (LLNL) * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ package llnl.gnem.apps.detection.sdBuilder.templateDisplay.projections; /** * * @author dodge1 */ public class DetectorProjection { private final int detectorid; private final int shift; private final double projection; public DetectorProjection(int detectorid, int shift, double projection) { this.detectorid = detectorid; this.shift = shift; this.projection = projection; } @Override public String toString() { return "DetectorProjection{" + "detectorid=" + detectorid + ", shift=" + shift + ", projection=" + projection + '}'; } @Override public int hashCode() { int hash = 5; hash = 13 * hash + this.detectorid; hash = 13 * hash + this.shift; hash = 13 * hash + (int) (Double.doubleToLongBits(this.projection) ^ (Double.doubleToLongBits(this.projection) >>> 32)); return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final DetectorProjection other = (DetectorProjection) obj; if (this.detectorid != other.detectorid) { return false; } if (this.shift != other.shift) { return false; } if (Double.doubleToLongBits(this.projection) != Double.doubleToLongBits(other.projection)) { return false; } return true; } /** * @return the detectorid */ public int getDetectorid() { return detectorid; } /** * @return the shift */ public int getShift() { return shift; } /** * @return the projection */ public double getProjection() { return projection; } }
3e18d3886446435567a78109958e29ff49ebc1ad
4,382
java
Java
core/runtime/src/main/java/org/qi4j/runtime/unitofwork/BuilderEntityState.java
bwzhang2011/qi4j-sdk
be5f91e61a3b02e21f8f236fbaf85747f7f993ae
[ "Apache-2.0" ]
1
2017-08-08T03:09:29.000Z
2017-08-08T03:09:29.000Z
core/runtime/src/main/java/org/qi4j/runtime/unitofwork/BuilderEntityState.java
bwzhang2011/qi4j-sdk
be5f91e61a3b02e21f8f236fbaf85747f7f993ae
[ "Apache-2.0" ]
null
null
null
core/runtime/src/main/java/org/qi4j/runtime/unitofwork/BuilderEntityState.java
bwzhang2011/qi4j-sdk
be5f91e61a3b02e21f8f236fbaf85747f7f993ae
[ "Apache-2.0" ]
null
null
null
29.809524
131
0.687129
10,559
/* * Copyright (c) 2009, Rickard Öberg. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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.qi4j.runtime.unitofwork; import java.util.HashMap; import java.util.Map; import org.qi4j.api.common.QualifiedName; import org.qi4j.api.entity.EntityDescriptor; import org.qi4j.api.entity.EntityReference; import org.qi4j.api.util.Classes; import org.qi4j.spi.entity.EntityState; import org.qi4j.spi.entity.EntityStatus; import org.qi4j.spi.entity.ManyAssociationState; /** * JAVADOC */ public final class BuilderEntityState implements EntityState { private final EntityDescriptor entityType; private EntityReference reference; private final Map<QualifiedName, Object> properties; private final Map<QualifiedName, EntityReference> associations; private final Map<QualifiedName, ManyAssociationState> manyAssociations; public BuilderEntityState( EntityDescriptor type, EntityReference reference ) { entityType = type; this.reference = reference; properties = new HashMap<QualifiedName, Object>(); associations = new HashMap<QualifiedName, EntityReference>(); manyAssociations = new HashMap<QualifiedName, ManyAssociationState>(); } @Override public EntityReference identity() { return reference; } @Override public String version() { return ""; } @Override public long lastModified() { return 0; } @Override public void remove() { } @Override public EntityStatus status() { return EntityStatus.NEW; } @Override public boolean isAssignableTo( Class<?> type ) { return Classes.exactTypeSpecification( type ).satisfiedBy( entityType ); } @Override public EntityDescriptor entityDescriptor() { return entityType; } @Override public Object propertyValueOf( QualifiedName stateName ) { return properties.get( stateName ); } @Override public EntityReference associationValueOf( QualifiedName stateName ) { return associations.get( stateName ); } @Override public void setPropertyValue( QualifiedName stateName, Object newValue ) { properties.put( stateName, newValue ); } @Override public void setAssociationValue( QualifiedName stateName, EntityReference newEntity ) { associations.put( stateName, newEntity ); } @Override public ManyAssociationState manyAssociationValueOf( QualifiedName stateName ) { ManyAssociationState state = manyAssociations.get( stateName ); if( state == null ) { state = new BuilderManyAssociationState(); manyAssociations.put( stateName, state ); } return state; } public void copyTo( EntityState newEntityState ) { for( Map.Entry<QualifiedName, Object> stateNameStringEntry : properties.entrySet() ) { newEntityState.setPropertyValue( stateNameStringEntry.getKey(), stateNameStringEntry.getValue() ); } for( Map.Entry<QualifiedName, EntityReference> stateNameEntityReferenceEntry : associations.entrySet() ) { newEntityState.setAssociationValue( stateNameEntityReferenceEntry.getKey(), stateNameEntityReferenceEntry.getValue() ); } for( Map.Entry<QualifiedName, ManyAssociationState> stateNameManyAssociationStateEntry : manyAssociations.entrySet() ) { ManyAssociationState manyAssoc = newEntityState.manyAssociationValueOf( stateNameManyAssociationStateEntry.getKey() ); int idx = 0; for( EntityReference entityReference : stateNameManyAssociationStateEntry.getValue() ) { manyAssoc.add( idx, entityReference ); } } } }
3e18d44f35efad52fb650a51f05a770b0f8e281a
3,727
java
Java
src/main/java/org/kie/example/git/integration/githook/push/integration/GitHubIntegration.java
gonzalezcaf/bc-git-integration-push
a6418135d43b4b30102e260a7fb4b105de95cdda
[ "Apache-2.0" ]
2
2020-06-18T09:37:23.000Z
2020-06-26T14:16:56.000Z
src/main/java/org/kie/example/git/integration/githook/push/integration/GitHubIntegration.java
gonzalezcaf/bc-git-integration-push
a6418135d43b4b30102e260a7fb4b105de95cdda
[ "Apache-2.0" ]
2
2019-08-30T18:41:12.000Z
2020-04-27T15:32:48.000Z
src/main/java/org/kie/example/git/integration/githook/push/integration/GitHubIntegration.java
gonzalezcaf/bc-git-integration-push
a6418135d43b4b30102e260a7fb4b105de95cdda
[ "Apache-2.0" ]
4
2019-08-27T12:45:53.000Z
2020-11-20T06:34:39.000Z
39.648936
127
0.658707
10,560
/* * Copyright 2019 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.example.git.integration.githook.push.integration; import java.io.IOException; import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; import org.kohsuke.github.GHCreateRepositoryBuilder; import org.kohsuke.github.GHOrganization; import org.kohsuke.github.GHRepository; import org.kohsuke.github.GitHub; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.kie.example.git.integration.githook.push.properties.GitRemoteProperties; public class GitHubIntegration implements GitRemoteIntegration { private static final Logger LOGGER = LoggerFactory.getLogger(GitHubIntegration.class); private final GHOrganization organization; private GitHub github; private String user; private CredentialsProvider credentialsProvider; private boolean useSSH; public GitHubIntegration(final GitRemoteProperties props) { try { if (props.getToken().isEmpty()) { LOGGER.info("Unsecured connection using username and password since token is not provided in properties file"); github = GitHub.connectToEnterprise(props.getRemoteGitUrl(), props.getLogin(), props.getPassword()); credentialsProvider = new UsernamePasswordCredentialsProvider(props.getLogin(), props.getPassword()); } else { LOGGER.info("Connecting using secured token from properties file"); github = GitHub.connectUsingOAuth(props.getRemoteGitUrl(), props.getToken()); credentialsProvider = new UsernamePasswordCredentialsProvider(props.getToken(), ""); } user = github.getMyself().getLogin(); if (!props.getGitHubOrg().isEmpty()){ organization = github.getOrganization(props.getGitHubOrg()); } else { organization = null; } useSSH = props.getUseSSH(); } catch (IOException e) { LOGGER.error("An unexpected error occurred.", e); throw new RuntimeException(e); } } public String createRepository(String repoName) { try { final GHCreateRepositoryBuilder builder; if (organization != null){ builder = organization.createRepository(repoName); } else { builder = github.createRepository(repoName); } final GHRepository repo = builder.description("Created from Business Central: " + repoName) .autoInit(false) .create(); if (user.isEmpty()) { user = repo.getOwnerName(); } if (useSSH){ return repo.getSshUrl(); } return repo.getHttpTransportUrl(); } catch (IOException e) { LOGGER.error("An unexpected error occurred.", e); throw new RuntimeException(e); } } @Override public CredentialsProvider getCredentialsProvider() { return credentialsProvider; } }
3e18d4c2e2caebfa1f9383af58f8d440b8626049
2,969
java
Java
src/main/java/nl/bitmanager/elasticsearch/transport/NodeBroadcastRequest.java
pweerd/Elasticsearch-plugin
08fc0e8df4d55ab45b065bf75beedc18b84edd2f
[ "Apache-2.0" ]
2
2017-03-04T15:28:24.000Z
2021-03-08T16:26:33.000Z
src/main/java/nl/bitmanager/elasticsearch/transport/NodeBroadcastRequest.java
pweerd/Elasticsearch-plugin
08fc0e8df4d55ab45b065bf75beedc18b84edd2f
[ "Apache-2.0" ]
null
null
null
src/main/java/nl/bitmanager/elasticsearch/transport/NodeBroadcastRequest.java
pweerd/Elasticsearch-plugin
08fc0e8df4d55ab45b065bf75beedc18b84edd2f
[ "Apache-2.0" ]
null
null
null
34.929412
103
0.710003
10,561
/* * Licensed to De Bitmanager under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. De Bitmanager 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 nl.bitmanager.elasticsearch.transport; import java.io.IOException; import java.util.function.Supplier; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; public class NodeBroadcastRequest extends BaseNodesRequest<NodeBroadcastRequest> { private TransportItemBase transportItem; public final NodeActionDefinitionBase definition; protected final String id; public NodeBroadcastRequest(NodeActionDefinitionBase definition, TransportItemBase transportItem) { this.definition = definition; this.id = definition.id + ".NodeBroadcastRequest"; this.transportItem = transportItem; } public NodeBroadcastRequest(NodeActionDefinitionBase definition) { this(definition, definition.createTransportItem()); } public TransportItemBase getTransportItem() { return transportItem; } @Override public void readFrom(StreamInput in) throws IOException { if (definition.debug) System.out.printf("[%s]: readFrom\n", id); super.readFrom(in); transportItem = definition.createTransportItem(); transportItem.readFrom(in); if (definition.debug) System.out.printf("[%s]: readFrom->%s\n", id, transportItem); } @Override public void writeTo(StreamOutput out) throws IOException { if (definition.debug) System.out.printf("[%s]: writeTo item=%s\n", id, transportItem); super.writeTo(out); transportItem.writeTo(out); } /** Factory to passthrough the actiondefinition */ public static class Factory implements Supplier<NodeBroadcastRequest> { public final NodeActionDefinitionBase definition; public Factory(NodeActionDefinitionBase definition) { this.definition = definition; } @Override public NodeBroadcastRequest get() { if (definition.debug) System.out.println("new NodeBroadcastRequest()"); return new NodeBroadcastRequest(definition, null); } } }
3e18d4ebb1435d880d832d8f4bcf40b3892baa5a
48,616
java
Java
proto-google-cloud-dataproc-metastore-v1beta/src/main/java/com/google/cloud/metastore/v1beta/UpdateMetadataImportRequest.java
renovate-bot/java-dataproc-metastore
263e925b40fb1b8ab4b9f588578bb29f22e46f4a
[ "Apache-2.0" ]
1
2021-06-04T06:01:36.000Z
2021-06-04T06:01:36.000Z
proto-google-cloud-dataproc-metastore-v1beta/src/main/java/com/google/cloud/metastore/v1beta/UpdateMetadataImportRequest.java
renovate-bot/java-dataproc-metastore
263e925b40fb1b8ab4b9f588578bb29f22e46f4a
[ "Apache-2.0" ]
71
2021-03-25T20:55:43.000Z
2022-03-30T00:16:27.000Z
proto-google-cloud-dataproc-metastore-v1beta/src/main/java/com/google/cloud/metastore/v1beta/UpdateMetadataImportRequest.java
renovate-bot/java-dataproc-metastore
263e925b40fb1b8ab4b9f588578bb29f22e46f4a
[ "Apache-2.0" ]
4
2021-04-13T04:12:31.000Z
2021-10-07T04:49:39.000Z
35.616117
116
0.669923
10,562
/* * Copyright 2020 Google LLC * * 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 * * https://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. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/metastore/v1beta/metastore.proto package com.google.cloud.metastore.v1beta; /** * * * <pre> * Request message for * [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport]. * </pre> * * Protobuf type {@code google.cloud.metastore.v1beta.UpdateMetadataImportRequest} */ public final class UpdateMetadataImportRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.metastore.v1beta.UpdateMetadataImportRequest) UpdateMetadataImportRequestOrBuilder { private static final long serialVersionUID = 0L; // Use UpdateMetadataImportRequest.newBuilder() to construct. private UpdateMetadataImportRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private UpdateMetadataImportRequest() { requestId_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new UpdateMetadataImportRequest(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private UpdateMetadataImportRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.FieldMask.Builder subBuilder = null; if (updateMask_ != null) { subBuilder = updateMask_.toBuilder(); } updateMask_ = input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(updateMask_); updateMask_ = subBuilder.buildPartial(); } break; } case 18: { com.google.cloud.metastore.v1beta.MetadataImport.Builder subBuilder = null; if (metadataImport_ != null) { subBuilder = metadataImport_.toBuilder(); } metadataImport_ = input.readMessage( com.google.cloud.metastore.v1beta.MetadataImport.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(metadataImport_); metadataImport_ = subBuilder.buildPartial(); } break; } case 26: { java.lang.String s = input.readStringRequireUtf8(); requestId_ = s; break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.metastore.v1beta.MetastoreProto .internal_static_google_cloud_metastore_v1beta_UpdateMetadataImportRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.metastore.v1beta.MetastoreProto .internal_static_google_cloud_metastore_v1beta_UpdateMetadataImportRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.class, com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.Builder.class); } public static final int UPDATE_MASK_FIELD_NUMBER = 1; private com.google.protobuf.FieldMask updateMask_; /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the updateMask field is set. */ @java.lang.Override public boolean hasUpdateMask() { return updateMask_ != null; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The updateMask. */ @java.lang.Override public com.google.protobuf.FieldMask getUpdateMask() { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { return getUpdateMask(); } public static final int METADATA_IMPORT_FIELD_NUMBER = 2; private com.google.cloud.metastore.v1beta.MetadataImport metadataImport_; /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the metadataImport field is set. */ @java.lang.Override public boolean hasMetadataImport() { return metadataImport_ != null; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The metadataImport. */ @java.lang.Override public com.google.cloud.metastore.v1beta.MetadataImport getMetadataImport() { return metadataImport_ == null ? com.google.cloud.metastore.v1beta.MetadataImport.getDefaultInstance() : metadataImport_; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.cloud.metastore.v1beta.MetadataImportOrBuilder getMetadataImportOrBuilder() { return getMetadataImport(); } public static final int REQUEST_ID_FIELD_NUMBER = 3; private volatile java.lang.Object requestId_; /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @return The requestId. */ @java.lang.Override public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } } /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @return The bytes for requestId. */ @java.lang.Override public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (updateMask_ != null) { output.writeMessage(1, getUpdateMask()); } if (metadataImport_ != null) { output.writeMessage(2, getMetadataImport()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, requestId_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (updateMask_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getUpdateMask()); } if (metadataImport_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getMetadataImport()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, requestId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest)) { return super.equals(obj); } com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest other = (com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest) obj; if (hasUpdateMask() != other.hasUpdateMask()) return false; if (hasUpdateMask()) { if (!getUpdateMask().equals(other.getUpdateMask())) return false; } if (hasMetadataImport() != other.hasMetadataImport()) return false; if (hasMetadataImport()) { if (!getMetadataImport().equals(other.getMetadataImport())) return false; } if (!getRequestId().equals(other.getRequestId())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasUpdateMask()) { hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; hash = (53 * hash) + getUpdateMask().hashCode(); } if (hasMetadataImport()) { hash = (37 * hash) + METADATA_IMPORT_FIELD_NUMBER; hash = (53 * hash) + getMetadataImport().hashCode(); } hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; hash = (53 * hash) + getRequestId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Request message for * [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport]. * </pre> * * Protobuf type {@code google.cloud.metastore.v1beta.UpdateMetadataImportRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.metastore.v1beta.UpdateMetadataImportRequest) com.google.cloud.metastore.v1beta.UpdateMetadataImportRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.metastore.v1beta.MetastoreProto .internal_static_google_cloud_metastore_v1beta_UpdateMetadataImportRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.metastore.v1beta.MetastoreProto .internal_static_google_cloud_metastore_v1beta_UpdateMetadataImportRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.class, com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.Builder.class); } // Construct using com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); if (updateMaskBuilder_ == null) { updateMask_ = null; } else { updateMask_ = null; updateMaskBuilder_ = null; } if (metadataImportBuilder_ == null) { metadataImport_ = null; } else { metadataImport_ = null; metadataImportBuilder_ = null; } requestId_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.metastore.v1beta.MetastoreProto .internal_static_google_cloud_metastore_v1beta_UpdateMetadataImportRequest_descriptor; } @java.lang.Override public com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest getDefaultInstanceForType() { return com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.getDefaultInstance(); } @java.lang.Override public com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest build() { com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest buildPartial() { com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest result = new com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest(this); if (updateMaskBuilder_ == null) { result.updateMask_ = updateMask_; } else { result.updateMask_ = updateMaskBuilder_.build(); } if (metadataImportBuilder_ == null) { result.metadataImport_ = metadataImport_; } else { result.metadataImport_ = metadataImportBuilder_.build(); } result.requestId_ = requestId_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest) { return mergeFrom((com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest other) { if (other == com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest.getDefaultInstance()) return this; if (other.hasUpdateMask()) { mergeUpdateMask(other.getUpdateMask()); } if (other.hasMetadataImport()) { mergeMetadataImport(other.getMetadataImport()); } if (!other.getRequestId().isEmpty()) { requestId_ = other.requestId_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private com.google.protobuf.FieldMask updateMask_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> updateMaskBuilder_; /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the updateMask field is set. */ public boolean hasUpdateMask() { return updateMaskBuilder_ != null || updateMask_ != null; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The updateMask. */ public com.google.protobuf.FieldMask getUpdateMask() { if (updateMaskBuilder_ == null) { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } else { return updateMaskBuilder_.getMessage(); } } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { if (value == null) { throw new NullPointerException(); } updateMask_ = value; onChanged(); } else { updateMaskBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { if (updateMaskBuilder_ == null) { updateMask_ = builderForValue.build(); onChanged(); } else { updateMaskBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { if (updateMask_ != null) { updateMask_ = com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); } else { updateMask_ = value; } onChanged(); } else { updateMaskBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearUpdateMask() { if (updateMaskBuilder_ == null) { updateMask_ = null; onChanged(); } else { updateMask_ = null; updateMaskBuilder_ = null; } return this; } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { onChanged(); return getUpdateMaskFieldBuilder().getBuilder(); } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { if (updateMaskBuilder_ != null) { return updateMaskBuilder_.getMessageOrBuilder(); } else { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } } /** * * * <pre> * Required. A field mask used to specify the fields to be overwritten in the * metadata import resource by the update. * Fields specified in the `update_mask` are relative to the resource (not * to the full request). A field is overwritten if it is in the mask. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> getUpdateMaskFieldBuilder() { if (updateMaskBuilder_ == null) { updateMaskBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder>( getUpdateMask(), getParentForChildren(), isClean()); updateMask_ = null; } return updateMaskBuilder_; } private com.google.cloud.metastore.v1beta.MetadataImport metadataImport_; private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.metastore.v1beta.MetadataImport, com.google.cloud.metastore.v1beta.MetadataImport.Builder, com.google.cloud.metastore.v1beta.MetadataImportOrBuilder> metadataImportBuilder_; /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the metadataImport field is set. */ public boolean hasMetadataImport() { return metadataImportBuilder_ != null || metadataImport_ != null; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The metadataImport. */ public com.google.cloud.metastore.v1beta.MetadataImport getMetadataImport() { if (metadataImportBuilder_ == null) { return metadataImport_ == null ? com.google.cloud.metastore.v1beta.MetadataImport.getDefaultInstance() : metadataImport_; } else { return metadataImportBuilder_.getMessage(); } } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMetadataImport(com.google.cloud.metastore.v1beta.MetadataImport value) { if (metadataImportBuilder_ == null) { if (value == null) { throw new NullPointerException(); } metadataImport_ = value; onChanged(); } else { metadataImportBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMetadataImport( com.google.cloud.metastore.v1beta.MetadataImport.Builder builderForValue) { if (metadataImportBuilder_ == null) { metadataImport_ = builderForValue.build(); onChanged(); } else { metadataImportBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeMetadataImport(com.google.cloud.metastore.v1beta.MetadataImport value) { if (metadataImportBuilder_ == null) { if (metadataImport_ != null) { metadataImport_ = com.google.cloud.metastore.v1beta.MetadataImport.newBuilder(metadataImport_) .mergeFrom(value) .buildPartial(); } else { metadataImport_ = value; } onChanged(); } else { metadataImportBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearMetadataImport() { if (metadataImportBuilder_ == null) { metadataImport_ = null; onChanged(); } else { metadataImport_ = null; metadataImportBuilder_ = null; } return this; } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.cloud.metastore.v1beta.MetadataImport.Builder getMetadataImportBuilder() { onChanged(); return getMetadataImportFieldBuilder().getBuilder(); } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.cloud.metastore.v1beta.MetadataImportOrBuilder getMetadataImportOrBuilder() { if (metadataImportBuilder_ != null) { return metadataImportBuilder_.getMessageOrBuilder(); } else { return metadataImport_ == null ? com.google.cloud.metastore.v1beta.MetadataImport.getDefaultInstance() : metadataImport_; } } /** * * * <pre> * Required. The metadata import to update. The server only merges fields * in the import if they are specified in `update_mask`. * The metadata import's `name` field is used to identify the metastore * import to be updated. * </pre> * * <code> * .google.cloud.metastore.v1beta.MetadataImport metadata_import = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.metastore.v1beta.MetadataImport, com.google.cloud.metastore.v1beta.MetadataImport.Builder, com.google.cloud.metastore.v1beta.MetadataImportOrBuilder> getMetadataImportFieldBuilder() { if (metadataImportBuilder_ == null) { metadataImportBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.metastore.v1beta.MetadataImport, com.google.cloud.metastore.v1beta.MetadataImport.Builder, com.google.cloud.metastore.v1beta.MetadataImportOrBuilder>( getMetadataImport(), getParentForChildren(), isClean()); metadataImport_ = null; } return metadataImportBuilder_; } private java.lang.Object requestId_ = ""; /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @return The requestId. */ public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @return The bytes for requestId. */ public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @param value The requestId to set. * @return This builder for chaining. */ public Builder setRequestId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } requestId_ = value; onChanged(); return this; } /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @return This builder for chaining. */ public Builder clearRequestId() { requestId_ = getDefaultInstance().getRequestId(); onChanged(); return this; } /** * * * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to * ignore the request if it has completed. The server will ignore subsequent * requests that provide a duplicate request ID for at least 60 minutes after * the first request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * * @param value The bytes for requestId to set. * @return This builder for chaining. */ public Builder setRequestIdBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); requestId_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.metastore.v1beta.UpdateMetadataImportRequest) } // @@protoc_insertion_point(class_scope:google.cloud.metastore.v1beta.UpdateMetadataImportRequest) private static final com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest(); } public static com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<UpdateMetadataImportRequest> PARSER = new com.google.protobuf.AbstractParser<UpdateMetadataImportRequest>() { @java.lang.Override public UpdateMetadataImportRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new UpdateMetadataImportRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<UpdateMetadataImportRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<UpdateMetadataImportRequest> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.metastore.v1beta.UpdateMetadataImportRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
3e18d559dd02328603d54928050d0b232ba21b85
1,306
java
Java
Assignment_2-1/Recipient1_326/src/main/java/seu/Recipient.java
shellqiqi/distributed-system-design-course
a5e2d3f807d7586f276efc8deb706614d91a8b52
[ "MIT" ]
1
2018-05-17T07:07:01.000Z
2018-05-17T07:07:01.000Z
Assignment_2-1/Recipient1_326/src/main/java/seu/Recipient.java
shellqiqi/distributed-system-design-course
a5e2d3f807d7586f276efc8deb706614d91a8b52
[ "MIT" ]
null
null
null
Assignment_2-1/Recipient1_326/src/main/java/seu/Recipient.java
shellqiqi/distributed-system-design-course
a5e2d3f807d7586f276efc8deb706614d91a8b52
[ "MIT" ]
null
null
null
33.487179
96
0.598009
10,563
package seu; import java.io.IOException; import java.io.ObjectInputStream; import java.net.ServerSocket; import java.net.Socket; import java.text.SimpleDateFormat; import java.util.Date; public class Recipient { public void start(int port) throws IOException, ClassNotFoundException { ServerSocket serverSocket = new ServerSocket(port); Socket socket = serverSocket.accept(); ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream()); System.out.printf("%-10s%-10s%-15s%-15s\n", "random1", "random2", "timer", "localtime"); for (int i = 0; i < 20; i++) { Object object = inputStream.readObject(); if (object != null) { Message received = (Message)object; if (received.getRandom1() == 2) break; logLine(received); } else break; } inputStream.close(); socket.close(); serverSocket.close(); System.out.println("Done."); } private void logLine(Message message) { System.out.printf("%-10d%-10d%-15s%-15s\n", message.getRandom1(), message.getRandom2(), message.getTimer(), new SimpleDateFormat("HH:mm:ss:SSS").format(new Date())); } }
3e18d594607612c074adbdf5524e53f7702a7bfc
6,741
java
Java
org.eclipse.datatools.modelbase.sql/src/org/eclipse/datatools/modelbase/sql/datatypes/impl/ReferenceDataTypeImpl.java
KangZhiDong/DataToolsPlatform
76be044c0c2a413f09e1f00bf4a4ce08c52be070
[ "Apache-2.0" ]
1
2021-02-26T11:17:27.000Z
2021-02-26T11:17:27.000Z
org.eclipse.datatools.modelbase.sql/src/org/eclipse/datatools/modelbase/sql/datatypes/impl/ReferenceDataTypeImpl.java
KangZhiDong/DataToolsPlatform
76be044c0c2a413f09e1f00bf4a4ce08c52be070
[ "Apache-2.0" ]
null
null
null
org.eclipse.datatools.modelbase.sql/src/org/eclipse/datatools/modelbase/sql/datatypes/impl/ReferenceDataTypeImpl.java
KangZhiDong/DataToolsPlatform
76be044c0c2a413f09e1f00bf4a4ce08c52be070
[ "Apache-2.0" ]
null
null
null
30.2287
157
0.695297
10,564
/******************************************************************************* * Copyright (c) 2001, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.datatools.modelbase.sql.datatypes.impl; import java.util.Collection; import org.eclipse.datatools.modelbase.sql.datatypes.ReferenceDataType; import org.eclipse.datatools.modelbase.sql.datatypes.SQLDataTypesPackage; import org.eclipse.datatools.modelbase.sql.datatypes.StructuredUserDefinedType; import org.eclipse.datatools.modelbase.sql.tables.Table; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Reference Data Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.datatools.modelbase.sql.datatypes.impl.ReferenceDataTypeImpl#getScopeTable <em>Scope Table</em>}</li> * <li>{@link org.eclipse.datatools.modelbase.sql.datatypes.impl.ReferenceDataTypeImpl#getReferencedType <em>Referenced Type</em>}</li> * </ul> * </p> * * @generated */ public abstract class ReferenceDataTypeImpl extends ConstructedDataTypeImpl implements ReferenceDataType { /** * The cached value of the '{@link #getScopeTable() <em>Scope Table</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getScopeTable() * @generated * @ordered */ protected Table scopeTable; /** * The cached value of the '{@link #getReferencedType() <em>Referenced Type</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getReferencedType() * @generated * @ordered */ protected StructuredUserDefinedType referencedType; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ReferenceDataTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return SQLDataTypesPackage.Literals.REFERENCE_DATA_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Table getScopeTable() { if (scopeTable != null && scopeTable.eIsProxy()) { InternalEObject oldScopeTable = (InternalEObject)scopeTable; scopeTable = (Table)eResolveProxy(oldScopeTable); if (scopeTable != oldScopeTable) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SQLDataTypesPackage.REFERENCE_DATA_TYPE__SCOPE_TABLE, oldScopeTable, scopeTable)); } } return scopeTable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Table basicGetScopeTable() { return scopeTable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setScopeTable(Table newScopeTable) { Table oldScopeTable = scopeTable; scopeTable = newScopeTable; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SQLDataTypesPackage.REFERENCE_DATA_TYPE__SCOPE_TABLE, oldScopeTable, scopeTable)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public StructuredUserDefinedType getReferencedType() { if (referencedType != null && referencedType.eIsProxy()) { InternalEObject oldReferencedType = (InternalEObject)referencedType; referencedType = (StructuredUserDefinedType)eResolveProxy(oldReferencedType); if (referencedType != oldReferencedType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SQLDataTypesPackage.REFERENCE_DATA_TYPE__REFERENCED_TYPE, oldReferencedType, referencedType)); } } return referencedType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public StructuredUserDefinedType basicGetReferencedType() { return referencedType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setReferencedType(StructuredUserDefinedType newReferencedType) { StructuredUserDefinedType oldReferencedType = referencedType; referencedType = newReferencedType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SQLDataTypesPackage.REFERENCE_DATA_TYPE__REFERENCED_TYPE, oldReferencedType, referencedType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SQLDataTypesPackage.REFERENCE_DATA_TYPE__SCOPE_TABLE: if (resolve) return getScopeTable(); return basicGetScopeTable(); case SQLDataTypesPackage.REFERENCE_DATA_TYPE__REFERENCED_TYPE: if (resolve) return getReferencedType(); return basicGetReferencedType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case SQLDataTypesPackage.REFERENCE_DATA_TYPE__SCOPE_TABLE: setScopeTable((Table)newValue); return; case SQLDataTypesPackage.REFERENCE_DATA_TYPE__REFERENCED_TYPE: setReferencedType((StructuredUserDefinedType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case SQLDataTypesPackage.REFERENCE_DATA_TYPE__SCOPE_TABLE: setScopeTable((Table)null); return; case SQLDataTypesPackage.REFERENCE_DATA_TYPE__REFERENCED_TYPE: setReferencedType((StructuredUserDefinedType)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case SQLDataTypesPackage.REFERENCE_DATA_TYPE__SCOPE_TABLE: return scopeTable != null; case SQLDataTypesPackage.REFERENCE_DATA_TYPE__REFERENCED_TYPE: return referencedType != null; } return super.eIsSet(featureID); } } //ReferenceDataTypeImpl
3e18d5a52035ddb0fc9af00f1a157cf554c8de29
1,478
java
Java
src/test/java/reincarnation/coder/java/JavaCoderNamingTest.java
Teletha/Reincarnation
39dddafacefb37223111b053fee159cfa922b7b6
[ "MIT" ]
null
null
null
src/test/java/reincarnation/coder/java/JavaCoderNamingTest.java
Teletha/Reincarnation
39dddafacefb37223111b053fee159cfa922b7b6
[ "MIT" ]
null
null
null
src/test/java/reincarnation/coder/java/JavaCoderNamingTest.java
Teletha/Reincarnation
39dddafacefb37223111b053fee159cfa922b7b6
[ "MIT" ]
2
2021-12-06T02:04:17.000Z
2022-01-01T11:30:12.000Z
32.844444
137
0.67659
10,565
/* * Copyright (C) 2020 Reincarnation Development Team * * Licensed under the MIT License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://opensource.org/licenses/MIT */ package reincarnation.coder.java; import org.junit.jupiter.api.Test; /** * @version 2018/10/19 14:21:51 */ class JavaCoderNamingTest { Object anonymous = new Object() { }; class Member { } @Test void simpleName() { class Local { } assert JavaCoder.computeSimpleName(String.class).equals("String"); assert JavaCoder.computeSimpleName(anonymous.getClass()).equals("JavaCoderNamingTest$1"); assert JavaCoder.computeSimpleName(Local.class).equals("JavaCoderNamingTest$1Local"); assert JavaCoder.computeSimpleName(Member.class).equals("Member"); } @Test void name() { class Local { } assert JavaCoder.computeName(String.class).equals("java.lang.String"); assert JavaCoder.computeName(anonymous.getClass()).equals("reincarnation.coder.java.JavaCoderNamingTest$JavaCoderNamingTest$1"); assert JavaCoder.computeName(Local.class).equals("reincarnation.coder.java.JavaCoderNamingTest$JavaCoderNamingTest$2Local"); assert JavaCoder.computeName(Member.class).equals("reincarnation.coder.java.JavaCoderNamingTest$Member"); } }
3e18d5b8ab8b823d35cce6e2af5a86f389cf5cf6
936
java
Java
android/src/lt/markmerkk/game/AndroidLauncher.java
marius-m/racer_test
0980eb4c01340d465599d0e0334db0fd1ff3ea5d
[ "Apache-2.0" ]
1
2020-12-08T13:16:27.000Z
2020-12-08T13:16:27.000Z
android/src/lt/markmerkk/game/AndroidLauncher.java
marius-m/racer_test
0980eb4c01340d465599d0e0334db0fd1ff3ea5d
[ "Apache-2.0" ]
null
null
null
android/src/lt/markmerkk/game/AndroidLauncher.java
marius-m/racer_test
0980eb4c01340d465599d0e0334db0fd1ff3ea5d
[ "Apache-2.0" ]
null
null
null
30.193548
87
0.672009
10,566
package lt.markmerkk.game; import android.content.Context; import android.os.Bundle; import android.support.multidex.MultiDex; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import lt.markmerkk.app.RacerGame; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); // fixme no initializer for android initialize( new RacerGame( true, "192.168.1.52" ), config ); } @Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(newBase); MultiDex.install(this); } }
3e18d6deef2fc69ee413ebc3adfafb065e1c493b
1,323
java
Java
api/src/main/java/org/commonjava/indy/util/ValuePipe.java
pkocandr/indy
ca7233edea09b2a55be930f471d91a3b0d21bc31
[ "Apache-2.0" ]
22
2016-07-21T13:32:44.000Z
2022-03-16T20:20:11.000Z
api/src/main/java/org/commonjava/indy/util/ValuePipe.java
pkocandr/indy
ca7233edea09b2a55be930f471d91a3b0d21bc31
[ "Apache-2.0" ]
865
2015-12-11T16:59:17.000Z
2022-03-23T09:02:56.000Z
api/src/main/java/org/commonjava/indy/util/ValuePipe.java
pkocandr/indy
ca7233edea09b2a55be930f471d91a3b0d21bc31
[ "Apache-2.0" ]
39
2015-12-10T16:11:29.000Z
2022-02-26T11:28:46.000Z
22.810345
109
0.652305
10,567
/** * Copyright (C) 2011-2020 Red Hat, Inc. (https://github.com/Commonjava/indy) * * 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.commonjava.indy.util; /** * ValuePipe can hold a single value object. We can use it to wrap a collection object to avoid unintentional * toString that may produce huge strings. * @param <T> */ public class ValuePipe<T> { private T value; public ValuePipe() { } public ValuePipe( T value ) { this.value = value; } public boolean isFilled() { return value != null; } public boolean isEmpty() { return value == null; } public synchronized T get() { return value; } public synchronized void set( final T value ) { this.value = value; } }
3e18d75d93bb88c2ffc0acbcdc39cd6151b395cf
1,865
java
Java
src/main/java/com/cdut/b2p/modules/sys/controller/SysChatController.java
zhangshengba/b2p
0071726d103c0c9538974fcc11d8a62aae98743c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/cdut/b2p/modules/sys/controller/SysChatController.java
zhangshengba/b2p
0071726d103c0c9538974fcc11d8a62aae98743c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/cdut/b2p/modules/sys/controller/SysChatController.java
zhangshengba/b2p
0071726d103c0c9538974fcc11d8a62aae98743c
[ "Apache-2.0" ]
null
null
null
31.610169
87
0.789812
10,568
package com.cdut.b2p.modules.sys.controller; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * @title SysChatController * @desc SysChatController类是有关交流的处理类 * @author zsb * */ import org.springframework.web.servlet.ModelAndView; import com.cdut.b2p.common.controller.BaseController; import com.cdut.b2p.common.utils.DateUtils; import com.cdut.b2p.modules.shop.po.ShopChat; import com.cdut.b2p.modules.shop.service.ShopChatService; @Controller @RequestMapping("${sysPath}/admin/chat") public class SysChatController extends BaseController{ @Autowired private ShopChatService shopChatService; /** * @desc 获取所有的订单 * @param response * @return */ @RequestMapping(value="/all",method=RequestMethod.POST) public String getAllChat(HttpServletResponse response) { ModelAndView model=new ModelAndView(); List<ShopChat> list=shopChatService.findAllChat(); model.addObject("ChatList", list); return renderString(response, model); } /** * @desc 获取某一时间段内的聊天记录 * @param response * @param request * @return */ @RequestMapping(value="/selectByDate",method=RequestMethod.POST) public String getChatByDate(HttpServletResponse response,HttpServletRequest request) { ModelAndView model=new ModelAndView(); Date startDate=DateUtils.parseDate(request.getParameter("startDate")); Date endDate=DateUtils.parseDate(request.getParameter("endDate")); List<ShopChat> list=shopChatService.findChatByDate(startDate, endDate); model.addObject("ChatList2", model); return renderString(response, model); } }
3e18d77319d442ca88a5a63173f36be517bbbf08
210
java
Java
damai-server/src/main/java/cn/ecnu/damai/dao/mapper/CityMapper.java
xiaomaibos/damai-grpc
1ba48e9461e43e25cbda9dfbb5faa1a41fcf5a35
[ "MIT" ]
null
null
null
damai-server/src/main/java/cn/ecnu/damai/dao/mapper/CityMapper.java
xiaomaibos/damai-grpc
1ba48e9461e43e25cbda9dfbb5faa1a41fcf5a35
[ "MIT" ]
null
null
null
damai-server/src/main/java/cn/ecnu/damai/dao/mapper/CityMapper.java
xiaomaibos/damai-grpc
1ba48e9461e43e25cbda9dfbb5faa1a41fcf5a35
[ "MIT" ]
null
null
null
15
33
0.690476
10,569
package cn.ecnu.damai.dao.mapper; import cn.ecnu.damai.entity.City; import java.util.List; /** * @author Kyrie Lee * @date 2021/5/11 14:19 */ public interface CityMapper { List<City> getCityList(); }
3e18d7c36bfebd1435f995d1979843d744edfdf5
4,761
java
Java
src/main/java/com/fzk/translate/respnode/java/TranslateNode.java
FanZhouk/note_translation
aef335879b3dea238593ed60deb46ebbd96b0fac
[ "Apache-2.0" ]
null
null
null
src/main/java/com/fzk/translate/respnode/java/TranslateNode.java
FanZhouk/note_translation
aef335879b3dea238593ed60deb46ebbd96b0fac
[ "Apache-2.0" ]
null
null
null
src/main/java/com/fzk/translate/respnode/java/TranslateNode.java
FanZhouk/note_translation
aef335879b3dea238593ed60deb46ebbd96b0fac
[ "Apache-2.0" ]
null
null
null
28.413174
108
0.533614
10,570
package com.fzk.translate.respnode.java; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.fzk.translate.respnode.ProcessContext; import com.fzk.translate.respnode.RespNode; import com.fzk.translate.util.HttpUtils; import java.net.URLEncoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 翻译节点 * <p> * 使用有道云API,文档地址:https://ai.youdao.com/docs/doc-trans-api.s#p01 */ public class TranslateNode extends RespNode { private static final String appKey = "kgfhvu9qnh3mr6eel97y6fq2hezzol8z"; private static final String privateKey = "949d1u22cbffbrarjh182eig55721odj"; @Override public List<String> process(ProcessContext context) throws Exception { List<String> result = new ArrayList<>(context.result.size()); for (String section : context.result) { String salt = String.valueOf(System.currentTimeMillis()); Map map = new HashMap(); map.put("q", section); map.put("from", "EN"); map.put("to", "zh-CHS"); map.put("appKey", appKey); map.put("salt", salt); map.put("sign", md5(appKey + section + salt + privateKey)); String res = HttpUtils.doGet(getUrlWithQueryString("http://openapi.youdao.com/api", map)); JSONObject jo = JSON.parseObject(res); Object translation = jo.get("translation"); System.out.println(translation); if (translation != null) result.add(((JSONArray)translation).get(0).toString()); } context.result = result; return go(context); } public static void main(String[] args) throws NoSuchAlgorithmException { String query = "你好"; String salt = String.valueOf(System.currentTimeMillis()); String from = "zh-CHS"; String to = "EN"; String sign = md5(appKey + query + salt + privateKey); System.out.println(sign); Map params = new HashMap(); params.put("q", query); params.put("from", from); params.put("to", to); params.put("sign", sign); params.put("salt", salt); params.put("appKey", appKey); System.out.println(HttpUtils.doGet(getUrlWithQueryString("http://openapi.youdao.com/api", params))); } /** * 生成32位MD5摘要 * * @param string * @return */ public static String md5(String string) { if (string == null) { return null; } char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; try { byte[] btInput = string.getBytes("utf-8"); /** 获得MD5摘要算法的 MessageDigest 对象 */ MessageDigest mdInst = MessageDigest.getInstance("MD5"); /** 使用指定的字节更新摘要 */ mdInst.update(btInput); /** 获得密文 */ byte[] md = mdInst.digest(); /** 把密文转换成十六进制的字符串形式 */ int j = md.length; char str[] = new char[j * 2]; int k = 0; for (byte byte0 : md) { str[k++] = hexDigits[byte0 >>> 4 & 0xf]; str[k++] = hexDigits[byte0 & 0xf]; } return new String(str); } catch (Exception e) { return null; } } /** * 根据api地址和参数生成请求URL * * @param url * @param params * @return */ public static String getUrlWithQueryString(String url, Map params) { if (params == null) { return url; } StringBuilder builder = new StringBuilder(url); if (url.contains("?")) { builder.append("&"); } else { builder.append("?"); } int i = 0; for (Object key : params.keySet()) { String value = (String) params.get(key); if (value == null) { // 过滤空的key continue; } if (i != 0) { builder.append('&'); } builder.append(key); builder.append('='); builder.append(encode(value)); i++; } return builder.toString(); } /** * 进行URL编码 * * @param input * @return */ public static String encode(String input) { if (input == null) { return ""; } try { return URLEncoder.encode(input, "utf-8"); } catch (Exception e) { e.printStackTrace(); } return input; } }
3e18d9be40b0b3254f4f1dd5b25e81a310e13e8c
51,407
java
Java
src/util-public/smartrplace-util-public/src/main/java/org/smartrplace/util/directobjectgui/ObjectResourceGUIHelper.java
smartrplace/api-draft
ff82b639aacde097c00d3088e3bfb9a393bf47c2
[ "Apache-2.0" ]
null
null
null
src/util-public/smartrplace-util-public/src/main/java/org/smartrplace/util/directobjectgui/ObjectResourceGUIHelper.java
smartrplace/api-draft
ff82b639aacde097c00d3088e3bfb9a393bf47c2
[ "Apache-2.0" ]
null
null
null
src/util-public/smartrplace-util-public/src/main/java/org/smartrplace/util/directobjectgui/ObjectResourceGUIHelper.java
smartrplace/api-draft
ff82b639aacde097c00d3088e3bfb9a393bf47c2
[ "Apache-2.0" ]
null
null
null
37.578216
172
0.724434
10,571
/** * Copyright 2018 Smartrplace UG * * 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.smartrplace.util.directobjectgui; import java.awt.IllegalComponentStateException; import java.math.BigInteger; import java.util.Map; import org.ogema.core.application.ApplicationManager; import org.ogema.core.model.Resource; import org.ogema.core.model.array.ArrayResource; import org.ogema.core.model.simple.BooleanResource; import org.ogema.core.model.simple.FloatResource; import org.ogema.core.model.simple.IntegerResource; import org.ogema.core.model.simple.SingleValueResource; import org.ogema.core.model.simple.StringResource; import org.ogema.core.model.simple.TimeResource; import org.ogema.core.model.units.TemperatureResource; import org.ogema.tools.resource.util.ResourceUtils; import org.ogema.tools.resource.util.TimeUtils; import org.ogema.tools.resource.util.ValueResourceUtils; import org.smartrplace.tissue.util.format.StringFormatHelperSP; import org.smartrplace.tissue.util.resource.ValueResourceHelperSP; import org.smartrplace.util.directresourcegui.LabelLongValue; import org.smartrplace.util.directresourcegui.SingleValueResourceAccess; import org.smartrplace.util.file.ApacheFileAdditions; import org.smartrplace.util.format.ValueConverter; import org.smartrplace.util.format.ValueFormat; import org.smartrplace.util.format.WidgetHelper; import de.iwes.util.format.StringFormatHelper; import de.iwes.util.resource.ResourceHelper; import de.iwes.widgets.api.widgets.OgemaWidget; import de.iwes.widgets.api.widgets.WidgetPage; import de.iwes.widgets.api.widgets.dynamics.TriggeredAction; import de.iwes.widgets.api.widgets.dynamics.TriggeringAction; import de.iwes.widgets.api.widgets.localisation.OgemaLocale; import de.iwes.widgets.api.widgets.sessionmanagement.OgemaHttpRequest; import de.iwes.widgets.html.alert.Alert; import de.iwes.widgets.html.complextable.RowTemplate.Row; import de.iwes.widgets.html.form.button.TemplateInitSingleEmpty; import de.iwes.widgets.html.form.button.TemplateRedirectButton; import de.iwes.widgets.html.form.dropdown.DropdownData; import de.iwes.widgets.html.form.label.Label; import de.iwes.widgets.html.form.textfield.TextField; import de.iwes.widgets.resource.widget.calendar.DatepickerTimeResource; import de.iwes.widgets.resource.widget.dropdown.ResourceDropdown; import de.iwes.widgets.resource.widget.dropdown.ValueResourceDropdown; import de.iwes.widgets.resource.widget.init.ResourceRedirectButton; import de.iwes.widgets.resource.widget.textfield.BooleanResourceCheckbox; /** Provides support for efficient generation of widgets to display, edit and further use resources in tables and * item edit/display pages. In this generic version the template item type T may be arbitrary, but a resource * type has to be specified that can be derived from the template type via the method {@link #getResource(OgemaHttpRequest)}. */ public abstract class ObjectResourceGUIHelper<T, R extends Resource> extends ObjectGUIHelperBase<T> { protected abstract R getResource(T object, OgemaHttpRequest req); protected boolean doRegisterDependentWidgets = false; //one of init or fixedGatewayInfo them must be null protected final TemplateInitSingleEmpty<T> initObject; protected final ApplicationManager appMan; /** Constructor used by detail pages showing content of a single resource selected by InitWidget*/ public ObjectResourceGUIHelper(WidgetPage<?> page, TemplateInitSingleEmpty<T> init, ApplicationManager appMan, boolean acceptMissingResources) { super(page, acceptMissingResources); this.initObject = init; this.appMan = appMan; } /** Used for initialization by ObjectGUITablePage */ public ObjectResourceGUIHelper(WidgetPage<?> page, T fixedGatewayInfo, ApplicationManager appMan, boolean acceptMissingResources) { super(page, fixedGatewayInfo, acceptMissingResources); this.initObject = null; this.appMan = appMan; } /** Used to initialize rows, DetailPopupButton*/ public ObjectResourceGUIHelper(OgemaWidget parent, OgemaHttpRequest req, T fixedGatewayInfo, ApplicationManager appMan, boolean acceptMissingResources) { super(parent, req, fixedGatewayInfo, acceptMissingResources); this.initObject = null; this.appMan = appMan; } public OgemaWidget valueEdit(String widgetId, String lineId, final SingleValueResource source, Row row, Alert alert) { if(source instanceof StringResource) return stringEdit(widgetId, lineId, (StringResource) source, row, alert); if(source instanceof FloatResource) return floatEdit(widgetId, lineId, (FloatResource) source, row, alert, -Float.MAX_VALUE, Float.MAX_VALUE, null); if(source instanceof BooleanResource) return booleanEdit(widgetId, lineId, (BooleanResource) source, row); if(source instanceof IntegerResource) return integerEdit(widgetId, lineId, (IntegerResource) source, row, alert, Integer.MIN_VALUE, Integer.MAX_VALUE, null); throw new IllegalArgumentException("SingleValueResource type "+source.getResourceType()+ " not supported."); } public Label stringLabel(String widgetId, String lineId, final StringResource source, Row row) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = stringLabel(widgetId + lineId, source, null, null); finishRowSnippet(row, widgetId, result); return result; } public Label stringLabel(String widgetId, String lineId, final String text, Row row) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = stringLabel(widgetId + lineId, null, null, text); finishRowSnippet(row, widgetId, result); return result; } public Label stringLabel(final StringResource source) { counter++; return stringLabel("stringLabel"+counter, source, null, null); } public Label stringLabel(final String subResourceName) { counter++; return stringLabel("stringLabel"+counter, (StringResource)null, subResourceName, null); } private Label stringLabel(String widgetId, final StringResource optSource, String altId, final String text) { final SingleValueResourceAccess<StringResource> sva; if(text != null) { sva = null; } else { sva = new SingleValueResourceAccess<StringResource>(optSource, altId); } LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { if(text != null) { myLabel.setText(text, req); } else { StringResource source = getResource(sva, req, null); if ((source == null)||(!source.exists())) { myLabel.setText("n.a.", req); return; } myLabel.setText(source.getValue(), req); } }; }; return result.myLabel; } public Label floatLabel(String widgetId, String lineId, final FloatResource source, Row row, String format) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = floatLabel(widgetId + lineId, source, null, format); finishRowSnippet(row, widgetId, result); return result; } public Label floatLabel(final FloatResource source, String format) { counter++; return floatLabel("floatLabel"+counter, source, null, format); } public Label floatLabel(final String subResourceName, String format) { counter++; return floatLabel("floatLabel"+counter, null, subResourceName, format); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param fomat: if null "%.1f" is used * @return */ private Label floatLabel(final String widgetId, final FloatResource optSource, String altId, final String formatIn) { final SingleValueResourceAccess<FloatResource> sva = new SingleValueResourceAccess<FloatResource>(optSource, altId); Float minValue; String format; if(formatIn.contains("#min:")) { minValue = Float.parseFloat(formatIn.substring(formatIn.indexOf("#min:")+"#min:".length())); format = formatIn.substring(0, formatIn.indexOf("#min:")); } else { minValue = null; format = formatIn; } LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { FloatResource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } float val; if(source instanceof TemperatureResource) { val = ((TemperatureResource) source).getCelsius(); } else { val = source.getValue(); } String valStr; if(minValue != null && val < minValue) valStr = "n/a"; else if(format != null) { valStr = String.format(format, val); } else { valStr = String.format("%.1f", val); } myLabel.setText(valStr, req); } }; return result.myLabel; } public Label intLabel(String widgetId, String lineId, final IntegerResource source, Row row, final int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = intLabel(widgetId + lineId, source, null, mode); finishRowSnippet(row, widgetId, result); return result; } public Label intLabel(final IntegerResource source, final int mode) { counter++; return intLabel("intLabel"+counter, source, null, mode); } public Label intLabel(final String subResourceName, int mode) { counter++; return intLabel("intLabel"+counter, null, subResourceName, mode); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param mode 0: value unmodified * @return */ private Label intLabel(String widgetId, final IntegerResource optSource, String altId, final int mode) { final SingleValueResourceAccess<IntegerResource> sva = new SingleValueResourceAccess<IntegerResource>(optSource, altId); LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { IntegerResource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } String val; switch(mode) { default: val = ""+source.getValue(); } myLabel.setText(val, req); }; }; return result.myLabel; } public Label booleanLabel(String widgetId, String lineId, final BooleanResource source, Row row, final int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = booleanLabel(widgetId + lineId, source, null, mode); finishRowSnippet(row, widgetId, result); return result; } public Label booleanLabel(final BooleanResource source, final int mode) { counter++; return booleanLabel("intLabel"+counter, source, null, mode); } public Label booleantLabel(final String subResourceName, int mode) { counter++; return intLabel("intLabel"+counter, null, subResourceName, mode); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param mode 0: value unmodified * @return */ private Label booleanLabel(String widgetId, final BooleanResource optSource, String altId, final int mode) { final SingleValueResourceAccess<BooleanResource> sva = new SingleValueResourceAccess<BooleanResource>(optSource, altId); LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { BooleanResource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } String val; switch(mode) { default: val = ""+source.getValue(); } myLabel.setText(val, req); }; }; return result.myLabel; } public interface LongProvider { LabelLongValue getValue(OgemaHttpRequest req); } public Label timeLabel(String widgetId, String lineId, final TimeResource source, Row row, final int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = timeLabel(widgetId + lineId, source, null, mode); finishRowSnippet(row, widgetId, result); return result; } public Label timeLabel(final TimeResource source, final int mode) { counter++; return timeLabel("timeLabel"+counter, source, null, mode); } public Label timeLabel(final String subResourceName, int mode) { counter++; return timeLabel("timeLabel"+counter, null, subResourceName, mode); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param mode 0: absolute time, 1: time in day, 2: absolute time relative to now, 3: as 2 for future, * 4: date string (year to day), absolute time, 5: relative time in milliseconds, 6: relative time in seconds * @return */ private Label timeLabel(String widgetId, final TimeResource optSource, String altId, final int mode) { final SingleValueResourceAccess<TimeResource> sva = new SingleValueResourceAccess<TimeResource>(optSource, altId); LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { TimeResource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } String time; switch(mode) { case 1: time = StringFormatHelper.getFormattedTimeOfDay(source.getValue()); break; case 2: if(source.getValue() <= 0) time = "not set"; else time = StringFormatHelper.getFormattedAgoValue(appMan, source); break; case 3: if(source.getValue() <= 0) time = "not set"; else time = StringFormatHelper.getFormattedFutureValue(appMan, source); break; case 4: if(source.getValue() <= 0) time = "not set"; else time = TimeUtils.getDateString(source.getValue()); break; case 5: time = StringFormatHelper.getFormattedValue(source.getValue()); break; case 6: time = StringFormatHelper.getFormattedValue(source.getValue()*1000); break; default: if(source.getValue() <= 0) time = "not set"; else time = TimeUtils.getDateAndTimeString(source.getValue()); } myLabel.setText(time, req); }; }; return result.myLabel; } public Label fileSizeLabel(String widgetId, String lineId, final TimeResource source, Row row, final LongProvider provider) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = fileSizeLabel(widgetId + lineId, source, null, provider); finishRowSnippet(row, widgetId, result); return result; } public Label fileSizeLabel(final TimeResource source, final LongProvider provider) { counter++; return fileSizeLabel("fileSizeLabel"+counter, source, null, provider); } public Label fileSizeLabel(final String subResourceName, final LongProvider provider) { counter++; return fileSizeLabel("fileSizeLabel"+counter, null, subResourceName, provider); } /** * * @param page * @param widgetId * @param lineId * @param source you can either provide a resource as source or you define a provider that is called to get * the actual value or an alternativeText if no value can be provided. If a provider is specified the * source resource will not be evaluated. * @param provider * @param row * @param gateway may be null. In this case no test will be performed if the gateway is active. This could * be the standard case in the future. * @return */ private Label fileSizeLabel(String widgetId, final TimeResource optSource, String altId, final LongProvider provider) { final SingleValueResourceAccess<TimeResource> sva = new SingleValueResourceAccess<TimeResource>(optSource, altId); LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { long value; if(provider != null) { LabelLongValue llv = provider.getValue(req); if(llv.alternativeText != null) { myLabel.setText(llv.alternativeText, req); return; } else { value = llv.value; } } else { TimeResource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } else { value = source.getValue(); } } myLabel.setText(ApacheFileAdditions.byteCountToDisplaySize(BigInteger.valueOf(value)), req); }; }; return result.myLabel; } public Label resourceLabel(String widgetId, String lineId, final Resource source, Row row, int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = resourceLabel(widgetId + lineId, source, null, mode); finishRowSnippet(row, widgetId, result); return result; } public Label resourceLabel(final Resource source, int mode) { counter++; return resourceLabel("resourceLabel"+counter, source, null, mode); } public Label resourceLabel(final String subResourceName, int mode) { counter++; return resourceLabel("resourceLabel"+counter, null, subResourceName, mode); } private Label resourceLabel(String widgetId, final Resource optSource, String altId, final int mode) { final SingleValueResourceAccess<Resource> sva = new SingleValueResourceAccess<Resource>(optSource, altId); LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { Resource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } switch(mode) { case 1: myLabel.setText(ResourceUtils.getHumanReadableShortName(source), req); break; case 2: myLabel.setText(source.getLocation(), req); break; case 3: myLabel.setText(source.getPath(), req); break; case 4: myLabel.setText(source.getName(), req); break; case 10: myLabel.setText(source.getResourceType().getName(), req); break; case 11: myLabel.setText(source.getResourceType().getSimpleName(), req); break; case 20: if(source instanceof SingleValueResource) myLabel.setText(ValueResourceUtils.getValue((SingleValueResource)source), req); else if(source instanceof ArrayResource) myLabel.setText(ValueResourceHelperSP.getValue((ArrayResource)source), req); else myLabel.setText("--", req); break; default: myLabel.setText(ResourceUtils.getHumanReadableName(source), req); } }; }; return result.myLabel; } public TextField integerEdit(String widgetId, String lineId, final IntegerResource source, Row row, final Alert alert,final int minimumAllowed, final int maximumAllowed, String notAllowedMessage) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TextField result = integerEdit(widgetId + lineId, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage); finishRowSnippet(row, widgetId, result); return result; } public TextField integerEdit(final IntegerResource source, final Alert alert, final int minimumAllowed, final int maximumAllowed, String notAllowedMessage) { counter++; return integerEdit("integerEdit"+counter, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage); } public TextField integerEdit(final String subResourceName, final Alert alert, final int minimumAllowed, final int maximumAllowed, String notAllowedMessage) { counter++; return integerEdit("integerEdit"+counter, null, subResourceName, alert, minimumAllowed, maximumAllowed, notAllowedMessage); } private TextField integerEdit(String widgetId, final IntegerResource optSource, String altId, final Alert alert, final int minimumAllowed, final int maximumAllowed, String notAllowedMessage) { final SingleValueResourceAccess<IntegerResource> sva = new SingleValueResourceAccess<IntegerResource>(optSource, altId); final String notAllowedMessageUsed; if(notAllowedMessage == null) { notAllowedMessageUsed = "Value not Allowed!"; } else notAllowedMessageUsed = notAllowedMessage; TextFieldFlex updateInterval = new TextFieldFlex(widgetId, this) { @Override public void onGET(OgemaHttpRequest req) { IntegerResource source = getResource(sva, req, IntegerResource.class); myField.setValue(source.getValue()+"",req); } @Override public void onPOSTComplete(String data, OgemaHttpRequest req) { IntegerResource source = getResource(sva, req, IntegerResource.class); String val = myField.getValue(req); int value; try { value = Integer.parseInt(val); } catch (NumberFormatException | NullPointerException e) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value < minimumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value > maximumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if(!source.exists()) { source.create(); source.setValue(value); source.activate(true); } else { source.setValue(value); } if(alert != null) alert.showAlert("New value: " + value, true, req); } }; if(alert != null) triggerOnPost(updateInterval.myField, alert); //updateInterval.myField.triggerAction(alert, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST); updateInterval.myField.setDefaultInputmode("numeric"); return updateInterval.myField; } public TextField integerEditExt(String widgetId, String lineId, final IntegerResource source, Row row, ValueConverter checker) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TextField result = integerEditExt(widgetId + lineId, source, null, checker); finishRowSnippet(row, widgetId, result); return result; } public TextField integerEditExt(final String subResourceName, ValueConverter checker) { counter++; return integerEditExt("integerEdit"+counter, null, subResourceName, checker); } public TextField integerEditExt(String widgetId, final IntegerResource optSource, String altId, ValueConverter checker) { final SingleValueResourceAccess<IntegerResource> sva = new SingleValueResourceAccess<IntegerResource>(optSource, altId); TextFieldFlex updateInterval = new TextFieldFlex(widgetId, this) { @Override public void onGET(OgemaHttpRequest req) { IntegerResource source = getResource(sva, req, IntegerResource.class); myField.setValue(source.getValue()+"",req); } @Override public void onPOSTComplete(String data, OgemaHttpRequest req) { IntegerResource source = getResource(sva, req, IntegerResource.class); String val = myField.getValue(req); Integer value = checker.checkNewValueInt(val, req); if(value == null) return; if(!source.exists()) { source.create(); source.setValue(value); source.activate(true); } else { source.setValue(value); } } }; if(checker.getAlert() != null) triggerOnPost(updateInterval.myField, checker.getAlert()); updateInterval.myField.setDefaultInputmode("numeric"); return updateInterval.myField; } public TextField timeEdit(String widgetId, String lineId, final TimeResource source, Row row, final Alert alert, final long minimumAllowed, final long maximumAllowed, String notAllowedMessage, final int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TextField result = timeEdit(widgetId + lineId, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage, mode); finishRowSnippet(row, widgetId, result); return result; } public TextField timeEdit(final TimeResource source, final Alert alert, final long minimumAllowed, final long maximumAllowed, String notAllowedMessage, final int mode) { counter++; return timeEdit("timeEdit"+counter, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage, mode); } public TextField timeEdit(final String subResourceName, final Alert alert, final long minimumAllowed, final long maximumAllowed, String notAllowedMessage, final int mode) { counter++; return timeEdit("timeEdit"+counter, null, subResourceName, alert, minimumAllowed, maximumAllowed, notAllowedMessage, mode); } /** * * @param widgetId * @param optSource * @param altId * @param alert * @param minimumAllowed * @param maximumAllowed * @param notAllowedMessage * @param mode 0:milliseconds; 1:seconds; 2:minutes; 3:hours; 4:days; 5:months; -1: auto * @return */ private TextField timeEdit(String widgetId, final TimeResource optSource, String altId, final Alert alert, final long minimumAllowed, final long maximumAllowed, String notAllowedMessage, final int mode) { final SingleValueResourceAccess<TimeResource> sva = new SingleValueResourceAccess<TimeResource>(optSource, altId); final String notAllowedMessageUsed; class LastMode { public int lastMode; } final LastMode lastMode = new LastMode(); if(notAllowedMessage == null) { notAllowedMessageUsed = "Value not Allowed!"; } else notAllowedMessageUsed = notAllowedMessage; TextFieldFlex updateInterval = new TextFieldFlex(widgetId, this) { @Override public void onGET(OgemaHttpRequest req) { TimeResource source = getResource(sva, req, TimeResource.class); switch(mode) { case 1: myField.setValue(source.getValue()/1000+"",req); break; case 2: myField.setValue(source.getValue()/60000+"",req); break; case 3: myField.setValue(source.getValue()/(60*60000)+"",req); break; case 4: myField.setValue(source.getValue()/(24*60*60000)+"",req); break; case 5: myField.setValue(source.getValue()/(30*24*60*60000)+"",req); break; case -1: String s = StringFormatHelperSP.getFormattedValue(source.getValue(), 360); lastMode.lastMode = getLastMode(s); myField.setValue(s, req); break; default: myField.setValue(source.getValue()+"",req); } } @Override public void onPOSTComplete(String data, OgemaHttpRequest req) { TimeResource source = getResource(sva, req, TimeResource.class); String val = myField.getValue(req); int value; int flexMode = -99; //init here should never be relevant if(mode == -1) { flexMode = getLastMode(val); if(flexMode <= 0) flexMode = lastMode.lastMode; val = val.replaceAll("[^\\d.]", ""); } try { value = Integer.parseInt(val); } catch (NumberFormatException | NullPointerException e) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value < minimumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value > maximumAllowed) { alert.showAlert(notAllowedMessageUsed, false, req); return; } if(mode == -1) { value = getCorerrectedValue(value, flexMode); } else { value = getCorerrectedValue(value, mode); } if(!source.exists()) { source.create(); source.setValue(value); source.activate(true); } else { source.setValue(value); } if(alert != null) alert.showAlert("New interval " + value + " ms" , true, req); } private int getLastMode(String s) { if(s.endsWith("sec")) return 1; if(s.endsWith("min")) return 2; if(s.endsWith("h")) return 3; if(s.endsWith("d")) return 4; if(s.endsWith("month")) return 5; return 0; } private int getCorerrectedValue(int value, int mode) { switch(mode) { case 1: return value * 1000; case 2: return value * 60000; case 3: return value * (60*60000); case 4: return value * (24*60*60000); case 5: return value * (30*24*60*60000); default: return value; } } }; if(alert != null) triggerOnPost(updateInterval.myField, alert); //updateInterval.myField.triggerAction(alert, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST); return updateInterval.myField; } public TextField floatEdit(String widgetId, String lineId, final FloatResource source, Row row, final Alert alert,final float minimumAllowed, final float maximumAllowed, String notAllowedMessage) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TextField result = floatEdit(widgetId + lineId, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage, 0); finishRowSnippet(row, widgetId, result); return result; } public TextField floatEdit(String widgetId, String lineId, final FloatResource source, Row row, final Alert alert,final float minimumAllowed, final float maximumAllowed, String notAllowedMessage, int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TextField result = floatEdit(widgetId + lineId, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage, mode); finishRowSnippet(row, widgetId, result); return result; } public TextField floatEdit(final FloatResource source, final Alert alert, final float minimumAllowed, final float maximumAllowed, String notAllowedMessage) { counter++; return floatEdit("floatEdit"+counter, source, null, alert, minimumAllowed, maximumAllowed, notAllowedMessage, 0); } public TextField floatEdit(final String subResourceName, final Alert alert, final float minimumAllowed, final float maximumAllowed, String notAllowedMessage) { counter++; return floatEdit("floatEdit"+counter, null, subResourceName, alert, minimumAllowed, maximumAllowed, notAllowedMessage, 0); } /** * * @param widgetId * @param optSource * @param altId * @param alert * @param minimumAllowed * @param maximumAllowed * @param notAllowedMessage * @param mode 0: default, 1:no value transformation, 2: show "0" as default, 3: show 0.0 as default * @return */ private TextField floatEdit(String widgetId, final FloatResource optSource, String altId, final Alert alert, final float minimumAllowed, final float maximumAllowed, String notAllowedMessage, int mode) { final SingleValueResourceAccess<FloatResource> sva = new SingleValueResourceAccess<FloatResource>(optSource, altId); final String notAllowedMessageUsed; if(notAllowedMessage == null) { notAllowedMessageUsed = "Value not Allowed!"; } else notAllowedMessageUsed = notAllowedMessage; TextFieldFlex updateInterval = new TextFieldFlex(widgetId, this) { @Override public void onGET(OgemaHttpRequest req) { FloatResource source = getResource(sva, req, FloatResource.class); if(mode == 2 && (!source.exists())) myField.setValue("0",req); else if(mode == 3 && (!source.exists())) myField.setValue("0.0",req); else if((source instanceof TemperatureResource)&&(mode == 0)) myField.setValue(((TemperatureResource)source).getCelsius()+"",req); else { myField.setValue(source.getValue()+"",req); } } private void setValue(FloatResource source, float value) { if((source instanceof TemperatureResource)&&(mode == 0)) ((TemperatureResource)source).setCelsius(value); else source.setValue(value); } @Override public void onPOSTComplete(String data, OgemaHttpRequest req) { FloatResource source = getResource(sva, req, FloatResource.class); String val = myField.getValue(req); float value; try { value = Float.parseFloat(val); } catch (NumberFormatException | NullPointerException e) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value < minimumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value > maximumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if(!source.exists()) { source.create(); setValue(source, value); source.activate(true); } else { setValue(source, value); } if(alert != null) alert.showAlert("New value: " + value, true, req); } }; if(alert != null) triggerOnPost(updateInterval.myField, alert); //updateInterval.myField.triggerAction(alert, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST); updateInterval.myField.setDefaultInputmode("decimal"); return updateInterval.myField; } public TextField stringEdit(String widgetId, String lineId, final StringResource source, Row row, final Alert alert) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TextField result = stringEdit(widgetId + lineId, source, null, alert); finishRowSnippet(row, widgetId, result); return result; } public TextField stringEdit(final StringResource source, final Alert alert) { counter++; return stringEdit("stringEdit"+counter, source, null, alert); } public TextField stringEdit(final String subResourceName, final Alert alert) { counter++; return stringEdit("stringEdit"+counter, null, subResourceName, alert); } private TextField stringEdit(String widgetId, final StringResource optSource, String altId, final Alert alert) { final SingleValueResourceAccess<StringResource> sva = new SingleValueResourceAccess<StringResource>(optSource, altId); TextFieldFlex updateInterval = new TextFieldFlex(widgetId, this) { @Override public void onGET(OgemaHttpRequest req) { StringResource source = getResource(sva, req, StringResource.class); if(source == null) { R gw = getResource(getGatewayInfo(req), req); if(gw != null) throw new IllegalStateException("Could not find "+sva.altIdUsed+" for "+gw.getLocation()); else throw new IllegalStateException("Could not find "+sva.altIdUsed); } myField.setValue(source.getValue()+"",req); } @Override public void onPOSTComplete(String data, OgemaHttpRequest req) { StringResource source = getResource(sva, req, StringResource.class); String val = myField.getValue(req); /*String value; try { value = Float.parseFloat(val); } catch (NumberFormatException | NullPointerException e) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value < minimumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; } if (value > maximumAllowed) { if(alert != null) alert.showAlert(notAllowedMessageUsed, false, req); return; }*/ if(!source.exists()) { source.create(); source.setValue(val); source.activate(true); } else { source.setValue(val); } if(alert != null) alert.showAlert("New value: " + val, true, req); } }; if(alert != null) triggerOnPost(updateInterval.myField, alert); //updateInterval.myField.triggerAction(alert, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST); return updateInterval.myField; } public DatepickerTimeResource datepicker(String widgetId, String lineId, final TimeResource source, Row row) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); DatepickerTimeResource result = datepicker(widgetId + lineId, source, null, null, null, null); finishRowSnippet(row, widgetId, result); return result; } public DatepickerTimeResource datepicker(final TimeResource source) { counter++; return datepicker("timeEdit"+counter, source, null, null, null, null); } public DatepickerTimeResource datepicker(final String subResourceName) { counter++; return datepicker("timeEdit"+counter, null, subResourceName, null, null, null); } public DatepickerTimeResource datepicker(final String subResourceName, String format, String defaultDate, String viewMode) { counter++; return datepicker("timeEdit"+counter, null, subResourceName, format, defaultDate, viewMode); } private DatepickerTimeResource datepicker(String widgetId, final TimeResource optSource, String altId, String format, String defaultDate, String viewMode) { final SingleValueResourceAccess<TimeResource> sva = new SingleValueResourceAccess<TimeResource>(optSource, altId); DatepickerFlex updateInterval = new DatepickerFlex(widgetId, this, format, defaultDate, viewMode) { @Override public void onGET(OgemaHttpRequest req) { TimeResource source = getResource(sva, req, TimeResource.class); myDrop.selectItem(source, req); } }; return updateInterval.myDrop; } public TemplateRedirectButton<T> linkingButton(String widgetId, String lineId, final T source, Row row, String buttonText, String url) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); TemplateRedirectButton<T> result = linkingButton(widgetId + lineId, source, buttonText, url); finishRowSnippet(row, widgetId, result); return result; } public TemplateRedirectButton<T> linkingButton(final T source, String buttonText, String url) { counter++; return linkingButton("linkingButton"+counter, source, buttonText, url); } private TemplateRedirectButton<T> linkingButton(String widgetId, final T optSource, String buttonText, String url) { TemplateRedirectButtonFlex<T> button = new TemplateRedirectButtonFlex<T>(widgetId, this, buttonText, url) { public void onPrePOST(String s, OgemaHttpRequest req) { if(optSource != null) myButton.selectItem(optSource, req); } }; return button.myButton; } /** The following two methods are copied from ResourceGUIHelperBak and adapted*/ public ResourceRedirectButton<R> linkingButton(final String subResourceName, String buttonText, String url) { counter++; return linkingButton("linkingButton"+counter, null, subResourceName, buttonText, url); } private ResourceRedirectButton<R> linkingButton(String widgetId, final R optSource, String altId, String buttonText, String url) { final SingleValueResourceAccess<R> sva = new SingleValueResourceAccess<R>(optSource, altId); ResourceRedirectButtonFlex<R> button = new ResourceRedirectButtonFlex<R>(widgetId, this, buttonText, url) { public void onPrePOST(String s, OgemaHttpRequest req) { R source = getResource(sva, req, null); myButton.selectItem(source, req); } }; return button.myButton; } public BooleanResourceCheckbox booleanEdit(String widgetId, String lineId, final BooleanResource source, Row row) { return booleanEdit(widgetId, lineId, source, row, 0); } public BooleanResourceCheckbox booleanEdit(String widgetId, String lineId, final BooleanResource source, Row row, int columnSize) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); BooleanResourceCheckbox result = booleanEdit(widgetId + lineId, source, null); finishRowSnippet(row, widgetId, result, columnSize); return result; } public BooleanResourceCheckbox booleanEdit(final BooleanResource source) { counter++; return booleanEdit("booleanEdit"+counter, source, null); } public BooleanResourceCheckbox booleanEdit(final String subResourceName) { counter++; return booleanEdit("booleanEdit"+counter, null, subResourceName); } private BooleanResourceCheckbox booleanEdit(String widgetId, final BooleanResource optSource, String altId) { final SingleValueResourceAccess<BooleanResource> sva = new SingleValueResourceAccess<BooleanResource>(optSource, altId); BooleanResourceCheckboxFlex boolWidget = new BooleanResourceCheckboxFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { BooleanResource source = getResource(sva, req, BooleanResource.class); myCheckbox.selectItem(source, req); } @Override public void onPrePOST(String data, OgemaHttpRequest req) { BooleanResource source = getResource(sva, req, BooleanResource.class); if(!source.exists()) { source.create(); source.activate(true); } } }; return boolWidget.myCheckbox; } public <S extends SingleValueResource> ValueResourceDropdown<S> dropdown(String widgetId, String lineId, final S source, Row row, Map<String, String> valuesToSet) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); ValueResourceDropdown<S> result = dropdown(widgetId + lineId, source, null, valuesToSet, null); finishRowSnippet(row, widgetId, result); return result; } public <S extends SingleValueResource> ValueResourceDropdown<S> dropdown(final S source, Map<String, String> valuesToSet) { counter++; return dropdown("dropdown"+counter, source, null, valuesToSet, null); } public <S extends SingleValueResource> ValueResourceDropdown<S> dropdown(final String subResourceName, Map<String, String> valuesToSet, final Class<S> resourceType) { counter++; return dropdown("dropdown"+counter, null, subResourceName, valuesToSet, resourceType); } private <S extends SingleValueResource> ValueResourceDropdown<S> dropdown(String widgetId, final S optSource, String altId, Map<String, String> valuesToSet, final Class<S> resourceType) { final SingleValueResourceAccess<S> sva = new SingleValueResourceAccess<S>(optSource, altId); ValueResourceDropdownFlex<S> widget = new ValueResourceDropdownFlex<S>(widgetId, this, valuesToSet) { public void onGET(OgemaHttpRequest req) { S source = getResource(sva, req, resourceType); myDrop.selectItem(source, req); } @Override public void onPrePOST(String data, OgemaHttpRequest req) { S source = getResource(sva, req, resourceType); if(!source.exists()) { source.create(); source.activate(true); } } }; return widget.myDrop; } public <S extends Resource> ResourceDropdown<S> referenceDropdownFixedChoice(String widgetId, String lineId, final S source, Row row, Map<S, String> valuesToSet) { return referenceDropdownFixedChoice(widgetId, lineId, source, row, valuesToSet, 0); } public <S extends Resource> ResourceDropdown<S> referenceDropdownFixedChoice(String widgetId, String lineId, final S source, Row row, Map<S, String> valuesToSet, int columnSize) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); ResourceDropdown<S> result = referenceDropdownFixedChoice(widgetId + lineId, source, null, valuesToSet, null); finishRowSnippet(row, widgetId, result, columnSize); return result; } public <S extends Resource> ResourceDropdown<S> referenceDropdownFixedChoice(final S source, Map<S, String> valuesToSet) { counter++; return referenceDropdownFixedChoice("dropdown"+counter, source, null, valuesToSet, null); } public <S extends Resource> ResourceDropdown<S> referenceDropdownFixedChoice(final String subResourceName, Map<S, String> valuesToSet, final Class<S> resourceType) { counter++; return referenceDropdownFixedChoice("dropdown"+counter, null, subResourceName, valuesToSet, resourceType); } /** Dropdown to set resource referenced on a certain path. The choices are fixed here, so this is usually only * suitable for dynamic widgets inside a table. * TODO: Provide also more flexible versions that provide all elements from a ResourceList or all resources * of a certain type on the system as options * * @param widgetId * @param optSource * @param altId * @param valuesToSet map containing resources offered and the labels to be displayed * @param resourceType * @return */ private <S extends Resource> ResourceDropdown<S> referenceDropdownFixedChoice(String widgetId, final S optSource, String altId, final Map<S, String> valuesToSet, final Class<S> resourceType) { final SingleValueResourceAccess<S> sva = new SingleValueResourceAccess<S>(optSource, altId); ResourceDropdownFlex<S> widget = new ResourceDropdownFlex<S>(widgetId, this) { @Override public String getLabel(S object, OgemaLocale locale) { String result = valuesToSet.get(object); if(result != null) return result; return super.getLabel(object, locale); } @SuppressWarnings("unchecked") public void onGET(OgemaHttpRequest req) { S source = getResource(sva, req, resourceType); if(source.exists()) myDrop.selectItem((S) source.getLocationResource(), req); else myDrop.selectSingleOption(DropdownData.EMPTY_OPT_ID, req); } @Override public void onPOSTComplete(String data, OgemaHttpRequest req) { S source = getResource(sva, req, resourceType); if(!source.exists()) { source.create(); source.activate(true); } S selection = myDrop.getSelectedItem(req); if(selection == null) source.delete(); else source.setAsReference(selection); } }; widget.myDrop.setDefaultItems(valuesToSet.keySet()); widget.myDrop.setDefaultAddEmptyOption(true, "(not set)"); return widget.myDrop; } /*protected R getGatewayInfo(T object, OgemaHttpRequest req) { return getResource(object, req); }*/ protected T getGatewayInfo(OgemaHttpRequest req) { if(fixedGatewayInfo != null) return fixedGatewayInfo; return initObject.getSelectedItem(req); } /** Method to provide a resource based on access information * * @param sva information on base resource and bath or direct resource reference * @param req * @param typeToCreate * @return */ @SuppressWarnings("unchecked") protected <S extends Resource> S getResource(SingleValueResourceAccess<S> sva, OgemaHttpRequest req, Class<? extends S> typeToCreate) { R gw = getResource(getGatewayInfo(req), req); if(sva.optSource == null) { if(gw == null) return null; if(sva.altIdUsed == null) return null; S result; if(sva.altIdUsed.equals("")) { result = (S) gw; } else if(typeToCreate == null) { result = ResourceHelper.getSubResource(gw, sva.altIdUsed); } else { result = ResourceHelper.getSubResource(gw, sva.altIdUsed, typeToCreate); } if((!acceptMissingResources)&&(result == null)) { throw new IllegalStateException("Subresource "+sva.altIdUsed+" not found!"); } if(result.getLocationResource() == null) { throw new IllegalComponentStateException("Invalid location should throw framework exception:"+result.getLocation()); } return result; } else { return sva.optSource; } } /*********************************** * Label widgets for various values * TODO: Provide conversion to String in a separate class and avoid doubling the code between * Resource-based label widgets and the resource-less widgets below * *********************************/ public Label floatLabel(String widgetId, String lineId, final float value, Row row, String format) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = floatLabel(widgetId + lineId, value, format); finishRowSnippet(row, widgetId, result); return result; } public Label floatLabel(final float value, String format) { counter++; return floatLabel("floatLabel"+counter, value, format); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param fomat: if null "%.1f" is used * @return */ private Label floatLabel(String widgetId, final float value, final String format) { LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { String val = ValueFormat.floatVal(value, format); myLabel.setText(val, req); } }; return result.myLabel; } public Label intLabel(String widgetId, String lineId, final Integer value, Row row, final int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = intLabel(widgetId + lineId, value, mode); finishRowSnippet(row, widgetId, result); return result; } public Label intLabel(final Integer value, final int mode) { counter++; return intLabel("intLabel"+counter, value, mode); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param mode 0: value unmodified * @return */ private Label intLabel(String widgetId, final Integer value, final int mode) { LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { if ((value == null)) { myLabel.setText("n.a.", req); return; } String val; switch(mode) { default: val = ""+value; } myLabel.setText(val, req); }; }; return result.myLabel; } public Label timeLabel(String widgetId, String lineId, final Long value, Row row, final int mode) { if(checkLineId(widgetId)) return null; widgetId = WidgetHelper.getValidWidgetId(widgetId); Label result = timeLabel(widgetId + lineId, value, mode); finishRowSnippet(row, widgetId, result); return result; } public Label timeLabel(final Long value, final int mode) { counter++; return timeLabel("timeLabel"+counter, value, mode); } /** * * @param page * @param id * @param source * @param row * @param gateway * @param mode 0: absolute time, 1: time in day, 2: absolute time relative to now (ago), * 3: absolute time relative to now (future), * 4: duration * @return */ private Label timeLabel(String widgetId, final Long value, final int mode) { LabelFlex result = new LabelFlex(widgetId, this) { public void onGET(OgemaHttpRequest req) { if ((value == null)) { myLabel.setText("n.a.", req); return; } String time; switch(mode) { case 1: time = StringFormatHelper.getFormattedTimeOfDay(value); break; case 2: if(value <= 0) time = "not set"; else time = StringFormatHelper.getFormattedAgoValue(appMan, value); break; case 3: if(value <= 0) time = "not set"; else time = StringFormatHelper.getFormattedFutureValue(appMan, value); break; case 4: if(value < 0) time = "not set"; else time = StringFormatHelper.getFormattedValue(value); break; default: if(value <= 0) time = "not set"; else time = TimeUtils.getDateAndTimeString(value); } myLabel.setText(time, req); }; }; return result.myLabel; } public void triggerOnPost(OgemaWidget governor, OgemaWidget target) { if(doRegisterDependentWidgets) governor.registerDependentWidget(target); else governor.triggerAction(target, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST); } public void triggerOnPostForRequest(OgemaWidget governor, OgemaWidget target) { if(doRegisterDependentWidgets) governor.registerDependentWidget(target, req); else governor.triggerAction(target, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST, req); } public void setDoRegisterDependentWidgets(boolean doRegisterDependentWidgets) { this.doRegisterDependentWidgets = doRegisterDependentWidgets; } }
3e18da9125910dac84e80d849a22acc9752820b2
26,695
java
Java
services/exhibition/client/src/test/java/org/collectionspace/services/client/test/ExhibitionServiceTest.java
Pacific-Bonsai-Museum/services
064c4c099c299e397dcf54878d239787a2c0b817
[ "ECL-2.0" ]
9
2015-05-07T04:11:23.000Z
2020-05-13T10:04:34.000Z
services/exhibition/client/src/test/java/org/collectionspace/services/client/test/ExhibitionServiceTest.java
Pacific-Bonsai-Museum/services
064c4c099c299e397dcf54878d239787a2c0b817
[ "ECL-2.0" ]
24
2015-03-14T00:38:25.000Z
2022-02-16T00:51:36.000Z
services/exhibition/client/src/test/java/org/collectionspace/services/client/test/ExhibitionServiceTest.java
Pacific-Bonsai-Museum/services
064c4c099c299e397dcf54878d239787a2c0b817
[ "ECL-2.0" ]
28
2015-01-23T01:31:25.000Z
2022-03-05T17:51:05.000Z
38.632417
132
0.625698
10,572
/** * This document is a part of the source code and related artifacts * for CollectionSpace, an open source collections management system * for museums and related institutions: * * http://www.collectionspace.org * http://wiki.collectionspace.org * * Copyright © 2009 Regents of the University of California * * Licensed under the Educational Community License (ECL), Version 2.0. * You may not use this file except in compliance with this License. * * You may obtain a copy of the ECL 2.0 License at * https://source.collectionspace.org/collection-space/LICENSE.txt * * 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.collectionspace.services.client.test; import org.collectionspace.services.client.AbstractCommonListUtils; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ExhibitionClient; import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.exhibition.ExhibitionsCommon; import javax.ws.rs.core.Response; import org.testng.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * ExhibitionServiceTest, carries out tests against a * deployed and running Exhibition Service. */ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, ExhibitionsCommon> { /** The logger. */ private final String CLASS_NAME = ExhibitionServiceTest.class.getName(); private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); // Instance variables specific to this test. /** The service path component. */ final String SERVICE_NAME = "exhibitions"; final String SERVICE_PATH_COMPONENT = "exhibitions"; /* (non-Javadoc) * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() */ @Override protected CollectionSpaceClient getClientInstance() throws Exception { return new ExhibitionClient(); } @Override protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception { return new ExhibitionClient(clientPropertiesFilename); } /* (non-Javadoc) * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) */ @Override protected AbstractCommonList getCommonList(Response response) { return response.readEntity(AbstractCommonList.class); } // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void create(String testName) throws Exception { // Perform setup, such as initializing the type of service request // (e.g. CREATE, DELETE), its valid and expected status codes, and // its associated HTTP method name (e.g. POST, DELETE). setupCreate(); // Submit the request to the service and store the response. ExhibitionClient client = new ExhibitionClient(); String identifier = createIdentifier(); PoxPayloadOut multipart = createExhibitionInstance(identifier); String newID = null; Response res = client.create(multipart); try { int statusCode = res.getStatus(); // Check the status code of the response: does it match // the expected response(s)? // // Specifically: // Does it fall within the set of valid status codes? // Does it exactly match the expected status code? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); newID = extractId(res); } finally { if (res != null) { res.close(); } } // Store the ID returned from the first resource created // for additional tests below. if (knownResourceId == null) { knownResourceId = newID; if (logger.isDebugEnabled()) { logger.debug(testName + ": knownResourceId=" + knownResourceId); } } // Store the IDs from every resource created by tests, // so they can be deleted after tests have been run. allResourceIdsCreated.add(newID); } /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"create"}) public void createList(String testName) throws Exception { for (int i = 0; i < 3; i++) { create(testName); } } /* @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createWithEmptyEntityBody(String testName) throws Exception { if (logger.isDebugEnabled()) { logger.debug(testBanner(testName, CLASS_NAME)); } // Perform setup. setupCreateWithEmptyEntityBody(); // Submit the request to the service and store the response. String method = REQUEST_TYPE.httpMethodName(); String url = getServiceRootURL(); String mediaType = MediaType.APPLICATION_XML; final String entity = ""; int statusCode = submitRequest(method, url, mediaType, entity); // Check the status code of the response: does it match // the expected response(s)? if(logger.isDebugEnabled()){ logger.debug("createWithEmptyEntityBody url=" + url + " status=" + statusCode); } Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createWithMalformedXml(String testName) throws Exception { if (logger.isDebugEnabled()) { logger.debug(testBanner(testName, CLASS_NAME)); } // Perform setup. setupCreateWithMalformedXml(testName, logger); // Submit the request to the service and store the response. String method = REQUEST_TYPE.httpMethodName(); String url = getServiceRootURL(); String mediaType = MediaType.APPLICATION_XML; final String entity = MALFORMED_XML_DATA; // Constant from base class. int statusCode = submitRequest(method, url, mediaType, entity); // Check the status code of the response: does it match // the expected response(s)? if(logger.isDebugEnabled()){ logger.debug(testName + ": url=" + url + " status=" + statusCode); } Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createWithWrongXmlSchema(String testName) throws Exception { if (logger.isDebugEnabled()) { logger.debug(testBanner(testName, CLASS_NAME)); } // Perform setup. setupCreateWithWrongXmlSchema(testName, logger); // Submit the request to the service and store the response. String method = REQUEST_TYPE.httpMethodName(); String url = getServiceRootURL(); String mediaType = MediaType.APPLICATION_XML; final String entity = WRONG_XML_SCHEMA_DATA; int statusCode = submitRequest(method, url, mediaType, entity); // Check the status code of the response: does it match // the expected response(s)? if(logger.isDebugEnabled()){ logger.debug(testName + ": url=" + url + " status=" + statusCode); } Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } */ // --------------------------------------------------------------- // CRUD tests : READ tests // --------------------------------------------------------------- // Success outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"create"}) public void read(String testName) throws Exception { // Perform setup. setupRead(); // Submit the request to the service and store the response. ExhibitionClient client = new ExhibitionClient(); Response res = client.read(knownResourceId); PoxPayloadIn input = null; try { assertStatusCode(res, testName); input = new PoxPayloadIn(res.readEntity(String.class)); } finally { if (res != null) { res.close(); } } // Get the common part of the response and verify that it is not null. PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName()); ExhibitionsCommon exhibitionCommon = null; if (payloadInputPart != null) { exhibitionCommon = (ExhibitionsCommon) payloadInputPart.getBody(); } Assert.assertNotNull(exhibitionCommon); // Check selected fields. // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters. String generalNote = exhibitionCommon.getGeneralNote(); if (logger.isDebugEnabled()) { logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n" + "UTF-8 data received=" + generalNote); } Assert.assertEquals(generalNote, getUTF8DataFragment(), "UTF-8 data retrieved '" + generalNote + "' does not match expected data '" + getUTF8DataFragment()); } // Failure outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"read"}) public void readNonExistent(String testName) throws Exception { // Perform setup. setupReadNonExistent(); // Submit the request to the service and store the response. ExhibitionClient client = new ExhibitionClient(); Response res = client.read(NON_EXISTENT_ID); try { int statusCode = res.getStatus(); // Check the status code of the response: does it match // the expected response(s)? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); } finally { if (res != null) { res.close(); } } } // --------------------------------------------------------------- // CRUD tests : READ_LIST tests // --------------------------------------------------------------- // Success outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"createList", "read"}) public void readList(String testName) throws Exception { // Perform setup. setupReadList(); // Submit the request to the service and store the response. AbstractCommonList list = null; ExhibitionClient client = new ExhibitionClient(); Response res = client.readList(); assertStatusCode(res, testName); try { int statusCode = res.getStatus(); // Check the status code of the response: does it match // the expected response(s)? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); list = res.readEntity(getCommonListType()); } finally { if (res != null) { res.close(); } } // Optionally output additional data about list members for debugging. boolean iterateThroughList = true; if(iterateThroughList && logger.isDebugEnabled()){ AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName); } } // Failure outcomes // None at present. // --------------------------------------------------------------- // CRUD tests : UPDATE tests // --------------------------------------------------------------- // Success outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"read"}) public void update(String testName) throws Exception { // Perform setup. setupRead(); // Retrieve the contents of a resource to update. ExhibitionClient client = new ExhibitionClient(); Response res = client.read(knownResourceId); PoxPayloadIn input = null; try { assertStatusCode(res, testName); input = new PoxPayloadIn(res.readEntity(String.class)); if (logger.isDebugEnabled()) { logger.debug("got object to update with ID: " + knownResourceId); } } finally { if (res != null) { res.close(); } } // Extract the common part from the response. PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName()); ExhibitionsCommon exhibitionCommon = null; if (payloadInputPart != null) { exhibitionCommon = (ExhibitionsCommon) payloadInputPart.getBody(); } Assert.assertNotNull(exhibitionCommon); // Update the content of this resource. exhibitionCommon.setExhibitionNumber("updated-" + exhibitionCommon.getExhibitionNumber()); String generalNote = exhibitionCommon.getGeneralNote(); exhibitionCommon.setGeneralNote("updated-generalNote-" + generalNote); if (logger.isDebugEnabled()) { logger.debug("to be updated object"); logger.debug(objectAsXmlString(exhibitionCommon, ExhibitionsCommon.class)); } setupUpdate(); // Submit the updated common part in an update request to the service // and store the response. PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent()); PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), exhibitionCommon); res = client.update(knownResourceId, output); try { assertStatusCode(res, testName); int statusCode = res.getStatus(); // Check the status code of the response: does it match the expected response(s)? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); input = new PoxPayloadIn(res.readEntity(String.class)); } finally { if (res != null) { res.close(); } } // Extract the updated common part from the response. payloadInputPart = input.getPart(client.getCommonPartName()); ExhibitionsCommon updatedExhibitionCommon = null; if (payloadInputPart != null) { updatedExhibitionCommon = (ExhibitionsCommon) payloadInputPart.getBody(); } Assert.assertNotNull(updatedExhibitionCommon); // Check selected fields in the updated common part. Assert.assertEquals(updatedExhibitionCommon.getExhibitionNumber(), exhibitionCommon.getExhibitionNumber(), "Data in updated object did not match submitted data."); // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters. String originalGeneralNote = exhibitionCommon.getGeneralNote(); String updatedGeneralNote = updatedExhibitionCommon.getGeneralNote(); Assert.assertEquals(updatedGeneralNote, originalGeneralNote, "Data in updated object did not match submitted data."); if(logger.isDebugEnabled()){ logger.debug("UTF-8 data sent=" + originalGeneralNote + "\n" + "UTF-8 data received=" + updatedGeneralNote); } Assert.assertTrue(updatedGeneralNote.contains(getUTF8DataFragment()), "UTF-8 data retrieved '" + updatedGeneralNote + "' does not match expected data '" + getUTF8DataFragment()); } @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"update", "testSubmitRequest"}) public void updateNonExistent(String testName) throws Exception { // Perform setup. setupUpdateNonExistent(); // Submit the request to the service and store the response. // Note: The ID used in this 'create' call may be arbitrary. // The only relevant ID may be the one used in update(), below. ExhibitionClient client = new ExhibitionClient(); PoxPayloadOut multipart = createExhibitionInstance(NON_EXISTENT_ID); Response res = client.update(NON_EXISTENT_ID, multipart); try { int statusCode = res.getStatus(); // Check the status code of the response: does it match // the expected response(s)? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); } finally { if (res != null) { res.close(); } } } // --------------------------------------------------------------- // CRUD tests : DELETE tests // --------------------------------------------------------------- // Success outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) public void delete(String testName) throws Exception { // Perform setup. setupDelete(); // Submit the request to the service and store the response. ExhibitionClient client = new ExhibitionClient(); Response res = client.delete(knownResourceId); try { int statusCode = res.getStatus(); // Check the status code of the response: does it match // the expected response(s)? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); } finally { if (res != null) { res.close(); } } } // Failure outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) */ @Override // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, // dependsOnMethods = {"delete"}) public void deleteNonExistent(String testName) throws Exception { // Perform setup. setupDeleteNonExistent(); // Submit the request to the service and store the response. ExhibitionClient client = new ExhibitionClient(); Response res = client.delete(NON_EXISTENT_ID); try { int statusCode = res.getStatus(); // Check the status code of the response: does it match // the expected response(s)? if (logger.isDebugEnabled()) { logger.debug(testName + ": status = " + statusCode); } Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), invalidStatusCodeMessage(testRequestType, statusCode)); Assert.assertEquals(statusCode, testExpectedStatusCode); } finally { if (res != null) { res.close(); } } } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above // --------------------------------------------------------------- /** * Tests the code for manually submitting data that is used by several * of the methods above. */ // @Test(dependsOnMethods = {"create", "read"}) public void testSubmitRequest() { // Expected status code: 200 OK final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Submit the request to the service and store the response. String method = ServiceRequestType.READ.httpMethodName(); String url = getResourceURL(knownResourceId); int statusCode = submitRequest(method, url); // Check the status code of the response: does it match // the expected response(s)? if (logger.isDebugEnabled()) { logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode); } Assert.assertEquals(statusCode, EXPECTED_STATUS); } // --------------------------------------------------------------- // Utility methods used by tests above // --------------------------------------------------------------- @Override public String getServiceName() { return SERVICE_NAME; } /* (non-Javadoc) * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() */ @Override public String getServicePathComponent() { return SERVICE_PATH_COMPONENT; } @Override protected PoxPayloadOut createInstance(String identifier) throws Exception { return createExhibitionInstance(identifier); } /** * Creates the exhibition instance. * * @param identifier the identifier * @return the multipart output */ //private PoxPayloadOut createExhibitionInstance(String identifier) { // return createExhibitionInstance("exhibitionNumber-" + identifier); //} /** * Creates the exhibition instance. * * @param exhibitionNumber the exhibition number * @return the multipart output * @throws Exception */ private PoxPayloadOut createExhibitionInstance(String exhibitionNumber) throws Exception { ExhibitionsCommon exhibitionCommon = new ExhibitionsCommon(); exhibitionCommon.setExhibitionNumber(exhibitionNumber); exhibitionCommon.setGeneralNote(getUTF8DataFragment()); PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); PayloadOutputPart commonPart = multipart.addPart(new ExhibitionClient().getCommonPartName(), exhibitionCommon); if (logger.isDebugEnabled()) { logger.debug("to be created, exhibition common"); logger.debug(objectAsXmlString(exhibitionCommon, ExhibitionsCommon.class)); } return multipart; } @Override public void CRUDTests(String testName) { // TODO Auto-generated method stub } @Override protected PoxPayloadOut createInstance(String commonPartName, String identifier) throws Exception { PoxPayloadOut result = createExhibitionInstance(identifier); return result; } @Override protected ExhibitionsCommon updateInstance(ExhibitionsCommon commonPartObject) { // TODO Auto-generated method stub return null; } @Override protected void compareUpdatedInstances(ExhibitionsCommon original, ExhibitionsCommon updated) throws Exception { // TODO Auto-generated method stub } }
3e18dbaee14900775229da5eb010c83c680a5090
1,141
java
Java
flinkx-connectors/flinkx-connector-http/src/main/java/com/dtstack/flinkx/connector/http/common/HttpKeys.java
fanliunian/flinkx
e81cd61390921d21c2aa0a1bf9252c4521982931
[ "ECL-2.0", "Apache-2.0" ]
3,101
2018-04-08T03:49:08.000Z
2022-03-31T12:22:11.000Z
flinkx-connectors/flinkx-connector-http/src/main/java/com/dtstack/flinkx/connector/http/common/HttpKeys.java
qyfftf/flinkx
e81cd61390921d21c2aa0a1bf9252c4521982931
[ "ECL-2.0", "Apache-2.0" ]
507
2018-06-07T08:58:59.000Z
2022-02-19T13:01:10.000Z
flinkx-connectors/flinkx-connector-http/src/main/java/com/dtstack/flinkx/connector/http/common/HttpKeys.java
qyfftf/flinkx
e81cd61390921d21c2aa0a1bf9252c4521982931
[ "ECL-2.0", "Apache-2.0" ]
1,326
2018-05-02T08:13:29.000Z
2022-03-26T13:11:24.000Z
38.033333
75
0.739702
10,573
/* * 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 com.dtstack.flinkx.connector.http.common; /** * @author : shifang * @date : 2020/3/19 */ public class HttpKeys { public static final String KEY_HEADER = "header"; public static final String KEY_BODY = "body"; public static final String KEY_PARAMS = "params"; public static final String KEY_BATCH = "batchId"; }
3e18dc63dcffe13303f7e910f9d258fba6bf7800
2,498
java
Java
engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/migration/MigrationFlipScopesTest.java
AndreaGiardini/camunda-bpm-platform
ce60b6799ab381f817f1b6f39883576678a43cfa
[ "Apache-2.0" ]
1
2020-05-20T19:15:09.000Z
2020-05-20T19:15:09.000Z
engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/migration/MigrationFlipScopesTest.java
AndreaGiardini/camunda-bpm-platform
ce60b6799ab381f817f1b6f39883576678a43cfa
[ "Apache-2.0" ]
1
2022-03-31T21:02:16.000Z
2022-03-31T21:02:16.000Z
engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/migration/MigrationFlipScopesTest.java
AndreaGiardini/camunda-bpm-platform
ce60b6799ab381f817f1b6f39883576678a43cfa
[ "Apache-2.0" ]
1
2019-09-07T01:31:19.000Z
2019-09-07T01:31:19.000Z
40.290323
153
0.768615
10,574
/* 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.camunda.bpm.engine.test.api.runtime.migration; import org.camunda.bpm.engine.migration.MigrationPlanValidationException; import org.camunda.bpm.engine.repository.ProcessDefinition; import org.camunda.bpm.engine.test.ProcessEngineRule; import org.camunda.bpm.engine.test.api.runtime.migration.models.ProcessModels; import org.camunda.bpm.engine.test.util.MigrationPlanValidationReportAssert; import org.camunda.bpm.engine.test.util.ProvidedProcessEngineRule; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.RuleChain; /** * @author Thorben Lindhauer * */ public class MigrationFlipScopesTest { protected ProcessEngineRule rule = new ProvidedProcessEngineRule(); protected MigrationTestRule testHelper = new MigrationTestRule(rule); @Rule public RuleChain ruleChain = RuleChain.outerRule(rule).around(testHelper); @Test public void testCannotFlipAncestorScopes() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.DOUBLE_SUBPROCESS_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.DOUBLE_SUBPROCESS_PROCESS); // when try { rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("outerSubProcess", "innerSubProcess") .mapActivities("innerSubProcess", "outerSubProcess") .mapActivities("userTask", "userTask") .build(); Assert.fail("should not validate"); } catch (MigrationPlanValidationException e) { MigrationPlanValidationReportAssert.assertThat(e.getValidationReport()) .hasInstructionFailures("innerSubProcess", "The closest mapped ancestor 'outerSubProcess' is mapped to scope 'innerSubProcess' which is not an ancestor of target scope 'outerSubProcess'" ); } } }
3e18dd5722cc70c77c0162c68af47a04dcccd5fd
5,121
java
Java
src/test/java/com/github/dakusui/jcunit8/tests/features/pipeline/parameters/FsmTest.java
haim/jcunit
46b9a6fcde875adde9ad4bf3a75ef774dbf0f955
[ "Apache-2.0" ]
71
2015-02-04T14:06:43.000Z
2022-01-28T17:25:07.000Z
src/test/java/com/github/dakusui/jcunit8/tests/features/pipeline/parameters/FsmTest.java
dakusui/jcun
09e3170dbe40c2be319624c505cbea1d7f6fcc52
[ "Apache-2.0" ]
110
2015-09-21T21:57:28.000Z
2022-02-23T12:54:27.000Z
src/test/java/com/github/dakusui/jcunit8/tests/features/pipeline/parameters/FsmTest.java
haim/jcunit
46b9a6fcde875adde9ad4bf3a75ef774dbf0f955
[ "Apache-2.0" ]
10
2016-02-13T20:05:41.000Z
2021-03-13T06:24:12.000Z
38.216418
163
0.670182
10,575
package com.github.dakusui.jcunit8.tests.features.pipeline.parameters; import com.github.dakusui.jcunit8.examples.flyingspaghettimonster.FlyingSpaghettiMonsterSpec; import com.github.dakusui.jcunit8.factorspace.Constraint; import com.github.dakusui.jcunit8.factorspace.FactorSpace; import com.github.dakusui.jcunit8.factorspace.Parameter; import com.github.dakusui.jcunit8.factorspace.ParameterSpace; import com.github.dakusui.jcunit8.pipeline.Config; import com.github.dakusui.jcunit8.pipeline.Requirement; import com.github.dakusui.jcunit8.pipeline.stages.generators.Cartesian; import com.github.dakusui.jcunit8.testsuite.SchemafulTupleSet; import com.github.dakusui.jcunit8.testutils.*; import org.junit.Test; import java.util.function.Function; import static com.github.dakusui.jcunit8.testutils.UTUtils.sizeIs; import static java.util.Collections.*; public class FsmTest extends PipelineTestBase { @Test public void givenFlyingSpaghttiMonster$whenBuildFactorSpace$thenBuilt() { FactorSpaceUtils.validateFactorSpace( Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 2).create("fsm1").toFactorSpace(), UTUtils.matcher( FactorSpaceUtils.sizeOfFactorsIs("==6", value -> value == 6), FactorSpaceUtils.sizeOfConstraintsIs("==8", value -> value == 8) ) ); } @Test public void givenFlyingSpaghettiMonster$whenGenerateWithCartesian$thenGenerated() { SchemafulTupleSetUtils.validateSchemafulTupleSet( SchemafulTupleSet.fromTuples( new Cartesian( Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 1) .create("fsm1") .toFactorSpace(), requirement() ).generate() ), UTUtils.matcher( sizeIs(">=number of states, at least", size -> size >= FlyingSpaghettiMonsterSpec.values().length) ) ); } @Test public void givenFlyingSpaghettiMonster$whenGenerateTestSuite$thenGenerated() { TestSuiteUtils.validateTestSuite( generateTestSuite( Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 1).create("fsm1") ), UTUtils.matcher( sizeIs(">=number of states, at least", size -> size >= FlyingSpaghettiMonsterSpec.values().length) ) ); } @Test public void givenFlyingSpaghettiMonster$whenGenerateTestSuiteFromFactorsWithConstraints() { TestSuiteUtils.validateTestSuite( generateTestSuite( singletonList(Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 1).create("fsm1")), singletonList(Constraint.create( "alwaysTrue[fsm1]", tuple -> true, "fsm1" )) ), UTUtils.matcher( sizeIs(">=number of states, at least", size -> size >= FlyingSpaghettiMonsterSpec.values().length) ) ); } @Test public void givenFlyingSpaghettiMonster$whenEncodeParameterSpace$thenFactorSpaceGenerated() { Function<ParameterSpace, FactorSpace> encoder = Config.Builder.forTuple(new Requirement.Builder().withNegativeTestGeneration(false).build()).build().encoder(); FactorSpaceUtils.validateFactorSpace( encoder.apply( new ParameterSpace.Builder() .addAllParameters(singleton(Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 1).create("fsm1"))) .build() ), UTUtils.matcher( FactorSpaceUtils.sizeOfFactorsIs("==6", value -> value == 3), FactorSpaceUtils.sizeOfConstraintsIs("==8", value -> value == 4) ) ); } @Test public void givenFlyingSpaghettiMonsteWithNoConstraint$whenPreprocess$thenFsmParameterWillBeKept() { ParameterSpaceUtils.validateParameterSpace( preprocess( singletonList( Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 1).create("fsm1")), emptyList() ), UTUtils.matcher( ParameterSpaceUtils.hasParameters(1), ParameterSpaceUtils.parameterIsInstanceOf("fsm1", Parameter.Fsm.class), ParameterSpaceUtils.hasConstraints(0) ) ); } @Test public void givenFlyingSpaghettiMonsterWithConstraint$whenPreprocess$thenParameterSpaceWithSimpleParameterAndConstraintIsGenerated() { ParameterSpaceUtils.validateParameterSpace( preprocess( singletonList(Parameter.Fsm.Factory.of(FlyingSpaghettiMonsterSpec.class, 1).create("fsm1")), singletonList(Constraint.create( "alwaysTrue[fsm1]", tuple -> true, "fsm1" )) ), UTUtils.matcher( ParameterSpaceUtils.hasParameters(1), ParameterSpaceUtils.parameterIsInstanceOf("fsm1", Parameter.Simple.class), ParameterSpaceUtils.sizeOfParameterKnownValuesSatisfies( "fsm1", UTUtils.oracle(">0", size -> size > 0) ), ParameterSpaceUtils.hasConstraints(1) ) ); } }
3e18dd5eb7a6061abe9d836a8f2bfd904516297d
1,334
java
Java
components/camel-seda/src/main/java/org/apache/camel/component/seda/LinkedBlockingQueueFactory.java
LittleEntity/camel
da0d257a983859c25add75047498aa2aa319d7e2
[ "Apache-2.0" ]
4,262
2015-01-01T15:28:37.000Z
2022-03-31T04:46:41.000Z
components/camel-seda/src/main/java/org/apache/camel/component/seda/LinkedBlockingQueueFactory.java
LittleEntity/camel
da0d257a983859c25add75047498aa2aa319d7e2
[ "Apache-2.0" ]
3,408
2015-01-03T02:11:17.000Z
2022-03-31T20:07:56.000Z
components/camel-seda/src/main/java/org/apache/camel/component/seda/LinkedBlockingQueueFactory.java
LittleEntity/camel
da0d257a983859c25add75047498aa2aa319d7e2
[ "Apache-2.0" ]
5,505
2015-01-02T14:58:12.000Z
2022-03-30T19:23:41.000Z
37.055556
108
0.748126
10,576
/* * 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.camel.component.seda; import java.util.concurrent.LinkedBlockingQueue; /** * Implementation of {@link BlockingQueueFactory} producing {@link java.util.concurrent.LinkedBlockingQueue} */ public class LinkedBlockingQueueFactory<E> implements BlockingQueueFactory<E> { @Override public LinkedBlockingQueue<E> create() { return new LinkedBlockingQueue<>(); } @Override public LinkedBlockingQueue<E> create(int capacity) { return new LinkedBlockingQueue<>(capacity); } }
3e18dd622cceb02c34387f8eb77b776426056173
2,768
java
Java
runescape-client/src/main/java/GameObject.java
CrossCRS/runelite
6d4f293224f10f0beb52f6c0ed0b4186ff3a552a
[ "BSD-2-Clause" ]
null
null
null
runescape-client/src/main/java/GameObject.java
CrossCRS/runelite
6d4f293224f10f0beb52f6c0ed0b4186ff3a552a
[ "BSD-2-Clause" ]
null
null
null
runescape-client/src/main/java/GameObject.java
CrossCRS/runelite
6d4f293224f10f0beb52f6c0ed0b4186ff3a552a
[ "BSD-2-Clause" ]
null
null
null
22.504065
78
0.636922
10,577
import net.runelite.mapping.Export; import net.runelite.mapping.Implements; import net.runelite.mapping.ObfuscatedGetter; import net.runelite.mapping.ObfuscatedName; import net.runelite.mapping.ObfuscatedSignature; @ObfuscatedName("ep") @Implements("GameObject") public final class GameObject { @ObfuscatedName("qe") @ObfuscatedSignature( signature = "Li;" ) @Export("grandExchangeEvents") static GrandExchangeEvents grandExchangeEvents; @ObfuscatedName("d") @ObfuscatedGetter( intValue = -415524067 ) @Export("plane") int plane; @ObfuscatedName("z") @ObfuscatedSignature( signature = "Leb;" ) @Export("renderable") public Renderable renderable; @ObfuscatedName("n") @ObfuscatedGetter( intValue = 2015304177 ) @Export("height") int height; @ObfuscatedName("r") @ObfuscatedGetter( intValue = -1875135455 ) @Export("x") int x; @ObfuscatedName("e") @ObfuscatedGetter( intValue = 1107775953 ) @Export("y") int y; @ObfuscatedName("y") @ObfuscatedGetter( intValue = -1002981227 ) @Export("orientation") int orientation; @ObfuscatedName("k") @ObfuscatedGetter( intValue = -898980511 ) @Export("relativeX") int relativeX; @ObfuscatedName("s") @ObfuscatedGetter( intValue = 654730907 ) @Export("offsetX") int offsetX; @ObfuscatedName("p") @ObfuscatedGetter( intValue = -1827831145 ) @Export("relativeY") int relativeY; @ObfuscatedName("x") @ObfuscatedGetter( intValue = -1974564541 ) @Export("offsetY") int offsetY; @ObfuscatedName("m") @ObfuscatedGetter( intValue = -365421721 ) @Export("drawPriority") int drawPriority; @ObfuscatedName("h") @ObfuscatedGetter( intValue = 1769629895 ) @Export("cycle") int cycle; @ObfuscatedName("t") @ObfuscatedGetter( intValue = 1467533485 ) @Export("hash") public int hash; @ObfuscatedName("i") @ObfuscatedGetter( intValue = -66541605 ) @Export("flags") int flags; GameObject() { this.hash = 0; this.flags = 0; } @ObfuscatedName("z") @ObfuscatedSignature( signature = "(Ljs;IB)V", garbageValue = "75" ) static void method3166(IndexData var0, int var1) { if(class20.NetCache_reference != null) { class20.NetCache_reference.offset = var1 * 8 + 5; int var2 = class20.NetCache_reference.readInt(); int var3 = class20.NetCache_reference.readInt(); var0.setInformation(var2, var3); } else { class229.requestNetFile((IndexData)null, 255, 255, 0, (byte)0, true); class264.NetCache_indexCaches[var1] = var0; } } }
3e18de905c0d37904a321e0fb630d675d3f3fb67
141
java
Java
src/test/resources/miniJava/pa3_tests/pass305.java
eric-unc/520-compiler
6ff258bf3eae79db237f71832aec6b3f8926350b
[ "Unlicense" ]
null
null
null
src/test/resources/miniJava/pa3_tests/pass305.java
eric-unc/520-compiler
6ff258bf3eae79db237f71832aec6b3f8926350b
[ "Unlicense" ]
null
null
null
src/test/resources/miniJava/pa3_tests/pass305.java
eric-unc/520-compiler
6ff258bf3eae79db237f71832aec6b3f8926350b
[ "Unlicense" ]
null
null
null
14.1
44
0.567376
10,578
/** * COMP 520 * Identification */ class Pass305 { public static void main(String[] args) { System.out.println(3); } }
3e18deacf1788969876c8d595f63273f6ad58869
1,385
java
Java
src/main/java/org/springframework/data/tarantool/core/mapping/TarantoolPersistentEntity.java
tarantool/spring-data-tarantool
da5dd3d2a0d1062aec78da71aeecedc28a6aabec
[ "BSD-2-Clause" ]
1
2020-09-22T22:14:13.000Z
2020-09-22T22:14:13.000Z
src/main/java/org/springframework/data/tarantool/core/mapping/TarantoolPersistentEntity.java
akudiyar/spring-data-tarantool
4cdc81d9c029d0d3fc5b757f935cf6b4730a9f5d
[ "BSD-2-Clause" ]
null
null
null
src/main/java/org/springframework/data/tarantool/core/mapping/TarantoolPersistentEntity.java
akudiyar/spring-data-tarantool
4cdc81d9c029d0d3fc5b757f935cf6b4730a9f5d
[ "BSD-2-Clause" ]
null
null
null
27.156863
104
0.67509
10,579
package org.springframework.data.tarantool.core.mapping; import org.springframework.data.mapping.PersistentEntity; import java.util.List; import java.util.Optional; /** * Represents an entity to be persisted * * @param <T> domain object type * @author Alexey Kuzin */ public interface TarantoolPersistentEntity<T> extends PersistentEntity<T, TarantoolPersistentProperty> { /** * Tarantool space this entity can be saved to * * @return not null String */ String getSpaceName(); /** * Get information about {@link Tuple} annotation on the class * * @return true, if the {@link Tuple} annotation is set on the class */ boolean hasTupleAnnotation(); /** * Get information about {@link TarantoolIdClass} annotation on the class * * @return true if the {@link TarantoolIdClass} annotation is set on the class */ boolean hasTarantoolIdClassAnnotation(); /** * Get annotated identifier class type * * @return type specified in {@link TarantoolIdClass} or null if annotation was not specified */ Optional<Class<?>> getTarantoolIdClass(); /** * Extract property values from id object to list. * * @param idValue a bean of {@link TarantoolIdClass} type * @return list with property values */ List<?> getCompositeIdParts(Object idValue); }
3e18deb583c3774a22e5e4ab826bb3238ee9f202
5,889
java
Java
src/main/java/igentuman/ncsteamadditions/crafttweaker/AddSteamAdditionsRecipe.java
igentuman/nc-steam-additions
d105b90aeaadb1db21839dd3c9b9dcc35a064954
[ "MIT" ]
2
2022-01-18T00:52:04.000Z
2022-01-20T23:47:35.000Z
src/main/java/igentuman/ncsteamadditions/crafttweaker/AddSteamAdditionsRecipe.java
igentuman/nc-steam-additions
d105b90aeaadb1db21839dd3c9b9dcc35a064954
[ "MIT" ]
11
2021-12-11T16:13:41.000Z
2022-02-11T18:44:11.000Z
src/main/java/igentuman/ncsteamadditions/crafttweaker/AddSteamAdditionsRecipe.java
igentuman/nc-steam-additions
d105b90aeaadb1db21839dd3c9b9dcc35a064954
[ "MIT" ]
null
null
null
32.716667
252
0.718288
10,580
package igentuman.ncsteamadditions.crafttweaker; import java.util.ArrayList; import java.util.List; import crafttweaker.CraftTweakerAPI; import crafttweaker.IAction; import crafttweaker.api.item.IIngredient; import igentuman.ncsteamadditions.recipe.NCSteamAdditionsRecipe; import igentuman.ncsteamadditions.recipe.NCSteamAdditionsRecipeHandler; import igentuman.ncsteamadditions.recipe.NCSteamAdditionsRecipeHelper; import nc.integration.crafttweaker.CTHelper; import nc.recipe.ingredient.IFluidIngredient; import nc.recipe.ingredient.IItemIngredient; public class AddSteamAdditionsRecipe implements IAction { public static boolean hasErrored = false; public List<IItemIngredient> itemIngredients; public List<IFluidIngredient> fluidIngredients; public List<IItemIngredient> itemProducts; public List<IFluidIngredient> fluidProducts; public List extras; public NCSteamAdditionsRecipe recipe; public boolean inputsAllNull = true, ingredientError, wasNull, wrongSize; public final NCSteamAdditionsRecipeHandler recipeHandler; public AddSteamAdditionsRecipe(NCSteamAdditionsRecipeHandler recipeHandler, List objects) { this.recipeHandler = recipeHandler; int listCount = 0, ingredientCount = 0; List<IItemIngredient> itemIngredients = new ArrayList<>(); List<IFluidIngredient> fluidIngredients = new ArrayList<>(); List<IItemIngredient> itemProducts = new ArrayList<>(); List<IFluidIngredient> fluidProducts = new ArrayList<>(); List extras = new ArrayList(); while (listCount < objects.size()) { Object object = objects.get(listCount); if (ingredientCount < recipeHandler.getItemInputSize()) { if (object != null) { if (!(object instanceof IIngredient)) { ingredientError = true; return; } inputsAllNull = false; } IItemIngredient ingredient = CTHelper.buildAdditionItemIngredient((IIngredient) object); if (ingredient == null) { ingredientError = true; return; } itemIngredients.add(ingredient); } else if (ingredientCount < recipeHandler.getItemInputSize() + recipeHandler.getFluidInputSize()) { if (object != null) { if (!(object instanceof IIngredient)) { ingredientError = true; return; } inputsAllNull = false; } IFluidIngredient ingredient = CTHelper.buildAdditionFluidIngredient((IIngredient) object); if (ingredient == null) { ingredientError = true; return; } fluidIngredients.add(ingredient); } else if (ingredientCount < recipeHandler.getItemInputSize() + recipeHandler.getFluidInputSize()) { if (object != null) { if (!(object instanceof IIngredient)) { ingredientError = true; return; } inputsAllNull = false; } } else if (ingredientCount < recipeHandler.getItemInputSize() + recipeHandler.getFluidInputSize() + recipeHandler.getItemOutputSize()) { if (object != null) { if (!(object instanceof IIngredient)) { ingredientError = true; return; } } IItemIngredient ingredient = CTHelper.buildAdditionItemIngredient((IIngredient) object); if (ingredient == null) { ingredientError = true; return; } itemProducts.add(ingredient); } else if (ingredientCount < recipeHandler.getItemInputSize() + recipeHandler.getFluidInputSize() + recipeHandler.getItemOutputSize() + recipeHandler.getFluidOutputSize()) { if (object != null) { if (!(object instanceof IIngredient)) { ingredientError = true; return; } } IFluidIngredient ingredient = CTHelper.buildAdditionFluidIngredient((IIngredient) object); if (ingredient == null) { ingredientError = true; return; } fluidProducts.add(ingredient); } else if (ingredientCount < recipeHandler.getItemInputSize() + recipeHandler.getFluidInputSize() + recipeHandler.getItemOutputSize() + recipeHandler.getFluidOutputSize()) { if (object != null) { if (!(object instanceof IIngredient)) { ingredientError = true; return; } } } else { extras.add(object); } listCount++; ingredientCount++; } if (itemIngredients.size() != recipeHandler.getItemInputSize() || fluidIngredients.size() != recipeHandler.getFluidInputSize() || itemProducts.size() != recipeHandler.getItemOutputSize() || fluidProducts.size() != recipeHandler.getFluidOutputSize()) { CraftTweakerAPI.logError("A " + recipeHandler.getRecipeName() + " recipe was the wrong size"); wrongSize = true; return; } this.itemIngredients = itemIngredients; this.fluidIngredients = fluidIngredients; this.itemProducts = itemProducts; this.fluidProducts = fluidProducts; this.extras = extras; recipe = recipeHandler.buildRecipe(itemIngredients, fluidIngredients, itemProducts, fluidProducts, extras, recipeHandler.isShapeless()); if (recipe == null) wasNull = true; } @Override public void apply() { if (!inputsAllNull && !ingredientError && !wasNull && !wrongSize) { recipeHandler.addRecipe(recipe); } } @Override public String describe() { if (inputsAllNull || ingredientError || wasNull || wrongSize) { if (ingredientError || wrongSize) callError(); return String.format("Error: Failed to add %s recipe: %s", recipeHandler.getRecipeName(), NCSteamAdditionsRecipeHelper.getRecipeString(itemIngredients, fluidIngredients, itemProducts, fluidProducts)); } return String.format("Adding %s recipe: %s", recipeHandler.getRecipeName(), NCSteamAdditionsRecipeHelper.getRecipeString(itemIngredients, fluidIngredients, itemProducts, fluidProducts)); } public static void callError() { if (!hasErrored) { CraftTweakerAPI.logError("At least one CraftTweaker recipe addition method has errored - check the CraftTweaker log for more details"); } hasErrored = true; } }
3e18dfae23e6c0ca654e7b9d42d9896a6e624321
658
java
Java
src/test/java/com/king/tratt/spi/test/imp/IdEventValue.java
king/tratt-api
bbda37695d75b046fe5a7171736669a4431f83d1
[ "Apache-2.0" ]
6
2016-08-11T10:37:05.000Z
2019-09-23T07:48:56.000Z
src/test/java/com/king/tratt/spi/test/imp/IdEventValue.java
king/tratt-api
bbda37695d75b046fe5a7171736669a4431f83d1
[ "Apache-2.0" ]
4
2016-05-31T07:55:22.000Z
2017-01-16T12:06:39.000Z
src/test/java/com/king/tratt/spi/test/imp/IdEventValue.java
king/tratt-api
bbda37695d75b046fe5a7171736669a4431f83d1
[ "Apache-2.0" ]
2
2016-05-23T16:12:29.000Z
2021-01-25T08:57:12.000Z
23.5
74
0.667173
10,581
// (C) king.com Ltd 2016 // https://github.com/king/tratt-api // License: Apache 2.0, https://raw.github.com/king/PROJECT/LICENSE-APACHE package com.king.tratt.spi.test.imp; import com.king.tratt.spi.Context; import com.king.tratt.spi.Event; import com.king.tratt.spi.Value; public class IdEventValue extends Value { @Override public String toDebugString(Event e, Context context) { return String.format("[[source:event.id]]%s", get(e, context)); } @Override protected String getImp(Event e, Context context) { return e.getId(); } @Override public String toString() { return "event[id]"; } }
3e18dff075b0fbfcbc58d3620916301548c4c4b9
18,626
java
Java
src/main/java/asia/redact/bracket/properties/ArrayListPropertiesImpl.java
buttermilk-crypto/bracket
8fb4e734af8c152afed5745a12e645548f799b99
[ "Apache-2.0" ]
1
2016-07-01T12:13:55.000Z
2016-07-01T12:13:55.000Z
src/main/java/asia/redact/bracket/properties/ArrayListPropertiesImpl.java
buttermilk-crypto/bracket
8fb4e734af8c152afed5745a12e645548f799b99
[ "Apache-2.0" ]
null
null
null
src/main/java/asia/redact/bracket/properties/ArrayListPropertiesImpl.java
buttermilk-crypto/bracket
8fb4e734af8c152afed5745a12e645548f799b99
[ "Apache-2.0" ]
null
null
null
22.882064
122
0.616772
10,582
/* * This file is part of Bracket Properties * Copyright 2011-2016 David R. Smith, All Rights Reserved * */ package asia.redact.bracket.properties; import java.io.Serializable; import java.math.BigDecimal; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.Date; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.regex.Matcher; import asia.redact.bracket.util.AccessorMethodSetter; import asia.redact.bracket.util.EnvResolver; /** * Backed with a list * * @author Dave * */ public class ArrayListPropertiesImpl extends PropertiesBaseImpl implements Properties, Serializable { // data protected ArrayList<Entry> list; private static final long serialVersionUID = 1L; public ArrayListPropertiesImpl(ArrayList<Entry> list) { super(); this.list = list; } public ArrayListPropertiesImpl() { super(); list= new ArrayList<Entry>(); } /** * for compatibility with PropertiesImpl code * */ @Override public Map<String, ValueModel> getPropertyMap() { Map<String,ValueModel> map = new LinkedHashMap<String,ValueModel>(); for(Entry e: list){ map.put(e.getKey(), e.getModel()); } return map; } @Override public Map<String, String> getFlattenedMap() { Map<String,String> map = new LinkedHashMap<String,String>(); for(Entry e: list){ map.put(e.getKey(), e.getModel().getValue()); } return map; } /** * Given a key, locate our Entry in the array. This is thread-safe * */ public Entry find(String key) { lock.lock(); try { for(Entry e: list){ if(e.getKey().equals(key)) return e; } }finally{ lock.unlock(); } throw new RuntimeException("no such key: "+key); } /** * Update an entry by index. Thread-safe. * */ public void updateAt(int index, Entry entry){ lock.lock(); try { list.remove(index); list.add(index, entry); }finally{ lock.unlock(); } } /** * Update a position based on the key found in the entry. Thread-safe. If the key is not found, just add it by * calling list.add(); * */ public void update(Entry entry) { lock.lock(); try { boolean found = false; int i = 0; for(Entry e: list){ if(entry.key.equals(e.key)) { found=true; break; } i++; } if(found){ list.remove(i); list.add(i,entry); }else{ list.add(entry); } }finally{ lock.unlock(); } } public void delete(String key) { lock.lock(); try { int i = 0; for(Entry e: list){ if(key.equals(e.key)) break; i++; } if(i>0)list.remove(i); }finally{ lock.unlock(); } } @Override public String get(String key) { return find(key).getModel().getValue(); } /** * Special method which resolves environment variables in the value. The variables take the form ${varname} like in ant. * * Variables in keys are not allowed * */ @Override public String resolve(String key) { String template = get(key); Matcher matcher = antStyleVarPattern.matcher(template); StringBuffer sb = new StringBuffer(); while(matcher.find()){ String val = matcher.group(1); String repl = EnvResolver.INSTANCE.get(val); matcher.appendReplacement(sb,Matcher.quoteReplacement(repl)); } matcher.appendTail(sb); return sb.toString(); } @Override public int intValue(String key) { return Integer.parseInt(get(key)); } /** * Works for "true/false", "enabled/disabled", "yes/no" */ public boolean booleanValue(String key) { String val = get(key); if(Boolean.parseBoolean(val)) return true; else{ // special tests if(val == null || val.equals("")) return false; if(val.toLowerCase().trim().equals("enabled")) return true; if(val.toLowerCase().trim().equals("ok")) return true; if(val.toLowerCase().trim().equals("yes")) return true; } return false; } @Override public long longValue(String key) { return Long.parseLong(get(key)); } /** * The value is assumed to be a long integer * */ public Date dateValue(String key) { lock.lock(); try { String val = get(key); if(val.trim().length() != 13) throw new RuntimeException("Value does not look like a long that could be used as a date"); return new java.util.Date(longValue(key)); }finally{ lock.unlock(); } } /** * I should really deprecate this - you should really use long values as dates in a serialization. See above. */ public Date dateValue(String key, String format) throws ParseException { lock.lock(); try { SimpleDateFormat f = new SimpleDateFormat(format); return f.parse(get(key)); }finally{ lock.unlock(); } } /** * Where the value is a string you wish to tokenize, space delimiter * */ public List<String> listValue(String key){ List<String> l = new ArrayList<String>(); String val = get(key); String [] items = val.split(" "); for(String s : items){ l.add(s); } return l; } /** * Where the value is a string you wish to tokenize, any delimiter * */ public List<String> listValue(String key, String delimiter){ List<String> l = new ArrayList<String>(); String val = get(key); String [] items = val.split(delimiter); for(String s : items){ l.add(s); } return l; } /** * Complement of the above * */ public void putList(String key, char ch, List<String> l) { StringBuffer buf = new StringBuffer(); for(String val : l){ buf.append(val); buf.append(ch); } buf.deleteCharAt(buf.length()-1); put(key,buf.toString()); } public BitSet bitsetValue(String key) { String value = get(key).trim(); BitSet set = new BitSet(value.length()); for(int i=0;i<value.length();i++){ set.set(i,value.charAt(i)=='1' ? true : false); } return set; } public BigInteger bigValue(String key) { return new BigInteger(get(key).trim()); } public BigDecimal bigDecimalValue(String key) { return new BigDecimal(get(key).trim()); } public Object beanValue(Class<?> clazz, String keyBase) { try { Object obj = clazz.newInstance(); // collect the keys which match for(Entry e : list){ String k = e.key; if(k.startsWith(keyBase)){ // verify key is actually of the correct form, with a dot and a terminal identifier String remainder = k.substring(keyBase.length(),k.length()); Matcher matcher = dotIdentifierPattern.matcher(remainder); if(matcher.matches()){ String identifier = matcher.group(1); String value = get(k); AccessorMethodSetter setter = new AccessorMethodSetter(clazz, obj, identifier, value); setter.set(); if(setter.success()){ }else{ } }else{ continue; } } } return obj; } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public Node getTree(){ return getTree(new GroupParams()); } public Node getTree(GroupParams params) { lock.lock(); try { TreeBuilder builder = new TreeBuilder(this,params.rootNodeName); for(Entry e : list){ String key = e.key; if(key.startsWith(params.getPartialKey())){ ValueModel value = find(key).getModel(); builder.createNode(key, value, params.getSeparator()); } } return builder.tree(); }finally{ lock.unlock(); } } public Properties getGroup(GroupParams params){ PropertiesImpl impl = new PropertiesImpl(); for(String key : this.getPropertyMap().keySet()){ if(key.startsWith(params.getPartialKey())){ ValueModel value = find(key).getModel(); impl.getPropertyMap().put(key, value); } } return impl; } public List<String> getComments(String key) { lock.lock(); try { if(!containsKey(key)) return null; return getPropertyMap().get(key).getComments(); }finally{ lock.unlock(); } } public char getSeparator(String key) { lock.lock(); try { if(!containsKey(key)) return '\0'; return find(key).getModel().getSeparator(); }finally{ lock.unlock(); } } /** * Useful for adding e.g., ImmutableValueObjects * */ public void put(Entry entry) { update(entry); } public void put(String key, String ... values){ lock.lock(); try { if(!containsKey(key)){ update(new Entry(key, new BasicValueModel(values))); }else{ ValueModel val = find(key).getModel(); val.getValues().clear(); for(String s:values){ val.getValues().add(s); } } }finally{ lock.unlock(); } } @Override public void put(String key, int val) { put(key,String.valueOf(val)); } @Override public void put(String key, float val) { put(key,String.valueOf(val)); } @Override public void put(String key, double val) { put(key,String.valueOf(val)); } @Override public void put(String key, boolean val) { put(key,String.valueOf(val)); } @Override public void put(String key, char val) { put(key,String.valueOf(val)); } @Override public void put(String key, BigInteger bi) { put(key,bi.toString()); } @Override public void put(String key, BigDecimal bd) { put(key,bd.toString()); } public void put(String key, Comment comment, String ... values){ lock.lock(); try { if(!containsKey(key)){ update(new Entry(key, new BasicValueModel(comment,values))); }else{ ValueModel val = find(key).getModel(); if(val instanceof BasicValueModel){ ((BasicValueModel)val).addComment(comment.comment); } val.getValues().clear(); for(String s:values){ val.getValues().add(s); } } }finally{ lock.unlock(); } } public void put(String key, char separator, Comment comment, String ... values){ lock.lock(); try { if(!containsKey(key)){ update(new Entry(key, new BasicValueModel(comment,separator,values))); }else{ ValueModel val = find(key).getModel(); if(val instanceof BasicValueModel){ ((BasicValueModel)val).addComment(comment.comment); ((BasicValueModel)val).setSeparator(separator); } val.getValues().clear(); for(String s:values){ val.getValues().add(s); } } }finally{ lock.unlock(); } } @Override public int size() { lock.lock(); try { return list.size(); }finally{ lock.unlock(); } } @Override public void clear() { lock.lock(); try { list.clear(); }finally{ lock.unlock(); } } @Override public boolean containsKey(String key) { lock.lock(); try { for(Entry e: list){ if(e.getKey().equals(key)) return true; } }finally{ lock.unlock(); } return false; } @Override public boolean hasValue(String key) { lock.lock(); try { for(Entry e: list){ if(e.getKey().equals(key)){ if(!e.getModel().getValue().equals("")) return true; } } }finally{ lock.unlock(); } return false; } /** * This is a combine function, existing keys which do not collide * with the incoming are kept, keys that collide are overwritten * with the new values * */ public Properties merge(Properties props) { merge(props,false,false); return this; } public Properties merge(Properties props, boolean mergeComments) { merge(props,mergeComments,false); return this; } /** * merge and deobfuscate not yet implemented */ public Properties merge(Properties props, boolean mergeComments, boolean deobfuscate) { lock.lock(); try { if(props instanceof ArrayListPropertiesImpl){ ArrayListPropertiesImpl impl = (ArrayListPropertiesImpl)props; for(Entry e: impl.list) { this.update(e); } }else{ Iterator<String> iter = props.getPropertyMap().keySet().iterator(); while(iter.hasNext()){ String key = iter.next(); this.update(new Entry(key,props.getPropertyMap().get(key))); } } }finally{ lock.unlock(); } return this; } public void obfuscate(String key){ String val = this.get(key); if(key != null && !key.equals("")){ String obfuscated = Obfuscate.FACTORY.encrypt(val); this.put(key, obfuscated); } } public void deobfuscate(String key){ String val = this.get(key); if(key != null && !key.equals("")){ String deobfuscated = Obfuscate.FACTORY.decrypt(val); this.put(key, deobfuscated); } } public char[] deobfuscateToChar(String key){ String val = this.get(key); return Obfuscate.FACTORY.decryptToChar(val,StandardCharsets.UTF_8); } /** * Caution - can have serious consequences if misused * */ @Override public void mergeIntoSystemProperties() { Map<String,ValueModel> map = getPropertyMap(); for(String key : map.keySet()){ System.setProperty(key, map.get(key).getValue()); } } /** * Given a base like key, collect keys like key.0, key.1, key.2 etc into a list. The keys need not * be in order in the file */ public List<String> getList(String keyBase) { List<String> l = new ArrayList<String>(); Map<Integer,String> numberedMap = new TreeMap<Integer,String>(); // collect the keys which match for(Entry e : list){ String key = e.getKey(); if(key.startsWith(keyBase)){ // verify key is actually of the correct form, with a dot and a terminal integer String remainder = key.substring(keyBase.length(),key.length()); Matcher matcher = dotIntegerPattern.matcher(remainder); if(matcher.matches()){ Integer keyInt = Integer.parseInt(matcher.group(1)); numberedMap.put(keyInt,find(key).getModel().getValue()); }else{ continue; } } } if(numberedMap.size() == 0) return l; //collect the values in order of the numbers Set<Integer> numberKeySet = numberedMap.keySet(); for(Integer i: numberKeySet){ l.add(numberedMap.get(i)); } return l; } public void put(String key, char separator, String ... values){ lock.lock(); try { if(!containsKey(key)){ update(new Entry(key, new BasicValueModel(separator,values))); }else{ ValueModel val = find(key).getModel(); if(val instanceof BasicValueModel){ ((BasicValueModel)val).setSeparator(separator); } val.getValues().clear(); for(String s:values){ val.getValues().add(s); } } }finally{ lock.unlock(); } } @Override public void putList(List<String> list, String rootKey) { int count = 0; for(String val : list){ StringBuffer buf = new StringBuffer(rootKey); buf.append("."); buf.append(count); put(buf.toString(),val); count++; } } public void putList(List<String> list, Comment comment, String rootKey) { int count = 0; for(String val : list){ StringBuffer buf = new StringBuffer(rootKey); buf.append("."); buf.append(count); if(count == 0) put(buf.toString(),comment,val); else put(buf.toString(),val); count++; } } public void putList(List<String> list, char sep, Comment comment, String rootKey) { int count = 0; for(String val : list){ StringBuffer buf = new StringBuffer(rootKey); buf.append("."); buf.append(count); if(count == 0) put(buf.toString(),sep,comment,val); else put(buf.toString(),sep,val); count++; } } public List<String> getListKeys(String keyBase) { List<String> l = new ArrayList<String>(); // collect the keys which match for(Entry e : list){ String k = e.key; if(k.startsWith(keyBase)){ // verify key is actually of the correct form, with a dot and a terminal integer String remainder = k.substring(keyBase.length(),k.length()); Matcher matcher = dotIntegerPattern.matcher(remainder); if(matcher.matches()){ l.add(k); }else{ continue; } } } //TODO use a comparator Collections.sort(l); return l; } public List<String> getMapKeys(String keyBase) { List<String> l = new ArrayList<String>(); for(Entry e : list){ String k = e.key; if(k.startsWith(keyBase)){ // verify key is actually of the correct form, with a dot, integer, dot, and k or v String remainder = k.substring(keyBase.length(),k.length()); Matcher matcher = dotKeyValuePattern.matcher(remainder); if(matcher.matches()){ l.add(k); }else{ continue; } } } Collections.sort(l); return l; } public boolean hasKeyLike(String partial){ for(String key : this.getPropertyMap().keySet()){ if(key.startsWith(partial)){ return true; } } return false; } public java.util.Properties convertToLegacyProperties() { lock.lock(); try { java.util.Properties legacy = new java.util.Properties(); for(Entry e: list){ String key = e.key; String value = get(key); legacy.put(key, value); } return legacy; }finally{ lock.unlock(); } } public void put(String key, List<String> values){ lock.lock(); try { putList(key,' ',values); }finally{ lock.unlock(); } } /** * Return null if out of bounds */ public Entry atIndex(int index){ try { return list.get(index); }catch(Exception x){ return null; } } @Override public float floatValue(String key) { return Float.parseFloat(get(key)); } @Override public void put(String key, long val){ put(key,String.valueOf(val)); } @Override public Properties slice(String root){ PropertiesImpl impl = new PropertiesImpl(); for(String key : this.getPropertyMap().keySet()){ if(key.startsWith(root)){ ValueModel value = find(key).getModel(); impl.getPropertyMap().put(key, value); } } return impl; } }
3e18e1968f44fbf7eb42b1e18d35da4136ec9d59
4,026
java
Java
data-structures-and-algorithms/src/test/java/org/devon/algorithms/leetcode/MergeTwoSortedListTest.java
devon-ye/demos-parent
bc98102d26d7b123bb4bfdd13d3d6f20c27b16a8
[ "Apache-2.0" ]
10
2018-03-27T06:47:00.000Z
2019-10-20T17:47:44.000Z
data-structures-and-algorithms/src/test/java/org/devon/algorithms/leetcode/MergeTwoSortedListTest.java
Devonmusa/demos-parent
bc98102d26d7b123bb4bfdd13d3d6f20c27b16a8
[ "Apache-2.0" ]
2
2019-01-05T13:07:56.000Z
2019-01-12T02:20:44.000Z
data-structures-and-algorithms/src/test/java/org/devon/algorithms/leetcode/MergeTwoSortedListTest.java
devon-ye/demos-parent
bc98102d26d7b123bb4bfdd13d3d6f20c27b16a8
[ "Apache-2.0" ]
4
2018-03-07T02:50:38.000Z
2018-05-28T06:41:30.000Z
25.643312
54
0.570541
10,583
package org.devon.algorithms.leetcode; import org.junit.Test; public class MergeTwoSortedListTest { @Test public void mergeTwoList() { ListNode node1 = new ListNode(1); ListNode node2 = new ListNode(2); ListNode node3 = new ListNode(4); node1.next = node2; node2.next = node3; ListNode node4 = new ListNode(2); ListNode node5 = new ListNode(4); ListNode node6 = new ListNode(6); node4.next = node5; node5.next = node6; MergeTwoSortedList.mergeTwoList(node1, node4); } @Test public void mergeKLists1() { //case 1 ListNode node1 = new ListNode(1); ListNode node12 = new ListNode(2); ListNode node13 = new ListNode(7); ListNode node14 = new ListNode(9); node1.next = node12; node12.next = node13; node13.next = node14; ListNode node2 = new ListNode(3); ListNode node3 = new ListNode(2); ListNode node31 = new ListNode(5); ListNode node32 = new ListNode(8); ListNode node33 = new ListNode(9); node3.next = node31; node31.next = node32; node32.next = node33; ListNode node4 = new ListNode(7); ListNode node41 = new ListNode(8); ListNode node42 = new ListNode(18); ListNode node43 = new ListNode(30); node4.next = node41; node41.next = node42; node42.next = node43; ListNode[] lists = new ListNode[4]; lists[0] = node1; lists[1] = node2; lists[2] = node3; lists[3] = node4; MergeTwoSortedList.mergeKLists(lists); } @Test public void mergeKLists2() { //case 1 ListNode node1 = new ListNode(2); ListNode node2 = null; ListNode node3 = new ListNode(-1); ListNode[] lists = new ListNode[3]; lists[0] = node1; lists[1] = node2; lists[2] = node3; MergeTwoSortedList.mergeKLists(lists); } @Test public void mergeKLists21() { //case 1 ListNode node1 = new ListNode(1); ListNode node12 = new ListNode(2); ListNode node13 = new ListNode(7); ListNode node14 = new ListNode(9); node1.next = node12; node12.next = node13; node13.next = node14; ListNode node2 = new ListNode(3); ListNode node3 = new ListNode(2); ListNode node31 = new ListNode(5); ListNode node32 = new ListNode(8); ListNode node33 = new ListNode(9); node3.next = node31; node31.next = node32; node32.next = node33; ListNode node4 = new ListNode(7); ListNode node41 = new ListNode(8); ListNode node42 = new ListNode(18); ListNode node43 = new ListNode(30); node4.next = node41; node41.next = node42; node42.next = node43; ListNode[] lists = new ListNode[4]; lists[0] = node1; lists[1] = node2; lists[2] = node3; lists[3] = node4; MergeTwoSortedList.mergeKLists(lists); } @Test public void swapPairs() { ListNode node1 = new ListNode(1); ListNode node2 = new ListNode(2); ListNode node3 = new ListNode(7); ListNode node4 = new ListNode(9); node1.next = node2; node2.next = node3; node3.next = node4; MergeTwoSortedList.swapPairs(node1); } @Test public void swapPairs2() { ListNode node5 = new ListNode(1); ListNode node6 = new ListNode(2); ListNode node7 = new ListNode(7); node5.next =node6; node6.next = node7; MergeTwoSortedList.swapPairs(node5); } @Test public void deleteDuplicates() { ListNode node1 = new ListNode(1); ListNode node2= new ListNode(1); ListNode node3 = new ListNode(2); node1.next =node2; node2.next = node3; MergeTwoSortedList.deleteDuplicates(node1); } }
3e18e1fe390c4883e048314188dee86a95896b50
2,799
java
Java
core/src/main/java/org/bouncycastle/asn1/x509/qualified/Iso4217CurrencyCode.java
matheus-eyng/bc-java
b35d626619a564db860e59e1cda353dec8d7a4fa
[ "MIT" ]
1,604
2015-01-01T16:53:59.000Z
2022-03-31T13:21:39.000Z
core/src/main/java/org/bouncycastle/asn1/x509/qualified/Iso4217CurrencyCode.java
matheus-eyng/bc-java
b35d626619a564db860e59e1cda353dec8d7a4fa
[ "MIT" ]
1,015
2015-01-08T08:15:43.000Z
2022-03-31T11:05:41.000Z
core/src/main/java/org/bouncycastle/asn1/x509/qualified/Iso4217CurrencyCode.java
matheus-eyng/bc-java
b35d626619a564db860e59e1cda353dec8d7a4fa
[ "MIT" ]
885
2015-01-01T16:54:08.000Z
2022-03-31T22:46:25.000Z
29.463158
133
0.634512
10,584
package org.bouncycastle.asn1.x509.qualified; import org.bouncycastle.asn1.ASN1Choice; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1PrintableString; import org.bouncycastle.asn1.DERPrintableString; /** * The Iso4217CurrencyCode object. * <pre> * Iso4217CurrencyCode ::= CHOICE { * alphabetic PrintableString (SIZE 3), --Recommended * numeric INTEGER (1..999) } * -- Alphabetic or numeric currency code as defined in ISO 4217 * -- It is recommended that the Alphabetic form is used * </pre> */ public class Iso4217CurrencyCode extends ASN1Object implements ASN1Choice { final int ALPHABETIC_MAXSIZE = 3; final int NUMERIC_MINSIZE = 1; final int NUMERIC_MAXSIZE = 999; ASN1Encodable obj; int numeric; public static Iso4217CurrencyCode getInstance( Object obj) { if (obj == null || obj instanceof Iso4217CurrencyCode) { return (Iso4217CurrencyCode)obj; } if (obj instanceof ASN1Integer) { ASN1Integer numericobj = ASN1Integer.getInstance(obj); int numeric = numericobj.intValueExact(); return new Iso4217CurrencyCode(numeric); } else if (obj instanceof ASN1PrintableString) { ASN1PrintableString alphabetic = ASN1PrintableString.getInstance(obj); return new Iso4217CurrencyCode(alphabetic.getString()); } throw new IllegalArgumentException("unknown object in getInstance"); } public Iso4217CurrencyCode( int numeric) { if (numeric > NUMERIC_MAXSIZE || numeric < NUMERIC_MINSIZE) { throw new IllegalArgumentException("wrong size in numeric code : not in (" +NUMERIC_MINSIZE +".."+ NUMERIC_MAXSIZE +")"); } obj = new ASN1Integer(numeric); } public Iso4217CurrencyCode( String alphabetic) { if (alphabetic.length() > ALPHABETIC_MAXSIZE) { throw new IllegalArgumentException("wrong size in alphabetic code : max size is " + ALPHABETIC_MAXSIZE); } obj = new DERPrintableString(alphabetic); } public boolean isAlphabetic() { return obj instanceof ASN1PrintableString; } public String getAlphabetic() { return ((ASN1PrintableString)obj).getString(); } public int getNumeric() { return ((ASN1Integer)obj).intValueExact(); } public ASN1Primitive toASN1Primitive() { return obj.toASN1Primitive(); } }
3e18e23c795290f93600b7a22eb277d0dc27977e
9,801
java
Java
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set8/light/Card8_047.java
stevetotheizz0/gemp-swccg-public
05529086de91ecb03807fda820d98ec8a1465246
[ "MIT" ]
19
2020-08-30T18:44:38.000Z
2022-02-10T18:23:49.000Z
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set8/light/Card8_047.java
stevetotheizz0/gemp-swccg-public
05529086de91ecb03807fda820d98ec8a1465246
[ "MIT" ]
480
2020-09-11T00:19:27.000Z
2022-03-31T19:46:37.000Z
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set8/light/Card8_047.java
stevetotheizz0/gemp-swccg-public
05529086de91ecb03807fda820d98ec8a1465246
[ "MIT" ]
21
2020-08-29T16:19:44.000Z
2022-03-29T01:37:39.000Z
64.058824
284
0.493827
10,585
package com.gempukku.swccgo.cards.set8.light; import com.gempukku.swccgo.cards.AbstractUsedInterrupt; import com.gempukku.swccgo.cards.GameConditions; import com.gempukku.swccgo.common.*; import com.gempukku.swccgo.filters.Filter; import com.gempukku.swccgo.filters.Filters; import com.gempukku.swccgo.game.PhysicalCard; import com.gempukku.swccgo.game.SwccgGame; import com.gempukku.swccgo.game.state.GameState; import com.gempukku.swccgo.logic.GameUtils; import com.gempukku.swccgo.logic.TriggerConditions; import com.gempukku.swccgo.logic.actions.PlayInterruptAction; import com.gempukku.swccgo.logic.effects.*; import com.gempukku.swccgo.logic.timing.Action; import com.gempukku.swccgo.logic.timing.EffectResult; import com.gempukku.swccgo.logic.timing.GuiUtils; import com.gempukku.swccgo.logic.timing.results.MovedResult; import com.gempukku.swccgo.logic.timing.results.PlayCardResult; import java.util.*; /** * Set: Endor * Type: Interrupt * Subtype: Used * Title: Ewok And Roll */ public class Card8_047 extends AbstractUsedInterrupt { public Card8_047() { super(Side.LIGHT, 5, "Ewok And Roll", Uniqueness.UNIQUE); setLore("Even an All Terrain Scout Transport cannot stand on all terrain."); setGameText("If opponent's creature vehicle or AT-ST just deployed or moved to where your Ewok is present, draw destiny. Creature vehicle lost if destiny > defense value. AT-ST crashed if destiny +2 > armor. OR If your Ewok is defending a battle, add 2 to your total power."); addIcons(Icon.ENDOR); } @Override protected List<PlayInterruptAction> getGameTextOptionalAfterActions(final String playerId, final SwccgGame game, EffectResult effectResult, final PhysicalCard self) { Filter vehicleFilter = Filters.and(Filters.opponents(self), Filters.or(Filters.and(Filters.creature_vehicle, Filters.canBeTargetedBy(self, TargetingReason.TO_BE_LOST)), Filters.and(Filters.AT_ST, Filters.canBeTargetedBy(self, TargetingReason.TO_BE_CRASHED)))); Filter locationFilter = Filters.wherePresent(self, Filters.and(Filters.your(self), Filters.Ewok)); // Check condition(s) Collection<PhysicalCard> vehicles = null; if (TriggerConditions.justDeployedTo(game, effectResult, vehicleFilter, locationFilter)) { vehicles = Collections.singletonList(((PlayCardResult) effectResult).getPlayedCard()); } else if (TriggerConditions.movedToLocation(game, effectResult, vehicleFilter, locationFilter)) { vehicles = Filters.filter(((MovedResult) effectResult).getMovedCards(), game, vehicleFilter); } if (vehicles != null && !vehicles.isEmpty()) { Map<TargetingReason, Filterable> targetFiltersMap = new HashMap<TargetingReason, Filterable>(); targetFiltersMap.put(TargetingReason.TO_BE_LOST, Filters.and(Filters.in(vehicles), Filters.creature_vehicle)); targetFiltersMap.put(TargetingReason.TO_BE_CRASHED, Filters.and(Filters.in(vehicles), Filters.AT_ST)); final PlayInterruptAction action = new PlayInterruptAction(game, self); action.setText("Target vehicle"); // Choose target(s) action.appendTargeting( new TargetCardOnTableEffect(action, playerId, "Choose vehicle", targetFiltersMap) { @Override protected void cardTargeted(final int targetGroupId, PhysicalCard cardTargeted) { action.addAnimationGroup(cardTargeted); String msgText = Filters.creature_vehicle.accepts(game, cardTargeted) ? ("Make " + GameUtils.getCardLink(cardTargeted) + " lost") : ("Crash " + GameUtils.getCardLink(cardTargeted)); // Allow response(s) action.allowResponses(msgText, new RespondablePlayCardEffect(action) { @Override protected void performActionResults(Action targetingAction) { // Get the targeted card(s) from the action using the targetGroupId. // This needs to be done in case the target(s) were changed during the responses. final PhysicalCard finalTarget = targetingAction.getPrimaryTargetCard(targetGroupId); // Perform result(s) action.appendEffect( new DrawDestinyEffect(action, playerId) { @Override protected Collection<PhysicalCard> getGameTextAbilityManeuverOrDefenseValueTargeted() { return Collections.singletonList(finalTarget); } @Override protected void destinyDraws(SwccgGame game, List<PhysicalCard> destinyCardDraws, List<Float> destinyDrawValues, Float totalDestiny) { GameState gameState = game.getGameState(); if (totalDestiny == null) { gameState.sendMessage("Result: Failed due to failed destiny draw"); return; } gameState.sendMessage("Destiny: " + GuiUtils.formatAsString(totalDestiny)); if (Filters.creature_vehicle.accepts(game, finalTarget)) { float defenseValue = game.getModifiersQuerying().getDefenseValue(game.getGameState(), finalTarget); gameState.sendMessage("Defense value: " + GuiUtils.formatAsString(defenseValue)); if (totalDestiny > defenseValue) { gameState.sendMessage("Result: Succeeded"); action.appendEffect( new LoseCardFromTableEffect(action, finalTarget)); } else { gameState.sendMessage("Result: Failed"); } } else { float armor = game.getModifiersQuerying().getArmor(game.getGameState(), finalTarget); gameState.sendMessage("Armor: " + GuiUtils.formatAsString(armor)); if ((totalDestiny + 2) > armor) { gameState.sendMessage("Result: Succeeded"); action.appendEffect( new CrashVehicleEffect(action, finalTarget, self)); } else { gameState.sendMessage("Result: Failed"); } } } } ); } } ); } } ); return Collections.singletonList(action); } return null; } @Override protected List<PlayInterruptAction> getGameTextTopLevelActions(final String playerId, SwccgGame game, final PhysicalCard self) { // Check condition(s) if (GameConditions.isDuringBattleWithParticipant(game, Filters.and(Filters.your(self), Filters.Ewok, Filters.defendingBattle))) { final PlayInterruptAction action = new PlayInterruptAction(game, self); action.setText("Add 2 to total power"); // Allow response(s) action.allowResponses( new RespondablePlayCardEffect(action) { @Override protected void performActionResults(Action targetingAction) { // Perform result(s) action.appendEffect( new ModifyTotalPowerUntilEndOfBattleEffect(action, 2, playerId, "Adds 2 to total power")); } } ); return Collections.singletonList(action); } return null; } }
3e18e31019f0f17b3062df19d4c500fb64d87594
627
java
Java
ExtractedJars/Health_com.huawei.health/javafiles/android/support/v7/app/NotificationCompat$DecoratedCustomViewStyle.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
3
2019-05-01T09:22:08.000Z
2019-07-06T22:21:59.000Z
ExtractedJars/Health_com.huawei.health/javafiles/android/support/v7/app/NotificationCompat$DecoratedCustomViewStyle.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
null
null
null
ExtractedJars/Health_com.huawei.health/javafiles/android/support/v7/app/NotificationCompat$DecoratedCustomViewStyle.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
1
2020-11-26T12:22:02.000Z
2020-11-26T12:22:02.000Z
29.857143
119
0.722488
10,586
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package android.support.v7.app; // Referenced classes of package android.support.v7.app: // NotificationCompat public static class NotificationCompat$DecoratedCustomViewStyle extends android.support.v4.app.NotificationCompat.Style { public NotificationCompat$DecoratedCustomViewStyle() { // 0 0:aload_0 // 1 1:invokespecial #11 <Method void android.support.v4.app.NotificationCompat$Style()> // 2 4:return } }
3e18e31924ab2e7df8c2894215ed8608720eb0b4
924
java
Java
identityManager/src/test/java/com/identity/manager/test/service/util/UserUtil.java
lavish8/IDM-Repository
eab63fd1893b26ba2f6a220fcdd613d4ce230bfa
[ "MIT" ]
null
null
null
identityManager/src/test/java/com/identity/manager/test/service/util/UserUtil.java
lavish8/IDM-Repository
eab63fd1893b26ba2f6a220fcdd613d4ce230bfa
[ "MIT" ]
10
2017-09-21T03:07:24.000Z
2018-06-27T09:03:20.000Z
identityManager/src/test/java/com/identity/manager/test/service/util/UserUtil.java
lavish8/IDM-Repository
eab63fd1893b26ba2f6a220fcdd613d4ce230bfa
[ "MIT" ]
null
null
null
28.875
110
0.672078
10,587
package com.identity.manager.test.service.util; import java.time.LocalDate; import com.identity.manager.web.domain.UserPojo; public class UserUtil { /** * Non instantiable. */ private UserUtil() { throw new AssertionError("Non instantiable"); } public static UserPojo createUser(String username, String email, String compnay) { UserPojo user = new UserPojo(); user.setLogin(username); user.setPassword("ax5kh6jaqkcd2tiexxs8v6xjo8yv8a6b"); user.setEmail(email); user.setCompany(compnay); user.setObsoleteDate(LocalDate.now()); user.setFirstName(email.split("@")[0].split("\\.")[0]); user.setLastName(email.split("@")[0].split("\\.").length > 1 ? email.split("@")[0].split("\\.")[1] : null); user.setPhoneNumber(1234567890); user.setCountry(email.split("@")[1].split("\\.")[1]); user.setDepartment("ICT"); user.setPassword("useme123"); return user; } }
3e18e31ef285b6263ebe3e7af672b52a13853edb
1,326
java
Java
src/main/java/org/xlrnet/datac/database/domain/QuickDeploymentResult.java
jhendess/datac
b1d44c1c1af2e8010612298e6e58c145706db1e2
[ "MIT" ]
1
2017-07-28T19:56:22.000Z
2017-07-28T19:56:22.000Z
src/main/java/org/xlrnet/datac/database/domain/QuickDeploymentResult.java
jhendess/datac
b1d44c1c1af2e8010612298e6e58c145706db1e2
[ "MIT" ]
null
null
null
src/main/java/org/xlrnet/datac/database/domain/QuickDeploymentResult.java
jhendess/datac
b1d44c1c1af2e8010612298e6e58c145706db1e2
[ "MIT" ]
null
null
null
33.15
150
0.762443
10,588
package org.xlrnet.datac.database.domain; import java.util.ArrayList; import java.util.List; import org.xlrnet.datac.database.util.DeploymentPhase; import lombok.Value; /** * Result status object of a quick deployment. */ @Value public class QuickDeploymentResult { /** The phase in which the deployment failed. */ private final DeploymentPhase phase; /** Flag whether the deployment was successful or not. */ private final boolean successful; /** Error message if the deployment wasn't successful. */ private final String errorMessage; /** List of all executed instance deployments. */ private final List<InstanceDeploymentResult> instanceDeploymentResultList; public static QuickDeploymentResult success(List<InstanceDeploymentResult> instanceDeploymentResults) { return new QuickDeploymentResult(null, true, null, instanceDeploymentResults); } public static QuickDeploymentResult failed(DeploymentPhase phase, String errorMessage, List<InstanceDeploymentResult> instanceDeploymentResults) { return new QuickDeploymentResult(phase, false, errorMessage, instanceDeploymentResults); } public static QuickDeploymentResult failed(DeploymentPhase phase, String errorMessage) { return failed(phase, errorMessage, new ArrayList<>()); } }
3e18e420ca9d20a3d8856cd4a3b18a0ccc742c1f
945
java
Java
src/main/java/fr/univnantes/termsuite/istex/json/SubjectDeserializer.java
termsuite/termsuite-istex
4514060078841be24e7fe9751616f0df4784bfe3
[ "Apache-2.0" ]
1
2018-10-17T21:08:28.000Z
2018-10-17T21:08:28.000Z
src/main/java/fr/univnantes/termsuite/istex/json/SubjectDeserializer.java
termsuite/termsuite-istex
4514060078841be24e7fe9751616f0df4784bfe3
[ "Apache-2.0" ]
1
2017-06-06T10:54:27.000Z
2017-06-06T13:27:48.000Z
src/main/java/fr/univnantes/termsuite/istex/json/SubjectDeserializer.java
termsuite/termsuite-istex
4514060078841be24e7fe9751616f0df4784bfe3
[ "Apache-2.0" ]
null
null
null
29.53125
122
0.750265
10,589
package fr.univnantes.termsuite.istex.json; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; public class SubjectDeserializer extends JsonDeserializer<List<String>> { @Override public List<String> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); List<String> subjects = new ArrayList<>(); for(int i = 0 ; i < node.size() ; i ++) { String next = node.get(i).get("value").asText(); subjects.add(next); } return subjects; } }
3e18e4fd5144e08b2f19a35d66bf95c481cb68e0
8,434
java
Java
src/test/java/com/aerospike/restclient/msgpack/BasicMsgPackOperationsTest.java
realmgic/aerospike-client-rest
e9d4b387cddd4a85335b3ab8290b897380f81ed6
[ "Apache-2.0" ]
13
2019-10-09T03:44:58.000Z
2021-11-16T13:37:16.000Z
src/test/java/com/aerospike/restclient/msgpack/BasicMsgPackOperationsTest.java
realmgic/aerospike-client-rest
e9d4b387cddd4a85335b3ab8290b897380f81ed6
[ "Apache-2.0" ]
6
2020-03-02T11:36:56.000Z
2021-11-16T23:42:51.000Z
src/test/java/com/aerospike/restclient/msgpack/BasicMsgPackOperationsTest.java
realmgic/aerospike-client-rest
e9d4b387cddd4a85335b3ab8290b897380f81ed6
[ "Apache-2.0" ]
7
2019-05-26T01:48:14.000Z
2022-01-05T05:18:17.000Z
32.817121
95
0.741048
10,590
/* * Copyright 2019 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0. * * 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.aerospike.restclient.msgpack; import static com.aerospike.restclient.util.AerospikeAPIConstants.OPERATION_FIELD; import static com.aerospike.restclient.util.AerospikeAPIConstants.OPERATION_VALUES_FIELD; import java.io.ByteArrayInputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.aerospike.restclient.util.AerospikeOperation; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.msgpack.core.MessageBufferPacker; import org.msgpack.core.MessagePack; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import com.aerospike.client.AerospikeClient; import com.aerospike.client.AerospikeException; import com.aerospike.client.Bin; import com.aerospike.client.Key; import com.aerospike.restclient.ASTestUtils; import com.aerospike.restclient.MsgPackOperationPerformer; import com.aerospike.restclient.util.AerospikeAPIConstants; import com.aerospike.restclient.util.deserializers.MsgPackBinParser; @RunWith(Parameterized.class) @SpringBootTest public class BasicMsgPackOperationsTest { @ClassRule public static final SpringClassRule springClassRule = new SpringClassRule(); @Rule public final SpringMethodRule springMethodRule = new SpringMethodRule(); @Autowired private AerospikeClient client; @Autowired private WebApplicationContext wac; private MsgPackOperationPerformer opPerformer = new MsgPackOperationPerformer(); private MockMvc mockMVC; private Key testKey; private String testEndpoint; @Parameters public static Object[] getParams() { return new Object[] { true, false }; } public BasicMsgPackOperationsTest(boolean useSet) { if (useSet) { testKey = new Key("test", "junit", "mpoperate"); testEndpoint = ASTestUtils.buildEndpoint("operate", "test", "junit", "mpoperate"); } else { testKey = new Key("test", null, "mpoperate"); testEndpoint = ASTestUtils.buildEndpoint("operate", "test", "mpoperate"); } } @Before public void setup() { mockMVC = MockMvcBuilders.webAppContextSetup(wac).build(); client.put(null, testKey, new Bin("a", "b")); } @After public void clean() { try { client.delete(null, testKey); } catch(AerospikeException e) { ; } } @SuppressWarnings("unchecked") @Test public void testGetWithNonJson() throws Exception { List<Map<String, Object>> opList = new ArrayList<Map<String, Object>>(); Map<String, Object> opMap = new HashMap<String, Object>(); Map<String, Object> opValues = new HashMap<String, Object>(); opMap.put(OPERATION_FIELD, AerospikeOperation.GET); opMap.put(OPERATION_VALUES_FIELD, opValues); opList.add(opMap); Map<Object, Object>imap = new HashMap<>(); imap.put(1l, "long"); Bin mb = new Bin("map", imap); client.put(null, testKey, new Bin("bytes", new byte[] {1,2,3}), mb); byte[] binBytes = opPerformer.performOperationsAndReturnRaw(mockMVC, testEndpoint, opList); MsgPackBinParser bParser = new MsgPackBinParser(new ByteArrayInputStream(binBytes)); Map<String, Object>retRec = bParser.parseBins(); Map<String, Object>opBins = (Map<String, Object>) retRec.get("bins"); Map<String, Object>realBins = client.get(null, testKey).bins; Assert.assertTrue(ASTestUtils.compareMapStringObj(opBins, realBins)); } @Test public void testPutIntMapKey() throws Exception { /* * [{OPERATION_FIELD:"PUT", OPERATION_VALUES_FIELD:{"bin":"new", "value":{1:2}}}] */ MessageBufferPacker packer = new MessagePack.PackerConfig().newBufferPacker(); packer.packArrayHeader(1); packer.packMapHeader(2); packer.packString(OPERATION_FIELD); packer.packString(AerospikeOperation.PUT.name()); packer.packString(OPERATION_VALUES_FIELD); packer.packMapHeader(2); packer.packString("bin"); packer.packString("new"); packer.packString("value"); packer.packMapHeader(1); packer.packLong(1); packer.packLong(2); byte[] opBytes = packer.toByteArray(); opPerformer.performOperationsAndReturnRaw(mockMVC, testEndpoint, opBytes); Map<String, Object>realBins = client.get(null, testKey).bins; @SuppressWarnings("unchecked") Map<Long, Long> expectedMap = (Map<Long, Long>) realBins.get("new"); Assert.assertEquals(expectedMap.size(), 1); Assert.assertEquals((Long)2l, expectedMap.get(1l)); } @Test public void testPutOpBytes() throws Exception { List<Map<String, Object>> opList = new ArrayList<Map<String, Object>>(); Map<String, Object> opMap = new HashMap<String, Object>(); Map<String, Object> opValues = new HashMap<String, Object>(); opValues.put("bin", "new"); opValues.put("value", new byte[] {1,2,3}); opMap.put(OPERATION_FIELD, AerospikeOperation.PUT.name()); opMap.put(OPERATION_VALUES_FIELD, opValues); opList.add(opMap); opPerformer.performOperationsAndReturn(mockMVC, testEndpoint, opList); Map<String, Object> expectedBins = new HashMap<String, Object>(); expectedBins.put("a", "b"); expectedBins.put("new", new byte[] {1,2,3}); Map<String, Object>realBins = client.get(null, testKey).bins; Assert.assertTrue(ASTestUtils.compareMapStringObj(expectedBins, realBins)); } @Test public void testAppendOp() throws Exception { /* * Append [4,5] to a bytearray of [1,2,3] and verify that the bin ends up having [1,2,3,4,5] */ client.put(null, testKey, new Bin("bytes", new byte[] {1,2,3})); List<Map<String, Object>> opList = new ArrayList<Map<String, Object>>(); Map<String, Object> opMap = new HashMap<String, Object>(); Map<String, Object> opValues = new HashMap<String, Object>(); opMap.put(OPERATION_FIELD, AerospikeOperation.APPEND.name()); opValues.put("value", new byte[] {4,5}); opValues.put("bin", "bytes"); opMap.put(OPERATION_VALUES_FIELD, opValues); opList.add(opMap); opPerformer.performOperationsAndReturn(mockMVC, testEndpoint, opList); Map<String, Object>realBins = client.get(null, testKey, "bytes").bins; byte[] realBytes = (byte[]) realBins.get("bytes"); Assert.assertArrayEquals(realBytes, new byte[] {1,2,3,4,5}); } // @Test public void testPrependOp() throws Exception { /* * Prepend [1,2] to a bytearray of [3,4,5] and verify that the bin ends up having [1,2,3,4,5] */ client.put(null, testKey, new Bin("bytes", new byte[] {3,4,5})); List<Map<String, Object>> opList = new ArrayList<Map<String, Object>>(); Map<String, Object> opMap = new HashMap<String, Object>(); Map<String, Object> opValues = new HashMap<String, Object>(); opMap.put(OPERATION_FIELD, AerospikeOperation.PREPEND.name()); opValues.put("value", new byte[] {1,2}); opValues.put("bin", "bytes"); opMap.put(OPERATION_VALUES_FIELD, opValues); opList.add(opMap); opPerformer.performOperationsAndReturn(mockMVC, testEndpoint, opList); /* Only read the str bin on the get*/ Map<String, Object> expectedBins = new HashMap<String, Object>(); expectedBins.put("str", "binary"); Map<String, Object>realBins = client.get(null, testKey, "bytes").bins; byte[] realBytes = (byte[]) realBins.get("bytes"); Assert.assertArrayEquals(realBytes, new byte[] {1,2,3,4,5}); } }
3e18e5089815d253283cc7106b69415fa7de21c4
3,028
java
Java
core/src/main/java/com/github/games647/lambdaattack/bot/listener/SessionListener116.java
pronze/LambdaAttack
75b8f169c8a44dd9f4b2dc7ac69a906505c402f3
[ "MIT" ]
null
null
null
core/src/main/java/com/github/games647/lambdaattack/bot/listener/SessionListener116.java
pronze/LambdaAttack
75b8f169c8a44dd9f4b2dc7ac69a906505c402f3
[ "MIT" ]
null
null
null
core/src/main/java/com/github/games647/lambdaattack/bot/listener/SessionListener116.java
pronze/LambdaAttack
75b8f169c8a44dd9f4b2dc7ac69a906505c402f3
[ "MIT" ]
1
2021-08-31T13:34:50.000Z
2021-08-31T13:34:50.000Z
48.063492
117
0.726222
10,591
package com.github.games647.lambdaattack.bot.listener; import com.github.games647.lambdaattack.LambdaAttack; import com.github.games647.lambdaattack.Options; import com.github.games647.lambdaattack.bot.Bot; import com.github.games647.lambdaattack.bot.EntitiyLocation; import com.github.steveice10.v1_16.packetlib.event.session.DisconnectedEvent; import com.github.steveice10.v1_16.mc.protocol.packet.ingame.server.ServerChatPacket; import com.github.steveice10.v1_16.mc.protocol.packet.ingame.server.ServerJoinGamePacket; import com.github.steveice10.v1_16.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket; import com.github.steveice10.v1_16.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; import com.github.steveice10.v1_16.packetlib.event.session.PacketReceivedEvent; import com.github.steveice10.v1_16.packetlib.event.session.SessionAdapter; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; import java.util.logging.Level; @RequiredArgsConstructor public class SessionListener116 extends SessionAdapter { protected final Options options; protected final Bot owner; @Override public void packetReceived(PacketReceivedEvent receiveEvent) { if (receiveEvent.getPacket() instanceof ServerChatPacket) { ServerChatPacket chatPacket = receiveEvent.getPacket(); // Message API was replaced in version 1.16 Component message = chatPacket.getMessage(); owner.getLogger().log(Level.INFO, "Received Message: {0}", message); } else if (receiveEvent.getPacket() instanceof ServerPlayerPositionRotationPacket) { ServerPlayerPositionRotationPacket posPacket = receiveEvent.getPacket(); double posX = posPacket.getX(); double posY = posPacket.getY(); double posZ = posPacket.getZ(); float pitch = posPacket.getPitch(); float yaw = posPacket.getYaw(); EntitiyLocation location = new EntitiyLocation(posX, posY, posZ, pitch, yaw); owner.setLocation(location); } else if (receiveEvent.getPacket() instanceof ServerPlayerHealthPacket) { ServerPlayerHealthPacket healthPacket = receiveEvent.getPacket(); owner.setHealth(healthPacket.getHealth()); owner.setFood(healthPacket.getFood()); } else if (receiveEvent.getPacket() instanceof ServerJoinGamePacket) { onJoin(); } } @Override public void disconnected(DisconnectedEvent disconnectedEvent) { String reason = disconnectedEvent.getReason(); owner.getLogger().log(Level.INFO, "Disconnected: {0}", reason); } public void onJoin() { if (options.autoRegister) { String password = LambdaAttack.PROJECT_NAME; owner.sendMessage(Bot.COMMAND_IDENTIFIER + "register " + password + ' ' + password); owner.sendMessage(Bot.COMMAND_IDENTIFIER + "login " + password); } } }
3e18e57cb243a0278ef45a61905f5458cf2afcb6
3,121
java
Java
tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java
cerker/camel
f5b73ce48ba8e5bf58495ad2dff0896d83bffa61
[ "Apache-2.0" ]
null
null
null
tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java
cerker/camel
f5b73ce48ba8e5bf58495ad2dff0896d83bffa61
[ "Apache-2.0" ]
null
null
null
tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java
cerker/camel
f5b73ce48ba8e5bf58495ad2dff0896d83bffa61
[ "Apache-2.0" ]
null
null
null
38.060976
125
0.64851
10,592
/** * 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.camel.itest.issues; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; /** * @version */ public class JettyHttpTest extends CamelTestSupport { private String targetProducerUri = "http://localhost:8542/someservice?bridgeEndpoint=true&throwExceptionOnFailure=false"; private String targetConsumerUri = "jetty:http://localhost:8542/someservice?matchOnUriPrefix=true"; private String sourceUri = "jetty:http://localhost:6323/myservice?matchOnUriPrefix=true"; private String sourceProducerUri = "http://localhost:6323/myservice"; @Test public void testGetRootPath() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedBodiesReceived("Hi! /someservice"); template.sendBody("direct:root", ""); assertMockEndpointsSatisfied(); } @Test public void testGetWithRelativePath() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedBodiesReceived("Hi! /someservice/relative"); template.sendBody("direct:relative", ""); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from(targetConsumerUri) .process(new Processor() { public void process(Exchange exchange) throws Exception { String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class); exchange.getOut().setBody("Hi! " + path); } }); from(sourceUri) .to(targetProducerUri); from("direct:root") .to(sourceProducerUri) .to("mock:result"); from("direct:relative") .to(sourceProducerUri + "/relative") .to("mock:result"); } }; } }
3e18e616cebe746ac5e3e58f01ad8df717ed41e1
5,905
java
Java
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
iuliana/brooklyn-server
ef50143e52bd92ad56d57716f2a5bdaeda97452e
[ "Apache-2.0" ]
46
2016-02-02T19:37:30.000Z
2022-03-14T07:47:24.000Z
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
iuliana/brooklyn-server
ef50143e52bd92ad56d57716f2a5bdaeda97452e
[ "Apache-2.0" ]
1,014
2016-02-03T10:56:46.000Z
2022-02-18T13:37:49.000Z
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
kemitix/brooklyn-server
0f54b40871141d43a0c078546b393e228de9e229
[ "Apache-2.0" ]
78
2016-02-01T22:10:47.000Z
2022-02-16T12:18:54.000Z
51.798246
682
0.724301
10,593
/* * 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.brooklyn.camp.brooklyn; import static org.testng.Assert.assertEquals; import java.util.Map; import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.camp.brooklyn.AbstractJcloudsStubYamlTest.ByonComputeServiceStaticRef; import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer; import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts; import org.apache.brooklyn.entity.machine.MachineEntity; import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry; import org.apache.brooklyn.location.jclouds.JcloudsLocation; import org.apache.brooklyn.location.jclouds.JcloudsMachineLocation; import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool; import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd; import org.testng.annotations.Test; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; /** * This is primarily to test https://issues.apache.org/jira/browse/BROOKLYN-349. * It confirms that entity "provisioning.properties" get passed through to the machine. * * It could do with some cleanup at some point: * <ul> * <li>There is an NPE at AddMachineMetrics$2.apply(AddMachineMetrics.java:111), despite having set * "metrics.usage.retrieve: false". Perhaps even with that set it will poll once before being disabled?! * <li>When "stopping" the dummy machine, it fails when executing commands against the real SoftLayer: * <pre> * 2016-09-21 17:49:22,776 ERROR Cannot retry after server error, command has exceeded retry limit 5: [method=org.jclouds.softlayer.features.VirtualGuestApi.public abstract org.jclouds.softlayer.domain.VirtualGuest org.jclouds.softlayer.features.VirtualGuestApi.getVirtualGuest(long)[123], request=GET https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/123/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences%3BprivateNetworkOnlyFlag%3BsshKeys HTTP/1.1] * </pre> * Presumably we need to stub out that call as well somehow! * </ul> */ @Test public class JcloudsRebindWithYamlDslTest extends AbstractJcloudsRebindStubYamlTest { protected Entity origApp; @Override protected JcloudsLocation newJcloudsLocation(ComputeServiceRegistry computeServiceRegistry) throws Exception { ByonComputeServiceStaticRef.setInstance(computeServiceRegistry); String symbolicName = "my.catalog.app.id.load"; String catalogYaml = Joiner.on("\n").join( "brooklyn.catalog:", " id: " + symbolicName, " version: \"0.1.2\"", " itemType: entity", " item:", " brooklyn.parameters:", " - name: password", " default: myYamlPassword", " type: "+ MachineEntity.class.getName()); mgmt().getCatalog().addItems(catalogYaml, true, true); String yaml = Joiner.on("\n").join( "location: " + LOCATION_CATALOG_ID, "services:\n"+ "- type: "+symbolicName, " brooklyn.config:", " onbox.base.dir.skipResolution: true", " sshMonitoring.enabled: false", " metrics.usage.retrieve: false", " provisioning.properties:", " password: $brooklyn:config(\"password\")"); EntitySpec<?> spec = mgmt().getTypeRegistry().createSpecFromPlan(CampTypePlanTransformer.FORMAT, yaml, RegisteredTypeLoadingContexts.spec(Application.class), EntitySpec.class); origApp = mgmt().getEntityManager().createEntity(spec); return (JcloudsLocation) Iterables.getOnlyElement(origApp.getLocations()); } @Override protected JcloudsMachineLocation obtainMachine(JcloudsLocation jcloudsLoc, Map<?,?> props) throws Exception { final MachineEntity entity = (MachineEntity) Iterables.getOnlyElement(origApp.getChildren()); origApp.invoke(Startable.START, ImmutableMap.<String, Object>of()).get(); // Execute ssh (with RecordingSshTool), and confirm was given resolved password entity.execCommand("mycmd"); Map<?, ?> constructorProps = RecordingSshTool.getLastConstructorProps(); ExecCmd execCmd = RecordingSshTool.getLastExecCmd(); assertEquals(constructorProps.get("password"), "myYamlPassword", "constructorProps: "+constructorProps+"; execProps: "+execCmd.props); return Machines.findUniqueMachineLocation(entity.getLocations(), JcloudsMachineLocation.class).get(); } }
3e18e6e486d5cf9fabd2033733601eb9bf23b17d
953
java
Java
src/main/java/org/learncraft/configuration/assignment/Assignment.java
TorchPowered/LearnCraft
bd79c186289a47f1a9266771e409bc53e7924808
[ "MIT" ]
null
null
null
src/main/java/org/learncraft/configuration/assignment/Assignment.java
TorchPowered/LearnCraft
bd79c186289a47f1a9266771e409bc53e7924808
[ "MIT" ]
null
null
null
src/main/java/org/learncraft/configuration/assignment/Assignment.java
TorchPowered/LearnCraft
bd79c186289a47f1a9266771e409bc53e7924808
[ "MIT" ]
null
null
null
20.276596
66
0.643232
10,594
package org.learncraft.configuration.assignment; import java.io.Serializable; import java.util.Date; /** * Represents a LearnCraft assignment. * * @since 1.0-SNAPSHOT * @author Open-source contributors to LearnCraft */ public class Assignment implements Serializable { private Date due; private String name; private String description; public Assignment(String name, String description, Date due) { this.name = name; this.description = description; this.due = due; } public Date getDueDate() { return due; } public String getDescription() { return description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setDueDate(Date date) { this.due = date; } public void setDescription(String description) { this.description = description; } }
3e18e6ec8bbf148ba70497a5f96b5d1976e64fd1
2,734
java
Java
plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/decoders/DoubleDecoder.java
grantatspothero/trino
7c34f5a7a9235f7434696c8da84f55dff48521ee
[ "Apache-2.0" ]
3,603
2020-12-27T23:06:56.000Z
2022-03-31T22:17:28.000Z
plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/decoders/DoubleDecoder.java
grantatspothero/trino
7c34f5a7a9235f7434696c8da84f55dff48521ee
[ "Apache-2.0" ]
4,315
2020-12-28T00:55:19.000Z
2022-03-31T23:55:11.000Z
plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/decoders/DoubleDecoder.java
grantatspothero/trino
7c34f5a7a9235f7434696c8da84f55dff48521ee
[ "Apache-2.0" ]
954
2020-12-28T02:03:33.000Z
2022-03-31T14:21:35.000Z
29.717391
172
0.648135
10,595
/* * 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 io.trino.plugin.elasticsearch.decoders; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import io.trino.plugin.elasticsearch.DecoderDescriptor; import io.trino.spi.TrinoException; import io.trino.spi.block.BlockBuilder; import org.elasticsearch.search.SearchHit; import java.util.function.Supplier; import static io.trino.spi.StandardErrorCode.TYPE_MISMATCH; import static io.trino.spi.type.DoubleType.DOUBLE; import static java.lang.String.format; import static java.util.Objects.requireNonNull; public class DoubleDecoder implements Decoder { private final String path; public DoubleDecoder(String path) { this.path = requireNonNull(path, "path is null"); } @Override public void decode(SearchHit hit, Supplier<Object> getter, BlockBuilder output) { Object value = getter.get(); if (value == null) { output.appendNull(); return; } double decoded; if (value instanceof Number) { decoded = ((Number) value).doubleValue(); } else if (value instanceof String) { try { decoded = Double.parseDouble((String) value); } catch (NumberFormatException e) { throw new TrinoException(TYPE_MISMATCH, format("Cannot parse value for field '%s' as DOUBLE: %s", path, value)); } } else { throw new TrinoException(TYPE_MISMATCH, format("Expected a numeric value for field %s of type DOUBLE: %s [%s]", path, value, value.getClass().getSimpleName())); } DOUBLE.writeDouble(output, decoded); } public static class Descriptor implements DecoderDescriptor { private final String path; @JsonCreator public Descriptor(String path) { this.path = path; } @JsonProperty public String getPath() { return path; } @Override public Decoder createDecoder() { return new DoubleDecoder(path); } } }
3e18e7867b0b85d3634588a1893f715a4ed6c44b
3,040
java
Java
min-dataset/train/zest/org.eclipse.zest.dot.export/src/org/eclipse/zest/internal/dot/DotDrawer.java
giganticode/icse-2020
80235ada6a02273e7062f159a6ee34c99178a5ab
[ "Apache-2.0" ]
2
2020-12-14T19:10:37.000Z
2022-01-21T10:54:35.000Z
min-dataset/train/zest/org.eclipse.zest.dot.export/src/org/eclipse/zest/internal/dot/DotDrawer.java
giganticode/icse-2020
80235ada6a02273e7062f159a6ee34c99178a5ab
[ "Apache-2.0" ]
6
2020-01-28T23:16:34.000Z
2022-02-10T00:44:45.000Z
min-dataset/train/zest/org.eclipse.zest.dot.export/src/org/eclipse/zest/internal/dot/DotDrawer.java
giganticode/icse-2020
80235ada6a02273e7062f159a6ee34c99178a5ab
[ "Apache-2.0" ]
null
null
null
34.942529
110
0.645066
10,596
/******************************************************************************* * Copyright (c) 2009, 2010 Fabian Steeg. All rights reserved. This program and * the accompanying materials are made available under the terms of the Eclipse * Public License v1.0 which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * <p/> * Contributors: Fabian Steeg - initial API and implementation; see bug 277380 *******************************************************************************/ package org.eclipse.zest.internal.dot; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; /** * Class for drawing dot graphs by calling the dot executable. * * @author Fabian Steeg (fsteeg) */ final class DotDrawer { private DotDrawer() {/* Enforce non-instantiability */ } static File renderImage(final File dotExecutableDir, final File dotInputFile, final String format, final String imageResultFile) { String outputFormat = "-T" + format; //$NON-NLS-1$ String resultFile = imageResultFile == null ? dotInputFile.getName() + "." + format : imageResultFile; //$NON-NLS-1$ String dotFile = dotInputFile.getName(); String inputFolder = new File(dotInputFile.getParent()) .getAbsolutePath() + File.separator; String outputFolder = imageResultFile == null ? inputFolder : new File( new File(imageResultFile).getAbsolutePath()).getParentFile() .getAbsolutePath() + File.separator; String dotExecutable = "dot" + (runningOnWindows() ? ".exe" : ""); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ String[] commands = new String[] { dotExecutableDir.getAbsolutePath() + File.separator + dotExecutable, outputFormat, "-o", //$NON-NLS-1$ outputFolder + resultFile, inputFolder + dotFile }; call(commands); return new File(outputFolder, resultFile); } private static void call(final String[] commands) { System.out.print("Calling: " + Arrays.asList(commands)); //$NON-NLS-1$ Runtime runtime = Runtime.getRuntime(); Process p = null; try { p = runtime.exec(commands); p.waitFor(); } catch (Exception x) { x.printStackTrace(); } System.out .println(", " + "resulted in exit status" + ": " + p.exitValue()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ String errors = read(p.getErrorStream()); String output = read(p.getInputStream()); if (errors.trim().length() > 0) { System.err.println("Errors from dot call: " + errors); } if (output.trim().length() > 0) { System.out.println("Output from dot call: " + output); } } private static String read(InputStream s) { StringBuilder builder = new StringBuilder(); try { int current = -1; while ((current = s.read()) != -1) { builder.append((char) current); } } catch (IOException e) { e.printStackTrace(); } return builder.toString(); } private static boolean runningOnWindows() { return System.getProperty("os.name").toLowerCase().contains("win"); //$NON-NLS-1$//$NON-NLS-2$ } }
3e18e888db74740c6030fab75e467374c08ed097
1,689
java
Java
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java
cat0501/ruoyi-vue-pro
724827905ad94c52da30ece9c1aa3b10fad13f43
[ "MIT" ]
1
2022-03-20T03:37:19.000Z
2022-03-20T03:37:19.000Z
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java
cat0501/ruoyi-vue-pro
724827905ad94c52da30ece9c1aa3b10fad13f43
[ "MIT" ]
1
2022-03-31T08:49:38.000Z
2022-03-31T08:49:38.000Z
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java
cat0501/ruoyi-vue-pro
724827905ad94c52da30ece9c1aa3b10fad13f43
[ "MIT" ]
null
null
null
27.241935
109
0.656602
10,597
package cn.iocoder.yudao.framework.file.core.client.sftp; import cn.hutool.core.io.FileUtil; import cn.hutool.extra.ssh.Sftp; import cn.iocoder.yudao.framework.common.util.io.FileUtils; import cn.iocoder.yudao.framework.file.core.client.AbstractFileClient; import java.io.File; /** * Sftp 文件客户端 * * @author 芋道源码 */ public class SftpFileClient extends AbstractFileClient<SftpFileClientConfig> { private Sftp sftp; public SftpFileClient(Long id, SftpFileClientConfig config) { super(id, config); } @Override protected void doInit() { // 补全风格。例如说 Linux 是 /,Windows 是 \ if (!config.getBasePath().endsWith(File.separator)) { config.setBasePath(config.getBasePath() + File.separator); } // 初始化 Ftp 对象 this.sftp = new Sftp(config.getHost(), config.getPort(), config.getUsername(), config.getPassword()); } @Override public String upload(byte[] content, String path) { // 执行写入 String filePath = getFilePath(path); File file = FileUtils.createTempFile(content); sftp.upload(filePath, file); // 拼接返回路径 return super.formatFileUrl(config.getDomain(), path); } @Override public void delete(String path) { String filePath = getFilePath(path); sftp.delFile(filePath); } @Override public byte[] getContent(String path) { String filePath = getFilePath(path); File destFile = FileUtils.createTempFile(); sftp.download(filePath, destFile); return FileUtil.readBytes(destFile); } private String getFilePath(String path) { return config.getBasePath() + path; } }
3e18e8c653561a53ccc9daac07c3dbf2f9cfe570
8,832
java
Java
aws-java-sdk-codecommit/src/main/java/com/amazonaws/services/codecommit/model/BatchDisassociateApprovalRuleTemplateFromRepositoriesError.java
ericvincent83/aws-sdk-java
c491416f3ea9411a04d9bafedee6c6874a79e48d
[ "Apache-2.0" ]
3,372
2015-01-03T00:35:43.000Z
2022-03-31T15:56:24.000Z
aws-java-sdk-codecommit/src/main/java/com/amazonaws/services/codecommit/model/BatchDisassociateApprovalRuleTemplateFromRepositoriesError.java
ericvincent83/aws-sdk-java
c491416f3ea9411a04d9bafedee6c6874a79e48d
[ "Apache-2.0" ]
2,391
2015-01-01T12:55:24.000Z
2022-03-31T08:01:50.000Z
aws-java-sdk-codecommit/src/main/java/com/amazonaws/services/codecommit/model/BatchDisassociateApprovalRuleTemplateFromRepositoriesError.java
ericvincent83/aws-sdk-java
c491416f3ea9411a04d9bafedee6c6874a79e48d
[ "Apache-2.0" ]
2,876
2015-01-01T14:38:37.000Z
2022-03-29T19:53:10.000Z
36.04898
155
0.659307
10,598
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.codecommit.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Returns information about errors in a BatchDisassociateApprovalRuleTemplateFromRepositories operation. * </p> * * @see <a * href="http://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchDisassociateApprovalRuleTemplateFromRepositoriesError" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class BatchDisassociateApprovalRuleTemplateFromRepositoriesError implements Serializable, Cloneable, StructuredPojo { /** * <p> * The name of the repository where the association with the template was not able to be removed. * </p> */ private String repositoryName; /** * <p> * An error code that specifies whether the repository name was not valid or not found. * </p> */ private String errorCode; /** * <p> * An error message that provides details about why the repository name was either not found or not valid. * </p> */ private String errorMessage; /** * <p> * The name of the repository where the association with the template was not able to be removed. * </p> * * @param repositoryName * The name of the repository where the association with the template was not able to be removed. */ public void setRepositoryName(String repositoryName) { this.repositoryName = repositoryName; } /** * <p> * The name of the repository where the association with the template was not able to be removed. * </p> * * @return The name of the repository where the association with the template was not able to be removed. */ public String getRepositoryName() { return this.repositoryName; } /** * <p> * The name of the repository where the association with the template was not able to be removed. * </p> * * @param repositoryName * The name of the repository where the association with the template was not able to be removed. * @return Returns a reference to this object so that method calls can be chained together. */ public BatchDisassociateApprovalRuleTemplateFromRepositoriesError withRepositoryName(String repositoryName) { setRepositoryName(repositoryName); return this; } /** * <p> * An error code that specifies whether the repository name was not valid or not found. * </p> * * @param errorCode * An error code that specifies whether the repository name was not valid or not found. */ public void setErrorCode(String errorCode) { this.errorCode = errorCode; } /** * <p> * An error code that specifies whether the repository name was not valid or not found. * </p> * * @return An error code that specifies whether the repository name was not valid or not found. */ public String getErrorCode() { return this.errorCode; } /** * <p> * An error code that specifies whether the repository name was not valid or not found. * </p> * * @param errorCode * An error code that specifies whether the repository name was not valid or not found. * @return Returns a reference to this object so that method calls can be chained together. */ public BatchDisassociateApprovalRuleTemplateFromRepositoriesError withErrorCode(String errorCode) { setErrorCode(errorCode); return this; } /** * <p> * An error message that provides details about why the repository name was either not found or not valid. * </p> * * @param errorMessage * An error message that provides details about why the repository name was either not found or not valid. */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } /** * <p> * An error message that provides details about why the repository name was either not found or not valid. * </p> * * @return An error message that provides details about why the repository name was either not found or not valid. */ public String getErrorMessage() { return this.errorMessage; } /** * <p> * An error message that provides details about why the repository name was either not found or not valid. * </p> * * @param errorMessage * An error message that provides details about why the repository name was either not found or not valid. * @return Returns a reference to this object so that method calls can be chained together. */ public BatchDisassociateApprovalRuleTemplateFromRepositoriesError withErrorMessage(String errorMessage) { setErrorMessage(errorMessage); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRepositoryName() != null) sb.append("RepositoryName: ").append(getRepositoryName()).append(","); if (getErrorCode() != null) sb.append("ErrorCode: ").append(getErrorCode()).append(","); if (getErrorMessage() != null) sb.append("ErrorMessage: ").append(getErrorMessage()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof BatchDisassociateApprovalRuleTemplateFromRepositoriesError == false) return false; BatchDisassociateApprovalRuleTemplateFromRepositoriesError other = (BatchDisassociateApprovalRuleTemplateFromRepositoriesError) obj; if (other.getRepositoryName() == null ^ this.getRepositoryName() == null) return false; if (other.getRepositoryName() != null && other.getRepositoryName().equals(this.getRepositoryName()) == false) return false; if (other.getErrorCode() == null ^ this.getErrorCode() == null) return false; if (other.getErrorCode() != null && other.getErrorCode().equals(this.getErrorCode()) == false) return false; if (other.getErrorMessage() == null ^ this.getErrorMessage() == null) return false; if (other.getErrorMessage() != null && other.getErrorMessage().equals(this.getErrorMessage()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRepositoryName() == null) ? 0 : getRepositoryName().hashCode()); hashCode = prime * hashCode + ((getErrorCode() == null) ? 0 : getErrorCode().hashCode()); hashCode = prime * hashCode + ((getErrorMessage() == null) ? 0 : getErrorMessage().hashCode()); return hashCode; } @Override public BatchDisassociateApprovalRuleTemplateFromRepositoriesError clone() { try { return (BatchDisassociateApprovalRuleTemplateFromRepositoriesError) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.codecommit.model.transform.BatchDisassociateApprovalRuleTemplateFromRepositoriesErrorMarshaller.getInstance().marshall(this, protocolMarshaller); } }
3e18e93c022bbab4f6deda241cc1927e6de4cbd4
10,427
java
Java
src/main/java/cert/aiops/pega/masterExecutors/Master.java
mangBaobao/WechatSogou
c275b31fe1e659d747a62c06da93389821943d0a
[ "Apache-2.0" ]
null
null
null
src/main/java/cert/aiops/pega/masterExecutors/Master.java
mangBaobao/WechatSogou
c275b31fe1e659d747a62c06da93389821943d0a
[ "Apache-2.0" ]
null
null
null
src/main/java/cert/aiops/pega/masterExecutors/Master.java
mangBaobao/WechatSogou
c275b31fe1e659d747a62c06da93389821943d0a
[ "Apache-2.0" ]
null
null
null
41.875502
179
0.659634
10,599
package cert.aiops.pega.masterExecutors; import cert.aiops.pega.channels.ChannelManager; import cert.aiops.pega.registratedHostManagement.RegisteredHostManager; import cert.aiops.pega.util.PegaEnum; import cert.aiops.pega.bean.SystemInfo; import cert.aiops.pega.config.PegaConfiguration; import cert.aiops.pega.innerService.HostInfoService; import cert.aiops.pega.innerService.SystemInfoService; import cert.aiops.pega.startup.BeingMasterCondition; import cert.aiops.pega.synchronization.Synchronizer; import cert.aiops.pega.util.SpringContextUtil; import cert.aiops.pega.util.ZookeeperUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Component @Conditional(value = {BeingMasterCondition.class}) public class Master { private Logger logger = LoggerFactory.getLogger(Master.class); @Autowired PegaConfiguration pegaConfiguration; @Autowired private Synchronizer synchronizer; private PegaEnum.NodeRole role; private long epoch; private String id; private MasterPathChildrenCacheListener workersListener; private ArrayList<SystemInfo> systemInfos; @Autowired private MappingManager mappingManager; @Autowired private MessageQueueManager messageQueueManager; @Autowired private RegisteredHostManager registeredHostManager; @Autowired private ChannelManager channelManager; MappingManager getMappingManager() { return mappingManager; } public Master() { workersListener = new MasterPathChildrenCacheListener(); systemInfos = new ArrayList<>(); } public void init(PegaEnum.State state, String[] systemNames) { id = pegaConfiguration.getId(); establishIdentity(); if (role == PegaEnum.NodeRole.online) { initNodesInZKTree(); initializeEpoch(); initializeSystemInfos(state, systemNames); constructSystemsTree(); mappingManager.setSystemInfos(systemInfos); mappingManager.initAllMappings(); messageQueueManager.updateQueueStatus(); channelManager.init(); registeredHostManager.firstPublishIdentification(); } } private void initNodesInZKTree() { boolean ifExists = ZookeeperUtil.getInstance().checkExists(pegaConfiguration.getWorkerPath()); if (!ifExists) { String result = ZookeeperUtil.getInstance().createPersistenceNodeWithoutValue(pegaConfiguration.getWorkerPath()); if (result == null) { logger.error("Master initNodesInZKTree fail:path={};reason=null", pegaConfiguration.getWorkerPath()); System.exit(0); } } ifExists = ZookeeperUtil.getInstance().checkExists(pegaConfiguration.getMappingPath()); if (!ifExists) { String result = ZookeeperUtil.getInstance().createPersistenceNodeWithoutValue(pegaConfiguration.getMappingPath()); if (result == null) { logger.error("Master initNodesInZKTree fail: createPersistenceNodeWithoutValue fail: path:{}", pegaConfiguration.getMappingPath()); System.exit(0); } } ifExists = ZookeeperUtil.getInstance().checkExists(pegaConfiguration.getSystemPath()); if (!ifExists) { String base = ZookeeperUtil.getInstance().createPersistenceNodeWithoutValue(pegaConfiguration.getSystemPath()); if (base == null) { logger.error("Master_constructHostZKTree fail: createPersistenceNodeWithoutValue fail: path:{}", pegaConfiguration.getSystemPath()); System.exit(0); } } } public String getId() { return id; } private boolean becomeOnline() { // String nodePath=ZookeeperUtil.getInstance().concatPath(pegaConfiguration.getControllerPath(),id); String result = ZookeeperUtil.getInstance().createEphemeralNode(pegaConfiguration.getControllerPath(), id); if (result != null) { role = PegaEnum.NodeRole.online; pegaConfiguration.setRole(String.valueOf(role)); logger.info("Master_establishIdentity: id ({}) becomes online,path={}", id,pegaConfiguration.getControllerPath()); return true; } return false; } private void establishIdentity() { boolean ifMasterExists = ZookeeperUtil.getInstance().checkExists(pegaConfiguration.getControllerPath()); if (!ifMasterExists) { boolean success = becomeOnline(); if (!success) { logger.info("Master_establishIdentity: success={}. System is going to exit", success); System.exit(0); } } else { String masterId = ZookeeperUtil.getInstance().getData(pegaConfiguration.getControllerPath()); if (masterId.equals(id)) { role = PegaEnum.NodeRole.online; pegaConfiguration.setRole(String.valueOf(role)); logger.info("Master_establishIdentity: id ({}) becomes online", id); } else { logger.info("Master_establishIdentity: id={} exists but not equal to self id ={}. System is going to exit", id, masterId); System.exit(0); } } } public SystemInfo getSystemInfoByName(String systemName) { for (SystemInfo info : systemInfos) { if (info.getSystemName().equals(systemName)) return info; } return null; } public long getEpoch() { return epoch; } public ArrayList<SystemInfo> getSystemInfos() { return systemInfos; } private void initializeEpoch() { boolean ifEpochExist = ZookeeperUtil.getInstance().checkExists(pegaConfiguration.getRoutineEpochPath()); if (!ifEpochExist) { epoch = 0; ZookeeperUtil.getInstance().createPersistenceNode(pegaConfiguration.getRoutineEpochPath(), String.valueOf(epoch)); } else epoch = Long.valueOf(ZookeeperUtil.getInstance().getData(pegaConfiguration.getRoutineEpochPath())); logger.info("Master_initializeEpoch: id={} successfully create epoch node in zkTree", pegaConfiguration.getRoutineEpochPath()); } void updateEpoch() { epoch++; ZookeeperUtil.getInstance().setData(pegaConfiguration.getRoutineEpochPath(), String.valueOf(epoch)); logger.info("updateEpoch: finishes updating epoch to {}", epoch); } private void initializeSystemInfos(PegaEnum.State state, String[] systemNames) { SystemInfoService systemInfoService = SpringContextUtil.getBean(SystemInfoService.class); ArrayList<SystemInfo> synchronizedInfos = new ArrayList<>(); systemInfos = systemInfoService.getAllSystemInfos(); // if (systemInfos.size() == 0) { if (systemNames == null || systemNames.length == 0) synchronizedInfos.addAll(synchronizer.syncSystemsByState(state.toString())); else { for (String systemName : systemNames) { SystemInfo info = synchronizer.syncSystemByName(state.toString(), systemName); if (info == null) continue; if (info.getHosts() != null) synchronizedInfos.add(info); } } ArrayList<SystemInfo> duplicatedSystemInfos=new ArrayList<>(); for(int i =0;i<synchronizedInfos.size();i++){ long id=synchronizedInfos.get(i).getId(); for(int j=0;j<systemInfos.size();j++){ long id_db=systemInfos.get(j).getId(); if(id==id_db){ logger.info("Master_initializeSystemInfos: find duplicated system id={}, name={}, delete from synchronized infos",id, synchronizedInfos.get(i).getSystemName()); duplicatedSystemInfos.add(synchronizedInfos.get(i)); } } } synchronizedInfos.removeAll(duplicatedSystemInfos); //store systeminfo and hostinfo to db HostInfoService hostInfoService = SpringContextUtil.getBean(HostInfoService.class); for (SystemInfo info : synchronizedInfos) { systemInfoService.addSystem(info); hostInfoService.addHostInfoList(info.getHosts()); } //} systemInfos.addAll(synchronizedInfos); } /** * todo increamental synchronization with jczy */ // private ArrayList<SystemInfo> mergeSystemInfosWithSynchronization(ArrayList<SystemInfo> synchronizedInfos){ // if (systemInfos == null) // return synchronizedInfos; // // if // } /** * input arraylist<systeminfo> pojos, and maps them into zk tree as /systems/sys1/hostIp, * where sys1 records total number of hosts, and host records host name and host state etc. */ private void constructSystemsTree() { // boolean ifExists=ZookeeperUtil.getInstance().checkExists(pegaConfiguration.getSystemPath()); // if(ifExists==false) // ObjectMapper mapper = new ObjectMapper(); ZookeeperUtil.getInstance().createPersistenceNodeWithoutValue(pegaConfiguration.getSystemPath()); ZookeeperUtil.getInstance().setData(pegaConfiguration.getSystemPath(), String.valueOf(systemInfos.size())); List<String> children = ZookeeperUtil.getInstance().getChildren(pegaConfiguration.getSystemPath()); if (children == null) { children = new ArrayList<>(); } for (SystemInfo systemInfo : systemInfos) { if (children.contains(String.valueOf(systemInfo.getId()))) continue; // if (systemInfo.getHostCount() != 0) { String parentPath = ZookeeperUtil.getInstance().concatPath(pegaConfiguration.getSystemPath(), String.valueOf(systemInfo.getId())); String result = ZookeeperUtil.getInstance().createPersistenceNode(parentPath, ""); if (result == null) { logger.error("Master_constructSystemTree fail: createPersistenceNodeWithoutValue fail: path:{}", parentPath); System.exit(0); } // } } } }
3e18e98e9bcb00514c7f43f9c7a58ce9f9a2d928
895
java
Java
shop-scm-dao/src/main/java/com/ele/me/shop/mapper/TbAddressMapper.java
IflytekBrain/distributed-shop
b430c3f0b6f214e5ac808b5d57431d2ec7f792ff
[ "Apache-2.0" ]
null
null
null
shop-scm-dao/src/main/java/com/ele/me/shop/mapper/TbAddressMapper.java
IflytekBrain/distributed-shop
b430c3f0b6f214e5ac808b5d57431d2ec7f792ff
[ "Apache-2.0" ]
null
null
null
shop-scm-dao/src/main/java/com/ele/me/shop/mapper/TbAddressMapper.java
IflytekBrain/distributed-shop
b430c3f0b6f214e5ac808b5d57431d2ec7f792ff
[ "Apache-2.0" ]
null
null
null
27.96875
116
0.768715
10,600
package com.ele.me.shop.mapper; import com.ele.me.shop.pojo.domain.TbAddress; import com.ele.me.shop.pojo.domain.TbAddressExample; import org.apache.ibatis.annotations.Param; import java.util.List; public interface TbAddressMapper { int countByExample(TbAddressExample example); int deleteByExample(TbAddressExample example); int deleteByPrimaryKey(Long id); int insert(TbAddress record); int insertSelective(TbAddress record); List<TbAddress> selectByExample(TbAddressExample example); TbAddress selectByPrimaryKey(Long id); int updateByExampleSelective(@Param( "record" ) TbAddress record, @Param( "example" ) TbAddressExample example); int updateByExample(@Param( "record" ) TbAddress record, @Param( "example" ) TbAddressExample example); int updateByPrimaryKeySelective(TbAddress record); int updateByPrimaryKey(TbAddress record); }
3e18ea4ba9c95f0b05ba96a79aa29bb5bf58c541
26,337
java
Java
Branch/app/src/main/java/com/jx/intelligent/view/AutoScrollLoopViewPager.java
enjoyWindWorld/jx_app_android
0d5fb26cf3f9f276565d022a9b422940dbcca4ba
[ "MIT" ]
null
null
null
Branch/app/src/main/java/com/jx/intelligent/view/AutoScrollLoopViewPager.java
enjoyWindWorld/jx_app_android
0d5fb26cf3f9f276565d022a9b422940dbcca4ba
[ "MIT" ]
null
null
null
Branch/app/src/main/java/com/jx/intelligent/view/AutoScrollLoopViewPager.java
enjoyWindWorld/jx_app_android
0d5fb26cf3f9f276565d022a9b422940dbcca4ba
[ "MIT" ]
null
null
null
31.846433
133
0.575198
10,601
package com.jx.intelligent.view; import android.content.Context; import android.os.Handler; import android.os.Message; import android.os.Parcelable; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.MotionEventCompat; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.SparseArray; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.Interpolator; import android.widget.Scroller; import java.lang.ref.WeakReference; import java.lang.reflect.Field; /** * Auto Scroll View Pager * <ul> * <strong>Basic Setting and Usage</strong> * <li>{@link #startAutoScroll()} start auto scroll, or * {@link #startAutoScroll(int)} start auto scroll delayed</li> * <li>{@link #stopAutoScroll()} stop auto scroll</li> * <li>{@link #setInterval(long)} set auto scroll time in milliseconds, default * is {@link #DEFAULT_INTERVAL}</li> * </ul> * <ul> * <strong>Advanced Settings and Usage</strong> * <li>{@link #setDirection(int)} set auto scroll direction</li> * <li>{@link #setCycle(boolean)} set whether automatic cycle when auto scroll * reaching the last or first layout_wd_dd_item, default is true</li> * <li>{@link #setSlideBorderMode(int)} set how to process when sliding at the * last or first layout_wd_dd_item</li> * <li>{@link #setStopScrollWhenTouch(boolean)} set whether stop auto scroll * when touching, default is true</li> * </ul> */ public class AutoScrollLoopViewPager extends ViewPager { private boolean isCanScroll; public static final int DEFAULT_INTERVAL = 3000; public static final int LEFT = 0; public static final int RIGHT = 1; /** * do nothing when sliding at the last or first layout_wd_dd_item * */ public static final int SLIDE_BORDER_MODE_NONE = 0; /** * deliver event to parent when sliding at the last or first layout_wd_dd_item * */ public static final int SLIDE_BORDER_MODE_TO_PARENT = 1; /** * auto scroll time in milliseconds, default is {@link #DEFAULT_INTERVAL} * */ private long interval = DEFAULT_INTERVAL; /** * auto scroll direction, default is {@link #RIGHT} * */ private int direction = RIGHT; /** * whether automatic cycle when auto scroll reaching the last or first layout_wd_dd_item, * default is true */ private boolean isCycle = true; /** * whether stop auto scroll when touching, default is true * */ private boolean stopScrollWhenTouch = true; /** * how to process when sliding at the last or first layout_wd_dd_item, default is * {@link #SLIDE_BORDER_MODE_NONE} */ private int slideBorderMode = SLIDE_BORDER_MODE_NONE; /** * scroll factor for auto scroll animation, default is 1.0 * */ private double autoScrollFactor = 1.0; /** * scroll factor for swipe scroll animation, default is 1.0 * */ private double swipeScrollFactor = 1.0; private Handler handler; private boolean isAutoScroll = false; private boolean isStopByTouch = false; private float touchX = 0f, downX = 0f; private CustomDurationScroller scroller = null; public static final int SCROLL_WHAT = 0; private float startX; private float startY; private float moveX; private float moveY; public AutoScrollLoopViewPager(Context paramContext) { this(paramContext, null); } public AutoScrollLoopViewPager(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); init(); } private void init() { handler = new MyHandler(this); setViewPagerScroller(); super.setOnPageChangeListener(onPageChangeListener); } /** * start auto scroll, first scroll delay time is {@link #getInterval()} */ public void startAutoScroll() { isAutoScroll = true; sendScrollMessage((long) (interval + scroller.getDuration() / autoScrollFactor * swipeScrollFactor)); } /** * start auto scroll * * @param delayTimeInMills first scroll delay time */ public void startAutoScroll(int delayTimeInMills) { isAutoScroll = true; sendScrollMessage(delayTimeInMills); } /** * stop auto scroll */ public void stopAutoScroll() { isAutoScroll = false; handler.removeMessages(SCROLL_WHAT); } public boolean isAutoScroll() { return isAutoScroll; } /** * set the factor by which the duration of sliding animation will change * while swiping */ public void setSwipeScrollDurationFactor(double scrollFactor) { swipeScrollFactor = scrollFactor; } /** * set the factor by which the duration of sliding animation will change * while auto scrolling */ public void setAutoScrollDurationFactor(double scrollFactor) { autoScrollFactor = scrollFactor; } private void sendScrollMessage(long delayTimeInMills) { /** remove messages before, keeps one message is running at most **/ handler.removeMessages(SCROLL_WHAT); handler.sendEmptyMessageDelayed(SCROLL_WHAT, delayTimeInMills); } /** * set ViewPager scroller to change animation duration when sliding */ private void setViewPagerScroller() { try { Field scrollerField = ViewPager.class.getDeclaredField("mScroller"); scrollerField.setAccessible(true); Field interpolatorField = ViewPager.class .getDeclaredField("sInterpolator"); interpolatorField.setAccessible(true); scroller = new CustomDurationScroller(getContext(), (Interpolator) interpolatorField.get(null)); scrollerField.set(this, scroller); } catch (Exception e) { e.printStackTrace(); } } /** * scroll only once */ public void scrollOnce() { PagerAdapter adapter = getAdapter(); int count = 0; if (adapter != null) { count = adapter.getCount(); if (count <= 1) { return; } } int currentItem = getCurrentItem(); int nextItem = (direction == LEFT) ? --currentItem : ++currentItem; if (nextItem >= count) { nextItem = 0; } /*the real position is Handled in LoopPagerAdapterWrapper */ setCurrentItem(nextItem); } /** * <ul> * if stopScrollWhenTouch is true * <li>if event is down, stop auto scroll.</li> * <li>if event is up, start auto scroll again.</li> * </ul> */ @Override public boolean dispatchTouchEvent(MotionEvent ev) { int action = MotionEventCompat.getActionMasked(ev); if (stopScrollWhenTouch) { if ((action == MotionEvent.ACTION_DOWN) && isAutoScroll) { isStopByTouch = true; stopAutoScroll(); } else if (ev.getAction() == MotionEvent.ACTION_UP && isStopByTouch) { startAutoScroll(); } } if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT) { int currentItem = getCurrentItem(); PagerAdapter adapter = getAdapter(); int pageCount = adapter == null ? 0 : adapter.getCount(); if (currentItem == 0 || currentItem == pageCount - 1) { touchX = ev.getX(); if (ev.getAction() == MotionEvent.ACTION_DOWN) { downX = touchX; } /** * current index is first one and slide to right or current index is * last one and slide to left.<br/> * if slide border mode is to parent, then * requestDisallowInterceptTouchEvent false.<br/> * else scroll to last one when current layout_wd_dd_item is first one, scroll to * first one when current layout_wd_dd_item is last one. */ if ((currentItem == 0 && downX < touchX) || (currentItem == pageCount - 1 && downX > touchX)) { getParent().requestDisallowInterceptTouchEvent(false); } } } else { getParent().requestDisallowInterceptTouchEvent(true); } return super.dispatchTouchEvent(ev); } private static class MyHandler extends Handler { private final WeakReference<AutoScrollLoopViewPager> autoScrollViewPager; public MyHandler(AutoScrollLoopViewPager autoScrollViewPager) { this.autoScrollViewPager = new WeakReference<>( autoScrollViewPager); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case SCROLL_WHAT: AutoScrollLoopViewPager pager = this.autoScrollViewPager.get(); if (pager != null) { pager.scroller.setScrollDurationFactor(pager.autoScrollFactor); pager.scrollOnce(); pager.scroller.setScrollDurationFactor(pager.swipeScrollFactor); pager.sendScrollMessage(pager.interval + pager.scroller.getDuration()); if (pager.onLoopBannerChangeTimeListener != null) { pager.onLoopBannerChangeTimeListener.onChangeTime(pager.interval); } } default: break; } } } /** * get auto scroll time in milliseconds, default is * {@link #DEFAULT_INTERVAL} * * @return the interval */ public long getInterval() { return interval; } /** * set auto scroll time in milliseconds, default is * {@link #DEFAULT_INTERVAL} * * @param interval the interval to set */ public void setInterval(long interval) { this.interval = interval; } /** * get auto scroll direction * * @return {@link #LEFT} or {@link #RIGHT}, default is {@link #RIGHT} */ public int getDirection() { return (direction == LEFT) ? LEFT : RIGHT; } /** * set auto scroll direction * * @param direction {@link #LEFT} or {@link #RIGHT}, default is {@link #RIGHT} */ public void setDirection(int direction) { this.direction = direction; } /** * whether automatic cycle when auto scroll reaching the last or first layout_wd_dd_item, * default is true * * @return the isCycle */ public boolean isCycle() { return isCycle; } /** * set whether automatic cycle when auto scroll reaching the last or first * layout_wd_dd_item, default is true * * @param isCycle the isCycle to set */ public void setCycle(boolean isCycle) { boolean tmp = this.isCycle; this.isCycle = isCycle; if (mAdapter != null) { mAdapter.setCycle(isCycle); if (tmp && !isCycle) setCurrentItem(0, false); } } /** * whether stop auto scroll when touching, default is true * * @return the stopScrollWhenTouch */ public boolean isStopScrollWhenTouch() { return stopScrollWhenTouch; } /** * set whether stop auto scroll when touching, default is true * * @param stopScrollWhenTouch */ public void setStopScrollWhenTouch(boolean stopScrollWhenTouch) { this.stopScrollWhenTouch = stopScrollWhenTouch; } /** * get how to process when sliding at the last or first layout_wd_dd_item * * @return the slideBorderMode {@link #SLIDE_BORDER_MODE_NONE}, * {@link #SLIDE_BORDER_MODE_TO_PARENT}, * default is * {@link #SLIDE_BORDER_MODE_NONE} */ public int getSlideBorderMode() { return slideBorderMode; } /** * set how to process when sliding at the last or first layout_wd_dd_item * * @param slideBorderMode {@link #SLIDE_BORDER_MODE_NONE}, * {@link #SLIDE_BORDER_MODE_TO_PARENT}, * default is * {@link #SLIDE_BORDER_MODE_NONE} */ public void setSlideBorderMode(int slideBorderMode) { this.slideBorderMode = slideBorderMode; } public class CustomDurationScroller extends Scroller { private double scrollFactor = 1; public CustomDurationScroller(Context context) { this(context, null); } public CustomDurationScroller(Context context, Interpolator interpolator) { super(context, interpolator); } /** * not exist in android 2.3 * * @param context * @param interpolator * @param flywheel */ /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { this.scrollFactor = scrollFactor; } @Override public void startScroll(int startX, int startY, int dx, int dy, int duration) { super.startScroll(startX, startY, dx, dy, (int) (duration * scrollFactor)); } } /** * *************************************************** Looping * ************************************* */ OnPageChangeListener mOuterPageChangeListener; private LoopPagerAdapterWrapper mAdapter; /** * helper function which may be used when implementing FragmentPagerAdapter * * @param position * @param count * @return (position-1)%count */ public static int toRealPosition(int position, int count) { position = position - 1; if (position < 0) { position += count; } else { position = position % count; } return position; } /** * If set to true, the boundary views (i.e. first and last) will never be * destroyed This may help to prevent "blinking" of some views * * @param mBoundaryCaching */ public void setBoundaryCaching(boolean mBoundaryCaching) { if (mAdapter != null) { mAdapter.setBoundaryCaching(mBoundaryCaching); } } @Override public void setAdapter(PagerAdapter adapter) { mAdapter = new LoopPagerAdapterWrapper(adapter); super.setAdapter(mAdapter); setCurrentItem(0, false); } @Override public PagerAdapter getAdapter() { return mAdapter != null ? mAdapter.getRealAdapter() : mAdapter; } @Override public int getCurrentItem() { return mAdapter != null ? mAdapter.toRealPosition(super .getCurrentItem()) : 0; } public void setCurrentItem(int item, boolean smoothScroll) { int realItem = mAdapter.toInnerPosition(item); super.setCurrentItem(realItem, smoothScroll); } @Override public void setCurrentItem(int item) { if (getCurrentItem() != item) { setCurrentItem(item, true); } } @Override public void setOnPageChangeListener(OnPageChangeListener listener) { mOuterPageChangeListener = listener; } private OnPageChangeListener onPageChangeListener = new OnPageChangeListener() { private float mPreviousOffset = -1; private float mPreviousPosition = -1; @Override public void onPageSelected(int position) { int realPosition = mAdapter.toRealPosition(position); if (mPreviousPosition != realPosition) { mPreviousPosition = realPosition; if (mOuterPageChangeListener != null) { mOuterPageChangeListener.onPageSelected(realPosition); } } } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int realPosition = position; if (mAdapter != null) { realPosition = mAdapter.toRealPosition(position); if (positionOffset == 0 && mPreviousOffset == 0 && (position == 0 || position == mAdapter.getCount() - 1)) { if (!isCycle && realPosition != position) { mOuterPageChangeListener.onPageScrolled(realPosition, positionOffset, positionOffsetPixels); } else { setCurrentItem(realPosition, false); } } } mPreviousOffset = positionOffset; if (mOuterPageChangeListener != null) { if (mAdapter != null && realPosition != mAdapter.getRealCount() - 1) { mOuterPageChangeListener.onPageScrolled(realPosition, positionOffset, positionOffsetPixels); } else { if (positionOffset > .5) { mOuterPageChangeListener.onPageScrolled(0, 0, 0); } else { mOuterPageChangeListener.onPageScrolled(realPosition, 0, 0); } } } } @Override public void onPageScrollStateChanged(int state) { if (mAdapter != null) { int position = AutoScrollLoopViewPager.super.getCurrentItem(); int realPosition = mAdapter.toRealPosition(position); if (state == ViewPager.SCROLL_STATE_IDLE && (position == 0 || position == mAdapter.getCount() - 1)) { if (!isCycle && realPosition != position) { mOuterPageChangeListener .onPageScrollStateChanged(state); } else { setCurrentItem(realPosition, false); } } } if (mOuterPageChangeListener != null) { mOuterPageChangeListener.onPageScrollStateChanged(state); } } }; /** * A PagerAdapter wrapper responsible for providing a proper page to * LoopViewPager * <p/> * This class shouldn't be used directly */ public static class LoopPagerAdapterWrapper extends PagerAdapter { private PagerAdapter mAdapter; private SparseArray<ToDestroy> mToDestroy = new SparseArray<>(); private boolean mBoundaryCaching = false; private boolean isCycle = true; void setBoundaryCaching(boolean mBoundaryCaching) { this.mBoundaryCaching = mBoundaryCaching; super.notifyDataSetChanged(); } void setCycle(boolean isCycle) { this.isCycle = isCycle; super.notifyDataSetChanged(); } LoopPagerAdapterWrapper(PagerAdapter adapter) { this.mAdapter = adapter; } @Override public void notifyDataSetChanged() { mToDestroy = new SparseArray<>(); super.notifyDataSetChanged(); } int toRealPosition(int position) { int realPosition = position; int realCount = getRealCount(); if (realCount == 0) return 0; if (isCycle) { realPosition = (position - 1) % realCount; if (realPosition < 0) { realPosition += realCount; } } return realPosition; } public int toInnerPosition(int realPosition) { return isCycle ? realPosition + 1 : realPosition; } private int getRealFirstPosition() { return isCycle ? 1 : 0; } private int getRealLastPosition() { int count = getRealCount(); return isCycle ? count : count - 1; } @Override public int getCount() { int count = getRealCount(); return isCycle ? count + 2 : count; } public int getRealCount() { return mAdapter.getCount(); } public PagerAdapter getRealAdapter() { return mAdapter; } @Override public Object instantiateItem(ViewGroup container, int position) { int realPosition = (mAdapter instanceof FragmentPagerAdapter || mAdapter instanceof FragmentStatePagerAdapter) ? position : toRealPosition(position); if (mBoundaryCaching) { ToDestroy toDestroy = mToDestroy.get(position); if (toDestroy != null) { mToDestroy.remove(position); return toDestroy.object; } } return mAdapter.instantiateItem(container, realPosition); } @Override public void destroyItem(ViewGroup container, int position, Object object) { int realFirst = getRealFirstPosition(); int realLast = getRealLastPosition(); int realPosition = (mAdapter instanceof FragmentPagerAdapter || mAdapter instanceof FragmentStatePagerAdapter) ? position : toRealPosition(position); if (mBoundaryCaching && (position == realFirst || position == realLast)) { mToDestroy.put(position, new ToDestroy(container, realPosition, object)); } mAdapter.destroyItem(container, realPosition, object); } /* * Delegate rest of methods directly to the inner adapter. */ @Override public void finishUpdate(ViewGroup container) { mAdapter.finishUpdate(container); } @Override public boolean isViewFromObject(View view, Object object) { return mAdapter.isViewFromObject(view, object); } @Override public void restoreState(Parcelable bundle, ClassLoader classLoader) { mAdapter.restoreState(bundle, classLoader); } @Override public Parcelable saveState() { return mAdapter.saveState(); } @Override public void startUpdate(ViewGroup container) { mAdapter.startUpdate(container); } @Override public void setPrimaryItem(ViewGroup container, int position, Object object) { mAdapter.setPrimaryItem(container, position, object); } } /* * End delegation */ /** * Container class for caching the boundary views */ public static class ToDestroy { ViewGroup container; int position; Object object; public ToDestroy(ViewGroup container, int position, Object object) { this.container = container; this.position = position; this.object = object; } } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); this.stopAutoScroll(); } private OnLoopBannerChangeTimeListener onLoopBannerChangeTimeListener; public void setOnLoopBannerChangeTimeListener(OnLoopBannerChangeTimeListener onLoopBannerChangeTimeListener) { this.onLoopBannerChangeTimeListener = onLoopBannerChangeTimeListener; } public interface OnLoopBannerChangeTimeListener { void onChangeTime(long time); } float interceptStartX = 0; float interceptStartY = 0; float interceptMoveX = 0; float interceptMoveY = 0; @Override public boolean onInterceptTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: interceptStartX = ev.getX(); interceptStartY = ev.getY(); break; case MotionEvent.ACTION_MOVE: if(isCanScroll) { interceptMoveX = ev.getX(); interceptMoveY = ev.getY(); if (Math.abs(interceptMoveX - interceptStartX) < Math.abs(interceptMoveY - interceptStartY)) { getParent().requestDisallowInterceptTouchEvent(false); return false; } interceptStartX = interceptMoveX; interceptStartY = interceptMoveY; } else { return true; } break; case MotionEvent.ACTION_UP: break; } return super.onInterceptTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: startX = ev.getX(); startY = ev.getY(); break; case MotionEvent.ACTION_MOVE: if(isCanScroll) { moveX = ev.getX(); moveY = ev.getY(); if (Math.abs(moveX - startX) < Math.abs(moveY - startY)) { getParent().requestDisallowInterceptTouchEvent(false); return false; } startX = moveX; startY = moveY; } else { return true; } break; case MotionEvent.ACTION_UP: break; } return super.onTouchEvent(ev); } public boolean isCanScroll() { return isCanScroll; } public void setCanScroll(boolean canScroll) { isCanScroll = canScroll; } }
3e18ea60643a3ea55012ea9148ce8f96c821a855
1,127
java
Java
app/src/test/java/com/st/practice/mytaxi/UserProxyHandler.java
st237688100/MyTaxiSample
bab73a83c969045adb4bfe05fa902638c0149b11
[ "Apache-2.0" ]
null
null
null
app/src/test/java/com/st/practice/mytaxi/UserProxyHandler.java
st237688100/MyTaxiSample
bab73a83c969045adb4bfe05fa902638c0149b11
[ "Apache-2.0" ]
null
null
null
app/src/test/java/com/st/practice/mytaxi/UserProxyHandler.java
st237688100/MyTaxiSample
bab73a83c969045adb4bfe05fa902638c0149b11
[ "Apache-2.0" ]
null
null
null
25.613636
136
0.675244
10,602
package com.st.practice.mytaxi; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** * @Date: 2019/4/9 10:56 */ public class UserProxyHandler implements InvocationHandler { UserService realService; UserService proxyInstance; public UserProxyHandler(UserService userService) { realService = userService; /** * 关键点1:代理实例生成 */ proxyInstance = (UserService) Proxy.newProxyInstance(getClass().getClassLoader(), userService.getClass().getInterfaces(), this); } public UserService getRealService() { return realService; } public UserService getProxyInstance() { return proxyInstance; } /** * 关键点2:代理实例的接口方法会调用InvocationHandler的invoke方法 */ @Override public Object invoke(Object o, Method method, Object[] objects) throws Throwable { System.out.println("UserProxyHandler before"); // 代理实现的地方 Object result = method.invoke(realService, objects); System.out.println("UserProxyHandler after"); return result; } }
3e18eade04db350040b3168c82977dd7f6d179a7
1,349
java
Java
src/main/java/se/mickelus/tetra/items/IItemModular.java
noobanidus/tetra
fa3f1b71086de96c597222acec1bb7624df2bf95
[ "MIT" ]
null
null
null
src/main/java/se/mickelus/tetra/items/IItemModular.java
noobanidus/tetra
fa3f1b71086de96c597222acec1bb7624df2bf95
[ "MIT" ]
null
null
null
src/main/java/se/mickelus/tetra/items/IItemModular.java
noobanidus/tetra
fa3f1b71086de96c597222acec1bb7624df2bf95
[ "MIT" ]
null
null
null
37.472222
145
0.775389
10,603
package se.mickelus.tetra.items; import com.google.common.collect.ImmutableList; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import se.mickelus.tetra.module.ItemModule; import se.mickelus.tetra.module.ItemModuleMajor; import se.mickelus.tetra.module.data.ModuleModel; public interface IItemModular { public boolean isModuleRequired(String moduleSlot); public int getNumMajorModules(); public String[] getMajorModuleKeys(); public String[] getMajorModuleNames(); public ItemModuleMajor[] getMajorModules(ItemStack itemStack); public int getNumMinorModules(); public String[] getMinorModuleKeys(); public String[] getMinorModuleNames(); public ItemModule[] getMinorModules(ItemStack itemStack); public ItemStack getDefaultStack(); /** * Resets and applies effects for the current setup of modules & improvements. Applies enchantments and other things which cannot be emulated * through other means. Call this after each time the module setup changes. * @param itemStack The modular item itemstack */ public void assemble(ItemStack itemStack, World world); public ImmutableList<ResourceLocation> getTextures(ItemStack itemStack); public ImmutableList<ModuleModel> getModels(ItemStack itemStack); }
3e18eb6e20e9f8e21c0932fe7e06beae24be64d1
1,153
java
Java
client-cm/src/main/java/com/sequenceiq/cloudbreak/cm/client/retry/CmApiRetryAspect.java
Beast2709/cloudbreak
6fefcf8e1ba441f46d3e7fe253e41381622a6b4d
[ "Apache-2.0" ]
174
2017-07-14T03:20:42.000Z
2022-03-25T05:03:18.000Z
client-cm/src/main/java/com/sequenceiq/cloudbreak/cm/client/retry/CmApiRetryAspect.java
Beast2709/cloudbreak
6fefcf8e1ba441f46d3e7fe253e41381622a6b4d
[ "Apache-2.0" ]
2,242
2017-07-12T05:52:01.000Z
2022-03-31T15:50:08.000Z
client-cm/src/main/java/com/sequenceiq/cloudbreak/cm/client/retry/CmApiRetryAspect.java
Beast2709/cloudbreak
6fefcf8e1ba441f46d3e7fe253e41381622a6b4d
[ "Apache-2.0" ]
172
2017-07-12T08:53:48.000Z
2022-03-24T12:16:33.000Z
32.942857
120
0.758023
10,604
package com.sequenceiq.cloudbreak.cm.client.retry; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.retry.support.RetryTemplate; import org.springframework.stereotype.Component; @Aspect @Component public class CmApiRetryAspect { private final RetryTemplate cmApiRetryTemplate; public CmApiRetryAspect(RetryTemplate cmApiRetryTemplate) { this.cmApiRetryTemplate = cmApiRetryTemplate; } @Pointcut("within(com.cloudera.api.swagger.*) && !execution(public * *(com.cloudera.api.swagger.client.ApiClient))") public void allCmApiCalls() { } @Pointcut("!execution(public * com.cloudera.api.swagger.ClouderaManagerResourceApi.getVersion())") public void noGetVersion() { } @Around("allCmApiCalls() && noGetVersion()") // CHECKSTYLE:OFF public Object retryableApiCall(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { // CHECKSTYLE:ON return cmApiRetryTemplate.execute(context -> proceedingJoinPoint.proceed()); } }
3e18ec3d2694e54ebe7725a90eda717fb2431490
232
java
Java
code/Client/src/main/java/net/selenate/client/interfaces/INavigation.java
presjednik/selenate
4bfd3e8bccb653199ab6b76c7f1bb38b510c2d49
[ "BSD-3-Clause" ]
null
null
null
code/Client/src/main/java/net/selenate/client/interfaces/INavigation.java
presjednik/selenate
4bfd3e8bccb653199ab6b76c7f1bb38b510c2d49
[ "BSD-3-Clause" ]
null
null
null
code/Client/src/main/java/net/selenate/client/interfaces/INavigation.java
presjednik/selenate
4bfd3e8bccb653199ab6b76c7f1bb38b510c2d49
[ "BSD-3-Clause" ]
null
null
null
23.2
43
0.784483
10,605
package net.selenate.client.interfaces; import java.io.IOException; public interface INavigation { public void back() throws IOException; public void forward() throws IOException; public void refresh() throws IOException; }
3e18eca6e559ce9569101c9a71dae130bc0886b6
614
java
Java
rpc-framework-simple/src/main/java/github/javaguide/loadbalance/loadbalancer/RandomLoadBalance.java
xujia1017/guide-rpc-framework
d4e54ac5bcbe346d1567e9771e459a4ee55d952b
[ "MulanPSL-1.0" ]
2,303
2020-06-04T16:12:30.000Z
2022-03-31T14:38:52.000Z
rpc-framework-simple/src/main/java/github/javaguide/loadbalance/loadbalancer/RandomLoadBalance.java
xujia1017/guide-rpc-framework
d4e54ac5bcbe346d1567e9771e459a4ee55d952b
[ "MulanPSL-1.0" ]
45
2020-06-09T12:07:13.000Z
2022-03-26T13:41:41.000Z
rpc-framework-simple/src/main/java/github/javaguide/loadbalance/loadbalancer/RandomLoadBalance.java
xujia1017/guide-rpc-framework
d4e54ac5bcbe346d1567e9771e459a4ee55d952b
[ "MulanPSL-1.0" ]
1,209
2020-06-05T01:45:25.000Z
2022-03-31T13:58:58.000Z
27.909091
85
0.767101
10,606
package github.javaguide.loadbalance.loadbalancer; import github.javaguide.loadbalance.AbstractLoadBalance; import github.javaguide.remoting.dto.RpcRequest; import java.util.List; import java.util.Random; /** * Implementation of random load balancing strategy * * @author shuang.kou * @createTime 2020年06月21日 07:47:00 */ public class RandomLoadBalance extends AbstractLoadBalance { @Override protected String doSelect(List<String> serviceAddresses, RpcRequest rpcRequest) { Random random = new Random(); return serviceAddresses.get(random.nextInt(serviceAddresses.size())); } }
3e18ecb77f1538ce119f6a80e021e31252a30784
103
java
Java
src/main/java/com/lazy/interfaces/Clickable.java
feiyuediy/java_ui
1874b0ea76f72f710fa804d79625cf756c60428d
[ "MIT" ]
null
null
null
src/main/java/com/lazy/interfaces/Clickable.java
feiyuediy/java_ui
1874b0ea76f72f710fa804d79625cf756c60428d
[ "MIT" ]
null
null
null
src/main/java/com/lazy/interfaces/Clickable.java
feiyuediy/java_ui
1874b0ea76f72f710fa804d79625cf756c60428d
[ "MIT" ]
null
null
null
17.166667
41
0.757282
10,607
package com.lazy.interfaces; public interface Clickable { public void click() throws Exception; }
3e18ed55181c300dbac21636cc75b1bdb341a944
348
java
Java
iotsys-xacml/src/an/xacml/engine/PDPInitializeException.java
mjung85/iotsys
c50d6f61d7d2c41ad26c03bf4f565b0c8f1be853
[ "BSD-3-Clause" ]
32
2016-03-24T06:22:03.000Z
2021-12-28T00:07:34.000Z
iotsys-xacml/src/an/xacml/engine/PDPInitializeException.java
mjung85/iotsys
c50d6f61d7d2c41ad26c03bf4f565b0c8f1be853
[ "BSD-3-Clause" ]
5
2015-08-09T08:35:53.000Z
2019-06-13T16:38:42.000Z
iotsys-xacml/src/an/xacml/engine/PDPInitializeException.java
mjung85/iotsys
c50d6f61d7d2c41ad26c03bf4f565b0c8f1be853
[ "BSD-3-Clause" ]
16
2016-03-09T18:06:54.000Z
2021-07-20T03:09:06.000Z
26.769231
71
0.701149
10,608
package an.xacml.engine; public class PDPInitializeException extends Exception { private static final long serialVersionUID = 3000641797363636826L; public PDPInitializeException(String message) { super(message); } public PDPInitializeException(String message, Throwable t) { super(message, t); } }
3e18edbb75955ee4d84e75ab758de985ee0426d4
480
java
Java
hybridcache/src/main/java/tech/easily/hybridcache/lib/cache/CacheKeyProvider.java
libern/HybridCache
88cb94d25b970d6fce9abfb3f432f3fd19662cc3
[ "MIT" ]
62
2018-04-05T10:47:06.000Z
2021-12-22T06:32:28.000Z
hybridcache/src/main/java/tech/easily/hybridcache/lib/cache/CacheKeyProvider.java
libern/HybridCache
88cb94d25b970d6fce9abfb3f432f3fd19662cc3
[ "MIT" ]
5
2018-07-12T12:03:55.000Z
2019-12-04T13:33:36.000Z
hybridcache/src/main/java/tech/easily/hybridcache/lib/cache/CacheKeyProvider.java
libern/HybridCache
88cb94d25b970d6fce9abfb3f432f3fd19662cc3
[ "MIT" ]
15
2018-04-08T06:04:50.000Z
2021-12-22T06:32:20.000Z
21.818182
121
0.683333
10,609
package tech.easily.hybridcache.lib.cache; /** * interface to generate the cache key, * implements it ,if flexible cache key strategy is needed.Simply using the default implementation {@link MD5KeyProvider} * <p> * Created by lemon on 06/01/2018. */ public interface CacheKeyProvider { /** * create a cache key * * @param baseKey usually it is the res's url * @return the real cache key String */ String buildCacheKey(String baseKey); }
3e18edf9606953243a8320566377546a647f010a
9,712
java
Java
People/app/src/main/java/com/example/tetianapriadko/people/MapsActivity.java
ChipiHenzj/androidLessons
8ae6e8c30c914e6ecf058493837f4e21ffe90b0f
[ "Apache-2.0" ]
null
null
null
People/app/src/main/java/com/example/tetianapriadko/people/MapsActivity.java
ChipiHenzj/androidLessons
8ae6e8c30c914e6ecf058493837f4e21ffe90b0f
[ "Apache-2.0" ]
null
null
null
People/app/src/main/java/com/example/tetianapriadko/people/MapsActivity.java
ChipiHenzj/androidLessons
8ae6e8c30c914e6ecf058493837f4e21ffe90b0f
[ "Apache-2.0" ]
null
null
null
40.978903
121
0.626544
10,610
package com.example.tetianapriadko.people; import android.Manifest; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.FrameLayout; import android.widget.Toast; import com.backendless.Backendless; import com.backendless.BackendlessCollection; import com.backendless.async.callback.AsyncCallback; import com.backendless.exceptions.BackendlessFault; import com.backendless.geo.GeoPoint; import com.backendless.persistence.BackendlessDataQuery; import com.backendless.persistence.QueryOptions; import com.example.tetianapriadko.people.structure.Student; import com.example.tetianapriadko.people.structure.Teacher; import com.google.android.gms.appindexing.Action; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; import java.util.List; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private GoogleApiClient client; private FrameLayout layoutProgress; private List<Student> students; private List<Teacher> teachers; private ArrayList<GeoPoint> geoPointsStudents; private ArrayList<GeoPoint> geoPointsTeachers; private ArrayList<String> placesOfStudents; private ArrayList<String> placesOfTeachers; private ArrayList<String> namesOfStudents; private ArrayList<String> namesOfTeachers; private ArrayList<String> surnamesOfStudents; private ArrayList<String> surnamesOfTeachers; private LatLng markersShow; private double latitudeStudent; private double longitudeStudent; private double latitudeTeacher; private double longitudeTeacher; private String placeStudent; private String nameStudent; private String surnameStudent; private String placeTeacher; private String nameTeacher; private String surnameTeacher; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); } @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); layoutProgress = (FrameLayout) findViewById(R.id.layout_progress); layoutProgress.setVisibility(View.GONE); if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mMap.setMyLocationEnabled(true); getStudentList(); getTeacherList(); } else { ActivityCompat.requestPermissions(MapsActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0); } } private void getStudentList() { layoutProgress.setVisibility(View.VISIBLE); QueryOptions queryOptions = new QueryOptions(); BackendlessDataQuery query = new BackendlessDataQuery(queryOptions); query.setPageSize(100); Backendless.Data.of(Student.class).find(query, new AsyncCallback<BackendlessCollection<Student>>() { @Override public void handleResponse(BackendlessCollection<Student> response) { layoutProgress.setVisibility(View.GONE); students = response.getCurrentPage(); geoPointsStudents = new ArrayList<GeoPoint>(); placesOfStudents = new ArrayList<String>(); namesOfStudents = new ArrayList<String>(); surnamesOfStudents = new ArrayList<String>(); for (int i = 0; i < students.size(); ++i) { geoPointsStudents.add(students.get(i).getGeoPoint()); placesOfStudents.add(students.get(i).getPlaceOfStudy()); namesOfStudents.add(students.get(i).getName()); surnamesOfStudents.add(students.get(i).getSurname()); } for (int i = 0; i < geoPointsStudents.size(); ++i) { if (geoPointsStudents.get(i) != null) { latitudeStudent = geoPointsStudents.get(i).getLatitude(); longitudeStudent = geoPointsStudents.get(i).getLongitude(); markersShow = new LatLng(latitudeStudent, longitudeStudent); placeStudent = placesOfStudents.get(i); nameStudent = namesOfStudents.get(i); surnameStudent = surnamesOfStudents.get(i); // mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(show, 10.f)); mMap.addMarker(new MarkerOptions() .position(markersShow) .title(placeStudent) .snippet(nameStudent + " " + surnameStudent)) .showInfoWindow(); } } } @Override public void handleFault(BackendlessFault fault) { layoutProgress.setVisibility(View.GONE); Toast.makeText(MapsActivity.this, fault.toString(), Toast.LENGTH_SHORT).show(); } }); } private void getTeacherList() { layoutProgress.setVisibility(View.VISIBLE); QueryOptions queryOptions = new QueryOptions(); BackendlessDataQuery query = new BackendlessDataQuery(queryOptions); query.setPageSize(100); Backendless.Data.of(Teacher.class).find(query, new AsyncCallback<BackendlessCollection<Teacher>>() { @Override public void handleResponse(BackendlessCollection<Teacher> response) { layoutProgress.setVisibility(View.GONE); teachers = response.getCurrentPage(); geoPointsTeachers = new ArrayList<GeoPoint>(); placesOfTeachers = new ArrayList<String>(); namesOfTeachers = new ArrayList<String>(); surnamesOfTeachers = new ArrayList<String>(); for (int i = 0; i < teachers.size(); ++i) { geoPointsTeachers.add(teachers.get(i).getGeoPoint()); placesOfTeachers.add(teachers.get(i).getPlaceofWork()); namesOfTeachers.add(teachers.get(i).getName()); surnamesOfTeachers.add(teachers.get(i).getSurname()); } for (int i = 0; i < geoPointsTeachers.size(); ++i) { if (geoPointsTeachers.get(i) != null) { latitudeTeacher = geoPointsTeachers.get(i).getLatitude(); longitudeTeacher = geoPointsTeachers.get(i).getLongitude(); markersShow = new LatLng(latitudeTeacher, longitudeTeacher); placeTeacher = placesOfTeachers.get(i); nameTeacher = namesOfTeachers.get(i); surnameTeacher = surnamesOfTeachers.get(i); mMap.addMarker(new MarkerOptions() .position(markersShow) .title(placeTeacher) .snippet(nameTeacher + " " + surnameTeacher)) .showInfoWindow(); } } } @Override public void handleFault(BackendlessFault fault) { layoutProgress.setVisibility(View.GONE); Toast.makeText(MapsActivity.this, fault.toString(), Toast.LENGTH_SHORT).show(); } }); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return; } mMap.setMyLocationEnabled(true); } else { } } @Override public void onStart() { super.onStart(); client.connect(); Action viewAction = Action.newAction( Action.TYPE_VIEW, "Maps Page", Uri.parse("http://host/path"), Uri.parse("android-app://com.example.tetianapriadko.people/http/host/path") ); AppIndex.AppIndexApi.start(client, viewAction); } @Override public void onStop() { super.onStop(); Action viewAction = Action.newAction( Action.TYPE_VIEW, "Maps Page", Uri.parse("http://host/path"), Uri.parse("android-app://com.example.tetianapriadko.people/http/host/path") ); AppIndex.AppIndexApi.end(client, viewAction); client.disconnect(); } }
3e18eef59c143bf34292c0a861685b6f5e06ca11
113
java
Java
src/main/java/br/wjangoo/divertidamente/models/usuario/PerfilEnum.java
welingtonliima/wjangoo-divertidamente
c10d77daa7d20b727df4f855b2f676b55642dff5
[ "MIT" ]
null
null
null
src/main/java/br/wjangoo/divertidamente/models/usuario/PerfilEnum.java
welingtonliima/wjangoo-divertidamente
c10d77daa7d20b727df4f855b2f676b55642dff5
[ "MIT" ]
null
null
null
src/main/java/br/wjangoo/divertidamente/models/usuario/PerfilEnum.java
welingtonliima/wjangoo-divertidamente
c10d77daa7d20b727df4f855b2f676b55642dff5
[ "MIT" ]
null
null
null
16.142857
49
0.761062
10,611
package br.wjangoo.divertidamente.models.usuario; public enum PerfilEnum { ROLE_ADMIN, ROLE_PACIENTE; }
3e18eefbfcd07a3cdd8c3bcaeb693243fbdcf5f1
2,908
java
Java
src/main/java/com/publicuhc/pluginframework/routing/tester/SenderTester.java
Eluinhost/pluginframework
352f1baf14fdb02af3a750c70ef411bef969639b
[ "MIT" ]
null
null
null
src/main/java/com/publicuhc/pluginframework/routing/tester/SenderTester.java
Eluinhost/pluginframework
352f1baf14fdb02af3a750c70ef411bef969639b
[ "MIT" ]
1
2016-04-26T11:04:30.000Z
2016-04-26T11:04:30.000Z
src/main/java/com/publicuhc/pluginframework/routing/tester/SenderTester.java
Eluinhost/pluginframework
352f1baf14fdb02af3a750c70ef411bef969639b
[ "MIT" ]
null
null
null
35.036145
116
0.69326
10,612
/* * SenderTester.java * * The MIT License (MIT) * * Copyright (c) 2014 Graham Howden <graham_howden1 at yahoo.co.uk>. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.publicuhc.pluginframework.routing.tester; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import java.util.HashSet; /** * A tester that allows a command if any of the classes provided match the sender. If no senders are defined it will * always fail */ public class SenderTester extends HashSet<Class<? extends CommandSender>> implements CommandTester { /** * Check if all of the supplied classes can be treated as the supplied class * @param klass the class to check * @return true if no classes in the set or all classes are applicable */ @SuppressWarnings("unchecked") public boolean isApplicable(Class klass) { for(Class<? extends CommandSender> senderType : this) { if(!klass.isAssignableFrom(senderType)) { return false; } } return true; } /** * Checks to see if any of the classes in set are superclasses of the provided class * @param klass the class to check * @return true if any of the classes match, false otherwise or if set is empty */ public boolean isAllowed(Class klass) { for(Class<? extends CommandSender> senderType : this) { if(senderType.isAssignableFrom(klass)) { return true; } } return false; } @Override public boolean testCommand(Command command, CommandSender sender, String[] args) { boolean passed = isAllowed(sender.getClass()); if(!passed) sender.sendMessage(ChatColor.RED + "You cannot run that command from here!"); return passed; } }
3e18f035fbb64880c144030e45f32679aa73b6a8
105
java
Java
app/src/main/java/com/coolweather/android/gson/Suggestion.java
AmyStudyHappy/coolweather
1fe49c7a0dd28c85a44a4f52e26d3ba1a5a32350
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/coolweather/android/gson/Suggestion.java
AmyStudyHappy/coolweather
1fe49c7a0dd28c85a44a4f52e26d3ba1a5a32350
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/coolweather/android/gson/Suggestion.java
AmyStudyHappy/coolweather
1fe49c7a0dd28c85a44a4f52e26d3ba1a5a32350
[ "Apache-2.0" ]
null
null
null
11.666667
37
0.67619
10,613
package com.coolweather.android.gson; /** * Created by wxm on 18/5/2. */ public class Suggestion { }
3e18f0fea5dde0cec0abb8bd687dfc33c5b034e6
1,371
java
Java
01_Language/01_Functions/java/src/main/java/com/onevgo/functions/ArrayKeys.java
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
3
2020-06-28T07:42:51.000Z
2021-01-15T10:32:11.000Z
01_Language/01_Functions/java/src/main/java/com/onevgo/functions/ArrayKeys.java
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
9
2021-03-10T22:45:40.000Z
2022-02-27T06:53:20.000Z
01_Language/01_Functions/java/src/main/java/com/onevgo/functions/ArrayKeys.java
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
1
2021-01-15T10:51:24.000Z
2021-01-15T10:51:24.000Z
29.170213
82
0.53027
10,614
package com.onevgo.functions; import java.util.*; import java.util.stream.Collectors; public class ArrayKeys { public static <K, V> List<K> arrayKeys(Map<K, V> map) { return new ArrayList<>(map.keySet()); } public static <E> List<Integer> arrayKeys(List<E> list) { List<Integer> res = new ArrayList<>(list.size()); for (int i = 0; i < list.size(); i++) { res.add(i); } return res; } public static <K, V> List<K> arrayKeys(Map<K, V> map, V search) { return map.keySet().stream().filter(k -> { V v = map.get(k); return Objects.equals(search, v); }).collect(Collectors.toList()); } public static <E> List<Integer> arrayKeys(List<E> list, E search) { List<Integer> res = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { E e = list.get(i); if (Objects.equals(search, e)) { res.add(i); } } return res; } public static void main(String[] args) { Map<Object, Object> map = new LinkedHashMap<>(); map.put(0, 100); map.put("color", "red"); System.out.println(arrayKeys(map)); List<String> list = Arrays.asList("blue", "red", "green", "blue", "blue"); System.out.println(arrayKeys(list, "blue")); } }
3e18f19b72fe22f82c6503af56beb472967df59a
7,013
java
Java
src/main/java/com/metaopsis/icsapi/v2/dom/di/Workflow.java
tcgibennett/iics_rest_api_v2_java
17ad07c5b9d486aec79c762784d307a8efe5daa0
[ "MIT" ]
null
null
null
src/main/java/com/metaopsis/icsapi/v2/dom/di/Workflow.java
tcgibennett/iics_rest_api_v2_java
17ad07c5b9d486aec79c762784d307a8efe5daa0
[ "MIT" ]
4
2020-03-04T22:40:19.000Z
2021-01-20T23:46:15.000Z
src/main/java/com/metaopsis/icsapi/v2/dom/di/Workflow.java
tcgibennett/iics_rest_api_v2_java
17ad07c5b9d486aec79c762784d307a8efe5daa0
[ "MIT" ]
null
null
null
26.869732
75
0.64409
10,615
package com.metaopsis.icsapi.v2.dom.di; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Arrays; public class Workflow { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "@type", access = JsonProperty.Access.WRITE_ONLY) private String type = "workflow"; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_ONLY) private long id; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String orgId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String name; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String description; @JsonProperty(access = JsonProperty.Access.READ_ONLY) private String createTime; @JsonProperty(access = JsonProperty.Access.READ_ONLY) private String updateTime; @JsonProperty(access = JsonProperty.Access.READ_ONLY) private String createdBy; @JsonProperty(access = JsonProperty.Access.READ_ONLY) private String updatedBy; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private TaskEmail errorTaskEmail; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private TaskEmail successTaskEmail; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private TaskEmail warningTaskEmail; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String agentId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String runtimeEnvironmentId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String scheduleId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String preProcessingCmd; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private String postProcessingCmd; @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private int maxLogs; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(access = JsonProperty.Access.READ_WRITE) private WorkflowTask[] tasks; public Workflow() { } public String getType() { return type; } public void setType(String type) { this.type = type; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getOrgId() { return orgId; } public void setOrgId(String orgId) { this.orgId = orgId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getUpdateTime() { return updateTime; } public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public String getUpdatedBy() { return updatedBy; } public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; } public TaskEmail getErrorTaskEmail() { return errorTaskEmail; } public void setErrorTaskEmail(TaskEmail errorTaskEmail) { this.errorTaskEmail = errorTaskEmail; } public TaskEmail getSuccessTaskEmail() { return successTaskEmail; } public void setSuccessTaskEmail(TaskEmail successTaskEmail) { this.successTaskEmail = successTaskEmail; } public TaskEmail getWarningTaskEmail() { return warningTaskEmail; } public void setWarningTaskEmail(TaskEmail warningTaskEmail) { this.warningTaskEmail = warningTaskEmail; } public String getAgentId() { return agentId; } public void setAgentId(String agentId) { this.agentId = agentId; } public String getRuntimeEnvironmentId() { return runtimeEnvironmentId; } public void setRuntimeEnvironmentId(String runtimeEnvironmentId) { this.runtimeEnvironmentId = runtimeEnvironmentId; } public String getScheduleId() { return scheduleId; } public void setScheduleId(String scheduleId) { this.scheduleId = scheduleId; } public String getPreProcessingCmd() { return preProcessingCmd; } public void setPreProcessingCmd(String preProcessingCmd) { this.preProcessingCmd = preProcessingCmd; } public String getPostProcessingCmd() { return postProcessingCmd; } public void setPostProcessingCmd(String postProcessingCmd) { this.postProcessingCmd = postProcessingCmd; } public int getMaxLogs() { return maxLogs; } public void setMaxLogs(int maxLogs) { this.maxLogs = maxLogs; } public WorkflowTask[] getTasks() { return tasks; } public void setTasks(WorkflowTask[] tasks) { this.tasks = tasks; } @Override public String toString() { return "Workflow{" + "type='" + type + '\'' + ", id=" + id + ", orgId='" + orgId + '\'' + ", name='" + name + '\'' + ", description='" + description + '\'' + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", createdBy='" + createdBy + '\'' + ", updatedBy='" + updatedBy + '\'' + ", errorTaskEmail=" + errorTaskEmail + ", successTaskEmail=" + successTaskEmail + ", warningTaskEmail=" + warningTaskEmail + ", agentId='" + agentId + '\'' + ", runtimeEnvironmentId='" + runtimeEnvironmentId + '\'' + ", scheduleId='" + scheduleId + '\'' + ", preProcessingCmd='" + preProcessingCmd + '\'' + ", postProcessingCmd='" + postProcessingCmd + '\'' + ", maxLogs=" + maxLogs + ", tasks=" + Arrays.toString(tasks) + '}'; } }
3e18f207287163e972944c668f24be1e8ee0703a
118,497
java
Java
jira-6.3.6/work/Catalina/localhost/_/org/apache/jsp/secure/views/dashboard/deleteportalpage_jsp.java
davin-bao/djra
6b977dc761214d230a2b6bdd644c47b833a759f5
[ "Apache-2.0" ]
null
null
null
jira-6.3.6/work/Catalina/localhost/_/org/apache/jsp/secure/views/dashboard/deleteportalpage_jsp.java
davin-bao/djra
6b977dc761214d230a2b6bdd644c47b833a759f5
[ "Apache-2.0" ]
null
null
null
jira-6.3.6/work/Catalina/localhost/_/org/apache/jsp/secure/views/dashboard/deleteportalpage_jsp.java
davin-bao/djra
6b977dc761214d230a2b6bdd644c47b833a759f5
[ "Apache-2.0" ]
null
null
null
67.558153
279
0.775328
10,616
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.55 * Generated at: 2016-09-07 02:18:18 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.secure.views.dashboard; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class deleteportalpage_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; static { _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/tld/webwork.tld", Long.valueOf(1467871584000L)); _jspx_dependants.put("/WEB-INF/tld/sitemesh-page.tld", Long.valueOf(1467871584000L)); } private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fif_0026_005ftest; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005ftext_0026_005fname; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fparam_0026_005fname; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005felse; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname_005fid; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005furl_0026_005fvalue_005fatltoken_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005faui_005fcomponent_0026_005fvalue_005ftheme_005ftemplate_005fname_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005faui_005fparam_0026_005fname; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005faui_005fparam_0026_005fvalue_005fname_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005felseIf_0026_005ftest; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fiterator_0026_005fvalue; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005ftext_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005fparam_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005felse = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname_005fid = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005furl_0026_005fvalue_005fatltoken_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005faui_005fcomponent_0026_005fvalue_005ftheme_005ftemplate_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005faui_005fparam_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005faui_005fparam_0026_005fvalue_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005felseIf_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fww_005fiterator_0026_005fvalue = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.release(); _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.release(); _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.release(); _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.release(); _005fjspx_005ftagPool_005fww_005felse.release(); _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.release(); _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname_005fid.release(); _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.release(); _005fjspx_005ftagPool_005fww_005furl_0026_005fvalue_005fatltoken_005fnobody.release(); _005fjspx_005ftagPool_005faui_005fcomponent_0026_005fvalue_005ftheme_005ftemplate_005fname_005fnobody.release(); _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.release(); _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.release(); _005fjspx_005ftagPool_005faui_005fparam_0026_005fvalue_005fname_005fnobody.release(); _005fjspx_005ftagPool_005fww_005felseIf_0026_005ftest.release(); _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.release(); _005fjspx_005ftagPool_005fww_005fiterator_0026_005fvalue.release(); } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n"); out.write("\n"); out.write("\n"); out.write("<html>\n"); out.write("<head>\n"); out.write(" "); if (_jspx_meth_ww_005fif_005f0(_jspx_page_context)) return; out.write("\n"); out.write(" "); if (_jspx_meth_ww_005felse_005f0(_jspx_page_context)) return; out.write("\n"); out.write("</head>\n"); out.write("<body>\n"); if (_jspx_meth_ww_005fif_005f1(_jspx_page_context)) return; out.write('\n'); if (_jspx_meth_ww_005felse_005f1(_jspx_page_context)) return; out.write("\n"); out.write("</body>\n"); out.write("</html>\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_ww_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:if webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f0 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class); _jspx_th_ww_005fif_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005fif_005f0.setParent(null); // /secure/views/dashboard/deleteportalpage.jsp(6,4) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fif_005f0.setTest("/canDelete == true"); int _jspx_eval_ww_005fif_005f0 = _jspx_th_ww_005fif_005f0.doStartTag(); if (_jspx_eval_ww_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" <title>"); if (_jspx_meth_ww_005ftext_005f0(_jspx_th_ww_005fif_005f0, _jspx_page_context)) return true; out.write("</title>\n"); out.write(" <meta name=\"decorator\" content=\"panel-general\" />\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005fif_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f0); return true; } _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f0); return false; } private boolean _jspx_meth_ww_005ftext_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f0 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f0); // /secure/views/dashboard/deleteportalpage.jsp(7,15) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f0.setName("'portal.deletepage.title'"); int _jspx_eval_ww_005ftext_005f0 = _jspx_th_ww_005ftext_005f0.doStartTag(); if (_jspx_eval_ww_005ftext_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005ftext_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005ftext_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005ftext_005f0.doInitBody(); } do { if (_jspx_meth_ww_005fparam_005f0(_jspx_th_ww_005ftext_005f0, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_ww_005ftext_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005ftext_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005ftext_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f0); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f0); return false; } private boolean _jspx_meth_ww_005fparam_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005ftext_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:param webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f0 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_ww_005fparam_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005fparam_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005ftext_005f0); // /secure/views/dashboard/deleteportalpage.jsp(7,57) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fparam_005f0.setName("'value0'"); int _jspx_eval_ww_005fparam_005f0 = _jspx_th_ww_005fparam_005f0.doStartTag(); if (_jspx_eval_ww_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005fparam_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005fparam_005f0.doInitBody(); } do { if (_jspx_meth_ww_005fproperty_005f0(_jspx_th_ww_005fparam_005f0, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_ww_005fparam_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005fparam_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f0); return true; } _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f0); return false; } private boolean _jspx_meth_ww_005fproperty_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:property webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f0 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class); _jspx_th_ww_005fproperty_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005fproperty_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f0); // /secure/views/dashboard/deleteportalpage.jsp(7,83) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fproperty_005f0.setValue("pageName"); int _jspx_eval_ww_005fproperty_005f0 = _jspx_th_ww_005fproperty_005f0.doStartTag(); if (_jspx_th_ww_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f0); return true; } _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f0); return false; } private boolean _jspx_meth_ww_005felse_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:else webwork.view.taglib.ElseTag _jspx_th_ww_005felse_005f0 = (webwork.view.taglib.ElseTag) _005fjspx_005ftagPool_005fww_005felse.get(webwork.view.taglib.ElseTag.class); _jspx_th_ww_005felse_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005felse_005f0.setParent(null); int _jspx_eval_ww_005felse_005f0 = _jspx_th_ww_005felse_005f0.doStartTag(); if (_jspx_eval_ww_005felse_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" <title>"); if (_jspx_meth_ww_005ftext_005f1(_jspx_th_ww_005felse_005f0, _jspx_page_context)) return true; out.write("</title>\n"); out.write(" <meta name=\"decorator\" content=\"message\" />\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005felse_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005felse_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f0); return true; } _005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f0); return false; } private boolean _jspx_meth_ww_005ftext_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005felse_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f1 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f1.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005felse_005f0); // /secure/views/dashboard/deleteportalpage.jsp(11,15) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f1.setName("'common.words.error'"); int _jspx_eval_ww_005ftext_005f1 = _jspx_th_ww_005ftext_005f1.doStartTag(); if (_jspx_th_ww_005ftext_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f1); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f1); return false; } private boolean _jspx_meth_ww_005fif_005f1(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:if webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f1 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class); _jspx_th_ww_005fif_005f1.setPageContext(_jspx_page_context); _jspx_th_ww_005fif_005f1.setParent(null); // /secure/views/dashboard/deleteportalpage.jsp(16,0) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fif_005f1.setTest("/canDelete == true"); int _jspx_eval_ww_005fif_005f1 = _jspx_th_ww_005fif_005f1.doStartTag(); if (_jspx_eval_ww_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" "); if (_jspx_meth_page_005fapplyDecorator_005f0(_jspx_th_ww_005fif_005f1, _jspx_page_context)) return true; out.write('\n'); int evalDoAfterBody = _jspx_th_ww_005fif_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f1); return true; } _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f1); return false; } private boolean _jspx_meth_page_005fapplyDecorator_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // page:applyDecorator com.atlassian.jira.web.tags.JiraApplyDecoratorTag _jspx_th_page_005fapplyDecorator_005f0 = (com.atlassian.jira.web.tags.JiraApplyDecoratorTag) _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname_005fid.get(com.atlassian.jira.web.tags.JiraApplyDecoratorTag.class); _jspx_th_page_005fapplyDecorator_005f0.setPageContext(_jspx_page_context); _jspx_th_page_005fapplyDecorator_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f1); // /secure/views/dashboard/deleteportalpage.jsp(17,4) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fapplyDecorator_005f0.setId("delete-portal-page"); // /secure/views/dashboard/deleteportalpage.jsp(17,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fapplyDecorator_005f0.setName("auiform"); int _jspx_eval_page_005fapplyDecorator_005f0 = _jspx_th_page_005fapplyDecorator_005f0.doStartTag(); if (_jspx_eval_page_005fapplyDecorator_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_page_005fapplyDecorator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_page_005fapplyDecorator_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_page_005fapplyDecorator_005f0.doInitBody(); } do { out.write("\n"); out.write(" "); if (_jspx_meth_page_005fparam_005f0(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_page_005fparam_005f1(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_page_005fparam_005f2(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_page_005fparam_005f3(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); out.write("\n"); out.write(" "); if (_jspx_meth_page_005fparam_005f4(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f0(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f1(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f2(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f3(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f4(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f5(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f6(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f7(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f8(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f9(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context)) return true; out.write("\n"); out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_page_005fapplyDecorator_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_page_005fapplyDecorator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_page_005fapplyDecorator_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname_005fid.reuse(_jspx_th_page_005fapplyDecorator_005f0); return true; } _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname_005fid.reuse(_jspx_th_page_005fapplyDecorator_005f0); return false; } private boolean _jspx_meth_page_005fparam_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // page:param com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f0 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class); _jspx_th_page_005fparam_005f0.setPageContext(_jspx_page_context); _jspx_th_page_005fparam_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(18,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fparam_005f0.setName("action"); int _jspx_eval_page_005fparam_005f0 = _jspx_th_page_005fparam_005f0.doStartTag(); if (_jspx_eval_page_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_page_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_page_005fparam_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_page_005fparam_005f0.doInitBody(); } do { if (_jspx_meth_ww_005fproperty_005f1(_jspx_th_page_005fparam_005f0, _jspx_page_context)) return true; out.write(".jspa"); int evalDoAfterBody = _jspx_th_page_005fparam_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_page_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_page_005fparam_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f0); return true; } _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f0); return false; } private boolean _jspx_meth_ww_005fproperty_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:property webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f1 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class); _jspx_th_ww_005fproperty_005f1.setPageContext(_jspx_page_context); _jspx_th_ww_005fproperty_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f0); // /secure/views/dashboard/deleteportalpage.jsp(18,34) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fproperty_005f1.setValue("./actionName"); int _jspx_eval_ww_005fproperty_005f1 = _jspx_th_ww_005fproperty_005f1.doStartTag(); if (_jspx_th_ww_005fproperty_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f1); return true; } _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f1); return false; } private boolean _jspx_meth_page_005fparam_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // page:param com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f1 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class); _jspx_th_page_005fparam_005f1.setPageContext(_jspx_page_context); _jspx_th_page_005fparam_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(19,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fparam_005f1.setName("cssClass"); int _jspx_eval_page_005fparam_005f1 = _jspx_th_page_005fparam_005f1.doStartTag(); if (_jspx_eval_page_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_page_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_page_005fparam_005f1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_page_005fparam_005f1.doInitBody(); } do { out.write("delete-portal-page-"); if (_jspx_meth_ww_005fproperty_005f2(_jspx_th_page_005fparam_005f1, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_page_005fparam_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_page_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_page_005fparam_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f1); return true; } _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f1); return false; } private boolean _jspx_meth_ww_005fproperty_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:property webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f2 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class); _jspx_th_ww_005fproperty_005f2.setPageContext(_jspx_page_context); _jspx_th_ww_005fproperty_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f1); // /secure/views/dashboard/deleteportalpage.jsp(19,55) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fproperty_005f2.setValue("pageId"); int _jspx_eval_ww_005fproperty_005f2 = _jspx_th_ww_005fproperty_005f2.doStartTag(); if (_jspx_th_ww_005fproperty_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f2); return true; } _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f2); return false; } private boolean _jspx_meth_page_005fparam_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // page:param com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f2 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class); _jspx_th_page_005fparam_005f2.setPageContext(_jspx_page_context); _jspx_th_page_005fparam_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(20,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fparam_005f2.setName("submitButtonName"); int _jspx_eval_page_005fparam_005f2 = _jspx_th_page_005fparam_005f2.doStartTag(); if (_jspx_eval_page_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_page_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_page_005fparam_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_page_005fparam_005f2.doInitBody(); } do { out.write("Delete"); int evalDoAfterBody = _jspx_th_page_005fparam_005f2.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_page_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_page_005fparam_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f2); return true; } _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f2); return false; } private boolean _jspx_meth_page_005fparam_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // page:param com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f3 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class); _jspx_th_page_005fparam_005f3.setPageContext(_jspx_page_context); _jspx_th_page_005fparam_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(21,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fparam_005f3.setName("submitButtonText"); int _jspx_eval_page_005fparam_005f3 = _jspx_th_page_005fparam_005f3.doStartTag(); if (_jspx_eval_page_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_page_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_page_005fparam_005f3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_page_005fparam_005f3.doInitBody(); } do { if (_jspx_meth_ww_005ftext_005f2(_jspx_th_page_005fparam_005f3, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_page_005fparam_005f3.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_page_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_page_005fparam_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f3); return true; } _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f3); return false; } private boolean _jspx_meth_ww_005ftext_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f3, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f2 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f2.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f3); // /secure/views/dashboard/deleteportalpage.jsp(21,44) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f2.setName("'common.words.delete'"); int _jspx_eval_ww_005ftext_005f2 = _jspx_th_ww_005ftext_005f2.doStartTag(); if (_jspx_th_ww_005ftext_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f2); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f2); return false; } private boolean _jspx_meth_page_005fparam_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // page:param com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f4 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class); _jspx_th_page_005fparam_005f4.setPageContext(_jspx_page_context); _jspx_th_page_005fparam_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(24,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_page_005fparam_005f4.setName("cancelLinkURI"); int _jspx_eval_page_005fparam_005f4 = _jspx_th_page_005fparam_005f4.doStartTag(); if (_jspx_eval_page_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_page_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_page_005fparam_005f4.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_page_005fparam_005f4.doInitBody(); } do { if (_jspx_meth_ww_005furl_005f0(_jspx_th_page_005fparam_005f4, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_page_005fparam_005f4.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_page_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_page_005fparam_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f4); return true; } _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f4); return false; } private boolean _jspx_meth_ww_005furl_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f4, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:url com.atlassian.jira.web.tags.URLTag _jspx_th_ww_005furl_005f0 = (com.atlassian.jira.web.tags.URLTag) _005fjspx_005ftagPool_005fww_005furl_0026_005fvalue_005fatltoken_005fnobody.get(com.atlassian.jira.web.tags.URLTag.class); _jspx_th_ww_005furl_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005furl_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f4); // /secure/views/dashboard/deleteportalpage.jsp(24,41) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005furl_005f0.setValue("'/secure/ConfigurePortalPages!default.jspa'"); // /secure/views/dashboard/deleteportalpage.jsp(24,41) name = atltoken type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005furl_005f0.setAtltoken(false); int _jspx_eval_ww_005furl_005f0 = _jspx_th_ww_005furl_005f0.doStartTag(); if (_jspx_th_ww_005furl_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005furl_0026_005fvalue_005fatltoken_005fnobody.reuse(_jspx_th_ww_005furl_005f0); return true; } _005fjspx_005ftagPool_005fww_005furl_0026_005fvalue_005fatltoken_005fnobody.reuse(_jspx_th_ww_005furl_005f0); return false; } private boolean _jspx_meth_aui_005fcomponent_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f0 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005fvalue_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f0.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(25,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f0.setName("'targetUrl'"); // /secure/views/dashboard/deleteportalpage.jsp(25,8) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f0.setValue("/targetUrl"); // /secure/views/dashboard/deleteportalpage.jsp(25,8) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f0.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(25,8) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f0.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f0 = _jspx_th_aui_005fcomponent_005f0.doStartTag(); if (_jspx_th_aui_005fcomponent_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005fvalue_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f0); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005fvalue_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f0); return false; } private boolean _jspx_meth_aui_005fcomponent_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f1 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f1.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(27,8) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f1.setTemplate("formHeading.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(27,8) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f1.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f1 = _jspx_th_aui_005fcomponent_005f1.doStartTag(); if (_jspx_eval_aui_005fcomponent_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fcomponent_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fcomponent_005f1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fcomponent_005f1.doInitBody(); } do { out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fparam_005f0(_jspx_th_aui_005fcomponent_005f1, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fparam_005f1(_jspx_th_aui_005fcomponent_005f1, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_aui_005fcomponent_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fcomponent_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fcomponent_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.reuse(_jspx_th_aui_005fcomponent_005f1); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.reuse(_jspx_th_aui_005fcomponent_005f1); return false; } private boolean _jspx_meth_aui_005fparam_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fcomponent_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:param webwork.view.taglib.ParamTag _jspx_th_aui_005fparam_005f0 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_aui_005fparam_005f0.setPageContext(_jspx_page_context); _jspx_th_aui_005fparam_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fcomponent_005f1); // /secure/views/dashboard/deleteportalpage.jsp(28,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f0.setName("'text'"); int _jspx_eval_aui_005fparam_005f0 = _jspx_th_aui_005fparam_005f0.doStartTag(); if (_jspx_eval_aui_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fparam_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fparam_005f0.doInitBody(); } do { if (_jspx_meth_ww_005ftext_005f3(_jspx_th_aui_005fparam_005f0, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_aui_005fparam_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fparam_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f0); return true; } _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f0); return false; } private boolean _jspx_meth_ww_005ftext_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fparam_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f3 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f3.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fparam_005f0); // /secure/views/dashboard/deleteportalpage.jsp(28,37) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f3.setName("'portal.deletepage.title'"); int _jspx_eval_ww_005ftext_005f3 = _jspx_th_ww_005ftext_005f3.doStartTag(); if (_jspx_eval_ww_005ftext_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005ftext_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005ftext_005f3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005ftext_005f3.doInitBody(); } do { if (_jspx_meth_ww_005fparam_005f1(_jspx_th_ww_005ftext_005f3, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_ww_005ftext_005f3.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005ftext_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005ftext_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f3); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f3); return false; } private boolean _jspx_meth_ww_005fparam_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005ftext_005f3, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:param webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f1 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_ww_005fparam_005f1.setPageContext(_jspx_page_context); _jspx_th_ww_005fparam_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005ftext_005f3); // /secure/views/dashboard/deleteportalpage.jsp(28,79) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fparam_005f1.setName("'value0'"); int _jspx_eval_ww_005fparam_005f1 = _jspx_th_ww_005fparam_005f1.doStartTag(); if (_jspx_eval_ww_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005fparam_005f1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005fparam_005f1.doInitBody(); } do { if (_jspx_meth_ww_005fproperty_005f3(_jspx_th_ww_005fparam_005f1, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_ww_005fparam_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005fparam_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f1); return true; } _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f1); return false; } private boolean _jspx_meth_ww_005fproperty_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:property webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f3 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class); _jspx_th_ww_005fproperty_005f3.setPageContext(_jspx_page_context); _jspx_th_ww_005fproperty_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f1); // /secure/views/dashboard/deleteportalpage.jsp(28,105) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fproperty_005f3.setValue("pageName"); int _jspx_eval_ww_005fproperty_005f3 = _jspx_th_ww_005fproperty_005f3.doStartTag(); if (_jspx_th_ww_005fproperty_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f3); return true; } _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f3); return false; } private boolean _jspx_meth_aui_005fparam_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fcomponent_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:param webwork.view.taglib.ParamTag _jspx_th_aui_005fparam_005f1 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005faui_005fparam_0026_005fvalue_005fname_005fnobody.get(webwork.view.taglib.ParamTag.class); _jspx_th_aui_005fparam_005f1.setPageContext(_jspx_page_context); _jspx_th_aui_005fparam_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fcomponent_005f1); // /secure/views/dashboard/deleteportalpage.jsp(29,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f1.setName("'escape'"); // /secure/views/dashboard/deleteportalpage.jsp(29,12) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f1.setValue("'false'"); int _jspx_eval_aui_005fparam_005f1 = _jspx_th_aui_005fparam_005f1.doStartTag(); if (_jspx_th_aui_005fparam_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fparam_0026_005fvalue_005fname_005fnobody.reuse(_jspx_th_aui_005fparam_005f1); return true; } _005fjspx_005ftagPool_005faui_005fparam_0026_005fvalue_005fname_005fnobody.reuse(_jspx_th_aui_005fparam_005f1); return false; } private boolean _jspx_meth_aui_005fcomponent_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f2 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f2.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(32,8) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f2.setTemplate("formDescriptionBlock.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(32,8) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f2.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f2 = _jspx_th_aui_005fcomponent_005f2.doStartTag(); if (_jspx_eval_aui_005fcomponent_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fcomponent_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fcomponent_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fcomponent_005f2.doInitBody(); } do { out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fparam_005f2(_jspx_th_aui_005fcomponent_005f2, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_aui_005fcomponent_005f2.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fcomponent_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fcomponent_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.reuse(_jspx_th_aui_005fcomponent_005f2); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.reuse(_jspx_th_aui_005fcomponent_005f2); return false; } private boolean _jspx_meth_aui_005fparam_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fcomponent_005f2, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:param webwork.view.taglib.ParamTag _jspx_th_aui_005fparam_005f2 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_aui_005fparam_005f2.setPageContext(_jspx_page_context); _jspx_th_aui_005fparam_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fcomponent_005f2); // /secure/views/dashboard/deleteportalpage.jsp(33,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f2.setName("'messageHtml'"); int _jspx_eval_aui_005fparam_005f2 = _jspx_th_aui_005fparam_005f2.doStartTag(); if (_jspx_eval_aui_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fparam_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fparam_005f2.doInitBody(); } do { out.write("\n"); out.write(" <p>"); if (_jspx_meth_ww_005ftext_005f4(_jspx_th_aui_005fparam_005f2, _jspx_page_context)) return true; out.write("</p>\n"); out.write(" "); if (_jspx_meth_ww_005fif_005f2(_jspx_th_aui_005fparam_005f2, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_aui_005fparam_005f2.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fparam_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f2); return true; } _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f2); return false; } private boolean _jspx_meth_ww_005ftext_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fparam_005f2, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f4 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f4.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fparam_005f2); // /secure/views/dashboard/deleteportalpage.jsp(34,19) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f4.setName("'portal.deletepage.confirm.desc'"); int _jspx_eval_ww_005ftext_005f4 = _jspx_th_ww_005ftext_005f4.doStartTag(); if (_jspx_th_ww_005ftext_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f4); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f4); return false; } private boolean _jspx_meth_ww_005fif_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fparam_005f2, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:if webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f2 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class); _jspx_th_ww_005fif_005f2.setPageContext(_jspx_page_context); _jspx_th_ww_005fif_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fparam_005f2); // /secure/views/dashboard/deleteportalpage.jsp(35,16) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fif_005f2.setTest("otherFavouriteCount > 0"); int _jspx_eval_ww_005fif_005f2 = _jspx_th_ww_005fif_005f2.doStartTag(); if (_jspx_eval_ww_005fif_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" <p id=\"otherFavouriteCount\">\n"); out.write(" "); if (_jspx_meth_ww_005fif_005f3(_jspx_th_ww_005fif_005f2, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_ww_005felseIf_005f0(_jspx_th_ww_005fif_005f2, _jspx_page_context)) return true; out.write("\n"); out.write(" </p>\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005fif_005f2.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005fif_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f2); return true; } _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f2); return false; } private boolean _jspx_meth_ww_005fif_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f2, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:if webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f3 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class); _jspx_th_ww_005fif_005f3.setPageContext(_jspx_page_context); _jspx_th_ww_005fif_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f2); // /secure/views/dashboard/deleteportalpage.jsp(37,24) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fif_005f3.setTest("otherFavouriteCount == 1"); int _jspx_eval_ww_005fif_005f3 = _jspx_th_ww_005fif_005f3.doStartTag(); if (_jspx_eval_ww_005fif_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" "); if (_jspx_meth_ww_005ftext_005f5(_jspx_th_ww_005fif_005f3, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005fif_005f3.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005fif_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f3); return true; } _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f3); return false; } private boolean _jspx_meth_ww_005ftext_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f3, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f5 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f5.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f3); // /secure/views/dashboard/deleteportalpage.jsp(38,28) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f5.setName("'portal.deletepage.other.favourite.filter.one'"); int _jspx_eval_ww_005ftext_005f5 = _jspx_th_ww_005ftext_005f5.doStartTag(); if (_jspx_th_ww_005ftext_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f5); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f5); return false; } private boolean _jspx_meth_ww_005felseIf_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f2, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:elseIf webwork.view.taglib.ElseIfTag _jspx_th_ww_005felseIf_005f0 = (webwork.view.taglib.ElseIfTag) _005fjspx_005ftagPool_005fww_005felseIf_0026_005ftest.get(webwork.view.taglib.ElseIfTag.class); _jspx_th_ww_005felseIf_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005felseIf_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f2); // /secure/views/dashboard/deleteportalpage.jsp(40,24) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005felseIf_005f0.setTest("otherFavouriteCount > 1"); int _jspx_eval_ww_005felseIf_005f0 = _jspx_th_ww_005felseIf_005f0.doStartTag(); if (_jspx_eval_ww_005felseIf_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" "); if (_jspx_meth_ww_005ftext_005f6(_jspx_th_ww_005felseIf_005f0, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005felseIf_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005felseIf_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005felseIf_0026_005ftest.reuse(_jspx_th_ww_005felseIf_005f0); return true; } _005fjspx_005ftagPool_005fww_005felseIf_0026_005ftest.reuse(_jspx_th_ww_005felseIf_005f0); return false; } private boolean _jspx_meth_ww_005ftext_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005felseIf_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f6 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f6.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005felseIf_005f0); // /secure/views/dashboard/deleteportalpage.jsp(41,28) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f6.setName("'portal.deletepage.other.favourite.filter.many'"); int _jspx_eval_ww_005ftext_005f6 = _jspx_th_ww_005ftext_005f6.doStartTag(); if (_jspx_eval_ww_005ftext_005f6 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005ftext_005f6 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005ftext_005f6.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005ftext_005f6.doInitBody(); } do { out.write("\n"); out.write(" "); if (_jspx_meth_ww_005fparam_005f2(_jspx_th_ww_005ftext_005f6, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005ftext_005f6.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005ftext_005f6 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005ftext_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f6); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f6); return false; } private boolean _jspx_meth_ww_005fparam_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005ftext_005f6, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:param webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f2 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_ww_005fparam_005f2.setPageContext(_jspx_page_context); _jspx_th_ww_005fparam_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005ftext_005f6); // /secure/views/dashboard/deleteportalpage.jsp(42,32) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fparam_005f2.setName("'value0'"); int _jspx_eval_ww_005fparam_005f2 = _jspx_th_ww_005fparam_005f2.doStartTag(); if (_jspx_eval_ww_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005fparam_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005fparam_005f2.doInitBody(); } do { if (_jspx_meth_ww_005fproperty_005f4(_jspx_th_ww_005fparam_005f2, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_ww_005fparam_005f2.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005fparam_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f2); return true; } _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f2); return false; } private boolean _jspx_meth_ww_005fproperty_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f2, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:property webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f4 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class); _jspx_th_ww_005fproperty_005f4.setPageContext(_jspx_page_context); _jspx_th_ww_005fproperty_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f2); // /secure/views/dashboard/deleteportalpage.jsp(42,58) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fproperty_005f4.setValue("otherFavouriteCount"); int _jspx_eval_ww_005fproperty_005f4 = _jspx_th_ww_005fproperty_005f4.doStartTag(); if (_jspx_th_ww_005fproperty_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f4); return true; } _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f4); return false; } private boolean _jspx_meth_aui_005fcomponent_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f3 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f3.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(49,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f3.setName("'searchName'"); // /secure/views/dashboard/deleteportalpage.jsp(49,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f3.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(49,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f3.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f3 = _jspx_th_aui_005fcomponent_005f3.doStartTag(); if (_jspx_th_aui_005fcomponent_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f3); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f3); return false; } private boolean _jspx_meth_aui_005fcomponent_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f4 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f4.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(50,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f4.setName("'searchOwnerUserName'"); // /secure/views/dashboard/deleteportalpage.jsp(50,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f4.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(50,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f4.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f4 = _jspx_th_aui_005fcomponent_005f4.doStartTag(); if (_jspx_th_aui_005fcomponent_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f4); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f4); return false; } private boolean _jspx_meth_aui_005fcomponent_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f5 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f5.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(51,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f5.setName("'sortColumn'"); // /secure/views/dashboard/deleteportalpage.jsp(51,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f5.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(51,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f5.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f5 = _jspx_th_aui_005fcomponent_005f5.doStartTag(); if (_jspx_th_aui_005fcomponent_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f5); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f5); return false; } private boolean _jspx_meth_aui_005fcomponent_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f6 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f6.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(52,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f6.setName("'sortAscending'"); // /secure/views/dashboard/deleteportalpage.jsp(52,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f6.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(52,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f6.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f6 = _jspx_th_aui_005fcomponent_005f6.doStartTag(); if (_jspx_th_aui_005fcomponent_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f6); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f6); return false; } private boolean _jspx_meth_aui_005fcomponent_005f7(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f7 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f7.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f7.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(53,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f7.setName("'pagingOffset'"); // /secure/views/dashboard/deleteportalpage.jsp(53,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f7.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(53,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f7.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f7 = _jspx_th_aui_005fcomponent_005f7.doStartTag(); if (_jspx_th_aui_005fcomponent_005f7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f7); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f7); return false; } private boolean _jspx_meth_aui_005fcomponent_005f8(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f8 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f8.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f8.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(54,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f8.setName("'totalResultCount'"); // /secure/views/dashboard/deleteportalpage.jsp(54,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f8.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(54,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f8.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f8 = _jspx_th_aui_005fcomponent_005f8.doStartTag(); if (_jspx_th_aui_005fcomponent_005f8.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f8); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f8); return false; } private boolean _jspx_meth_aui_005fcomponent_005f9(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f9 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f9.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f9.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(55,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f9.setName("'pageId'"); // /secure/views/dashboard/deleteportalpage.jsp(55,4) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f9.setTemplate("hidden.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(55,4) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f9.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f9 = _jspx_th_aui_005fcomponent_005f9.doStartTag(); if (_jspx_th_aui_005fcomponent_005f9.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f9); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate_005fname_005fnobody.reuse(_jspx_th_aui_005fcomponent_005f9); return false; } private boolean _jspx_meth_ww_005felse_005f1(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:else webwork.view.taglib.ElseTag _jspx_th_ww_005felse_005f1 = (webwork.view.taglib.ElseTag) _005fjspx_005ftagPool_005fww_005felse.get(webwork.view.taglib.ElseTag.class); _jspx_th_ww_005felse_005f1.setPageContext(_jspx_page_context); _jspx_th_ww_005felse_005f1.setParent(null); int _jspx_eval_ww_005felse_005f1 = _jspx_th_ww_005felse_005f1.doStartTag(); if (_jspx_eval_ww_005felse_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" <div class=\"form-body\">\n"); out.write(" <header>\n"); out.write(" <h1>"); if (_jspx_meth_ww_005ftext_005f7(_jspx_th_ww_005felse_005f1, _jspx_page_context)) return true; out.write("</h1>\n"); out.write(" </header>\n"); out.write(" "); if (_jspx_meth_aui_005fcomponent_005f10(_jspx_th_ww_005felse_005f1, _jspx_page_context)) return true; out.write("\n"); out.write(" </div>\n"); int evalDoAfterBody = _jspx_th_ww_005felse_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005felse_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f1); return true; } _005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f1); return false; } private boolean _jspx_meth_ww_005ftext_005f7(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005felse_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f7 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f7.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f7.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005felse_005f1); // /secure/views/dashboard/deleteportalpage.jsp(62,16) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f7.setName("'common.words.error'"); int _jspx_eval_ww_005ftext_005f7 = _jspx_th_ww_005ftext_005f7.doStartTag(); if (_jspx_th_ww_005ftext_005f7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f7); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f7); return false; } private boolean _jspx_meth_aui_005fcomponent_005f10(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005felse_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:component webwork.view.taglib.ui.ComponentTag _jspx_th_aui_005fcomponent_005f10 = (webwork.view.taglib.ui.ComponentTag) _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.get(webwork.view.taglib.ui.ComponentTag.class); _jspx_th_aui_005fcomponent_005f10.setPageContext(_jspx_page_context); _jspx_th_aui_005fcomponent_005f10.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005felse_005f1); // /secure/views/dashboard/deleteportalpage.jsp(64,8) name = template type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f10.setTemplate("auimessage.jsp"); // /secure/views/dashboard/deleteportalpage.jsp(64,8) name = theme type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fcomponent_005f10.setTheme("'aui'"); int _jspx_eval_aui_005fcomponent_005f10 = _jspx_th_aui_005fcomponent_005f10.doStartTag(); if (_jspx_eval_aui_005fcomponent_005f10 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fcomponent_005f10 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fcomponent_005f10.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fcomponent_005f10.doInitBody(); } do { out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fparam_005f3(_jspx_th_aui_005fcomponent_005f10, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fparam_005f4(_jspx_th_aui_005fcomponent_005f10, _jspx_page_context)) return true; out.write("\n"); out.write(" "); if (_jspx_meth_aui_005fparam_005f5(_jspx_th_aui_005fcomponent_005f10, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_aui_005fcomponent_005f10.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fcomponent_005f10 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fcomponent_005f10.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.reuse(_jspx_th_aui_005fcomponent_005f10); return true; } _005fjspx_005ftagPool_005faui_005fcomponent_0026_005ftheme_005ftemplate.reuse(_jspx_th_aui_005fcomponent_005f10); return false; } private boolean _jspx_meth_aui_005fparam_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fcomponent_005f10, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:param webwork.view.taglib.ParamTag _jspx_th_aui_005fparam_005f3 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_aui_005fparam_005f3.setPageContext(_jspx_page_context); _jspx_th_aui_005fparam_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fcomponent_005f10); // /secure/views/dashboard/deleteportalpage.jsp(65,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f3.setName("'messageType'"); int _jspx_eval_aui_005fparam_005f3 = _jspx_th_aui_005fparam_005f3.doStartTag(); if (_jspx_eval_aui_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fparam_005f3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fparam_005f3.doInitBody(); } do { out.write("error"); int evalDoAfterBody = _jspx_th_aui_005fparam_005f3.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fparam_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f3); return true; } _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f3); return false; } private boolean _jspx_meth_aui_005fparam_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fcomponent_005f10, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:param webwork.view.taglib.ParamTag _jspx_th_aui_005fparam_005f4 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_aui_005fparam_005f4.setPageContext(_jspx_page_context); _jspx_th_aui_005fparam_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fcomponent_005f10); // /secure/views/dashboard/deleteportalpage.jsp(66,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f4.setName("'titleText'"); int _jspx_eval_aui_005fparam_005f4 = _jspx_th_aui_005fparam_005f4.doStartTag(); if (_jspx_eval_aui_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fparam_005f4.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fparam_005f4.doInitBody(); } do { if (_jspx_meth_ww_005ftext_005f8(_jspx_th_aui_005fparam_005f4, _jspx_page_context)) return true; int evalDoAfterBody = _jspx_th_aui_005fparam_005f4.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fparam_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f4); return true; } _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f4); return false; } private boolean _jspx_meth_ww_005ftext_005f8(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fparam_005f4, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:text com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f8 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class); _jspx_th_ww_005ftext_005f8.setPageContext(_jspx_page_context); _jspx_th_ww_005ftext_005f8.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fparam_005f4); // /secure/views/dashboard/deleteportalpage.jsp(66,42) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005ftext_005f8.setName("'portal.deletepage.can.not.delete'"); int _jspx_eval_ww_005ftext_005f8 = _jspx_th_ww_005ftext_005f8.doStartTag(); if (_jspx_th_ww_005ftext_005f8.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f8); return true; } _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f8); return false; } private boolean _jspx_meth_aui_005fparam_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fcomponent_005f10, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // aui:param webwork.view.taglib.ParamTag _jspx_th_aui_005fparam_005f5 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class); _jspx_th_aui_005fparam_005f5.setPageContext(_jspx_page_context); _jspx_th_aui_005fparam_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fcomponent_005f10); // /secure/views/dashboard/deleteportalpage.jsp(67,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_aui_005fparam_005f5.setName("'messageHtml'"); int _jspx_eval_aui_005fparam_005f5 = _jspx_th_aui_005fparam_005f5.doStartTag(); if (_jspx_eval_aui_005fparam_005f5 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_aui_005fparam_005f5 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_aui_005fparam_005f5.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_aui_005fparam_005f5.doInitBody(); } do { out.write("\n"); out.write(" "); if (_jspx_meth_ww_005fif_005f4(_jspx_th_aui_005fparam_005f5, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_aui_005fparam_005f5.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_aui_005fparam_005f5 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_aui_005fparam_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f5); return true; } _005fjspx_005ftagPool_005faui_005fparam_0026_005fname.reuse(_jspx_th_aui_005fparam_005f5); return false; } private boolean _jspx_meth_ww_005fif_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_aui_005fparam_005f5, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:if webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f4 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class); _jspx_th_ww_005fif_005f4.setPageContext(_jspx_page_context); _jspx_th_ww_005fif_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_aui_005fparam_005f5); // /secure/views/dashboard/deleteportalpage.jsp(68,16) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fif_005f4.setTest("hasErrorMessages == 'true'"); int _jspx_eval_ww_005fif_005f4 = _jspx_th_ww_005fif_005f4.doStartTag(); if (_jspx_eval_ww_005fif_005f4 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write(" "); if (_jspx_meth_ww_005fiterator_005f0(_jspx_th_ww_005fif_005f4, _jspx_page_context)) return true; out.write("\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005fif_005f4.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_ww_005fif_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f4); return true; } _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f4); return false; } private boolean _jspx_meth_ww_005fiterator_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f4, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:iterator webwork.view.taglib.IteratorTag _jspx_th_ww_005fiterator_005f0 = (webwork.view.taglib.IteratorTag) _005fjspx_005ftagPool_005fww_005fiterator_0026_005fvalue.get(webwork.view.taglib.IteratorTag.class); _jspx_th_ww_005fiterator_005f0.setPageContext(_jspx_page_context); _jspx_th_ww_005fiterator_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f4); // /secure/views/dashboard/deleteportalpage.jsp(69,20) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fiterator_005f0.setValue("flushedErrorMessages"); int _jspx_eval_ww_005fiterator_005f0 = _jspx_th_ww_005fiterator_005f0.doStartTag(); if (_jspx_eval_ww_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_ww_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_ww_005fiterator_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_ww_005fiterator_005f0.doInitBody(); } do { out.write("\n"); out.write(" <p>"); if (_jspx_meth_ww_005fproperty_005f5(_jspx_th_ww_005fiterator_005f0, _jspx_page_context)) return true; out.write("</p>\n"); out.write(" "); int evalDoAfterBody = _jspx_th_ww_005fiterator_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_ww_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_ww_005fiterator_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fiterator_0026_005fvalue.reuse(_jspx_th_ww_005fiterator_005f0); return true; } _005fjspx_005ftagPool_005fww_005fiterator_0026_005fvalue.reuse(_jspx_th_ww_005fiterator_005f0); return false; } private boolean _jspx_meth_ww_005fproperty_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // ww:property webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f5 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class); _jspx_th_ww_005fproperty_005f5.setPageContext(_jspx_page_context); _jspx_th_ww_005fproperty_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fiterator_005f0); // /secure/views/dashboard/deleteportalpage.jsp(70,27) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_ww_005fproperty_005f5.setValue("."); int _jspx_eval_ww_005fproperty_005f5 = _jspx_th_ww_005fproperty_005f5.doStartTag(); if (_jspx_th_ww_005fproperty_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f5); return true; } _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f5); return false; } }
3e18f4211f19a1348882f8092c5e1330dda59d25
237
java
Java
src/main/java/me/jonathing/minecraft/foragecraft/common/block/template/package-info.java
theishiopian/ForageCraft
af839141960a8a56ac96ede744e5deda0f7ec0b7
[ "Apache-2.0" ]
3
2016-10-24T19:28:44.000Z
2017-04-17T21:13:20.000Z
src/main/java/me/jonathing/minecraft/foragecraft/common/block/template/package-info.java
theishiopian/ForageCraft
af839141960a8a56ac96ede744e5deda0f7ec0b7
[ "Apache-2.0" ]
52
2016-10-23T18:54:50.000Z
2019-12-11T02:12:12.000Z
src/main/java/me/jonathing/minecraft/foragecraft/common/block/template/package-info.java
theishiopian/ForageCraft
af839141960a8a56ac96ede744e5deda0f7ec0b7
[ "Apache-2.0" ]
9
2016-10-22T03:23:39.000Z
2019-10-03T15:23:14.000Z
29.625
65
0.894515
10,617
@MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault package me.jonathing.minecraft.foragecraft.common.block.template; import net.minecraft.MethodsReturnNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
3e18f4ccc605958de4e5474c27ca9a13a8632921
394
java
Java
src/main/java/com/xiadiao/fruits/mall/backend/model/Good.java
lanxia/mall_backend
6cd57836842cd7f38cce002608a796944fa1670d
[ "MIT" ]
null
null
null
src/main/java/com/xiadiao/fruits/mall/backend/model/Good.java
lanxia/mall_backend
6cd57836842cd7f38cce002608a796944fa1670d
[ "MIT" ]
null
null
null
src/main/java/com/xiadiao/fruits/mall/backend/model/Good.java
lanxia/mall_backend
6cd57836842cd7f38cce002608a796944fa1670d
[ "MIT" ]
null
null
null
15.76
46
0.725888
10,618
package com.xiadiao.fruits.mall.backend.model; @lombok.Data public class Good { private String uuid; private String productId; private String productName; private String productMsg; private String sub_title; private String productImageSmall; private String productImageBig; private Long stock; private Long salePrice; private Long limit_num; }
3e18f513db3ba4af8616152cd829f6926a0f106e
1,432
java
Java
src/main/java/com/microsoft/store/partnercenter/models/subscriptions/SupportContact.java
epinter/Partner-Center-Java
4a05288ec99477f45b34f21cb8a7f0044c8caa10
[ "MIT" ]
null
null
null
src/main/java/com/microsoft/store/partnercenter/models/subscriptions/SupportContact.java
epinter/Partner-Center-Java
4a05288ec99477f45b34f21cb8a7f0044c8caa10
[ "MIT" ]
null
null
null
src/main/java/com/microsoft/store/partnercenter/models/subscriptions/SupportContact.java
epinter/Partner-Center-Java
4a05288ec99477f45b34f21cb8a7f0044c8caa10
[ "MIT" ]
null
null
null
23.096774
74
0.59148
10,619
// ----------------------------------------------------------------------- // <copyright file="SupportContact.java" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> // ----------------------------------------------------------------------- package com.microsoft.store.partnercenter.models.subscriptions; import com.microsoft.store.partnercenter.models.ResourceBaseWithLinks; import com.microsoft.store.partnercenter.models.StandardResourceLinks; /** *Represents a form of support contact for a customer's subscription. */ public class SupportContact extends ResourceBaseWithLinks<StandardResourceLinks> { /** * Gets or sets the support tenant id. */ private String __SupportTenantId; public String getSupportTenantId() { return __SupportTenantId; } public void setSupportTenantId( String value ) { __SupportTenantId = value; } /** * Gets or sets the support MPN id. */ private String __SupportMpnId; public String getSupportMpnId() { return __SupportMpnId; } public void setSupportMpnId( String value ) { __SupportMpnId = value; } /** * Gets or sets the name. */ private String __Name; public String getName() { return __Name; } public void setName( String value ) { __Name = value; } }
3e18f68e88a952e028d6d16431a3992f3ada94b1
3,694
java
Java
src/core/src/main/java/org/apache/jmeter/gui/action/Remove.java
Chromico/jmeter
f4d93f32624f5574e43db4e171f96c56d7e8f22d
[ "Apache-2.0" ]
6,160
2015-01-03T00:03:36.000Z
2022-03-31T03:07:12.000Z
src/core/src/main/java/org/apache/jmeter/gui/action/Remove.java
Chromico/jmeter
f4d93f32624f5574e43db4e171f96c56d7e8f22d
[ "Apache-2.0" ]
439
2015-01-26T15:30:59.000Z
2022-03-30T01:30:39.000Z
src/core/src/main/java/org/apache/jmeter/gui/action/Remove.java
Chromico/jmeter
f4d93f32624f5574e43db4e171f96c56d7e8f22d
[ "Apache-2.0" ]
2,009
2015-01-04T13:59:25.000Z
2022-03-30T14:47:28.000Z
37.693878
124
0.680022
10,620
/* * 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.jmeter.gui.action; import java.awt.event.ActionEvent; import java.util.HashSet; import java.util.Set; import javax.swing.JOptionPane; import javax.swing.tree.TreePath; import org.apache.jmeter.gui.GuiPackage; import org.apache.jmeter.gui.tree.JMeterTreeNode; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.util.JMeterUtils; /** * Implements the Remove menu item. */ public class Remove extends AbstractAction { private static final Set<String> commands = new HashSet<>(); // Whether to skip the delete confirmation dialogue private static final boolean SKIP_CONFIRM = JMeterUtils.getPropDefault("confirm.delete.skip", false); // $NON-NLS-1$ static { commands.add(ActionNames.REMOVE); } /** * Constructor for the Remove object */ public Remove() { } /** * Gets the ActionNames attribute of the Remove object. * * @return the ActionNames value */ @Override public Set<String> getActionNames() { return commands; } @Override public void doAction(ActionEvent e) { int isConfirm = SKIP_CONFIRM ? JOptionPane.YES_OPTION : JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(), JMeterUtils.getResString("remove_confirm_msg"),// $NON-NLS-1$ JMeterUtils.getResString("remove_confirm_title"), // $NON-NLS-1$ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (isConfirm == JOptionPane.YES_OPTION) { // TODO - removes the nodes from the CheckDirty map - should it be done later, in case some can't be removed? ActionRouter.getInstance().actionPerformed(new ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_REMOVE)); GuiPackage guiPackage = GuiPackage.getInstance(); JMeterTreeNode[] nodes = guiPackage.getTreeListener().getSelectedNodes(); TreePath newTreePath = // Save parent node for later guiPackage.getTreeListener().removedSelectedNode(); for (int i = nodes.length - 1; i >= 0; i--) { removeNode(nodes[i]); } guiPackage.getTreeListener().getJTree().setSelectionPath(newTreePath); guiPackage.updateCurrentGui(); } } private static void removeNode(JMeterTreeNode node) { TestElement testElement = node.getTestElement(); if (testElement.canRemove()) { GuiPackage.getInstance().getTreeModel().removeNodeFromParent(node); GuiPackage.getInstance().removeNode(testElement); testElement.removed(); } else { String message = testElement.getClass().getName() + " is busy"; JOptionPane.showMessageDialog(null, message, "Cannot remove item", JOptionPane.ERROR_MESSAGE); } } }
3e18f759ae8932d68ad14ebd4ab4df7495186474
2,183
java
Java
mymall-ware/src/main/java/com/ljc/mymall/ware/controller/WareInfoController.java
lp980915/mymall
a36f4015371fd72e08b39c72d02e20612cd5a415
[ "Apache-2.0" ]
null
null
null
mymall-ware/src/main/java/com/ljc/mymall/ware/controller/WareInfoController.java
lp980915/mymall
a36f4015371fd72e08b39c72d02e20612cd5a415
[ "Apache-2.0" ]
5
2020-07-20T12:42:22.000Z
2022-02-10T22:14:55.000Z
mymall-ware/src/main/java/com/ljc/mymall/ware/controller/WareInfoController.java
lp980915/mymall
a36f4015371fd72e08b39c72d02e20612cd5a415
[ "Apache-2.0" ]
null
null
null
24.010989
63
0.687872
10,621
package com.ljc.mymall.ware.controller; import java.util.Arrays; import java.util.Map; //import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.ljc.mymall.ware.entity.WareInfoEntity; import com.ljc.mymall.ware.service.WareInfoService; import com.ljc.common.utils.PageUtils; import com.ljc.common.utils.R; /** * 仓库信息 * * @author ljc * @email efpyi@example.com * @date 2020-05-02 16:15:28 */ @RestController @RequestMapping("ware/wareinfo") public class WareInfoController { @Autowired private WareInfoService wareInfoService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("ware:wareinfo:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = wareInfoService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") // @RequiresPermissions("ware:wareinfo:info") public R info(@PathVariable("id") Long id){ WareInfoEntity wareInfo = wareInfoService.getById(id); return R.ok().put("wareInfo", wareInfo); } /** * 保存 */ @RequestMapping("/save") // @RequiresPermissions("ware:wareinfo:save") public R save(@RequestBody WareInfoEntity wareInfo){ wareInfoService.save(wareInfo); return R.ok(); } /** * 修改 */ @RequestMapping("/update") // @RequiresPermissions("ware:wareinfo:update") public R update(@RequestBody WareInfoEntity wareInfo){ wareInfoService.updateById(wareInfo); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("ware:wareinfo:delete") public R delete(@RequestBody Long[] ids){ wareInfoService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
3e18f7a33f3303bbf75c226960e50c7e51f8938b
772
java
Java
libs/javassist/src/test/test4/NestedClass.java
123099/QuestJobs
fe5e83e399ef9e151e2ac1cd56491c2a126dc8e9
[ "MIT" ]
null
null
null
libs/javassist/src/test/test4/NestedClass.java
123099/QuestJobs
fe5e83e399ef9e151e2ac1cd56491c2a126dc8e9
[ "MIT" ]
null
null
null
libs/javassist/src/test/test4/NestedClass.java
123099/QuestJobs
fe5e83e399ef9e151e2ac1cd56491c2a126dc8e9
[ "MIT" ]
null
null
null
25.733333
68
0.453368
10,622
package test4; public class NestedClass { public S.S2 s2; public class N { public String toString() { return "N"; } } public static class S { public String toString() { return "S"; } public static class S2 { public String toString() { return "S2"; } } } public Object foo() { class In { public String toString() { return "S"; } public String toString2() { return new S().toString(); } } return new Object() { public String toString() { return new Object() { public String toString() { return "ok"; } }.toString(); } }; } }
3e18f7e99d6dcb1f317f208b7c326e821afa5db5
1,048
java
Java
src/main/java/com/belladati/sdk/dataset/AttributeType.java
BellaDati/belladati-sdk-api
9742d92dddabd40f7ba00799463ff13a51300d25
[ "Apache-2.0" ]
1
2015-10-09T09:18:16.000Z
2015-10-09T09:18:16.000Z
src/main/java/com/belladati/sdk/dataset/AttributeType.java
BellaDati/belladati-sdk-api
9742d92dddabd40f7ba00799463ff13a51300d25
[ "Apache-2.0" ]
1
2021-12-09T20:17:07.000Z
2021-12-09T20:17:07.000Z
src/main/java/com/belladati/sdk/dataset/AttributeType.java
BellaDati/belladati-sdk-api
9742d92dddabd40f7ba00799463ff13a51300d25
[ "Apache-2.0" ]
null
null
null
25.560976
78
0.706107
10,623
package com.belladati.sdk.dataset; /** * Indicates the type of an attribute. Provides information of what content to * expect from the attribute. * * @author Chris Hennigfeld */ public enum AttributeType { /** A textual attribute. No semantic meaning is attached to the value. */ TEXT("string"), /** An attribute indicating a date. */ DATE("date"), /** An attribute indicating a time. */ TIME("time"), /** An attribute indicating geographical coordinates. */ GEO_POINT("point"); private final String jsonType; private AttributeType(String jsonType) { this.jsonType = jsonType; } /** * Returns the attribute type matching the given string type from JSON. This * method is used by the SDK internally. * * @param jsonType string type from JSON * @return the attribute type matching the given string type from JSON */ public static AttributeType valueOfJson(String jsonType) { for (AttributeType type : values()) { if (type.jsonType.equalsIgnoreCase(jsonType)) { return type; } } return null; } }
3e18f8f9e5e3e9af872172be0b983b5f2ba93779
208
java
Java
api/src/main/java/com/puc/sistemasdevendas/model/entities/PatchOrderRequest.java
leoee/sistema-de-vendas
0c003bbba67c139b4afdf07111085d11d36e7474
[ "MIT" ]
null
null
null
api/src/main/java/com/puc/sistemasdevendas/model/entities/PatchOrderRequest.java
leoee/sistema-de-vendas
0c003bbba67c139b4afdf07111085d11d36e7474
[ "MIT" ]
null
null
null
api/src/main/java/com/puc/sistemasdevendas/model/entities/PatchOrderRequest.java
leoee/sistema-de-vendas
0c003bbba67c139b4afdf07111085d11d36e7474
[ "MIT" ]
null
null
null
17.333333
48
0.793269
10,624
package com.puc.sistemasdevendas.model.entities; import lombok.Data; import javax.validation.constraints.NotNull; @Data public class PatchOrderRequest { @NotNull private OrderStatus orderStatus; }
3e18fa8598bf931f1d9d925efc475a203aecf0af
142
java
Java
src/com/twu/service/UserService.java
trepolus/twu-biblioteca-lucas
8fffaf5f161799fa0a1aa33656db7345e0fc9f19
[ "Apache-1.1" ]
null
null
null
src/com/twu/service/UserService.java
trepolus/twu-biblioteca-lucas
8fffaf5f161799fa0a1aa33656db7345e0fc9f19
[ "Apache-1.1" ]
null
null
null
src/com/twu/service/UserService.java
trepolus/twu-biblioteca-lucas
8fffaf5f161799fa0a1aa33656db7345e0fc9f19
[ "Apache-1.1" ]
null
null
null
15.777778
50
0.760563
10,625
package com.twu.service; import com.twu.entities.User; public interface UserService { User login(String libraryId, String password); }
3e18fb88cf9e7695562a444ca9944f1e42b1c362
9,281
java
Java
src/main/java/tv/floe/metronome/deeplearning/neuralnetwork/optimize/VectorizedBackTrackLineSearch.java
jpatanooga/Metronome
c9889484eb081329f185dea416779cfeef3bf402
[ "Apache-2.0" ]
33
2015-01-18T19:16:48.000Z
2021-09-05T14:30:16.000Z
src/main/java/tv/floe/metronome/deeplearning/neuralnetwork/optimize/VectorizedBackTrackLineSearch.java
jpatanooga/Metronome
c9889484eb081329f185dea416779cfeef3bf402
[ "Apache-2.0" ]
1
2015-02-16T16:43:06.000Z
2015-02-16T16:47:09.000Z
src/main/java/tv/floe/metronome/deeplearning/neuralnetwork/optimize/VectorizedBackTrackLineSearch.java
jpatanooga/Metronome
c9889484eb081329f185dea416779cfeef3bf402
[ "Apache-2.0" ]
12
2015-01-15T09:08:05.000Z
2020-11-11T06:44:32.000Z
33.157143
166
0.647458
10,626
package tv.floe.metronome.deeplearning.neuralnetwork.optimize; /* Copyright (C) 2002 Univ. of Massachusetts Amherst, Computer Science Dept. This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit). http://www.cs.umass.edu/~mccallum/mallet This software is provided under the terms of the Common Public License, version 1.0, as published by http://www.opensource.org. For further information, see the file `LICENSE' included with this distribution. */ /** @author Aron Culotta <a href="mailto:dycjh@example.com"upchh@example.com.edu</a> @author Adam Gibson Adapted from mallet with original authors above. Modified to be a vectorized version that uses jblas matrices for computation rather than the mallet ops. */ /** Numerical Recipes in C: p.385. lnsrch. A simple backtracking line search. No attempt at accurately finding the true minimum is made. The goal is only to ensure that BackTrackLineSearch will return a position of higher value. */ import java.util.logging.Level; import org.apache.commons.math3.util.FastMath; import org.apache.mahout.math.DenseMatrix; import org.apache.mahout.math.Matrix; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tv.floe.metronome.math.ArrayUtils; import tv.floe.metronome.math.MathUtils; import tv.floe.metronome.math.MatrixUtils; import cc.mallet.optimize.InvalidOptimizableException; //"Line Searches and Backtracking", p385, "Numeric Recipes in C" public class VectorizedBackTrackLineSearch implements LineOptimizerMatrix { private static Logger logger = LoggerFactory.getLogger(VectorizedBackTrackLineSearch.class.getName()); OptimizableByGradientValueMatrix function; public VectorizedBackTrackLineSearch (OptimizableByGradientValueMatrix optimizable) { this.function = optimizable; } final int maxIterations = 100; final double stpmax = 100; final double EPS = 3.0e-12; // termination conditions: either // a) abs(delta x/x) < REL_TOLX for all coordinates // b) abs(delta x) < ABS_TOLX for all coordinates // c) sufficient function increase (uses ALF) private double relTolx = 1e-10; private double absTolx = 1e-4; // tolerance on absolute value difference final double ALF = 1e-4; /** * Sets the tolerance of relative diff in function value. * Line search converges if <tt>abs(delta x / x) < tolx</tt> * for all coordinates. */ public void setRelTolx (double tolx) { relTolx = tolx; } /** * Sets the tolerance of absolute diff in function value. * Line search converges if <tt>abs(delta x) < tolx</tt> * for all coordinates. */ public void setAbsTolx (double tolx) { absTolx = tolx; } // initialStep is ignored. This is b/c if the initial step is not 1.0, // it sometimes confuses the backtracking for reasons I don't // understand. (That is, the jump gets LARGER on iteration 1.) // returns fraction of step size (alam) if found a good step // returns 0.0 if could not step in direction public double optimize (Matrix line, double initialStep) { Matrix g, x, oldParameters; double slope, test, alamin, alam, alam2, tmplam; double rhs1, rhs2, a, b, disc, oldAlam; double f, fold, f2; g = function.getValueGradient(); // gradient x = function.getParameters(); // parameters //oldParameters = x.dup(); oldParameters = x.clone(); alam2 = tmplam = 0.0; f2 = fold = function.getValue(); /* if (logger.isDebugEnabled()) { logger.debug ("ENTERING BACKTRACK\n"); logger.debug("Entering BackTrackLnSrch, value="+fold+",\ndirection.oneNorm:" + line.norm1() + " direction.infNorm:"+ FastMath.max(Double.NEGATIVE_INFINITY,MatrixFunctions.abs(line).max())); } */ if (logger.isDebugEnabled()) { logger.debug ("ENTERING BACKTRACK\n"); logger.debug("Entering BackTrackLnSrch, value="+fold+",\ndirection.oneNorm:" + MathUtils.norm1( line ) + " direction.infNorm:"+ FastMath.max(Double.NEGATIVE_INFINITY, MatrixUtils.max( MatrixUtils.abs(line) ) )); } //assert (!MatrixUtil.isNaN(g)); assert( !MatrixUtils.isNaN( g ) ); //double sum = line.norm2(); double sum = MathUtils.norm2( line ); if(sum > stpmax) { logger.warn("attempted step too big. scaling: sum= " + sum + ", stpmax= "+ stpmax); //line.muli(stpmax / sum); line = line.times( stpmax / sum ); } //dot product //slope = SimpleBlas.dot(g, line); slope = MathUtils.rdot( MatrixUtils.length( g ), ArrayUtils.flatten( MatrixUtils.fromMatrix(g) ), 0, 1, ArrayUtils.flatten( MatrixUtils.fromMatrix( line ) ), 0, 1); logger.debug("slope = " + slope); if (slope < 0) { throw new InvalidOptimizableException ("Slope = " + slope + " is negative"); } if (slope == 0) { throw new InvalidOptimizableException ("Slope = " + slope + " is zero"); } // find maximum lambda // converge when (delta x) / x < REL_TOLX for all coordinates. // the largest step size that triggers this threshold is // precomputed and saved in alamin Matrix maxOldParams = new DenseMatrix( oldParameters.numRows(), oldParameters.numCols() ); for (int i = 0; i < oldParameters.numRows(); i++) { for (int c = 0; c < oldParameters.numCols(); c++) { //maxOldParams.put(i,Math.max(Math.abs(oldParameters.get(i)), 1.0)); maxOldParams.set( i, c, Math.max( Math.abs( oldParameters.get( i, c ) ), 1.0 ) ); } } //DoubleMatrix testMatrix = MatrixFunctions.abs(line).div(maxOldParams); Matrix testMatrix = MatrixUtils.div( MatrixUtils.abs( line ), maxOldParams ); //test = testMatrix.max(); test = MatrixUtils.max(testMatrix); alamin = relTolx / test; alam = 1.0; oldAlam = 0.0; int iteration = 0; // look for step size in direction given by "line" for (iteration = 0; iteration < maxIterations; iteration++) { // x = oldParameters + alam*line // initially, alam = 1.0, i.e. take full Newton step logger.debug("BackTrack loop iteration " + iteration +" : alam="+ alam+" oldAlam="+oldAlam); logger.debug ("before step, x.1norm: " + MathUtils.norm1(x) + "\nalam: " + alam + "\noldAlam: " + oldAlam); assert(alam != oldAlam) : "alam == oldAlam"; //x.addi(line.mul(alam - oldAlam)); // step MatrixUtils.addi( x, line.times(alam - oldAlam) ); logger.debug ("after step, x.1norm: " + MathUtils.norm1(x) ); // check for convergence //convergence on delta x if ((alam < alamin) || smallAbsDiff (oldParameters, x)) { // if ((alam < alamin)) { function.setParameters(oldParameters); f = function.getValue(); logger.warn("EXITING BACKTRACK: Jump too small (alamin="+ alamin + "). Exiting and using xold. Value="+f); return 0.0; } function.setParameters(x); oldAlam = alam; f = function.getValue(); logger.debug("value = " + f); // sufficient function increase (Wolf condition) if(f >= fold + ALF * alam * slope) { logger.debug("EXITING BACKTRACK: value="+f); if (f<fold) throw new IllegalStateException ("Function did not increase: f=" + f + " < " + fold + "=fold"); return alam; } // if value is infinite, i.e. we've // jumped to unstable territory, then scale down jump else if(Double.isInfinite(f) || Double.isInfinite(f2)) { logger.warn ("Value is infinite after jump " + oldAlam + ". f="+f+", f2="+f2+". Scaling back step size..."); tmplam = .2 * alam; if(alam < alamin) { //convergence on delta x function.setParameters(oldParameters); f = function.getValue(); logger.warn("EXITING BACKTRACK: Jump too small. Exiting and using xold. Value="+f); return 0.0; } } else { // backtrack if(alam == 1.0) // first time through tmplam = -slope / (2.0 * ( f - fold - slope )); else { rhs1 = f - fold- alam * slope; rhs2 = f2 - fold - alam2 * slope; assert((alam - alam2) != 0): "FAILURE: dividing by alam-alam2. alam="+alam; a = ( rhs1 / (FastMath.pow(alam, 2)) - rhs2 / ( FastMath.pow(alam2, 2) )) / (alam-alam2); b = ( -alam2* rhs1/( alam* alam ) + alam * rhs2 / ( alam2 * alam2 )) / ( alam - alam2); if(a == 0.0) tmplam = -slope / (2.0 * b); else { disc = b * b - 3.0 * a * slope; if(disc < 0.0) { tmplam = .5 * alam; } else if (b <= 0.0) tmplam = (-b + FastMath.sqrt(disc))/(3.0 * a ); else tmplam = -slope / (b + FastMath.sqrt(disc)); } if (tmplam > .5 * alam) tmplam = .5 * alam; // lambda <= .5 lambda_1 } } alam2 = alam; f2 = f; logger.debug("tmplam:" + tmplam); alam = Math.max(tmplam, .1*alam); // lambda >= .1*Lambda_1 } if(iteration >= maxIterations) throw new IllegalStateException ("Too many iterations."); return 0.0; } // returns true iff we've converged based on absolute x difference private boolean smallAbsDiff (Matrix x, Matrix xold) { //for (int i = 0; i < x.length; i++) { for (int i = 0; i < MatrixUtils.length( x ); i++) { //double comp = Math.abs( x.get(i) - xold.get(i) ); double comp = Math.abs( MatrixUtils.getElement( x, i ) - MatrixUtils.getElement( xold, i ) ); if ( comp > absTolx) { return false; } } return true; } }
3e18fb9d7ae0cc9352bb6f5e0cadbfc3f7490b5c
8,999
java
Java
netreflected/microsoft_azure_cosmos_3_25_0_0/src/net6.0/microsoft.azure.cosmos.client_version_3.25.0.0_culture_neutral_publickeytoken_31bf3856ad364e35/microsoft/azure/cosmos/ThroughputProperties.java
masesdevelopers/NuReflector
bf25df84c211e66821a503d4588ab22c99e26c7f
[ "MIT" ]
null
null
null
netreflected/microsoft_azure_cosmos_3_25_0_0/src/net6.0/microsoft.azure.cosmos.client_version_3.25.0.0_culture_neutral_publickeytoken_31bf3856ad364e35/microsoft/azure/cosmos/ThroughputProperties.java
masesdevelopers/NuReflector
bf25df84c211e66821a503d4588ab22c99e26c7f
[ "MIT" ]
7
2021-11-14T02:18:03.000Z
2022-03-30T17:38:29.000Z
netreflected/microsoft_azure_cosmos_3_25_0_0/src/net6.0/microsoft.azure.cosmos.client_version_3.25.0.0_culture_neutral_publickeytoken_31bf3856ad364e35/microsoft/azure/cosmos/ThroughputProperties.java
masesdevelopers/NuReflector
bf25df84c211e66821a503d4588ab22c99e26c7f
[ "MIT" ]
1
2021-11-16T00:08:00.000Z
2021-11-16T00:08:00.000Z
40.536036
452
0.67752
10,627
/* * MIT License * * Copyright (c) 2022 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package microsoft.azure.cosmos; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section import microsoft.azure.cosmos.ThroughputProperties; /** * The base .NET class managing Microsoft.Azure.Cosmos.ThroughputProperties, Microsoft.Azure.Cosmos.Client, Version=3.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/Microsoft.Azure.Cosmos.ThroughputProperties" target="_top">https://docs.microsoft.com/en-us/dotnet/api/Microsoft.Azure.Cosmos.ThroughputProperties</a> */ public class ThroughputProperties extends NetObject { /** * Fully assembly qualified name: Microsoft.Azure.Cosmos.Client, Version=3.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 */ public static final String assemblyFullName = "Microsoft.Azure.Cosmos.Client, Version=3.25.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; /** * Assembly name: Microsoft.Azure.Cosmos.Client */ public static final String assemblyShortName = "Microsoft.Azure.Cosmos.Client"; /** * Qualified class name: Microsoft.Azure.Cosmos.ThroughputProperties */ public static final String className = "Microsoft.Azure.Cosmos.ThroughputProperties"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { String classToCreate = className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); if (JCOReflector.getDebug()) JCOReflector.writeLog("Creating %s", classToCreate); JCType typeCreated = bridge.GetType(classToCreate); if (JCOReflector.getDebug()) JCOReflector.writeLog("Created: %s", (typeCreated != null) ? typeCreated.toString() : "Returned null value"); return typeCreated; } catch (JCException e) { JCOReflector.writeLog(e); return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } /** * Internal constructor. Use with caution */ public ThroughputProperties(java.lang.Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public java.lang.Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link ThroughputProperties}, a cast assert is made to check if types are compatible. * @param from {@link IJCOBridgeReflected} instance to be casted * @return {@link ThroughputProperties} instance * @throws java.lang.Throwable in case of error during cast operation */ public static ThroughputProperties cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new ThroughputProperties(from.getJCOInstance()); } // Constructors section public ThroughputProperties() throws Throwable { } // Methods section public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objCreateAutoscaleThroughput = (JCObject)classType.Invoke("CreateAutoscaleThroughput", autoscaleMaxThroughput); return new ThroughputProperties(objCreateAutoscaleThroughput); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static ThroughputProperties CreateManualThroughput(int throughput) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objCreateManualThroughput = (JCObject)classType.Invoke("CreateManualThroughput", throughput); return new ThroughputProperties(objCreateManualThroughput); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Properties section public java.lang.String getETag() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Get("ETag"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setETag(java.lang.String ETag) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("ETag", ETag); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String getSelfLink() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Get("SelfLink"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setSelfLink(java.lang.String SelfLink) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("SelfLink", SelfLink); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }
3e18fbf3a9020cbe947df147d0da16175f1a51b8
2,080
java
Java
object-mother/src/main/java/com/iluwatar/objectmother/Queen.java
awesome-startup/java-design-patterns
c94c8a3e74799c5dc83bd90d98669ad697e1087b
[ "MIT" ]
2
2018-12-20T17:46:01.000Z
2021-06-30T18:44:12.000Z
object-mother/src/main/java/com/iluwatar/objectmother/Queen.java
whysqwhw/java-design-patterns
faa29f8025f6fb90472dacb6e8ad8569605f8d61
[ "MIT" ]
1
2022-01-21T23:48:24.000Z
2022-01-21T23:48:24.000Z
object-mother/src/main/java/com/iluwatar/objectmother/Queen.java
whysqwhw/java-design-patterns
faa29f8025f6fb90472dacb6e8ad8569605f8d61
[ "MIT" ]
3
2017-06-13T01:46:09.000Z
2017-06-15T08:32:31.000Z
29.714286
80
0.713942
10,628
/** * The MIT License * Copyright (c) 2016 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.iluwatar.objectmother; public class Queen implements Royalty { private boolean isDrunk = false; private boolean isHappy = false; private boolean isFlirty = false; @Override public void makeDrunk() { isDrunk = true; } @Override public void makeSober() { isDrunk = false; } @Override public void makeHappy() { isHappy = true; } @Override public void makeUnhappy() { isHappy = false; } public boolean isFlirty() { return isFlirty; } public void setFlirtiness(boolean flirtiness) { this.isFlirty = flirtiness; } /** * Method which is called when the king is flirting to a queen. * @param king King who initialized the flirt. * @return A value which describes if the flirt was successful or not. */ public boolean getFlirted(King king) { if (this.isFlirty && king.isHappy && !king.isDrunk) { return true; } return false; } }
3e18fc1e5faca756227b9bc1405d08812507b484
2,078
java
Java
core/src/test/java/io/questdb/griffin/engine/functions/math/DivLongFunctionFactoryTest.java
halilertekin/questdb
1d7417c2e066a8a6fac16d76b3e85b335acb1b6a
[ "Apache-2.0" ]
8,451
2019-11-18T10:25:08.000Z
2022-03-31T16:13:52.000Z
core/src/test/java/io/questdb/griffin/engine/functions/math/DivLongFunctionFactoryTest.java
halilertekin/questdb
1d7417c2e066a8a6fac16d76b3e85b335acb1b6a
[ "Apache-2.0" ]
1,278
2019-11-18T11:31:17.000Z
2022-03-31T21:34:49.000Z
core/src/test/java/io/questdb/griffin/engine/functions/math/DivLongFunctionFactoryTest.java
halilertekin/questdb
1d7417c2e066a8a6fac16d76b3e85b335acb1b6a
[ "Apache-2.0" ]
493
2019-11-18T11:19:29.000Z
2022-03-29T18:21:12.000Z
32.984127
80
0.613571
10,629
/******************************************************************************* * ___ _ ____ ____ * / _ \ _ _ ___ ___| |_| _ \| __ ) * | | | | | | |/ _ \/ __| __| | | | _ \ * | |_| | |_| | __/\__ \ |_| |_| | |_) | * \__\_\\__,_|\___||___/\__|____/|____/ * * Copyright (c) 2014-2019 Appsicle * Copyright (c) 2019-2020 QuestDB * * 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 io.questdb.griffin.engine.functions.math; import io.questdb.griffin.FunctionFactory; import io.questdb.griffin.SqlException; import io.questdb.griffin.engine.AbstractFunctionFactoryTest; import io.questdb.std.Numbers; import org.junit.Test; public class DivLongFunctionFactoryTest extends AbstractFunctionFactoryTest { @Test public void testDivByZero() throws SqlException { call(24L, 0L).andAssert(Numbers.LONG_NaN); } @Test public void testLeftNan() throws SqlException { call(Numbers.LONG_NaN, 5L).andAssert(Numbers.LONG_NaN); } @Test public void testNegative() throws SqlException { call(-12L, 4L).andAssert(-3L); } @Test public void testRightNan() throws SqlException { call(123L, Numbers.LONG_NaN).andAssert(Numbers.LONG_NaN); } @Test public void testSimple() throws SqlException { call(24L, 8L).andAssert(3L); } @Override protected FunctionFactory getFunctionFactory() { return new DivLongFunctionFactory(); } }
3e18fc34544bacb426e407f58409d105dc95033d
1,321
java
Java
camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationProducers.java
heiko-braun/camel-k-runtime
3976b334f42583cb4f29cc087e168478e3e5b91c
[ "Apache-2.0" ]
46
2019-02-25T09:32:58.000Z
2022-01-30T08:11:18.000Z
camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationProducers.java
heiko-braun/camel-k-runtime
3976b334f42583cb4f29cc087e168478e3e5b91c
[ "Apache-2.0" ]
343
2019-02-22T18:00:10.000Z
2022-03-28T12:25:49.000Z
camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationProducers.java
christophd/camel-k-runtime
e4012e682cbeadae9a5dbe7a10451720bff9c22b
[ "Apache-2.0" ]
43
2019-02-20T12:58:29.000Z
2022-03-21T07:14:43.000Z
32.219512
75
0.747161
10,630
/* * 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.camel.k.quarkus; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; import javax.inject.Singleton; import io.quarkus.arc.Unremovable; import org.apache.camel.k.Runtime; @ApplicationScoped public class ApplicationProducers { private volatile Runtime runtime; public void setRuntime(Runtime runtime) { this.runtime = runtime; } @Unremovable @Singleton @Produces Runtime runtime() { return this.runtime; } }
3e18fc55ac4276a50873f1693c4e8b19db19e125
13,648
java
Java
src/main/java/com/gmail/chibitopoochan/soqlui/initializer/parts/ButtonPartsInitializer.java
chibitopoochan/soqlui
70acd2e5ab2f39a90c7fb270108e280a33c94bba
[ "MIT" ]
null
null
null
src/main/java/com/gmail/chibitopoochan/soqlui/initializer/parts/ButtonPartsInitializer.java
chibitopoochan/soqlui
70acd2e5ab2f39a90c7fb270108e280a33c94bba
[ "MIT" ]
6
2019-10-26T06:38:02.000Z
2020-03-08T16:41:56.000Z
src/main/java/com/gmail/chibitopoochan/soqlui/initializer/parts/ButtonPartsInitializer.java
mametochoko/soqlui
70acd2e5ab2f39a90c7fb270108e280a33c94bba
[ "MIT" ]
null
null
null
32.495238
123
0.724355
10,631
package com.gmail.chibitopoochan.soqlui.initializer.parts; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.Arrays; import java.util.Calendar; import java.util.List; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import org.slf4j.Logger; import com.gmail.chibitopoochan.soqlexec.soql.QueryAnalyzeUtils; import com.gmail.chibitopoochan.soqlexec.soql.QueryAnalyzeUtils.TokenException; import com.gmail.chibitopoochan.soqlexec.soql.SOQL; import com.gmail.chibitopoochan.soqlexec.soql.SOQLField; import com.gmail.chibitopoochan.soqlui.SceneManager; import com.gmail.chibitopoochan.soqlui.config.ApplicationSettingSet; import com.gmail.chibitopoochan.soqlui.controller.MainController; import com.gmail.chibitopoochan.soqlui.logic.ConnectionLogic; import com.gmail.chibitopoochan.soqlui.logic.ConnectionSettingLogic; import com.gmail.chibitopoochan.soqlui.model.DescribeField; import com.gmail.chibitopoochan.soqlui.model.DescribeSObject; import com.gmail.chibitopoochan.soqlui.service.ConnectService; import com.gmail.chibitopoochan.soqlui.service.ExportService; import com.gmail.chibitopoochan.soqlui.service.SOQLExecuteService; import com.gmail.chibitopoochan.soqlui.util.DialogUtils; import com.gmail.chibitopoochan.soqlui.util.LogUtils; import com.sforce.ws.ConnectionException; import javafx.beans.property.StringProperty; import javafx.collections.ObservableList; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.control.ProgressIndicator; import javafx.scene.control.TextArea; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCodeCombination; import javafx.scene.input.KeyEvent; import javafx.scene.text.Font; import javafx.scene.web.WebView; import javafx.stage.FileChooser; import javafx.stage.FileChooser.ExtensionFilter; public class ButtonPartsInitializer implements PartsInitializer<MainController>{ // クラス共通の参照 private static final boolean USE_ADVANCE_SOQL = ApplicationSettingSet.getInstance().getSetting().isAdvanceQuery(); private static final boolean USE_EDITOR = ApplicationSettingSet.getInstance().getSetting().isUseEditor(); private static final Logger logger = LogUtils.getLogger(ButtonPartsInitializer.class); private static final Pattern BIND_PATTERN = Pattern.compile(":[a-zA-Z]+"); private static final KeyCodeCombination ZOOM_IN = new KeyCodeCombination(KeyCode.I, KeyCodeCombination.CONTROL_DOWN); private static final KeyCodeCombination ZOOM_OUT = new KeyCodeCombination(KeyCode.O, KeyCodeCombination.CONTROL_DOWN); private static final KeyCodeCombination EXECUTE = new KeyCodeCombination(KeyCode.ENTER, KeyCodeCombination.CONTROL_DOWN); private static final KeyCodeCombination IMAGE_COPY = new KeyCodeCombination(KeyCode.P, KeyCodeCombination.CONTROL_DOWN); private ConnectionSettingLogic setting; private Button connect; private Button disconnect; private Button execute; private Button export; private ComboBox<String> connectOption; private ConnectService connector; private SOQLExecuteService executor; private ProgressIndicator progressIndicator; private ExportService exportor; private ProgressBar progressBar; private Label progressText; private Button cancel; private TextArea soqlArea; private StringProperty actualSOQL; private WebView soqlWebArea; private CheckBox useTooling; private StringProperty baseFileName; private Optional<File> exportHistory = Optional.empty(); private ObservableList<DescribeSObject> objectList; private ObservableList<String> soqlList; private ConnectionLogic logic; @Override public void setController(MainController controller) { this.setting = controller.getSetting(); this.connect = controller.getConnect(); this.disconnect = controller.getDisconnect(); this.connectOption = controller.getConnectOption(); this.connector = controller.getConnectService(); this.executor = controller.getExecutionService(); this.progressIndicator = controller.getProgressIndicator(); this.execute = controller.getExecute(); this.export = controller.getExport(); this.exportor = controller.getExportService(); this.progressBar = controller.getProgressBar(); this.progressText = controller.getProgressText(); this.cancel = controller.getCancel(); this.soqlArea = controller.getSoqlArea(); this.actualSOQL = controller.actualSOQL(); this.objectList = controller.getObjectMasterList(); this.soqlList = controller.getExecSoqlList(); this.logic = controller.getConnectService().getConnectionLogic(); this.soqlWebArea = controller.getSoqlWebArea(); this.useTooling = controller.getUseTooling(); this.baseFileName = controller.getExecSoqlBaseName(); } public void initialize() { // 接続情報関連の設定 if(setting.hasSetting()) { logger.debug("Connection Button Enabled"); connect.setDisable(false); disconnect.setDisable(true); connectOption.setDisable(false); } else { logger.debug("Connection Button Disabled"); connect.setDisable(true); disconnect.setDisable(true); connectOption.setDisable(true); } connect.setOnAction(e -> doConnect()); disconnect.setOnAction(e -> doDisconnect()); execute.setOnAction(e -> doExecute()); export.setOnAction(e -> doExport()); cancel.setOnAction(e -> doCancel()); soqlArea.setOnKeyPressed(this::keyPressed); soqlWebArea.setOnKeyPressed(this::keyPressed); } /** * 処理のキャンセル */ public void doCancel() { if(executor.isRunning()) { executor.cancel(); } else if (exportor.isRunning()) { exportor.cancel(); } } /** * 切断イベント */ public void doDisconnect() { // 変数をバインド progressIndicator.progressProperty().unbind(); progressIndicator.visibleProperty().unbind(); progressIndicator.progressProperty().bind(connector.progressProperty()); progressIndicator.visibleProperty().bind(connector.runningProperty()); // 切断を開始 connector.setClosing(true); connector.start(); } /** * 拡張SOQLを実際のSOQLに変換 */ private void convertToActualSOQL() { String soql = soqlArea.getText(); if(USE_ADVANCE_SOQL) { SOQL query; try { query = QueryAnalyzeUtils.analyze(soql); convertByWildcard(query); bindVariable(query); soql = query.toString(); } catch (TokenException | ConnectionException e) { soql = convertByID(soql); } } actualSOQL.set(soql); } private void convertByWildcard(SOQL soql) throws ConnectionException { List<SOQLField> fields = soql.getSelectFields(); // "*"1文字なら継続 if(fields.size() != 1) return; if(!fields.get(0).getLabel().equals("*")) return; // "*"を削除し、オブジェクトの項目を追加 List<DescribeField> fieldList = logic.getFieldList(soql.getFromObject()); soql.getSelectFields().clear(); fieldList.stream().map(f -> new SOQLField(f.getName())).forEach(e -> soql.getSelectFields().add(e)); } /** * IDからレコードを取得するSOQLを作成 * @param soql ID * @return SOQL * @throws ConnectionException */ private String convertByID(String soql){ // 対象とならない場合、処理を終了 if(soql.toLowerCase().contains("select") || soql.length() < 3) return soql; // KeyPrefixからオブジェクトを特定 String keyPrefix = soql.substring(0,3); Optional<DescribeSObject> result = objectList.stream().filter(o -> keyPrefix.equals(o.getKeyPrefix())).findFirst(); if(!result.isPresent()) return soql; // オブジェクトから項目を特定 DescribeSObject obj = result.get(); List<DescribeField> fieldList; try { fieldList = logic.getFieldList(obj.getName()); } catch (ConnectionException e) { e.printStackTrace(); return soql; } // SOQLを構築 SOQL query = new SOQL(); fieldList.forEach(f -> query.addSelectField(new SOQLField(f.getName()))); query.setWhere(String.format("id = '%s'",soql.trim())); return query.toString(); } private void bindVariable(SOQL query) { // SOQLからバインド変数を抽出 Matcher bindMatcher = BIND_PATTERN.matcher(query.getWhere()); // SOQLを再構築 StringBuffer whereCaluse = new StringBuffer(); while(bindMatcher.find()) { // バインド変数の入力 Optional<String> result = DialogUtils.showMultiLineDialog(bindMatcher.group()); // SOQLの組み換え result.ifPresent(r -> { List<String> varList = Arrays.asList(r.split("\n")); String replaceText = varList.stream().map(v -> String.format("'%s'",v )).collect(Collectors.joining(",")); replaceText = varList.size() > 1 ? String.format("(%s)", replaceText) : replaceText; bindMatcher.appendReplacement(whereCaluse, replaceText); }); } bindMatcher.appendTail(whereCaluse); query.setWhere(whereCaluse.toString()); } /** * SOQLを実行 */ public void doExecute() { convertToActualSOQL(); progressBar.progressProperty().unbind(); progressBar.progressProperty().bind(executor.progressProperty()); progressBar.visibleProperty().unbind(); progressBar.visibleProperty().bind(executor.runningProperty()); progressText.textProperty().unbind(); progressText.textProperty().bind(executor.messageProperty()); cancel.setDisable(false); export.setDisable(true); execute.setDisable(true); executor.start(); } /** * ショートカットキー * @param e キーイベント */ private void keyPressed(KeyEvent e) { if(USE_EDITOR) { if(ZOOM_IN.match(e)) soqlWebArea.getEngine().executeScript("zoomIn()"); if(ZOOM_OUT.match(e)) soqlWebArea.getEngine().executeScript("zoomOut()"); if(IMAGE_COPY.match(e)) { ClipboardContent content = new ClipboardContent(); content.putImage(soqlWebArea.snapshot(null, null)); Clipboard.getSystemClipboard().setContent(content); } if(EXECUTE.match(e) && !connector.isClosing()) { soqlWebArea.getOnMouseExited().handle(null); doExecute(); } } else { Font font = soqlArea.getFont(); if(ZOOM_IN.match(e)) soqlArea.setFont(Font.font(font.getFamily(), font.getSize()+1)); if(ZOOM_OUT.match(e)) soqlArea.setFont(Font.font(font.getFamily(), font.getSize()-1)); if(IMAGE_COPY.match(e)) { ClipboardContent content = new ClipboardContent(); content.putImage(soqlArea.snapshot(null, null)); Clipboard.getSystemClipboard().setContent(content); } if(EXECUTE.match(e) && !connector.isClosing()) doExecute(); } } public void doExport() { // HTML形式からテキスト形式に変換 convertToActualSOQL(); // 変数をバインド progressBar.progressProperty().unbind(); progressBar.visibleProperty().unbind(); progressText.textProperty().unbind(); progressBar.progressProperty().bind(exportor.progressProperty()); progressBar.visibleProperty().bind(exportor.runningProperty()); progressText.textProperty().bind(exportor.messageProperty()); // ボタンを制御 cancel.setDisable(false); export.setDisable(true); execute.setDisable(true); // ダイアログの準備 FileChooser chooser = new FileChooser(); chooser.setTitle("Data Export"); chooser.getExtensionFilters().add(new ExtensionFilter("CSV Format", "csv")); exportHistory.ifPresent(value -> { chooser.setInitialDirectory(value.getParentFile()); chooser.setInitialFileName(value.getName()); }); // ファイルの取得(キャンセルなら終了) File saveFile = chooser.showSaveDialog(SceneManager.getInstance().getStageStack().peek().unwrap()); exportHistory = Optional.ofNullable(saveFile); if(!exportHistory.isPresent()) { cancel.setDisable(true); export.setDisable(false); execute.setDisable(false); return; } // 既存ファイル削除 if(saveFile.exists()) { saveFile.delete(); } // 連続実行の前処理 saveFile = splitExportSOQL(saveFile); // エクスポートの開始 try { saveFile.createNewFile(); exportor.setExportPath(saveFile.toPath()); exportor.start(); } catch (IOException e) { e.printStackTrace(); } } /** * 連続実行の前処理 */ private File splitExportSOQL(File saveFile) { File newSaveFile = saveFile; if(USE_ADVANCE_SOQL) { // SOQLの分割 String soql = actualSOQL.getValue(); String[] list = soql.split("\n/\n"); soqlList.clear(); soqlList.addAll(list); soql = soqlList.remove(0); actualSOQL.setValue(soql); // ファイル名の修正 if(!soqlList.isEmpty()){ Path path = saveFile.toPath(); String fileName = path.getFileName().toString(); if(fileName.endsWith(".csv")) { fileName = fileName.substring(0, fileName.length()-".csv".length()); } baseFileName.setValue(fileName); fileName = String.format("%s-%2$tY%2$tm%2$td%2$tH%2$tM%2$tS.csv",fileName, Calendar.getInstance().getTime()); newSaveFile = path.resolveSibling(fileName).toFile(); } } return newSaveFile; } /** * 接続イベント */ public void doConnect() { // 変数をバインド progressIndicator.progressProperty().unbind(); progressIndicator.visibleProperty().unbind(); progressIndicator.progressProperty().bind(connector.progressProperty()); progressIndicator.visibleProperty().bind(connector.runningProperty()); // 接続を開始 String selected = connectOption.getValue(); connector.setConnectionSetting(setting.getConnectionSetting(selected)); connector.setClosing(false); connector.useTooling().bind(useTooling.selectedProperty()); connector.start(); connect.setDisable(true); // 接続名を保存 setting.setSelectedName(selected); } }
3e18fcb5e3e912d3a1a52c5e5a27c7d18ea5b785
1,730
java
Java
main/plugins/org.talend.cwm.mip/src/orgomg/cwm/management/warehouseprocess/events/CalendarDate.java
dmytro-sylaiev/tcommon-studio-se
b75fadfb9bd1a42897073fe2984f1d4fb42555bd
[ "Apache-2.0" ]
75
2015-01-29T03:23:32.000Z
2022-02-26T07:05:40.000Z
main/plugins/org.talend.cwm.mip/src/orgomg/cwm/management/warehouseprocess/events/CalendarDate.java
dmytro-sylaiev/tcommon-studio-se
b75fadfb9bd1a42897073fe2984f1d4fb42555bd
[ "Apache-2.0" ]
813
2015-01-21T09:36:31.000Z
2022-03-30T01:15:29.000Z
main/plugins/org.talend.cwm.mip/src/orgomg/cwm/management/warehouseprocess/events/CalendarDate.java
dmytro-sylaiev/tcommon-studio-se
b75fadfb9bd1a42897073fe2984f1d4fb42555bd
[ "Apache-2.0" ]
272
2015-01-08T06:47:46.000Z
2022-02-09T23:22:27.000Z
31.454545
147
0.643353
10,632
/** * <copyright> </copyright> * * $Id$ */ package orgomg.cwm.management.warehouseprocess.events; import orgomg.cwm.objectmodel.core.ModelElement; /** * <!-- begin-user-doc --> A representation of the model object ' * <em><b>Calendar Date</b></em>'. <!-- end-user-doc --> * * <!-- begin-model-doc --> * An entry in a CustomCalendar representing a specific date and time. * <!-- end-model-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link orgomg.cwm.management.warehouseprocess.events.CalendarDate#getSpecificDate <em>Specific Date</em>}</li> * </ul> * </p> * * @see orgomg.cwm.management.warehouseprocess.events.EventsPackage#getCalendarDate() * @model * @generated */ public interface CalendarDate extends ModelElement { /** * Returns the value of the '<em><b>Specific Date</b></em>' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> <!-- begin-model-doc --> The * value of the date. <!-- end-model-doc --> * * @return the value of the '<em>Specific Date</em>' attribute. * @see #setSpecificDate(String) * @see orgomg.cwm.management.warehouseprocess.events.EventsPackage#getCalendarDate_SpecificDate() * @model dataType="orgomg.cwm.objectmodel.core.Time" * @generated */ String getSpecificDate(); /** * Sets the value of the '{@link orgomg.cwm.management.warehouseprocess.events.CalendarDate#getSpecificDate <em>Specific Date</em>}' attribute. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @param value the new value of the '<em>Specific Date</em>' attribute. * @see #getSpecificDate() * @generated */ void setSpecificDate(String value); } // CalendarDate
3e18fce7c42563cfc678b25544a0a641c6cfb4cd
1,237
java
Java
jeets-clients/jeets-player/src/main/java/java8/timeapi/ChronoUnits.java
kbeigl/jeets
73d560e6f3dc297d071f3785ce82495296c9d24c
[ "Apache-2.0" ]
2
2019-01-12T20:21:25.000Z
2020-02-27T16:10:01.000Z
jeets-clients/jeets-player/src/main/java/java8/timeapi/ChronoUnits.java
kbeigl/jeets
73d560e6f3dc297d071f3785ce82495296c9d24c
[ "Apache-2.0" ]
3
2018-07-29T10:52:31.000Z
2020-08-31T09:54:51.000Z
jeets-clients/jeets-player/src/main/java/java8/timeapi/ChronoUnits.java
kbeigl/jeets
73d560e6f3dc297d071f3785ce82495296c9d24c
[ "Apache-2.0" ]
1
2019-01-12T19:32:09.000Z
2019-01-12T19:32:09.000Z
30.925
79
0.64996
10,633
package java8.timeapi; import java.time.LocalDate; import java.time.temporal.ChronoUnit; /** * java.time.temporal.ChronoUnit enum is added in Java 8 * to replace the integer values used in old API to represent day, month, etc. */ public class ChronoUnits { public static void main(String args[]){ ChronoUnits java8tester = new ChronoUnits(); java8tester.testChromoUnits(); } public void testChromoUnits(){ //Get the current date LocalDate today = LocalDate.now(); System.out.println("Current date: " + today); //add 1 week to the current date LocalDate nextWeek = today.plus(1, ChronoUnit.WEEKS); System.out.println("Next week: " + nextWeek); //add 1 month to the current date LocalDate nextMonth = today.plus(1, ChronoUnit.MONTHS); System.out.println("Next month: " + nextMonth); //add 1 year to the current date LocalDate nextYear = today.plus(1, ChronoUnit.YEARS); System.out.println("Next year: " + nextYear); //add 10 years to the current date LocalDate nextDecade = today.plus(1, ChronoUnit.DECADES); System.out.println("Date after ten year: " + nextDecade); } }
3e18fdfa17904b9a6ecb424e869aaa850f17fea3
253
java
Java
stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java
tedliUCAS/omnidata-spark-connector
877a21a03920c389ab3006c6e3e34c5d6b41491a
[ "Apache-2.0" ]
null
null
null
stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java
tedliUCAS/omnidata-spark-connector
877a21a03920c389ab3006c6e3e34c5d6b41491a
[ "Apache-2.0" ]
30
2021-09-27T11:12:57.000Z
2022-03-07T07:48:06.000Z
stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java
tedliUCAS/omnidata-spark-connector
877a21a03920c389ab3006c6e3e34c5d6b41491a
[ "Apache-2.0" ]
13
2021-09-22T07:09:33.000Z
2022-03-03T02:32:42.000Z
18.071429
78
0.711462
10,634
/* * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. */ package com.huawei.boostkit.omnidata.decode.type; /** * Long To Byte decode * * @since 2021-08-26 */ public class LongToByteDecodeType implements DecodeType { }
3e18fe8ade11d4181f9588fe5cc5973d914661c9
1,675
java
Java
api/src/main/java/org/iton/messenger/api/TLUpdatesCombined.java
ITON-Solutions/messenger-server
2dd14a37413540fe297903a7dc08190e72a09055
[ "MIT" ]
1
2018-06-25T00:07:19.000Z
2018-06-25T00:07:19.000Z
api/src/main/java/org/iton/messenger/api/TLUpdatesCombined.java
ITON-Solutions/messenger-server
2dd14a37413540fe297903a7dc08190e72a09055
[ "MIT" ]
null
null
null
api/src/main/java/org/iton/messenger/api/TLUpdatesCombined.java
ITON-Solutions/messenger-server
2dd14a37413540fe297903a7dc08190e72a09055
[ "MIT" ]
null
null
null
29.385965
134
0.653731
10,635
package org.iton.messenger.api; import io.netty.buffer.ByteBuf; import org.iton.messenger.api.updates.Updates; import org.iton.messenger.core.TLContext; import org.iton.messenger.core.TLVector; import java.io.IOException; import static org.iton.messenger.core.utils.StreamingUtils.*; public class TLUpdatesCombined extends Updates { public static final int CLASS_ID = 0x725b04c3; public TLUpdatesCombined() { } public TLUpdatesCombined(TLVector<Update> updates, TLVector<User> users, TLVector<Chat> chats, int date, int seq_start, int seq) { this.updates = updates; this.users = users; this.chats = chats; this.date = date; this.seq_start = seq_start; this.seq = seq; } @Override public int getClassId() { return CLASS_ID; } @Override public void serializeBody(ByteBuf stream) throws IOException { writeTLVector(this.updates, stream); writeTLVector(this.users, stream); writeTLVector(this.chats, stream); writeInt(this.date, stream); writeInt(this.seq_start, stream); writeInt(this.seq, stream); } @Override public void deserializeBody(ByteBuf stream, TLContext context) throws IOException { this.updates = readTLVector(stream, context); this.users = readTLVector(stream, context); this.chats = readTLVector(stream, context); this.date = readInt(stream); this.seq_start = readInt(stream); this.seq = readInt(stream); } @Override public String toString() { return "updatesCombined#725b04c3"; } }
3e18ff14d668aeeb7b7a065b3cdb41c57ff5150b
4,454
java
Java
src/test/java/org/dnal/compiler/core/GeneratorTests.java
ianrae/dnallang
8bf627210708c15df5ee6e139cbc58603a39466b
[ "MIT" ]
6
2017-05-23T10:25:20.000Z
2017-05-26T09:07:06.000Z
src/test/java/org/dnal/compiler/core/GeneratorTests.java
ianrae/dnal-lang
8bf627210708c15df5ee6e139cbc58603a39466b
[ "MIT" ]
null
null
null
src/test/java/org/dnal/compiler/core/GeneratorTests.java
ianrae/dnal-lang
8bf627210708c15df5ee6e139cbc58603a39466b
[ "MIT" ]
null
null
null
32.510949
105
0.663673
10,636
package org.dnal.compiler.core; import static org.junit.Assert.assertEquals; import java.util.List; import org.dnal.compiler.dnalgenerate.ASTToDNALGenerator; import org.dnal.compiler.generate.DNALGeneratePhase; import org.dnal.compiler.generate.SimpleFormatOutputGenerator; import org.dnal.compiler.parser.FullParser; import org.dnal.compiler.parser.ast.Exp; import org.dnal.core.DTypeRegistry; import org.junit.Test; public class GeneratorTests extends BaseTest { @Test public void test1() { chkGen("type Foo boolean end", "type:Foo:boolean|endtype|"); chkGen("type Foo int end", "type:Foo:int|endtype|"); chkGen("type Foo long end", "type:Foo:long|endtype|"); chkGen("type Foo string end", "type:Foo:string|endtype|"); } @Test public void testRules() { chkGen("type X int > 0, < 5 end", "type:X:int| r: > 0| r: < 5|endtype|"); } @Test public void testStruct() { chkGen("type Foo struct { } end", "type:Foo:struct|endtype|"); chkGen("type Foo struct { x int, y string } end", "type:Foo:struct| x:int| y:string|endtype|"); } @Test public void testEnum() { chkGen("type Foo enum { } end", "type:Foo:enum|endtype|"); chkGen("type Foo enum { RED, BLUE } end", "type:Foo:enum| RED:string| BLUE:string|endtype|"); } @Test public void testList() { chkGen("type Foo list<int> end", "type:Foo:list<int>|endtype|"); // chkGen("type Foo enum { RED BLUE } end", "type:Foo:enum| RED:string| BLUE:string|endtype|"); } @Test public void testVal() { chkGen("type Foo boolean end let x Foo = true", "type:Foo:boolean|endtype|value:x:Foo:true|", 2); chkGen("type Foo int end let x Foo = 54", "type:Foo:int|endtype|value:x:Foo:54|", 2); chkGen("type Foo string end let x Foo = 'abc'", "type:Foo:string|endtype|value:x:Foo:abc|", 2); } @Test public void testStructVal() { String s1 = "type:Foo:struct| x:int| y:int|endtype|"; String s2 = "value:x:Foo {| vx:10| vy:11|}|"; chkGen("type Foo struct { x int, y int } end let x Foo = { 10, 11 }", s1 + s2, 2); } @Test public void testStructValOptional() { String s1 = "type:Foo:struct| x:int| y:int|endtype|"; String s2 = "value:x:Foo {| vx:10| vy:11|}|"; chkGen("type Foo struct { x int optional, y int } end let x Foo = { 10, 11 }", s1 + s2, 2); } @Test public void testStructValOptional2() { String s1 = "type:Foo:struct| x:int| y:int|endtype|"; String s2 = "value:x:Foo {| vx:null| vy:11|}|"; chkGen("type Foo struct { x int optional, y int } end let x Foo = { null, 11 }", s1 + s2, 2); } @Test public void testStructValOptional2a() { String s1 = "type:Foo:struct| x:int| y:int|endtype|"; String s2 = "value:x:Foo {| vx:null| vy:11|}|"; chkGen("type Foo struct { x int optional, y int } end let x Foo = { x:null, y:11 }", s1 + s2, 2); } @Test public void testListVal() { String s1 = "type:Foo:list<int>|endtype|"; String s2 = "value:x:Foo [| 10| 11|]|"; chkGen("type Foo list<int> end let x Foo = [ 10, 11]", s1 + s2, 2); } private void chkGen(String input, String expectedOutput) { chkGen(input, expectedOutput, 1); } private void chkGen(String input, String expectedOutput, int expectedSize) { ASTToDNALGenerator dnalGenerator = parseAndGenDVals(input, expectedSize); DTypeRegistry registry = getContext().registry; DNALGeneratePhase phase = new DNALGeneratePhase(getContext().et, registry, getContext().world, null); SimpleFormatOutputGenerator visitor = new SimpleFormatOutputGenerator(); boolean b = phase.generateTypes(visitor); assertEquals(true, b); String output = flatten(visitor.outputL); log("outputTypes: " + output); b = phase.generateValues(visitor); assertEquals(true, b); String output2 = flatten(visitor.outputL); log("outputValues: " + output2); assertEquals(expectedOutput, output2); } private ASTToDNALGenerator parseAndGenDVals(String input, int expectedSize) { log("doing: " + input); List<Exp> list = FullParser.fullParse(input); assertEquals(expectedSize, list.size()); ASTToDNALGenerator generator = createASTGenerator(); boolean b = generator.generate(list); assertEquals(true, b); return generator; } private String flatten(List<String> L) { StringBuffer sb = new StringBuffer(); for(String s: L) { sb.append(s); sb.append("|"); } return sb.toString(); } private void log(String s) { System.out.println(s); } }
3e18ff709a84044e3e701dd720ce2ae1e7e46f9f
864
java
Java
src/main/java/com/defano/hypertalk/ast/model/Destination.java
Msimoneau/wyldcard
08bedf1b06399739414150a40187dd6d7e266d21
[ "MIT" ]
null
null
null
src/main/java/com/defano/hypertalk/ast/model/Destination.java
Msimoneau/wyldcard
08bedf1b06399739414150a40187dd6d7e266d21
[ "MIT" ]
null
null
null
src/main/java/com/defano/hypertalk/ast/model/Destination.java
Msimoneau/wyldcard
08bedf1b06399739414150a40187dd6d7e266d21
[ "MIT" ]
null
null
null
22.736842
66
0.618056
10,637
package com.defano.hypertalk.ast.model; import com.defano.wyldcard.parts.stack.StackModel; import java.util.Objects; public class Destination { private final StackModel stack; private final int cardId; public Destination(StackModel stackModel, int cardIndex) { this.stack = stackModel; this.cardId = cardIndex; } public StackModel getStack() { return stack; } public int getCardId() { return cardId; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Destination that = (Destination) o; return cardId == that.cardId && Objects.equals(stack, that.stack); } @Override public int hashCode() { return Objects.hash(stack, cardId); } }
3e1900b3da41ac039566ecef54e6e718bd26b888
447
java
Java
src/main/java/cn/teamscorpio/trouble/annotation/HttpTrouble.java
TeamScorpio/trouble
9f415e521d46fa335c9407a2f21f18a6004235cb
[ "MIT" ]
null
null
null
src/main/java/cn/teamscorpio/trouble/annotation/HttpTrouble.java
TeamScorpio/trouble
9f415e521d46fa335c9407a2f21f18a6004235cb
[ "MIT" ]
null
null
null
src/main/java/cn/teamscorpio/trouble/annotation/HttpTrouble.java
TeamScorpio/trouble
9f415e521d46fa335c9407a2f21f18a6004235cb
[ "MIT" ]
null
null
null
21.285714
46
0.787472
10,638
package cn.teamscorpio.trouble.annotation; import org.springframework.http.HttpStatus; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author TeamScorpio * @since 2021/01/27 */ @Target({ElementType.TYPE, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface HttpTrouble { HttpStatus status(); }
3e1902b8b8c50af3fb9fd844c235c4050a9498e0
2,758
java
Java
modules/framework/src/main/java/io/cattle/platform/object/defaults/JsonDefaultsProvider.java
vharsh/cattle2
c66574233f48b4237bf3c2f0d2fa9591ff4d9ed6
[ "Apache-2.0" ]
null
null
null
modules/framework/src/main/java/io/cattle/platform/object/defaults/JsonDefaultsProvider.java
vharsh/cattle2
c66574233f48b4237bf3c2f0d2fa9591ff4d9ed6
[ "Apache-2.0" ]
3
2017-05-09T01:54:22.000Z
2017-05-09T01:54:33.000Z
modules/framework/src/main/java/io/cattle/platform/object/defaults/JsonDefaultsProvider.java
cjellick/cattle
6d89876caf6cb7cbff354efd44f48baa11fffbf0
[ "Apache-2.0" ]
null
null
null
34.049383
133
0.607687
10,639
package io.cattle.platform.object.defaults; import io.cattle.platform.json.JsonMapper; import io.cattle.platform.object.ObjectDefaultsProvider; import io.github.ibuildthecloud.gdapi.factory.SchemaFactory; import io.github.ibuildthecloud.gdapi.model.Schema; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class JsonDefaultsProvider implements ObjectDefaultsProvider { private static final Logger log = LoggerFactory.getLogger(JsonDefaultsProvider.class); SchemaFactory schemaFactory; JsonMapper jsonMapper; String defaultPath; String defaultOverridePath; Map<Class<?>, Map<String, Object>> defaults = new HashMap<>(); public JsonDefaultsProvider(SchemaFactory schemaFactory, JsonMapper jsonMapper, String defaultPath, String defaultOverridePath) { super(); this.schemaFactory = schemaFactory; this.jsonMapper = jsonMapper; this.defaultPath = defaultPath; this.defaultOverridePath = defaultOverridePath; } @Override public Map<? extends Class<?>, ? extends Map<String, Object>> getDefaults() { return defaults; } public void start() { for (Schema schema : schemaFactory.listSchemas()) { Class<?> clz = schemaFactory.getSchemaClass(schema.getId()); if (clz == null) continue; InputStream is = null; try { is = jsonFile(defaultOverridePath, schema); if (is == null) { is = jsonFile(defaultPath, schema); } if (is != null) { @SuppressWarnings("unchecked") Map<String, Object> defaults = jsonMapper.readValue(is, Map.class); Map<String, Object> existing = this.defaults.get(clz); if (existing != null) { existing.putAll(defaults); defaults = existing; } this.defaults.put(clz, defaults); } } catch (IOException e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(is); } } } protected InputStream jsonFile(String prefix, Schema schema) { String path = String.format("%s/%s.json", prefix, schema.getId()); InputStream is = schema.getClass().getClassLoader().getResourceAsStream(path); if (is != null) { log.info("Loading defaults for type [{}] from [{}]", schema.getId(), path); } return is; } }