blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
564d98949f69b5c5be333ca6e6478f373306a160 | 78904c200568ce8adb08b8c3a328c2a4d6d7d4b2 | /fcf-security/fcf-security-core/src/main/java/org/fujionclinical/security/FCFAuthenticationDetails.java | efcaf6389318ddc12e74f9caac0123543128ec93 | [
"LicenseRef-scancode-fujion-exception-to-apache-2.0"
] | permissive | fujionclinical/fujion-clinical-framework | 9ab5682be96feed6caae8e2cb6a03b052d0f812d | 686b4ff4704f6c2c83305dc59c66d4a6b37037fa | refs/heads/master | 2023-08-09T03:45:13.565855 | 2023-07-05T19:37:25 | 2023-07-05T19:37:25 | 140,986,953 | 1 | 0 | null | 2023-07-31T21:20:08 | 2018-07-15T00:25:59 | Java | UTF-8 | Java | false | false | 2,735 | java | /*
* #%L
* Fujion Clinical Framework
* %%
* Copyright (C) 2020 fujionclinical.org
* %%
* 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 Source Code Form is also subject to the terms of the Health-Related
* Additional Disclaimer of Warranty and Limitation of Liability available at
*
* http://www.fujionclinical.org/licensing/disclaimer
*
* #L%
*/
package org.fujionclinical.security;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* Extends the stock Spring web authentication details class by adding the ability to add arbitrary
* detail objects to it.
*/
public class FCFAuthenticationDetails extends WebAuthenticationDetails {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(FCFAuthenticationDetails.class);
public static final String ATTR_USER = "user";
private final Map<String, Object> details = new HashMap<>();
public FCFAuthenticationDetails(HttpServletRequest request) {
super(request);
}
/**
* Sets the specified detail element to the specified value.
*
* @param name Name of the detail element.
* @param value Value for the detail element. A null value removes any existing detail element.
*/
public void setDetail(String name, Object value) {
if (value == null) {
details.remove(name);
} else {
details.put(name, value);
}
if (log.isDebugEnabled()) {
if (value == null) {
log.debug("Detail removed: " + name);
} else {
log.debug("Detail added: " + name + " = " + value);
}
}
}
/**
* Returns the specified detail element.
*
* @param name Name of the detail element.
* @return Value of the detail element, or null if not found.
*/
public Object getDetail(String name) {
return name == null ? null : details.get(name);
}
}
| [
"mdgeek1@gmail.com"
] | mdgeek1@gmail.com |
46f9569003950f59fdbd114c62aa850c4a02b89d | 335a3b7e5a4a545c51b75c71239f3b6705a2b14c | /UIDemo/UiDemo/src/com/irun/sm/ui/demo/ui/DragGridViewActivity.java | e969180c187316d38f9523967c90f7e5aa1159f1 | [] | no_license | mrrichardli/study | ff9e65e37e2fd6bcbcd87eab2fd96a870905340c | 80cb7042867b4b18b6b09aa23a3c99f9a7a17049 | refs/heads/master | 2020-12-25T16:14:00.293230 | 2014-01-02T06:25:58 | 2014-01-02T06:25:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,389 | java | package com.irun.sm.ui.demo.ui;
import java.util.ArrayList;
import java.util.List;
import com.irun.sm.ui.demo.view.DragGridView;
import com.irun.sm.ui.demo.view.DragGridView.DropViewListener;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.Toast;
/***
* @author huangsm
* @date 2012-7-20
* @email huangsanm@gmail.com
* @desc 拖拽的activity
*/
public class DragGridViewActivity extends Activity implements DropViewListener {
private Context mContext;
private DragGridView mDragGrid;
private DragGridAdapter mDragGridAdapter;
private List<Integer> mThumbs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.drag_gridview);
mContext = this;
mThumbs = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
if(i % 2 == 0)
mThumbs.add(R.drawable.ic_launcher_biz);
if(i % 3 == 0)
mThumbs.add(R.drawable.ic_launcher);
}
mDragGridAdapter = new DragGridAdapter(mThumbs);
mDragGrid = (DragGridView) findViewById(R.id.drag_gridview);
mDragGrid.setAdapter(mDragGridAdapter);
mDragGrid.setDropViewListener(this);
}
class DragGridAdapter extends BaseAdapter {
private List<Integer> list;
public DragGridAdapter(List<Integer> lt){
list = lt;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = LayoutInflater.from(mContext).inflate(R.layout.gridview_item, null);
ImageView iv = (ImageView) view.findViewById(R.id.imageview);
iv.setImageResource(list.get(position));
return view;
}
private void insert(int position, Integer items){
list.remove(items);
list.add(position, items);
}
}
@Override
public void drog(int from, int to) {
Toast.makeText(mContext, from + ":" + to, Toast.LENGTH_LONG).show();
mDragGridAdapter.insert(to, (Integer)mDragGridAdapter.getItem(from));
mDragGridAdapter.notifyDataSetChanged();
}
}
| [
"tianshanxuester@gmail.com"
] | tianshanxuester@gmail.com |
a049d6739a3dbd897c5cea8431e238ae3c912b7e | 37db0f0f74455e3794cf418865669106b2c2858a | /src/main/java/tamaized/voidscape/entity/EntityNullServant.java | 43bf8cb6880276ee1c36de9862cbcefa14c81093 | [] | no_license | Tamaized/Voidscape | 9a19fcd1bd195a3e4df3fd601d9da8dd5b53a662 | cdd4df5d468235007f2203bf7027b5be4a463d13 | refs/heads/1.18 | 2023-07-10T05:39:43.343094 | 2022-06-20T23:25:49 | 2022-06-20T23:25:49 | 240,576,836 | 7 | 3 | null | 2022-06-16T15:10:18 | 2020-02-14T18:46:26 | Java | UTF-8 | Java | false | false | 4,431 | java | package tamaized.voidscape.entity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import tamaized.voidscape.registry.ModAttributes;
import tamaized.voidscape.registry.ModEntities;
import tamaized.voidscape.registry.ModTools;
import javax.annotation.Nullable;
public class EntityNullServant extends Monster implements IEthereal {
public EntityNullServant(Level level) {
this(ModEntities.NULL_SERVANT.get(), level);
}
public EntityNullServant(EntityType<? extends EntityNullServant> type, Level level) {
super(type, level);
xpReward = 10;
}
public static AttributeSupplier.Builder createAttributes() {
return Monster.createMonsterAttributes().
add(Attributes.MAX_HEALTH, 50.0D).
add(Attributes.FOLLOW_RANGE, 15.0D).
add(Attributes.MOVEMENT_SPEED, 0.23F).
add(Attributes.ATTACK_DAMAGE, 3.0D).
add(Attributes.ARMOR, 10.0D).
add(ModAttributes.VOIDIC_DMG.get(), 2.0D).
add(ModAttributes.VOIDIC_RES.get(), 3.0D);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this)));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
}
@Override
@Nullable
public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_33282_, DifficultyInstance p_33283_, MobSpawnType p_33284_, @Nullable SpawnGroupData p_33285_, @Nullable CompoundTag p_33286_) {
this.populateDefaultEquipmentSlots(p_33283_);
this.populateDefaultEquipmentEnchantments(p_33283_);
return super.finalizeSpawn(p_33282_, p_33283_, p_33284_, p_33285_, p_33286_);
}
@Override
protected void populateDefaultEquipmentSlots(DifficultyInstance p_32136_) {
super.populateDefaultEquipmentSlots(p_32136_);
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(random.nextBoolean() ? ModTools.CORRUPT_AXE.get() : ModTools.CORRUPT_SWORD.get()));
}
@Override
protected void dropCustomDeathLoot(DamageSource p_21385_, int p_21386_, boolean p_21387_) {
// NO-OP
}
@Override
protected SoundEvent getAmbientSound() {
return null;
}
@Override
protected SoundEvent getHurtSound(DamageSource p_33579_) {
return SoundEvents.BLAZE_HURT;
}
@Override
protected SoundEvent getDeathSound() {
return SoundEvents.BLAZE_DEATH;
}
@Override
protected void playStepSound(BlockPos p_32159_, BlockState p_32160_) {
this.playSound(this.getStepSound(), 0.15F, 1.0F);
}
protected SoundEvent getStepSound() {
return SoundEvents.AMETHYST_BLOCK_STEP;
}
@Override
public void tick() {
super.tick();
if (level.isClientSide() && tickCount % 5 == 0) {
Vec3 vec = position().add(0, 1.0F - (random.nextFloat() * 0.6F), 0).add(new Vec3(0.1D + random.nextDouble() * 0.35D, 0D, 0D).yRot((float) Math.toRadians(random.nextInt(360))));
level.addParticle(ParticleTypes.END_ROD, vec.x, vec.y, vec.z, 0, 0, 0);
}
}
}
| [
"9671313+Tamaized@users.noreply.github.com"
] | 9671313+Tamaized@users.noreply.github.com |
b4f643707deefa1ae483a94a25147b6c30b8712c | 50ad1f453a4a4def40a25816f631e311ddd076e0 | /开发域/03 编码实现/trunk/screening-talent/src/main/java/com/idsmanager/xsifter/domain/question/ExaminationSetting.java | 1096a98265d12dc1b1d70698742149911ce290f1 | [] | no_license | jiadongdongdd/ScreeningTalent | 756928c6d95c7e4267d15a43ffc672fc56b63c7a | fd9d06f6a0086d257e04dd0b93a7e486022eb3e7 | refs/heads/master | 2021-04-26T23:56:51.694998 | 2018-03-05T07:59:11 | 2018-03-05T07:59:11 | 123,868,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,505 | java | package com.idsmanager.xsifter.domain.question;
import com.idsmanager.xsifter.domain.AbstractDomain;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by LZW on 2016/9/14.
*/
//试卷设置
@Document(collection = "ExaminationSetting")
public class ExaminationSetting extends AbstractDomain {
private static final long serialVersionUID = 1189208610713603380L;
//关联的面试员工
private String memberUuid;
//差异性标签
private List<String> differenceTags;
//选择的差异性标签
private List<String> selectedDifferenceTags;
//选择的综合标签
private List<String> generalTags;
//综合试卷题型
private Set<QuestionType> generalTypes;
//综合试卷各题型数量
private Map<String, Object> generalQuestionNum;
//是否综合试卷生成试卷 是:true 否:false
private boolean generatedGeneralExam;
//综合试卷难度
private String generalDifficultyDegree;
//专业标签
private Set<String> professionalTags;
//专业试卷各题型数量
private Map<String, Object> professionalQuestionNum;
//专业试卷生成试卷 是:true 否:false
private boolean generatedProfessionalExam;
//专业试卷难度
private String professionalDifficultyDegree;
public ExaminationSetting() {
}
public String memberUuid() {
return memberUuid;
}
public ExaminationSetting memberUuid(String memberUuid) {
this.memberUuid = memberUuid;
return this;
}
public List<String> differenceTags() {
return differenceTags;
}
public ExaminationSetting differenceTags(List<String> differenceTags) {
this.differenceTags = differenceTags;
return this;
}
public List<String> selectedDifferenceTags() {
return selectedDifferenceTags;
}
public ExaminationSetting selectedDifferenceTags(List<String> selectedDifferenceTags) {
this.selectedDifferenceTags = selectedDifferenceTags;
return this;
}
public List<String> generalTags() {
return generalTags;
}
public ExaminationSetting generalTags(List<String> generalTags) {
this.generalTags = generalTags;
return this;
}
public Set<QuestionType> generalTypes() {
return generalTypes;
}
public ExaminationSetting generalTypes(Set<QuestionType> generalTypes) {
this.generalTypes = generalTypes;
return this;
}
public Map<String, Object> generalQuestionNum() {
return generalQuestionNum;
}
public ExaminationSetting generalQuestionNum(Map<String, Object> generalQuestionNum) {
this.generalQuestionNum = generalQuestionNum;
return this;
}
public boolean generatedGeneralExam() {
return generatedGeneralExam;
}
public ExaminationSetting generatedGeneralExam(boolean generatedGeneralExam) {
this.generatedGeneralExam = generatedGeneralExam;
return this;
}
public String generalDifficultyDegree() {
return generalDifficultyDegree;
}
public ExaminationSetting generalDifficultyDegree(String generalDifficultyDegree) {
this.generalDifficultyDegree = generalDifficultyDegree;
return this;
}
public Set<String> professionalTags() {
return professionalTags;
}
public ExaminationSetting professionalTags(Set<String> professionalTags) {
this.professionalTags = professionalTags;
return this;
}
public Map<String, Object> professionalQuestionNum() {
return professionalQuestionNum;
}
public ExaminationSetting professionalQuestionNum(Map<String, Object> professionalQuestionNum) {
this.professionalQuestionNum = professionalQuestionNum;
return this;
}
public boolean generatedProfessionalExam() {
return generatedProfessionalExam;
}
public ExaminationSetting generatedProfessionalExam(boolean generatedProfessionalExam) {
this.generatedProfessionalExam = generatedProfessionalExam;
return this;
}
public String professionalDifficultyDegree() {
return professionalDifficultyDegree;
}
public ExaminationSetting professionalDifficultyDegree(String professionalDifficultyDegree) {
this.professionalDifficultyDegree = professionalDifficultyDegree;
return this;
}
}
| [
"ddjia@qytpay.com.cn"
] | ddjia@qytpay.com.cn |
b422d0921f1da251d24765bf1477fd81d4b5d196 | 08082d7fec12dc4779645fc01c9002cb11735cfd | /src/NanObjectInfiniti/ExampleNanObject.java | 035f5a059a7a58c432bbf1b91558441f816e25eb | [] | no_license | jvmNet/myTotalFirstProjects | e9f1a43760322e12ffb210a8ddb72843c7518d43 | c4aeb1186e520ca63bcafd8fdc85dc5dbdacc273 | refs/heads/master | 2020-07-17T02:09:17.190652 | 2019-09-02T18:55:26 | 2019-09-02T18:55:26 | 205,919,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,192 | java | package NanObjectInfiniti;
import java.util.LinkedList;
import java.util.List;
public class ExampleNanObject {
public static void main(String[] args) {
List<Number> list = new LinkedList<Number>();
initList(list);
printListValues(list);
processCastedObjects(list);
}
private static void initList(List<Number> list) {
list.add(new Double(1000f));
list.add(new Double("123e-445632"));
list.add(new Float(-90 / -3));
list.remove(new Double("123e-445632"));
}
private static void printListValues(List<Number> list) {
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
}
private static void processCastedObjects(List<Number> list) {
for (Number object : list) {
if (object instanceof Double) {
Double a = (Double) object;
System.out.println("Is double value infinite? " + a.isInfinite());
} else if (object instanceof Float) {
Float a = (Float) object;
System.out.println("Is float value defined? " + !(a.isNaN()));
}
}
}
}
| [
"direct@javac.online"
] | direct@javac.online |
16090aaa4fb1868b5c1e547fa92abdc90bd4445f | 9af3dbc44c4eaf32293adf450c7b51fc47f6602e | /src/com/action/FlightAction.java | 3b156cc78dd213e6bb7b94a2ccf744adf95431c7 | [] | no_license | TerenceZH/FlightForCustomer | 135e7fddaf76dfe2f54d5e051263911e1d01627f | 21a0a79d60a7b0ae9de4bffeeb2b0439b9ed3aaa | refs/heads/master | 2020-07-02T02:54:34.339985 | 2014-12-31T03:02:10 | 2014-12-31T03:02:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | package com.action;
import java.util.ArrayList;
import java.util.List;
import com.pojo.Flight;
import com.service.FlightService;
public class FlightAction {
private Flight flight;
private FlightService flightService;
private String message ;
private List<Flight> list;
public List<Flight> getList() {
return list;
}
public void setList(List<Flight> list) {
this.list = list;
}
public Flight getFlight() {
return flight;
}
public void setFlight(Flight flight) {
this.flight = flight;
}
public FlightService getFlightService() {
return flightService;
}
public void setFlightService(FlightService flightService) {
this.flightService = flightService;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String queryFlight(){
// System.out.println(flight.getDepart_city()+" "+flight.getArrival_city()+" "+flight.getDepart_time());
list = flightService.queryFlight(flight.getDepart_time(),flight.getDepart_city(),flight.getArrival_city());
// System.out.println(list);
return "FlightqueryFlightSuccess";
}
public String queryFlight2(){
list = new ArrayList<Flight>();
return "FlightqueryFlight2Success";
}
}
| [
"1033281892@qq.com"
] | 1033281892@qq.com |
9a24cd5900ea4510dd977febb7dd18ffaa5018e9 | 48596daeb91ac96f4b8182f8d81114ea097a94c5 | /BuildServer/trunk/BuildServer/src/edu/umd/cs/buildServer/CTester.java | 8b769b297e655ee57f58ae69a92b2b7ebcafb3b5 | [] | no_license | squished18/marmoset_ECE_base | a46fc23118c2a85c6f6484ba466a0687d5ec2cba | 5cc41a80a4c614689e01b1f84bf64c11f0fc5218 | refs/heads/master | 2021-01-13T03:45:19.862939 | 2018-12-13T22:16:09 | 2018-12-13T22:16:09 | 77,246,889 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 10,067 | java | /*
* Copyright (C) 2005 University of Maryland
* All Rights Reserved
* Created on Jan 21, 2005
*/
package edu.umd.cs.buildServer;
import java.io.File;
import java.io.IOException;
import java.util.StringTokenizer;
import edu.umd.cs.marmoset.modelClasses.TestOutcome;
import edu.umd.cs.marmoset.modelClasses.TestProperties;
import edu.umd.cs.marmoset.utilities.MarmosetUtilities;
/**
* Tester for C, OCaml and Ruby submissions.
* <p>
* <b>NOTE:</b> "CTester" is a legacy name.
* We use the same infrastructure for building and testing C, OCaml and Ruby code
* because the process is exactly the same. For more details see {@see CBuilder}.
*
* @author David Hovemeyer
* @author jspacco
*/
public class CTester extends Tester {
/**
* Constructor.
*
* @param testProperties TestProperties loaded from the project jarfile's test.properties
* @param haveSecurityPolicyFile true if there is a security.policy file in the project jarfile
* @param projectSubmission the ProjectSubmission
* @param directoryFinder DirectoryFinder to locate build and testfiles directories
*/
public CTester(TestProperties testProperties, boolean haveSecurityPolicyFile, ProjectSubmission projectSubmission, DirectoryFinder directoryFinder) {
super(testProperties, haveSecurityPolicyFile, projectSubmission, directoryFinder);
}
/* (non-Javadoc)
* @see edu.umd.cs.buildServer.Tester#loadTestProperties()
*/
protected void loadTestProperties() throws BuilderException {
super.loadTestProperties();
}
/* (non-Javadoc)
* @see edu.umd.cs.buildServer.Tester#execute()
*/
protected void executeTests() throws BuilderException {
loadTestProperties();
String[] dynamicTestTypes = TestOutcome.DYNAMIC_TEST_TYPES;
for (int i = 0; i < dynamicTestTypes.length; ++i) {
String testType = dynamicTestTypes[i];
StringTokenizer testExes = getTestExecutables(
getTestProperties(), testType);
if (testExes == null)
// No tests of this kind specified
continue;
// Create list of the executables
int testCount = 0;
while (testExes.hasMoreTokens()) {
executeTest(testExes.nextToken(), testType, testCount++);
}
}
testsCompleted();
}
static StringTokenizer getTestExecutables(TestProperties testProperties, String testType) {
String testExes = testProperties.getTestClass(testType);
if (testExes == null)
// No tests of this kind specified
return null;
return new StringTokenizer(testExes, ", \t\r\n");
}
/**
* Execute a single test executable.
*
* @param exeName name of the test executable
* @param testType test type (public, release, secret, etc.)
* @param testNumber test number (among other tests of the same type)
*/
protected void executeTest(String exeName, String testType, int testNumber) throws BuilderException {
Process process = null;
boolean finished = false;
CombinedStreamMonitor streamMonitor = null;
try {
// Hopefully the test executable is really there.
checkTestExe(exeName);
// Run the test executable in the build directory.
getLog().debug("Running C test number " +testNumber+ ": " +exeName+
" process in directory " + getDirectoryFinder().getBuildDirectory());
// Add LD_LIBRARY_PATH according to the environment, if requested
String[] environment=null;
if (getTestProperties().getLdLibraryPath()!=null) {
environment = new String[] { getTestProperties().getLdLibraryPath() };
getLog().debug(getTestProperties().getLdLibraryPath());
}
int maxTime = getTestProperties().getTestTimeoutInSeconds();
maxTime += 1;
String shell = getProjectSubmission().getConfig().getStringProperty(SHELL, "bash");
// XXX Will only work on a *nix machine. Actually the entire process of testing
// C, Ruby or OCaml will only work on Linux (and maybe Solaris but it hasn't been tested).
String[] command = null;
// Using an unprivileged account:
// Note that this requires the instructor's Makefile to give o+x permissions
// to anything it needs to execute, such as utility perl scripts for diffing files
// and whatnot.
// ulimits are in bytes
// TODO Make the parameters passed to ulimit configurable by the test.properties file
// either globally (i.e. for all test cases) or per-test case
// XXX The virtual memory limit is really high because Java allocates
// a huge amount of virtual memory that it never uses, even if you set
// something like -Xmx=128m . While this code is the for CTester
// and ostensibly runs C code (or other code launched from the command line)
// this mechanism is used for example in CMSC 420 to call Java,
// which will fail if it cannot allocate a huge amount of virtual memory.
// Thus, we're limiting the actual memory
// to 128 MB and the virtual memory to 756 MB, and hoping this is
// well enough balanced to let Java allocate all the virtual memory it
// wants, but will kill student C code that's calling malloc in a loop
// before it takes down the BuildServer.
int virtualMemoryLimit=750*(1024*1024);
int memoryLimit=128*(1024*1024);
String unprivilegedAccount=getProjectSubmission().getConfig().getOptionalProperty(UNPRIVILEGED_ACCOUNT);
if (unprivilegedAccount!=null && !unprivilegedAccount.trim().equals("")) {
command=new String[] {shell, "-c", "ulimit -t " +maxTime+
" -v " +virtualMemoryLimit+ " "+
//" -m " +memoryLimit + " "+
" ; "+
"cd " +getDirectoryFinder().getBuildDirectory().getAbsolutePath()+
" ; "+
"sudo -u " +unprivilegedAccount.trim()+ " "+
"./" +exeName
};
} else {
command=new String[] {shell, "-c", "ulimit -t " +maxTime+
" -v " +virtualMemoryLimit+ " "+
//" -m " +memoryLimit+ " "+
" ; "+
new File(getDirectoryFinder().getBuildDirectory(), exeName).getAbsolutePath()};
}
getLog().debug("Test command: " +MarmosetUtilities.commandToString(command));
process = Runtime.getRuntime().exec(
command,
environment,
getDirectoryFinder().getBuildDirectory());
// Read the stdout/stderr from the test executable.
streamMonitor = new CombinedStreamMonitor(
process.getInputStream(), process.getErrorStream());
streamMonitor.start();
// Start a thread which will wait for the process to exit.
// The issue here is that Java has timed monitor waits,
// but not timed process waits. We emulate the latter
// using the former.
ProcessExitMonitor exitMonitor = new ProcessExitMonitor(process);
exitMonitor.start();
// Record a test outcome.
TestOutcome testOutcome = new TestOutcome();
testOutcome.setTestNumber(testNumber);
testOutcome.setTestName(exeName);
testOutcome.setTestType(testType);
long processTimeoutMillis = getTestProperties().getTestTimeoutInSeconds() * 1000L;
// Wait for the process to exit.
if (exitMonitor.waitForProcessToExit(processTimeoutMillis)) {
int exitCode = exitMonitor.getExitCode();
finished = true;
streamMonitor.join();
// Use the process exit code to decide whether the test
// passed or failed.
boolean passed = exitCode == 0;
String outcome = passed ? TestOutcome.PASSED : TestOutcome.FAILED;
getLog().debug("Process exited with exit code " + exitCode);
// Add a TestOutcome to the TestOutcomeCollection
testOutcome.setOutcome(outcome);
testOutcome.setShortTestResult("Test " + exeName + " " + testOutcome.getOutcome());
// XXX We're storing the output from the streamMonitor in the
// testOutcome record whether it passes or fails
testOutcome.setLongTestResult(streamMonitor.getCombinedOutput());
} else {
// Test timed out!
// XXX this should be set to failed! Why not "timeout"?
testOutcome.setOutcome(TestOutcome.TIMEOUT);
testOutcome.setShortTestResult("Test " + exeName + " did not complete before the timeout of " +
getTestProperties().getTestTimeoutInSeconds() + " seconds)");
testOutcome.setLongTestResult(streamMonitor != null ? streamMonitor.getCombinedOutput() : "");
}
getTestOutcomeCollection().add(testOutcome);
} catch (IOException e) {
// Possible reasons this could happen are:
// - the Makefile is buggy and didn't create the exes it should have
// - a temporary resource exhaustion prevented the process from running
// In any case, we can't trust the test results at this point,
// so we'll abort all testing of this submission.
throw new BuilderException("Could not run test process", e);
} catch (InterruptedException e) {
throw new BuilderException("Test process wait interrupted unexpectedly", e);
} finally {
// Whatever happens, make sure we don't leave the process running
if (process != null && !finished) {
MarmosetUtilities.destroyProcessGroup(process, getLog());
}
}
}
/**
* Check if a test executable really exists in the build directory.
* Right now we just emit log messages if it doesn't.
*
* @param exeName name of the test executable.
*/
protected void checkTestExe(String exeName) {
File exeFile = new File(getDirectoryFinder().getBuildDirectory(), exeName);
int tries = 0;
while (tries++ < 5) {
if (exeFile.isFile())
break;
getLog().warn("Test executable " + exeFile + " doesn't exist -- sleeping");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
}
}
| [
"squished18@gmail.com"
] | squished18@gmail.com |
8ec33edfe0992695999b5efad73bdc49f12e2ce8 | 5eee38dc3000980ae5fc535a950be4fb395abffd | /src/main/java/com/capstone/service/MenuService.java | bdba01373422eea3a4b19771037efc355f1c0d06 | [] | no_license | BuiDat99/capstone | aafcf82e8e96cbb8b10194adc8cd64594c8c24ab | 5ab2af8d97bca191bf4193c358e66dcbf8bf9b8b | refs/heads/master | 2023-04-27T17:16:14.592008 | 2020-07-24T08:44:13 | 2020-07-24T08:44:13 | 274,885,695 | 0 | 2 | null | 2020-07-24T07:58:12 | 2020-06-25T10:14:41 | CSS | UTF-8 | Java | false | false | 314 | java | package com.capstone.service;
import java.util.List;
import com.capstone.model.MenuDTO;
public interface MenuService {
public void addMenu(MenuDTO menu);
public void updateMenu(MenuDTO menu);
public void deleteMenu(int id);
public List<MenuDTO> getAllMenu();
public MenuDTO getMenubyId(int id);
}
| [
"63451376+BuiDat99@users.noreply.github.com"
] | 63451376+BuiDat99@users.noreply.github.com |
bda8a88da3105b6144b474adc3f486d5d8175aea | 78d638a9b09a3dc88594dfda6a33b8bf2d9c769b | /information/app.java | 624a95116c69b72d94734f1670ef41acb25cb3c2 | [] | no_license | Myjacklee/weather-informaion-decoder | 892ec0f6ba1b62980beaf8aa51cab1c5ce5fbf06 | 0b691efb520202dfddd0aebb0d395bdc4ca3c3f2 | refs/heads/master | 2022-11-18T08:37:11.351728 | 2020-07-17T07:37:19 | 2020-07-17T07:37:19 | 265,122,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 34,153 | java | package information;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class app {
public static String dirName="src/地面资料";
public static String name=new String();
public String year=new String();
public String month=new String();
public String day=new String();
public String time=new String();
public String stationNumber=new String();
//输出信息
public char iR;
public String iRMessage=new String();
public char iX;
public String iXMessage=new String();
public char h;
public String lowestCloudHeightString="暂无数据";
public int vv;
public String effectiveVisibilityString="暂无数据";
public char N;
public String totalCloudString="暂无数据";
public String dd=new String();
public String cloudDirection="暂无数据";
public String ff=new String();
public String cloudSpeedString="暂无数据";
public String temperatureString="暂无数据";
public String dewPoint="暂无数据";
public String localPressure="暂无数据";
public String seaPressure="暂无数据";
public String pressureChangeString="暂无数据";
public String pressureChangeDesString="暂无数据";
public String precipitation="暂无数据";
public String weatherPhenomena="暂无数据";
public String cloudiness ="暂无数据";
public String CLCloud="暂无数据";
public String CMCloud="暂无数据";
public String CHCloud="暂无数据";
public String time_h=new String();
public String time_m=new String();
public String nowTime="暂无数据";
//返回搜索的文件名称
public String getFileName(){
Scanner input=new Scanner(System.in);
System.out.println("请输入年份");
year=input.nextLine();
System.out.println("请输入月份");
month=input.nextLine();
System.out.println("请输入日期");
day=input.nextLine();
System.out.println("请输入时次");
time=input.nextLine();
System.out.println("请输入台站号");
stationNumber=input.nextLine();
input.close();
if(day.length()<2){
day="0"+day;
}
if(time.length()<2){
time="0"+time;
}
if(month.length()<2)
{
month="0"+month;
}
return "AAXX"+month+day+".T"+time;
}
//比对对应的文件名称是否一致
public boolean FileName(String name){
boolean isExistence=false;
File thisDir=new File(dirName);
if(thisDir.isDirectory()){
String Dir[]=thisDir.list();
for(int i=0;i<Dir.length;i++){
if(Dir[i].equals(name)){
isExistence=true;
}else{
continue;
}
}
}
return isExistence;
}
//在对应文件里面找到对应的台站号
public String findStationNumber() throws IOException{
String fileRoute=dirName+"/"+name;
@SuppressWarnings("resource")
BufferedReader in = new BufferedReader(new FileReader(fileRoute));
String line=new String();
while((line=in.readLine())!=null){
if(line.indexOf("AAXX")!=-1){
line=in.readLine();
while(line!=null){
String codeString=new String();
do {
codeString=codeString+" "+line;
line=in.readLine();
} while (codeString.charAt(codeString.length()-1)!='=');
// System.out.println(codeString);
if(codeString.substring(1,6).equals(stationNumber)){
return codeString.substring(1,codeString.length()-1);
}
}
}
}
in.close();
return "notExist";
}
//对编码进行解码
public void decode(String code){
String[] codeVector=code.split(" ");
for(int i=0;i<codeVector.length-1;i++){
// System.out.println(codeVector[i]+" "+codeVector[i].length());
if(codeVector[i].equals("333")||codeVector[i].equals("333//")){
break;
}
if(i<3){
if(i==1){
String tempString=codeVector[1];
iR=tempString.charAt(0);
if(iR=='1'){
iRMessage="编报降水组";
}else if(iR=='3'){
iRMessage="无降水而不编报";
}else if(iR=='4'){
iRMessage="有降水但因未观测或观测值无法测定而不编报";
}else{
iRMessage="无相关信息";
}
iX=tempString.charAt(1);
if(iX=='1'){
iXMessage="测站类别:人工站 编报与否:编报";
}else if(iX=='2'){
iXMessage="测站类别:人工站 编报与否:不编报(无规定要编报的天气现象)";
}else if(iX=='3'){
iXMessage="测站类别:人工站 编报与否:不编报(未观测)";
}else if(iX=='4'){
iXMessage="测站类别:自动站 编报与否:编报";
}else if(iX=='5'){
iXMessage="测站类别:自动站 编报与否:不编报(无规定要编报的天气现象)";
}else if(iX=='6'){
iXMessage="观站类别:自动站 编报与否:不编报(未观测)";
}else{
iXMessage="无相关信息";
}
h=tempString.charAt(2);
if(h=='0'){
lowestCloudHeightString="<50";
}else if(h=='1'){
lowestCloudHeightString="50-<100";
}else if(h=='2'){
lowestCloudHeightString="100-<200";
lowestCloudHeightString="200-<300";
}else if(h=='4'){
lowestCloudHeightString="300-<600";
}else if(h=='5'){
lowestCloudHeightString="600-<1000";
}else if(h=='6'){
lowestCloudHeightString="1000-<1500";
}else if(h=='7'){
lowestCloudHeightString="1500-<2000";
}else if(h=='8'){
lowestCloudHeightString="2000-<2500";
}else if(h=='9'){
lowestCloudHeightString=">=2500米,或无云";
}else if(h=='/'){
lowestCloudHeightString="云底高度不明,或者云底低于测站而云顶高于测站";
}else{
lowestCloudHeightString="无相关信息";
}
vv=Integer.valueOf(tempString.substring(3,5));
if(vv==00){
effectiveVisibilityString="<0.1";
}else if(vv>=1&&vv<=50){
effectiveVisibilityString=String.valueOf(vv/10);
}else if(vv>=51&&vv<=55){
effectiveVisibilityString="不用";
}else if(vv>=56&&vv<=79){
effectiveVisibilityString=String.valueOf(vv-50);
}else if(vv==80){
effectiveVisibilityString=">=30";
}else if(vv>=81&&vv<=88){
effectiveVisibilityString=String.valueOf((vv-80)*5+30);
}else if(vv==89){
effectiveVisibilityString=">70";
}else if(vv==90){
effectiveVisibilityString="<=0.05";
}else if(vv==92){
effectiveVisibilityString="0.05";
}else if(vv==93){
effectiveVisibilityString="0.5";
}else if(vv==94){
effectiveVisibilityString="1";
}else if(vv==95){
effectiveVisibilityString="2";
}else if(vv==96){
effectiveVisibilityString="4";
}else if(vv==97){
effectiveVisibilityString="10";
}else if(vv==98){
effectiveVisibilityString="20";
}else if(vv==99){
effectiveVisibilityString=">=50";
}else{
effectiveVisibilityString="无相关信息";
}
}else if(i==2){
String tempString=codeVector[2];
N=tempString.charAt(0);
if(N=='0'){
totalCloudString="无云";
}else if(N=='1'){
totalCloudString="1或微量(可判定云状的微量云)";
}else if(N=='2'){
totalCloudString="2-3";
}else if(N=='3'){
totalCloudString="4";
}else if(N=='4'){
totalCloudString="5";
}else if(N=='5'){
totalCloudString="6";
}else if(N=='6'){
totalCloudString="7-8";
}else if(N=='7'){
totalCloudString="9或10";
}else if(N=='8'){
totalCloudString="10";
}else if(N=='9'){
totalCloudString="因有雾或其他视程障碍现象而使总云量无法估计";
}else if(N=='/'){
totalCloudString="未观测(自动站未配有测云设备)";
}else{
totalCloudString="无相关信息";
}
dd=tempString.substring(1,3);
if(dd.equals("02")){
cloudDirection="东北风(NNE)";
}else if(dd.equals("04")){
cloudDirection="东北(NE)";
}else if(dd.equals("07")){
cloudDirection="东东北(ENE)";
}else if(dd.equals("09")){
cloudDirection="东 (E)";
}else if(dd.equals("11")){
cloudDirection="东东南(ESE)";
}else if(dd.equals("14")){
cloudDirection="东 南(SE)";
}else if(dd.equals("16")){
cloudDirection="南东南(SSE)";
}else if(dd.equals("18")){
cloudDirection="南 (S)";
}else if(dd.equals("20")){
cloudDirection="南西南(SSW)";
}else if(dd.equals("22")){
cloudDirection="西南(SW)";
}else if(dd.equals("25")){
cloudDirection="西西南(WSW)";
}else if(dd.equals("27")){
cloudDirection="西(W)";
}else if(dd.contentEquals("29")){
cloudDirection="西西北(WNW)";
}else if(dd.equals("32")){
cloudDirection="西北(NW)";
}else if(dd.equals("34")){
cloudDirection="北西北(NNW)";
}else if(dd.equals("36")){
cloudDirection="北(N)";
}else if(dd.equals("00")){
cloudDirection="静风";
}else{
cloudDirection="无相关信息";
}
ff=tempString.substring(3,5);
if(ff.charAt(0)=='0'){
cloudSpeedString=ff.substring(1);
}else{
cloudSpeedString=ff;
}
}
}else{
String tempString=codeVector[i];
char beginChar=tempString.charAt(0);
if(beginChar=='1'){
if(tempString.charAt(1)=='0'){
String temp=tempString.substring(2,4);
if(temp.charAt(0)=='0'){
temp=temp.substring(1);
}
temperatureString=temp+"."+tempString.substring(4);
}else{
String temp=tempString.substring(2,4);
if(temp.charAt(0)=='0'){
temp=temp.substring(1);
}
temperatureString="-"+temp+"."+tempString.substring(4);
}
}else if(beginChar=='2'){
if(tempString.charAt(1)=='9'){
if(tempString.charAt(2)=='1'){
dewPoint="100%";
}else{
dewPoint=tempString.substring(3,5)+"%";
}
}else{
if(tempString.substring(2,5)=="800"){
dewPoint="低于-80.0 C";
}else{
String temp=tempString.substring(2,4);
if(temp.charAt(0)=='0'){
temp=temp.substring(1);
}
if(tempString.charAt(1)=='0'){
dewPoint=temp+"."+tempString.substring(4);
}else{
dewPoint="-"+temp+"."+tempString.substring(4);
}
}
}
}else if(beginChar=='3'){
String temp=tempString.substring(1,4);
int tempLength=temp.length();
for(int innerI=0;innerI<tempLength;)
{
if(temp.charAt(innerI)=='0'){
temp=temp.substring(innerI+1);
continue;
}else{
break;
}
}
localPressure=temp+"."+tempString.substring(4);
}else if(beginChar=='4'){
seaPressure="1"+tempString.substring(1,4)+"."+tempString.substring(4);
}else if(beginChar=='5'){
if(tempString.indexOf('/')!=-1){
pressureChangeString="暂无数据";
}else if(tempString.charAt(1)=='2'){
pressureChangeDesString="上升";
String temp=tempString.substring(2,4);
if(temp.charAt(0)=='0'){
temp=temp.substring(1);
}
pressureChangeString=temp+"."+tempString.charAt(4);
}else if(tempString.charAt(1)=='4'){
pressureChangeDesString="气压无变量";
pressureChangeString="0";
}else if(tempString.charAt(1)=='7'){
pressureChangeDesString="下降";
String temp=tempString.substring(2,4);
if(temp.charAt(0)=='0'){
temp=temp.substring(1);
}
pressureChangeString="-"+temp+"."+tempString.charAt(4);
}else{
pressureChangeString="编码段错误";
}
}else if(beginChar=='6'){
int temp=Integer.valueOf(tempString.substring(1,4));
if(temp==0){
precipitation="不用";
}else if(temp>=1&&temp<=988){
precipitation=String.valueOf(temp);
}else if(temp==990){
precipitation="微量";
}else if(temp>=991&&temp<=999){
precipitation=String.valueOf((temp-990)/10);
}
}else if(beginChar=='7'){
String ww=tempString.substring(1,3);
if(ww.equals("00")||ww.equals("01")){
weatherPhenomena="过去一小时内没有出现规定要编报ww的各种天气现象";
}else if(ww.equals("02")||ww.equals("03")){
weatherPhenomena="不用";
}else if(ww.equals("04")){
weatherPhenomena="观测时水平能见度因烟(草原或森林着火而引起的烟,工厂排出的烟)或火山爆发的灰尘障碍而降低";
}else if(ww.equals("05")){
weatherPhenomena="观测时有霾";
}else if(ww.equals("06")){
weatherPhenomena="观测时有浮尘,广泛散布的浮在空中的尘土,不是在观测时由测站或测站附近的风所吹起来的。";
}else if(ww.equals("07")){
weatherPhenomena="观测时由测站或测站附近的风吹起来的扬沙或尘土,但还没有发展成完好的尘卷风或沙尘暴;或飞沫吹到观测船上";
}else if(ww.equals("08")){
weatherPhenomena="观测时或观测前一小时内在测站或测站附近看到发展完好的尘卷风,但没有沙尘暴";
}else if(ww.equals("09")){
weatherPhenomena="观测时视区内有沙尘暴,或者观测前一小时内测站有沙尘暴";
}else if(ww.equals("10")){
weatherPhenomena="轻雾";
}else if(ww.equals("11")){
weatherPhenomena="测站有浅雾,呈片状,在陆地上厚度不超过2米,在海上不超过10米";
}else if(ww.equals("12")){
weatherPhenomena="测站有浅雾,基本连续,在陆地上厚度不超过2米,在海上不超过10米";
}else if(ww.equals("13")){
weatherPhenomena="闪电";
}else if(ww.equals("14")){
weatherPhenomena="视区内有降水,没有到达地面或海面";
}else if(ww.equals("15")){
weatherPhenomena="视区内有降水,已经到达地面或海面,但估计距测站5千米以外";
}else if(ww.equals("16")){
weatherPhenomena="视区内有降水,已经到达地面或海面,在测站附近,但本站无降水";
}else if(ww.equals("17")){
weatherPhenomena="雷暴,但观测时测站没有降水";
}else if(ww.equals("18")){
weatherPhenomena="飑,观测时或观测前一小时内在测站或视区内出现";
}else if(ww.equals("19")){
weatherPhenomena="龙卷,观测时或观测前一小时内在测站或视区内出现";
}else if(ww.equals("20")){
weatherPhenomena="毛毛雨";
}else if(ww.equals("21")){
weatherPhenomena="雨";
}else if(ww.equals("22")){
weatherPhenomena="非阵性的雪、米雪或冰粒";
}else if(ww.equals("23")){
weatherPhenomena="雨夹雪,或雨夹冰粒";
}else if(ww.equals("24")){
weatherPhenomena="毛毛雨或雨,并有雨凇结成";
}else if(ww.equals("25")){
weatherPhenomena="阵雨";
}else if(ww.equals("26")){
weatherPhenomena="阵雪,或阵性雨夹雪";
}else if(ww.equals("27")){
weatherPhenomena="冰雹或霰(伴有或不伴有雨) ";
}else if(ww.equals("28")){
weatherPhenomena="雾";
}else if(ww.equals("29")){
weatherPhenomena="雷暴(伴有或不伴有降水)";
}else if(ww.equals("30")){
weatherPhenomena="轻的或中度的沙尘暴,过去一小时内减弱";
}else if(ww.equals("31")){
weatherPhenomena="轻的或中度的沙尘暴,过去一小时内没有显著的变化";
}else if(ww.equals("32")){
weatherPhenomena="轻的或中度的沙尘暴,过去一小时内开始或增强";
}else if(ww.equals("33")){
weatherPhenomena="强的沙尘暴,过去一小时内减弱";
}else if(ww.equals("34")){
weatherPhenomena="强的沙尘暴,过去一小时内没有显著的变化";
}else if(ww.equals("35")){
weatherPhenomena="强的沙尘暴,过去一小时内开始或增强";
}else if(ww.equals("36")){
weatherPhenomena="轻的或中度的低吹雪,吹雪所达高度一般低于观测员的眼睛(水平视线)";
}else if(ww.equals("37")){
weatherPhenomena="强的低吹雪,吹雪所达高度一般低于观测员的眼睛(水平视线)";
}else if(ww.equals("38")){
weatherPhenomena="轻的或中度的高吹雪,吹雪所达高度一般高于观测员的眼睛(水平视线)";
}else if(ww.equals("39")){
weatherPhenomena="强的高吹雪,吹雪所达高度一般高于观测员的眼睛(水平视线),或雪暴";
}else if(ww.equals("40")){
weatherPhenomena="观测时近处有雾,其高度高于观测员的眼睛(水平视线),但观测前一小时内测站没有雾";
}else if(ww.equals("41")){
weatherPhenomena="散片的雾";
}else if(ww.equals("42")){
weatherPhenomena="雾,过去一小时内已变薄,天空可辨明";
}else if(ww.equals("43")){
weatherPhenomena="雾,过去一小时内已变薄,天空不可辨";
}else if(ww.equals("44")){
weatherPhenomena="雾,过去一小时内强度没有显著的变化,天空可辨明";
}else if(ww.equals("45")){
weatherPhenomena="雾,过去一小时内强度没有显著的变化,天空不可辨";
}else if(ww.equals("46")){
weatherPhenomena="雾,过去一小时内开始出现或已变浓,天空可辨明";
}else if(ww.equals("47")){
weatherPhenomena="雾,过去一小时内开始出现或已变浓,天空不可辨";
}else if(ww.equals("48")){
weatherPhenomena="雾,有雾凇结成,天空可辨明";
}else if(ww.equals("49")){
weatherPhenomena="雾,有雾凇结成,天空不可辨";
}else if(ww.equals("50")){
weatherPhenomena="间歇性轻毛毛雨";
}else if(ww.equals("51")){
weatherPhenomena="连续性轻毛毛雨";
}else if(ww.equals("52")){
weatherPhenomena="间歇性中常毛毛雨";
}else if(ww.equals("53")){
weatherPhenomena="连续性中常毛毛雨";
}else if(ww.equals("54")){
weatherPhenomena="间歇性浓毛毛雨";
}else if(ww.equals("55")){
weatherPhenomena="连续性浓毛毛雨";
}else if(ww.equals("56")){
weatherPhenomena="轻的毛毛雨,并有雨凇结成";
}else if(ww.equals("57")){
weatherPhenomena="中常的或浓的毛毛雨,并有雨凇结成";
}else if(ww.equals("58")){
weatherPhenomena="轻的毛毛雨夹雨";
}else if(ww.equals("59")){
weatherPhenomena="中常的或浓的毛毛雨夹雨";
}else if(ww.equals("60")){
weatherPhenomena="间歇性小雨";
}else if(ww.equals("61")){
weatherPhenomena="连续性小雨";
}else if(ww.equals("62")){
weatherPhenomena="间歇性中雨";
}else if(ww.equals("63")){
weatherPhenomena="连续性中雨";
}else if(ww.equals("64")){
weatherPhenomena="间歇性大雨";
}else if(ww.equals("65")){
weatherPhenomena="连续性大雨";
}else if(ww.equals("66")){
weatherPhenomena="小雨,并有雨凇结成";
}else if(ww.equals("67")){
weatherPhenomena="中雨或大雨,并有雨凇结成";
}else if(ww.equals("68")){
weatherPhenomena="小的雨夹雪,或轻毛毛雨夹雪";
}else if(ww.equals("69")){
weatherPhenomena="中常的或大的雨夹雪,或中常的或浓的毛毛雨夹雪";
}else if(ww.equals("70")){
weatherPhenomena="间歇性小雪";
}else if(ww.equals("71")){
weatherPhenomena="连续性小雪";
}else if(ww.equals("72")){
weatherPhenomena="间歇性中雪";
}else if(ww.equals("73")){
weatherPhenomena="连续性中雪";
}else if(ww.equals("74")){
weatherPhenomena="间歇性大雪";
}else if(ww.equals("75")){
weatherPhenomena="连续性大雪";
}else if(ww.equals("76")){
weatherPhenomena="冰针(伴有或不伴有雾)";
}else if(ww.equals("77")){
weatherPhenomena="米雪(伴有或不伴有雾)";
}else if(ww.equals("78")){
weatherPhenomena="孤立的星状雪晶(伴有或不伴有雾)";
}else if(ww.equals("79")){
weatherPhenomena="冰粒";
}else if(ww.equals("80")){
weatherPhenomena="小的阵雨";
}else if(ww.equals("81")){
weatherPhenomena="中常的阵雨";
}else if(ww.equals("82")){
weatherPhenomena="大的阵雨";
}else if(ww.equals("83")){
weatherPhenomena="小的阵性雨夹雪";
}else if(ww.equals("84")){
weatherPhenomena="中常或大的阵性雨夹雪";
}else if(ww.equals("85")){
weatherPhenomena="小的阵雪";
}else if(ww.equals("86")){
weatherPhenomena="中常或大的阵雪";
}else if(ww.equals("87")){
weatherPhenomena="小的阵性霰,伴有或不伴有雨或雨夹雪";
}else if(ww.equals("88")){
weatherPhenomena="中常或大的阵性霰,伴有或不伴有雨或雨夹雪";
}else if(ww.equals("89")){
weatherPhenomena="轻的冰雹,伴有或不伴有雨或雨夹雪";
}else if(ww.equals("90")){
weatherPhenomena="中常或强的冰雹,伴有或不伴有雨或雨夹雪";
}else if(ww.equals("91")){
weatherPhenomena="观测前一小时内有雷暴,观测时有小雨";
}else if(ww.equals("92")){
weatherPhenomena="观测前一小时内有雷暴,观测时有中雨或大雨";
}else if(ww.equals("93")){
weatherPhenomena="观测前一小时内有雷暴,观测时有小(轻)的雪、或雨夹雪、或霰、或冰雹";
}else if(ww.equals("94")){
weatherPhenomena="观测前一小时内有雷暴,观测时有中常或大(强)的雪、或雨夹雪、或霰、或冰雹";
}else if(ww.equals("95")){
weatherPhenomena="小或中常的雷暴,观测时没有冰雹、或霰,但有雨、或雪、或雨夹雪";
}else if(ww.equals("96")){
weatherPhenomena="小或中常的雷暴,观测时伴有冰雹、或霰";
}else if(ww.equals("97")){
weatherPhenomena="大雷暴,观测时没有冰雹、或霰,但有雨、或雪、或雨夹雪";
}else if(ww.equals("98")){
weatherPhenomena="雷暴,观测时伴有沙尘暴和降水";
}else if(ww.equals("99")){
weatherPhenomena="大雷暴,观测时伴有冰雹、或霰";
}else{
weatherPhenomena="无相关信息";
}
}else if(beginChar=='8'){
char temp=tempString.charAt(1);
if(temp=='0'){
cloudiness="无云";
}else if(temp=='1'){
cloudiness="1或微量(可判定云状的微量云)";
}else if(temp=='2'){
cloudiness="2-3";
}else if(temp=='3'){
cloudiness="4";
}else if(temp=='4'){
cloudiness="5";
}else if(temp=='5'){
cloudiness="6";
}else if(temp=='6'){
cloudiness="7-8";
}else if(temp=='7'){
cloudiness="9或10";
}else if(temp=='8'){
cloudiness="10";
}else if(temp=='9'){
cloudiness="因有雾或其他视程障碍现而使总云量无法估计";
}else if(temp=='/'){
cloudiness="未观测(自动站未装配有测云设备)";
}else{
cloudiness="无相关信息";
}
temp=tempString.charAt(2);
if(temp=='0'){
CLCloud="技术性说明:没有CL云 非技术性说明:没有层积云、层云、积云、积雨云";
}else if(temp=='1'){
CLCloud="技术性说明:淡积云或碎积云,或者两者同时存在 非技术性说明:垂直发展很小,形状扁平的积云,或碎积云,或两者同时存在。";
}else if(temp=='2'){
CLCloud="技术性说明:浓积云,可伴有淡积云、碎积云或层积云,云底在同一高度上。 非技术性说明:垂直发展很可观的积云,一般都呈塔状,在此云底的同一高度上可伴有别种积云或层积云。";
}else if(temp=='3'){
CLCloud="技术性说明:秃积雨云,可伴有积云或层积云或层云。 非技术性说明:积雨云,顶部轮廓模糊,但显然不是卷云状的,也不是砧状的;可伴有积云或层积云或层云。";
}else if(temp=='4'){
CLCloud="技术性说明:积云性层积云。 非技术性说明:层积云,由积云扩展而成,时常伴有积云。";
}else if(temp=='5'){
CLCloud="技术性说明:层积云,不是积云性的。 非技术性说明:层积云、不是由积云扩展而成。";
}else if(temp=='6'){
CLCloud="技术性说明:层云和(或)碎层云,但不是恶劣天气的碎雨云。 非技术性说明:层云或碎层云,或层云和碎层云两者同时存在,但不是恶劣天气下的碎雨云。";
}else if(temp=='7'){
CLCloud="技术性说明:恶劣天气下的碎雨云,通常在高层云或雨层云之下。 非技术性说明:恶劣天气下的碎雨云,通常位于高层云或雨层云之下(恶劣天气指降水时或降水前后一小段时间内的天气状况)。";
}else if(temp=='8'){
CLCloud="技术性说明:积云和不是积云性的层积云同时存在,此两种云的底部高度不同。 非技术性说明:积云和不是由积云扩展而成的层积云同时存在,两种云底部不在同一高度上。";
}else if(temp=='9'){
CLCloud="技术性说明:鬃积雨云,常带砧状,可伴有积云、层积云、层云或恶劣天气下的碎云。 非技术性说明:具有清晰的纤维状的(即卷云状的)顶部的积雨云,云顶常带有砧状,可伴有积云、层积云、层云或恶劣天气下的的碎云。";
}else if(temp=='/'){
CLCloud="由于黑暗、或雾、或沙尘暴、或其他类似现象以致看不到属于CL的各属云";
}else{
CLCloud="无相关信息";
}
temp=tempString.charAt(2);
if(temp=='0'){
CMCloud="技术性说明:没有CM云。 非技术性说明:没有高积云、高层云、雨层云。";
}else if(temp=='1'){
CMCloud="技术性说明:透光高层云 非技术性说明:薄的(半透明的)高层云、从这种云看过去,可以朦胧地看到太阳或月亮,好象隔着一层毛玻璃一样。";
}else if(temp=='2'){
CMCloud="技术性说明:蔽光高层云或雨层云。 非技术性说明:厚的高层云或雨层云(有时从云层的某些部分看过去,可以找到比较明亮的小块来指示出太阳或月亮的位置)。";
}else if(temp=='3'){
CMCloud="技术性说明:透光高积云,较稳定,并且在同一个高度上。 非技术性说明:薄的(半透明的)高积云,各个云块没有显著变化,并且在同一高度上。";
}else if(temp=='4'){
CMCloud="技术性说明:透光高积云(常呈荚状)或荚状层积云,连续不断地在改变中,并且出现在一个或几个高度上。 非技术性说明:一块块薄的(半透明的)高积云片或层积云片(常呈荚状);云块连续不断地在变化中,并且出现在一个或几个高度上";
}else if(temp=='5'){
CMCloud="技术性说明:成带的或成层的透光高积云,有系统地侵入天空,常常全部增厚,甚至有一部分已变成蔽光高积云或复高积云。 非技术性说明:成带或成层的薄的(半透明的)高积云,迅速向天空扩展,并且全部增厚,它的一部分可能已变成不透光的或成为双层的。";
}else if(temp=='6'){
CMCloud="技术性说明:积云性高积云 非技术性说明:由积云或积雨云扩展而成的高积云。";
}else if(temp=='7'){
CMCloud="技术性说明:复高积云或蔽光高积云,不是有系统地侵盖天空;或者高层云和高积云同时存在。 非技术性说明:可能有下列情况:(1)双层高积云,通常有些部分不透明,不是有系统地侵盖天空;(2)一厚层的(不透明的)高积云;不是有系统地侵盖天空;(3)在同一高度上或在不同高度上有高层云和高积云。";
}else if(temp=='8'){
CMCloud="技术性说明:积云状高积云(絮状的或堡状的)或堡状层积云。 非技术性说明:呈积云形状的,一球一球的高积云或具有小塔形状的高积云或高层云。";
}else if(temp=='9'){
CMCloud="技术性说明:混乱天空的高积云,常出现在几个高度上。 非技术性说明:混乱天空的高积云,常出现在几个高度上。";
}else if(temp=='/'){
CMCloud="由于黑暗、或雾、或沙尘暴、或其他类似现象,或者完整的较低云层存在,以致看不到属于CM的各属云。";
}else{
CMCloud="无相关信息";
}
temp=tempString.charAt(3);
if(temp=='0'){
CHCloud="技术性说明:没有CH云 非技术说明:没有卷云、卷层云、卷积云";
}else if(temp=='1'){
CHCloud="技术性说明:毛卷云,分散在天空,不是有系统地侵盖天空。 非技术性说明:一丝丝的或一条条的卷云,分散在天空,不是有系统地侵盖天空(通常叫做马尾云)。;";
}else if(temp=='2'){
CHCloud="技术性说明:密卷云,成散片或卷曲束状,通常量不增加,有时好象是积雨云顶部的残余部分。 非技术性说明:散布的或卷曲的一束束的浓密的卷云,通常量不增加,有时好象是积雨云顶部的残余部分。;";
}else if(temp=='3'){
CHCloud="技术性说明:伪卷云,或为过去的积雨云的残余部分,或为远处母体看不到的积雨云的顶部。 非技术性说明:卷云,常为砧状,或者是积雨云顶部的残余部分,或为远处母体看不到的积雨云的顶部(假使对这种卷云是来自积雨云有怀疑时,那么应该报电码2);";
}else if(temp=='4'){
CHCloud="技术性说明:卷云(常常是钩卷云)有系统地侵盖天空,并且常常全部增厚。 非技术性说明:卷云(常常是钩状的)渐渐地在天空中伸展,并且常常全部增厚。;";
}else if(temp=='5'){
CHCloud="技术性说明:辐辏状卷云和卷层云,或只有卷层云,有系统地侵盖天空,且常全部增厚,但卷层云幕前缘的高度角不到45°。 非技术性说明:卷云(常成一带带的向地平线辐合)和卷层云,或只有卷层云;总是渐渐地在天空中伸展着,并且常常全部增厚,卷层云幕前缘的高度角不到45°。;";
}else if(temp=='6'){
CHCloud="技术性说明:辐辏状卷云和卷层云,或只有卷层云,有系统地侵盖天空,且常全部增厚,同时卷层云幕前缘的高度角已超过45°,但未布满全天。 非技术性说明:卷云(常成一带带的向地平线辐合)和卷层云,或只有卷层云;总是渐渐地在天空中伸展着,并且常常全部增厚,同时卷层云幕前缘的高度角已超过45°,但未布满全天。;";
}else if(temp=='7'){
CHCloud="技术性说明:卷层云布满全天。 非技术性说明:卷层云幕遮蔽整个天空。;";
}else if(temp=='8'){
CHCloud="技术性说明:卷层云,不是有系统地侵盖天空,也没有布满全天。 非技术性说明:卷层云,不是有系统地侵盖天空,也没有遮蔽整个天空。;";
}else if(temp=='9'){
CHCloud="技术性说明: 非技术性说明:只有卷积云;或卷积云伴有卷云或(和)卷层云,但卷积云量多于其他高云。;";
}else if(temp=='/'){
CHCloud="由于黑暗、或雾、或沙尘暴、或其他类似现象,或者完整的较低云层存在,以致看不到属于CH的各属云。";
}else{
CHCloud="无相关信息";
}
}else if(beginChar=='9'){
time_h=tempString.substring(1,3);
time_m=tempString.substring(3,5);
if(time_h.charAt(0)=='0'){
time_h=time_h.substring(1);
}
if(time_m.charAt(0)=='0'){
time_m=time_h.substring(1);
}
nowTime=time_h+":"+time_m;
}
}
}
}
//输出所有可用的编码信息
public void printAll(){
System.out.print("日期:");
System.out.println(year+"年 "+month+"月"+day+"日");
System.out.print("时间:");
System.out.println(nowTime);
System.out.print("台站号:");
System.out.println(stationNumber);
System.out.print("最低云的高度:");
System.out.println(lowestCloudHeightString);
System.out.print("有效能见度:");
System.out.println(effectiveVisibilityString);
System.out.print("总云量:");
System.out.println(totalCloudString);
System.out.print("风向:");
System.out.println(cloudDirection);
System.out.print("风速:");
System.out.println(cloudSpeedString);
System.out.print("气温:");
System.out.println(temperatureString);
System.out.print("露点温度:");
System.out.println(dewPoint);
System.out.print("站点气压:");
System.out.println(localPressure);
System.out.print("海平面气压:");
System.out.println(seaPressure);
System.out.print("气压变化:");
System.out.println(pressureChangeString);
System.out.print("降水量:");
System.out.println(precipitation);
System.out.print("天气现象:");
System.out.println(weatherPhenomena);
System.out.print("低状云情况:");
System.out.println(CLCloud);
System.out.print("中状云情况:");
System.out.println(CMCloud);
System.out.print("高状云情况:");
System.out.println(CHCloud);
System.out.print("总云量情况:");
System.out.println(cloudiness);
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
app newApp=new app();
name=newApp.getFileName();
if(newApp.FileName(name)){
String code=newApp.findStationNumber();
if("notExist".equals(code)){
System.out.println("请求的台站号不存在!");
}else{
System.out.println("请求的台站号编码为:");
System.out.println(code);
newApp.decode(code);
newApp.printAll();
}
// newApp.decode(code);
}
else{
System.out.println("未找到对应文件!");
}
}
}
| [
"lee2251222797@gmail.com"
] | lee2251222797@gmail.com |
2e32ab49ff032b0357716aa7423c66843c86797e | 9943481fb33d4155bb8311391083c30a499ffc14 | /src/com/franco/event/IdleEvent.java | da291047e31f090bfbda0e9319ccdd7ef5611fc9 | [] | no_license | francoccc/match-group | 96311c6e2e2463bd31b71f992e219eb7a47fdaa1 | 328b097db439d0fab63b4b19ce00ecbc6bd31387 | refs/heads/master | 2020-06-30T16:54:22.998523 | 2019-08-07T18:38:08 | 2019-08-07T18:38:08 | 200,890,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.franco.event;
import java.util.EventObject;
public class IdleEvent extends EventObject {
public IdleEvent(Object source) {
super(source);
}
}
| [
"850253432@qq.com"
] | 850253432@qq.com |
6719d88a0984bee7e2eb24c307e3b7c85c8c8817 | 707b6dae4692fdee92f8fc8e7a00bd6b3528bf78 | /org.tesoriero.cauce.task/src/tamm/Join.java | 05eaa43fc56c78f03b4a0017a048e58e436eed7a | [] | no_license | tesorieror/cauce | ec2c05b5b6911824bdf27f5bd64c678fd49037c3 | ef859fe6e81650a6671e6ad773115e5bc86d54ea | refs/heads/master | 2020-05-14T13:07:54.152875 | 2015-03-19T12:20:27 | 2015-03-19T12:20:27 | 32,517,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | /**
*/
package tamm;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Join</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link tamm.Join#getIncoming <em>Incoming</em>}</li>
* <li>{@link tamm.Join#getOngoing <em>Ongoing</em>}</li>
* </ul>
* </p>
*
* @see tamm.TammPackage#getJoin()
* @model abstract="true"
* @generated
*/
public interface Join extends RouteTask {
/**
* Returns the value of the '<em><b>Incoming</b></em>' reference list.
* The list contents are of type {@link tamm.InputConditionToJoinTask}.
* It is bidirectional and its opposite is '{@link tamm.InputConditionToJoinTask#getTarget <em>Target</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Incoming</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Incoming</em>' reference list.
* @see tamm.TammPackage#getJoin_Incoming()
* @see tamm.InputConditionToJoinTask#getTarget
* @model opposite="target" required="true"
* @generated
*/
EList<InputConditionToJoinTask> getIncoming();
/**
* Returns the value of the '<em><b>Ongoing</b></em>' reference.
* It is bidirectional and its opposite is '{@link tamm.JoinTaskToOutputCondition#getSource <em>Source</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ongoing</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ongoing</em>' reference.
* @see #setOngoing(JoinTaskToOutputCondition)
* @see tamm.TammPackage#getJoin_Ongoing()
* @see tamm.JoinTaskToOutputCondition#getSource
* @model opposite="source" required="true"
* @generated
*/
JoinTaskToOutputCondition getOngoing();
/**
* Sets the value of the '{@link tamm.Join#getOngoing <em>Ongoing</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ongoing</em>' reference.
* @see #getOngoing()
* @generated
*/
void setOngoing(JoinTaskToOutputCondition value);
} // Join
| [
"tesorieror@gmail.com"
] | tesorieror@gmail.com |
5d614ceb09b0f8aa86dfa5a09279b86f56f13799 | 7b48b1908f2e23b1d594c3fb0c175364cad8ac6d | /edu.pdx.svl.coDoc.cdt.core/src/edu/pdx/svl/coDoc/cdt/internal/core/parser/TemplateParameterManager.java | 07102dca8fed09210a49b2aed476e9be4b9d4949 | [] | no_license | hellozt/coDoc | 89bd3928a289dc5a1a53ef81d8048c82eb0cdf46 | 7015c431c9b903a19c0785631c7eb76d857e23cf | refs/heads/master | 2021-01-17T18:23:57.253024 | 2013-05-04T16:09:52 | 2013-05-04T16:09:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,436 | java | /*******************************************************************************
* Copyright (c) 2005 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 Rational Software - Initial API and implementation
*******************************************************************************/
package edu.pdx.svl.coDoc.cdt.internal.core.parser;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public final class TemplateParameterManager {
protected void reset() {
list = Collections.EMPTY_LIST;
emptySegmentCount = 0;
}
private TemplateParameterManager(int i) {
reset();
counterId = i;
}
private final int counterId;
private List list;
private int emptySegmentCount;
public List getTemplateArgumentsList() {
return list;
}
public void addSegment(List inputSegment) {
if (inputSegment == null) {
if (list == Collections.EMPTY_LIST)
++emptySegmentCount;
else
list.add(null);
} else {
if (list == Collections.EMPTY_LIST) {
list = new ArrayList();
for (int i = 0; i < emptySegmentCount; ++i)
list.add(null);
}
list.add(inputSegment);
}
}
private static final int NUMBER_OF_INSTANCES = 8;
private static final boolean[] instancesUsed = new boolean[NUMBER_OF_INSTANCES];
private static final TemplateParameterManager[] counters = new TemplateParameterManager[NUMBER_OF_INSTANCES];
private static int counter = 8;
static {
for (int i = 0; i < NUMBER_OF_INSTANCES; ++i) {
instancesUsed[i] = false;
counters[i] = new TemplateParameterManager(i);
}
}
/**
* @return
*/
public synchronized static TemplateParameterManager getInstance() {
int index = findFreeCounter();
if (index == -1)
return new TemplateParameterManager(++counter);
instancesUsed[index] = true;
return counters[index];
}
public synchronized static void returnInstance(TemplateParameterManager c) {
if (c.counterId > 0 && c.counterId < NUMBER_OF_INSTANCES)
instancesUsed[c.counterId] = false;
c.reset();
}
/**
* @return
*/
private static int findFreeCounter() {
for (int i = 0; i < NUMBER_OF_INSTANCES; ++i)
if (instancesUsed[i] == false)
return i;
return -1;
}
}
| [
"electronseu@gmail.com"
] | electronseu@gmail.com |
f896ab293c24a089cbadbfebf622280f7dd83571 | 77d52e50c64c94c0a31b93f64a2b88c0395c202e | /JUnitSuite/JunitTest1.java | 06952ff2e748460a6f675d82f449c5c996acade8 | [] | no_license | RamzanShahidkhan/Java-Projects | 258ecc275f75e2edc5a473041751e410f5cfc8fd | 5d78fc8c172b5815f8193b143d903b5594aeb5d1 | refs/heads/master | 2021-07-23T00:41:13.215538 | 2017-11-02T12:08:41 | 2017-11-02T12:08:41 | 109,261,600 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 362 | java |
import static org.junit.Assert.*;
import org.junit.Test;
public class JunitTest1 {
FirstDayAtSchool school = new FirstDayAtSchool();
String[] bag = {"Books", "Notebooks", "Pens"};
@Test
public void testPrepareMyBag() {
System.out.println("Inside testPrepareMyBag()");
assertArrayEquals(bag, school.prepareMyBag());
}
} | [
"mramzan4422@gmail.com"
] | mramzan4422@gmail.com |
6dd893f135c9ba84fa2f83fac81cc02fac245904 | a2ee3836586fadb752b6ec023fa121a8b7b83df7 | /app/src/main/java/com/shenhui/doubanfilm/bean/BoxSubjectBean.java | be62377549f0814ed14742f0bd0f7134cdefce01 | [] | no_license | sanousun/DoubanFilm | 2e8256da2d5c456fbd23a3ead7b22661fd8c9b08 | 84ccf007c2408fc8c0b8ddbebb6f32e2c21b06c9 | refs/heads/master | 2021-01-10T04:00:47.403911 | 2018-03-20T07:00:44 | 2018-03-20T07:00:44 | 43,955,336 | 19 | 4 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package com.shenhui.doubanfilm.bean;
import com.google.gson.annotations.SerializedName;
public class BoxSubjectBean {
private int box;
@SerializedName("new")
private boolean newX;
private int rank;
private SimpleSubjectBean subject;
public boolean isNewX() {
return newX;
}
public void setBox(int box) {
this.box = box;
}
public void setNewX(boolean newX) {
this.newX = newX;
}
public void setRank(int rank) {
this.rank = rank;
}
public void setSubject(SimpleSubjectBean subject) {
this.subject = subject;
}
public int getBox() {
return box;
}
public boolean getNewX() {
return newX;
}
public int getRank() {
return rank;
}
public SimpleSubjectBean getSubject() {
return subject;
}
}
| [
"sanousun@163.com"
] | sanousun@163.com |
836eb8b35be7cca320b914f7859f0745cb615131 | c706217975e7d3d80b8bb93886ca0b0b8342ef67 | /level0/짝수는_싫어요.java | e2f54ad71b7330699e5fe528b364b14d3af15389 | [] | no_license | CodeJin19/Programmers_PS | cb1384b6f505ab836be0eadf56ba1ee7e2cd5346 | d83675330ba8d69146c77031983d044e480c809c | refs/heads/master | 2023-07-19T06:00:11.484710 | 2023-07-10T14:38:35 | 2023-07-10T14:38:35 | 204,431,820 | 0 | 0 | null | 2023-05-27T13:44:38 | 2019-08-26T08:33:03 | Java | UTF-8 | Java | false | false | 260 | java | class Solution {
public int[] solution(int n) {
int[] answer = new int[(n + 1) / 2];
int num = 1;
for(int i = 0; i < answer.length; i++) {
answer[i] = num;
num += 2;
}
return answer;
}
} | [
"codejin19@gmail.com"
] | codejin19@gmail.com |
c82d1902cb6604cc42cc1424a6864ef8c2aecf5e | 863acb02a064a0fc66811688a67ce3511f1b81af | /sources/p005cm/aptoide/p006pt/MyStoreManager.java | 431d0e33bc5cfbfa9f7456f9d51c25f64f54786e | [
"MIT"
] | permissive | Game-Designing/Custom-Football-Game | 98d33eb0c04ca2c48620aa4a763b91bc9c1b7915 | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | refs/heads/master | 2020-08-04T00:02:04.876780 | 2019-10-06T06:55:08 | 2019-10-06T06:55:08 | 211,914,568 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package p005cm.aptoide.p006pt;
import org.jacoco.agent.p025rt.internal_8ff85ea.Offline;
/* renamed from: cm.aptoide.pt.MyStoreManager */
public class MyStoreManager {
private static transient /* synthetic */ boolean[] $jacocoData;
private static /* synthetic */ boolean[] $jacocoInit() {
boolean[] zArr = $jacocoData;
if (zArr != null) {
return zArr;
}
boolean[] probes = Offline.getProbes(4675091109079659734L, "cm/aptoide/pt/MyStoreManager", 2);
$jacocoData = probes;
return probes;
}
public MyStoreManager() {
$jacocoInit()[0] = true;
}
public static boolean shouldShowCreateStore() {
$jacocoInit()[1] = true;
return true;
}
}
| [
"tusharchoudhary0003@gmail.com"
] | tusharchoudhary0003@gmail.com |
e3974462500f74e1a140be0f209875c3d42192ae | cfca6d8c709863e8887259ff31cdfa4a662e8959 | /app/src/main/java/com/unava/dia/commentsdownloader/di/PerActivity.java | cd9fbbb774cc67934180b8e6ca48eb11211689b4 | [] | no_license | beyond-godlike/CommentsDownloader | 18f0bfb7276c0cc3464c3bd41ad058937a4a2f3a | 3a7317984c1c1e45661e6182f5a71c666a7ac066 | refs/heads/master | 2020-06-11T15:06:44.573411 | 2019-09-18T13:46:44 | 2019-09-18T13:46:44 | 194,006,373 | 0 | 0 | null | 2019-09-18T13:46:45 | 2019-06-27T02:09:41 | Java | UTF-8 | Java | false | false | 237 | java | package com.unava.dia.commentsdownloader.di;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface PerActivity {
}
| [
"dia_the_ghost@mail.ru"
] | dia_the_ghost@mail.ru |
c453eb0b0eabf8ebda274f5b2326815de5102a44 | 47a1dee4861a76e92cc8d9a16fd7b59c5141bf2e | /app/src/main/java/com/example/lvo/alertnotifications/ToyVpnService.java | 9cfebb86c440b85785e9d2233b70aadb201247b1 | [] | no_license | TurboAsteroid/oi_app | 4e19aa0925c2efc9b21a3bf4cc9308acf706ccac | 33e932421ed639e219ed1c3bd6675f187ce492f4 | refs/heads/master | 2020-11-24T20:24:59.675648 | 2020-01-14T07:17:27 | 2020-01-14T07:17:27 | 228,328,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,172 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.lvo.alertnotifications;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.VpnService;
import android.os.Handler;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import android.util.Pair;
import android.widget.Toast;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
public class ToyVpnService extends VpnService implements Handler.Callback {
private static final String TAG = ToyVpnService.class.getSimpleName();
public static final String ACTION_CONNECT = "com.example.android.toyvpn.START";
public static final String ACTION_DISCONNECT = "com.example.android.toyvpn.STOP";
private Handler mHandler;
private static class Connection extends Pair<Thread, ParcelFileDescriptor> {
public Connection(Thread thread, ParcelFileDescriptor pfd) {
super(thread, pfd);
}
}
private final AtomicReference<Thread> mConnectingThread = new AtomicReference<>();
private final AtomicReference<Connection> mConnection = new AtomicReference<>();
private AtomicInteger mNextConnectionId = new AtomicInteger(1);
private PendingIntent mConfigureIntent;
@Override
public void onCreate() {
// The handler is only used to show messages.
if (mHandler == null) {
mHandler = new Handler(this);
}
// Create the intent to "configure" the connection (just start ToyVpnClient).
mConfigureIntent = PendingIntent.getActivity(this, 0, new Intent(this, ToyVpnClient.class),
PendingIntent.FLAG_UPDATE_CURRENT);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null && ACTION_DISCONNECT.equals(intent.getAction())) {
disconnect();
return START_NOT_STICKY;
} else {
connect();
return START_STICKY;
}
}
@Override
public void onDestroy() {
disconnect();
}
@Override
public boolean handleMessage(Message message) {
Toast.makeText(this, message.what, Toast.LENGTH_SHORT).show();
if (message.what != R.string.disconnected) {
updateForegroundNotification(message.what);
}
return true;
}
private void connect() {
// Become a foreground service. Background services can be VPN services too, but they can
// be killed by background check before getting a chance to receive onRevoke().
updateForegroundNotification(R.string.connecting);
mHandler.sendEmptyMessage(R.string.connecting);
// Extract information from the shared preferences.
final SharedPreferences prefs = getSharedPreferences(ToyVpnClient.Prefs.NAME, MODE_PRIVATE);
final String server = prefs.getString(ToyVpnClient.Prefs.SERVER_ADDRESS, "");
final byte[] secret = prefs.getString(ToyVpnClient.Prefs.SHARED_SECRET, "").getBytes();
final int port;
try {
port = Integer.parseInt(prefs.getString(ToyVpnClient.Prefs.SERVER_PORT, ""));
} catch (NumberFormatException e) {
Log.e(TAG, "Bad port: " + prefs.getString(ToyVpnClient.Prefs.SERVER_PORT, null), e);
return;
}
// Kick off a connection.
startConnection(new ToyVpnConnection(
this, mNextConnectionId.getAndIncrement(), server, port, secret));
}
private void startConnection(final ToyVpnConnection connection) {
// Replace any existing connecting thread with the new one.
final Thread thread = new Thread(connection, "ToyVpnThread");
setConnectingThread(thread);
// Handler to mark as connected once onEstablish is called.
connection.setConfigureIntent(mConfigureIntent);
connection.setOnEstablishListener(new ToyVpnConnection.OnEstablishListener() {
public void onEstablish(ParcelFileDescriptor tunInterface) {
mHandler.sendEmptyMessage(R.string.connected);
mConnectingThread.compareAndSet(thread, null);
setConnection(new Connection(thread, tunInterface));
}
});
thread.start();
}
private void setConnectingThread(final Thread thread) {
final Thread oldThread = mConnectingThread.getAndSet(thread);
if (oldThread != null) {
oldThread.interrupt();
}
}
private void setConnection(final Connection connection) {
final Connection oldConnection = mConnection.getAndSet(connection);
if (oldConnection != null) {
try {
oldConnection.first.interrupt();
oldConnection.second.close();
} catch (IOException e) {
Log.e(TAG, "Closing VPN interface", e);
}
}
}
private void disconnect() {
mHandler.sendEmptyMessage(R.string.disconnected);
setConnectingThread(null);
setConnection(null);
stopForeground(true);
}
private void updateForegroundNotification(final int message) {
startForeground(1, new Notification.Builder(this)
.setSmallIcon(R.drawable.ic_vpn)
.setContentText(getString(message))
.setContentIntent(mConfigureIntent)
.build());
}
}
| [
"vlobarev@gmail.com"
] | vlobarev@gmail.com |
3ad0b58d57e0c0ea3e406fce7f3d1bad01246acf | 5874720a5f9fb4e632fdd442f65ac64e121db468 | /src/backtrack/SubSets.java | 0018f4ce1e4c67b4f46913f18d72700456e75b7f | [] | no_license | CccRJ/git-learning | d2d5c4a6ad7dc4be211e9a85aadac135db6129dd | 6805c658dbc6af357c7dfbf94be30bda64647877 | refs/heads/master | 2022-11-30T06:56:53.538479 | 2020-08-12T15:45:00 | 2020-08-12T15:45:00 | 286,760,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package backtrack;
import java.util.ArrayList;
import java.util.List;
public class SubSets {
/*
* 78 子集
* 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)
* 回溯
* */
public List<List<Integer>> subsets(int[] nums){
List<List<Integer>> res = new ArrayList<>();
backtrack(nums,0,res,new ArrayList<Integer>());
return res;
}
private void backtrack(int[] nums,int start,List<List<Integer>> res,List<Integer> temp){
res.add(new ArrayList<>(temp));
for (int i = start; i < nums.length; i++) {
temp.add(nums[i]);
backtrack(nums,i + 1,res,temp);
temp.remove(temp.size() - 1);
}
}
}
| [
"769167629@qq.com"
] | 769167629@qq.com |
08278aa3fd2b45d5bebdbe1a80bbceeec492b00b | aff669e7dbab35ab8838595d0f2dee825393d8d4 | /src/gravity/simulation/display/graphics/GPUManager.java | b28d8f124c6943ad422bd0fe5b1d20ef15f2a83a | [] | no_license | Asnarok/gravity2D | 3a0c9b7177a7311bccc0658aacd090073d48bb75 | efa7a22d902615252f7aebef3f660688f108826b | refs/heads/master | 2020-06-01T03:41:25.041461 | 2019-07-22T10:20:12 | 2019-07-22T10:20:12 | 190,619,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,954 | java | package gravity.simulation.display.graphics;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import gravity.simulation.display.graphics.model.GPolygon;
import gravity.simulation.display.graphics.model.RawModel;
import gravity.simulation.display.graphics.model.StaticObject;
import gravity.simulation.math.Vector2f;
public class GPUManager {
private List<Integer> vaos = new ArrayList<Integer>();
private List<Integer> vbos = new ArrayList<Integer>();
public RawModel loadToVAO(float[] positions,int[] indices){
int vaoID = createVAO();
bindIndicesBuffer(indices);
storeDataInAttributeList(0,positions);
unbindVAO();
return new RawModel(vaoID,indices.length);
}
public StaticObject loadToVAO(String fileName, Vector2f offset, float scale, float[] color) {
GPolygon p = OBJLoader.loadSimpeOBJ(fileName);
int vaoID = createVAO();
int[] colorIndices = new int[p.getIndices().length];
for(int i = 0; i < colorIndices.length; i++) {
colorIndices[i] = 0;
}
bindIndicesBuffer(p.getIndices());
storeDataInAttributeList(0, p.getVertices());
bindIndicesBuffer(colorIndices);
storeDataInAttributeList(1, scale);
bindIndicesBuffer(colorIndices);
storeDataInAttributeList(2, new float[] {offset.getX(), offset.getY()});
bindIndicesBuffer(colorIndices);
storeDataInAttributeList(3, color);
unbindVAO();
return new StaticObject(new RawModel(vaoID, p.getIndices().length), offset, color, scale);
}
public void cleanUp(){
for(int vao:vaos){
GL30.glDeleteVertexArrays(vao);
}
for(int vbo:vbos){
GL15.glDeleteBuffers(vbo);
}
}
private int createVAO(){
int vaoID = GL30.glGenVertexArrays();
vaos.add(vaoID);
GL30.glBindVertexArray(vaoID);
return vaoID;
}
private void storeDataInAttributeList(int attributeNumber, float[] data){
int vboID = GL15.glGenBuffers();
vbos.add(vboID);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID);
FloatBuffer buffer = storeDataInFloatBuffer(data);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
GL20.glVertexAttribPointer(attributeNumber, 2, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
private void storeDataInAttributeList(int attributeNumber, float data){
int vboID = GL15.glGenBuffers();
vbos.add(vboID);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID);
FloatBuffer buffer = storeDataInFloatBuffer(new float[] {data});
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
GL20.glVertexAttribPointer(attributeNumber, 1, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
private void unbindVAO(){
GL30.glBindVertexArray(0);
}
private void bindIndicesBuffer(int[] indices){
int vboID = GL15.glGenBuffers();
vbos.add(vboID);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboID);
IntBuffer buffer = storeDataInIntBuffer(indices);
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
}
private IntBuffer storeDataInIntBuffer(int[] data){
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
private FloatBuffer storeDataInFloatBuffer(float[] data){
FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
}
| [
"matteo.chanourdie@gmail.com"
] | matteo.chanourdie@gmail.com |
dd9cc0897c3fe52aa1a3b6a3aaa402d697e490db | 86746294f3c83c89ed6fea54522944b04fdd5b18 | /cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/types/css/InlineStylesForNode.java | 4fedd90d9ce7831c1ef251896eb3f36a8d353b66 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sechawk/chrome-devtools-java-client | cd029ce51fe0339cedb822fa84a0049798de6b7a | 5720062f2ac4918c322d93f717c1f6e5f66ab7f0 | refs/heads/master | 2021-06-25T04:09:49.619320 | 2020-12-18T18:28:01 | 2020-12-18T18:28:01 | 186,698,915 | 0 | 0 | Apache-2.0 | 2019-05-14T20:53:53 | 2019-05-14T20:53:53 | null | UTF-8 | Java | false | false | 1,515 | java | package com.github.kklisura.cdt.protocol.types.css;
/*-
* #%L
* cdt-java-client
* %%
* Copyright (C) 2018 Kenan Klisura
* %%
* 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.
* #L%
*/
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
public class InlineStylesForNode {
@Optional private CSSStyle inlineStyle;
@Optional private CSSStyle attributesStyle;
/** Inline style for the specified DOM node. */
public CSSStyle getInlineStyle() {
return inlineStyle;
}
/** Inline style for the specified DOM node. */
public void setInlineStyle(CSSStyle inlineStyle) {
this.inlineStyle = inlineStyle;
}
/** Attribute-defined element style (e.g. resulting from "width=20 height=100%"). */
public CSSStyle getAttributesStyle() {
return attributesStyle;
}
/** Attribute-defined element style (e.g. resulting from "width=20 height=100%"). */
public void setAttributesStyle(CSSStyle attributesStyle) {
this.attributesStyle = attributesStyle;
}
}
| [
"kklisura@hotmail.com"
] | kklisura@hotmail.com |
8e0cf58e46dcee500c57a80a2ca69748884b8a82 | cea798c0f62406f73130cc855f05ef59dc6a6383 | /intellij/FormaleSprachen_03/src/recognizer/recognizerListener.java | 9f49e424c6132a551dc8a645240905747614279f | [] | no_license | ldeichmann/workspace | 917b9cac30441105ec43be33643e1015855779f7 | 418e1a8b8c08c11e166cdd409a52cde87c1bb5a0 | refs/heads/master | 2021-06-13T22:30:36.204234 | 2017-01-17T21:10:28 | 2017-01-17T21:10:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,388 | java | // Generated from /home/cru/Code/workspace/intellij/FormaleSprachen_03/src/recognizer.g4 by ANTLR 4.5.3
package recognizer;
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
* This interface defines a complete listener for a parse tree produced by
* {@link recognizerParser}.
*/
public interface recognizerListener extends ParseTreeListener {
/**
* Enter a parse tree produced by {@link recognizerParser#script}.
* @param ctx the parse tree
*/
void enterScript(recognizerParser.ScriptContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#script}.
* @param ctx the parse tree
*/
void exitScript(recognizerParser.ScriptContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#block}.
* @param ctx the parse tree
*/
void enterBlock(recognizerParser.BlockContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#block}.
* @param ctx the parse tree
*/
void exitBlock(recognizerParser.BlockContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#variable}.
* @param ctx the parse tree
*/
void enterVariable(recognizerParser.VariableContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#variable}.
* @param ctx the parse tree
*/
void exitVariable(recognizerParser.VariableContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#comparison}.
* @param ctx the parse tree
*/
void enterComparison(recognizerParser.ComparisonContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#comparison}.
* @param ctx the parse tree
*/
void exitComparison(recognizerParser.ComparisonContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#add}.
* @param ctx the parse tree
*/
void enterAdd(recognizerParser.AddContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#add}.
* @param ctx the parse tree
*/
void exitAdd(recognizerParser.AddContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#sub}.
* @param ctx the parse tree
*/
void enterSub(recognizerParser.SubContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#sub}.
* @param ctx the parse tree
*/
void exitSub(recognizerParser.SubContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#mul}.
* @param ctx the parse tree
*/
void enterMul(recognizerParser.MulContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#mul}.
* @param ctx the parse tree
*/
void exitMul(recognizerParser.MulContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#div}.
* @param ctx the parse tree
*/
void enterDiv(recognizerParser.DivContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#div}.
* @param ctx the parse tree
*/
void exitDiv(recognizerParser.DivContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#pow}.
* @param ctx the parse tree
*/
void enterPow(recognizerParser.PowContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#pow}.
* @param ctx the parse tree
*/
void exitPow(recognizerParser.PowContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#fac}.
* @param ctx the parse tree
*/
void enterFac(recognizerParser.FacContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#fac}.
* @param ctx the parse tree
*/
void exitFac(recognizerParser.FacContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#lt}.
* @param ctx the parse tree
*/
void enterLt(recognizerParser.LtContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#lt}.
* @param ctx the parse tree
*/
void exitLt(recognizerParser.LtContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#gt}.
* @param ctx the parse tree
*/
void enterGt(recognizerParser.GtContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#gt}.
* @param ctx the parse tree
*/
void exitGt(recognizerParser.GtContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#expr}.
* @param ctx the parse tree
*/
void enterExpr(recognizerParser.ExprContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#expr}.
* @param ctx the parse tree
*/
void exitExpr(recognizerParser.ExprContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#val_or_var}.
* @param ctx the parse tree
*/
void enterVal_or_var(recognizerParser.Val_or_varContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#val_or_var}.
* @param ctx the parse tree
*/
void exitVal_or_var(recognizerParser.Val_or_varContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#val}.
* @param ctx the parse tree
*/
void enterVal(recognizerParser.ValContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#val}.
* @param ctx the parse tree
*/
void exitVal(recognizerParser.ValContext ctx);
/**
* Enter a parse tree produced by {@link recognizerParser#var}.
* @param ctx the parse tree
*/
void enterVar(recognizerParser.VarContext ctx);
/**
* Exit a parse tree produced by {@link recognizerParser#var}.
* @param ctx the parse tree
*/
void exitVar(recognizerParser.VarContext ctx);
} | [
"lukasdeichmann+github@gmail.com"
] | lukasdeichmann+github@gmail.com |
0fcc32304e9bf70c4396332126d9d3dd54c59a07 | 9cc054d1e3a90af76a5e5762b7a58ddfa3df9907 | /vertx-pg-client/src/test/java/io/vertx/pgclient/data/BinaryDataTypesSimpleCodecTest.java | c4922a1e52bef1398be511ddb78bc19f3b012422 | [
"Apache-2.0"
] | permissive | barreiro/vertx-sql-client | c46f51d470ce18eea5a44fd32cb982a6cbf89044 | 57db51001489717f790317e231085471bfb1de2e | refs/heads/master | 2022-11-05T06:06:04.951949 | 2020-06-30T02:00:53 | 2020-06-30T02:08:05 | 275,971,295 | 0 | 0 | Apache-2.0 | 2020-06-30T02:00:01 | 2020-06-30T02:00:00 | null | UTF-8 | Java | false | false | 2,750 | java | package io.vertx.pgclient.data;
import io.vertx.core.buffer.Buffer;
import io.vertx.ext.unit.TestContext;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.Tuple;
import org.junit.Test;
public class BinaryDataTypesSimpleCodecTest extends SimpleQueryDataTypeCodecTestBase {
@Test
public void testByteaHexFormat1(TestContext ctx) {
testDecodeGeneric(ctx, "12345678910", "BYTEA", "Buffer1", Tuple::getBuffer, Row::getBuffer, Buffer.buffer("12345678910"));
}
@Test
public void testByteaHexFormat2(TestContext ctx) {
testDecodeGeneric(ctx, "\u00DE\u00AD\u00BE\u00EF", "BYTEA", "Buffer2", Tuple::getBuffer, Row::getBuffer, Buffer.buffer("\u00DE\u00AD\u00BE\u00EF"));
}
@Test
public void testByteaEscapeBackslash(TestContext ctx) {
testDecodeGeneric(ctx, "\\\\\\134", "BYTEA", "Buffer3", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(new byte[]{0x5C, 0x5C}));
}
@Test
public void testByteaEscapeNonPrintableOctets(TestContext ctx) {
testDecodeGeneric(ctx, "\\001\\007", "BYTEA", "Buffer4", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(new byte[]{0x01, 0x07}));
}
@Test
public void testByteaEscapePrintableOctets(TestContext ctx) {
testDecodeGeneric(ctx, "123abc", "BYTEA", "Buffer5", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(new byte[]{'1', '2', '3', 'a', 'b', 'c'}));
}
@Test
public void testByteaEscapeSingleQuote(TestContext ctx) {
testDecodeGeneric(ctx, "\'\'", "BYTEA", "Buffer6", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(new byte[]{0x27}));
}
@Test
public void testByteaEscapeZeroOctet(TestContext ctx) {
testDecodeGeneric(ctx, "\\000", "BYTEA", "Buffer7", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(new byte[]{0x00}));
}
@Test
public void testByteaEscapeFormat(TestContext ctx) {
testDecodeGeneric(ctx, "abc \\153\\154\\155 \\052\\251\\124", "BYTEA", "Buffer8", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(new byte[]{'a', 'b', 'c', ' ', 'k', 'l', 'm', ' ', '*', (byte) 0xA9, 'T'}));
}
@Test
public void testByteaEmptyString(TestContext ctx) {
testDecodeGeneric(ctx, "", "BYTEA", "Buffer9", Tuple::getBuffer, Row::getBuffer, Buffer.buffer(""));
}
@Test
public void testDecodeHexByteaArray(TestContext ctx) {
testDecodeGenericArray(ctx, "ARRAY [decode('48454c4c4f', 'hex') :: BYTEA]", "BufferArray", Tuple::getBufferArray, Row::getBufferArray, Buffer.buffer("HELLO"));
}
@Test
public void testDecodeEscapeByteaArray(TestContext ctx) {
testDecodeGenericArray(ctx, "ARRAY [decode('abc \\153\\154\\155 \\052\\251\\124', 'escape') :: BYTEA]", "BufferArray2", Tuple::getBufferArray, Row::getBufferArray, Buffer.buffer(new byte[]{'a', 'b', 'c', ' ', 'k', 'l', 'm', ' ', '*', (byte) 0xA9, 'T'}));
}
}
| [
"julien@julienviet.com"
] | julien@julienviet.com |
d8488447a752445e68dd5669954a1db62d2e0ca1 | af2810da0ec21cd77b631f55ab0161a3207347cb | /src/main/java/problema03/Solucion2.java | 167f13167491a7f489d270858f05ad812c11c8d2 | [] | no_license | FranMontejo/guia-09 | 00125647528b6608b3081eea67848a77dd2cd85f | 597f3d5f55615e5f163ff0cf5e22c86045a4971b | refs/heads/master | 2022-06-14T11:53:25.084660 | 2020-05-05T22:20:26 | 2020-05-05T22:20:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package problema03;
public class Solucion2 implements Solucion{
public SecuenciaMaxima subsecuenciaMaxima(Secuencia m) {
return new SecuenciaMaxima();
}
}
| [
"mdomingu@gmailcom"
] | mdomingu@gmailcom |
1d1572278d8803c80fe6d45f6d675c7bc96b3959 | 461be082a6e205fe39571f47a7c2e8701af6b099 | /injavawetrust.springmvc/src/_05/parameterMethodNameResolver/controller/OrderController.java | 57f846389bde5cdc438f958736b8f63a0c1211e0 | [] | no_license | anjijava16/Injavawetrust-springmvc-tutorial | bd11daac12c7a86078fee4f54d685955ceadf1cd | 1e9766961754da1c9e3029192e13ac739712411d | refs/heads/master | 2021-01-13T14:59:58.097157 | 2016-07-02T09:36:09 | 2016-07-02T09:36:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package _05.parameterMethodNameResolver.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
// public class MultiActionController extends AbstractController implements
// LastModified { ...}
public class OrderController extends MultiActionController {
// public (ModelAndView | Map | String | void) actionName(HttpServletRequest
// request, HttpServletResponse response, [,HttpSession] [,AnyObject]);
public String add(HttpServletRequest request, HttpServletResponse response) {
request.setAttribute("message", "add method");
return "05.parameterMethodNameResolver.view/add";
}
public ModelAndView remove(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("05.parameterMethodNameResolver.view/remove");
modelAndView.addObject("message", "remove method");
return modelAndView;
}
public ModelAndView list(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) {
modelAndView.setViewName("05.parameterMethodNameResolver.view/list");
modelAndView.addObject("message", "list method");
return modelAndView;
}
}
| [
"erguder.levent@gmail.com"
] | erguder.levent@gmail.com |
fd8b2da7329dda937915ef1cb2d87fd7298e6411 | 3ad9ce67bae83a8130d6752e8ab81e57ee3a24ec | /src/Operation.java | 6449e6972d37aaeb93eeab915af76f85a4ab3e28 | [] | no_license | anshulbajpai/RomanCalculator | 6b2b0fe0c05e5160534fbb3b1252366f4e055e6e | eaaa08b37d9c43801b56c865dd053a3a9a220bbd | refs/heads/master | 2020-05-20T03:05:42.578514 | 2013-05-30T10:41:43 | 2013-05-30T10:41:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | public interface Operation {
int evaluate(int seed, Symbol previousSymbol);
}
| [
"bajpai.anshul@gmail.com"
] | bajpai.anshul@gmail.com |
2edb3e8271aa4a0024f6ca626a3674864e092589 | a140ffc6af2a35ba915a62b4e92d4317057b8db6 | /src/main/java/org/zalando/putittorest/RestClientAutoConfiguration.java | 45fff33c371e866d52194bae7137f7b949a15dc3 | [
"MIT"
] | permissive | rjumurov/put-it-to-rest | b23039c5b21ed24200459edb99faf4a2a03ab474 | ce402ddddd2d678ec8d230a7d54da9321e66d29c | refs/heads/master | 2020-12-24T19:46:26.553230 | 2016-06-13T19:25:13 | 2016-06-13T19:25:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package org.zalando.putittorest;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
@Configuration
@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE)
public class RestClientAutoConfiguration {
@Bean
public static RestClientPostProcessor restClientPostProcessor() {
return new RestClientPostProcessor();
}
}
| [
"willi.schoenborn@zalando.de"
] | willi.schoenborn@zalando.de |
f7aa2bd596d66acea83306e8a4da05eaca76f466 | d009b8112e694353f6f3f3a369a83a1fcf4bf99f | /survey/src/main/java/com/jxlg/entity/User.java | 5db26563a5cb7c340c33beeb1cbfda679c9379d4 | [] | no_license | Huwei1993/- | fd770269b4a6ea3a0ee97c2cf306b6e9ed13d31e | e0359c932f018c608d47f62f2282fbf97144bac9 | refs/heads/master | 2021-01-09T06:57:11.873842 | 2016-07-10T16:20:40 | 2016-07-10T16:20:40 | 63,008,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,328 | java | package com.jxlg.entity;
/**
* 用户实体类
* @author feng
*
*/
public class User {
private int uid; // 用户id
private String number; // 用户账号
private String password; // 用户密码
private String email; // 用户邮箱
private int peid; // 用户权限等级id
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getPeid() {
return peid;
}
public void setPeid(int peid) {
this.peid = peid;
}
public User(int uid, String number, String password, String email, int peid) {
super();
this.uid = uid;
this.number = number;
this.password = password;
this.email = email;
this.peid = peid;
}
public User() {
super();
}
@Override
public String toString() {
return "User [uid=" + uid + ", number=" + number + ", password="
+ password + ", email=" + email + ", peid=" + peid + "]";
}
}
| [
"huwei1993@huwei1993-PC"
] | huwei1993@huwei1993-PC |
f98ad7712ec57f60470628b33bfe3b2edf89331d | 3c4fb71065c1ced5e991b69f417ed4f98d8a453b | /Nexpa/src/com/lpoezy/nexpa/chatservice/ChatMessagesService.java | c64a11de37ab286d4602983f5a362fa741b597e3 | [] | no_license | fitzroycorpuz/Nexpa | 0375e2e02d6c90fdb9bf52bc19dcf9fa3972107e | 08cd658706fc1190bf9c2077332f6d64d96767cc | refs/heads/master | 2021-01-10T11:29:25.739632 | 2015-11-03T04:57:30 | 2015-11-03T04:57:30 | 45,430,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,431 | java | package com.lpoezy.nexpa.chatservice;
import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import com.android.volley.Request.Method;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.lpoezy.nexpa.R;
import com.lpoezy.nexpa.activities.ChatActivity;
import com.lpoezy.nexpa.activities.ChatHistoryActivity;
import com.lpoezy.nexpa.activities.TabHostActivity;
import com.lpoezy.nexpa.configuration.AppConfig;
import com.lpoezy.nexpa.configuration.AppController;
import com.lpoezy.nexpa.objects.Correspondent;
import com.lpoezy.nexpa.openfire.XMPPLogic;
import com.lpoezy.nexpa.sqlite.SQLiteHandler;
import com.lpoezy.nexpa.utility.L;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.widget.Toast;
//started in TabHostActivity class onResume
public class ChatMessagesService extends Service {
private IBinder mBinder = new LocalBinder();
public static boolean isRunning;
public class LocalBinder extends Binder{
public ChatMessagesService getService(){ return ChatMessagesService.this; }
}
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
isRunning = false;
L.debug("ChatMessagesService onDestroy");
}
@Override
public void onCreate() {
L.debug("ChatMessagesService, onCreate");
super.onCreate();
isRunning = true;
onReceiveChatMessages();
}
//create a connection with xmpp,
//and listen to any incoming messages
public void onReceiveChatMessages() {
L.debug("onReceiveChatMessages");
SQLiteHandler db = new SQLiteHandler(this);
db.openToWrite();
db.updateBroadcasting(0);
db.updateBroadcastTicker(0);
XMPPConnection connection = XMPPLogic.getInstance().getConnection();
PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
if(connection!=null){
connection.addPacketListener(new PacketListener() {
@Override
public void processPacket(Packet packet) {
final Message message = (Message) packet;
if (message.getBody() != null) {
final String fromName = StringUtils.parseBareAddress(message
.getFrom());
final String tag_string_req = "get_single";
StringRequest strReq = new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener < String > () {
@Override
public void onResponse(String response) {
L.debug("response: " + response.toString());
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
L.debug("msg? "+message.getBody());
if (!error) {
L.debug("getting sender's credential");
String uid = jObj.getString("uid");
JSONObject user = jObj.getJSONObject("user");
String name = user.getString("name");
String email = user.getString("email");
Correspondent correspondent = new Correspondent();
correspondent.setUsername(name);
correspondent.setEmail(email);
OneComment comment = new OneComment(false, message.getBody(), true);
comment.isUnread = true;
correspondent.addMessage(comment);
//check if there is an available activity to,
//receive the brodacast
if(!TabHostActivity.isRunning
&& !ChatHistoryActivity.isRunning
&& !ChatActivity.isRunning){
saveMesageOffline(correspondent);
L.debug("sending nottification!");
//send notification
sendNotification(correspondent);
}else{
//save mesage offline
//if ChatHistoryActivity is running
if(!ChatActivity.isRunning){
saveMesageOffline(correspondent);
}
//send broadcast
Intent broadcast = new Intent(AppConfig.ACTION_RECEIVED_MSG);
broadcast.putExtra("email", correspondent.getEmail());
broadcast.putExtra("username", correspondent.getUsername());
broadcast.putExtra("fname", correspondent.getFname());
broadcast.putExtra("msg", message.getBody());
L.debug("sending broadcast!");
sendBroadcast(broadcast);
}
} else {
String errorMsg = jObj.getString("error_msg");
Toast.makeText(getApplicationContext(), errorMsg, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {@Override
public void onErrorResponse(VolleyError error) {
L.error("error: " + error.getMessage());
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_LONG).show();
}
}) {@Override
protected Map < String, String > getParams() {
Map < String, String > params = new HashMap < String, String > ();
params.put("tag", tag_string_req);
params.put("username", fromName.split("@")[0]);
return params;
}
};
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
//OneComment comment = new OneComment(false, message.getBody(), true);
}
}
}, filter);
}
// Account ac = new Account();
// ac.LogInChatAccount(db.getUsername(), db.getPass(), db.getEmail(), new OnXMPPConnectedListener() {
//
// @Override
// public void onXMPPConnected() {
//
// onTabHostActivtyReadyListener.onTabHostActivtyReady();
//
//
//
// }
// });
}
private void saveMesageOffline(Correspondent correspondent) {
//save only the message,
//if sender is already exist in db
if(correspondent.isExisting(getApplicationContext())){
correspondent.getConversation().get(0).saveOffline(getApplicationContext(), correspondent.getId());
//save both the sender and the message,
//if sender doesn't exist in db
}else{
correspondent.saveOffline(getApplicationContext(), false);
}
}
private PendingIntent getNotificationPendingIntent(Correspondent correspondent) {
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, ChatActivity.class);
resultIntent.putExtra("email", correspondent.getEmail());
resultIntent.putExtra("username", correspondent.getUsername());
resultIntent.putExtra("fname", correspondent.getFname());
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(ChatActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
return stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
}
private void sendNotification(Correspondent correspondent) {
int msgCount = OneComment.getUnReadMsgCountOffline(getApplicationContext());
String title = (msgCount>1)? " new messages" : " new message";
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(msgCount + title)
.setAutoCancel(true)
.setContentText(correspondent.getUsername());
mBuilder.build().flags |= Notification.FLAG_AUTO_CANCEL;
PendingIntent resultPendingIntent = getNotificationPendingIntent(correspondent);
// if (Build.VERSION.SDK_INT == 19) {
// resultPendingIntent.cancel();
// }
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(AppConfig.MSG_NOTIFICATION_ID, mBuilder.build());
}
}
| [
"lui.donios@gmail.com"
] | lui.donios@gmail.com |
b9d120a8f06be75dd1c9814dce5c4f1fc6a0a0d0 | f12f127af43dfd47847e2ce8401cdafa3900012f | /src/main/java/com/rong/web/action/NewsController.java | 0b35d57a81876ece9c507867f4b6e1a97d036215 | [] | no_license | llrong/NewsReleaseSystem | dcde5cf4f46a3f3c04fd11ea18831c016ab86805 | b1e3382977301b09107f76520b67a86617be74c2 | refs/heads/master | 2022-07-01T00:28:03.499861 | 2019-06-20T16:52:33 | 2019-06-20T16:52:33 | 181,848,815 | 1 | 0 | null | 2022-06-17T02:08:04 | 2019-04-17T08:25:22 | Java | UTF-8 | Java | false | false | 14,853 | java | package com.rong.web.action;
import com.rong.service.CommentService;
import com.rong.service.NewsInfoService;
import com.rong.service.NewsTypeService;
import com.rong.utils.DateTimeUtils;
import com.rong.web.pojo.Comment;
import com.rong.web.pojo.NewsInfo;
import com.rong.web.pojo.NewsType;
import com.rong.web.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.Response;
import java.io.*;
import java.util.*;
@Controller
@RequestMapping("/news")
public class NewsController
{
@Autowired
private NewsInfoService newsInfoService;
@Autowired
private NewsTypeService newsTypeService;
@Autowired
private CommentService commentService;
@RequestMapping(value = "/addNews", method = RequestMethod.POST)
// @ResponseBody
public String addNews(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "title") String title,
@RequestParam(value = "digest") String digest,
@RequestParam(value = "type") String type,
@RequestParam(value = "content") String content, HttpServletRequest request,
HttpServletResponse response) throws IOException{
response.setContentType("text/html;charset=utf-8");
PrintWriter printWriter = response.getWriter();
if(title.equals("")){
printWriter.println("<script language='javascript'>alert('请输入新闻标题!');</script>");
}else if(content.equals("")){
printWriter.println("<script language='javascript'>alert('请输入新闻内容!');</script>");
}else{
NewsInfo newsInfo = new NewsInfo();
User user = (User)request.getSession().getAttribute("user");
if(user == null ){
printWriter.println("<script language='javascript'>alert('请先登录!');</script>");
}else{
NewsType newsType= newsTypeService.selectByName(type);
if(newsType != null){
if(file != null){
try {
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(new File("E:\\IntelliJ IDEA\\NewsReleaseSystem\\src\\main\\resources\\static\\picture\\"+file.getOriginalFilename())));//保存图片到目录下
out.write(file.getBytes());
out.flush();
out.close();
String filename="/picture/"+file.getOriginalFilename();
newsInfo.setPicture(filename);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
newsInfo.setTypeId(newsType.getId());
newsInfo.setAuthor(user.getUserName());
newsInfo.setTitle(title);
newsInfo.setDigest(digest);
newsInfo.setContent(content);
newsInfo.setCreated(DateTimeUtils.getCurrentTime());
newsInfo.setHits(0);
newsInfo.setRemark(user.getId().toString());
newsInfo.setDeleted((byte) 0);
newsInfo.setIsCheck((byte) 0);
newsInfo.setIsCheck((byte) 1);
newsInfoService.insertNews(newsInfo);
printWriter.println("<script language='javascript'>alert('添加成功!');</script>");
}
else{
printWriter.println("<script language='javascript'>alert('新闻类型不存在!');</script>");
}
}
}
return "news/addNews";
}
@RequestMapping(value = "/addagain", method = RequestMethod.POST)
// @ResponseBody
public String addagain(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "title") String title,
@RequestParam(value = "digest") String digest,
@RequestParam(value = "type") String type,
@RequestParam(value = "content") String content, HttpServletRequest request,
HttpServletResponse response) throws IOException{
response.setContentType("text/html;charset=utf-8");
PrintWriter printWriter = response.getWriter();
if(title.equals("")){
printWriter.println("<script language='javascript'>alert('请输入新闻标题!');</script>");
}else if(content.equals("")){
printWriter.println("<script language='javascript'>alert('请输入新闻内容!');</script>");
}else{
NewsInfo newsInfo = new NewsInfo();
User user = (User)request.getSession().getAttribute("user");
if(user == null ){
printWriter.println("<script language='javascript'>alert('请先登录!');</script>");
}else{
NewsType newsType= newsTypeService.selectByName(type);
if(newsType != null){
if(file != null){
try {
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(new File("E:\\IntelliJ IDEA\\NewsReleaseSystem\\src\\main\\resources\\static\\picture\\"+file.getOriginalFilename())));//保存图片到目录下
out.write(file.getBytes());
out.flush();
out.close();
String filename="/picture/"+file.getOriginalFilename();
newsInfo.setPicture(filename);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
newsInfo.setTypeId(newsType.getId());
newsInfo.setAuthor(user.getUserName());
newsInfo.setTitle(title);
newsInfo.setDigest(digest);
newsInfo.setContent(content);
newsInfo.setCreated(DateTimeUtils.getCurrentTime());
newsInfo.setHits(0);
newsInfo.setRemark(user.getId().toString());
newsInfo.setDeleted((byte) 0);
newsInfo.setIsCheck((byte) 0);
newsInfo.setIsCheck((byte) 1);
newsInfoService.insertNews(newsInfo);
printWriter.println("<script language='javascript'>alert('添加成功!');</script>");
}
else{
printWriter.println("<script language='javascript'>alert('新闻类型不存在!');</script>");
}
}
}
return "news/updateNews";
}
// @RequestMapping(value = "/baocun", method = RequestMethod.POST)
//// @ResponseBody
// public String baocun( HttpServletRequest request, HttpServletResponse response) throws IOException{
// String type = request.getParameter("type");
// String digest = request.getParameter("digest");
// String content = request.getParameter("content");
// String title = request.getParameter("title");
// NewsInfo newsInfo = new NewsInfo();
// int result;
// User user = (User)request.getSession().getAttribute("user");
// if(user == null ){
// result = 0;
// }else{
// NewsType newsType= newsTypeService.selectByName(type);
// if(newsType != null){
// newsInfo.setTypeId(newsType.getId());
// newsInfo.setAuthor(user.getUserName());
// newsInfo.setTitle(title);
// newsInfo.setDigest(digest);
// newsInfo.setContent(content);
// newsInfo.setCreated(DateTimeUtils.getCurrentTime());
// newsInfo.setHits(0);
// newsInfo.setRemark(user.getId().toString());
// newsInfo.setIsCheck((byte) 0);
// newsInfoService.insertNews(newsInfo);
//
// }
// }
// return result;
//
// }
@RequestMapping(value = "/deleted",method = RequestMethod.POST)
@ResponseBody
public int deleteNews(HttpServletRequest request) {
int id = Integer.parseInt(request.getParameter("newsid"));
System.out.println("id: "+id);
int result =0 ;
result = newsInfoService.deleteNewsById(id);
return result;
}
@RequestMapping("/queryNews")
public String queryAllNews(Model model) {
List<NewsInfo> list = newsInfoService.selectAllNews();
List<Map<String, Object>> result = new ArrayList<>(list.size());
for (NewsInfo newsInfo : list) {
if(newsTypeService.selectById(newsInfo.getTypeId()) != null){
Map<String, Object> map = new HashMap<>(10);
map.put("id", newsInfo.getId());
map.put("title",newsInfo.getTitle());
map.put("author",newsInfo.getAuthor());
map.put("type",newsTypeService.selectById(newsInfo.getTypeId()).getTypeName());
map.put("created",DateTimeUtils.getFormatTime(newsInfo.getCreated()));
result.add(map);
}
}
model.addAttribute("result", result);
return "news/queryNews";
}
@RequestMapping("/queryMyNews")
public String queryMyNews(HttpServletRequest request , Model model) {
User user = (User)request.getSession().getAttribute("user");
List<NewsInfo> list = newsInfoService.selectMyNews(user.getId().toString());
List<Map<String, Object>> result = new ArrayList<>(list.size());
for (NewsInfo newsInfo : list) {
if(newsTypeService.selectById(newsInfo.getTypeId()) != null) {
Map<String, Object> map = new HashMap<>(10);
map.put("id", newsInfo.getId());
map.put("title", newsInfo.getTitle());
map.put("hits", newsInfo.getHits());
map.put("type", newsTypeService.selectById(newsInfo.getTypeId()).getTypeName());
map.put("created", DateTimeUtils.getFormatTime(newsInfo.getCreated()));
result.add(map);
}
}
model.addAttribute("result", result);
return "news/queryMyNews";
}
@RequestMapping("/queryUncheck")
public String queryUnckeck(HttpServletRequest request , Model model) {
User user = (User)request.getSession().getAttribute("user");
List<NewsInfo> list = newsInfoService.selectMyNews(user.getId().toString());
List<Map<String, Object>> result = new ArrayList<>(list.size());
for (NewsInfo newsInfo : list) {
Map<String, Object> map = new HashMap<>(10);
map.put("id", newsInfo.getId());
map.put("title",newsInfo.getTitle());
map.put("type",newsTypeService.selectById(newsInfo.getTypeId()).getTypeName());
map.put("created",DateTimeUtils.getFormatTime(newsInfo.getCreated()));
result.add(map);
}
model.addAttribute("result", result);
return "news/queryUnckeck";
}
@RequestMapping(value = "/check")
public String checkNews(HttpServletRequest request,Model model) {
int id = Integer.parseInt(request.getParameter("id"));
NewsInfo newsInfo = newsInfoService.selectNewsById(id);
Map<String, Object> map = new HashMap<>(10);
map.put("id", newsInfo.getId());
map.put("title",newsInfo.getTitle());
map.put("author",newsInfo.getAuthor());
map.put("created",DateTimeUtils.getFormatTime(newsInfo.getCreated()));
map.put("content",newsInfo.getContent());
map.put("digest",newsInfo.getDigest());
map.put("picture",newsInfo.getPicture());
model.addAttribute("news",map);
return "news/NewsInfo";
}
@RequestMapping(value = "/getnews")
public String getNewsAnaCom(HttpServletRequest request,Model model) {
int id = Integer.parseInt(request.getParameter("id"));
NewsInfo newsInfo = newsInfoService.selectNewsById(id);
Map<String, Object> map = new HashMap<>(10);
map.put("id", newsInfo.getId());
map.put("title",newsInfo.getTitle());
map.put("author",newsInfo.getAuthor());
map.put("created",DateTimeUtils.getFormatTime(newsInfo.getCreated()));
map.put("hits",newsInfo.getHits());
map.put("content",newsInfo.getContent());
map.put("picture",newsInfo.getPicture());
model.addAttribute("newsinfo",map);
List<Comment> list = commentService.selectByNewsId(id);
List<Map<String, Object>> result = new ArrayList<>(list.size());
for (Comment comment : list) {
Map<String, Object> mc = new HashMap<>(10);
mc.put("id", comment.getId());
mc.put("content",comment.getCommentContent());
mc.put("ower",comment.getOwer());
mc.put("created",DateTimeUtils.getFormatTime(comment.getCreated()));
result.add(mc);
}
newsInfoService.addHits(id);
model.addAttribute("coms",result);
return "news/newsComment";
}
@RequestMapping(value = "/updated")
public String updated(HttpServletRequest request,Model model) {
int id = Integer.parseInt(request.getParameter("id"));
NewsInfo newsInfo = newsInfoService.selectNewsById(id);
Map<String, Object> map = new HashMap<>(10);
map.put("id", newsInfo.getId());
map.put("title",newsInfo.getTitle());
map.put("author",newsInfo.getAuthor());
map.put("created",DateTimeUtils.getFormatTime(newsInfo.getCreated()));
map.put("content",newsInfo.getContent());
map.put("digest",newsInfo.getDigest());
map.put("picture",newsInfo.getPicture());
model.addAttribute("news",map);
return "news/updateNews";
}
} | [
"1191799097@qq.com"
] | 1191799097@qq.com |
f71275c7d2fb7bb0ec6f2bc02a816a36b1347547 | 126cb08d2af4eeaa9b18b2410fc4923ba625fa45 | /fop-core/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawCCITTFax.java | 1bbbf310ccd07a42423f6a50908f0299df1e3001 | [
"Apache-2.0"
] | permissive | apache/xmlgraphics-fop | 5413ae11fc0eb3875ffafd299d381f19c21f61a2 | caba469ffe74ac9afa1ce189fbbb2643637d94f1 | refs/heads/main | 2023-08-31T03:16:17.099726 | 2023-08-14T10:34:19 | 2023-08-14T10:46:35 | 206,318 | 63 | 67 | Apache-2.0 | 2023-04-27T09:16:16 | 2009-05-21T00:26:43 | Java | UTF-8 | Java | false | false | 4,291 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id$ */
package org.apache.fop.render.ps;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import org.apache.xmlgraphics.image.loader.Image;
import org.apache.xmlgraphics.image.loader.ImageFlavor;
import org.apache.xmlgraphics.image.loader.ImageInfo;
import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
import org.apache.xmlgraphics.ps.FormGenerator;
import org.apache.xmlgraphics.ps.ImageEncoder;
import org.apache.xmlgraphics.ps.ImageFormGenerator;
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.xmlgraphics.ps.PSImageUtils;
import org.apache.fop.render.RenderingContext;
/**
* Image handler implementation which handles CCITT fax images for PostScript output.
*/
public class PSImageHandlerRawCCITTFax implements PSImageHandler {
private static final ImageFlavor[] FLAVORS = new ImageFlavor[] {
ImageFlavor.RAW_CCITTFAX
};
/** {@inheritDoc} */
public void handleImage(RenderingContext context, Image image, Rectangle pos)
throws IOException {
PSRenderingContext psContext = (PSRenderingContext)context;
PSGenerator gen = psContext.getGenerator();
ImageRawCCITTFax ccitt = (ImageRawCCITTFax)image;
float x = (float)pos.getX() / 1000f;
float y = (float)pos.getY() / 1000f;
float w = (float)pos.getWidth() / 1000f;
float h = (float)pos.getHeight() / 1000f;
Rectangle2D targetRect = new Rectangle2D.Float(
x, y, w, h);
ImageInfo info = image.getInfo();
ImageEncoder encoder = new ImageEncoderCCITTFax(ccitt);
PSImageUtils.writeImage(encoder, info.getSize().getDimensionPx(),
info.getOriginalURI(), targetRect,
ccitt.getColorSpace(), 1, false, gen);
}
/** {@inheritDoc} */
public void generateForm(RenderingContext context, Image image, PSImageFormResource form)
throws IOException {
PSRenderingContext psContext = (PSRenderingContext)context;
PSGenerator gen = psContext.getGenerator();
ImageRawCCITTFax ccitt = (ImageRawCCITTFax)image;
ImageInfo info = image.getInfo();
String imageDescription = info.getMimeType() + " " + info.getOriginalURI();
ImageEncoder encoder = new ImageEncoderCCITTFax(ccitt);
FormGenerator formGen = new ImageFormGenerator(
form.getName(), imageDescription,
info.getSize().getDimensionPt(),
info.getSize().getDimensionPx(),
encoder,
ccitt.getColorSpace(), 1, false);
formGen.generate(gen);
}
/** {@inheritDoc} */
public int getPriority() {
return 200;
}
/** {@inheritDoc} */
public Class getSupportedImageClass() {
return ImageRawCCITTFax.class;
}
/** {@inheritDoc} */
public ImageFlavor[] getSupportedImageFlavors() {
return FLAVORS;
}
/** {@inheritDoc} */
public boolean isCompatible(RenderingContext targetContext, Image image) {
if (targetContext instanceof PSRenderingContext) {
PSRenderingContext psContext = (PSRenderingContext)targetContext;
//The filters required for this implementation need PS level 2 or higher
if (psContext.getGenerator().getPSLevel() >= 2) {
return (image == null || image instanceof ImageRawCCITTFax);
}
}
return false;
}
}
| [
"jeremias@apache.org"
] | jeremias@apache.org |
54f1af4f332b662f00b16e2b1b1ac1a3ca9d1d9a | 53adaa1ab8ce73af4733a93bd8f326de51bce414 | /SortingAlgorithms.java | 5f782963f682403306e29804cb04112c702be75f | [] | no_license | wesleyclark/SortingAlgorithmTimer | 744908b23df92ec1694ed9b3b4c34823787fbb3d | e27e32954f317d4f7f10fd2b4d87cc0a26cac039 | refs/heads/master | 2016-09-10T19:06:11.323030 | 2014-11-07T03:04:46 | 2014-11-07T03:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,753 | java |
public class SortingAlgorithms {
//list of algorithm names; this list is looped through in SortingHelper.java to call each
//sorting algorithm; if you implement a new sorting algorithm, you should add its name to this
//array in addition to updating the timeSort method in SortingHelper.java; otherwise,
//the newly implemented algorithm will not be called by the timeAllAlgorithms method of SortingHelper.java
public static String[] listOfAlgorithms = {"bubble", "insertion", "merge"};
//bubble sort implementation
public static void bubbleSort(int[] numbers) {
boolean changed = false;
do {
changed = false;
for (int a = 0; a < numbers.length - 1; a++) {
if (numbers[a] > numbers[a + 1]) {
int tmp = numbers[a];
numbers[a] = numbers[a + 1];
numbers[a + 1] = tmp;
changed = true;
}
}
} while (changed);
}
//insertion sort implementation
public static void insertionSort(int[] numbers){
for(int i = 1; i < numbers.length; i++){
int value = numbers[i];
int j = i - 1;
while(j >= 0 && numbers[j] > value){
numbers[j + 1] = numbers[j];
j = j - 1;
}
numbers[j + 1] = value;
}
}
//merge sort implementation
public static void mergeSort(int[] numbers){
if (numbers.length > 1) {
//copy the left half of the array
int[] leftHalf = new int[numbers.length / 2];
System.arraycopy(numbers, 0, leftHalf, 0, numbers.length / 2);
//copy the right half of the array
int lengthOfRightHalf = numbers.length - numbers.length / 2;
int[] rightHalf = new int[lengthOfRightHalf];
System.arraycopy(numbers, numbers.length / 2, rightHalf, 0, lengthOfRightHalf);
//merge sort left half
mergeSort(leftHalf);
//merge sort right half
mergeSort(rightHalf);
//merge left half with right half into the input array
merge(leftHalf, rightHalf, numbers);
}
}
public static void merge(int[] firstList, int[] secondList, int[] tempList){
int firstListIndex = 0; //the current index in firstList
int secondListIndex = 0; //the current index in secondList
int tempListIndex = 0; //the current index in tempList
while (firstListIndex < firstList.length && secondListIndex < secondList.length){
if (firstList[firstListIndex] < secondList[secondListIndex])
tempList[tempListIndex++] = firstList[firstListIndex++];
else
tempList[tempListIndex++] = secondList[secondListIndex++];
}
while (firstListIndex < firstList.length)
tempList[tempListIndex++] = firstList[firstListIndex++];
while (secondListIndex < secondList.length)
tempList[tempListIndex++] = secondList[secondListIndex++];
}
}
| [
"wesley@wesleygordonclark.com"
] | wesley@wesleygordonclark.com |
84f45f245b00160e1c345a29c7deb58cec09a02f | dc35ed01b30aa45c3fb5170d9b20ea5d71d6d2e5 | /src/main/java/com/pet_space/models/essences/RoleEssence.java | 1aabdd7ba6e11ac9b16580f701d8e7e62d9443db | [] | no_license | WeDism/HibernatePetSpace | 4925ffb0423574343ea5e187a61f3a8d3ab69eac | 6de8239b644464c68204c2843532a011d84691f7 | refs/heads/master | 2021-09-08T23:08:39.956219 | 2018-03-12T19:37:41 | 2018-03-12T19:37:41 | 122,365,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.pet_space.models.essences;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
@Entity
@Table(name = "role_essence")
public class RoleEssence implements Serializable {
public enum RoleEssenceEnum {
ROOT, ADMIN, USER
}
@Id
@Enumerated(EnumType.STRING)
@Column(name = "role")
private RoleEssenceEnum roleEssenceEnum;
public RoleEssence() {
}
public RoleEssence(RoleEssenceEnum roleEssenceEnum) {
super();
this.roleEssenceEnum = roleEssenceEnum;
}
public RoleEssenceEnum getRoleEssenceEnum() {
return this.roleEssenceEnum;
}
public void setRoleEssenceEnum(RoleEssenceEnum roleEssenceEnum) {
this.roleEssenceEnum = roleEssenceEnum;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RoleEssence)) return false;
RoleEssence that = (RoleEssence) o;
return getRoleEssenceEnum() == that.getRoleEssenceEnum();
}
@Override
public int hashCode() {
return Objects.hash(getRoleEssenceEnum());
}
}
| [
"wer58@ya.ru"
] | wer58@ya.ru |
56f6ea3c0a17cd2fb34a77515589f7eb9a07b926 | be4c092fe1ab17264e9abd1eea1cab408da52b65 | /src/test/java/test/CreateWishListTest.java | 3fba746dbf2041ae3e2a71a62eb530fa13098c7e | [] | no_license | vilson-vili/Ispitni-zadatak | 0f50f5aa232f4a3f326d080318a070d798180f8c | 0884a0e5d21ada90de87879e8167da10f266c7e8 | refs/heads/master | 2023-05-11T18:27:00.201298 | 2020-07-26T19:19:26 | 2020-07-26T19:19:26 | 282,716,769 | 0 | 0 | null | 2023-05-09T18:54:33 | 2020-07-26T19:15:01 | HTML | UTF-8 | Java | false | false | 1,624 | java | package test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import pages.CreateWishListPage;
import pages.SignUpAccountPage;
public class CreateWishListTest {
private static WebDriver driver = null;
@BeforeClass
public static void SignIn() {
String dir = System.getProperty("user.dir");
System.setProperty("webdriver.chrome.driver", dir + "\\executable\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("http://automationpractice.com/index.php");
}
@Test(priority=29)
public void LogInWithEmailAndPasword() {
CreateWishListPage Wish = new CreateWishListPage(driver);
Wish.LogInAsUser();
}
@Test(priority=30)
public void createWishListTest() {
CreateWishListPage Wish = new CreateWishListPage(driver);
Wish.createWishList();
}
@Test(priority=31)
public void checkNumberOfWishListInTable() {
CreateWishListPage Wish = new CreateWishListPage(driver);
//Wish.createWishList();
//int numberOfRows = Wish.numberOfWishListInTable();
//int expectedNumberOfRows = 3;
Assert.assertEquals(Wish.numberOfWishListInTable(), 3, "Number of wish lists in table not as expected." );
}
@AfterClass
public void tearDown() {
SignUpAccountPage home = new SignUpAccountPage(driver);
home.tearDown();
}
}
| [
"vildana.panjeta@gmail.com"
] | vildana.panjeta@gmail.com |
36db9b1b57cbca45d583d266a49597a832327681 | c192133235148e8d1b092ab36b52ec1e18e58858 | /BrickBreaker/src/main/Main.java | 0a7477bb1fe6d7c01c0a35c44cb0fb13d55b5d16 | [] | no_license | mkhan14/BrickBreaker | 0934f878a2be4ffd1098109160f4e65f9b2b5590 | 26a0712ef630a1822c8ec646f455bbe2e349db2a | refs/heads/master | 2020-12-15T19:22:40.840262 | 2020-01-21T00:59:14 | 2020-01-21T00:59:14 | 235,228,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | package main;
import javax.swing.JFrame;
public class Main {
public static void main(String[] args) {
//create jframe
JFrame obj = new JFrame();
//create gameplay object
Gameplay gp = new Gameplay();
//set the jframe's properties
obj.setBounds(10, 10, 700, 600);
obj.setTitle("Brick Breaker");
obj.setResizable(false);
obj.setVisible(true);
obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//add gameplay object inside object of jframe
//make Gameplay class extend JPanel so there's no error when adding gameplay object
//into the jframe object
obj.add(gp);
}
}
| [
"Mahin Khan@LAPTOP-DPFDT029.home"
] | Mahin Khan@LAPTOP-DPFDT029.home |
1eff97e5a9f77cf3c0f226e66bca1b9ea349b149 | 2fda0a2f1f5f5d4e7d72ff15a73a4d3e1e93abeb | /proFL-plugin-2.0.3/org/codehaus/groovy/runtime/dgm$727.java | 27ca0cbfe878c5bb9d3b7faebb2d84bd4152f8d7 | [
"MIT"
] | permissive | ycj123/Research-Project | d1a939d99d62dc4b02d9a8b7ecbf66210cceb345 | 08296e0075ba0c13204944b1bc1a96a7b8d2f023 | refs/heads/main | 2023-05-29T11:02:41.099975 | 2021-06-08T13:33:26 | 2021-06-08T13:33:26 | 374,899,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | //
// Decompiled by Procyon v0.5.36
//
package org.codehaus.groovy.runtime;
import groovy.lang.Closure;
import java.io.File;
import org.codehaus.groovy.reflection.CachedClass;
import org.codehaus.groovy.reflection.GeneratedMetaMethod;
public class dgm$727 extends GeneratedMetaMethod
{
public dgm$727(final String name, final CachedClass declaringClass, final Class returnType, final Class[] parameters) {
super(name, declaringClass, returnType, parameters);
}
public Object invoke(final Object o, final Object[] array) {
return DefaultGroovyMethods.withObjectOutputStream((File)o, (Closure)array[0]);
}
public final Object doMethodInvoke(final Object o, Object[] coerceArgumentsToClasses) {
coerceArgumentsToClasses = this.coerceArgumentsToClasses(coerceArgumentsToClasses);
return DefaultGroovyMethods.withObjectOutputStream((File)o, (Closure)coerceArgumentsToClasses[0]);
}
}
| [
"chijiang.yang@student.unimelb.edu.au"
] | chijiang.yang@student.unimelb.edu.au |
bbd40379e43674b804a90e2d3fd2510d3a11d1ea | fcc3ea8eab3260f4aa99bd6a6b056b48adb87d64 | /src/transport_factory/TransportFactory.java | 00a62a867ea4ac60a7b19e0ca53708c0e35712f5 | [] | no_license | sidorenconastya/TMPS-Lab1 | 31590667c774a5a15bcb6fdd3a192dbfd31bab5b | 2a4ec6d9087ddbf3b6860f0102acd0ecbb1845ab | refs/heads/master | 2020-04-23T17:54:37.378509 | 2019-02-18T21:38:39 | 2019-02-18T21:38:39 | 171,348,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package transport_factory;
abstract class TransportFactory {
public abstract Transport createTransport();
}
| [
"sidorenco.anastasia@gmail.com"
] | sidorenco.anastasia@gmail.com |
a53088478db8266d8fd2bf542828481b51a1ca5a | 9515a3ccf47cc6cf2e98895fc79c5f84e55511f0 | /src/main/java/com/app/config/AppConfig.java | 862e1ae7052c6fea0a9eaf0496bcb795d401929a | [] | no_license | Mah-khalid/ShopifyIntg | 907ee38228a9651c04af565f8894aa5f777244d5 | 161b338834bc18ef6bdb3ecb94491ce3b2f6a913 | refs/heads/master | 2021-06-22T17:52:44.843926 | 2017-08-07T12:20:04 | 2017-08-07T12:20:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package com.app.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import com.app.util.ShopifyHelper;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
@Configuration
public class AppConfig {
@Bean
public ShopifyHelper shopifyHelper(){
return new ShopifyHelper();
}
@Bean
public ObjectMapper objectMapper(){
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
return mapper;
}
@Bean
public RestTemplate restTemplate(){
return new RestTemplate();
}
}
| [
"zishanmohsin@Zishans-MacBook-Pro.local"
] | zishanmohsin@Zishans-MacBook-Pro.local |
1d41b0a6be23a36e1ffc73f4ad020d0b49b2e827 | b65b00391f03c83ee2a344c7571b042d6eb4451d | /app/src/main/java/com/recruit/zejuxin/recruit/Fragment/Luncher/LauncherScrollDelegate.java | 8193898b3a8ba937c34e9c1867ee68e1ec298a1d | [] | no_license | winelx/recruit2 | 8e379004e40bb419e8f79a0641bd47d0033b1f06 | 92cbfff7d09fe401e11e4039278083d30beee764 | refs/heads/master | 2021-07-09T15:27:16.555175 | 2017-10-10T10:08:49 | 2017-10-10T10:08:49 | 104,870,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,465 | java | package com.recruit.zejuxin.recruit.Fragment.Luncher;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import com.bigkoo.convenientbanner.ConvenientBanner;
import com.recruit.zejuxin.recruit.Code.delegate.LatteDelegate;
import com.recruit.zejuxin.recruit.Code.ui.scanner.LauncherHolderCreator;
import com.recruit.zejuxin.recruit.Code.ui.scanner.ScrollLauncherTag;
import com.recruit.zejuxin.recruit.Code.util.Loader.ILauncherListener;
import com.recruit.zejuxin.recruit.Code.util.storage.LattePreference;
import com.recruit.zejuxin.recruit.Fragment.main.ExampleDelegate;
import com.recruit.zejuxin.recruit.R;
import com.recruit.zejuxin.recruit.R2;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by 10942 on 2017/9/25 0025.
*/
public class LauncherScrollDelegate extends LatteDelegate {
private static final ArrayList<Integer> INTEGERS = new ArrayList<>();
private ILauncherListener mILauncherListener = null;
@BindView(R2.id.banner)
ConvenientBanner<Integer> mIntegerConvenientBanner = null;
@OnClick(R2.id.scroo_new)
void scroo() {
startWithPop(new ExampleDelegate());
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof ILauncherListener) {
mILauncherListener = (ILauncherListener) activity;
}
}
public void initBanner() {
//启动页的轮播图片
INTEGERS.add(R.mipmap.launcher_01);
INTEGERS.add(R.mipmap.launcher_02);
INTEGERS.add(R.mipmap.launcher_03);
INTEGERS.add(R.mipmap.launcher_05);
//设置Banner数据
mIntegerConvenientBanner
.setPages(new LauncherHolderCreator(), INTEGERS)
.setPageIndicator(new int[]{R.drawable.dot_normal, R.drawable.dot_focus})
.setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.CENTER_HORIZONTAL)
.setCanLoop(false);
LattePreference.setAppFlag(ScrollLauncherTag.HAS_FIRST_LAUNCHER_APP.name(), true);
}
@Override
public Object setLayout() {
return R.layout.delegate_launcherscroll;
}
@Override
public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
INTEGERS.clear();
initBanner();
}
}
| [
"1094290855@qq.com"
] | 1094290855@qq.com |
a34dc9f614e453db0db7d20f2445b474c1057e59 | 17226e5eb44ac118c4008350b2113656a0455e27 | /src/com/vcu/graph/dfs/Traversal.java | df8ca3ca43e47f8151f23acc964d2ef7e3b7e4ed | [] | no_license | GauravBahl/UCV | e63f544c42fd482a0c52f771bf4c82b766d9b031 | a306d1301a407508fdea1bda850cfdd3f5e7c2c2 | refs/heads/master | 2016-08-12T22:39:56.827205 | 2015-11-24T04:11:05 | 2015-11-24T04:11:05 | 46,765,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java | package com.vcu.graph.dfs;
public class Traversal {
//dfs
public void dfs(){
//begin at vertex 0
}
}
| [
"gauravbahl30@gmail.com"
] | gauravbahl30@gmail.com |
3cffbed4ade027e959cc4f61e57ee8bad78fa30b | 76bc40263e74e96030423464502986981d0bef0f | /src/test/java/com/starsgroup/techtest/feed/formatter/JsonFormatterTest.java | 4b9dced347faad069b153374bda0f7c9e13cc992 | [] | no_license | upkars1/tech_test_solution | d3db440a2e5877227ebc14980cbcca00f8331439 | a51269f4d969be131ea9cb38ea6775acbd20be3a | refs/heads/master | 2021-07-02T13:00:55.433663 | 2020-01-09T05:35:05 | 2020-01-09T05:35:05 | 228,913,760 | 0 | 0 | null | 2021-04-26T19:48:19 | 2019-12-18T20:09:28 | Java | UTF-8 | Java | false | false | 1,238 | java | package com.starsgroup.techtest.feed.formatter;
import com.starsgroup.techtest.domain.*;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.runners.MockitoJUnitRunner;
import static org.junit.Assert.assertEquals;
@RunWith(MockitoJUnitRunner.class)
public class JsonFormatterTest {
@InjectMocks
private JsonFormatter testSubject;
@Test
public void shouldFormat() {
String expected = "{\"header\":{\"msgId\":1,\"operation\":\"CREATE\",\"type\":\"EVENT\",\"timestamp\":2},\"body\":{\"name\":\"event-name-1\",\"displayed\":true,\"suspended\":false,\"eventId\":\"event-id-1\",\"category\":\"Football\",\"subCategory\":\"Champions League\",\"startTime\":3}}";
Header header = new Header( 1L , Operation.CREATE, PacketType.EVENT, 2L );
EventBody body = new EventBody.Builder().withCategory( "Football" ).withDisplayed(true).withEventId("event-id-1")
.withName("event-name-1").withStartTime(3L).withSubCategory("Champions League").withSuspended(false).build();
Event event = new Event(header , body);
String json = testSubject.toJson(event);
assertEquals(expected, json);
}
}
| [
"upkarsaimbi@upkars-mbp-2.home"
] | upkarsaimbi@upkars-mbp-2.home |
6276e893b7ab527fa84cd7eeaf93ab456daa2368 | e9fd62f97b3c26f3f2fd0759c3dc0216097278aa | /Chapter13-Appium Tips and Tricks/src/test/java/testcases/AppiumServiceBuilderTest.java | 4e1a52f3ba19f3eb2f78dc38aeb7e9e49617d491 | [] | no_license | prat3ik/appiumbook | 1f35ef6c31cbbe057d64f9184a8e65816db386c7 | ee4baea76f7449545666cccfe1c63bdfb25c06c0 | refs/heads/master | 2020-07-27T09:18:00.004699 | 2019-01-17T13:14:28 | 2019-01-17T13:43:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,998 | java | package testcases;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.io.IOException;
/**
* Year: 2018-19
*
* @author Prat3ik on 26/12/18
* @project POM_Automation_Framework
*/
public class AppiumServiceBuilderTest extends BaseTest {
AppiumServiceBuilder builder;
AppiumDriverLocalService appiumDriverLocalService;
@BeforeTest
@Override
public void setUpPage() throws IOException {
DesiredCapabilities desiredCapabilities = getDesiredCapabilities();
AppiumServiceBuilder builder = new AppiumServiceBuilder();
builder.withIPAddress("127.0.0.1");
builder.usingPort(4729);
builder.withCapabilities(desiredCapabilities);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, "error");
appiumDriverLocalService = AppiumDriverLocalService.buildService(builder);
appiumDriverLocalService.start();
}
@Test
public void test1() {
System.out.println("Test-1");
}
@Test
public void test2() {
System.out.println("Test-2");
}
@AfterSuite
@Override
public void tearDownAppium() {
super.tearDownAppium();
appiumDriverLocalService.stop();
}
public DesiredCapabilities getDesiredCapabilities() {
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
desiredCapabilities.setCapability(MobileCapabilityType.NO_RESET, true);
return desiredCapabilities;
}
}
| [
"pratikquora@gmail.com"
] | pratikquora@gmail.com |
73a4c96579ec1dda7a487def92fa10a60becf0fb | 879af57c265391cc1fac228529e1b094c9bf18e8 | /test-suite/src/test/java/io/micronaut/docs/config/value/Engine.java | ab5ac50f4775ed839982b50f54dc48b829cbac45 | [
"Apache-2.0"
] | permissive | msgilligan/micronaut-core | 1b2287cf0909ff573d3299103c9deb3c821f6cbc | d20564d333f2e009d4336222f1304539db71f0e5 | refs/heads/master | 2021-10-27T17:09:59.075820 | 2019-08-21T17:07:26 | 2019-08-21T17:07:26 | 203,679,233 | 0 | 0 | Apache-2.0 | 2019-08-21T23:31:47 | 2019-08-21T23:31:47 | null | UTF-8 | Java | false | false | 146 | java | package io.micronaut.docs.config.value;
public interface Engine {
public abstract int getCylinders();
public abstract String start();
}
| [
"william.parker.buck@gmail.com"
] | william.parker.buck@gmail.com |
ede028dd2ee5e1a447f75bb030d091b5495c65c7 | 59e6dc1030446132fb451bd711d51afe0c222210 | /components/dashboard/org.wso2.carbon.dashboard/4.2.0/src/main/java/org/wso2/carbon/dashboard/DashboardDSService.java | d5ffc5ca9fadb1a009eae92eebfd00c08caa552d | [] | no_license | Alsan/turing-chunk07 | 2f7470b72cc50a567241252e0bd4f27adc987d6e | e9e947718e3844c07361797bd52d3d1391d9fb5e | refs/heads/master | 2020-05-26T06:20:24.554039 | 2014-02-07T12:02:53 | 2014-02-07T12:02:53 | 38,284,349 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 80,340 | java | /*
* Copyright (c) 2009, WSO2 Inc. (http://www.wso2.org) 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.wso2.carbon.dashboard;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.core.AbstractAdmin;
import org.wso2.carbon.dashboard.bean.DashboardContentBean;
import org.wso2.carbon.dashboard.common.DashboardConstants;
import org.wso2.carbon.dashboard.common.LayoutConstants;
import org.wso2.carbon.dashboard.common.bean.Gadget;
import org.wso2.carbon.dashboard.common.bean.Tab;
import org.wso2.carbon.registry.core.*;
import org.wso2.carbon.registry.core.Collection;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.jdbc.utils.Transaction;
import org.wso2.carbon.registry.core.session.UserRegistry;
import org.wso2.carbon.registry.core.utils.MediaTypesUtils;
import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.utils.CarbonUtils;
import org.wso2.carbon.utils.ServerConstants;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
public class DashboardDSService extends AbstractAdmin {
private static final Log log = LogFactory.getLog(DashboardService.class);
/**
* Stores a given preference value for a Gadget in the Registry
*
* @param userId The name of the user in concern
* @param gadgetId A unique gadget id
* @param prefId A unique Preference id
* @param value Preference Value
* @param dashboardName The name of the Dashboard (this can be null)
* @return A boolean indicating success or failure
*/
public Boolean setGadgetPrefs(String userId, String gadgetId,
String prefId, String value, String dashboardName) {
Boolean response = false;
try {
Registry registry = getConfigSystemRegistry();
String gadgetPrefPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetPrefPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.GADGET_PATH
+ gadgetId
+ DashboardConstants.GADGET_PREFERENCE_PATH + prefId;
} else {
// Check whether this user is in a role to change settings
gadgetPrefPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.GADGET_PATH
+ gadgetId + DashboardConstants.GADGET_PREFERENCE_PATH + prefId;
}
Resource gadgetPreferences;
if (registry.resourceExists(gadgetPrefPath)) {
gadgetPreferences = registry.get(gadgetPrefPath);
} else {
gadgetPreferences = registry.newResource();
}
// Storing the gadget preference
//gadgetPreferences.setProperty(prefId, value);
//registry.put(gadgetPrefPath, gadgetPreferences);
gadgetPreferences.setContent(value);
gadgetPreferences.setMediaType("text/html");
registry.put(gadgetPrefPath, gadgetPreferences);
response = true;
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Failed to set preferences for user " + userId + " for prefId " + prefId, e);
}
}
return response;
}
/**
* Retrieves a given preference value for a Gadget from the Registry
*
* @param userId Currently logged in user
* @param gadgetId A unique gadget id
* @param prefId Preference Id
* @param dashboardName The name of the Dashboard (this can be null)
* @return A string with preference meta-data
*/
public String getGadgetPrefs(String userId, String gadgetId, String prefId,
String dashboardName) {
String response = "NA";
try {
Registry registry = getConfigSystemRegistry();
String gadgetPrefPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetPrefPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.GADGET_PATH
+ gadgetId
+ DashboardConstants.GADGET_PREFERENCE_PATH + prefId;
} else {
gadgetPrefPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.GADGET_PATH
+ gadgetId + DashboardConstants.GADGET_PREFERENCE_PATH + prefId;
}
Resource gadgetPreferences = registry.get(gadgetPrefPath);
// Retrieve preferences
//response = gadgetPreferences.getProperty(prefId);
response = new String((byte[]) gadgetPreferences.getContent());
// Decoding the value
response = new String(Hex.decodeHex(response.toCharArray()));
/* if (response == null) {
response = "NA";
}*/
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Preferences were not found for user " + userId + " for prefId " + prefId, e);
}
}
return response;
}
/**
* Persists the gadget layout in the dashboard page to registry
*
* @param userId Currently logged in user
* @param newLayout The new layout meta-data to store
* @param tabId The id of the relevant Tab
* @param dashboardName The name of the Dashboard (this can be null)
* @return Boolean, indicating success or failure
*/
public Boolean setGadgetLayout(String userId, String tabId,
String newLayout, String dashboardName) {
Boolean response = false;
try {
Registry registry = getConfigSystemRegistry();
String gadgetLayoutPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetLayoutPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH
+ tabId
+ DashboardConstants.CURRENT_GADGET_LAYOUT_PATH;
} else {
gadgetLayoutPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.TAB_PATH
+ tabId
+ DashboardConstants.CURRENT_GADGET_LAYOUT_PATH;
}
// Check whether this user is in a role to change settings
Resource gadgetLayout;
if (registry.resourceExists(gadgetLayoutPath)) {
gadgetLayout = registry.get(gadgetLayoutPath);
} else {
gadgetLayout = registry.newCollection();
}
// Storing the gadget layout
gadgetLayout.setProperty(DashboardConstants.CURRENT_GADGET_LAYOUT,
newLayout);
registry.put(gadgetLayoutPath, gadgetLayout);
response = true;
} catch (Exception e) {
log.error("Failed to set new layout for user " + userId
+ " for layout info [" + newLayout + "]", e);
}
return response;
}
/**
* Retrieves the stored layout meta-data
*
* @param userId Currently logged in user
* @param tabId The id of the relevant Tab
* @param dashboardName The name of the Dashboard (this can be null)
* @return Layout meta-data
*/
public String getGadgetLayout(String userId, String tabId,
String dashboardName) {
String response;
try {
Registry registry = getConfigSystemRegistry();
String gadgetLayoutPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetLayoutPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH
+ tabId
+ DashboardConstants.CURRENT_GADGET_LAYOUT_PATH;
} else {
gadgetLayoutPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.TAB_PATH
+ tabId
+ DashboardConstants.CURRENT_GADGET_LAYOUT_PATH;
}
Resource gadgetLayout;
if (registry.resourceExists(gadgetLayoutPath)) {
gadgetLayout = registry.get(gadgetLayoutPath);
} else {
// If the layout is not there, this might be a new tab. Create
// new resource
gadgetLayout = registry.newCollection();
registry.put(gadgetLayoutPath, gadgetLayout);
}
// Retrieving the gadget layout
response = gadgetLayout
.getProperty(DashboardConstants.CURRENT_GADGET_LAYOUT);
if (response == null || "".equals(response)) {
response = "NA";
}
} catch (Exception e) {
log.error("Failed to get layout information for user " + userId, e);
response = "NA";
}
return response;
}
public String getTabLayout(String userId, String dashboardName) {
String response = "0";
try {
Registry registry = getConfigSystemRegistry();
String tabLayoutPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
tabLayoutPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH;
} else {
tabLayoutPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.TAB_PATH;
}
Resource gadgetLayout;
if (registry.resourceExists(tabLayoutPath)) {
gadgetLayout = registry.get(tabLayoutPath);
} else {
// If not found we need to create the first gadget tab
gadgetLayout = registry.newCollection();
}
// Retrieving the current tab layout
response = gadgetLayout
.getProperty(DashboardConstants.CURRENT_TAB_LAYOUT);
if (response == null) {
gadgetLayout.setProperty(DashboardConstants.CURRENT_TAB_LAYOUT,
"0");
registry.put(tabLayoutPath, gadgetLayout);
response = "0";
}
} catch (Exception e) {
log.error("Failed to get layout information for user " + userId, e);
}
return response;
}
/**
* Traverses the JSON layout and retrieves the set of corresponding gadget IDs.
*
* @param layouts A JSON Layout array
* @throws JSONException
*/
private void getGadgetIdsFromJsonLayout(JSONArray layouts, ArrayList IdStore) throws JSONException {
for (int x = 0; x < layouts.length(); x++) {
JSONObject currentLayoutObject = layouts.getJSONObject(x);
if (currentLayoutObject.getString("type").equalsIgnoreCase("gadget")) {
// This is a gadget. Store the ID
IdStore.add(currentLayoutObject.getString("id"));
} else {
// This is a container element. Recurse
getGadgetIdsFromJsonLayout(currentLayoutObject.getJSONArray("layout"), IdStore);
}
}
}
private boolean isGadgetAutharized(String user, String gadgetUrl) throws UserStoreException {
if (gadgetUrl.startsWith("/registry")) {
gadgetUrl = gadgetUrl.split("resource")[1];
} else {
//GS is not hosting this gadget
return true;
}
UserRegistry registry = (UserRegistry) getConfigUserRegistry();
if (registry == null) {
registry = (UserRegistry) getConfigSystemRegistry();
}
return registry.getUserRealm().getAuthorizationManager().isUserAuthorized(user, gadgetUrl, ActionConstants.GET);
}
/**
* Looks at the in memory gadget layout and returns an array of
* corresponding gadget spec URLs
*
* @param userId Currently logged in user
* @param tabId The id of the relevant Tab
* @param dashboardName The name of the Dashboard (this can be null)
* @param backendServerURL
* @return A String Array of Gadget Spec URLs
*/
public String[] getGadgetUrlsToLayout(String userId, String tabId,
String dashboardName, String backendServerURL) throws AxisFault {
try {
ArrayList gadgetIdStore = new ArrayList();
String storedLayout = getGadgetLayout(userId, tabId, dashboardName);
if ("NA".equalsIgnoreCase(storedLayout)) {
return null;
} else if (storedLayout.contains("G1#")) {
// This is a legacy layout. Grab IDs the old way.
String[] columnIdCombos = storedLayout.split(",");
for (int x = 0; x < columnIdCombos.length; x++) {
String currentId = columnIdCombos[x].split("#")[1];
if ((currentId != null) && (!"".equals(currentId))) {
gadgetIdStore.add(currentId);
}
}
} else {
getGadgetIdsFromJsonLayout(new JSONObject(storedLayout).getJSONArray("layout"), gadgetIdStore);
}
Registry registry = getConfigSystemRegistry();
ArrayList gadgetUrlsList = new ArrayList();
String[] indGadgetIds = new String[gadgetIdStore.size()];
gadgetIdStore.toArray(indGadgetIds);
for (String indGadgetId : indGadgetIds) {
// Get the corresponding Gadget Spec URL
String gadgetPath;
if ((dashboardName == null)
|| ("null".equals(dashboardName))) {
gadgetPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.GADGET_PATH
+ indGadgetId;
} else {
gadgetPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.GADGET_PATH
+ indGadgetId;
}
Resource currentGadget;
try {
currentGadget = registry.get(gadgetPath);
String gadgetUrlTmp = currentGadget
.getProperty(DashboardConstants.GADGET_URL);
if (isGadgetAutharized(userId, gadgetUrlTmp)) {
gadgetUrlsList.add(gadgetUrlTmp);
}
} catch (RegistryException e) {
// Remove this gadget from the layout
removeGadgetFromLayout(userId, tabId, indGadgetId, dashboardName);
}
}
String[] gadgetUrls = new String[gadgetUrlsList.size()];
gadgetUrlsList.toArray(gadgetUrls);
if ((gadgetUrls.length > 0)) {
// Sanitize URLs. This takes care of realtive paths for Gadgets
// stored in the registry.
gadgetUrls = sanitizeUrls(gadgetUrls, backendServerURL);
}
return gadgetUrls;
} catch (Exception e) {
log.error("Error occurred while parsing the gadget urls to the layout : ", e);
throw new AxisFault(e.getMessage(), e);
}
}
/**
* Removes a given gadget Id from the existing layout
*
* @param userId Currently logged in user
* @param tabId Current tab
* @param dashboardName The name of the Dashboard (this can be null)
* @param gadgetId The id of the gadget to be removed
*/
private void removeGadgetFromLayout(String userId, String tabId,
String gadgetId, String dashboardName) throws JSONException {
JSONObject storedLayout = new JSONObject(getGadgetLayout(userId, tabId, dashboardName));
JSONArray layoutsArray = storedLayout.getJSONArray("layout");
if ((layoutsArray != null) && (layoutsArray.length() > 0)) {
JSONArray modifiedLayoutsArray = searchAndRemoveGadgetFromLayout(gadgetId, layoutsArray);
storedLayout.put("layout", modifiedLayoutsArray);
String newLayout = storedLayout.toString();
// Persist this new layout
setGadgetLayout(userId, tabId, newLayout, dashboardName);
}
}
private JSONArray searchAndRemoveGadgetFromLayout(String gadgetId, JSONArray layoutsArray) throws JSONException {
JSONArray modifiedLayoutsArray = new JSONArray();
for (int x = 0; x < layoutsArray.length(); x++) {
JSONObject currentLayoutElement = (JSONObject) layoutsArray.get(x);
if ("gadget".equals(currentLayoutElement.get("type"))) {
if (!gadgetId.equals(currentLayoutElement.get("id"))) {
// This is NOT the gadget we want to remove. Add it to the modified layout
modifiedLayoutsArray.put(currentLayoutElement);
}
} else {
// This is another container element.
currentLayoutElement.put("layout", searchAndRemoveGadgetFromLayout(gadgetId, currentLayoutElement.getJSONArray("layout")));
modifiedLayoutsArray.put(currentLayoutElement);
}
}
return modifiedLayoutsArray;
}
/**
* Adds a new Gadget to the Dashboard
*
* @param userId Currently logged in user
* @param url The gadget spec URL
* @param tabId The id of the relevant Tab
* @param dashboardName The name of the Dashboard (this can be null)
* @return A Boolean indicating success / failure
*/
public Boolean addGadgetToUser(String userId, String tabId, String url,
String dashboardName, String gadgetGroup) {
Boolean response = false;
Registry registry = null;
try {
if (!isGadgetAutharized(userId, url)) {
return false;
}
registry = getConfigSystemRegistry();
// Need not do any null checks for registry, as if so, we'll never
// get here.
registry.beginTransaction();
// Adding the gadget to the registry and getting its ID
String gadgetId = addGadgetToRegistry(userId, url, dashboardName, registry);
// Adding the latest Gadget ID to the layout
String gadgetLayoutPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetLayoutPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH
+ tabId
+ DashboardConstants.CURRENT_GADGET_LAYOUT_PATH;
} else {
gadgetLayoutPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.TAB_PATH
+ tabId
+ DashboardConstants.CURRENT_GADGET_LAYOUT_PATH;
}
Resource gadgetLayout;
if (registry.resourceExists(gadgetLayoutPath)) {
gadgetLayout = registry.get(gadgetLayoutPath);
} else {
gadgetLayout = registry.newCollection();
}
//get the column which the new gadget should be added to have a equal distribution <column, numberOfGadgets>
HashMap<Integer, Integer> gadgets = new HashMap<Integer, Integer>();
String layout = getGadgetLayout(userId, tabId, dashboardName);
if (layout.equals("NA")) {
layout = "{layout:[]}";
}
// to hold the sorted result
HashMap<Integer, Integer> map = new LinkedHashMap<Integer, Integer>();
JSONObject json = null;
try {
json = new JSONObject(layout);
} catch (Exception e) {
log.error("JSONParser unsuccessful : ", e);
}
for (int i = 0; i < json.getJSONArray("layout").length(); i++) {
JSONArray numberOfGadgetsInColumn = json.getJSONArray("layout").getJSONObject(i).getJSONArray("layout");
gadgets.put(i, numberOfGadgetsInColumn.length());
}
List<Integer> mapKeys = new ArrayList<Integer>(gadgets.keySet());
List<Integer> mapValues = new ArrayList<Integer>(gadgets.values());
TreeSet<Integer> sortedSet = new TreeSet<Integer>(mapValues);
Object[] sortedArray = sortedSet.toArray();
int size = sortedArray.length;
for (int i = 0; i < size; i++) {
map.put
(mapKeys.get(mapValues.indexOf(sortedArray[i])),
Integer.parseInt(sortedArray[i].toString()));
}
List<Integer> ref = new ArrayList<Integer>(map.keySet());
// Retrieving the gadget layout
String currentLayout = gadgetLayout
.getProperty(DashboardConstants.CURRENT_GADGET_LAYOUT);
int colNum = 0;
if (ref.size() != 0) {
colNum = ref.get(0);
}
gadgetLayout.setProperty(DashboardConstants.CURRENT_GADGET_LAYOUT,
insertGadgetToJsonLayout(currentLayout, gadgetId, colNum).toString());
registry.put(gadgetLayoutPath, gadgetLayout);
// Done
response = true;
registry.commitTransaction();
} catch (Exception e) {
log.error(e.getMessage(), e);
if (registry != null) {
try {
registry.rollbackTransaction();
} catch (Exception ex) {
log.error(ex.getMessage(), e);
}
}
}
return response;
}
private String addGadgetToRegistry(String userId, String url, String dashboardName, Registry registry) throws RegistryException {
String nextGadgetIdPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
nextGadgetIdPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.NEXT_GADGET_ID_PATH;
} else {
nextGadgetIdPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.NEXT_GADGET_ID_PATH;
}
Resource nextGadgetIdResource;
if (registry.resourceExists(nextGadgetIdPath)) {
nextGadgetIdResource = registry.get(nextGadgetIdPath);
} else {
nextGadgetIdResource = registry.newCollection();
}
// Generating a unique ID for this gadget
int nextGadgetId;
String gadgetId = "0";
if (nextGadgetIdResource
.getProperty(DashboardConstants.NEXT_GADGET_ID) != null) {
// We need to use that
gadgetId = nextGadgetIdResource
.getProperty(DashboardConstants.NEXT_GADGET_ID);
}
// Increment and update counter
nextGadgetId = Integer.parseInt(gadgetId) + 1;
nextGadgetIdResource.setProperty(DashboardConstants.NEXT_GADGET_ID,
String.valueOf(nextGadgetId));
registry.put(nextGadgetIdPath, nextGadgetIdResource);
// Adding the new gadget to registry
String newGadgetPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
newGadgetPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.GADGET_PATH + gadgetId;
} else {
newGadgetPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName
+ DashboardConstants.GADGET_PATH
+ gadgetId;
}
Resource newGadgetResource;
if (registry.resourceExists(newGadgetPath)) {
newGadgetResource = registry.get(newGadgetPath);
} else {
newGadgetResource = registry.newCollection();
}
// Storing the gadget url as a property and adding the new gadget
newGadgetResource.setProperty(DashboardConstants.GADGET_URL, url);
registry.put(newGadgetPath, newGadgetResource);
return gadgetId;
}
private JSONObject insertGadgetToJsonLayout(String layout, String gadgetId, int columnNumber) throws JSONException {
// We will add this gadget to the first row or column container in the layout. The user
// will decide where the gadget will go eventually via the UI.
if ((layout == null) || ("".equals(layout))) {
// This is the first gadget for this tab and a layout is not present for some reason.
// Creating a 3 column default layout, with this gadget included.
String twoColumnTemplate = "{\n" +
" \"layout\":\n" +
" [\n" +
" {\n" +
" \"type\": \"columnContainer\",\n" +
" \"width\": \"33%\",\n" +
" \"layout\":\n" +
" [\n" +
" {\n" +
" \"type\": \"gadget\",\n" +
" \"id\": \"" + gadgetId + "\"\n" +
" }\n" +
" ]\n" +
" },\n" +
" {\n" +
" \"type\": \"columnContainer\",\n" +
" \"width\": \"67%\",\n" +
" \"layout\":\n" +
" [\n" +
"\n" +
" ]\n" +
" }\n" +
" ]\n" +
"}";
return new JSONObject(twoColumnTemplate);
} else {
// We already have a layout
JSONObject currentLayout = new JSONObject(layout);
// Create gadget object
JSONObject newGadget = new JSONObject();
newGadget.put("type", "gadget");
newGadget.put("id", gadgetId);
// Get the first container and add the gadget to it.
JSONArray firstContainersLayoutArray = currentLayout.getJSONArray("layout").getJSONObject(columnNumber).getJSONArray("layout");
firstContainersLayoutArray.put(firstContainersLayoutArray.length(), newGadget);
return currentLayout;
}
}
private String getGadgetUrl(String userId, String gadgetId,
String dashboardName) {
String gadgetUrl = null;
String gadgetPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.GADGET_PATH + gadgetId;
} else {
gadgetPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.GADGET_PATH + gadgetId;
}
try {
Registry registry = getConfigSystemRegistry();
Resource gadgetRes = registry.get(gadgetPath);
gadgetUrl = gadgetRes.getProperty(DashboardConstants.GADGET_URL);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return gadgetUrl;
}
/**
* Removes a gadget from the Dashboard
*
* @param userId Currently logged in user
* @param gadgetId The id of the gadget to be removed
* @param tabId The id of the relevant Tab
* @param dashboardName The name of the Dashboard (this can be null)
* @return Boolean indicating success/failure
*/
public Boolean removeGadget(String userId, String tabId, String gadgetId,
String dashboardName) {
Boolean response = false;
Registry registry = null;
try {
registry = getConfigSystemRegistry();
registry.beginTransaction();
// First remove this gadget from the Layout and persist the new layout.
removeGadgetFromLayout(userId, tabId, gadgetId, dashboardName);
// Remove the Gadget from registry
String gadgetPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
gadgetPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.GADGET_PATH + gadgetId;
} else {
gadgetPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.GADGET_PATH
+ gadgetId;
}
registry.delete(gadgetPath);
// Done
response = true;
registry.commitTransaction();
} catch (Exception e) {
log.error(e.getMessage(), e);
if (registry != null) {
try {
registry.rollbackTransaction();
} catch (Exception ex) {
log.error(ex.getMessage(), e);
}
}
}
return response;
}
/**
* Creates a new tab and persists its meta-data
*
* @param userId Currently logged in user
* @param tabTitle A title forthe new tab
* @param dashboardName The name of the Dashboard (this can be null)
* @return integer
*/
public Integer addNewTab(String userId, String tabTitle,
String dashboardName) {
Integer response = 0;
String dashboardTabPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
dashboardTabPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH;
} else {
dashboardTabPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.TAB_PATH;
}
Registry registry = null;
try {
registry = getConfigSystemRegistry();
// Need not do any null checks for registry, as if so, we'll never
// get here.
registry.beginTransaction();
Resource userTabResource = null;
if (registry.resourceExists(dashboardTabPath)) {
userTabResource = registry.get(dashboardTabPath);
} else {
registry.put(dashboardTabPath, registry.newCollection());
userTabResource = registry.get(dashboardTabPath);
}
// First generate the new Id
String nextTabId = userTabResource
.getProperty(DashboardConstants.NEXT_TAB_ID);
if (nextTabId == null) {
// This is the first tab after home [0]
nextTabId = "0";
}
// Persisting the updated counter
userTabResource.setProperty(DashboardConstants.NEXT_TAB_ID, String
.valueOf(Integer.parseInt(nextTabId) + 1));
registry.put(dashboardTabPath, userTabResource);
// Creating a new tab resource
Resource newTab = registry.newCollection();
// Storing the name of the tab
if ("".equals(tabTitle)) {
tabTitle = "Tab " + nextTabId;
}
newTab.setProperty(DashboardConstants.TAB_TITLE, tabTitle);
String newTabPath = dashboardTabPath + nextTabId;
registry.put(newTabPath, newTab);
// Retrieving the current tab layout
String currentTabLayout = userTabResource
.getProperty(DashboardConstants.CURRENT_TAB_LAYOUT);
// Adding the new Tab
if (null == currentTabLayout || "null".equals(currentTabLayout) || ("0".equalsIgnoreCase(currentTabLayout) && "0".equals(nextTabId))) {
currentTabLayout = String.valueOf(nextTabId);
} else {
currentTabLayout = currentTabLayout + ","
+ String.valueOf(nextTabId);
}
userTabResource.setProperty(DashboardConstants.CURRENT_TAB_LAYOUT,
currentTabLayout);
registry.put(dashboardTabPath, userTabResource);
// Done
response = Integer.parseInt(nextTabId);
registry.commitTransaction();
} catch (Exception e) {
log.error(e.getMessage(), e);
if (registry != null) {
try {
registry.rollbackTransaction();
} catch (Exception ex) {
log.error(ex.getMessage(), e);
}
}
}
return response;
}
private void addHomeTab(String userId,
String dashboardName) {
Integer response = 0;
String dashboardTabPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
dashboardTabPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH;
} else {
dashboardTabPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.TAB_PATH;
}
Registry registry = null;
try {
registry = getConfigSystemRegistry();
// Need not do any null checks for registry, as if so, we'll never
// get here.
registry.beginTransaction();
Resource userTabResource = null;
if (registry.resourceExists(dashboardTabPath)) {
userTabResource = registry.get(dashboardTabPath);
}
String nextTabId = "0";
Resource newTab = registry.newCollection();
// Storing the name of the tab
String tabTitle = "Tab " + nextTabId;
newTab.setProperty(DashboardConstants.TAB_TITLE, tabTitle);
String newTabPath = dashboardTabPath + nextTabId;
registry.put(newTabPath, newTab);
// Retrieving the current tab layout
String currentTabLayout = userTabResource
.getProperty(DashboardConstants.CURRENT_TAB_LAYOUT);
// Adding the new Tab
if (null == currentTabLayout || "null".equals(currentTabLayout)) {
currentTabLayout = String.valueOf(nextTabId);
} else {
currentTabLayout = currentTabLayout + ","
+ String.valueOf(nextTabId);
}
userTabResource.setProperty(DashboardConstants.CURRENT_TAB_LAYOUT,
currentTabLayout);
registry.put(dashboardTabPath, userTabResource);
// Done
response = Integer.parseInt(nextTabId);
registry.commitTransaction();
} catch (Exception e) {
log.error(e.getMessage(), e);
if (registry != null) {
try {
registry.rollbackTransaction();
} catch (Exception ex) {
log.error(ex.getMessage(), e);
}
}
}
}
/**
* Returns the title of a given tab
*
* @param userId Currently logged in user
* @param tabId The tab id
* @param dashboardName The name of the Dashboard (this can be null)
* @return The title of the tab or a default value if not found
*/
public String getTabTitle(String userId, String tabId, String dashboardName) {
String response = "Tab " + tabId;
// if (((dashboardName == null) && ("0".equals(tabId))) || ("null".equals(dashboardName)) && ("0".equals(tabId))) {
// return "Home";
// }
String tabPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
tabPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT + userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH + tabId;
} else {
tabPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.TAB_PATH + tabId;
}
try {
Registry registry = getConfigSystemRegistry();
if ("0".equals(tabId) && (!registry.resourceExists(tabPath) || registry.get(tabPath).getProperty(DashboardConstants.TAB_TITLE) == null)) {
return "Home";
}
Resource tabResource = registry.get(tabPath);
if (tabResource.getProperty(DashboardConstants.TAB_TITLE) != null) {
return tabResource.getProperty(DashboardConstants.TAB_TITLE);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return response;
}
/**
* Removes a given tab from the system
*
* @param userId Currently logged in user
* @param tabId The id of the tab to be removed
* @param dashboardName The name of the Dashboard (this can be null)
* @return Boolean indicating success/failure
*/
public Boolean removeTab(String userId, String tabId, String dashboardName) {
Boolean response = false;
String dashboardTabPath;
if ((dashboardName == null) || ("null".equals(dashboardName))) {
dashboardTabPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId + DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.TAB_PATH;
} else {
dashboardTabPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT
+ dashboardName + DashboardConstants.TAB_PATH;
}
Registry registry = null;
boolean transactionStarted = false;
try {
registry = getConfigSystemRegistry();
// Need not do any null checks for registry, as if so, we'll never
// get here.
if (!Transaction.isStarted()) {
registry.beginTransaction();
transactionStarted = true;
}
Resource userTabResource = registry.get(dashboardTabPath);
// First remove this tab from the tab layout
String currentTabLayout = userTabResource
.getProperty(DashboardConstants.CURRENT_TAB_LAYOUT);
String[] tabIds = currentTabLayout.split(",");
String newTabLayout = "";
for (String tabId1 : tabIds) {
if (!tabId1.equals(tabId)) {
if (newTabLayout.equals("")) {
newTabLayout = tabId1;
} else {
newTabLayout = newTabLayout + "," + tabId1;
}
}
}
userTabResource.setProperty(DashboardConstants.CURRENT_TAB_LAYOUT,
newTabLayout);
registry.put(dashboardTabPath, userTabResource);
// Then remove all the Gadgets belonging to this tab
JSONObject currentLayout = new JSONObject(getGadgetLayout(userId, tabId, dashboardName));
JSONArray layoutElements = currentLayout.getJSONArray("layout");
ArrayList gadgetIdStore = new ArrayList();
getGadgetIdsFromJsonLayout(layoutElements, gadgetIdStore);
if (gadgetIdStore.size() > 0) {
// We have gadgets need to remove them
String[] gadgetList = new String[gadgetIdStore.size()];
gadgetIdStore.toArray(gadgetList);
for (int x = 0; x < gadgetList.length; x++) {
removeGadget(userId, tabId, gadgetList[x], dashboardName);
}
}
// Finally remove the tab
String tabPath = dashboardTabPath + tabId;
registry.delete(tabPath);
// Done
response = true;
if (transactionStarted) {
registry.commitTransaction();
}
if ("0".equals(tabId)) {
addHomeTab(userId, dashboardName);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
if (registry != null) {
try {
if (transactionStarted) {
registry.rollbackTransaction();
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
}
}
return response;
}
/**
* Checks whether the Dashboard should be rendered in read-only mode or not
* for a given user
*
* @param userId Currently logged in user
* @return Boolean
*/
public Boolean isReadOnlyMode(String userId) {
if (userId == null || "null".equals(userId)) {
return true;
}
Boolean resp = true;
try {
String[] userRoles = getUserRealm()
.getUserStoreManager().getRoleListOfUser(userId);
for (int x = 0; x < userRoles.length; x++) {
if ("admin".equals(userRoles[x])) {
return false;
}
}
} catch (Exception e) {
log.error(e);
}
return resp;
}
public String getBackendHttpPort() {
String httpPort = null;
try {
// httpPort = ServerConfiguration.getInstance().getFirstProperty("RegistryHttpPort");
/* String apacheHttpPort = ServerConfiguration.getInstance().getFirstProperty(
"ApacheHttpPort");
if (apacheHttpPort != null && !"".equals(apacheHttpPort)) {
httpPort = apacheHttpPort;
}*/
int port = CarbonUtils.getTransportProxyPort(getConfigContext(), "http");
if (port == -1) {
port = CarbonUtils.getTransportPort(getConfigContext(), "http");
}
httpPort = Integer.toString(port);
/* if (httpPort == null) {
httpPort = (String) DashboardContext.getConfigContext()
.getAxisConfiguration().getTransportIn("http")
.getParameter("port").getValue();
}*/
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return httpPort;
}
public Boolean isSelfRegistrationEnabled() {
Boolean response = false;
try {
Registry registry = getConfigSystemRegistry();
Resource regAdminDataResource;
if (registry
.resourceExists(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH)) {
regAdminDataResource = registry
.get(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH);
String storedValue = regAdminDataResource
.getProperty(DashboardConstants.USER_SELF_REG_PROPERTY_ID);
if ((storedValue != null) && ("true".equals(storedValue))) {
return true;
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return response;
}
public Boolean isExternalGadgetAdditionEnabled() {
Boolean response = false;
try {
Registry registry = getConfigSystemRegistry();
Resource regAdminDataResource;
if (registry
.resourceExists(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH)) {
regAdminDataResource = registry
.get(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH);
String storedValue = regAdminDataResource
.getProperty(DashboardConstants.USER_EXTERNAL_GADGET_ADD_PROPERTY_ID);
if ((storedValue != null) && ("true".equals(storedValue))) {
return true;
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return response;
}
/**
* A custom query to retrieve the data for default view
*
* @return array of strings containing the gadget URLs
*/
public String[] getDefaultGadgetUrlSet(String userId) throws AxisFault {
Registry registry;
try {
if (isOldUser(userId)) {
return new String[0];
}
registry = getConfigSystemRegistry();
String sql = "SELECT R.REG_NAME, R.REG_PATH_ID FROM REG_RESOURCE R, REG_PROPERTY P, REG_RESOURCE_PROPERTY RP, REG_PATH PA WHERE "
+ "R.REG_VERSION=RP.REG_VERSION AND "
+ "P.REG_NAME='"
+ DashboardConstants.DEFAULT_GADGET
+ "' AND "
+ "P.REG_VALUE='true' AND "
+ "P.REG_ID=RP.REG_PROPERTY_ID AND "
+ "PA.REG_PATH_ID=R.REG_PATH_ID";
HashMap<String, String> map = new HashMap<String, String>();
map.put("query", sql);
Collection qResults = registry.executeQuery(
DashboardConstants.SQL_STATEMENTS_PATH + "/query3", map);
String[] qPaths = (String[]) qResults.getContent();
ArrayList gadgetUrlsList = new ArrayList();
for (String qPath : qPaths) {
if (registry.resourceExists(qPath)) {
Resource tempRes = registry.get(qPath);
String gadgetUrlTmp = tempRes.getProperty(
DashboardConstants.GADGET_URL);
if (isGadgetAutharized(userId, gadgetUrlTmp)) {
gadgetUrlsList.add(gadgetUrlTmp);
try {
Integer userCount = Integer.parseInt(tempRes.getProperty(
DashboardConstants.USER_CONTER));
userCount = userCount + 1;
tempRes.setProperty(DashboardConstants.USER_CONTER, userCount.toString());
registry.put(qPath, tempRes);
} catch (Exception e) {
log.error("could not increment the user count :" + e.getMessage());
}
}
}
}
String[] gadgetUrls = new String[gadgetUrlsList.size()];
gadgetUrlsList.toArray(gadgetUrls);
return gadgetUrls;
} catch (Exception e) {
log.error("Backend server error - could not get the default gadget url set", e);
throw new AxisFault(e.getMessage(), e);
}
}
private String getHttpServerRoot(String backendServerURL) {
String response = "";
try {
String hostName = CarbonUtils.getServerConfiguration().getFirstProperty("HostName");
// Removing the carbon part
response = backendServerURL.split("/carbon/")[0];
URL newUrl = new URL(response);
if ("".equals(newUrl.getPath())) {
response = "http://" + newUrl.getHost() + ":" + getBackendHttpPort();
} else {
response = "http://" + newUrl.getHost() + ":" + getBackendHttpPort() + newUrl.getPath();
}
if (hostName != null && !hostName.equals("")) {
if (!"".equals(newUrl.getPath())) {
response = "http://" + hostName + ":" + getBackendHttpPort() + newUrl.getPath();
} else {
response = "http://" + hostName + ":" + getBackendHttpPort();
}
}
} catch (MalformedURLException e) {
log.error(e.getMessage(), e);
}
return response;
}
private String[] sanitizeUrls(String[] gadgetUrls, String backendServerURL) {
String[] response = new String[0];
String tDomain = getTenantDomain();
String tPathWithDOmain = "";
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tDomain)) {
tPathWithDOmain = "/t/" + tDomain;
}
if (gadgetUrls != null) {
ArrayList tempUrlHolder = new ArrayList();
for (String currentUrl : gadgetUrls) {
// Removing trailing and leading special characters
currentUrl = currentUrl.replaceAll("[\r\n]", "").trim();
// Check whether this is a relative URL. If so, attach the local
// server http root to it
if ("/".equals(String.valueOf(currentUrl.charAt(0)))) {
currentUrl = getHttpServerRoot(backendServerURL) + tPathWithDOmain + currentUrl;
}
tempUrlHolder.add(currentUrl);
}
response = new String[tempUrlHolder.size()];
tempUrlHolder.toArray(response);
}
return response;
}
/**
* This operation duplicates the content of a given Tab to a new Tab appends
* it into the users Tab Layout.
*
* @param userId The logged in user
* @param dashboardName The name of the System Dashboard, if applicable.
* @param sourceTabId The Tab to be dupliated
* @param newTabName The name to be used for the new Tab
* @return Integer ID of the newly created Tab
*/
public Integer duplicateTab(String userId, String dashboardName,
String sourceTabId, String newTabName) {
int resp = 0;
// Create the new tab
String newTabId = String.valueOf(addNewTab(userId, newTabName, dashboardName));
// Get the Gadget layout of the source Tab
try {
Registry registry = getConfigSystemRegistry();
JSONObject sourceGadgetLayout = new JSONObject(getGadgetLayout(userId, sourceTabId,
dashboardName));
JSONArray layoutElements = sourceGadgetLayout.getJSONArray("layout");
// Traverse this source format, duplicating gadgets and replacing source gadget IDs
// with the new ones.
JSONArray gadgetDuplicatedLayoutElements = duplicateGadgetsInLayout(userId, dashboardName, registry, layoutElements);
sourceGadgetLayout.put("layout", gadgetDuplicatedLayoutElements);
// Store this layout
setGadgetLayout(userId, newTabId, sourceGadgetLayout.toString(), dashboardName);
return Integer.parseInt(newTabId);
} catch (Exception e) {
log.error(e.getMessage(), e);
resp = 0;
}
return resp;
}
private JSONArray duplicateGadgetsInLayout(String userId, String dashboardName, Registry registry, JSONArray layoutElements) throws JSONException, RegistryException {
for (int x = 0; x < layoutElements.length(); x++) {
JSONObject currentLayoutElement = (JSONObject) layoutElements.get(x);
if ("gadget".equals(currentLayoutElement.get("type"))) {
// Duplicate this gadget and replace with the new gadget's ID
String sourceGadgetsId = currentLayoutElement.get("id").toString();
if ((sourceGadgetsId != null) && (!"".equals(sourceGadgetsId))) {
String duplicatesId = addGadgetToRegistry(userId, getGadgetUrl(userId, sourceGadgetsId, dashboardName), dashboardName, registry);
currentLayoutElement.put("id", duplicatesId);
}
} else {
// Container element. Recurse.
duplicateGadgetsInLayout(userId, dashboardName, registry, currentLayoutElement.getJSONArray("layout"));
}
}
return layoutElements;
}
/**
* The method copies a given gadegt
*
* @param userId The loged in user
* @param dashboardName dashboard type
* @param sourceGadgetId source gadget
* @param tab copying tab
* @param grp
* @return
*/
public Boolean copyGadget(String userId, String dashboardName,
String sourceGadgetId, String tab, String grp) {
Boolean resp;
String gadgetUrl = getGadgetUrl(userId, sourceGadgetId, dashboardName);
resp = addGadgetToUser(userId, tab, gadgetUrl, dashboardName, grp);
return resp;
}
/**
* Moves a gadget to a new tab.
*
* @param userId
* @param dashboardName
* @param sourceGadgetId
* @param tab
* @return
*/
public Boolean moveGadgetToTab(String userId, String dashboardName,
String sourceGadgetId, String tab) {
Boolean resp;
String gadgetUrl = getGadgetUrl(userId, sourceGadgetId, dashboardName);
resp = addGadgetToUser(userId, tab, gadgetUrl, dashboardName, "G1#");
return resp;
}
/**
* checking for duplicate tab names
*
* @param tabName
* @param userId
* @return
*/
private Boolean tabNameExsists(String tabName, String userId) {
Registry registry;
try {
registry = getConfigSystemRegistry();
Resource comQuery = registry.newResource();
String sql = "SELECT R.REG_NAME, R.REG_PATH_ID FROM REG_RESOURCE R, REG_PROPERTY P, REG_RESOURCE_PROPERTY RP, " +
"REG_PATH PA WHERE R.REG_VERSION=RP.REG_VERSION AND P.REG_NAME='tabTitle' " +
"AND P.REG_VALUE LIKE ? AND P.REG_ID=RP.REG_PROPERTY_ID AND PA.REG_PATH_ID=R.REG_PATH_ID " +
"AND PA.REG_PATH_VALUE LIKE ?";
Map<String, String> params = new HashMap<String, String>();
params.put("1", tabName);
String tabPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT + userId + "%";
params.put("2", tabPath);
params.put("query", sql);
Collection qResults = registry.executeQuery(
DashboardConstants.SQL_STATEMENTS_PATH + "/query4", params);
String[] qPaths = (String[]) qResults.getContent();
return (qPaths.length != 0);
} catch (Exception e) {
log.error("Backend server error - could validate the url for duplicates", e);
return false;
}
}
/**
* Checks if the user has logged in before
*
* @param userId
* @return
*/
private Boolean isOldUser(String userId) {
Boolean newUser;
String nextGadgetIdPath;
Registry registry;
nextGadgetIdPath = DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT
+ userId
+ DashboardConstants.REGISTRY_PRODUCT_ID_PATH
+ DashboardConstants.NEXT_GADGET_ID_PATH;
try {
registry = getConfigSystemRegistry();
newUser = registry.resourceExists(nextGadgetIdPath);
return newUser;
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
}
}
/**
* Checking for session expiration
*
* @return true | false
*/
public Boolean isSessionValid() {
MessageContext msgContext = MessageContext.getCurrentMessageContext();
HttpServletRequest request = (HttpServletRequest) msgContext
.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
HttpSession httpSession = request.getSession(false);
return (!httpSession.isNew());
}
public String getPortalStylesUrl(String user) {
Registry userRegistry = getConfigSystemRegistry();
String retPath = null;
try {
if (userRegistry.resourceExists(DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT + user + DashboardConstants.GS_DEFAULT_THEME_PATH)) {
Resource res = userRegistry.get(DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT + user + DashboardConstants.GS_DEFAULT_THEME_PATH);
retPath = res.getProperty("theme.location");
return retPath;
}
return retPath;
} catch (Exception e) {
log.error("Exception when retriving Portal style URL", e);
return null;
}
}
/**
* Set the tab layout according to user's selection.
*
* @param userId
* @param tabId
* @param layout
* @return true/false
*/
public Boolean populateCustomLayouts(String userId, String tabId, String layout, String dashboard) {
Boolean result = false;
String response = "NA";
if ((userId == null) | ("NULL".equalsIgnoreCase(userId))) {
// Unsigned user. Do nothing
response = "NA";
} else {
try {
String templateType = null;
if (layout.equalsIgnoreCase("1")) {
templateType = LayoutConstants.ONE_COLUMN_LAYOUT;
} else if (layout.equalsIgnoreCase("2")) {
templateType = LayoutConstants.TWO_COLUMN_SYMETRIC_LAYOUT;
} else if (layout.equalsIgnoreCase("3")) {
templateType = LayoutConstants.DEFAULT_THREE_COLUMN_LAYOUT;
} else if (layout.equalsIgnoreCase("4")) {
templateType = LayoutConstants.CUSTOM_THREE_COLUMN_LAYOUT;
} else if (layout.equalsIgnoreCase("5")) {
templateType = LayoutConstants.TWO_COLUMN_ASYMETRIC1_LAYOUT;
} else if (layout.equalsIgnoreCase("6")) {
templateType = LayoutConstants.TWO_COLUMN_ASYMETRIC2_LAYOUT;
}
response = new JSONObject(templateType).toString();
try {
JSONObject currentLayout = new JSONObject(getGadgetLayout(userId, tabId, dashboard));
JSONArray layoutElements = currentLayout.getJSONArray("layout");
ArrayList<String> gadgetIdStore = new ArrayList<String>();
getGadgetIdsFromJsonLayout(layoutElements, gadgetIdStore);
for (String gadgetId : gadgetIdStore) {
response = insertGadgetToJsonLayout(response, gadgetId, 0).toString();
}
} catch (JSONException e) {
//ignoring the exception
log.debug("ignoring this exception : ", e);
}
//getGadgetIdsFromJsonLayout();
// Store this layout in the Registry
setGadgetLayout(userId, tabId, response, dashboard);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
return result;
}
public String populateDefaultThreeColumnLayout(String userId, String tabId) throws AxisFault {
String response = "NA";
if ((userId == null) | ("NULL".equalsIgnoreCase(userId))) {
// Unsigned user. Do nothing
response = "NA";
} else {
String[] gadgetURLs = getDefaultGadgetUrlSet(userId);
Registry registry = null;
try {
JSONObject masterLayout = new JSONObject();
JSONObject column1Layout = new JSONObject();
column1Layout.put("type", "columnContainer");
column1Layout.put("width", "33%");
JSONObject column2Layout = new JSONObject();
column2Layout.put("type", "columnContainer");
column2Layout.put("width", "33%");
JSONObject column3Layout = new JSONObject();
column3Layout.put("type", "columnContainer");
column3Layout.put("width", "33%");
registry = getConfigSystemRegistry();
JSONArray column1Gadgets = new JSONArray();
JSONArray column2Gadgets = new JSONArray();
JSONArray column3Gadgets = new JSONArray();
for (int x = 0; x < gadgetURLs.length; x = x + 3) {
String gadgetId = addGadgetToRegistry(userId, gadgetURLs[x], null, registry);
JSONObject gadget = new JSONObject();
gadget.put("type", "gadget");
gadget.put("id", gadgetId);
column1Gadgets.put(column1Gadgets.length(), gadget);
}
for (int x = 1; x < gadgetURLs.length; x = x + 3) {
String gadgetId = addGadgetToRegistry(userId, gadgetURLs[x], null, registry);
JSONObject gadget = new JSONObject();
gadget.put("type", "gadget");
gadget.put("id", gadgetId);
column2Gadgets.put(column2Gadgets.length(), gadget);
}
for (int x = 2; x < gadgetURLs.length; x = x + 3) {
String gadgetId = addGadgetToRegistry(userId, gadgetURLs[x], null, registry);
JSONObject gadget = new JSONObject();
gadget.put("type", "gadget");
gadget.put("id", gadgetId);
column3Gadgets.put(column3Gadgets.length(), gadget);
}
column1Layout.put("layout", column1Gadgets);
column2Layout.put("layout", column2Gadgets);
column3Layout.put("layout", column3Gadgets);
JSONArray columnCollection = new JSONArray();
columnCollection.put(columnCollection.length(), column1Layout);
columnCollection.put(columnCollection.length(), column2Layout);
columnCollection.put(columnCollection.length(), column3Layout);
masterLayout.put("layout", columnCollection);
response = masterLayout.toString();
// Store this layout in the Registry
setGadgetLayout(userId, tabId, response, null);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AxisFault(e.getMessage(), e);
}
}
return response;
}
/**
* The method is used to obtain the complete dashboard as a bean
*
* @param userId
* @param dashboardName
* @param tDomain
* @param backendServerURL
* @return
* @throws AxisFault
*/
public DashboardContentBean getDashboardContent(String userId, String dashboardName, String tDomain, String backendServerURL) throws AxisFault {
DashboardContentBean dashboardContentBean = new DashboardContentBean();
dashboardContentBean.setBackendHttpPort(getBackendHttpPort());
dashboardContentBean.setDefaultGadgetUrlSet(getDefaultGadgetUrlSet(userId));
dashboardContentBean.setPortalCss(getPortalStylesUrl(userId));
dashboardContentBean.setReadOnlyMode(isReadOnlyMode(userId));
dashboardContentBean.setTabLayout(getTabLayout(userId, dashboardName));
String[] userTabLayout = getTabLayout(userId, dashboardName).split(",");
ArrayList<Tab> userTabs = new ArrayList<Tab>();
try {
for (String userTab : userTabLayout) {
Tab tab = new Tab();
tab.setTabName(getTabTitle(userId, userTab, dashboardName));
tab.setTabId(userTab);
tab.setGadgetLayout(getGadgetLayout(userId, userTab, dashboardName));
tab.setGadgets(getGadgetsForTab(userId, dashboardName, tab.getGadgetLayout()));
//tab.setGadgetUrls(getGadgetUrlsToLayout(userId, userTab, dashboardName, backendServerURL));
userTabs.add(tab);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AxisFault(e.getMessage(), e);
}
Tab[] tabs = new Tab[userTabs.size()];
dashboardContentBean.setTabs(userTabs.toArray(tabs));
return dashboardContentBean;
}
/**
* Method is used to obtain the complete dashboard as a JSOn data structure
*
* @param userId
* @param dashboardName
* @param tDomain
* @param backendServerURL
* @return
* @throws AxisFault
*/
public String getDashboardContentAsJson(String userId, String dashboardName, String tDomain, String backendServerURL) throws AxisFault {
DashboardContentBean dashboardContentBean = getDashboardContent(userId, dashboardName, tDomain, backendServerURL);
try {
return dashboardContentBean.toJSONObject().toString();
} catch (JSONException e) {
log.error(e.getMessage(), e);
throw new AxisFault(e.getMessage(), e);
}
}
/**
* Tab content is taken via this method as a JSOn string at each tab refresh.
*
* @param userId
* @param dashboardName
* @param tDomain
* @param backendServerURL
* @param tabId
* @return
* @throws AxisFault
*/
public String getTabContentAsJson(String userId, String dashboardName, String tDomain, String backendServerURL, String tabId) throws AxisFault {
DashboardContentBean dashboardContentBean = getDashboardContent(userId, dashboardName, tDomain, backendServerURL);
Tab tab = getTabContentFromId(dashboardContentBean, tabId);
try {
return tab.toJSONObject().toString();
} catch (JSONException e) {
log.error(e.getMessage(), e);
throw new AxisFault(e.getMessage(), e);
}
}
private Gadget[] getGadgetsForTab(String userId, String dashboardName, String storedLayout) throws Exception {
ArrayList<String> gadgetIdStore = new ArrayList<String>();
if ("NA".equalsIgnoreCase(storedLayout)) {
return new Gadget[0];
} else if (storedLayout.contains("G1#")) {
// This is a legacy layout. Grab IDs the old way.
String[] columnIdCombos = storedLayout.split(",");
for (int x = 0; x < columnIdCombos.length; x++) {
String currentId = columnIdCombos[x].split("#")[1];
if ((currentId != null) && (!"".equals(currentId))) {
gadgetIdStore.add(currentId);
}
}
} else {
getGadgetIdsFromJsonLayout(new JSONObject(storedLayout).getJSONArray("layout"), gadgetIdStore);
}
ArrayList<Gadget> gadgets = new ArrayList<Gadget>();
for (String gadgetId : gadgetIdStore) {
Gadget gadget = new Gadget();
gadget.setGadgetId(gadgetId);
gadget.setGadgetUrl(getGadgetUrl(userId, gadgetId, dashboardName));
gadget.setGadgetPrefs(getGadgetPrefs(userId, gadgetId, "gadgetUserPrefs-" + gadgetId, dashboardName));
gadgets.add(gadget);
}
Gadget[] gadgetsArray = new Gadget[gadgets.size()];
return gadgets.toArray(gadgetsArray);
}
private Tab getTabContentFromId(DashboardContentBean dcb, String tabId) {
Tab[] tabs = dcb.getTabs();
for (Tab tab : tabs) {
if (tab.getTabId().equals(tabId)) {
return tab;
}
}
return null;
}
/**
* A webservice method which is used to obtain both tab id and associated name
*/
public String getTabLayoutWithNames(String userId, String dashboard) throws AxisFault {
String[] userTabLayout = getTabLayout(userId, dashboard).split(",");
StringBuilder result = new StringBuilder();
for (String tabId : userTabLayout) {
result.append(tabId + "-" + getTabTitle(userId, tabId, dashboard));
result.append(",");
}
if (result.length() != 0) {
return result.substring(0, result.length() - 1);
}
return "";
}
/**
* Populating Gadget resources to registry for the given tenant
* (On demand Gadget population)
*
* @param tabId
* @return boolean
* @throws AxisFault
*/
public boolean populateDashboardTab(String tabId) throws AxisFault {
boolean returnValue = false;
// Read gadgets from {CARBON_HOME}/repository/resources/dashboard/gadgets/
String gadgetDiskRoot = System.getProperty(ServerConstants.CARBON_HOME) + File.separator +
"repository" + File.separator + "resources" + File.separator + "dashboard" +
File.separator + "gadgets" + File.separator;
String tabResourcePath = "tab" + tabId;
// Read tab resources from {CARBON_HOME}/repository/resources/dashboard/gadgets/tabX
String tabDiskLocation = gadgetDiskRoot + tabResourcePath;
String registryGadgetPath = DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT +
DashboardConstants.GADGET_PATH;
String serverName = CarbonUtils.getServerConfiguration().getFirstProperty("Name");
Registry registry = getConfigSystemRegistry();
try {
// Following resource already added in dashboard.xml population time
if (registry.resourceExists(DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT + serverName)) {
Resource serverNameResource = registry.
get(DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT + serverName);
// If this tab is not populated yet, populate it
if (serverNameResource.getProperty(tabResourcePath) == null) {
// Following property used to ensure first time population (running only ones)
serverNameResource.setProperty(tabResourcePath, tabResourcePath);
String tenantDomain = PrivilegedCarbonContext.getCurrentContext().getTenantDomain();
// So gadget resources not populated for this tab
// Need to populate resources related to this tab
File tabResourceDir = new File(tabDiskLocation);
if (tabResourceDir.exists()) {
beginFileTransfer(tabResourceDir, registry, registryGadgetPath);
log.info("Successfully populated the default Gadgets for tab : " + tabId + " in tenant : " + tenantDomain);
returnValue = true;
} else {
log.info("Couldn't find contents at '" + tabDiskLocation + "'. Giving up.");
}
registry.put(DashboardConstants.SYSTEM_DASHBOARDS_REGISTRY_ROOT + serverName, serverNameResource);
}
} else {
log.debug("Couldn't find a dashboard resources for " + serverName + ", and skipping on demand gadget population");
}
} catch (RegistryException e) {
log.error(e.getMessage(), e);
throw new AxisFault(e.getMessage(), e);
}
return returnValue;
}
private void beginFileTransfer(File rootDirectory, Registry registry,
String registryGadgetPath) throws RegistryException {
// Storing the root path for future reference
String rootPath = rootDirectory.getAbsolutePath();
// Creating the default gadget collection resource
Collection defaultGadgetCollection = registry.newCollection();
try {
registry.beginTransaction();
if (!registry.resourceExists(registryGadgetPath)) {
registry.put(registryGadgetPath, defaultGadgetCollection);
}
transferDirectoryContentToRegistry(rootDirectory, rootPath, registry, registryGadgetPath);
registry.commitTransaction();
} catch (Exception e) {
registry.rollbackTransaction();
log.error(e.getMessage(), e);
}
}
private void transferDirectoryContentToRegistry(File rootDirectory, String rootPath,
Registry registry, String registryGadgetPath)
throws FileNotFoundException {
try {
File[] filesAndDirs = rootDirectory.listFiles();
List<File> filesDirs = Arrays.asList(filesAndDirs);
for (File file : filesDirs) {
if (!file.isFile()) {
// This is a Directory add a new collection
// This path is used to store the file resource under registry
String directoryRegistryPath =
registryGadgetPath + file.getAbsolutePath()
.substring(rootPath.length()).replaceAll("[/\\\\]+", "/");
Collection newCollection = registry.newCollection();
if (!registry.resourceExists(directoryRegistryPath)) {
setAnonymousReadPermission(directoryRegistryPath);
registry.put(directoryRegistryPath, newCollection);
}
// recursive
transferDirectoryContentToRegistry(file, rootPath, registry, registryGadgetPath);
} else {
// Add this to registry
addToRegistry(rootPath, file, registry, registryGadgetPath);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
private void addToRegistry(String rootPath, File file, Registry registry, String registryGadgetPath) {
try {
// This path is used to store the file resource under registry
String fileRegistryPath =
registryGadgetPath + file.getAbsolutePath().substring(rootPath.length())
.replaceAll("[/\\\\]+", "/");
// Adding the file to the Registry
Resource fileResource = registry.newResource();
String mediaType = MediaTypesUtils.getMediaType(file.getAbsolutePath());
if (mediaType.equals("application/xml")) {
fileResource.setMediaType("application/vnd.wso2-gadget+xml");
} else {
fileResource.setMediaType(mediaType);
}
fileResource.setContentStream(new FileInputStream(file));
registry.put(fileRegistryPath, fileResource);
setAnonymousReadPermission(fileRegistryPath);
} catch (org.wso2.carbon.user.api.UserStoreException e) {
log.error(e.getMessage(), e);
} catch (RegistryException e) {
log.error(e.getMessage(), e);
} catch (FileNotFoundException e) {
log.error(e.getMessage(), e);
}
}
/**
* Setting read permission for anonymous user
*
* @param fileRegistryPath
* @throws org.wso2.carbon.user.api.UserStoreException
*
*/
private void setAnonymousReadPermission(String fileRegistryPath)
throws org.wso2.carbon.user.api.UserStoreException {
AuthorizationManager accessControlAdmin =
CarbonContext.getCurrentContext().getUserRealm().getAuthorizationManager();
if (!accessControlAdmin.isRoleAuthorized(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME,
RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
fileRegistryPath, ActionConstants.GET)) {
accessControlAdmin.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME,
RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
fileRegistryPath, ActionConstants.GET);
}
}
// protected Registry getConfigSystemRegistry() {
// return (Registry) PrivilegedCarbonContext.getCurrentContext().
// getRegistry(RegistryType.SYSTEM_CONFIGURATION);
// }
//
//
protected Registry getConfigUserRegistry() {
return (Registry) PrivilegedCarbonContext.getCurrentContext().
getRegistry(RegistryType.USER_CONFIGURATION);
}
protected Registry getConfigSystemRegistry() {
try {
return DashboardContext.getRegistry(PrivilegedCarbonContext.getCurrentContext().getTenantId());
} catch (RegistryException e) {
log.error(e.getMessage(), e);
return null;
}
}
}
| [
"malaka@wso2.com"
] | malaka@wso2.com |
986e62711c223de43d083929d694678286b2f001 | 1c7524ed1092f06a14588aab66d0b51876dc83c4 | /SecondActivity/app/src/main/java/com/example/winsoft/co/secondactivity/MainActivity.java | 0bc485044804013ac1f29a6225cfa4519d12fd53 | [] | no_license | Ashraf24/IntentApp | 359854d64342f3b2a7cc06a58701a35a3466b1e1 | 85deac633b0460f69c73183f270143538edf1c5b | refs/heads/master | 2022-12-19T02:48:42.831232 | 2020-09-23T11:32:55 | 2020-09-23T11:32:55 | 297,938,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package com.example.winsoft.co.secondactivity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent=new Intent(this,SecondActivity.class)
startActivity ()
}
} | [
"alam24@usa.com"
] | alam24@usa.com |
e0d3c995b83f0fb625a1c6bbb909c2cf1c421bdf | dddcaedf9439a9dea33158dae806b242ac42fb4c | /src/org/crce/interns/service/InternshipPlacedService.java | 8c48d129645744fa45117861623b16318b1eca72 | [] | no_license | shindegau95/PMS_FINAL_REPO | 18c022f0447bcac985ef9e95726438aebf5c1c2a | 4ec97f3cf2425587c24ef33ed8cc8d63dd11d224 | refs/heads/master | 2021-01-18T09:18:26.267007 | 2016-07-10T15:21:12 | 2016-07-10T15:21:12 | 57,896,441 | 0 | 1 | null | 2016-06-05T03:51:38 | 2016-05-02T14:36:02 | Java | UTF-8 | Java | false | false | 309 | java | package org.crce.interns.service;
import java.util.List;
import org.crce.interns.beans.InternshipPlacedBean;
import org.crce.interns.model.InternshipPlaced;
public interface InternshipPlacedService {
public void addIP(InternshipPlacedBean ips);
public List<InternshipPlaced> listIhs();
}
| [
"melwyn95@gmail.com"
] | melwyn95@gmail.com |
21f1e001b80d081dfca7183e9ed994e48b9a4a49 | 836f1b511ad347cec862dd862829e42475836a23 | /chrome-extension-springboot/src/main/java/com/gcl/navigation/resp/DirQueryResp.java | fb270497e96eaa572e91d142506648fae6e4e927 | [
"MIT"
] | permissive | gaochlei/chrome-extension-vue3 | fad96e2a68c24c0a77c8551633eef7d9ba9a6961 | 553054a52b0181d3fb4e2507a5bbf776919dcc3a | refs/heads/master | 2023-07-13T22:36:14.946940 | 2021-08-27T12:05:00 | 2021-08-27T12:05:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,487 | java | package com.gcl.navigation.resp;
import com.gcl.navigation.req.WebsiteSaveReq;
import java.util.List;
public class DirQueryResp {
private Long id;
private Long user;
private Long parent;
private String name;
private Integer sort;
private List<WebsiteQueryResp> websiteList;
public List<WebsiteQueryResp> getWebsiteList() {
return websiteList;
}
public void setWebsiteList(List<WebsiteQueryResp> websiteList) {
this.websiteList = websiteList;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public Long getParent() {
return parent;
}
public void setParent(Long parent) {
this.parent = parent;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@Override
public String toString() {
return "DirQueryResp{" +
"id=" + id +
", user=" + user +
", parent=" + parent +
", name='" + name + '\'' +
", sort=" + sort +
", websiteList=" + websiteList +
'}';
}
} | [
"gaochlei@163.com"
] | gaochlei@163.com |
2a0ffd2a26ef78674b8df7c51e8d07c48a684e88 | 377290a4f940d25e4d5e8963277e4aa108d07a3f | /app/src/main/java/com/codesndata/aickongowea/ui/gallery/GalleryFragment.java | 8c04c9f7c0d9a35a2442df5603a5420d94908454 | [] | no_license | mbwika/aickongowea | 5ce4a37ba32b968e44ce737d78d4f673e75da8ef | 8a686318c0592ae638ab7435a4d65849dcf17a76 | refs/heads/master | 2023-03-26T02:27:54.693347 | 2021-03-26T17:03:08 | 2021-03-26T17:03:08 | 351,734,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | package com.codesndata.aickongowea.ui.gallery;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.codesndata.aickongowea.R;
public class GalleryFragment extends Fragment {
private GalleryViewModel galleryViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
galleryViewModel =
ViewModelProviders.of(this).get(GalleryViewModel.class);
View root = inflater.inflate(R.layout.fragment_gallery, container, false);
final TextView textView = root.findViewById(R.id.text_gallery);
galleryViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"collinsmbwika10@gmail.com"
] | collinsmbwika10@gmail.com |
f2da98e0df8ed35c81fc2eceb347239ca8d1cd26 | 70ed382c8722d81b3760b8fbbbf8159a01cab0e7 | /src/me/sunmin/algorithm/P658_FindKClosestElements.java | 46c90f399d8eac2a11941c2a479418f0e6fe2b53 | [] | no_license | s6530085/leetcode | df6235a48ce6f085c2e3d7d3977804634c32a8d9 | 1e0cd98df207ad6852972ac42695153ae66e945d | refs/heads/master | 2020-04-07T16:44:10.886021 | 2019-05-06T12:38:25 | 2019-05-06T12:38:25 | 158,540,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package me.sunmin.algorithm;
//https://leetcode.com/problems/find-k-closest-elements/
//Runtime: 6 ms, faster than 96.29% of Java online submissions for Find K Closest Elements.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class P658_FindKClosestElements {
public List<Integer> findClosestElements(int[] arr, int k, int x) {
int index = Arrays.binarySearch(arr, x);
if (index < 0) {
index = -index - 1;
if (index != 0) {
if (Math.abs(x - arr[index-1]) <= Math.abs(x - arr[index])) {
index--;
}
}
}
int left = index - 1;
int right = index + 1;
while (right - left <= k) {
if (left >= 0 && right < arr.length) {
if (Math.abs(x-arr[left]) <= Math.abs(x-arr[right])) {
left--;
}
else {
right++;
}
}
else if (left < 0) {
right++;
}
else {
left--;
}
}
List<Integer> l = new ArrayList<Integer>(right-left);
for (int i = left+1; i < right; i++) {
l.add(arr[i]);
}
return l;
}
public static void main(String[] args) {
int a[] = {1,2,3,5,6,7};
int i = Arrays.binarySearch(a, 4);
}
}
| [
"s6530085@hotmail.com"
] | s6530085@hotmail.com |
3d656faadd0aa088f86fd3672d6408640f0776c5 | 91d6cdbfeb1839c8c7a77a8f283ac77524e1d660 | /src/test/SimpleDateFormatDemo.java | 659e3054a8c8f1fb8ac59ce548295c218397d2cb | [] | no_license | wbbj/Test_and_PTA | 544f5bc559016a4c8354772e9221bce6d0cfc642 | 9f72cb376790adacbc631dd4eef93f173a0992ae | refs/heads/master | 2020-06-24T09:20:19.592641 | 2019-08-05T08:40:50 | 2019-08-05T08:40:50 | 198,922,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package test;
import java.util.*;
import java.text.*;
public class SimpleDateFormatDemo {
public static void main(String args[]) {
Date dNow = new Date( );
SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
System.out.println("当前时间为: " + ft.format(dNow));
}
} | [
"1694123166@qq.com"
] | 1694123166@qq.com |
439c2a2742201c9cbf7d55c6632dfc0ed5a0bd04 | 36e68d3887973b42aaa16303481560ef2f2cd516 | /it.unibo.jcc.xtext.simpleagent/src-gen/it/unibo/jcc/xtext/simpleAgent/AnyAction.java | bb76736619ad68026643d4e476f3fa0b7d3ec830 | [] | no_license | JCCorreale/ms-fw-dsl-2020 | e1f80431b560451d84dfbe4cbf8e642a1eef84d8 | 9e31a6616b05b55a215067bfda6f58953adc18c4 | refs/heads/master | 2022-12-14T08:43:24.115740 | 2019-11-14T17:29:42 | 2019-11-14T17:29:42 | 245,254,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | /**
* generated by Xtext 2.18.0.M3
*/
package it.unibo.jcc.xtext.simpleAgent;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Any Action</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link it.unibo.jcc.xtext.simpleAgent.AnyAction#getBody <em>Body</em>}</li>
* </ul>
*
* @see it.unibo.jcc.xtext.simpleAgent.SimpleAgentPackage#getAnyAction()
* @model
* @generated
*/
public interface AnyAction extends StateAction
{
/**
* Returns the value of the '<em><b>Body</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Body</em>' attribute.
* @see #setBody(String)
* @see it.unibo.jcc.xtext.simpleAgent.SimpleAgentPackage#getAnyAction_Body()
* @model
* @generated
*/
String getBody();
/**
* Sets the value of the '{@link it.unibo.jcc.xtext.simpleAgent.AnyAction#getBody <em>Body</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Body</em>' attribute.
* @see #getBody()
* @generated
*/
void setBody(String value);
} // AnyAction
| [
"jeanclaude.correale@studio.unibo.it"
] | jeanclaude.correale@studio.unibo.it |
2486f698ce32770f723e03966ef1b4fb7a96a7c3 | f2af72d0c85b057dfdd951c03c29086e346ef5c8 | /src/main/java/media/platform/amf/engine/handler/EngineMessageHandlerAudio.java | afa71968cdf0a5450dd931744bcdae59aed4e963 | [] | no_license | tonylim01/ACS_AMF_POC | d28f357298ecfb1070941788575746832263427b | ea3d865c5902e850f1d39bf80b70463f05ff9ef9 | refs/heads/master | 2020-04-23T19:14:14.998187 | 2019-02-20T07:41:26 | 2019-02-20T07:41:26 | 171,396,244 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,410 | java | package media.platform.amf.engine.handler;
import com.uangel.svc.oam.Level;
import media.platform.amf.common.AppId;
import media.platform.amf.engine.EngineClient;
import media.platform.amf.engine.messages.WakeupStartReq;
import media.platform.amf.engine.types.EngineMessageType;
import media.platform.amf.engine.types.EngineReportMessage;
import media.platform.amf.engine.types.EngineResponseMessage;
import media.platform.amf.oam.EventHandler;
import media.platform.amf.oam.StatManager;
import media.platform.amf.rmqif.handler.RmqProcOutgoingAiServiceCancelReq;
import media.platform.amf.room.RoomInfo;
import media.platform.amf.room.RoomManager;
import media.platform.amf.session.SessionInfo;
import media.platform.amf.session.SessionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EngineMessageHandlerAudio extends BaseEngineMessageHandler {
private static final Logger logger = LoggerFactory.getLogger(EngineMessageHandlerAudio.class);
private int index;
public EngineMessageHandlerAudio(int index) {
this.index = index;
}
public void handle(EngineResponseMessage msg) {
if (msg == null || msg.getHeader() == null) {
logger.warn("Null response message");
return;
}
String sessionId = AppId.getInstance().get(msg.getHeader().getAppId());
if (sessionId == null) {
logger.warn("No sessionId for appId=[{}]", msg.getHeader().getAppId());
return;
}
printResponseHeader(index, sessionId, msg);
if (compareString(msg.getHeader().getCmd(), EngineMessageType.MSG_CMD_CREATE)) {
procAudioCreateRes(sessionId, msg);
}
else if (compareString(msg.getHeader().getCmd(), EngineMessageType.MSG_CMD_DELETE)) {
procAudioDeleteRes(sessionId, msg);
}
else if (compareString(msg.getHeader().getCmd(), EngineMessageType.MSG_CMD_BRANCH)) {
procAudioBranchRes(sessionId, msg);
}
else {
logger.warn("Unsupported cmd [{}]", msg.getHeader().getCmd());
}
}
public void handle(EngineReportMessage msg) {
if (msg == null || msg.getHeader() == null) {
logger.warn("Null response message");
return;
}
String sessionId = AppId.getInstance().get(msg.getHeader().getAppId());
if (sessionId == null) {
logger.warn("No sessionId for appId=[{}]", msg.getHeader().getAppId());
return;
}
printReportHeader(index, sessionId, msg);
if (compareString(msg.getHeader().getCmd(), EngineMessageType.MSG_CMD_BRANCH)) {
procAudioBranchRpt(sessionId, msg);
}
else {
logger.warn("Unsupported cmd [{}]", msg.getHeader().getCmd());
}
}
private void procAudioCreateRes(String sessionId, EngineResponseMessage msg) {
if (msg == null || msg.getHeader() == null) {
logger.warn("Null response message");
return;
}
if (compareString(msg.getHeader().getResult(), EngineMessageType.MSG_RESULT_OK) ||
compareString(msg.getHeader().getResult(), EngineMessageType.MSG_RESULT_SUCCESS)) {
// Success
if (msg.getHeader().getAppId() == null) {
logger.warn("Null appId in response message");
return;
}
SessionInfo sessionInfo = SessionManager.getInstance().getSession(sessionId);
if (sessionInfo == null) {
logger.warn("Cannot find session for appId=[{}]", msg.getHeader().getAppId());
return;
}
sessionInfo.setAudioCreated(true);
logger.debug("[{}] Audio created", sessionId);
//
// TODO
//
SessionInfo otherSessionInfo = SessionManager.findOtherSession(sessionInfo);
if (otherSessionInfo != null) {
logger.debug("[{}] Other session found", sessionId);
if (otherSessionInfo.isAudioCreated()) {
//
// TODO
//
// EngineServiceManager.getInstance().popAndSendMessage();
}
else {
logger.debug("[{}] Other session audio not created", otherSessionInfo.getSessionId());
}
logger.debug("[{}] Other session audio created [{}]", sessionId, otherSessionInfo.getSessionId());
}
}
else {
logger.warn("Undefined result [{}]", msg.getHeader().getResult());
new EventHandler().onApplicationEvent(Level.MIN,
String.format("AMF engine audio error [%s]", msg.getHeader().getReason()));
}
}
private void procAudioDeleteRes(String sessionId, EngineResponseMessage msg) {
if (msg == null || msg.getHeader() == null) {
logger.warn("Null response message");
return;
}
if (compareString(msg.getHeader().getResult(), EngineMessageType.MSG_RESULT_OK) ||
compareString(msg.getHeader().getResult(), EngineMessageType.MSG_RESULT_SUCCESS)) {
// Success
if (msg.getHeader().getAppId() == null) {
logger.warn("Null appId in response message");
return;
}
SessionInfo sessionInfo = SessionManager.getInstance().getSession(sessionId);
if (sessionInfo == null) {
logger.warn("Cannot find session for appId=[{}]", msg.getHeader().getAppId());
return;
}
sessionInfo.setAudioCreated(false);
}
else {
logger.warn("Undefined result [{}]", msg.getHeader().getResult());
}
}
private void procAudioBranchRes(String sessionId, EngineResponseMessage msg) {
if (msg == null || msg.getHeader() == null) {
logger.warn("Null response message");
return;
}
if (compareString(msg.getHeader().getResult(), EngineMessageType.MSG_RESULT_OK) ||
compareString(msg.getHeader().getResult(), EngineMessageType.MSG_RESULT_SUCCESS)) {
// Success
if (msg.getHeader().getAppId() == null) {
logger.warn("Null appId in response message");
return;
}
SessionInfo sessionInfo = SessionManager.getInstance().getSession(sessionId);
if (sessionInfo == null) {
logger.warn("Cannot find session for appId=[{}]", msg.getHeader().getAppId());
return;
}
//
// TODO
//
// Nothing to do:w
}
else {
logger.warn("Undefined result [{}]", msg.getHeader().getResult());
}
}
private void procAudioBranchRpt(String sessionId, EngineReportMessage msg) {
if (msg == null || msg.getHeader() == null) {
logger.warn("Null response message");
return;
}
if (msg.getHeader().getAppId() == null) {
logger.warn("Null appId in response message");
return;
}
SessionInfo sessionInfo = SessionManager.getInstance().getSession(sessionId);
if (sessionInfo == null) {
logger.warn("Cannot find session for appId=[{}]", msg.getHeader().getAppId());
return;
}
if (sessionInfo.getConferenceId() != null) {
RoomInfo roomInfo = RoomManager.getInstance().getRoomInfo(sessionInfo.getConferenceId());
if (roomInfo != null && roomInfo.getAwfQueueName() != null) {
if (compareString(msg.getHeader().event, EngineMessageType.MSG_EVENT_TIMEOUT)) {
RmqProcOutgoingAiServiceCancelReq req = new RmqProcOutgoingAiServiceCancelReq(sessionInfo.getSessionId(), AppId.newId());
req.send(roomInfo.getAwfQueueName(), sessionInfo.isCaller() ? 1 : 2);
StatManager.getInstance().incCount(StatManager.SVC_OUT_AI_CANCEL);
}
else {
// Nothing to do
}
// Restart wakeup
/*
int wakeupStatus = roomInfo.getWakeupStatus();
if ((sessionInfo.isCaller() && ((sessionInfo.isCallerWakeupStatus() ? 0x8 : 0x0) != (wakeupStatus & 0xc))) ||
(!sessionInfo.isCaller() && ((sessionInfo.isCalleeWakeupStatus() ? 0x2 : 0x0) != (wakeupStatus & 0x3)))) {
roomInfo.setWakeupStatus(sessionInfo.isCaller(), RoomInfo.WAKEUP_STATUS_PREPARE);
}
logger.warn("[{}] Resend wakeup. isCaller [{}] caller [{}] callee [{}] wakeupStatus [{}]", sessionInfo.getSessionId(),
sessionInfo.isCaller(),
sessionInfo.isCallerWakeupStatus(), sessionInfo.isCalleeWakeupStatus(),
wakeupStatus);
if (sessionInfo.isCaller() && sessionInfo.isCallerWakeupStatus() && ((wakeupStatus & 0x4) > 0)) {
sendWakeupStartReqToEngine(sessionInfo, sessionInfo.getEngineToolId());
}
else if (!sessionInfo.isCaller() && sessionInfo.isCalleeWakeupStatus() && ((wakeupStatus & 0x1) > 0)) {
sendWakeupStartReqToEngine(sessionInfo, sessionInfo.getEngineToolId());
}
SessionInfo otherSessionInfo = SessionManager.findOtherSession(sessionInfo);
if (otherSessionInfo != null) {
if ((otherSessionInfo.isCaller() && ((otherSessionInfo.isCallerWakeupStatus() ? 0x8 : 0x0) != (wakeupStatus & 0xc))) ||
(!otherSessionInfo.isCaller() && ((otherSessionInfo.isCalleeWakeupStatus() ? 0x2 : 0x0) != (wakeupStatus & 0x3)))) {
roomInfo.setWakeupStatus(otherSessionInfo.isCaller(), RoomInfo.WAKEUP_STATUS_PREPARE);
}
logger.warn("[{}] Resend wakeup. isCaller [{}] caller [{}] callee [{}] wakeupStatus [{}]", otherSessionInfo.getSessionId(),
otherSessionInfo.isCaller(),
otherSessionInfo.isCallerWakeupStatus(), otherSessionInfo.isCalleeWakeupStatus(),
wakeupStatus);
if (otherSessionInfo.isCaller() && otherSessionInfo.isCallerWakeupStatus() && ((wakeupStatus & 0x4) > 0)) {
sendWakeupStartReqToEngine(otherSessionInfo, otherSessionInfo.getEngineToolId());
}
else if (!otherSessionInfo.isCaller() && otherSessionInfo.isCalleeWakeupStatus() && ((wakeupStatus & 0x1) > 0)) {
sendWakeupStartReqToEngine(otherSessionInfo, otherSessionInfo.getEngineToolId());
}
}
*/
}
else {
logger.warn("[{}] Invalid roomInfo. cnfId [{}] awf [{}]", sessionInfo.getSessionId(),
sessionInfo.getConferenceId(), (roomInfo != null) ? roomInfo.getAwfQueueName() : "no room");
}
}
}
private void sendWakeupStartReqToEngine(SessionInfo sessionInfo, int toolId) {
if (sessionInfo == null) {
return;
}
String appId = AppId.newId();
EngineProcWakeupStartReq wakeupStartReq = new EngineProcWakeupStartReq(appId);
wakeupStartReq.setData(sessionInfo, toolId, EngineProcWakeupStartReq.DEFAULT_TIMEOUT_MSEC);
EngineClient engineClient = EngineClient.getInstance(index);
if (engineClient == null) {
logger.error("[{}] Engine not found", sessionInfo.getSessionId());
return;
}
engineClient.pushSentQueue(appId, WakeupStartReq.class, wakeupStartReq.getData());
if (sessionInfo.getSessionId() != null) {
AppId.getInstance().push(appId, sessionInfo.getSessionId());
}
if (!wakeupStartReq.send(index, false)) {
// ERROR
// AppId.getInstance().remove(appId);
// EngineClient.getInstance().removeSentQueue(appId);
}
logger.info("[{}] -> (Engine-{}) WakeupStartReq. toolId [{}]", sessionInfo.getSessionId(), index, toolId);
}
}
| [
"conahuz@gmail.com"
] | conahuz@gmail.com |
6309f0eb5d286999274010f01f74f4fad4f4d624 | 882ba69afcdb9b6d7a14246ad5c544539cd82ecb | /app/src/main/java/com/example/egardening/egardening/IntentResult.java | ec82dabceb78c7582095d3c7feb48cb0a7de4121 | [] | no_license | marcinobiedz/Android-eGardening-App | 390451a2f79380b06f454e0beac58f506b69c892 | ef3eb6f6177ddd590f07896dc70f15c1d2f1e354 | refs/heads/master | 2021-01-22T03:39:01.459674 | 2017-05-25T09:28:02 | 2017-05-25T09:28:02 | 92,387,168 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,323 | java | package com.example.egardening.egardening;
/**
* <p>Encapsulates the result of a barcode scan invoked through {@link IntentIntegrator}.</p>
*
* @author Sean Owen
*/
public final class IntentResult {
private final String contents;
private final String formatName;
private final byte[] rawBytes;
private final Integer orientation;
private final String errorCorrectionLevel;
IntentResult() {
this(null, null, null, null, null);
}
IntentResult(String contents,
String formatName,
byte[] rawBytes,
Integer orientation,
String errorCorrectionLevel) {
this.contents = contents;
this.formatName = formatName;
this.rawBytes = rawBytes;
this.orientation = orientation;
this.errorCorrectionLevel = errorCorrectionLevel;
}
/**
* @return raw content of barcode
*/
public String getContents() {
return contents;
}
/**
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
*/
public String getFormatName() {
return formatName;
}
/**
* @return raw bytes of the barcode content, if applicable, or null otherwise
*/
public byte[] getRawBytes() {
return rawBytes;
}
/**
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
*/
public Integer getOrientation() {
return orientation;
}
/**
* @return name of the error correction level used in the barcode, if applicable
*/
public String getErrorCorrectionLevel() {
return errorCorrectionLevel;
}
@Override
public String toString() {
StringBuilder dialogText = new StringBuilder(100);
dialogText.append("Format: ").append(formatName).append('\n');
dialogText.append("Contents: ").append(contents).append('\n');
int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
dialogText.append("Raw bytes: (").append(rawBytesLength).append(" bytes)\n");
dialogText.append("Orientation: ").append(orientation).append('\n');
dialogText.append("EC level: ").append(errorCorrectionLevel).append('\n');
return dialogText.toString();
}
} | [
"marcin.obiedz@gmail.com"
] | marcin.obiedz@gmail.com |
5eda59fb9aceb129970197383b8177a78d8c724f | 2f44736f7d9df85506cf934b5eeaa7a416629622 | /service/service_edu/src/main/java/com/hogwarts/eduservice/service/EduCourseService.java | 70ccd4a80399efbdf2ac45859a4aaea5112c8b28 | [] | no_license | lengleng1528/edu | 0bf4c69837ddf062a285ee98df5e15ff56b5e358 | 3cfc31cedd39499e72eb9df10083ecffea9a98c6 | refs/heads/master | 2023-03-31T20:01:23.840946 | 2021-03-29T00:30:14 | 2021-03-29T00:30:14 | 344,709,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package com.hogwarts.eduservice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hogwarts.eduservice.entity.EduCourse;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hogwarts.eduservice.entity.frontvo.CourseFrontVo;
import com.hogwarts.eduservice.entity.frontvo.CourseWebVo;
import com.hogwarts.eduservice.entity.vo.CourseInfoVo;
import com.hogwarts.eduservice.entity.vo.PublishVo;
import java.util.Map;
/**
* <p>
* 课程 服务类
* </p>
*
* @author testjava
* @since 2021-01-18
*/
public interface EduCourseService extends IService<EduCourse> {
String saveCourseInfo(CourseInfoVo courseInfoVo);
CourseInfoVo getCourseInfo(String courseId);
void updateCourseInfo(CourseInfoVo courseInfoVo);
PublishVo getPublishVo(String courseId);
void removeCourse(String id);
CourseWebVo getBaseCourseInfo(String courseId);
Map<String, Object> getCourseFrontList(Page<EduCourse> pageCourse, CourseFrontVo courseFrontVo);
}
| [
"1010069135@qq.com"
] | 1010069135@qq.com |
3448f1c7dde171abaaa28b7c66a94f097408de9b | 6fa0f0f7390cffb017c2bca6d0d74f6b5414a92a | /src/main/java/riskgame/UpdateStatus.java | 361491def8e91fda01bfe5d41b8b3e2c59348a93 | [] | no_license | 4353Team/RiskGame | b7d308a3019220490a91f8dd1385a9796ee9c77c | 3fe808d6e1b38a63bcdcf1db3f0c519b1ccfcc37 | refs/heads/develop | 2020-03-27T16:52:34.393310 | 2018-12-03T08:14:34 | 2018-12-03T08:14:34 | 146,812,099 | 0 | 0 | null | 2018-12-03T08:14:35 | 2018-08-30T22:14:29 | Java | UTF-8 | Java | false | false | 1,048 | java | package riskgame;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
public class UpdateStatus {
static String consumerKeyStr = "xxxxxxxxxxxxxxxxxxxxxxxx";
static String consumerSecretStr = "xxxxxxxxxxxxxxxxxxxxxxxx";
static String accessTokenStr = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
static String accessTokenSecretStr = "xxxxxxxxxxxxxxxxxxxxxxxx";
public static void main(String[] args) {
try
{
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(consumerKeyStr, consumerSecretStr);
AccessToken accessToken = new AccessToken(accessTokenStr, accessTokenSecretStr);
twitter.setOAuthAccessToken(accessToken);
twitter.updateStatus("This tweet was sent using Twitter4J!");
System.out.println("Success.");
}
catch (TwitterException te)
{
te.printStackTrace();
}
}
} | [
"joshchan17@gmail.com"
] | joshchan17@gmail.com |
ea91f33f8a21dc76aca685b70913fc150a3d773c | 2600b62dd9180de9a8171f35b43be414a5a1b5ec | /src/main/java/util/FileUtils.java | 56a63cdd7a285e1f729fce8f233f050f367de944 | [] | no_license | leaderli/test | 304a4b2e80614cf01501674ad716e86505ae5e38 | 337ea1518c4c8ae4771b88ab8fe8d644eeccedc3 | refs/heads/master | 2020-03-12T10:46:22.503083 | 2019-01-21T14:18:47 | 2019-01-21T14:18:47 | 59,644,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package util;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
/**
* Created by li on 6/2/17.
*/
public class FileUtils {
public static List<String> listFilesUnderExactDir(String dirPath) {
List<String> list = new ArrayList<>();
Enumeration<URL> dirs;
try {
dirs = Thread.currentThread().getContextClassLoader().getResources(
"servlet");
while (dirs.hasMoreElements()) {
URL url = dirs.nextElement();
String path = null;
try {
path = URLDecoder.decode(url.getFile(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
File file;
if (path != null) {
file = new File(path);
File[] files = file.listFiles();
if (files == null)
return list;
for (File f : files) {
list.add(StringUtils.substringBeforeLast(f.getName(),"."));
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
return list;
}
} | [
"429243408@qq.com"
] | 429243408@qq.com |
f4dda3d0e9c36f6f57e049932e96f45333e4630f | 83e934b83e10ec240d543b1981a9205e525a4889 | /04. 1. Enumerations-And-Annotations/src/p05_Coding_Tracker/Tracker.java | 252c3e9c456f7872c6ba7e81c090868f90bc63de | [
"MIT"
] | permissive | kostadinlambov/Java-OOP-Advanced | dca49a1b0750092cc713684403629ff9ca06d39e | 12db2a30422deef057fc25cf2947d8bc22cce77c | refs/heads/master | 2021-05-12T10:59:24.753433 | 2018-01-20T19:01:45 | 2018-01-20T19:01:45 | 117,370,385 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package p05_Coding_Tracker;
import java.lang.reflect.Method;
import java.util.*;
public class Tracker {
private static Map<String, List<String>> map = new LinkedHashMap<>();
@Author(name = "Pesho")
public void run(){
}
@Author(name = "Gosho")
public void runAgain(){
}
public static void printMethodsByAuthor(Class<?> cl) {
Method[] arr = cl.getDeclaredMethods();
for (Method method : arr) {
Author annotation = method.getAnnotation(Author.class);
if (annotation != null) {
String methodName = method.getName() + "()";
String annotationValue = annotation.name();
map.putIfAbsent(annotationValue, new ArrayList<>());
map.get(annotationValue).add(methodName);
}
}
for (Map.Entry<String, List<String>> stringListEntry : map.entrySet()) {
System.out.println(stringListEntry.getKey() + ": " + String.join(", ", stringListEntry.getValue()));
}
}
}
| [
"valchak@abv.bg"
] | valchak@abv.bg |
f27a3b3c07887e3ea00782364e3acae20434f621 | 85b823436ea5f41bac9ad23a342e349bb53c0859 | /practice/day04/src/Demo01/Ma.java | 87cc6d76e15240b837569e833f34a0ebd2c85c89 | [] | no_license | huangqiyun/repo | 8c96a2fcef2459e1131c21b20ee62114ed29abdf | c9f520f28863c8987e29ed67139056bca311a57d | refs/heads/master | 2020-04-05T14:55:56.060187 | 2018-11-10T10:58:50 | 2018-11-10T10:58:50 | 156,946,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | package Demo01;
import java.sql.SQLOutput;
/*题目六:
这是经典的"百马百担"问题,有一百匹马,驮一百担货,大马驮3担,中马驮2担,
两只小马驮1担,问有大,中,小马各几匹?*/
public class Ma {
public static void main(String[] args) {
for (int daMa = 0; daMa <= 33; daMa++) {
for (int zhongMa = 0; zhongMa <= 50; zhongMa++) {
for (int xiaoMa = 0; xiaoMa <= 100; xiaoMa++) {
if (daMa + zhongMa + xiaoMa == 100 && xiaoMa % 2 == 0 && 3 * daMa + 2 * zhongMa + xiaoMa / 2 == 100) {
System.out.println("大马" + daMa + "匹\t" + "中马" + zhongMa + "匹\t" + "小马" + xiaoMa + "匹");
}
}
}
}
}
}
/*int daMa, zhongMa, xiaoMa;
int cons;
xiaoMa = 100 - daMa - zhongMa;
if (xiaoMa % 2 == 0) {
cons = daMa * 3 + zhongMa * 2 + xiaoMa / 2;
if (cons == 100) {
System.out.println("大马" + daMa + "匹/t" + "中马" + zhongMa + "匹/t" + "小马" + xiaoMa + "匹/t");*/ | [
"790253085@qq.com"
] | 790253085@qq.com |
b28ce48a277bc0278a93b272f6dae22399b6c17b | 82e5ed98367b78d0ba5e834d3b1b3c7c0c719842 | /NetflixOSS/StoreFeign/demo/src/main/java/com/example/demo/controllers/StoreController.java | 1565464d7e44d685c5b205002da2c9b43274c95b | [] | no_license | ogarules/CursoMicro2020 | 32fc4acfbcb36553570e8b3d33445c78985d7806 | 23f3a7435a95362e0eaefcf1da8a129f9d1bfd16 | refs/heads/master | 2023-01-03T05:24:44.843865 | 2020-10-31T18:12:10 | 2020-10-31T18:12:10 | 286,068,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package com.example.demo.controllers;
import com.example.demo.models.Order;
import com.example.demo.services.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(path="store")
public class StoreController {
@Autowired
private OrdersService ordersService;
@GetMapping(value="/order/{id}")
public Order getMethodName(@PathVariable Integer id) {
return this.ordersService.getOrder(id);
}
} | [
"oscargl2017@hotmail.com"
] | oscargl2017@hotmail.com |
41a0c305aa193d8dd111189029cc71ec234a4705 | 3346b4c5c3e7996ec2a92155d0295858185229a8 | /nettypro/src/main/java/com/ydw/netty/simple/NettyServerHandler.java | 06f6c4331caf3dce38be9714c1665f4edea5099b | [] | no_license | Yang-dongwen/ydw-netty | af897f0b22119b7cb04e1515c910cc4a3df26972 | 6a35218bb35a73f6b01c14121ac54efbd88d0592 | refs/heads/master | 2022-04-15T09:18:24.840966 | 2020-04-14T04:54:26 | 2020-04-14T04:54:26 | 255,513,451 | 0 | 0 | null | 2020-04-14T04:54:56 | 2020-04-14T04:54:09 | Java | UTF-8 | Java | false | false | 1,531 | java | package com.ydw.netty.simple;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.util.CharsetUtil;
public class NettyServerHandler extends ChannelInboundHandlerAdapter {
/**
*
* @param ctx
* @param msg
*/
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
System.out.println("当前线程:" + Thread.currentThread().getName());
System.out.println("ctx = " + ctx);
ChannelPipeline pipeline = ctx.pipeline();
Channel channel = pipeline.channel();
ByteBuf buf = (ByteBuf) msg;
System.out.println("客户端发送消息是:" + buf.toString(CharsetUtil.UTF_8));
System.out.println(ctx.channel().remoteAddress());
}
/**
*读取数据完毕
* @param ctx
*/
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
//将数据写入到缓存,并刷新
// 一般将 我们对这个发送的数据进行编码
ctx.writeAndFlush(Unpooled.copiedBuffer("Hello 客户端~", CharsetUtil.UTF_8));
}
/**
*处理异常
* @param ctx
* @param cause
*/
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
ctx.close();
}
}
| [
"2280994932@qq.com"
] | 2280994932@qq.com |
e9d2f10eba383900e27978e6514c4686128dd33c | 68e7e2edc120fc0c0748940912575610028e5fe2 | /ilcbs_server_web/src/main/java/godday/xin/web/action/HomeAction.java | 504ecd903ffbcd0121fef2da53648a9a55feb554 | [] | no_license | liuxugithub/ilcbs_parent | e9c6287d9bb0676e3f26b49dba1dc1ddb1a4b0f8 | 392822921a0a79fccb8c645ca291f9c302ab9fec | refs/heads/master | 2022-12-24T13:16:24.543230 | 2019-12-09T16:58:59 | 2019-12-09T16:58:59 | 225,913,186 | 0 | 0 | null | 2022-12-16T02:36:56 | 2019-12-04T16:44:10 | JavaScript | UTF-8 | Java | false | false | 1,564 | java | package godday.xin.web.action;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
/**
* @Description:
* @Author: 传智播客 java学院 传智.宋江
* @Company: http://java.itcast.cn
* @CreateDate: 2014年10月31日
*/
@Namespace("/")
@Results({
@Result(name="title",location="/WEB-INF/pages/home/title.jsp"),
@Result(name="fmain",location="/WEB-INF/pages/home/fmain.jsp"),
@Result(name="toleft",location="/WEB-INF/pages/${moduleName}/left.jsp"),
@Result(name="tomain",location="/WEB-INF/pages/${moduleName}/main.jsp")
})
public class HomeAction extends BaseAction{
private String moduleName; //动态指定跳转的模块,在struts.xml中配置动态的result
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
@Action("homeAction_fmain")
public String fmain(){
return "fmain";
}
@Action("homeAction_title")
public String title(){
return "title";
}
//转向moduleName指向的模块
@Action("homeAction_tomain")
public String tomain(){
return "tomain";
}
@Action("homeAction_toleft")
public String toleft(){
return "toleft";
}
}
| [
"504741809@qq.com"
] | 504741809@qq.com |
ca00d886d95cd415ddb5eb5e987e19287060b616 | bb768c2c6a5e9b376225c5334e10cc60d80bfb5a | /design_mode_lib/src/main/java/gesture/imisoftware/com/design_mode_lib/Iterator/BookShelf.java | b8772771a846bdfe2e0f4d7d6892d8d50d868c58 | [] | no_license | jtnkkk999/DataStructure | 1561eb05b921b49fc0b12b573ce974d3a88926e7 | d2b266b4fbda3623bd232853abf4928d934f7a76 | refs/heads/master | 2020-04-10T16:04:20.483660 | 2019-11-06T11:27:26 | 2019-11-06T11:27:26 | 161,132,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package gesture.imisoftware.com.design_mode_lib.Iterator;
import java.util.ArrayList;
/**
* 书架类:1.通过ArrayList存储book
* 2.添加书本
* 3.查找某个书本
* 4.获取书架种书本的本数
*/
public class BookShelf implements Aggregate {
private final ArrayList<Book> mBooks;
public BookShelf() {
mBooks = new ArrayList<>();
}
public void appendBook(Book book){
mBooks.add(book);
}
public int getLength(){
return mBooks.size();
}
public Book getBookAt(int index){
return mBooks.get(index);
}
@Override
public Iterator iterator() {
return new BookShelfIterator(this);
}
}
| [
"liuzhaoliang@hjimi.cn"
] | liuzhaoliang@hjimi.cn |
eb6041115561f60a4a391bd276b4e523f2dea638 | 55c4d49cdfa0f184b69d8b0a40aace4b866dd34f | /sb-test-api-Auth-jwt/src/main/java/com/abdev/sbtest/apiHrManager/controller/DepartementController.java | d3f910a5c9617d000b6a5de765207c6334eda103 | [] | no_license | diawababacar/TestSpring_Keycloak | 04e272bc95731874382249b3d452474ea986cc2e | f585bc3b365c91e0cf360132c19c89d37f919df4 | refs/heads/master | 2022-01-17T15:29:48.542093 | 2019-07-20T02:30:42 | 2019-07-20T02:30:42 | 197,868,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,031 | java | package com.abdev.sbtest.apiHrManager.controller;
import com.abdev.sbtest.apiHrManager.models.Departement;
import com.abdev.sbtest.apiHrManager.repository.DepartementRepository;
import com.abdev.sbtest.apiHrManager.services.ApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/api/ApiDep")
@CrossOrigin(origins = "*")
public class DepartementController {
@Autowired
private DepartementRepository departementRepository;
private ApiService apiService = new ApiService();
@GetMapping("/departement/{no}")
public Departement getDepartementNo(@PathVariable("no") String no) {
return departementRepository.findByNo(no);
}
@GetMapping("/departement/{name}")
public Departement getDepartementName(@PathVariable("name") String name) {
return departementRepository.findByName(name);
}
@PostMapping("/departement")
public Departement saveDepartement(@RequestBody Departement departement){
return departementRepository.save(departement);
}
@DeleteMapping("/departement/{id}")
public ResponseEntity<?> deleteDepartement(@PathVariable(value = "id")long id){
return ResponseEntity.ok(departementRepository.deleteById(id));
}
@PutMapping("/departement/{id}")
public ResponseEntity<?> putDepartement(@PathVariable(value = "id")long id,@RequestBody Departement departement){
if (departementRepository.findById(id) != null){
departement.setId(id);
return ResponseEntity.ok(departementRepository.save(departement));
}
else {
return ResponseEntity.ok("La Modification est impossible");
}
}
@GetMapping("/rapport-employee")
public void exportCSV(HttpServletResponse response) throws Exception {
apiService.exportRapportCSV(response);
}
}
| [
"diaw.ababacar94@gmail.com"
] | diaw.ababacar94@gmail.com |
b8f869d9d4fbc14a9053d27ae6d8fdb9bcf3a612 | 08e6fe03de6832e8adbfbc0051b3f7dbc26f980c | /src/com/hoyoji/android/hyjframework/HyjBitmapWorkerAsyncTask.java | c1dd4e5e9298eeec64d198d148711ef666604cf1 | [] | no_license | hoyoji/hoyoji_android | 58d1b92b6b33790a5f7d1fbca937de1e4db5d56f | 4a82168751a0744c3ca168a3748b6caee9912349 | refs/heads/master | 2020-04-14T01:09:37.155423 | 2014-08-27T05:58:54 | 2014-08-27T05:58:54 | 16,073,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,033 | java | package com.hoyoji.android.hyjframework;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.ref.WeakReference;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.hoyoji.android.hyjframework.server.HyjServer;
import com.hoyoji.hoyoji_android.R;
import com.hoyoji.hoyoji.models.Picture;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.util.Base64;
import android.widget.ImageView;
public class HyjBitmapWorkerAsyncTask extends AsyncTask<String, Void, Bitmap> {
private final WeakReference<ImageView> imageViewReference;
private String data = null;
public HyjBitmapWorkerAsyncTask(ImageView imageView) {
// Use a WeakReference to ensure the ImageView can be garbage collected
imageViewReference = new WeakReference<ImageView>(imageView);
}
public static void loadBitmap(String path, ImageView imageView) {
if (cancelPotentialWork(path, imageView)) {
final HyjBitmapWorkerAsyncTask task = new HyjBitmapWorkerAsyncTask(imageView);
final AsyncDrawable asyncDrawable =
new AsyncDrawable(HyjApplication.getInstance().getResources(), HyjUtil.getCommonBitmap(R.drawable.ic_action_refresh), task);
imageView.setImageDrawable(asyncDrawable);
task.execute(path);
}
}
public static void loadRemoteBitmap(String data, String path, ImageView imageView) {
if (cancelPotentialWork(data, imageView)) {
final HyjBitmapWorkerAsyncTask task = new HyjBitmapWorkerAsyncTask(imageView);
final AsyncDrawable asyncDrawable =
new AsyncDrawable(HyjApplication.getInstance().getResources(), HyjUtil.getCommonBitmap(R.drawable.ic_action_refresh), task);
imageView.setImageDrawable(asyncDrawable);
task.execute(data, path);
}
}
// Decode image in background.
@Override
protected Bitmap doInBackground(String... params) {
data = params[0];
Integer w = null;
Integer h = null;
String target = "";
if(params.length == 3){
w = Integer.parseInt(params[1]);
h = Integer.parseInt(params[2]);
}
if(params.length == 2){
target = params[1];
}
if(target.startsWith("http://")){
File dir = HyjApplication.getInstance().getCacheDir();
String[] l = dir.list(new FilenameFilter(){
@Override
public boolean accept(File dir, String filename) {
if(filename.startsWith(data+"_icon")){
return true;
}
return false;
}
});
if(l.length > 0){
return HyjUtil.decodeSampledBitmapFromFile(dir+"/"+l[0], null, null);
}
Object result = HyjServer.doHttpPost(this, target, data, true);
if(result instanceof JSONArray){
JSONArray jsonArray = (JSONArray) result;
try {
JSONObject jsonIcon = jsonArray.getJSONObject(0);
byte[] decodedByte = Base64.decode(jsonIcon.getString("base64PictureIcon"), 0);
Bitmap icon = BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);
FileOutputStream out = new FileOutputStream(HyjUtil.createTempImageFile(data+"_icon"));
icon.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.close();
out = null;
return icon;
} catch (JSONException e) {
e.printStackTrace();
return null;
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
}
} else {
return null;
}
} else {
return HyjUtil.decodeSampledBitmapFromFile(data, w, h);
}
}
// Once complete, see if ImageView is still around and set bitmap.
@Override
protected void onPostExecute(Bitmap bitmap) {
if (isCancelled()) {
bitmap = null;
}
if (imageViewReference != null && bitmap != null) {
final ImageView imageView = imageViewReference.get();
final HyjBitmapWorkerAsyncTask bitmapWorkerTask =
getBitmapWorkerTask(imageView);
if (this == bitmapWorkerTask && imageView != null) {
imageView.setImageBitmap(bitmap);
}
}
}
private static HyjBitmapWorkerAsyncTask getBitmapWorkerTask(ImageView imageView) {
if (imageView != null) {
final Drawable drawable = imageView.getDrawable();
if (drawable instanceof AsyncDrawable) {
final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable;
return asyncDrawable.getBitmapWorkerTask();
}
}
return null;
}
public static boolean cancelPotentialWork(int data, ImageView imageView) {
final HyjBitmapWorkerAsyncTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (bitmapWorkerTask != null) {
final String bitmapData = bitmapWorkerTask.data;
// If bitmapData is not yet set or it differs from the new data
if (bitmapData == null || !bitmapData.equals(data)) {
// Cancel previous task
bitmapWorkerTask.cancel(true);
} else {
// The same work is already in progress
return false;
}
}
// No task associated with the ImageView, or an existing task was cancelled
return true;
}
public static boolean cancelPotentialWork(String path, ImageView imageView) {
final HyjBitmapWorkerAsyncTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (bitmapWorkerTask != null) {
final String bitmapData = bitmapWorkerTask.data;
// If bitmapData is not yet set or it differs from the new data
if (bitmapData == null || !bitmapData.equals(path)) {
// Cancel previous task
bitmapWorkerTask.cancel(true);
} else {
// The same work is already in progress
return false;
}
}
// No task associated with the ImageView, or an existing task was cancelled
return true;
}
static class AsyncDrawable extends BitmapDrawable {
private final WeakReference<HyjBitmapWorkerAsyncTask> bitmapWorkerTaskReference;
public AsyncDrawable(Resources res, Bitmap bitmap,
HyjBitmapWorkerAsyncTask bitmapWorkerTask) {
super(res, bitmap);
bitmapWorkerTaskReference =
new WeakReference<HyjBitmapWorkerAsyncTask>(bitmapWorkerTask);
}
public HyjBitmapWorkerAsyncTask getBitmapWorkerTask() {
return bitmapWorkerTaskReference.get();
}
}
} | [
"szepan.yiu@gmail.com"
] | szepan.yiu@gmail.com |
ff643a0f27c6da838a410096fbee67776382af1c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_da3ac45ca7526d4d30d659e75142d44665e22871/SForm/27_da3ac45ca7526d4d30d659e75142d44665e22871_SForm_t.java | 5e28867243e2fac2582ee0ba7c66d6d9c5812331 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 17,947 | java | /*
* Copyright 2000,2005 wingS development team.
*
* This file is part of wingS (http://www.j-wings.org).
*
* wingS is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* Please see COPYING for the complete licence.
*/
package org.wings;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wings.plaf.FormCG;
import javax.swing.event.EventListenerList;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.*;
/**
* Container in which you need to wrap HTML input fields (ie. <code>STextField</code>)
* to work correctly.
* <p/>
* The browser uses this object/tag to identify how (POST or GET) and where
* to send an request originating from any input inside this form.
* <p/>
* <b>Note:</b>Please be aware, that some components render differently if
* placed inside a <code>SForm</code>.
*
* @author <a href="mailto:armin.haaf@mercatis.de">Armin Haaf</a>
*/
public class SForm extends SContainer implements LowLevelEventListener {
private final static Log log = LogFactory.getLog(SForm.class);
/**
* Default Form encoding type. See {@link #setEncodingType(String)}.
*/
public final static String ENC_TYPE_TEXT_PLAIN = "text/plain";
/**
* Multipart form encoding. Needed for file uploads. See {@link #setEncodingType(String)}.
*/
public final static String ENC_TYPE_MULTIPART_FORM = "multipart/form-data";
/**
* URL form encoding. See {@link #setEncodingType(String)}.
*/
public static final String URL_ENCODING = "application/x-www-form-urlencoded";
/**
* Use method POST for submission of the data.
*/
private boolean postMethod = true;
/**
* EncondingType for submission of the data.
*/
private String encType;
/**
* Target URL to which data should be sent to
*/
private URL action;
protected final EventListenerList listenerList = new EventListenerList();
protected String actionCommand;
/**
* the button, that is activated, if no other button is pressed in this
* form.
*/
private SButton defaultButton;
/**
* the WingS event thread is the servlet doGet()/doPost() context
* thread. Within this thread, we collect all armed components. A
* 'armed' component is a component, that will 'fire' an event after the
* first processRequest() stage is completed.
*/
private static ThreadLocal threadArmedComponents = new ThreadLocal() {
protected synchronized Object initialValue() {
return new HashSet(2);
}
};
/**
* Create a standard form component.
*/
public SForm() {
}
/**
* Create a standard form component but redirects the request to the passed
* URL. Use this i.e. to address other servlets.
*
* @param action The target URL.
*/
public SForm(URL action) {
setAction(action);
}
/**
* Create a standard form component.
*
* @param layout The layout to apply to this container.
* @see SContainer
*/
public SForm(SLayoutManager layout) {
super(layout);
}
/**
* A SForm fires an event each time it was triggered (i.e. pressing asubmit button inside)
*
* @param actionCommand The action command to place insiside the {@link ActionEvent}
*/
public void setActionCommand(String actionCommand) {
this.actionCommand = actionCommand;
}
/**
* @see #setActionCommand(String)
*/
public String getActionCommand() {
return actionCommand;
}
/**
* Set the default button activated upon <b>enter</b>.
* The button is triggered if you press <b>enter</b> inside a form to submit it.
* @param defaultButton A button which will be rendered <b>invisible</b>.
* If <code>null</code> enter key pressed will be catched by the wings framework.
*/
public void setDefaultButton(SButton defaultButton) {
reloadIfChange(this.defaultButton, defaultButton);
this.defaultButton = defaultButton;
}
/**
* @see #setDefaultButton(SButton)
*/
public SButton getDefaultButton() {
return this.defaultButton;
}
/**
* Add a listener for Form events. A Form event is always triggered, when
* a form has been submitted. Usually, this happens, whenever a submit
* button is pressed or some other mechanism triggered the posting of the
* form. Other mechanisms are
* <ul>
* <li> Java Script submit() event</li>
* <li> If a form contains a single text input, then many browsers
* submit the form, if the user presses RETURN in that field. In that
* case, the submit button will <em>not</em> receive any event but
* only the form.
* <li> The {@link SFileChooser} will trigger a form event, if the file
* size exceeded the allowed size. In that case, even if the submit
* button has been pressed, no submit-button event will be triggered.
* (For details, see {@link SFileChooser}).
* </ul>
* Form events are guaranteed to be triggered <em>after</em> all
* Selection-Changes and Button ActionListeners.
*/
public void addActionListener(ActionListener listener) {
listenerList.add(ActionListener.class, listener);
}
/**
* Remove a form action listener, that has been added in
* {@link #addActionListener(ActionListener)}
*/
public void removeActionListener(ActionListener listener) {
listenerList.remove(ActionListener.class, listener);
}
/**
* Fire a ActionEvent at each registered listener.
*/
protected void fireActionPerformed(String pActionCommand) {
ActionEvent e = null;
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ActionListener.class) {
// lazy create ActionEvent
if (e == null) {
e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
pActionCommand);
}
((ActionListener) listeners[i + 1]).actionPerformed(e);
}
}
}
/**
* Register a components to be subject to fire component events in a later phase of
* the request processing. <code>SForm</code> will call
* {@link org.wings.LowLevelEventListener#fireIntermediateEvents()} and later
* {@link org.wings.LowLevelEventListener#fireFinalEvents()} in a later phase of
* the request. The calls on the components will be ordered dependend on their type.
*
* @param component The component to callback for event firing in a later phase of the request
* @see #fireEvents()
*/
public static void addArmedComponent(LowLevelEventListener component) {
Set armedComponents = (Set) threadArmedComponents.get();
armedComponents.add(component);
}
/**
* clear armed components. This is usually not necessary, since sessions
* clear clear their armed components. But if there was some Exception, it
* might well be, that this does not happen.
*/
public static void clearArmedComponents() {
Set armedComponents = (Set) threadArmedComponents.get();
armedComponents.clear();
}
/*
* Die Sache muss natuerlich Thread Save sein, d.h. es duerfen nur
* die Events gefeuert werden, die auch aus dem feuernden Thread
* stammen (eben dem Dispatcher Thread). Sichergestellt wird das
* dadurch das beim abfeuern der Event in eine Queue (ArrayList)
* gestellt wird, die zu dem feuernden Event gehoert. Diese Queues
* der verschiedenen Threads werden in einer Map verwaltet.
* Beim feuern wird dann die Queue, die dem aktuellen Thread
* entspricht gefeuert und aus der Map entfernt.
*/
/**
* This method fires the low level events for all "armed" components of
* this thread (http session) in an ordered manner:
* <ul><li>forms
* <li>buttons / clickables
* <li>"regular" components</ul>
* This order derives out of the assumption, that a user first modifies
* regular components before he presses the button submitting his changes.
* Otherwise button actions would get fired before the edit components
* fired their events.
*/
public static void fireEvents() {
Set armedComponents = (Set) threadArmedComponents.get();
// use a copy to avoid concurrent modification exceptions if a
// LowLevelEventListener adds itself to the armedComponents again
Set armedComponentsCopy = new HashSet(armedComponents);
try {
// handle form special, form event should be fired last
// hopefully there is only one form ;-)
Iterator iterator = armedComponentsCopy.iterator();
LinkedList formEvents = null;
LinkedList buttonEvents = null;
while (iterator.hasNext()) {
LowLevelEventListener component = (LowLevelEventListener) iterator.next();
/* fire form events at last
* there could be more than one form event (e.g. mozilla posts a
* hidden element even if it is in a form outside the posted
* form (if the form is nested). Forms should not be nested in HTML.
*/
if (component instanceof SForm) {
if (formEvents == null) {
formEvents = new LinkedList();
} // end of if ()
formEvents.add(component);
iterator.remove();
} else if (component instanceof SAbstractIconTextCompound) {
if (buttonEvents == null) {
buttonEvents = new LinkedList();
}
buttonEvents.add(component);
iterator.remove();
} else {
component.fireIntermediateEvents();
}
}
/*
* no buttons in forms pressed ? Then consider the default-Button.
*/
// Wrong - this fires default button for page scrollers!
/*if (buttonEvents == null && formEvents != null) {
Iterator fit = formEvents.iterator();
while (fit.hasNext()) {
SForm form = (SForm) fit.next();
SButton defaultButton = form.getDefaultButton();
if (defaultButton != null) {
if (buttonEvents == null) {
buttonEvents = new LinkedList();
}
buttonEvents.add(defaultButton);
}
}
} */
if (buttonEvents != null) {
iterator = buttonEvents.iterator();
while (iterator.hasNext()) {
((SAbstractIconTextCompound) iterator.next()).fireIntermediateEvents();
}
}
if (formEvents != null) {
iterator = formEvents.iterator();
while (iterator.hasNext()) {
((SForm) iterator.next()).fireIntermediateEvents();
}
}
iterator = armedComponentsCopy.iterator();
while (iterator.hasNext()) {
LowLevelEventListener component = (LowLevelEventListener) iterator.next();
// fire form events at last
component.fireFinalEvents();
}
if (buttonEvents != null) {
iterator = buttonEvents.iterator();
while (iterator.hasNext()) {
((SAbstractIconTextCompound) iterator.next()).fireFinalEvents();
}
buttonEvents.clear();
}
if (formEvents != null) {
iterator = formEvents.iterator();
while (iterator.hasNext()) {
((SForm) iterator.next()).fireFinalEvents();
}
formEvents.clear();
}
} finally {
armedComponents.clear();
}
}
/**
* Set, whether this form is to be transmitted via <code>POST</code> (true)
* or <code>GET</code> (false). The default, and this is what you
* usually want, is <code>POST</code>.
*/
public void setPostMethod(boolean postMethod) {
this.postMethod = postMethod;
}
/**
* Returns, whether this form is transmitted via <code>POST</code> (true)
* or <code>GET</code> (false). <p>
* <b>Default</b> is <code>true</code>.
*
* @return <code>true</code> if form postedt via <code>POST</code>,
* <code>false</code> if via <code>GET</code> (false).
*/
public boolean isPostMethod() {
return postMethod;
}
/**
* Set the encoding of this form. This actually is an HTML interna
* that bubbles up here. By default, the encoding type of any HTML-form
* is <code>application/x-www-form-urlencoded</code>, and as such, needn't
* be explicitly set with this setter. However, if you've included a
* file upload element (as represented by {@link SFileChooser}) in your
* form, this must be set to <code>multipart/form-data</code>, since only
* then, files are transmitted correctly. In 'normal' forms without
* file upload, it is not necessary to set it to
* <code>multipart/form-data</code>; actually it enlarges the data to
* be transmitted, so you probably don't want to do this, then.
*
* @param type the encoding type; one of <code>multipart/form-data</code>,
* <code>application/x-www-form-urlencoded</code> or null to detect encoding.
*/
public void setEncodingType(String type) {
encType = type;
}
/**
* Get the current encoding type, as set with
* {@link #setEncodingType(String)}. If no encoding type was set, this
* method detects the best encoding type. This can be expensive, so if
* you can, set the encoding type.
*
* @return string containing the encoding type. This is something like
* <code>multipart/form-data</code>,
* <code>application/x-www-form-urlencoded</code> .. or 'null'
* by default.
*/
public String getEncodingType() {
if (encType == null) {
return detectEncodingType(this);
} else {
return encType;
}
}
/**
* Detects if the Container contains a component that needs a certain encoding type
* @return <code>null</code> or {@link #ENC_TYPE_MULTIPART_FORM}
*/
protected String detectEncodingType(SContainer pContainer) {
for (int i = 0; i < pContainer.getComponentCount(); i++) {
SComponent tComponent = pContainer.getComponent(i);
if (tComponent instanceof SFileChooser && tComponent.isVisible()) {
return ENC_TYPE_MULTIPART_FORM;
} else if ((tComponent instanceof SContainer) && tComponent.isVisible()) {
String tContainerEncoding = detectEncodingType((SContainer) tComponent);
if (tContainerEncoding != null) {
return tContainerEncoding;
}
}
}
return null;
}
public void setAction(URL action) {
this.action = action;
}
public URL getAction() {
return action;
}
public RequestURL getRequestURL() {
RequestURL addr = super.getRequestURL();
if (getAction() != null) {
addr.addParameter(getAction().toString()); // ??
}
return addr;
}
public void processLowLevelEvent(String action, String[] values) {
processKeyEvents(values);
// we have to wait, until all changed states of our form have
// changed, before we anything can happen.
SForm.addArmedComponent(this);
}
public void fireIntermediateEvents() {
}
public void fireFinalEvents() {
fireKeyEvents();
fireActionPerformed(getActionCommand());
}
/** @see LowLevelEventListener#isEpochCheckEnabled() */
private boolean epochCheckEnabled = true;
/** @see LowLevelEventListener#isEpochCheckEnabled() */
public boolean isEpochCheckEnabled() {
return epochCheckEnabled;
}
/** @see LowLevelEventListener#isEpochCheckEnabled() */
public void setEpochCheckEnabled(boolean epochCheckEnabled) {
this.epochCheckEnabled = epochCheckEnabled;
}
public SComponent addComponent(SComponent c, Object constraint, int index) {
if (c instanceof SForm)
log.warn("WARNING: attempt to nest forms; won't work.");
return super.addComponent(c, constraint, index);
}
public void setCG(FormCG cg) {
super.setCG(cg);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
7dc692076eabc7a4c3e90e6d02fe8489e5328017 | 4f0dc5b6be705eece63aede26e7a4616fdb89bf6 | /sandbox/src/main/java/ru/stqa/ptf/sandbox/Point.java | cd3135ba745bd3adb6f54d71af0db774ae070853 | [
"Apache-2.0"
] | permissive | daria-zaikina/java_HM | 79a0f9e3a653669ca58402653621b65f60dcfb6d | 4769c588a1101ee4973316b12ba23d5bb6ed2b43 | refs/heads/master | 2023-05-08T02:16:37.403455 | 2019-06-16T12:08:48 | 2019-06-16T12:08:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package ru.stqa.ptf.sandbox;
public class Point {
double x;
double y;
public Point(double a, double b) {
this.x = a;
this.y = b;
}
public double distance(Point p2) {
double dist = Math.sqrt((p2.x - this.x)*(p2.x - this.x) + (p2.y - this.y)*(p2.y - this.y));
return dist;
}
}
| [
"d.zaikina@eastbanctech.ru"
] | d.zaikina@eastbanctech.ru |
8280210d538a959d8fd2a8e5356755e87ec815f9 | 93229b79aa329ccaa8214873c358ce4c7c5eb76f | /src/main/java/tool/MyToolWindowFactory.java | 781813e6a7d1b161e91c983f5c3fe31815adb172 | [] | no_license | Jalomo1197/Design-Pattern-Code-Generator | 7bb5addb28e61edc305b6bafd130e42c7640cefa | 8958d0e8e4e09d01012808bb9da1781eb547f2fe | refs/heads/master | 2022-05-24T20:20:26.487520 | 2020-04-24T19:29:04 | 2020-04-24T19:29:04 | 258,604,627 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package tool;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import org.jetbrains.annotations.NotNull;
public class MyToolWindowFactory implements ToolWindowFactory {
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
MyToolWindow panel = new MyToolWindow(toolWindow, project);
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(panel.getContent(), "", false);
toolWindow.getContentManager().addContent(content);
}
}
| [
"alexisjalomo1197@gmail.com"
] | alexisjalomo1197@gmail.com |
8e898e0f7a5c8c06f747a98cd88eee752074a13f | 6bfde89dd11e04a8c78688c897f3a9bde571689f | /web/src/main/java/com/ncov/base/web/model/entity/NcovInfo.java | 7cbd258a619b32d223a292a2e2a89c10b02c3c4c | [] | no_license | DramaChen/spring-security-demo | e546e0880e82625e49f817a3c5ca136be762ffa5 | b83a103a3a01f7efd16f133fc327c3c55af69be9 | refs/heads/master | 2023-06-09T04:05:56.520515 | 2020-02-25T16:59:28 | 2020-02-25T16:59:28 | 242,875,000 | 0 | 0 | null | 2023-05-26T22:14:36 | 2020-02-25T00:37:00 | Java | UTF-8 | Java | false | false | 1,710 | java | package com.ncov.base.web.model.entity;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ncov.base.core.utils.IdUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
@Data
public class NcovInfo {
private String id;
private String generalRemark;//全国疫情信息概览
private Integer deadCount;//累计死亡人数
private Integer curedCount;//治愈病例
private Integer seriousCount;//重症病例人数
private Integer suspectedCount;//疑似感染总数
private Integer currentConfirmedCount;//当前确诊总数
private Integer confirmedCount;//累计确诊总数
private String note3;//传播途径
private String note2;//传染源
private String note1;//病毒名称
private Integer currentConfirmedIncr;//较昨日变化数量
private Integer suspectedIncr;//较昨日疑似感染人数
private Integer seriousIncr;//较昨日新增重症人数
private Integer confirmedIncr;//较昨日新增确诊人数
private Integer deadIncr;//死亡增加人数
private Integer curedIncr;//治愈增加人数
private Date createDate;
private Date updateDate;
private String createBy;
private String updateBy;
private String deleteFlag;
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
private Date updateTime;//更新时间
public void prepareInsert(){
if (StringUtils.isBlank(id)){
this.id= IdUtils.snowflakeId();
}
this.createBy="1";
this.updateBy="1";
this.createDate=new Date();
this.updateDate=new Date();
}
}
| [
"291920822@qq.com"
] | 291920822@qq.com |
655058c9a47b84e511eb563e46b67256e26bbfcc | 92583f2a9e376a8b7bd0a5dccc3aa455f24280be | /src/main/java/com/lakeqiu/base/design/charpter6/version1/ReadWriteLock.java | ddb0531343a347988943e557f3cdb54681a3f1ce | [] | no_license | lakeqiu/try-concurrency | f4b3a5bf92d80845312b5d68af7607b0ac154a73 | 65c31b0a44bd9690c0ae15dcb3f669f5289dc023 | refs/heads/master | 2020-08-02T17:08:03.772587 | 2019-10-26T12:25:36 | 2019-10-26T12:25:36 | 211,439,969 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,195 | java | package com.lakeqiu.base.design.charpter6.version1;
/**
* 获取读锁、写锁的类
* @author lakeqiu
*/
public class ReadWriteLock {
/**
* 阅读者数量
*/
private int readingReaders = 0;
/**
* 等待阅读者数量
*/
private int waitingReaders = 0;
/**
* 写入者数量
*/
private int writingWriters = 0;
/**
* 等待写入者数量
*/
private int waitingWriters = 0;
/**
* 获取读锁
*/
public synchronized void readLock() throws InterruptedException {
// 不知道能不能获取读锁,所以先加入等待获取读锁的队列中
this.waitingReaders++;
try {
// 只要还有人在写入中,就进行等待
while (writingWriters > 0){
this.wait();
}
// 没人在写入了,获取读锁,把阅读者数量加1
this.readingReaders++;
}finally {
// 获取锁完了,将自己从等待队列中剔除
this.waitingReaders--;
}
}
/**
* 释放读锁
*/
public synchronized void readUnlock(){
// 将自己从阅读队列里剔除
this.readingReaders--;
// 唤醒其他线程
this.notifyAll();
}
/**
* 获取写锁
*/
public synchronized void writerLock() throws InterruptedException {
// 不知道能不能获取锁成功,所以先自己加入等待队列
this.waitingWriters++;
try {
// 只要还有人在写入或读取,就进行等待
while (readingReaders > 0 || writingWriters >0 ){
this.wait();
}
// 没有写入或读取,可以获取锁了,把自己加入写入者队列
this.writingWriters++;
}finally {
// 获取锁完了,将自己从等待队列中剔除
this.waitingWriters--;
}
}
/**
* 释放写锁
*/
public synchronized void writerUnlock(){
// 将自己从写入者队列中剔除
this.writingWriters--;
// 唤醒其他线程
this.notifyAll();
}
}
| [
"884506946@qq.com"
] | 884506946@qq.com |
f8a0b5334025365d0f043b1c87a5cd5802f1d0e7 | e2fa11333f9a0a6a9e8663e074c18db7578d1c2b | /Uncom-android/app/src/main/java/com/example/chen1/uncom/me/MeInfoEdit.java | 802608f1c7c8f679c3aa318e9068a8e22b4b2d2f | [] | no_license | LearGroup/campus-community-project | 4b8093cbe4ee84c82a9f4d5b4aa38bd524dfb753 | 4fe8f98981977b5259474c582ce62b247430a410 | refs/heads/master | 2021-01-19T22:29:13.179064 | 2018-07-15T05:22:26 | 2018-07-15T05:22:26 | 88,822,076 | 3 | 0 | null | 2017-11-06T01:41:25 | 2017-04-20T04:51:34 | Java | UTF-8 | Java | false | false | 29,369 | java | package com.example.chen1.uncom.me;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.FileProvider;
import android.support.v7.widget.AppCompatImageView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.sdk.android.oss.ClientConfiguration;
import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.OSS;
import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSFederationToken;
import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSStsTokenCredentialProvider;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.example.chen1.uncom.FragmentBackHandler;
import com.example.chen1.uncom.R;
import com.example.chen1.uncom.application.CoreApplication;
import com.example.chen1.uncom.bean.BeanDaoManager;
import com.example.chen1.uncom.bean.PersonDynamicsBean;
import com.example.chen1.uncom.bean.PersonDynamicsBeanDao;
import com.example.chen1.uncom.bean.RelationShipLevelBean;
import com.example.chen1.uncom.bean.UserBean;
import com.example.chen1.uncom.chat.PersonChatFragment;
import com.example.chen1.uncom.expression.SoftKeyBoardListener;
import com.example.chen1.uncom.main.MainActivity;
import com.example.chen1.uncom.utils.BackHandlerHelper;
import com.example.chen1.uncom.utils.DisplayUtils;
import com.example.chen1.uncom.utils.GlideApp;
import com.example.chen1.uncom.utils.GlideCircleTransform;
import com.example.chen1.uncom.utils.GlideEngine;
import com.example.chen1.uncom.utils.LoadImageUtils;
import com.example.chen1.uncom.utils.MessageEvent;
import com.example.chen1.uncom.utils.OssService;
import com.example.chen1.uncom.utils.PopupWindowUtils;
import com.example.chen1.uncom.utils.SessionStoreJsonRequest;
import com.example.chen1.uncom.utils.SwipLayout;
import com.example.chen1.uncom.utils.SyncPersonInfoUtils;
import com.example.chen1.uncom.utils.UIDisplayer;
import com.huantansheng.easyphotos.EasyPhotos;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.greenrobot.greendao.query.Query;
import org.greenrobot.greendao.query.QueryBuilder;
import org.json.JSONException;
import org.json.JSONObject;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable;
import io.reactivex.FlowableEmitter;
import io.reactivex.FlowableOnSubscribe;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import top.zibin.luban.Luban;
import static android.app.Activity.RESULT_OK;
import static com.example.chen1.uncom.thinker.WriteThinkFragment.TAKE_PHOTO;
public class MeInfoEdit extends Fragment implements FragmentBackHandler,View.OnTouchListener{
private boolean change=false;
private static final String endpoint = "http://oss-cn-beijing.aliyuncs.com";
private String domain="http://uncomapp.oss-cn-beijing.aliyuncs.com";
private UIDisplayer uiDisplayer;
private ImageView headImg;
private String imgUrl;
private PhotoSelectorDialog dialog;
private AutoCompleteTextView username;
private RadioGroup gender;
private UserBean bean;
private AutoCompleteTextView selfAbstract;
private AutoCompleteTextView addr;
private AutoCompleteTextView email;
private OssService ossService;
private AppCompatImageView backBtn;
private AutoCompleteTextView university;
private AutoCompleteTextView college;
private RadioButton boy;
private RadioButton girl;
private AppCompatImageView saveBtn;
private ValueAnimator scrollViewAnimator;
private ImageView displayImage;
private int scrollViewBottom;
private TextView displayInfo;
private SyncPersonInfoUtils syncPersonInfoUtils;
private float raw_Y;
private ScrollView scrollView;
private String s_username;
private Integer s_sex;
private String s_self_abstract;
private String s_email;
private String s_university;
private String s_college;
private View view;
private SwipLayout swipLayout;
private SoftKeyBoardListener.OnSoftKeyBoardChangeListener onSoftKeyBoardChangeListener;
private SoftKeyBoardListener softKeyBoardListener;
public MeInfoEdit() {
// Required empty public constructor
}
public static MeInfoEdit newInstance() {
MeInfoEdit fragment = new MeInfoEdit();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
bean=CoreApplication.newInstance().getUserBean();
EventBus.getDefault().register(this);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
Log.v("MeInfoEdit","onCreateView");
if(view==null){
view =inflater.inflate(R.layout.fragment_me_info_edit, container, false);
}
((MainActivity)getActivity()).unBindDrawer();
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
swipLayout=new SwipLayout(getContext());
swipLayout.setLayoutParams(params);
swipLayout.setBackgroundColor(Color.TRANSPARENT);
swipLayout.removeAllViews();
swipLayout.addView(view);
if(CoreApplication.newInstance().getRoot()!=null){
Log.v("MeinfoEdit","rootView not null");
}
swipLayout.setParentView(getTargetFragment().getView()).setFragment(MeInfoEdit.this);
return swipLayout;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
headImg= (ImageView) view.findViewById(R.id.head_img);
view.setClickable(true);
displayInfo= (TextView) view.findViewById(R.id.display_info);
displayImage= (ImageView) view.findViewById(R.id.display_image);
username= (AutoCompleteTextView) view.findViewById(R.id.username);
gender= (RadioGroup) view.findViewById(R.id.gender);
boy= (RadioButton) view.findViewById(R.id.boy);
girl= (RadioButton) view.findViewById(R.id.girl);
backBtn= (AppCompatImageView) view.findViewById(R.id.back);
saveBtn= (AppCompatImageView) view.findViewById(R.id.save);
selfAbstract= (AutoCompleteTextView) view.findViewById(R.id.write);
addr= (AutoCompleteTextView) view.findViewById(R.id.addr);
email= (AutoCompleteTextView) view.findViewById(R.id.email);
university= (AutoCompleteTextView) view.findViewById(R.id.univiersity);
college= (AutoCompleteTextView) view.findViewById(R.id.college);
scrollView= (ScrollView) view.findViewById(R.id.container);
GlideApp.with(this)
.load(CoreApplication.newInstance().getUserBean().getHeader_pic()).transition(new DrawableTransitionOptions().crossFade())
.into(headImg);
uiDisplayer=new UIDisplayer(displayImage,null,displayInfo,getActivity());
saveBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
update();
} catch (JSONException e) {
e.printStackTrace();
}
}
});
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
onBack();
} catch (JSONException e) {
e.printStackTrace();
}
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
getFragmentManager().popBackStack();
CoreApplication.newInstance().getRoot().startAnimation(AnimationUtils.loadAnimation(CoreApplication.newInstance().getBaseContext(), R.anim.default_open_right));
}
});
gender.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
Log.v("checkedId", String.valueOf(checkedId));
RadioButton button= (RadioButton) gender.findViewById(checkedId);
if((gender.findViewById(checkedId)).equals("boy")){
s_sex=1;
}else{
s_sex=0;
}
Log.v("checkedId", (String) button.getText());
}
});
headImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogConfig();
}
});
setTouchListener();
setInfo();
onSoftKeyBoardChangeListener= new SoftKeyBoardListener.OnSoftKeyBoardChangeListener() {
@Override
public void keyBoardShow(int height) {
Log.v("height", String.valueOf(height));
Log.v("top height", String.valueOf((DisplayUtils.getWindowHeight(CoreApplication.newInstance().getApplicationContext())-raw_Y)));
if((DisplayUtils.getWindowHeight(CoreApplication.newInstance().getApplicationContext())-raw_Y)<height){
scrollViewBottom= (int)(height- (DisplayUtils.getWindowHeight(CoreApplication.newInstance().getApplicationContext())-raw_Y))+400;
if(scrollViewBottom>height){
scrollViewBottom=height;
}
scrollViewAnimator= ValueAnimator.ofInt(0,scrollViewBottom);
scrollViewAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
// 3.为目标对象的属性设置计算好的属性值
int animatorValue = (int)animation.getAnimatedValue();
LinearLayout.MarginLayoutParams marginLayoutParams = (LinearLayout.MarginLayoutParams) scrollView.getLayoutParams();
marginLayoutParams.bottomMargin = animatorValue;
scrollView.setLayoutParams(marginLayoutParams);
scrollView.smoothScrollBy(0, (int) raw_Y);
}
});
scrollViewAnimator.setDuration(180);
scrollViewAnimator.setInterpolator(new DecelerateInterpolator());
scrollViewAnimator.setTarget(scrollView);
scrollViewAnimator.start();
}
}
@Override
public void keyBoardHide(int height) {
if(scrollViewBottom!=0){
scrollViewAnimator= ValueAnimator.ofInt(scrollViewBottom,0);
scrollViewAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
// 3.为目标对象的属性设置计算好的属性值
int animatorValue = (int)animation.getAnimatedValue();
LinearLayout.MarginLayoutParams marginLayoutParams = (LinearLayout.MarginLayoutParams) scrollView.getLayoutParams();
marginLayoutParams.bottomMargin = animatorValue;
scrollView.setLayoutParams(marginLayoutParams);
scrollView.smoothScrollBy(0, (int) raw_Y);
}
});
scrollViewAnimator.setDuration(180);
scrollViewAnimator.setInterpolator(new DecelerateInterpolator());
scrollViewAnimator.setTarget(scrollView);
scrollViewAnimator.start();
}
}
};
softKeyBoardListener= SoftKeyBoardListener.setListener(getActivity().getWindow(),onSoftKeyBoardChangeListener);
}
public void setTouchListener(){
username.setOnTouchListener(this);
selfAbstract.setOnTouchListener(this);
addr.setOnTouchListener(this);
email.setOnTouchListener(this);
university.setOnTouchListener(this);
college.setOnTouchListener(this);
}
public String getPersosnFrendId(){
String string="";
ArrayList<RelationShipLevelBean> beans=CoreApplication.newInstance().getPersonFrendList();
for (RelationShipLevelBean bean : beans){
string+=bean.getMinor_user()+",";
}
return string;
}
private void setInfo(){
username.setText(bean.getUsername());
addr.setText(bean.getSprovince()+"-"+bean.getStown()+"-"+bean.getSarea());
if(bean.getSex()==null){
s_sex=-1;
}else if(bean.getSex().equals(1)){
boy.setChecked(true);
s_sex=1;
}else if(bean.getSex().equals(-1)){
s_sex=0;
girl.setChecked(true);
}
selfAbstract.setText(bean.getSelf_abstract());
email.setText(bean.getEmail());
university.setText(bean.getUniversity());
college.setText(bean.getCollege());
}
private void dialogConfig(){
dialog=PhotoSelectorDialog.newInstance();
dialog.setItemOnclickListener(new PhotoSelectorDialog.ItemOnclickListener() {
@Override
public void onClick(String type) {
if(type.equals("camera")){
Log.v("click ","camera");
String state = Environment.getExternalStorageState();
File vFile = new File( CoreApplication.newInstance().getDir());
imgUrl=CoreApplication.newInstance().getDir()+"/"+new Date().getTime()+".jpg";
//如果状态不是mounted,无法读写
if (!state.equals(Environment.MEDIA_MOUNTED)) {
return;
}
if(!vFile.exists()) {
boolean tag=vFile.mkdirs();
}
//必须确保文件夹路径存在,否则拍照后无法完成回调
File imgFile=new File(imgUrl);
Uri uri = FileProvider.getUriForFile(getActivity(),"com.example.chen1.uncom.fileprovider",imgFile);
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(intent, TAKE_PHOTO);
}else{
Log.v("click ","photo");
EasyPhotos.createAlbum(getActivity(), true, GlideEngine.getInstance())//参数说明:最大可选数,默认1//参数说明:上下文,是否显示相机按钮,图片加载引擎实现(ImageEngine说明)
.setCount(1) .setFileProviderAuthority("com.example.chen1.uncom.fileprovider")
.start(101);
}
}
});
dialog.show(getFragmentManager(),"MeInfoEditDialog");
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Toast toast = Toast.makeText(CoreApplication.newInstance().getBaseContext(),
"onActivityResult", Toast.LENGTH_LONG);
toast.show();
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TAKE_PHOTO:
if (resultCode == RESULT_OK) {
Flowable.just(imgUrl)
.map(new Function<String,File >() {
@Override
public File apply(@NonNull String list) throws Exception {
// 同步方法直接返回压缩后的文件
return Luban.with(CoreApplication.newInstance().getBaseContext()).load(list).get(list);
}
})
.subscribe(new Consumer<File>() {
@Override
public void accept(final File file) throws Exception {
uploadImage(file.getAbsolutePath());
}
});
}else{
File file = new File(imgUrl);
if(file.exists() && file.isFile()){
file.delete();
}
}
break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void syncEventBus(MessageEvent messageEvent){
Flowable.just(messageEvent.getList().get(0))
.map(new Function<String,File >() {
@Override
public File apply(@NonNull String list) throws Exception {
// 同步方法直接返回压缩后的文件
return Luban.with(CoreApplication.newInstance().getBaseContext()).load(list).get(list);
}
})
.subscribe(new Consumer<File>() {
@Override
public void accept(final File file) throws Exception {
try {
uploadImage(file.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
}
}
});
Log.v("syncEventBus",messageEvent.getList().toString());
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment fragment = getFragmentManager().findFragmentByTag("MeInfoEditDialog");
if (null != fragment) {
Log.v("remove","dialog");
dialog.onDestroyView();
ft.remove(fragment);
}
}
@Override
public void onDestroy() {
super.onDestroy();
softKeyBoardListener.unLink(1);
EventBus.getDefault().unregister(this);
}
private void onBack() throws JSONException {
update();
((MeDetailPage)getTargetFragment()).updateInfo();
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
}
@Override
public boolean onBackPressed() {
try {
onBack();
} catch (JSONException e) {
e.printStackTrace();
}
getFragmentManager().popBackStack();
getTargetFragment().getView().setAnimation((AnimationUtils.loadAnimation(CoreApplication.newInstance().getBaseContext(),R.anim.default_open_right)));
return true;
}
public void update() throws JSONException {
s_username=username.getText().toString();
s_college=college.getText().toString();
s_email=email.getText().toString();
s_university=university.getText().toString();
s_self_abstract=selfAbstract.getText().toString();
if(change==true || s_username.equals(bean.getUsername())==false || s_college.equals(bean.getCollege())==false
|| s_email.equals(bean.getEmail())==false || s_university.equals(bean.getUniversity())==false
|| s_self_abstract.equals(bean.getSelf_abstract())==false ){
bean.setUsername(s_username);
bean.setCollege(s_college);
bean.setEmail(s_email);
bean.setUniversity(s_university);
bean.setSelf_abstract(s_self_abstract);
bean.setSex(s_sex);
change=false;
JSONObject jsonObject= new JSONObject(com.alibaba.fastjson.JSONObject.toJSONString(bean));
jsonObject.put("updateList", JSONArray.toJSONString(getPersosnFrendId()));
SessionStoreJsonRequest sessionStoreJsonRequest=new SessionStoreJsonRequest(
"http://" + CoreApplication.newInstance().IP_ADDR + ":8081/syncPersonInfo", jsonObject,
new Response.Listener<JSONObject>() {
@SuppressLint("WrongConstant")
@Override
public void onResponse(JSONObject response) {
Log.v("response",response.toString());
BeanDaoManager.getInstance().getDaoSession().getUserBeanDao().update(bean);
CoreApplication.newInstance().setUserBean(bean);
syncPersonInfoUtils=new SyncPersonInfoUtils();
syncPersonInfoUtils.syncPersonInfo(bean);
change=false;
}
}, new Response.ErrorListener() {
@SuppressLint("WrongConstant")
@Override
public void onErrorResponse(VolleyError error) {
Log.v("erroor",error.toString());
Toast toast = Toast.makeText(CoreApplication.newInstance().getBaseContext(),
"网络错误", Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP, 0, 100);
toast.setDuration(500);
toast.show();
}
});
CoreApplication.newInstance().getRequestQueue().add(sessionStoreJsonRequest);
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
raw_Y= event.getRawY();
Log.v("getRawY", String.valueOf(raw_Y));
return false;
}
public void uploadImage(final String imgUrl) throws IOException {
SessionStoreJsonRequest sessionStoreJsonRequest = new SessionStoreJsonRequest("http://47.95.0.73:7080",
null, new com.android.volley.Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
String stsJson;
stsJson = response.toString();
JSONObject jsonObjs = null;
try {
String img_url=imgUrl;
jsonObjs = new JSONObject(stsJson);
String ak = jsonObjs.getString("AccessKeyId");
String sk = jsonObjs.getString("AccessKeySecret");
String token = jsonObjs.getString("SecurityToken");
String expiration = jsonObjs.getString("Expiration");
Log.v("AccessKeyId",ak);
Log.v("AccessKeySecret",sk);
Log.v("token",token);
OSSFederationToken federationToken= new OSSFederationToken(ak, sk, token, expiration);
ossService=initOSS(endpoint,"uncomapp",uiDisplayer,federationToken);
ossService.setSyncPutImageCallBack(new OssService.SyncPutImageCallBack() {
@Override
public void callBack(final String url, String localFile) {
Log.v("callback","user_head/");
File file = new File(localFile);
if(file.exists() && file.isFile()){
file.delete();
}
try {
Log.v("load url",domain+"/"+url);
Log.v("before url",bean.getHeader_pic());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
GlideApp.with(MeInfoEdit.this)
.load(domain+"/"+url).transition(new DrawableTransitionOptions().crossFade())
.into(headImg);
}
});
ossService.deleteImage( "user_head/"+ bean.getHeader_pic().split("/")[bean.getHeader_pic().split("/").length-1]);
bean.setHeader_pic(domain+"/"+url);
change=true;
BeanDaoManager.getInstance().getDaoSession().getUserBeanDao().update(bean);
CoreApplication.newInstance().setUserBean(bean);
try {
update();
} catch (JSONException e) {
e.printStackTrace();
}
Log.v("bean url",bean.getHeader_pic());
((MeDetailPage)getTargetFragment()).updateUserBean(CoreApplication.newInstance().getUserBean());
} catch (ClientException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
}
}
});
String lis[]=img_url.split("\\.");
ossService.asyncPutImage("user_head/"+new Date().getTime()+"."+lis[lis.length-1], img_url);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.v("SecurityToken", String.valueOf(error));
PopupWindowUtils.popupWindow("网络错误", R.layout.access_popupwindow_statustag_layout, LinearLayout.LayoutParams.MATCH_PARENT, 150, 1500, CoreApplication.newInstance().getApplicationContext(), getView());
}
});
CoreApplication.newInstance().getRequestQueue().add(sessionStoreJsonRequest);
}
//初始化一个OssService用来上传下载
public OssService initOSS(String endpoint, String bucket, UIDisplayer displayer,OSSFederationToken federationToken) {
//如果希望直接使用accessKey来访问的时候,可以直接使用OSSPlainTextAKSKCredentialProvider来鉴权。
//OSSCredentialProvider credentialProvider = new OSSPlainTextAKSKCredentialProvider(accessKeyId, accessKeySecret);
OSSCredentialProvider credentialProvider= new OSSStsTokenCredentialProvider(federationToken);
//使用自己的获取STSToken的类
ClientConfiguration conf = new ClientConfiguration();
conf.setConnectionTimeout(15 * 1000); // 连接超时,默认15秒
conf.setSocketTimeout(15 * 1000); // socket超时,默认15秒
conf.setMaxConcurrentRequest(5); // 最大并发请求书,默认5个
conf.setMaxErrorRetry(2); // 失败后最大重试次数,默认2次
OSS oss = new OSSClient(CoreApplication.newInstance().getApplicationContext(), endpoint, credentialProvider, conf);
return new OssService(oss, bucket, displayer);
}
}
| [
"chen1494518303@outlook.com"
] | chen1494518303@outlook.com |
029986d0ecb0a8412e80ecb312dc38358b094f4f | 0f97f8953782b7d93a5c9be8e706110a693d1ae7 | /ontap/src/BtT3/Album.java | 998741d6855def10bc0ddc02196f725bedfc3302 | [] | no_license | NamNguyen27/JavaTLU | 3725cc188fe078afdcbb0d115866a7e370e9d866 | 328da483d1a00054b19f4869ba6a93776f3e1d33 | refs/heads/master | 2023-08-20T13:29:05.120538 | 2021-10-23T16:01:56 | 2021-10-23T16:01:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package BtT3;
import java.util.ArrayList;
public class Album {
private ArrayList<BaiHat> bh;
public Album() {
bh=new ArrayList<BaiHat>();
}
public ArrayList<BaiHat> getBh() {
return bh;
}
public void setBh(ArrayList<BaiHat> bh) {
this.bh = bh;
}
}
| [
"79202343+minhan1410@users.noreply.github.com"
] | 79202343+minhan1410@users.noreply.github.com |
3fb11460f8fcf2632ff6b19e372f3a8e23b1a6c6 | 2b9548891f8b768526277d1b46368c47cee7ab8d | /spring-boot-spring-data-rest/src/main/java/com/iana/sdata/domain/Person.java | bdc389dd602a93c3b9ffe4e6406118751a5c66f8 | [] | no_license | chauhanvipul87/spring-data-rest | 33fc8134248eb7b815a2a673d10faf1074faead3 | ea9df1317ae9a210f876ae5e2ef6d6c78da0b73a | refs/heads/master | 2021-07-21T02:19:54.903254 | 2017-10-30T11:03:24 | 2017-10-30T11:03:24 | 108,743,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 604 | java | package com.iana.sdata.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
} | [
"test.jpatel1@gmail.com"
] | test.jpatel1@gmail.com |
c73e231fcbad6258f601fa6cf1b1a1d0417a15b1 | 89031474cae205ebc59cea1c5176c2f4d3baa147 | /WebClient/build/generated-sources/jax-ws/webclient/ObjectFactory.java | 1329af069d68c958d4b59deaedf07165f215e449 | [] | no_license | ahamedmuaaz/WebApp | ec0d0cacfe3a92ec0bb8255e69bdce9564333c81 | 7f85f22daf4a13320e9cc83c746f6570e1185f1e | refs/heads/master | 2020-05-05T01:53:13.366949 | 2019-04-05T04:09:46 | 2019-04-05T04:09:46 | 179,617,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,401 | java |
package webclient;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the webclient package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _HelloResponse_QNAME = new QName("http://Server/", "helloResponse");
private final static QName _AddSampleResponse_QNAME = new QName("http://Server/", "addSampleResponse");
private final static QName _FindMinimumBetweenResponse_QNAME = new QName("http://Server/", "findMinimumBetweenResponse");
private final static QName _AddSample_QNAME = new QName("http://Server/", "addSample");
private final static QName _FindMinimumCoordinadeResponse_QNAME = new QName("http://Server/", "findMinimumCoordinadeResponse");
private final static QName _TestConnectionResponse_QNAME = new QName("http://Server/", "testConnectionResponse");
private final static QName _Hello_QNAME = new QName("http://Server/", "hello");
private final static QName _FindMinimumAmongSamplesResponse_QNAME = new QName("http://Server/", "findMinimumAmongSamplesResponse");
private final static QName _FindMinimumAmongSamples_QNAME = new QName("http://Server/", "findMinimumAmongSamples");
private final static QName _FindMinimumBetweenWithExceptionResponse_QNAME = new QName("http://Server/", "findMinimumBetweenWithExceptionResponse");
private final static QName _TestConnection_QNAME = new QName("http://Server/", "testConnection");
private final static QName _Exception_QNAME = new QName("http://Server/", "Exception");
private final static QName _FindMinimumBetween_QNAME = new QName("http://Server/", "findMinimumBetween");
private final static QName _FindMinimumBetweenWithException_QNAME = new QName("http://Server/", "findMinimumBetweenWithException");
private final static QName _FindMinimumCoordinade_QNAME = new QName("http://Server/", "findMinimumCoordinade");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: webclient
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link TestConnection }
*
*/
public TestConnection createTestConnection() {
return new TestConnection();
}
/**
* Create an instance of {@link FindMinimumBetweenWithExceptionResponse }
*
*/
public FindMinimumBetweenWithExceptionResponse createFindMinimumBetweenWithExceptionResponse() {
return new FindMinimumBetweenWithExceptionResponse();
}
/**
* Create an instance of {@link FindMinimumCoordinade }
*
*/
public FindMinimumCoordinade createFindMinimumCoordinade() {
return new FindMinimumCoordinade();
}
/**
* Create an instance of {@link FindMinimumBetweenWithException }
*
*/
public FindMinimumBetweenWithException createFindMinimumBetweenWithException() {
return new FindMinimumBetweenWithException();
}
/**
* Create an instance of {@link FindMinimumBetween }
*
*/
public FindMinimumBetween createFindMinimumBetween() {
return new FindMinimumBetween();
}
/**
* Create an instance of {@link Exception }
*
*/
public Exception createException() {
return new Exception();
}
/**
* Create an instance of {@link AddSample }
*
*/
public AddSample createAddSample() {
return new AddSample();
}
/**
* Create an instance of {@link FindMinimumCoordinadeResponse }
*
*/
public FindMinimumCoordinadeResponse createFindMinimumCoordinadeResponse() {
return new FindMinimumCoordinadeResponse();
}
/**
* Create an instance of {@link AddSampleResponse }
*
*/
public AddSampleResponse createAddSampleResponse() {
return new AddSampleResponse();
}
/**
* Create an instance of {@link FindMinimumBetweenResponse }
*
*/
public FindMinimumBetweenResponse createFindMinimumBetweenResponse() {
return new FindMinimumBetweenResponse();
}
/**
* Create an instance of {@link HelloResponse }
*
*/
public HelloResponse createHelloResponse() {
return new HelloResponse();
}
/**
* Create an instance of {@link FindMinimumAmongSamples }
*
*/
public FindMinimumAmongSamples createFindMinimumAmongSamples() {
return new FindMinimumAmongSamples();
}
/**
* Create an instance of {@link FindMinimumAmongSamplesResponse }
*
*/
public FindMinimumAmongSamplesResponse createFindMinimumAmongSamplesResponse() {
return new FindMinimumAmongSamplesResponse();
}
/**
* Create an instance of {@link Hello }
*
*/
public Hello createHello() {
return new Hello();
}
/**
* Create an instance of {@link TestConnectionResponse }
*
*/
public TestConnectionResponse createTestConnectionResponse() {
return new TestConnectionResponse();
}
/**
* Create an instance of {@link Point2D }
*
*/
public Point2D createPoint2D() {
return new Point2D();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link HelloResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "helloResponse")
public JAXBElement<HelloResponse> createHelloResponse(HelloResponse value) {
return new JAXBElement<HelloResponse>(_HelloResponse_QNAME, HelloResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link AddSampleResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "addSampleResponse")
public JAXBElement<AddSampleResponse> createAddSampleResponse(AddSampleResponse value) {
return new JAXBElement<AddSampleResponse>(_AddSampleResponse_QNAME, AddSampleResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumBetweenResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumBetweenResponse")
public JAXBElement<FindMinimumBetweenResponse> createFindMinimumBetweenResponse(FindMinimumBetweenResponse value) {
return new JAXBElement<FindMinimumBetweenResponse>(_FindMinimumBetweenResponse_QNAME, FindMinimumBetweenResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link AddSample }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "addSample")
public JAXBElement<AddSample> createAddSample(AddSample value) {
return new JAXBElement<AddSample>(_AddSample_QNAME, AddSample.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumCoordinadeResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumCoordinadeResponse")
public JAXBElement<FindMinimumCoordinadeResponse> createFindMinimumCoordinadeResponse(FindMinimumCoordinadeResponse value) {
return new JAXBElement<FindMinimumCoordinadeResponse>(_FindMinimumCoordinadeResponse_QNAME, FindMinimumCoordinadeResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link TestConnectionResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "testConnectionResponse")
public JAXBElement<TestConnectionResponse> createTestConnectionResponse(TestConnectionResponse value) {
return new JAXBElement<TestConnectionResponse>(_TestConnectionResponse_QNAME, TestConnectionResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Hello }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "hello")
public JAXBElement<Hello> createHello(Hello value) {
return new JAXBElement<Hello>(_Hello_QNAME, Hello.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumAmongSamplesResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumAmongSamplesResponse")
public JAXBElement<FindMinimumAmongSamplesResponse> createFindMinimumAmongSamplesResponse(FindMinimumAmongSamplesResponse value) {
return new JAXBElement<FindMinimumAmongSamplesResponse>(_FindMinimumAmongSamplesResponse_QNAME, FindMinimumAmongSamplesResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumAmongSamples }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumAmongSamples")
public JAXBElement<FindMinimumAmongSamples> createFindMinimumAmongSamples(FindMinimumAmongSamples value) {
return new JAXBElement<FindMinimumAmongSamples>(_FindMinimumAmongSamples_QNAME, FindMinimumAmongSamples.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumBetweenWithExceptionResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumBetweenWithExceptionResponse")
public JAXBElement<FindMinimumBetweenWithExceptionResponse> createFindMinimumBetweenWithExceptionResponse(FindMinimumBetweenWithExceptionResponse value) {
return new JAXBElement<FindMinimumBetweenWithExceptionResponse>(_FindMinimumBetweenWithExceptionResponse_QNAME, FindMinimumBetweenWithExceptionResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link TestConnection }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "testConnection")
public JAXBElement<TestConnection> createTestConnection(TestConnection value) {
return new JAXBElement<TestConnection>(_TestConnection_QNAME, TestConnection.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Exception }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "Exception")
public JAXBElement<Exception> createException(Exception value) {
return new JAXBElement<Exception>(_Exception_QNAME, Exception.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumBetween }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumBetween")
public JAXBElement<FindMinimumBetween> createFindMinimumBetween(FindMinimumBetween value) {
return new JAXBElement<FindMinimumBetween>(_FindMinimumBetween_QNAME, FindMinimumBetween.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumBetweenWithException }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumBetweenWithException")
public JAXBElement<FindMinimumBetweenWithException> createFindMinimumBetweenWithException(FindMinimumBetweenWithException value) {
return new JAXBElement<FindMinimumBetweenWithException>(_FindMinimumBetweenWithException_QNAME, FindMinimumBetweenWithException.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindMinimumCoordinade }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://Server/", name = "findMinimumCoordinade")
public JAXBElement<FindMinimumCoordinade> createFindMinimumCoordinade(FindMinimumCoordinade value) {
return new JAXBElement<FindMinimumCoordinade>(_FindMinimumCoordinade_QNAME, FindMinimumCoordinade.class, null, value);
}
}
| [
"mma.muaaz@gmail.com"
] | mma.muaaz@gmail.com |
54de92d12d97f447aa8e92cf39c701f9e58f7a9c | 719206f4df3e5b627ef16f27bf659c36397f5d6f | /hybris/bin/custom/petshop/petshopfulfilmentprocess/testsrc/de/hybris/petshop/fulfilmentprocess/test/actions/consignmentfulfilment/SendDeliveryMessage.java | e063619f45801fe57e72759b112c9b25f0597493 | [] | no_license | rpalacgi/hybris_petshop_v2 | 60cac5081148a65db03eead3118e06d85cd3e952 | 449220feebb66a495ca3c23c7707d53b74c1e3e6 | refs/heads/master | 2021-06-13T01:36:13.345225 | 2017-04-06T14:01:34 | 2017-04-06T14:01:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.petshop.fulfilmentprocess.test.actions.consignmentfulfilment;
/**
*
*/
public class SendDeliveryMessage extends AbstractTestConsActionTemp
{
//empty
}
| [
"redchush@gmail.com"
] | redchush@gmail.com |
74a05226e77252030e8a27673a071ac65ca81a1c | 56f64cbbb2c2d7f1c03177b1f6e2f0e35f6b3e97 | /src/test/java/com/jyothi/service/DrawingAppTest.java | ea1754d89579267197dcd934fa34bbcd8c7abfc2 | [] | no_license | JyothiKaturi/canvas-proj | 1d13d9fc1f12412963d4a3d3a3b9c42cbb489b03 | 17f92f1558279e173558cce9d7850d46638cca99 | refs/heads/master | 2020-04-29T16:38:24.875201 | 2019-03-18T11:55:31 | 2019-03-18T11:55:31 | 176,268,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,062 | java | package com.jyothi.service;
import org.junit.Assert;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;;
public class DrawingAppTest {
private CommandHandler handler = new CommandHandler();
private String result;
@Given("^Enter command to draw convas \"([^\"]*)\"$")
public void enter_command_to_draw_convas(String command) throws Throwable {
result = handler.execute(command);
System.out.println(result);
}
@Then("^Expect the canvas drawing$")
public void expect_the_canvas_drawing(String arg1) throws Throwable {
System.out.println(arg1);
System.out.println("*** length = "+arg1.length());
System.out.println("*** length result= "+result.length());
//System.out.println(arg1.trim().length()==result.trim().length());
System.out.println(result.length());
//Assert.assertEquals(result,arg1);
Assert.assertTrue(result.equalsIgnoreCase(arg1.replaceAll("\r","")));
}
@Then("^Exit the command \"([^\"]*)\"$")
public void exit_the_command(String exit) throws Throwable {
handler.execute(exit);
}
}
| [
"rakeshnbr@ebi.ac.uk"
] | rakeshnbr@ebi.ac.uk |
b130add63efc769e2b5edc0ae12982f3fb7ac2df | 8fa41dddc52207b22df622c3ad2a4aa8bd92ee30 | /app/src/main/java/com/c/dompetabata/menuUtama/PaketData/PulsaPrabayar/Mchek.java | 8f3fa7023d57db3d51cb343d7c0f1ec4b71941ed | [] | no_license | benihero/DompetAbata3 | d8c192ca22508808e0b2a81398f696eb131a045c | 95c13b597641daddd9f88d72e1cd18bb5ee985e6 | refs/heads/master | 2023-07-27T14:43:21.242976 | 2021-09-08T02:29:47 | 2021-09-08T02:29:47 | 381,551,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.c.dompetabata.menuUtama.PaketData.PulsaPrabayar;
public class Mchek {
String code,error,message;
McheckData data;
public String getCode() {
return code;
}
public String getError() {
return error;
}
public String getMessage() {
return message;
}
public McheckData getData() {
return data;
}
}
| [
"herobenih@gmail.com"
] | herobenih@gmail.com |
521411175d8069da5c4588f3c7fda542368284d8 | 36e593943be060ca5ea74a3d45923aba422ad2c9 | /ProficientIn4xSpring/chapter13/src/main/java/com/smart/domain/Post.java | 3f3e509de15a65504d8870c7d52fb51e319ce0d7 | [] | no_license | xjr7670/book_practice | a73f79437262bb5e3b299933b7b1f7f662a157b5 | 5a562d76830faf78feec81bc11190b71eae3a799 | refs/heads/master | 2023-08-28T19:08:52.329127 | 2023-08-24T09:06:00 | 2023-08-24T09:06:00 | 101,477,574 | 3 | 1 | null | 2021-06-10T18:38:54 | 2017-08-26T09:56:02 | Python | UTF-8 | Java | false | false | 1,323 | java | package com.smart.domain;
import java.io.Serializable;
import java.util.Date;
public class Post implements Serializable {
private int postId;
private int topicId;
private int forumId;
private int userId;
private String postText;
private byte[] postAttach;
private Date postTime;
public int getForumId() {
return forumId;
}
public void setForumId(int forumId) {
this.forumId = forumId;
}
public int getPostId() {
return postId;
}
public void setPostId(int postId) {
this.postId = postId;
}
public String getPostText() {
return postText;
}
public void setPostText(String postText) {
this.postText = postText;
}
public Date getPostTime() {
return postTime;
}
public void setPostTime(Date postTime) {
this.postTime = postTime;
}
public int getTopicId() {
return topicId;
}
public void setTopicId(int topicId) {
this.topicId = topicId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public byte[] getPostAttach() {
return postAttach;
}
public void setPostAttach(byte[] postAttach) {
this.postAttach = postAttach;
}
}
| [
"xjr30226@126.com"
] | xjr30226@126.com |
dbf484563a6c3b06ab4456a9a752454d21eec7f2 | 79a7fa255875a9f961ef1bb7581f198aa5d2336b | /src/main/java/kr/co/crewmate/api/model/DispAreaDtl.java | 4d3d5cecd7ba4c8f1a7d2cee92c6522bf3505036 | [] | no_license | Enitsed/Java-Spring-Web-Server | 246e4cd9f974abca3621194aa43ba4c3f81c5bdb | 5f6e2fa14f721feb89291023f264dab3bf523d52 | refs/heads/master | 2020-03-19T12:50:26.135575 | 2018-06-28T08:40:09 | 2018-06-28T08:40:09 | 136,543,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,268 | java | package kr.co.crewmate.api.model;
import java.io.Serializable;
import kr.co.crewmate.core.model.BaseModel;
/**
* 전시영역 상세 관련 모델
* @author 정슬기
*
*/
public class DispAreaDtl extends BaseModel implements Serializable{
private static final long serialVersionUID = -1538868683430126575L;
/** 전시영역코드 */
private String dispCd;
/** 전시영역 상세 고유번호 */
private int dispAreaDtlSeq;
/** 전시영역 상세 이름 */
private String dispAreaDtlNm;
/** 전시순서 */
private int dispNo;
/** 사용여부 */
private String useYn;
public String getDispCd() {
return dispCd;
}
public void setDispCd(String dispCd) {
this.dispCd = dispCd;
}
public int getDispAreaDtlSeq() {
return dispAreaDtlSeq;
}
public void setDispAreaDtlSeq(int dispAreaDtlSeq) {
this.dispAreaDtlSeq = dispAreaDtlSeq;
}
public String getDispAreaDtlNm() {
return dispAreaDtlNm;
}
public void setDispAreaDtlNm(String dispAreaDtlNm) {
this.dispAreaDtlNm = dispAreaDtlNm;
}
public int getDispNo() {
return dispNo;
}
public void setDispNo(int dispNo) {
this.dispNo = dispNo;
}
public String getUseYn() {
return useYn;
}
public void setUseYn(String useYn) {
this.useYn = useYn;
}
} | [
"sllki1@naver.com"
] | sllki1@naver.com |
4f7b2a23de57d963bba77d6a2e70445f597370cf | 706db6f59e12f0b2938480611bb1476592f4b656 | /app/src/main/java/com/example/dualpaint/MainActivity.java | c1fc7a85857172a66e80562fc74751a765fce948 | [] | no_license | GowthamGoush/Dual_Paint_App | bf19492c38fd3db920f4ff78fa202ef8a77311b2 | 2d336865fbfab940cdb6f8a58da6322f46a3d772 | refs/heads/master | 2022-12-02T01:04:46.556397 | 2020-08-21T05:39:34 | 2020-08-21T05:39:34 | 289,186,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.example.dualpaint;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction()
.add(R.id.container_a, new FragmentA())
.add(R.id.container_b, new FragmentB())
.commit();
}
} | [
"westcity.21.gowtham@gmail.com"
] | westcity.21.gowtham@gmail.com |
fc7ca6d2f90157e18c30fd5e3a8b19d714fa753f | ea1fa7880624b64ea0b644b741d96e5735f0bdbd | /de.darmstadt.tu.crossing.CryptSL.ide/src-gen/de/darmstadt/tu/crossing/ide/AbstractCryptSLIdeModule.java | 236f65f2bdb84c88f972799221451b200742c91f | [] | no_license | sammekh/CryptSL | b4eefc64d752f3b943a0d296f62d1efda5727eb1 | bac97e19119e425109ae668d2bc79091ea898110 | refs/heads/master | 2020-07-05T20:52:56.479830 | 2019-07-31T08:17:28 | 2019-07-31T08:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,561 | java | /*
* generated by Xtext 2.18.0
*/
package de.darmstadt.tu.crossing.ide;
import com.google.inject.Binder;
import com.google.inject.name.Names;
import de.darmstadt.tu.crossing.ide.contentassist.antlr.CryptSLParser;
import de.darmstadt.tu.crossing.ide.contentassist.antlr.internal.InternalCryptSLLexer;
import org.eclipse.xtext.ide.DefaultIdeModule;
import org.eclipse.xtext.ide.LexerIdeBindings;
import org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher;
import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher;
import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
import org.eclipse.xtext.ide.refactoring.IRenameStrategy2;
import org.eclipse.xtext.ide.server.rename.IRenameService2;
import org.eclipse.xtext.ide.server.rename.RenameService2;
/**
* Manual modifications go to {@link CryptSLIdeModule}.
*/
@SuppressWarnings("all")
public abstract class AbstractCryptSLIdeModule extends DefaultIdeModule {
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public void configureContentAssistLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
.to(InternalCryptSLLexer.class);
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IContentAssistParser> bindIContentAssistParser() {
return CryptSLParser.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IProposalConflictHelper> bindIProposalConflictHelper() {
return AntlrProposalConflictHelper.class;
}
// contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
public Class<? extends IPrefixMatcher> bindIPrefixMatcher() {
return FQNPrefixMatcher.class;
}
// contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2
public Class<? extends IRenameService2> bindIRenameService2() {
return RenameService2.class;
}
// contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2
public Class<? extends IRenameStrategy2> bindIRenameStrategy2() {
return IRenameStrategy2.DefaultImpl.class;
}
}
| [
"stefan.krueger@crossing.tu-darmstadt.de"
] | stefan.krueger@crossing.tu-darmstadt.de |
b0ff64d86ab28c936895998caeaaef87aed6b54e | c49169ccbecdd31b19b723d11006fe950cc3e6fd | /app/src/main/java/com/example/foodordering/weather/widget/HourForeCastView.java | 824c55a6d8e9e3f5d7a4b19f58423c30899270c5 | [
"Apache-2.0"
] | permissive | algondon/FoodOrdering | 8c3f9a7df17af00832550f05c22db1c6c0c8dae5 | 7e1dffbe0917c6b1fbd4430a81087d9b32d7401d | refs/heads/master | 2020-03-24T18:08:17.243027 | 2018-07-25T07:26:45 | 2018-07-25T07:26:45 | 142,883,438 | 5 | 0 | Apache-2.0 | 2018-07-30T14:01:19 | 2018-07-30T14:01:19 | null | UTF-8 | Java | false | false | 5,246 | java | package com.example.foodordering.weather.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
import com.example.foodordering.weather.dao.greendao.HourForeCast;
import com.example.foodordering.weather.util.ScreenUtil;
/**
* Created by xch on 2018/3/10.
*/
public class HourForeCastView extends View {
public HourForeCastView(Context context) {
super(context);
this.context = context;
}
public HourForeCastView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
public HourForeCastView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
width = ScreenUtil.getScreenWidth(context);
height = width / 2 - getFitSize(20);
widthAvg = getFitSize(200);
radius = getFitSize(8);
setMeasuredDimension((int) leftRight + (int) widthAvg * 25, (int) height);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (hourForeCasts.size() == 0)
return;
paint.setColor(Color.WHITE);
paint.setAntiAlias(true);
paint.setStrokeWidth(0);
paint.setTextSize(ScreenUtil.getSp(context, 13));
paint.setTextAlign(Paint.Align.CENTER);
float weatherDetallPadding = getFitSize(50);
float weatherTimePadding = getFitSize(100);
float linePaddingBottom = getFitSize(200);
float lineHigh = getFitSize(180);
float lineAvg = lineHigh / getMaxMinDelta();
float paddingLeft = 0;
//解决path过大无法绘制,分成三段
Path tempPath = new Path();
Path tempPath2 = new Path();
Path tempPath3 = new Path();
int i = 1;
for (HourForeCast foreCast : hourForeCasts) {
paddingLeft = leftRight / 2 + (i - 1 + 0.5f) * widthAvg;
if (i == 1) {
tempPath.moveTo(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg));
} else if (i > 1 && i <= 10) {
tempPath.lineTo(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg));
tempPath2.moveTo(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg));
} else if (i > 10 && i <= 20) {
tempPath2.lineTo(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg));
tempPath3.moveTo(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg));
} else {
tempPath3.lineTo(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg));
}
paint.setStyle(Paint.Style.FILL);
paint.setStrokeWidth(getFitSize(2));
canvas.drawCircle(paddingLeft, height - (linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg), radius, paint);
paint.setStrokeWidth(0);
paint.setStyle(Paint.Style.STROKE);
canvas.drawText(foreCast.getTemp() + "°", paddingLeft, height - (getFitSize(20) + linePaddingBottom + (foreCast.getTemp() - tempL) * lineAvg), paint);
//文字
canvas.drawText(foreCast.getWeatherCondition(), paddingLeft, height - weatherDetallPadding, paint);
canvas.drawText(foreCast.getHour(), paddingLeft, height - weatherTimePadding, paint);
i++;
}
paint.setStrokeWidth(getFitSize(3));
paint.setStyle(Paint.Style.STROKE);
canvas.drawPath(tempPath, paint);
canvas.drawPath(tempPath2, paint);
canvas.drawPath(tempPath3, paint);
}
private int getMaxMinDelta() {
if (hourForeCasts.size() > 0) {
tempL = hourForeCasts.get(0).getTemp();
tempH = hourForeCasts.get(0).getTemp();
for (HourForeCast hourForeCast : hourForeCasts) {
if (hourForeCast.getTemp() > tempH) {
tempH = hourForeCast.getTemp();
}
if (hourForeCast.getTemp() < tempL) {
tempL = hourForeCast.getTemp();
}
}
return tempH - tempL;
}
return 0;
}
public void setHourForeCasts(List<HourForeCast> hourForeCasts) {
this.hourForeCasts.clear();
this.hourForeCasts.addAll(hourForeCasts);
this.invalidate();
}
private float getFitSize(float orgSize) {
return orgSize * width * 1.0f / 1080;
}
private final static String TAG = "HourForeCastView";
Paint paint = new Paint();
float widthAvg;
private float height, width;
private List<HourForeCast> hourForeCasts = new ArrayList<>();
private int tempH, tempL;
private Context context;
private float radius = 0;
private float leftRight = 0;
}
| [
"xch_yang@126.com"
] | xch_yang@126.com |
20f806b8f0000d88fa6ff9087a0f26c9e3a40886 | a3a82cba07c04896709776a1dac55d55fa9c4281 | /src/main/java/com/demo/controller/FaceController.java | 866d7ff6e1458321968ddb530272448c84d06e95 | [] | no_license | wanys/testfacematch | bfe59255cc1431902101cf3b2cf4d5968a0573f6 | 45f1999935e838f0df6b277ec25ceb0c5f18d6c1 | refs/heads/master | 2023-05-03T14:25:34.185145 | 2019-08-14T03:03:31 | 2019-08-14T03:03:31 | 201,238,629 | 0 | 0 | null | 2023-04-14T17:17:05 | 2019-08-08T10:51:04 | Java | UTF-8 | Java | false | false | 1,643 | java | package com.demo.controller;
import com.demo.facelogin.FaceSearch;
import com.demo.utils.Base64Util;
import com.demo.utils.FileUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.math.BigDecimal;
@Controller
public class FaceController {
@GetMapping("/test")
public String test(){
return "success";
}
@GetMapping("/test1")
public String test(@RequestParam("message") Integer message){
if (message==1){
return "success";
} else return "fail";
}
@GetMapping("/face1")
public String facemathchG(){
return "index";
}
@PostMapping("/face")
@ResponseBody
// public String facematch( String message) throws IOException {
public String facematch(HttpServletRequest request) throws IOException {
String despath = request.getParameter("message"); //从前端接受到的base64的数据
// System.out.println("----despath"+despath);
FaceSearch serch=new FaceSearch();
// String result = serch.search(message);
String result = serch.search(despath);
// Integer result1 = Integer.parseInt(serch.search(despath));
// response.setContentType("text/html;charset=utf-8");
// response.getWriter().print(result);
System.out.println("------------Controller "+result+"-----------");
return result;
}
}
| [
"1370842373@qq.com"
] | 1370842373@qq.com |
87559782c4a3d851860d7df639cd5a73014a4d5c | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a000/A000253Test.java | 73032090057ebe22f39a25384f1fb6e0fe1748d2 | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a000;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A000253Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
532231be5157c57b7adc0c9d4bebaa4bf6e750dc | 1bb16fb4b8f4283c308b8fae254dc774816ce26a | /src/main/java/com/chrisgya/webfluxr2dbc/repository/AddressRepository.java | 5d1606281dbc7e9f1959202565bbb46b8a29f5dc | [] | no_license | lindongy/webflux-r2dbc | a18a59dbabf7abff4b009e97e8893573d7714a85 | 57ee5eaccb0ff78ca12db64a4c1eec6459e3b909 | refs/heads/main | 2023-09-01T15:12:51.744086 | 2021-10-21T20:59:43 | 2021-10-21T20:59:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.chrisgya.webfluxr2dbc.repository;
import com.chrisgya.webfluxr2dbc.entity.AddressEntity;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import java.util.UUID;
public interface AddressRepository extends ReactiveCrudRepository<AddressEntity, UUID> {
}
| [
"christiangyaban@hotmail.com"
] | christiangyaban@hotmail.com |
60c8b1c9a38f28b4fe0eb605c2ecedf045a4c69a | ab6971a1e092d4b295276a713eeafed882d2f058 | /src/pong/Utils.java | 770e240b02f4ce33d2be766fb4e3daf98fe4df10 | [] | no_license | worsewicked/Pong | 412b763be0a811683bb57a747ab46e0c781ba3eb | d27e59fe8dc19e48e074943d13b76f09ec6abbd5 | refs/heads/master | 2021-01-18T11:15:19.752079 | 2011-06-29T22:41:36 | 2011-06-29T22:41:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package pong;
public class Utils {
/**
* Crappy little ugly wait for a cerain amount of time function.
* Uses 100% CPU while it waits.
*
* @param millisecs Time in milliseconds to wait.
*/
public static void wait(int millisecs) {
long nextTime = System.currentTimeMillis() + millisecs;
// Basically do nothing until the time is reached.
while (System.currentTimeMillis() <= nextTime);
}
}
| [
"knifacat@gmail.com"
] | knifacat@gmail.com |
0eaa223fa70801686a9b2da7db1554acb20d87c7 | 5f2f33f35a8e3fb8286e1c66c218523d725d930a | /app/src/main/java/com/example/myapplication/remote/RApiClientWithInterceptor.java | 162d7fdbcd71d1da3d270a10afcc3ee2a288a1a3 | [] | no_license | kpatil392/kpmv2m | 18c5dd51e2f10860f410b652aef88a3c6eb1e16c | cc359b0ebf365c2fa0256afbfc60f64ff338d6be | refs/heads/master | 2022-06-13T09:42:56.408158 | 2020-04-23T09:35:50 | 2020-04-23T09:35:50 | 257,005,762 | 0 | 0 | null | 2020-05-08T09:28:55 | 2020-04-19T13:26:12 | Java | UTF-8 | Java | false | false | 1,105 | java | /*
package com.example.myapplication.remote;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RApiClientWithInterceptor {
private static Retrofit retrofit = null;
public static Retrofit getClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(30000, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.addInterceptor(interceptor)
.build();
retrofit = new Retrofit.Builder()
.baseUrl("https://www.webdesky.com/wordpress/kouponhub/wp-json/custom-plugin/")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
return retrofit;
}
}
*/
| [
"kkbrothers0392@gmail.com"
] | kkbrothers0392@gmail.com |
d0e4482ca143693752223b8784a187ddae402eff | fda80b6897bad97730111483ec885904d4203f02 | /HyattCode/src/ServerSide/ServerGUI.java | dd7a4ebcb9e49f61f65277a64e88f02f927e7648 | [] | no_license | LuisNorman/hotel_management_db_sytem | 55ff0a1e30ebbcea926fd767b652a47aa0ef3ecb | 910559e29d8c7360f55e7cc29150ca745934133c | refs/heads/master | 2021-09-03T20:47:10.052670 | 2018-01-11T22:49:49 | 2018-01-11T22:49:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79,217 | java | package ServerSide;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Luis
*/
public class ServerGUI extends javax.swing.JFrame {
DBConnect staff = new DBConnect();
/**
* Creates new form ServerGUI
*/
public ServerGUI() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
viewReservationsFrame = new javax.swing.JFrame();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
viewReservationsList = new javax.swing.JList<>();
checkInBtn = new javax.swing.JButton();
checkOutBtn = new javax.swing.JButton();
changeCheckInBtn = new javax.swing.JButton();
cancelReservationsBtn = new javax.swing.JButton();
changeCheckOutBtn = new javax.swing.JButton();
cancelReservationsFrame = new javax.swing.JFrame();
jPanel3 = new javax.swing.JPanel();
logo7 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
changeCheckOutFrame = new javax.swing.JFrame();
jPanel5 = new javax.swing.JPanel();
logo9 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
newCheckOutField = new javax.swing.JTextField();
confirmChangeCheckOutBtn = new javax.swing.JButton();
changeCheckInFrame = new javax.swing.JFrame();
jPanel4 = new javax.swing.JPanel();
logo8 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
newCheckInField = new javax.swing.JTextField();
confirmChangeCheckInBtn = new javax.swing.JButton();
checkInFrame = new javax.swing.JFrame();
jPanel6 = new javax.swing.JPanel();
logo10 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
checkOutFrame = new javax.swing.JFrame();
jPanel7 = new javax.swing.JPanel();
logo11 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
successfulChangeFrame = new javax.swing.JFrame();
jPanel8 = new javax.swing.JPanel();
logo12 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
showCusChangeCheckInFrame = new javax.swing.JFrame();
jPanel11 = new javax.swing.JPanel();
logo15 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
customerInfoList = new javax.swing.JList<>();
jLabel7 = new javax.swing.JLabel();
yesChangeCheckInBtn = new javax.swing.JButton();
noChangeCheckInBtn = new javax.swing.JButton();
showCusChangeCheckOutFrame = new javax.swing.JFrame();
jPanel12 = new javax.swing.JPanel();
logo16 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
customerInfoList1 = new javax.swing.JList<>();
jLabel8 = new javax.swing.JLabel();
yesChangeCheckOutBtn = new javax.swing.JButton();
noChangeCheckOutBtn = new javax.swing.JButton();
showCusCancelResFrame = new javax.swing.JFrame();
jPanel13 = new javax.swing.JPanel();
logo17 = new javax.swing.JLabel();
jScrollPane4 = new javax.swing.JScrollPane();
customerInfoList2 = new javax.swing.JList<>();
jLabel9 = new javax.swing.JLabel();
yesCancelResBtn = new javax.swing.JButton();
noCancelResBtn = new javax.swing.JButton();
showCusCheckInFrame = new javax.swing.JFrame();
jPanel14 = new javax.swing.JPanel();
logo18 = new javax.swing.JLabel();
jScrollPane5 = new javax.swing.JScrollPane();
customerInfoList3 = new javax.swing.JList<>();
jLabel10 = new javax.swing.JLabel();
yesCheckInBtn = new javax.swing.JButton();
noCheckInBtn = new javax.swing.JButton();
showCusCheckOutFrame = new javax.swing.JFrame();
jPanel15 = new javax.swing.JPanel();
logo19 = new javax.swing.JLabel();
jScrollPane6 = new javax.swing.JScrollPane();
customerInfoList4 = new javax.swing.JList<>();
jLabel11 = new javax.swing.JLabel();
yesCheckOutBtn = new javax.swing.JButton();
noCheckOutBtn = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
logo6 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
viewReservationsBtn = new javax.swing.JButton();
viewReservationsFrame.setSize(new java.awt.Dimension(480, 400));
jPanel2.setBackground(new java.awt.Color(51, 51, 51));
jLabel1.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("HYATT Staff");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(22, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(19, 19, 19))
);
viewReservationsList.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane1.setViewportView(viewReservationsList);
checkInBtn.setText("Check In");
checkInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkInBtnActionPerformed(evt);
}
});
checkOutBtn.setText("Check Out");
checkOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkOutBtnActionPerformed(evt);
}
});
changeCheckInBtn.setText("Change Check In");
changeCheckInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
changeCheckInBtnActionPerformed(evt);
}
});
cancelReservationsBtn.setText("Cancel Reservations");
cancelReservationsBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelReservationsBtnActionPerformed(evt);
}
});
changeCheckOutBtn.setText("Change Check Out");
changeCheckOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
changeCheckOutBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout viewReservationsFrameLayout = new javax.swing.GroupLayout(viewReservationsFrame.getContentPane());
viewReservationsFrame.getContentPane().setLayout(viewReservationsFrameLayout);
viewReservationsFrameLayout.setHorizontalGroup(
viewReservationsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(viewReservationsFrameLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(viewReservationsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkInBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkOutBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(changeCheckInBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cancelReservationsBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
.addComponent(changeCheckOutBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
viewReservationsFrameLayout.setVerticalGroup(
viewReservationsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(viewReservationsFrameLayout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(viewReservationsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(viewReservationsFrameLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jScrollPane1))
.addGroup(viewReservationsFrameLayout.createSequentialGroup()
.addGap(61, 61, 61)
.addComponent(checkInBtn)
.addGap(18, 18, 18)
.addComponent(checkOutBtn)
.addGap(18, 18, 18)
.addComponent(changeCheckInBtn)
.addGap(18, 18, 18)
.addComponent(changeCheckOutBtn)
.addGap(18, 18, 18)
.addComponent(cancelReservationsBtn)
.addContainerGap(52, Short.MAX_VALUE))))
);
cancelReservationsFrame.setSize(new java.awt.Dimension(400, 400));
jPanel3.setBackground(new java.awt.Color(51, 51, 51));
logo7.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo7.setForeground(new java.awt.Color(255, 255, 255));
logo7.setText("HYATT Staff");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo7, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo7)
.addContainerGap())
);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel3.setText("Your reservations have been canceled :((");
javax.swing.GroupLayout cancelReservationsFrameLayout = new javax.swing.GroupLayout(cancelReservationsFrame.getContentPane());
cancelReservationsFrame.getContentPane().setLayout(cancelReservationsFrameLayout);
cancelReservationsFrameLayout.setHorizontalGroup(
cancelReservationsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
cancelReservationsFrameLayout.setVerticalGroup(
cancelReservationsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(cancelReservationsFrameLayout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(59, 59, 59)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 107, Short.MAX_VALUE))
);
changeCheckOutFrame.setSize(new java.awt.Dimension(400, 400));
jPanel5.setBackground(new java.awt.Color(51, 51, 51));
logo9.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo9.setForeground(new java.awt.Color(255, 255, 255));
logo9.setText("HYATT Staff");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo9, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo9)
.addContainerGap())
);
jLabel4.setText("Choose new check out date:");
newCheckOutField.setText("Change Check Out");
newCheckOutField.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
newCheckOutFieldMousePressed(evt);
}
});
newCheckOutField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
newCheckOutFieldActionPerformed(evt);
}
});
confirmChangeCheckOutBtn.setText("Confirm");
confirmChangeCheckOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
confirmChangeCheckOutBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout changeCheckOutFrameLayout = new javax.swing.GroupLayout(changeCheckOutFrame.getContentPane());
changeCheckOutFrame.getContentPane().setLayout(changeCheckOutFrameLayout);
changeCheckOutFrameLayout.setHorizontalGroup(
changeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(changeCheckOutFrameLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(changeCheckOutFrameLayout.createSequentialGroup()
.addGap(123, 123, 123)
.addGroup(changeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(newCheckOutField, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(confirmChangeCheckOutBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
changeCheckOutFrameLayout.setVerticalGroup(
changeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(changeCheckOutFrameLayout.createSequentialGroup()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(newCheckOutField, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
.addComponent(confirmChangeCheckOutBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
changeCheckInFrame.setSize(new java.awt.Dimension(400, 400));
jPanel4.setBackground(new java.awt.Color(51, 51, 51));
logo8.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo8.setForeground(new java.awt.Color(255, 255, 255));
logo8.setText("HYATT Staff");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo8, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo8)
.addContainerGap())
);
jLabel6.setText("Choose new check out date:");
newCheckInField.setText("Change Check In");
newCheckInField.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
newCheckInFieldMousePressed(evt);
}
});
newCheckInField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
newCheckInFieldActionPerformed(evt);
}
});
confirmChangeCheckInBtn.setText("Confirm");
confirmChangeCheckInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
confirmChangeCheckInBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout changeCheckInFrameLayout = new javax.swing.GroupLayout(changeCheckInFrame.getContentPane());
changeCheckInFrame.getContentPane().setLayout(changeCheckInFrameLayout);
changeCheckInFrameLayout.setHorizontalGroup(
changeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(changeCheckInFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(changeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE)
.addGroup(changeCheckInFrameLayout.createSequentialGroup()
.addGap(113, 113, 113)
.addGroup(changeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(newCheckInField, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(confirmChangeCheckInBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
changeCheckInFrameLayout.setVerticalGroup(
changeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(changeCheckInFrameLayout.createSequentialGroup()
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(newCheckInField, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
.addComponent(confirmChangeCheckInBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
checkInFrame.setSize(new java.awt.Dimension(400, 400));
jPanel6.setBackground(new java.awt.Color(51, 51, 51));
logo10.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo10.setForeground(new java.awt.Color(255, 255, 255));
logo10.setText("HYATT Staff");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo10, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo10)
.addContainerGap())
);
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel12.setText("Sending Customer,");
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel13.setText("greetings, room number, and keys");
javax.swing.GroupLayout checkInFrameLayout = new javax.swing.GroupLayout(checkInFrame.getContentPane());
checkInFrame.getContentPane().setLayout(checkInFrameLayout);
checkInFrameLayout.setHorizontalGroup(
checkInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(checkInFrameLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, checkInFrameLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
checkInFrameLayout.setVerticalGroup(
checkInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(checkInFrameLayout.createSequentialGroup()
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(111, Short.MAX_VALUE))
);
checkOutFrame.setSize(new java.awt.Dimension(400, 400));
jPanel7.setBackground(new java.awt.Color(51, 51, 51));
logo11.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo11.setForeground(new java.awt.Color(255, 255, 255));
logo11.setText("HYATT Staff");
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo11, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo11)
.addContainerGap())
);
jLabel14.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel14.setText("Sending Customer,");
jLabel15.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel15.setText("their bill through the network...");
javax.swing.GroupLayout checkOutFrameLayout = new javax.swing.GroupLayout(checkOutFrame.getContentPane());
checkOutFrame.getContentPane().setLayout(checkOutFrameLayout);
checkOutFrameLayout.setHorizontalGroup(
checkOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(checkOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(checkOutFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(checkOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(checkOutFrameLayout.createSequentialGroup()
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, checkOutFrameLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
checkOutFrameLayout.setVerticalGroup(
checkOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(checkOutFrameLayout.createSequentialGroup()
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 240, Short.MAX_VALUE))
.addGroup(checkOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(checkOutFrameLayout.createSequentialGroup()
.addGap(101, 101, 101)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(111, Short.MAX_VALUE)))
);
successfulChangeFrame.setSize(new java.awt.Dimension(400, 400));
jPanel8.setBackground(new java.awt.Color(51, 51, 51));
logo12.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo12.setForeground(new java.awt.Color(255, 255, 255));
logo12.setText("HYATT Staff");
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo12, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo12)
.addContainerGap())
);
jLabel5.setText("Your reservations has successfully been changed!");
javax.swing.GroupLayout successfulChangeFrameLayout = new javax.swing.GroupLayout(successfulChangeFrame.getContentPane());
successfulChangeFrame.getContentPane().setLayout(successfulChangeFrameLayout);
successfulChangeFrameLayout.setHorizontalGroup(
successfulChangeFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(successfulChangeFrameLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
successfulChangeFrameLayout.setVerticalGroup(
successfulChangeFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(successfulChangeFrameLayout.createSequentialGroup()
.addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(36, 36, 36)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 147, Short.MAX_VALUE))
);
showCusChangeCheckInFrame.setSize(new java.awt.Dimension(400, 400));
jPanel11.setBackground(new java.awt.Color(51, 51, 51));
logo15.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo15.setForeground(new java.awt.Color(255, 255, 255));
logo15.setText("HYATT Staff");
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo15, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo15)
.addContainerGap())
);
customerInfoList.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane2.setViewportView(customerInfoList);
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setText("Is it this Customer?");
yesChangeCheckInBtn.setText("Yes!");
yesChangeCheckInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
yesChangeCheckInBtnActionPerformed(evt);
}
});
noChangeCheckInBtn.setText("No!");
noChangeCheckInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noChangeCheckInBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout showCusChangeCheckInFrameLayout = new javax.swing.GroupLayout(showCusChangeCheckInFrame.getContentPane());
showCusChangeCheckInFrame.getContentPane().setLayout(showCusChangeCheckInFrameLayout);
showCusChangeCheckInFrameLayout.setHorizontalGroup(
showCusChangeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(showCusChangeCheckInFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(showCusChangeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusChangeCheckInFrameLayout.createSequentialGroup()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusChangeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(yesChangeCheckInBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noChangeCheckInBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(showCusChangeCheckInFrameLayout.createSequentialGroup()
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
showCusChangeCheckInFrameLayout.setVerticalGroup(
showCusChangeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusChangeCheckInFrameLayout.createSequentialGroup()
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusChangeCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(showCusChangeCheckInFrameLayout.createSequentialGroup()
.addComponent(yesChangeCheckInBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noChangeCheckInBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
showCusChangeCheckOutFrame.setSize(new java.awt.Dimension(400, 400));
jPanel12.setBackground(new java.awt.Color(51, 51, 51));
logo16.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo16.setForeground(new java.awt.Color(255, 255, 255));
logo16.setText("HYATT Staff");
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo16, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo16)
.addContainerGap())
);
customerInfoList1.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane3.setViewportView(customerInfoList1);
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel8.setText("Is it this Customer?");
yesChangeCheckOutBtn.setText("Yes!");
yesChangeCheckOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
yesChangeCheckOutBtnActionPerformed(evt);
}
});
noChangeCheckOutBtn.setText("No!");
noChangeCheckOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noChangeCheckOutBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout showCusChangeCheckOutFrameLayout = new javax.swing.GroupLayout(showCusChangeCheckOutFrame.getContentPane());
showCusChangeCheckOutFrame.getContentPane().setLayout(showCusChangeCheckOutFrameLayout);
showCusChangeCheckOutFrameLayout.setHorizontalGroup(
showCusChangeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(showCusChangeCheckOutFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(showCusChangeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusChangeCheckOutFrameLayout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusChangeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(yesChangeCheckOutBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noChangeCheckOutBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(showCusChangeCheckOutFrameLayout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
showCusChangeCheckOutFrameLayout.setVerticalGroup(
showCusChangeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusChangeCheckOutFrameLayout.createSequentialGroup()
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusChangeCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(showCusChangeCheckOutFrameLayout.createSequentialGroup()
.addComponent(yesChangeCheckOutBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noChangeCheckOutBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
showCusCancelResFrame.setSize(new java.awt.Dimension(400, 400));
jPanel13.setBackground(new java.awt.Color(51, 51, 51));
logo17.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo17.setForeground(new java.awt.Color(255, 255, 255));
logo17.setText("HYATT Staff");
javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
jPanel13.setLayout(jPanel13Layout);
jPanel13Layout.setHorizontalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo17, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel13Layout.setVerticalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo17)
.addContainerGap())
);
customerInfoList2.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane4.setViewportView(customerInfoList2);
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel9.setText("Are you sure you want to cancel this reservation?");
yesCancelResBtn.setText("Yes!");
yesCancelResBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
yesCancelResBtnActionPerformed(evt);
}
});
noCancelResBtn.setText("No!");
noCancelResBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noCancelResBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout showCusCancelResFrameLayout = new javax.swing.GroupLayout(showCusCancelResFrame.getContentPane());
showCusCancelResFrame.getContentPane().setLayout(showCusCancelResFrameLayout);
showCusCancelResFrameLayout.setHorizontalGroup(
showCusCancelResFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(showCusCancelResFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(showCusCancelResFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(showCusCancelResFrameLayout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusCancelResFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(yesCancelResBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noCancelResBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
);
showCusCancelResFrameLayout.setVerticalGroup(
showCusCancelResFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusCancelResFrameLayout.createSequentialGroup()
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusCancelResFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(showCusCancelResFrameLayout.createSequentialGroup()
.addComponent(yesCancelResBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noCancelResBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
showCusCheckInFrame.setSize(new java.awt.Dimension(400, 400));
jPanel14.setBackground(new java.awt.Color(51, 51, 51));
logo18.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo18.setForeground(new java.awt.Color(255, 255, 255));
logo18.setText("HYATT Staff");
javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
jPanel14.setLayout(jPanel14Layout);
jPanel14Layout.setHorizontalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo18, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel14Layout.setVerticalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo18)
.addContainerGap())
);
customerInfoList3.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane5.setViewportView(customerInfoList3);
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel10.setText("Is it this Customer?");
yesCheckInBtn.setText("Check In!");
yesCheckInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
yesCheckInBtnActionPerformed(evt);
}
});
noCheckInBtn.setText("No!");
noCheckInBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noCheckInBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout showCusCheckInFrameLayout = new javax.swing.GroupLayout(showCusCheckInFrame.getContentPane());
showCusCheckInFrame.getContentPane().setLayout(showCusCheckInFrameLayout);
showCusCheckInFrameLayout.setHorizontalGroup(
showCusCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(showCusCheckInFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(showCusCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusCheckInFrameLayout.createSequentialGroup()
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(yesCheckInBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noCheckInBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(showCusCheckInFrameLayout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
showCusCheckInFrameLayout.setVerticalGroup(
showCusCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusCheckInFrameLayout.createSequentialGroup()
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusCheckInFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(showCusCheckInFrameLayout.createSequentialGroup()
.addComponent(yesCheckInBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noCheckInBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
showCusCheckOutFrame.setSize(new java.awt.Dimension(400, 400));
jPanel15.setBackground(new java.awt.Color(51, 51, 51));
logo19.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo19.setForeground(new java.awt.Color(255, 255, 255));
logo19.setText("HYATT Staff");
javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
jPanel15.setLayout(jPanel15Layout);
jPanel15Layout.setHorizontalGroup(
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo19, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(247, Short.MAX_VALUE))
);
jPanel15Layout.setVerticalGroup(
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup()
.addContainerGap(27, Short.MAX_VALUE)
.addComponent(logo19)
.addContainerGap())
);
customerInfoList4.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane6.setViewportView(customerInfoList4);
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel11.setText("Is it this Customer?");
yesCheckOutBtn.setText("Check Out!");
yesCheckOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
yesCheckOutBtnActionPerformed(evt);
}
});
noCheckOutBtn.setText("No!");
noCheckOutBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noCheckOutBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout showCusCheckOutFrameLayout = new javax.swing.GroupLayout(showCusCheckOutFrame.getContentPane());
showCusCheckOutFrame.getContentPane().setLayout(showCusCheckOutFrameLayout);
showCusCheckOutFrameLayout.setHorizontalGroup(
showCusCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(showCusCheckOutFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(showCusCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusCheckOutFrameLayout.createSequentialGroup()
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(showCusCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(yesCheckOutBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noCheckOutBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(showCusCheckOutFrameLayout.createSequentialGroup()
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
showCusCheckOutFrameLayout.setVerticalGroup(
showCusCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showCusCheckOutFrameLayout.createSequentialGroup()
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(showCusCheckOutFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(showCusCheckOutFrameLayout.createSequentialGroup()
.addComponent(yesCheckOutBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(noCheckOutBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(51, 51, 51));
logo6.setFont(new java.awt.Font("Mshtakan", 2, 24)); // NOI18N
logo6.setForeground(new java.awt.Color(255, 255, 255));
logo6.setText("HYATT Staff");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(logo6, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(logo6)
.addContainerGap(31, Short.MAX_VALUE))
);
jLabel2.setFont(new java.awt.Font("Al Bayan", 3, 18)); // NOI18N
jLabel2.setText("Per Customer Request...");
viewReservationsBtn.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
viewReservationsBtn.setText("View Reservations");
viewReservationsBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewReservationsBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(126, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(viewReservationsBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 135, Short.MAX_VALUE)
.addComponent(viewReservationsBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void viewReservationsBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewReservationsBtnActionPerformed
// TODO add your handling code here:
this.setVisible(false);
viewReservationsFrame.setVisible(true);
viewReservationsList.setListData(staff.viewReservations());
viewReservationsList.setFixedCellHeight(30);
}//GEN-LAST:event_viewReservationsBtnActionPerformed
private void checkOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkOutBtnActionPerformed
// TODO add your handling code here:
viewReservationsFrame.setVisible(false);
showCusCheckOutFrame.setVisible(true);
customerInfoList4.setListData(staff.showUser(viewReservationsList.getSelectedValue()));
customerInfoList4.setFixedCellHeight(30);
}//GEN-LAST:event_checkOutBtnActionPerformed
private void cancelReservationsBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelReservationsBtnActionPerformed
// TODO add your handling code here:
viewReservationsFrame.setVisible(false);
showCusCancelResFrame.setVisible(true);
customerInfoList2.setListData(staff.showUser(viewReservationsList.getSelectedValue()));
customerInfoList2.setFixedCellHeight(30);
}//GEN-LAST:event_cancelReservationsBtnActionPerformed
private void changeCheckInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeCheckInBtnActionPerformed
// TODO add your handling code here:
viewReservationsFrame.setVisible(false);
showCusChangeCheckInFrame.setVisible(true);
customerInfoList.setListData(staff.showUser(viewReservationsList.getSelectedValue()));
customerInfoList.setFixedCellHeight(30);
}//GEN-LAST:event_changeCheckInBtnActionPerformed
private void changeCheckOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeCheckOutBtnActionPerformed
// TODO add your handling code here:
viewReservationsFrame.setVisible(false);
showCusChangeCheckOutFrame.setVisible(true);
customerInfoList1.setListData(staff.showUser(viewReservationsList.getSelectedValue()));
customerInfoList1.setFixedCellHeight(30);
}//GEN-LAST:event_changeCheckOutBtnActionPerformed
private void newCheckOutFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newCheckOutFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_newCheckOutFieldActionPerformed
private void confirmChangeCheckOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmChangeCheckOutBtnActionPerformed
try {
// TODO add your handling code here:
staff.changeCheckOut(newCheckOutField.getText(), viewReservationsList.getSelectedValue());
} catch (ParseException | SQLException ex) {
Logger.getLogger(ServerGUI.class.getName()).log(Level.SEVERE, null, ex);
}
changeCheckOutFrame.setVisible(false);
successfulChangeFrame.setVisible(true);
}//GEN-LAST:event_confirmChangeCheckOutBtnActionPerformed
private void newCheckInFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newCheckInFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_newCheckInFieldActionPerformed
private void confirmChangeCheckInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmChangeCheckInBtnActionPerformed
// TODO add your handling code here:
try {
// TODO add your handling code here:
staff.changeCheckIn(newCheckInField.getText(), viewReservationsList.getSelectedValue());
} catch (ParseException | SQLException ex) {
Logger.getLogger(ServerGUI.class.getName()).log(Level.SEVERE, null, ex);
}
changeCheckInFrame.setVisible(false);
successfulChangeFrame.setVisible(true);
}//GEN-LAST:event_confirmChangeCheckInBtnActionPerformed
private void newCheckInFieldMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_newCheckInFieldMousePressed
// TODO add your handling code here:
newCheckInField.setText("");
}//GEN-LAST:event_newCheckInFieldMousePressed
private void newCheckOutFieldMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_newCheckOutFieldMousePressed
// TODO add your handling code here:
newCheckOutField.setText("");
}//GEN-LAST:event_newCheckOutFieldMousePressed
private void yesChangeCheckInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesChangeCheckInBtnActionPerformed
// TODO add your handling code here:
showCusChangeCheckInFrame.setVisible(false);
changeCheckInFrame.setVisible(true);
}//GEN-LAST:event_yesChangeCheckInBtnActionPerformed
private void yesChangeCheckOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesChangeCheckOutBtnActionPerformed
// TODO add your handling code here:
showCusChangeCheckOutFrame.setVisible(false);
changeCheckInFrame.setVisible(true);
}//GEN-LAST:event_yesChangeCheckOutBtnActionPerformed
private void yesCancelResBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesCancelResBtnActionPerformed
// TODO add your handling code here:
showCusCancelResFrame.setVisible(false);
try {
staff.cancelReservations(viewReservationsList.getSelectedValue());
} catch (SQLException ex) {
Logger.getLogger(ServerGUI.class.getName()).log(Level.SEVERE, null, ex);
}
cancelReservationsFrame.setVisible(true);
}//GEN-LAST:event_yesCancelResBtnActionPerformed
private void yesCheckInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesCheckInBtnActionPerformed
// TODO add your handling code here:
showCusCheckInFrame.setVisible(false);
checkInFrame.setVisible(true);
}//GEN-LAST:event_yesCheckInBtnActionPerformed
private void yesCheckOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesCheckOutBtnActionPerformed
// TODO add your handling code here:
showCusCheckOutFrame.setVisible(false);
checkOutFrame.setVisible(true);
staff.checkOut(viewReservationsList.getSelectedValue());
Server server = new Server();
}//GEN-LAST:event_yesCheckOutBtnActionPerformed
private void checkInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkInBtnActionPerformed
// TODO add your handling code here:
viewReservationsFrame.setVisible(false);
showCusCheckInFrame.setVisible(true);
customerInfoList3.setListData(staff.showUser(viewReservationsList.getSelectedValue()));
customerInfoList3.setFixedCellHeight(30);
}//GEN-LAST:event_checkInBtnActionPerformed
private void noCheckInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noCheckInBtnActionPerformed
// TODO add your handling code here:
showCusCheckInFrame.setVisible(false);
viewReservationsFrame.setVisible(true);
}//GEN-LAST:event_noCheckInBtnActionPerformed
private void noCheckOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noCheckOutBtnActionPerformed
// TODO add your handling code here:
showCusCheckInFrame.setVisible(false);
viewReservationsFrame.setVisible(true);
}//GEN-LAST:event_noCheckOutBtnActionPerformed
private void noCancelResBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noCancelResBtnActionPerformed
// TODO add your handling code here:
showCusCancelResFrame.setVisible(false);
viewReservationsFrame.setVisible(true);
}//GEN-LAST:event_noCancelResBtnActionPerformed
private void noChangeCheckOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noChangeCheckOutBtnActionPerformed
// TODO add your handling code here:
showCusChangeCheckOutFrame.setVisible(false);
viewReservationsFrame.setVisible(true);
}//GEN-LAST:event_noChangeCheckOutBtnActionPerformed
private void noChangeCheckInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noChangeCheckInBtnActionPerformed
// TODO add your handling code here:
showCusChangeCheckInFrame.setVisible(false);
viewReservationsFrame.setVisible(true);
}//GEN-LAST:event_noChangeCheckInBtnActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ServerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ServerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ServerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ServerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ServerGUI().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelReservationsBtn;
private javax.swing.JFrame cancelReservationsFrame;
private javax.swing.JButton changeCheckInBtn;
private javax.swing.JFrame changeCheckInFrame;
private javax.swing.JButton changeCheckOutBtn;
private javax.swing.JFrame changeCheckOutFrame;
private javax.swing.JButton checkInBtn;
private javax.swing.JFrame checkInFrame;
private javax.swing.JButton checkOutBtn;
private javax.swing.JFrame checkOutFrame;
private javax.swing.JButton confirmChangeCheckInBtn;
private javax.swing.JButton confirmChangeCheckOutBtn;
private javax.swing.JList<String> customerInfoList;
private javax.swing.JList<String> customerInfoList1;
private javax.swing.JList<String> customerInfoList2;
private javax.swing.JList<String> customerInfoList3;
private javax.swing.JList<String> customerInfoList4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JLabel logo10;
private javax.swing.JLabel logo11;
private javax.swing.JLabel logo12;
private javax.swing.JLabel logo15;
private javax.swing.JLabel logo16;
private javax.swing.JLabel logo17;
private javax.swing.JLabel logo18;
private javax.swing.JLabel logo19;
private javax.swing.JLabel logo6;
private javax.swing.JLabel logo7;
private javax.swing.JLabel logo8;
private javax.swing.JLabel logo9;
private javax.swing.JTextField newCheckInField;
private javax.swing.JTextField newCheckOutField;
private javax.swing.JButton noCancelResBtn;
private javax.swing.JButton noChangeCheckInBtn;
private javax.swing.JButton noChangeCheckOutBtn;
private javax.swing.JButton noCheckInBtn;
private javax.swing.JButton noCheckOutBtn;
private javax.swing.JFrame showCusCancelResFrame;
private javax.swing.JFrame showCusChangeCheckInFrame;
private javax.swing.JFrame showCusChangeCheckOutFrame;
private javax.swing.JFrame showCusCheckInFrame;
private javax.swing.JFrame showCusCheckOutFrame;
private javax.swing.JFrame successfulChangeFrame;
private javax.swing.JButton viewReservationsBtn;
private javax.swing.JFrame viewReservationsFrame;
private javax.swing.JList<String> viewReservationsList;
private javax.swing.JButton yesCancelResBtn;
private javax.swing.JButton yesChangeCheckInBtn;
private javax.swing.JButton yesChangeCheckOutBtn;
private javax.swing.JButton yesCheckInBtn;
private javax.swing.JButton yesCheckOutBtn;
// End of variables declaration//GEN-END:variables
}
| [
"norman3@purduecal.edu"
] | norman3@purduecal.edu |
1dbf1d3df5ca6de64dcae64ce12e92a630fcef32 | e898a3ed41170029007f30b74b2d95470c602286 | /app/src/main/java/com/example/dentaku/MainActivity.java | ed75c6dfc4e4caf32c61537320e79bdcbbc22595 | [] | no_license | nakata-0523/Dentaku | 8cbaff389ecdc6e680f06670a45de6cf9846993b | 02cc732b3e41a968bf671928c5bdfd599166e86c | refs/heads/master | 2023-01-02T05:32:43.582514 | 2020-10-21T13:52:32 | 2020-10-21T13:52:32 | 306,040,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,438 | java | package com.example.dentaku;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
LinearLayout buttonPadLinearLayout;
final String[] buttonTexts =
{"AC", "C", "Del", "÷",
"7", "8", "9", "×",
"4", "5", "6", "-",
"1", "2", "3", "+",
"±", "0", ".", "="};
final String[] buttonTags = {
"allclear", "clear", "delete", "divide",
"seven", "eight", "nine", "multiply",
"four", "five", "six", "minus",
"one", "two", "three", "plus",
"sign", "zero", "dot", "equal"};
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.buttonPadLinearLayout =
findViewById(R.id.buttonPadLinearLayout);
final ButtonClickListener buttonClickListener =
new ButtonClickListener(
(TextView) findViewById(R.id.operand1),
(TextView) findViewById(R.id.operator),
(TextView) findViewById(R.id.operand2)
);
//LinearLayoutとButtonをforループで生成して追加する
for (int i = 0; i < 5; ++i) {
final LinearLayout newLL = new LinearLayout
(this.getApplicationContext());
newLL.setBackgroundColor(Color.YELLOW);
newLL.setOrientation(LinearLayout.HORIZONTAL);
final ViewGroup.LayoutParams newLP =
new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
buttonPadLinearLayout.addView(newLL, newLP);
for (int j = 0; j < 4; ++j) {
final Button b = new Button
(this.getApplicationContext());
//b.setText(i + "," + j);
b.setBackgroundColor(Color.RED);
b.setText(buttonTexts[i * 4 + j]);
b.setTextSize(22);
b.setTextColor(Color.WHITE);
//同じイベントリスナで複数のボタンを処理する際にボタンを識別するためタグをつける
//各ボタンにIDをつけて識別することもできる
b.setTag(buttonTags[i * 4 + j]);
b.setOnClickListener(buttonClickListener);
final LinearLayout.LayoutParams lllp =
new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
lllp.bottomMargin = 5;
lllp.topMargin = 5;
lllp.leftMargin = 5;
lllp.rightMargin = 5;
newLL.addView(b, lllp);
}//for j
}//for i
}}
| [
"nktstr.20050203@gmail.com"
] | nktstr.20050203@gmail.com |
68d5898f3905171b8cfb0174d774af520c4d81e6 | eb21f4c32e382064e283d7c5e10a27fd665bf80d | /score-service/src/main/java/com/fcy/scoreservice/entity/Course.java | 7c85634b74536315079d2f5c823510883f41b25a | [] | no_license | fcy1526/Automatic-Scoring-System | 69dd159b2391343ab21c6be23689b60f852332da | 2785490e02db63f6ce8a3c23879c432572fa056a | refs/heads/master | 2023-04-10T19:27:09.977600 | 2021-04-25T11:55:39 | 2021-04-25T11:55:39 | 346,721,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.fcy.scoreservice.entity;
import com.fcy.scoreservice.enums.CourseStatus;
import lombok.Data;
/**
* @Describe: 课程类
* @Author: fuchenyang
* @Date: 2021/3/28 20:38
*/
@Data
public class Course {
/**
* 课程id
*/
private Integer courseId;
/**
* 课程名称
*/
private String name;
/**
* 创建时间
*/
private String createTime;
/**
* 结束时间
*/
private String endTime;
/**
* 课程状态
*/
private CourseStatus status;
/**
* 课程阶段数
*/
private Integer stageNum;
/**
* 教师id
*/
private String teacherId;
/**
* 当前阶段
*/
private Integer currentStage;
}
| [
"fcy1526@163.com"
] | fcy1526@163.com |
75b11130593f8e407b4042f68cbea2a740e1d67f | 3e2e79bedac25ea5608bd89e692a868b4f847b80 | /eclipse/apet-plugin/src/apet/absunit/PureExpressionBuilder.java | ed2c5261b5a4b51690b075bf730b27f83e29eb04 | [] | no_license | JaacRepo/absCompiler | a50fa03beeaa9b5a2286cb9a0dd5ba2b52484541 | 8b852a71947c82bfc7172ec4e9c1affb4cb102d4 | refs/heads/master | 2018-10-16T11:04:35.821401 | 2018-08-16T14:24:01 | 2018-08-16T14:24:01 | 122,403,875 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,341 | java | package apet.absunit;
import static abs.backend.tests.AbsASTBuilderUtil.getDecl;
import static abs.backend.tests.AbsASTBuilderUtil.namePred;
import static apet.testCases.ABSTestCaseExtractor.getABSDataType;
import static apet.testCases.ABSTestCaseExtractor.getABSDataValue;
import static apet.testCases.ABSTestCaseExtractor.getABSTermArgs;
import static apet.testCases.ABSTestCaseExtractor.getABSTermFunctor;
import static apet.testCases.ABSTestCaseExtractor.getABSTermTypeName;
import java.util.List;
import java.util.Set;
import abs.frontend.ast.DataConstructorExp;
import abs.frontend.ast.DataTypeDecl;
import abs.frontend.ast.DataTypeUse;
import abs.frontend.ast.Decl;
import abs.frontend.ast.IntLiteral;
import abs.frontend.ast.InterfaceDecl;
import abs.frontend.ast.Model;
import abs.frontend.ast.NullExp;
import abs.frontend.ast.ParametricDataTypeDecl;
import abs.frontend.ast.PureExp;
import abs.frontend.ast.StringLiteral;
import abs.frontend.ast.TypeParameterDecl;
import abs.frontend.ast.TypeSynDecl;
import abs.frontend.ast.TypeUse;
import abs.frontend.ast.VarUse;
import apet.testCases.ABSData;
import apet.testCases.ABSRef;
import apet.testCases.ABSTerm;
/**
*
* @author woner
*
*/
final class PureExpressionBuilder {
private final String INT = "Int";
private final String STRING = "String";
private final Model model;
private final HeapReferenceBuilder heapRefBuilder = new HeapReferenceBuilder();
private final Set<String> importModules;
PureExpressionBuilder(Model input, Set<String> importModules) {
this.model = input;
this.importModules = importModules;
}
void updateInitialisationOrder(List<String> initialisationsOrders, String cr, String nr) {
int cpos = initialisationsOrders.indexOf(cr);
int npos = initialisationsOrders.indexOf(nr);
if (npos < 0 || npos > cpos) {
initialisationsOrders.add(cpos, nr);
}
}
PureExp createPureExpression(
String testName, Set<String> heapNames, ABSData dataValue) {
return createPureExpression(null, null, testName, heapNames, dataValue);
}
/**
* @param currentHeapReference
* @param initialisationsOrders
* @param heapNames
* @param dataValue
* @return
*/
PureExp createPureExpression(
String currentHeapReference,
List<String> initialisationsOrders,
String testName, Set<String> heapNames, ABSData dataValue) {
String type = getABSDataType(dataValue);
String value = getABSDataValue(dataValue);
if (type.contains("(") && dataValue instanceof ABSTerm) {
ABSTerm term = (ABSTerm) dataValue;
type = getABSTermTypeName(term);
}
//import type
Decl decl = getDecl(model, Decl.class, namePred(type));
importType(decl);
if (dataValue instanceof ABSTerm) {
ABSTerm term = (ABSTerm) dataValue;
return makeDataTermValue(currentHeapReference,
initialisationsOrders, testName, heapNames, term, decl);
} else if (dataValue instanceof ABSRef) {
if (heapNames.contains(value)) {
String ref = heapRefBuilder.heapReferenceForTest(testName, value);
if (currentHeapReference != null) {
//we need to consider initialisation order!
updateInitialisationOrder(initialisationsOrders, currentHeapReference, ref);
}
return new VarUse(ref);
} else {
return new NullExp();
}
} else {
throw new IllegalStateException("Cannot handle ABSData that is not " +
"either a ABSRef or a ABSTerm");
}
}
/**
* Resolve the type synonyms to its raw type (interface or data type)
* @param d
* @return
*/
Decl resolveTypeSynonym(TypeSynDecl d) {
TypeUse use = d.getValue();
Decl decl = getDecl(model, Decl.class, namePred(use.getName()));
if (decl instanceof TypeSynDecl) {
return resolveTypeSynonym((TypeSynDecl) decl);
}
return decl;
}
void importType(Decl decl) {
importModules.add(decl.getModuleDecl().getName());
if (decl instanceof TypeSynDecl) {
decl = resolveTypeSynonym((TypeSynDecl) decl);
importModules.add(decl.getModuleDecl().getName());
}
//import type parameters
if (decl instanceof ParametricDataTypeDecl) {
for (TypeParameterDecl t : ((ParametricDataTypeDecl) decl).getTypeParameters()) {
Decl type = getDecl(model, Decl.class, namePred(t.getName()));
if (type == null) {
//most likely a generic type
continue;
}
importType(type);
}
}
}
/**
* Construct a pure expression that is either a primitive literal
* such as Int and String, or a value of a data type.
* @param currentHeapReference
*
* @param initialisationsOrders
* @param heap
* @param testName
* @param value
* @param decl
*
* @return
*/
PureExp makeDataTermValue(String currentHeapReference,
List<String> initialisationsOrders,
String testName, Set<String> heap,
ABSTerm term, Decl decl) {
if (decl instanceof TypeSynDecl) {
decl = resolveTypeSynonym((TypeSynDecl) decl);
}
if (decl instanceof DataTypeDecl) {
if (STRING.equals(decl.getName())) {
return new StringLiteral(getABSDataValue(term));
} else if (INT.equals(decl.getName())) {
return new IntLiteral(getABSDataValue(term));
} else {
return parseValue(currentHeapReference,
initialisationsOrders, testName, heap, term);
}
} else if (decl instanceof InterfaceDecl) {
String value = getABSDataValue(term);
if (heap.contains(value)) {
String ref = heapRefBuilder.heapReferenceForTest(testName, value);
if (currentHeapReference != null) {
//we need to consider initialisation order!
updateInitialisationOrder(initialisationsOrders, currentHeapReference, ref);
}
return new VarUse(ref);
} else {
return new NullExp();
}
} else {
throw new IllegalStateException("Cannot handle declaration type "+decl);
}
}
DataConstructorExp parseValue(String currentHeapReference,
List<String> initialisationsOrders,
String testName, Set<String> heap, ABSTerm term) {
final DataConstructorExp result = new DataConstructorExp();
String fn = getABSTermFunctor(term);
result.setConstructor(fn);
result.setParamList(new abs.frontend.ast.List<PureExp>());
List<ABSData> vs = getABSTermArgs(term);
for (int i=0; i<vs.size(); i++) {
result.setParam(createPureExpression(currentHeapReference,
initialisationsOrders, testName, heap, vs.get(i)),i);
}
return result;
}
}
| [
"serbanescu.vlad.nicolae@gmail.com"
] | serbanescu.vlad.nicolae@gmail.com |
f6862de0549f288639fd561782d99df1bfd9b897 | 61ab185dabde08c0a2340244f8c52e6c8a80bde9 | /src/main/java/Design/Controllers/Courier/OrderUpdateController.java | 33a779b584c2fab59b3923a48fbcf9db6017e3d5 | [] | no_license | AnastasiaKozachuk/ComputerShopJavaFX | 7ef990de1f61d1fcf2d06b3ed6cf1eff2529b978 | 3473dadcc99849c951e66a811439d8d45fc7456a | refs/heads/master | 2020-04-11T19:10:59.994294 | 2018-12-16T17:43:51 | 2018-12-16T17:43:51 | 162,025,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,930 | java | package Design.Controllers.Courier;
import Design.SharedClasses;
import compShop.model.OrderStatus;
import compShop.model.UsersOrder;
import compShop.service.OrderService;
import compShop.service.OrderStatusService;
import compShop.service.impl.OrderServiceImpl;
import compShop.service.impl.OrderStatusServiceImpl;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.DatePicker;
import javafx.stage.Stage;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDate;
import java.util.List;
import java.util.ResourceBundle;
public class OrderUpdateController {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
private DatePicker appr_deliv_date_field;
@FXML
private ComboBox order_code_field;
@FXML
private ComboBox order_status_field;
@FXML
private Button saveButton;
@FXML
private DatePicker payment_date_field;
@FXML
private DatePicker actual_deliv_date_field;
@FXML
void initialize() {
init();
saveButton.setOnAction(event -> {
Integer order_code_chosen = (Integer) order_code_field.getSelectionModel().getSelectedItem();
LocalDate appr_deliv_date = appr_deliv_date_field.getValue();
LocalDate payment_date = payment_date_field.getValue();
LocalDate actual_deliv_date = actual_deliv_date_field.getValue();
String statusName = (String) order_status_field.getSelectionModel().getSelectedItem();
FXMLLoader loader = new FXMLLoader();
if (order_code_chosen != null && appr_deliv_date!=null && !statusName.isEmpty()) {
saveButton.getScene().getWindow().hide();
OrderService orderService = new OrderServiceImpl();
UsersOrder usersOrder = orderService.getOneById(order_code_chosen);
usersOrder.setAppr_deliv_date(appr_deliv_date);
usersOrder.setActual_deliv_date(actual_deliv_date);
usersOrder.setPayment_date(payment_date);
OrderStatusService orderStatusService = new OrderStatusServiceImpl();
List<OrderStatus> allOrderStatus = orderStatusService.getAllOrderStatus();
for (OrderStatus orderStatus : allOrderStatus) {
if(orderStatus.getOrder_status_name().equals(statusName)){
usersOrder.setOrderStatus_fk(orderStatus);
}
}
orderService.updateUsersOrder(usersOrder);
SharedClasses.courier_window.showOrders();
} else {
loader.setLocation(getClass().getResource("/FXML/WrongUser.fxml"));
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
Parent root = loader.getRoot();
Stage stage = new Stage();
stage.setScene(new Scene(root));
stage.setResizable(false);
stage.show();
}
});
order_code_field.setOnAction(event -> {
customizeView((Integer) order_code_field.getSelectionModel().getSelectedItem());
});
}
private void customizeView(Integer orderCode) {
OrderService orderService = new OrderServiceImpl();
UsersOrder usersOrder = orderService.getOneById(orderCode);
order_code_field.getSelectionModel().select(orderCode);
appr_deliv_date_field.setValue(usersOrder.getAppr_deliv_date());
actual_deliv_date_field.setValue(usersOrder.getActual_deliv_date());
payment_date_field.setValue(usersOrder.getPayment_date());
order_status_field.getSelectionModel().select(usersOrder.getStatusName());
}
private void init() {
OrderService orderService = new OrderServiceImpl();
List<UsersOrder> allUsersOrder = orderService.getAllUsersOrder();
for (UsersOrder obj : allUsersOrder) {
if (obj.getCourier_fk().getCourier_Id() == SharedClasses.courier_client.getCourier_Id()) {
order_code_field.getItems().add(obj.getOrder_code());
}
}
order_code_field.getSelectionModel().selectFirst();
OrderStatusService orderStatusService = new OrderStatusServiceImpl();
List<OrderStatus> allOrderStatus = orderStatusService.getAllOrderStatus();
for (OrderStatus orderStatus : allOrderStatus) {
order_status_field.getItems().add(orderStatus.getOrder_status_name());
}
order_status_field.getSelectionModel().selectFirst();
customizeView((Integer) order_code_field.getSelectionModel().getSelectedItem());
}
}
| [
"32028221+AnastasiaKozachuk@users.noreply.github.com"
] | 32028221+AnastasiaKozachuk@users.noreply.github.com |
015e4c39e9e8f5205fc8a4f0bd627454a1782253 | ee057c3e0bea08d45398b63c6f50ef40ea9a991e | /Java/Complete-Java-Exercies/HiberDAO/src/daopack/EmployeeServiceImpl.java | e8fd194d992ac136091845a995c243f291f82298 | [] | no_license | stormworm29/Programming-Snippets | de078d60e2a9e589e445dc14c98b300019b4214e | 161831719674e0e7dc329c63624ad51f5dddec17 | refs/heads/master | 2020-05-16T23:39:25.695355 | 2019-04-25T06:49:27 | 2019-04-25T06:49:27 | 183,372,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | package daopack;
import java.util.List;
public class EmployeeServiceImpl extends EmployeeServiceDAO{
private DAO dao;
@Override
public EmployeePojo findEmployee(int id) {
return dao.findEmployee(id);
}
@Override
public void deleteObject(Object o) {
dao.deleteObject(o);
}
@Override
public List<EmployeePojo> findAllEmployees() {
return dao.findAllEmployees();
}
@Override
public float getSalary(int id) {
return dao.getSalary(id);
}
@Override
public void saveObject(Object o) {
dao.saveObject(o);
}
@Override
public void updateEmployee(EmployeePojo e) {
dao.updateEmployee(e);
}
public DAO getDao() {
return dao;
}
public void setDao(DAO dao) {
this.dao = dao;
}
}
| [
"stormworm29@gmail.com"
] | stormworm29@gmail.com |
3ec9d5031d1f6bac6ad8a53820f27f00b2bbb7f7 | e5bb4c1c5cb3a385a1a391ca43c9094e746bb171 | /Service/trunk/service/service-baseInfo/src/main/java/com/hzfh/service/baseInfo/mapper/EmailMapper.java | e57031e86ff498d4ad9418a922040b14c404ebde | [] | no_license | FashtimeDotCom/huazhen | 397143967ebed9d50073bfa4909c52336a883486 | 6484bc9948a29f0611855f84e81b0a0b080e2e02 | refs/heads/master | 2021-01-22T14:25:04.159326 | 2016-01-11T09:52:40 | 2016-01-11T09:52:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package com.hzfh.service.baseInfo.mapper;
import com.hzfh.api.baseInfo.model.Email;
import com.hzfh.api.baseInfo.model.query.EmailCondition;
import com.hzframework.data.mapper.BaseMapper;
import org.springframework.stereotype.Service;
/*******************************************************************************
*
* Copyright 2015 HZFH. All rights reserved.
* Author: GuoZhenYu
* Create Date: 2015/3/5
* Description:
*
* Revision History:
* Date Author Description
*
******************************************************************************/
@Service("emailMapper")
public interface EmailMapper extends BaseMapper<Email, EmailCondition> {
} | [
"ulei0343@163.com"
] | ulei0343@163.com |
46af7cc39bf6d671e7a23e12dfaf9116d7733ae4 | ca77a4766e9ac28d8dbbaf69a8d34d141c31c1ff | /spi/src/main/java/org/apache/ode/spi/CDICallable.java | 5b50d8d5c39de6fb48d8cf57e02baa8d2203d38c | [] | no_license | aaronanderson/ODE-X | b79e19f1f90f7f03bae8db1271b851f4e8c8e911 | 3fb76fdfec5b3333ba6461832f6fe210d808c553 | refs/heads/master | 2021-06-19T00:19:48.479266 | 2019-08-31T06:26:48 | 2019-08-31T06:26:48 | 1,525,688 | 1 | 1 | null | 2021-03-19T20:19:37 | 2011-03-25T14:16:18 | Java | UTF-8 | Java | false | false | 1,090 | java | package org.apache.ode.spi;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.CDI;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.InjectionTargetFactory;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
public abstract class CDICallable<V> implements IgniteCallable<V> {
@Override
public V call() throws Exception {
BeanManager bm = CDI.current().getBeanManager();
InjectionTargetFactory itf = bm.getInjectionTargetFactory(bm.createAnnotatedType(getClass()));
InjectionTarget injectionTarget = itf.createInjectionTarget(null);
CreationalContext creationalContext = bm.createCreationalContext(null);
injectionTarget.inject(this, creationalContext);
injectionTarget.postConstruct(this);
try {
return callExt();
} finally {
injectionTarget.preDestroy(this);
creationalContext.release();
}
}
public abstract V callExt() throws Exception;
}
| [
"aaronanderson@acm.org"
] | aaronanderson@acm.org |
a2ec0f59f06a0109648378ca78ed26c6e9b3532e | 295abb3ea2ccac543ceb6a4e357dfcc51a36f9b8 | /src/main/java/com/study/clay/common/util/HibernatePhysicalNamingNamingStrategy.java | 4b7fbe32750360e9c15c4804082a1c9319ec88a7 | [] | no_license | wangkaistudy/cloud-study | 9a68686109357af6e1b7c378bc2c18f3f291f256 | 83c65bd799a0739b0cdd6a883f98bc580c949deb | refs/heads/master | 2020-07-09T14:38:03.697651 | 2019-08-23T12:54:59 | 2019-08-23T12:54:59 | 202,712,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | package com.study.clay.common.util;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.springframework.util.StringUtils;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public class HibernatePhysicalNamingNamingStrategy extends
PhysicalNamingStrategyStandardImpl {
@Override
public Identifier toPhysicalTableName(Identifier name,
JdbcEnvironment context) {
return new Identifier(name.getText(), name.isQuoted());
}
@Override
public Identifier toPhysicalColumnName(Identifier identifier,
JdbcEnvironment jdbcEnv) {
return convert(identifier);
}
// 更改Hibernate表名映射规则,保持Entity类中对数据库表命名的不变
private Identifier convert(Identifier identifier) {
if (identifier == null || ! StringUtils.hasText(identifier.getText())) {
return identifier;
}
String regex = "([a-z])([A-Z])";
String replacement = "$1_$2";
String newName = identifier.getText().replaceAll(regex,
replacement).toLowerCase();
return Identifier.toIdentifier(newName);
}
}
| [
"wangkai"
] | wangkai |
a4b3496467016e8c3130b87ce4076e4309df95d8 | 649ef1f18b7a5ad38a0c6f1e2b0a6e3a708e4769 | /src/main/java/com/hehe/mybatis/error/ErrorInfoBuilder.java | d6c6c4d559bbccebb90e69eba89ee0b2cc322b2b | [] | no_license | increasinglyy/Mybatis-Annotation | 5b8d86fceb19fcc0a43c1f1402f52755fd390d09 | 9c90397a5e3c314f052bd4c95b24645277b8c252 | refs/heads/master | 2020-05-15T03:59:09.009865 | 2019-04-23T06:15:54 | 2019-04-23T06:15:54 | 182,076,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,652 | java | package com.hehe.mybatis.error;
import org.springframework.boot.autoconfigure.web.ErrorProperties;
import org.springframework.boot.autoconfigure.web.ErrorProperties.IncludeStacktrace;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.WebUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.time.LocalDateTime;
/**
* 主要通途: 快速构建错误信息.
* 设计说明:
* 1.提供常用的API(例如#getError,#getHttpStatus),让控制器/处理器更专注于业务开发!!
* 2.从配置文件读取错误配置,例如是否打印堆栈轨迹等。
*
* @see ErrorInfo
* @see ErrorProperties
*/
@Order(Ordered.HIGHEST_PRECEDENCE)
@Component
public class ErrorInfoBuilder implements HandlerExceptionResolver, Ordered {
/**
* 错误KEY
*/
private final static String ERROR_NAME = "hehe.error";
/**
* 错误配置(ErrorConfiguration)
*/
private ErrorProperties errorProperties;
public ErrorProperties getErrorProperties() {
return errorProperties;
}
public void setErrorProperties(ErrorProperties errorProperties) {
this.errorProperties = errorProperties;
}
/**
* 错误构造器 (Constructor) 传递配置属性:server.xx -> server.error.xx
*/
public ErrorInfoBuilder(ServerProperties serverProperties) {
this.errorProperties = serverProperties.getError();
}
/**
* 构建错误信息.(ErrorInfo)
*/
public ErrorInfo getErrorInfo(HttpServletRequest request) {
return getErrorInfo(request, getError(request));
}
/**
* 构建错误信息.(ErrorInfo)
*/
public ErrorInfo getErrorInfo(HttpServletRequest request, Throwable error) {
ErrorInfo errorInfo = new ErrorInfo();
errorInfo.setTime(LocalDateTime.now().toString());
errorInfo.setUrl(request.getRequestURL().toString());
errorInfo.setError(error.toString());
errorInfo.setStatusCode(getHttpStatus(request).value());
errorInfo.setReasonPhrase(getHttpStatus(request).getReasonPhrase());
errorInfo.setStackTrace(getStackTraceInfo(error, isIncludeStackTrace(request)));
return errorInfo;
}
/**
* 获取错误.(Error/Exception)
* <p>
* 获取方式:通过Request对象获取(Key="javax.servlet.error.exception").
*
* @see DefaultErrorAttributes #addErrorDetails
*/
public Throwable getError(HttpServletRequest request) {
//根据HandlerExceptionResolver接口方法来获取错误.
Throwable error = (Throwable) request.getAttribute(ERROR_NAME);
//根据Request对象获取错误.
if (error == null) {
error = (Throwable) request.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE);
}
//当获取错误非空,取出RootCause.
if (error != null) {
while (error instanceof ServletException && error.getCause() != null) {
error = error.getCause();
}
}//当获取错误为null,此时我们设置错误信息即可.
else {
String message = (String) request.getAttribute(WebUtils.ERROR_MESSAGE_ATTRIBUTE);
if (StringUtils.isEmpty(message)) {
HttpStatus status = getHttpStatus(request);
message = "Unknown Exception But " + status.value() + " " + status.getReasonPhrase();
}
error = new Exception(message);
}
return error;
}
/**
* 获取通信状态(HttpStatus)
*
* @see AbstractErrorController #getStatus
*/
public HttpStatus getHttpStatus(HttpServletRequest request) {
Integer statusCode = (Integer) request.getAttribute(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE);
try {
return statusCode != null ? HttpStatus.valueOf(statusCode) : HttpStatus.INTERNAL_SERVER_ERROR;
} catch (Exception ex) {
return HttpStatus.INTERNAL_SERVER_ERROR;
}
}
/**
* 获取堆栈轨迹(StackTrace)
*
* @see DefaultErrorAttributes #addStackTrace
*/
public String getStackTraceInfo(Throwable error, boolean flag) {
if (!flag) {
return "omitted";
}
StringWriter stackTrace = new StringWriter();
error.printStackTrace(new PrintWriter(stackTrace));
stackTrace.flush();
return stackTrace.toString();
}
/**
* 判断是否包含堆栈轨迹.(isIncludeStackTrace)
*
* @see BasicErrorController #isIncludeStackTrace
*/
public boolean isIncludeStackTrace(HttpServletRequest request) {
//读取错误配置(server.error.include-stacktrace=NEVER)
IncludeStacktrace includeStacktrace = errorProperties.getIncludeStacktrace();
//情况1:若IncludeStacktrace为ALWAYS
if (includeStacktrace == IncludeStacktrace.ALWAYS) {
return true;
}
//情况2:若请求参数含有trace
if (includeStacktrace == IncludeStacktrace.ON_TRACE_PARAM) {
String parameter = request.getParameter("trace");
return parameter != null && !"false".equals(parameter.toLowerCase());
}
//情况3:其它情况
return false;
}
/**
* 保存错误/异常.
*
* @see DispatcherServlet #processHandlerException 进行选举HandlerExceptionResolver
*/
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
request.setAttribute(ERROR_NAME, ex);
return null;
}
/**
* 提供优先级 或用于排序
*/
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}
| [
"969989647@qq.com"
] | 969989647@qq.com |
10d45b7e1f83779d03f13dd1875db00cc08a25dd | ea4da81a69a300624a46fce9e64904391c37267c | /src/main/java/com/alipay/api/response/AlipayOpenPublicGisQueryResponse.java | 79cb0f7db28c4e5248f31f81e7706dea9ef3a5d7 | [
"Apache-2.0"
] | permissive | shiwei1024/alipay-sdk-java-all | 741cc3cb8cf757292b657ce05958ff9ad8ecf582 | d6a051fd47836c719a756607e6f84fee2b26ecb4 | refs/heads/master | 2022-12-29T18:46:53.195585 | 2020-10-09T06:34:30 | 2020-10-09T06:34:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,543 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.open.public.gis.query response.
*
* @author auto create
* @since 1.0, 2020-08-25 11:05:59
*/
public class AlipayOpenPublicGisQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 6393759826277923757L;
/**
* 精确度
*/
@ApiField("accuracy")
private String accuracy;
/**
* 经纬度所在位置
*/
@ApiField("city")
private String city;
/**
* 纬度信息
*/
@ApiField("latitude")
private String latitude;
/**
* 经度信息
*/
@ApiField("longitude")
private String longitude;
/**
* 经纬度对应位置所在的省份
*/
@ApiField("province")
private String province;
public void setAccuracy(String accuracy) {
this.accuracy = accuracy;
}
public String getAccuracy( ) {
return this.accuracy;
}
public void setCity(String city) {
this.city = city;
}
public String getCity( ) {
return this.city;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLatitude( ) {
return this.latitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLongitude( ) {
return this.longitude;
}
public void setProvince(String province) {
this.province = province;
}
public String getProvince( ) {
return this.province;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
5a0bf0ce884f3fd961e2403b689cdced6749c353 | 75f6d4b25f740acfddd65389f805509e8f23ba87 | /src/main/java/com/project/expensetracker/entity/Expense.java | 1adca6d6771d1820b4e59d4d8cbdcd9a5eb109d6 | [] | no_license | bhavina36/expenseTrackerService | 2093a0bc7775a95dc6a83c2f29724004b961beb8 | fb6a1ba39b4c75da1fd28896ad9708be187a818c | refs/heads/master | 2022-11-18T03:36:21.693799 | 2020-07-06T20:09:23 | 2020-07-06T20:09:23 | 261,612,597 | 0 | 0 | null | 2020-07-06T20:09:25 | 2020-05-06T00:20:23 | Java | UTF-8 | Java | false | false | 1,367 | java | package com.project.expensetracker.entity;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "expenses")
public class Expense {
@Id
private String id;
private String email;
private double amount;
private String transactionDate;
private Merchant merchant;
private CategoryLabel categoryLabel;
private String category;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getTransactionDate() {
return transactionDate;
}
public void setTransactionDate(String transactionDate) {
this.transactionDate = transactionDate;
}
public Merchant getMerchant() {
return merchant;
}
public void setMerchant(Merchant merchant) {
this.merchant = merchant;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public CategoryLabel getCategoryLabel() {
return categoryLabel;
}
public void setCategoryLabel(CategoryLabel categoryLabel) {
this.categoryLabel = categoryLabel;
}
}
| [
"bhavinak.mistry@gmail.com"
] | bhavinak.mistry@gmail.com |
e07c2135beda8c10a7b0365bf02ee52d7c74dc51 | 3466a89878072aa99423a8c070064a7b7be720a0 | /SpaceDefender/src/enemy/EnemyShotSystem.java | e7d51a4e25013d0d1c6ec56422094865ceb0a99c | [] | no_license | pallemusen/SpaceDefender | 03a1953ca69c06ce9acfcb832c870a285c054cdc | 550bf2418d54ba850fb9aa543cbdf7b77455247f | refs/heads/master | 2020-05-26T21:22:33.249040 | 2013-12-24T02:45:24 | 2013-12-24T02:50:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package enemy;
import java.awt.Graphics;
import java.util.ArrayList;
public class EnemyShotSystem {
public ArrayList<EnemyShot> shots;
private int id;
public EnemyShotSystem(int id) {
this.id = id;
shots = new ArrayList<EnemyShot>();
}
public void enemyFire(int x, int y, int dmg, int speed) {
System.out.println(" --- Shot fired... ---");
shots.add(new EnemyShot(x, y, dmg, speed, id));
System.out.println("Shot added to array.");
for(int i = 0; i < shots.size(); i++) {
System.out.println("Shots: "+i);
}
}
public void paint(Graphics g) {
for(int i = 0; i < shots.size(); i++) {
shots.get(i).paint(g);
}
}
}
| [
"pallemusenxd@gmail.com"
] | pallemusenxd@gmail.com |
b3682b416ba4812196eca5f31a1321b1cc4c960f | 6755879001a72e154541c2ce03ceedbebed0c7e6 | /src/test/java/org/frekele/demo/data/analyzer/factory/SaleItemFactoryTest.java | aba34ed7dada00695c9a6c37f8de0cdc36c560e7 | [
"MIT"
] | permissive | JeffersonSilveira/data-analyzer-demo | 5fd9addc6df47f5afbd03a8a615a55af86ca2d23 | 3b090e3614c3e33cdabb1b6d51e5bddacbbbb9af | refs/heads/master | 2022-04-05T01:41:37.798294 | 2020-02-05T14:45:00 | 2020-02-05T14:45:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,180 | java | package org.frekele.demo.data.analyzer.factory;
import org.frekele.demo.data.analyzer.enums.LayoutMatcherRegexEnum;
import org.frekele.demo.data.analyzer.model.SaleItem;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import static org.junit.jupiter.api.Assertions.*;
public class SaleItemFactoryTest extends BaseFactoryTest {
private SaleItemFactory saleItemFactory;
@BeforeEach
public void setUp() {
this.saleItemFactory = new SaleItemFactoryImpl();
}
@Test
public void createSaleItemFactoryWithSuccessTest() {
String line = "[1-10-100]";
Matcher matcher = getMatcherByLayout(line, LayoutMatcherRegexEnum.SALE_ITEM);
matcher.find();
SaleItem saleItem = saleItemFactory.create(matcher);
assertEquals(mockSaleItemWithAllFields().toString(), saleItem.toString());
}
private SaleItem mockSaleItemWithAllFields() {
SaleItem saleItem = new SaleItem();
saleItem.setId(1L);
saleItem.setPrice(BigDecimal.valueOf(100));
saleItem.setQuantity(10);
return saleItem;
}
}
| [
"leandro@frekele.org"
] | leandro@frekele.org |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.