blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2c61685e7a865e6fd616b8d3bce686944d219d1a | e42bf1446f880069ef7b45991764d526a229ddd1 | /StoreDataModel.java | a7f712452f24ca4612b1547de0d5652488756152 | [
"Apache-2.0"
] | permissive | shivbt/Unit | 892b6636d8c266fca98a2a952166c52151219d60 | 39844135626723d276e60431ef3f899b33cd711f | refs/heads/master | 2022-11-22T14:12:18.549451 | 2020-07-22T13:06:47 | 2020-07-22T13:06:47 | 281,678,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,989 | java | package com.ikai.unit.dataModels;
public class StoreDataModel {
private static final String LOG_TAG = StoreDataModel.class.getSimpleName();
//This field will store name of the shop
private String storeName;
//This field will store URL of image resource in a String
private String storeThumbnailImage;
//This field will store if customer will favorite the store
private boolean favoriteShop = false;
/**
*
* @param storeName Name of the store
* @param storeThumbnailImage image url of store image thumbnail
* @param favoriteShop option to make a shop favourite
*/
public StoreDataModel(String storeName, String storeThumbnailImage,
boolean favoriteShop) {
this.storeName = storeName;
this.storeThumbnailImage = storeThumbnailImage;
this.favoriteShop = favoriteShop;
}
//overloading constructor for default values
public StoreDataModel(String storeName, String storeThumbnailImage) {
this.storeName = storeName;
this.storeThumbnailImage = storeThumbnailImage;
this.favoriteShop = false;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStoreThumbnailImage() {
return storeThumbnailImage;
}
public void setStoreThumbnailImage(String storeThumbnailImage) {
this.storeThumbnailImage = storeThumbnailImage;
}
public boolean isFavoriteShop() {
return favoriteShop;
}
public void setFavoriteShop(boolean favoriteShop) {
this.favoriteShop = favoriteShop;
}
@Override
public String toString() {
return "StoreDataModel{" +
"storeName='" + storeName + '\'' +
", storeThumbnailImage='" + storeThumbnailImage + '\'' +
", favoriteShop=" + favoriteShop +
'}';
}
}
| [
"noreply@github.com"
] | noreply@github.com |
42bf9b67d32805df2758a276ccad2a0ea590a156 | 56801c7d97e1de0ebadb0062081a2ccbc8cfbaf1 | /Service_Java/Java_sample_C3_W1/3_Random_Img/src/main/java/com/example/demo/ImgController.java | 49578b53559a148431212fce0992b05847312ffb | [] | no_license | CharlotteH86/Javasamples_2020 | 18f93352d9c451426afc8eaefc7e0eb17a411872 | 5dea3ad74c84dc37d78b3f7d392eb5e9d2a9ff33 | refs/heads/master | 2023-09-04T07:08:34.839608 | 2021-10-19T19:44:21 | 2021-10-19T19:44:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package com.example.demo;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.MediaType;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@RestController
public class ImgController {
@RequestMapping(value = "/img", method = RequestMethod.GET, produces = MediaType.IMAGE_JPEG_VALUE)
public void getImage(HttpServletResponse response) throws IOException {
var imgFile = new ClassPathResource("img/strawberry.jpg");
if (Math.random() < 0.5) {
imgFile = new ClassPathResource("img/blueberry.jpg");
}
response.setContentType(MediaType.IMAGE_JPEG_VALUE);
StreamUtils.copy(imgFile.getInputStream(), response.getOutputStream());
}
}
| [
"mj.emeth@gmail.com"
] | mj.emeth@gmail.com |
53d93295350396835574464a9562dc6db61ed012 | 423c81e2c68c0c445c3820c220bf107b1d902cb9 | /Webshop-Root/WebshopAdmin/src/main/java/com/cg/petsupply/admin/webconfig/AdminWebMvcConfig.java | 8870448591d98121dc70009d25e7109c5726bff5 | [] | no_license | sanjaycaphub/CGWebshopSanjay | 482501dc198cad87851a21b14da5629b9713849f | 743d00f99fb2968127eaa5f5ba99ffa6dba27da5 | refs/heads/master | 2021-01-02T22:50:38.549510 | 2015-07-08T13:37:18 | 2015-07-08T13:37:18 | 37,589,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | package com.cg.petsupply.admin.webconfig;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
* Java based configuration of Spring MVC for Webshop Admin Module
* @author ssukheja
*/
@Configuration
@ComponentScan("com.cg.petsupply.admin.controllers")
@EnableWebMvc
public class AdminWebMvcConfig {
/**
* Registering InternalResourceViewResolver as ViewResolver for this Spring
* MVC app
*
* @return
*/
@Bean
public InternalResourceViewResolver setupViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
/**
* Registering ResourceBundleMessageSource as a resourcebundle for reading
* properties file in Spring MVC
*
* @return
*/
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource resourceBundle = new ReloadableResourceBundleMessageSource();
resourceBundle.setBasename("classpath:messages");
return resourceBundle;
}
}
| [
"sanjay.sukheja@capgemini.com"
] | sanjay.sukheja@capgemini.com |
80e4da32823cce80bed32a297b20f0a9a1037cdf | e91854ee028eed593fbf1dd0d95b2e582cf09b4e | /src/main/java/org/halim/attendance/frames/AttendanceFrame.java | 68c7ec4137146265e51a15616ed9b213f80ce1d4 | [] | no_license | Intelligent-Halim/employee-attendance-monitor | 8519ae7e1821e94573dcd9049c61de576655ebc0 | c1fdce320fd7e70d8eb7f0072ba66b59b2b62f30 | refs/heads/master | 2020-03-23T07:15:32.589631 | 2018-07-17T08:51:50 | 2018-07-17T08:51:50 | 141,258,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,246 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.halim.attendance.frames;
import java.awt.Point;
import org.halim.utils.TimeMainpulator;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import org.halim.Model.Employee;
import org.halim.controller.EmployeeController;
import org.halim.controller.EmployeeWorkingHoursController;
import org.halim.utils.Screen;
/**
*
* @author ABDELHALIM
*/
public class AttendanceFrame extends javax.swing.JFrame {
int employee_ID;
static int counter = 0;
static String currentTime;
Timer timer = null;
TimerTask task = null;
static boolean state;
static boolean arrived = false;
HistoryFrame historyFrame;
/**
* Creates new form Attendance
*
* @param employee_ID
*/
public AttendanceFrame(int employee_ID) {
initComponents();
this.employee_ID = employee_ID;
}
/**
* 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() {
jMenu1 = new javax.swing.JMenu();
jPanel1 = new javax.swing.JPanel();
stopButton = new javax.swing.JButton();
elapsedTime = new javax.swing.JLabel();
depatureTimeValue = new javax.swing.JLabel();
submitButton = new javax.swing.JButton();
start_pause_button = new javax.swing.JToggleButton();
arrivalTime = new javax.swing.JLabel();
depatureTime = new javax.swing.JLabel();
workingHours = new javax.swing.JLabel();
arrivalTimeValue = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
employeeID = new javax.swing.JLabel();
historyButton = new javax.swing.JButton();
jMenu1.setText("jMenu1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Attendance Dashboard");
setName("attendanceFrame"); // NOI18N
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
stopButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\ABDELHALIM\\Documents\\NetBeansProjects\\attendance\\resources\\images\\stop.png")); // NOI18N
stopButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
stopButtonActionPerformed(evt);
}
});
elapsedTime.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
elapsedTime.setText("Working Hours :");
depatureTimeValue.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
depatureTimeValue.setText("00 : 00 : 00");
submitButton.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
submitButton.setText("Submit Time");
submitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitButtonActionPerformed(evt);
}
});
start_pause_button.setBackground(new java.awt.Color(255, 255, 255));
start_pause_button.setIcon(new javax.swing.ImageIcon("C:\\Users\\ABDELHALIM\\Documents\\NetBeansProjects\\attendance\\resources\\images\\start.png")); // NOI18N
start_pause_button.setName("start_pause_button"); // NOI18N
start_pause_button.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
start_pause_buttonItemStateChanged(evt);
}
});
arrivalTime.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
arrivalTime.setText("Arrival Time :");
depatureTime.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
depatureTime.setText("Departure time :");
depatureTime.setToolTipText("");
workingHours.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
workingHours.setText("00 : 00 : 00");
arrivalTimeValue.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
arrivalTimeValue.setText("00 : 00 : 00");
arrivalTimeValue.setToolTipText("");
jLabel1.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
jLabel1.setText("Good Morning, ");
jLabel1.setToolTipText("");
employeeID.setToolTipText("");
historyButton.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
historyButton.setText("Attendance History ");
historyButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
historyButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(start_pause_button, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(stopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(employeeID)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 125, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(elapsedTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(depatureTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(arrivalTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(depatureTimeValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(workingHours, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(arrivalTimeValue, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(submitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(historyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(workingHours)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(elapsedTime)
.addComponent(jLabel1)
.addComponent(employeeID))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(arrivalTime)
.addComponent(arrivalTimeValue))))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(depatureTimeValue)
.addComponent(depatureTime))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(submitButton, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
.addComponent(historyButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 45, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(start_pause_button, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(stopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)))))
);
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)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void start_pause_buttonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_start_pause_buttonItemStateChanged
if (start_pause_button.isSelected()) {
//start working
start_pause_button.setIcon(new ImageIcon("resources\\images\\pause.png"));
state = true;
if (!arrived) {
arrivalTimeValue.setText(displayTime());
arrived = true;
timer = new Timer();
task = new TimerTask() {
@Override
public void run() {
if (state) {
currentTime = TimeMainpulator.getTime(counter);
workingHours.setText(currentTime);
counter++;
}
}
};
timer.schedule(task, 1, 1000);
}
} else {
//pause working
start_pause_button.setIcon(new ImageIcon("resources\\images\\start.png"));
state = false;
}
}//GEN-LAST:event_start_pause_buttonItemStateChanged
private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed
// TODO add your handling code here:
int optionSelected = JOptionPane.showConfirmDialog(this, "Woking Hours will be reset, Are you sure about that ?", "Reset Working Hours", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (optionSelected == JOptionPane.YES_OPTION) {
workingHours.setText("00 : 00 : 00");
counter = 0;
start_pause_button.setSelected(false);
arrivalTimeValue.setText("00 : 00 : 00");
arrived = false;
}
}//GEN-LAST:event_stopButtonActionPerformed
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed
// TODO add your handling code here:
start_pause_button.setSelected(false);
depatureTimeValue.setText(displayTime());
int optionSelected = JOptionPane.showConfirmDialog(this, "Day of work details : \n"
+ "Arrival Time : " + arrivalTimeValue.getText() + "\n"
+ "Depature Time : " + depatureTimeValue.getText() + "\n"
+ "Working Hours : " + workingHours.getText() + "\n"
+ "Are you sure for submitting your information ?", "Submit My Working Hours",
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (optionSelected == JOptionPane.YES_OPTION) {
String[] totalWorkingHours = workingHours.getText().split(" : ");
//DAO
EmployeeWorkingHoursController employeeController = new EmployeeWorkingHoursController();
Employee employee = new Employee(employee_ID,
getDate(), Integer.parseInt(totalWorkingHours[0]),
Integer.parseInt(totalWorkingHours[1]), Integer.parseInt(totalWorkingHours[2]),
arrivalTimeValue.getText().trim(), depatureTimeValue.getText().trim());
employeeController.submitWorkingHours(employee);
//close application
this.dispose();
System.exit(0);
} else if (optionSelected == JOptionPane.NO_OPTION) {
start_pause_button.setSelected(true);
depatureTimeValue.setText("00 : 00 : 00");
}
}//GEN-LAST:event_submitButtonActionPerformed
private void historyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_historyButtonActionPerformed
// TODO add your handling code here:
if (historyFrame == null) {
historyFrame = new HistoryFrame(employee_ID);
historyFrame.setVisible(true);
}
}//GEN-LAST:event_historyButtonActionPerformed
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
this.setLocation(new Point((Screen.getScreenWidth(50) - this.getSize().width / 2),
(Screen.getScreenHeight(50)) - this.getSize().height / 2));
employeeID.setText(new EmployeeController().getEmployeeName(employee_ID));
}//GEN-LAST:event_formWindowOpened
private String displayTime() {
Calendar calendar = Calendar.getInstance();
return "" + calendar.get(Calendar.HOUR) + " : "
+ calendar.get(Calendar.MINUTE) + " : " + calendar.get(Calendar.SECOND);
}
private String getDate() {
Calendar calendar = Calendar.getInstance();
return calendar.getTime().toString();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel arrivalTime;
private javax.swing.JLabel arrivalTimeValue;
private javax.swing.JLabel depatureTime;
private javax.swing.JLabel depatureTimeValue;
private javax.swing.JLabel elapsedTime;
private javax.swing.JLabel employeeID;
private javax.swing.JButton historyButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu1;
private javax.swing.JPanel jPanel1;
private javax.swing.JToggleButton start_pause_button;
private javax.swing.JButton stopButton;
private javax.swing.JButton submitButton;
private javax.swing.JLabel workingHours;
// End of variables declaration//GEN-END:variables
}
| [
"abdelhalem_2031@yahoo.com"
] | abdelhalem_2031@yahoo.com |
b16999287f78b6667dfa6d07cd40c0a83741efc8 | b5aa9b8ed6853bf1a405ead3eb8807dfd0abb589 | /scanlibrary/src/main/java/com/scanlibrary/ScanFragment.java | e30e68cf79e88d27afdbb9ddddb15ece16266c48 | [] | no_license | kritikkoolz/Soft-Doc | c44fceb5496db28296824e580a3bba937c217d67 | de84d121c18c96030fcfa721aedace9c7af216a7 | refs/heads/master | 2022-12-10T16:25:48.988263 | 2020-09-10T14:21:32 | 2020-09-10T14:21:32 | 274,886,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,588 | java | package com.scanlibrary;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ScanFragment extends Fragment {
private Button scanButton;
private ImageView sourceImageView;
private FrameLayout sourceFrame;
private PolygonView polygonView;
private View view;
private ProgressDialogFragment progressDialogFragment;
private IScanner scanner;
private Bitmap original;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (!(activity instanceof IScanner)) {
throw new ClassCastException("Activity must implement IScanner");
}
this.scanner = (IScanner) activity;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.scan_fragment_layout, null);
init();
return view;
}
public ScanFragment() {
}
private void init() {
sourceImageView = (ImageView) view.findViewById(R.id.sourceImageView);
scanButton = (Button) view.findViewById(R.id.scanButton);
scanButton.setOnClickListener(new ScanButtonClickListener());
sourceFrame = (FrameLayout) view.findViewById(R.id.sourceFrame);
polygonView = (PolygonView) view.findViewById(R.id.polygonView);
sourceFrame.post(new Runnable() {
@Override
public void run() {
original = getBitmap();
if (original != null) {
setBitmap(original);
}
}
});
}
private Bitmap getBitmap() {
Uri uri = getUri();
try {
Bitmap bitmap = Utils.getBitmap(getActivity(), uri);
getActivity().getContentResolver().delete(uri, null, null);
return bitmap;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private Uri getUri() {
Uri uri = getArguments().getParcelable(ScanConstants.SELECTED_BITMAP);
return uri;
}
private void setBitmap(Bitmap original) {
Bitmap scaledBitmap = scaledBitmap(original, sourceFrame.getWidth(), sourceFrame.getHeight());
sourceImageView.setImageBitmap(scaledBitmap);
Bitmap tempBitmap = ((BitmapDrawable) sourceImageView.getDrawable()).getBitmap();
Map<Integer, PointF> pointFs = getEdgePoints(tempBitmap);
polygonView.setPoints(pointFs);
polygonView.setVisibility(View.VISIBLE);
int padding = (int) getResources().getDimension(R.dimen.scanPadding);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(tempBitmap.getWidth() + 2 * padding, tempBitmap.getHeight() + 2 * padding);
layoutParams.gravity = Gravity.CENTER;
polygonView.setLayoutParams(layoutParams);
}
private Map<Integer, PointF> getEdgePoints(Bitmap tempBitmap) {
List<PointF> pointFs = getContourEdgePoints(tempBitmap);
Map<Integer, PointF> orderedPoints = orderedValidEdgePoints(tempBitmap, pointFs);
return orderedPoints;
}
private List<PointF> getContourEdgePoints(Bitmap tempBitmap) {
float[] points = ((ScanActivity) getActivity()).getPoints(tempBitmap);
float x1 = points[0];
float x2 = points[1];
float x3 = points[2];
float x4 = points[3];
float y1 = points[4];
float y2 = points[5];
float y3 = points[6];
float y4 = points[7];
List<PointF> pointFs = new ArrayList<>();
pointFs.add(new PointF(x1, y1));
pointFs.add(new PointF(x2, y2));
pointFs.add(new PointF(x3, y3));
pointFs.add(new PointF(x4, y4));
return pointFs;
}
private Map<Integer, PointF> getOutlinePoints(Bitmap tempBitmap) {
Map<Integer, PointF> outlinePoints = new HashMap<>();
outlinePoints.put(0, new PointF(0, 0));
outlinePoints.put(1, new PointF(tempBitmap.getWidth(), 0));
outlinePoints.put(2, new PointF(0, tempBitmap.getHeight()));
outlinePoints.put(3, new PointF(tempBitmap.getWidth(), tempBitmap.getHeight()));
return outlinePoints;
}
private Map<Integer, PointF> orderedValidEdgePoints(Bitmap tempBitmap, List<PointF> pointFs) {
Map<Integer, PointF> orderedPoints = polygonView.getOrderedPoints(pointFs);
if (!polygonView.isValidShape(orderedPoints)) {
orderedPoints = getOutlinePoints(tempBitmap);
}
return orderedPoints;
}
private class ScanButtonClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
Map<Integer, PointF> points = polygonView.getPoints();
if (isScanPointsValid(points)) {
new ScanAsyncTask(points).execute();
} else {
showErrorDialog();
}
}
}
private void showErrorDialog() {
SingleButtonDialogFragment fragment = new SingleButtonDialogFragment(R.string.ok, getString(R.string.cantCrop), "Error", true);
FragmentManager fm = getActivity().getFragmentManager();
fragment.show(fm, SingleButtonDialogFragment.class.toString());
}
private boolean isScanPointsValid(Map<Integer, PointF> points) {
return points.size() == 4;
}
private Bitmap scaledBitmap(Bitmap bitmap, int width, int height) {
Matrix m = new Matrix();
m.setRectToRect(new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight()), new RectF(0, 0, width, height), Matrix.ScaleToFit.CENTER);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
}
private Bitmap getScannedBitmap(Bitmap original, Map<Integer, PointF> points) {
int width = original.getWidth();
int height = original.getHeight();
float xRatio = (float) original.getWidth() / sourceImageView.getWidth();
float yRatio = (float) original.getHeight() / sourceImageView.getHeight();
float x1 = (points.get(0).x) * xRatio;
float x2 = (points.get(1).x) * xRatio;
float x3 = (points.get(2).x) * xRatio;
float x4 = (points.get(3).x) * xRatio;
float y1 = (points.get(0).y) * yRatio;
float y2 = (points.get(1).y) * yRatio;
float y3 = (points.get(2).y) * yRatio;
float y4 = (points.get(3).y) * yRatio;
Log.d("", "POints(" + x1 + "," + y1 + ")(" + x2 + "," + y2 + ")(" + x3 + "," + y3 + ")(" + x4 + "," + y4 + ")");
Bitmap _bitmap = ((ScanActivity) getActivity()).getScannedBitmap(original, x1, y1, x2, y2, x3, y3, x4, y4);
return _bitmap;
}
private class ScanAsyncTask extends AsyncTask<Void, Void, Bitmap> {
private Map<Integer, PointF> points;
public ScanAsyncTask(Map<Integer, PointF> points) {
this.points = points;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgressDialog(getString(R.string.scanning));
}
@Override
protected Bitmap doInBackground(Void... params) {
Bitmap bitmap = getScannedBitmap(original, points);
Uri uri = Utils.getUri(getActivity(), bitmap);
scanner.onScanFinish(uri);
return bitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
bitmap.recycle();
dismissDialog();
}
}
protected void showProgressDialog(String message) {
progressDialogFragment = new ProgressDialogFragment(message);
FragmentManager fm = getFragmentManager();
progressDialogFragment.show(fm, ProgressDialogFragment.class.toString());
}
protected void dismissDialog() {
progressDialogFragment.dismissAllowingStateLoss();
}
} | [
"kritik.1822csi1016@kiet.edu"
] | kritik.1822csi1016@kiet.edu |
4951f0f03b35da76b490f803361d613f91c28d5b | 6496c51d529b320857588becef79b7d85fd0c977 | /src/main/java/com/gmail/mosoft521/ConcurrencyTest.java | 89d33a8bdea19508e79eab7ea2a0a603ca142539 | [] | no_license | mosoft521/jcstress | 052fa1f6f2546798995f33a4a5dd20e3fc1efb0c | 4b6f05e2f374b84862b59a49f8fb11627c411c0b | refs/heads/master | 2021-01-19T18:21:37.009874 | 2017-08-23T02:45:12 | 2017-08-23T02:45:12 | 100,951,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,207 | java | /*
* Copyright (c) 2017, Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Oracle nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.gmail.mosoft521;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.II_Result;
// See jcstress-samples or existing tests for API introduction and testing guidelines
@JCStressTest
// Outline the outcomes here. The default outcome is provided, you need to remove it:
@Outcome(id = "0, 0", expect = Expect.ACCEPTABLE, desc = "Default outcome.")
@State
public class ConcurrencyTest {
@Actor
public void actor1(II_Result r) {
// Put the code for first thread here
}
@Actor
public void actor2(II_Result r) {
// Put the code for second thread here
}
}
| [
"zhangjiawen@vcredit.com"
] | zhangjiawen@vcredit.com |
c6587d2e8bf198abf2027312f0233496dcdd7870 | fa7978ce0fb0d1d2be022d5f116f440b7a3f91f8 | /app/src/main/java/smart/msocial/worker/staff/SemesterFourFragment.java | d6131717744c1b69303b5c8f7563483f5023095b | [] | no_license | gopalrobo/Smart_social_submitted | 9e83c15606216bdd3b27d0cb504981a3e7e56c6c | 899fe48281885110832e68a5dcd5dd853bd1f8fb | refs/heads/master | 2022-12-28T04:09:52.352198 | 2020-09-29T04:35:04 | 2020-09-29T04:35:04 | 299,504,827 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,738 | java | package smart.msocial.worker.staff;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.androidadvance.androidsurvey.SurveyActivity;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import smart.msocial.worker.CustomMarkerClusteringDemoActivity;
import smart.msocial.worker.DividerItemDecoration;
import smart.msocial.worker.FinalReport;
import smart.msocial.worker.MainActivityVideo;
import smart.msocial.worker.MapsFragActivity;
import smart.msocial.worker.Pra;
import smart.msocial.worker.R;
import smart.msocial.worker.TeamMember;
import smart.msocial.worker.VideoClick;
import smart.msocial.worker.app.AppConfig;
import static android.app.Activity.RESULT_OK;
public class SemesterFourFragment extends Fragment implements VideoClick {
private List<Pra> praList = new ArrayList<>();
private RecyclerView recyclerView;
private SemesterFourAdapter mAdapter;
SharedPreferences sharedpreferences;
public static final String mypreference = "mypref";
public static final String tittle = "tittleKey";
private static final int SURVEY_REQUEST = 1337;
private View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.activity_main_fragment, container, false);
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
mAdapter = new SemesterFourAdapter(praList, getActivity(), this);
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(mAdapter);
prepareMovieData();
return view;
}
private void prepareMovieData() {
Pra pra = new Pra("Theory", "oKbj3y-LUbw", "", AppConfig.URL);
praList.add(pra);
// pra = new Pra("Training", "oKbj3y-LUbw", "", AppConfig.URL);
// praList.add(pra);
// pra = new Pra("Rural Camp", "oKbj3y-LUbw", "", AppConfig.URL);
// praList.add(pra);
pra = new Pra("Fieldwork", "oKbj3y-LUbw", "", AppConfig.URL);
praList.add(pra);
pra = new Pra("Presentation for Seminar", "oKbj3y-LUbw", "", AppConfig.URL);
praList.add(pra);
pra = new Pra("Assignment", "oKbj3y-LUbw", "", AppConfig.URL);
praList.add(pra);
pra = new Pra("Block Placement", "oKbj3y-LUbw", "", AppConfig.URL);
praList.add(pra);
// pra = new Pra("ResearchActivity Project", "oKbj3y-LUbw", "", AppConfig.URL);
// praList.add(pra);
mAdapter.notifyDataSetChanged();
}
@Override
public void videoClick(int position) {
if (praList.get(position).getYear().equals("true")) {
Intent io = new Intent(getActivity(), TeamMember.class);
startActivity(io);
} else {
Intent io = new Intent(getActivity(), MainActivityVideo.class);
io.putExtra("video", praList.get(position).getGenre());
startActivity(io);
}
}
@Override
public void webClick(int position) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(praList.get(position).getUrl()));
startActivity(browserIntent);
}
@Override
public void mapClick(int position) {
Intent io = new Intent(getActivity(), MapsFragActivity.class);
io.putExtra("tittle", praList.get(position).getTitle());
startActivity(io);
}
@Override
public void imageClick(int position) {
sharedpreferences = getActivity().getSharedPreferences(mypreference,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(tittle, "SEMESTER 4");
editor.commit();
Intent io = new Intent(getActivity(), CustomMarkerClusteringDemoActivity.class);
io.putExtra("tittle", praList.get(position).getTitle());
startActivity(io);
}
@Override
public void reportClick(int position) {
sharedpreferences = getActivity().getSharedPreferences(mypreference,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(tittle, "SEMESTER 4");
editor.commit();
Intent io = new Intent(getActivity(), FinalReport.class);
startActivity(io);
}
@Override
public void tittleClick(int position) {
Intent i_survey = new Intent(getActivity(), SurveyActivity.class);
//you have to pass as an extra the json string.
i_survey.putExtra("json_survey", loadSurveyJson("example_survey_1.json"));
startActivityForResult(i_survey, SURVEY_REQUEST);
}
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.menu_main, menu);
// return true;
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// // Handle action bar item clicks here. The action bar will
// // automatically handle clicks on the Home/Up button, so long
// // as you specify a parent activity in AndroidManifest.xml.
// int id = item.getItemId();
//
// //noinspection SimplifiableIfStatement
// if (id == R.id.profile) {
// Intent io = new Intent(getActivity(), ProfileActivity.class);
// startActivity(io);
// return true;
// }
// if (id == R.id.timeTable) {
// Intent io = new Intent(getActivity(), MainActivityEvent.class);
// startActivity(io);
// return true;
// }
//
// return super.onOptionsItemSelected(item);
// }
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SURVEY_REQUEST) {
if (resultCode == RESULT_OK) {
String answers_json = data.getExtras().getString("answers");
Log.d("****", "****************** WE HAVE ANSWERS ******************");
Log.v("ANSWERS JSON", answers_json);
Log.d("****", "*****************************************************");
//do whatever you want with them...
}
}
}
//json stored in the assets folder. but you can get it from wherever you like.
private String loadSurveyJson(String filename) {
try {
InputStream is = getActivity().getAssets().open(filename);
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
return new String(buffer, "UTF-8");
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
}
}
| [
"gopal.ecretail@gmail.com"
] | gopal.ecretail@gmail.com |
55bbda26fbf4ff9a1eb4bf84e5b9c8134eed7b6b | 73208ab420f21e6a4d25b7b598817eb114ede14b | /src/main/java/com/workiva/wdata/grazaitis/bigqueryunemployment/BigqueryUnemploymentApplication.java | 155d5f5711c81d97df7397b0777f3482889f66ea | [] | no_license | pgrazaitis/google-bigquery | 5246c10bcc7cb1cf86304d4d11138b5db0c95dbb | 825ce7807aeffaebd632abbd45a2d8c607acb830 | refs/heads/master | 2020-04-26T16:31:29.254671 | 2019-03-04T05:58:00 | 2019-03-04T05:58:00 | 173,681,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.workiva.wdata.grazaitis.bigqueryunemployment;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BigqueryUnemploymentApplication {
public static void main(String[] args) {
SpringApplication.run(BigqueryUnemploymentApplication.class, args);
}
}
| [
"pgrazaitis@gmail.com"
] | pgrazaitis@gmail.com |
50773dd164d33010733d5666d3684b7b04274f52 | 279038953035525fe9855ce54b1a465b7f3c5f9c | /myblogs_common/src/main/java/com/xk/myblogs/common/demo/functional/SupplierDemo.java | fd60c61ee8fcc5c8c0b0e2f4114f2c8e69f47344 | [] | no_license | tscxk/myblogs | f152facf9cd5cd7dc8f7cd4c8b56b74c2dfc5feb | 029f109f0e92643017659298f5f23ca74717e5d3 | refs/heads/master | 2023-04-13T21:07:23.555459 | 2020-08-11T11:58:01 | 2020-08-11T11:58:01 | 234,834,056 | 0 | 0 | null | 2020-01-19T03:24:01 | 2020-01-19T03:24:00 | null | UTF-8 | Java | false | false | 839 | java | package com.xk.myblogs.common.demo.functional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
* 供给型函数式Demo
* @author: tian
* @date: 2020/8/5 18:03
*/
public class SupplierDemo {
public static void main(String[] args) {
//定义一个数组
int[] arr = {15, 20, 3, 65, 45, 6};
int x = getMax(() -> {
int Max = arr[0];
for (int i = 0; i < arr.length; i++) {
if (Max < arr[i]) {
Max = arr[i];
}
}
return Max;
});
System.out.println(x);
int y = getMax(() -> 200);
System.out.println(y);
}
private static int getMax(Supplier<Integer> sup) {
return sup.get();
}
}
| [
"952505116@qq.com"
] | 952505116@qq.com |
c37b94bf8e2743f58fcb964a80068b3c0d96dec7 | 96ccf9bb53c34de89bc501a876207d25054cb8d7 | /dts-dao/src/main/java/com/qiguliuxing/dts/db/domain/DtsKeywordExample.java | 696b8334ee22f3d816342fd0df952359f3744ccb | [] | no_license | zhou-github-name/dts-shop | a6d0bf1e6b43634e5e72e9be17ad5e4773ea856f | 6643ddde157df7c1092c82be9b8c73d9ebfd58d7 | refs/heads/main | 2023-02-24T00:55:25.194993 | 2021-01-21T09:42:11 | 2021-01-21T09:42:11 | 331,573,289 | 14 | 6 | null | null | null | null | UTF-8 | Java | false | false | 57,542 | java | package com.qiguliuxing.dts.db.domain;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class DtsKeywordExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_keyword
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_keyword
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_keyword
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public DtsKeywordExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DtsKeywordExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DtsKeywordExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
DtsKeywordExample example = new DtsKeywordExample();
return example.createCriteria();
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dts_keyword
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andKeywordIsNull() {
addCriterion("keyword is null");
return (Criteria) this;
}
public Criteria andKeywordIsNotNull() {
addCriterion("keyword is not null");
return (Criteria) this;
}
public Criteria andKeywordEqualTo(String value) {
addCriterion("keyword =", value, "keyword");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andKeywordEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("keyword = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andKeywordNotEqualTo(String value) {
addCriterion("keyword <>", value, "keyword");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andKeywordNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("keyword <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andKeywordGreaterThan(String value) {
addCriterion("keyword >", value, "keyword");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andKeywordGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("keyword > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andKeywordGreaterThanOrEqualTo(String value) {
addCriterion("keyword >=", value, "keyword");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andKeywordGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("keyword >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andKeywordLessThan(String value) {
addCriterion("keyword <", value, "keyword");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andKeywordLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("keyword < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andKeywordLessThanOrEqualTo(String value) {
addCriterion("keyword <=", value, "keyword");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andKeywordLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("keyword <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andKeywordLike(String value) {
addCriterion("keyword like", value, "keyword");
return (Criteria) this;
}
public Criteria andKeywordNotLike(String value) {
addCriterion("keyword not like", value, "keyword");
return (Criteria) this;
}
public Criteria andKeywordIn(List<String> values) {
addCriterion("keyword in", values, "keyword");
return (Criteria) this;
}
public Criteria andKeywordNotIn(List<String> values) {
addCriterion("keyword not in", values, "keyword");
return (Criteria) this;
}
public Criteria andKeywordBetween(String value1, String value2) {
addCriterion("keyword between", value1, value2, "keyword");
return (Criteria) this;
}
public Criteria andKeywordNotBetween(String value1, String value2) {
addCriterion("keyword not between", value1, value2, "keyword");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("url is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("url is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("url =", value, "url");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUrlEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("url = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("url <>", value, "url");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUrlNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("url <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("url >", value, "url");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUrlGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("url > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("url >=", value, "url");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUrlGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("url >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("url <", value, "url");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUrlLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("url < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("url <=", value, "url");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUrlLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("url <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("url like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("url not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("url in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("url not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("url between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("url not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andIsHotIsNull() {
addCriterion("is_hot is null");
return (Criteria) this;
}
public Criteria andIsHotIsNotNull() {
addCriterion("is_hot is not null");
return (Criteria) this;
}
public Criteria andIsHotEqualTo(Boolean value) {
addCriterion("is_hot =", value, "isHot");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsHotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_hot = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsHotNotEqualTo(Boolean value) {
addCriterion("is_hot <>", value, "isHot");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsHotNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_hot <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsHotGreaterThan(Boolean value) {
addCriterion("is_hot >", value, "isHot");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsHotGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_hot > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsHotGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_hot >=", value, "isHot");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsHotGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_hot >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsHotLessThan(Boolean value) {
addCriterion("is_hot <", value, "isHot");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsHotLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_hot < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsHotLessThanOrEqualTo(Boolean value) {
addCriterion("is_hot <=", value, "isHot");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsHotLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_hot <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsHotIn(List<Boolean> values) {
addCriterion("is_hot in", values, "isHot");
return (Criteria) this;
}
public Criteria andIsHotNotIn(List<Boolean> values) {
addCriterion("is_hot not in", values, "isHot");
return (Criteria) this;
}
public Criteria andIsHotBetween(Boolean value1, Boolean value2) {
addCriterion("is_hot between", value1, value2, "isHot");
return (Criteria) this;
}
public Criteria andIsHotNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_hot not between", value1, value2, "isHot");
return (Criteria) this;
}
public Criteria andIsDefaultIsNull() {
addCriterion("is_default is null");
return (Criteria) this;
}
public Criteria andIsDefaultIsNotNull() {
addCriterion("is_default is not null");
return (Criteria) this;
}
public Criteria andIsDefaultEqualTo(Boolean value) {
addCriterion("is_default =", value, "isDefault");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDefaultEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_default = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDefaultNotEqualTo(Boolean value) {
addCriterion("is_default <>", value, "isDefault");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDefaultNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_default <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDefaultGreaterThan(Boolean value) {
addCriterion("is_default >", value, "isDefault");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDefaultGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_default > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDefaultGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_default >=", value, "isDefault");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDefaultGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_default >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDefaultLessThan(Boolean value) {
addCriterion("is_default <", value, "isDefault");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDefaultLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_default < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDefaultLessThanOrEqualTo(Boolean value) {
addCriterion("is_default <=", value, "isDefault");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDefaultLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("is_default <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDefaultIn(List<Boolean> values) {
addCriterion("is_default in", values, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultNotIn(List<Boolean> values) {
addCriterion("is_default not in", values, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultBetween(Boolean value1, Boolean value2) {
addCriterion("is_default between", value1, value2, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_default not between", value1, value2, "isDefault");
return (Criteria) this;
}
public Criteria andSortOrderIsNull() {
addCriterion("sort_order is null");
return (Criteria) this;
}
public Criteria andSortOrderIsNotNull() {
addCriterion("sort_order is not null");
return (Criteria) this;
}
public Criteria andSortOrderEqualTo(Integer value) {
addCriterion("sort_order =", value, "sortOrder");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSortOrderEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("sort_order = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSortOrderNotEqualTo(Integer value) {
addCriterion("sort_order <>", value, "sortOrder");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSortOrderNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("sort_order <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSortOrderGreaterThan(Integer value) {
addCriterion("sort_order >", value, "sortOrder");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSortOrderGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("sort_order > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSortOrderGreaterThanOrEqualTo(Integer value) {
addCriterion("sort_order >=", value, "sortOrder");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSortOrderGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("sort_order >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSortOrderLessThan(Integer value) {
addCriterion("sort_order <", value, "sortOrder");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSortOrderLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("sort_order < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSortOrderLessThanOrEqualTo(Integer value) {
addCriterion("sort_order <=", value, "sortOrder");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSortOrderLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("sort_order <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSortOrderIn(List<Integer> values) {
addCriterion("sort_order in", values, "sortOrder");
return (Criteria) this;
}
public Criteria andSortOrderNotIn(List<Integer> values) {
addCriterion("sort_order not in", values, "sortOrder");
return (Criteria) this;
}
public Criteria andSortOrderBetween(Integer value1, Integer value2) {
addCriterion("sort_order between", value1, value2, "sortOrder");
return (Criteria) this;
}
public Criteria andSortOrderNotBetween(Integer value1, Integer value2) {
addCriterion("sort_order not between", value1, value2, "sortOrder");
return (Criteria) this;
}
public Criteria andAddTimeIsNull() {
addCriterion("add_time is null");
return (Criteria) this;
}
public Criteria andAddTimeIsNotNull() {
addCriterion("add_time is not null");
return (Criteria) this;
}
public Criteria andAddTimeEqualTo(LocalDateTime value) {
addCriterion("add_time =", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("add_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeNotEqualTo(LocalDateTime value) {
addCriterion("add_time <>", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("add_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeGreaterThan(LocalDateTime value) {
addCriterion("add_time >", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("add_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("add_time >=", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("add_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeLessThan(LocalDateTime value) {
addCriterion("add_time <", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("add_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("add_time <=", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("add_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeIn(List<LocalDateTime> values) {
addCriterion("add_time in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotIn(List<LocalDateTime> values) {
addCriterion("add_time not in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("add_time between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("add_time not between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("update_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("update_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("update_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("update_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(LocalDateTime value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("update_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("update_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("deleted = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedNotEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("deleted <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedGreaterThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("deleted > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedGreaterThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("deleted >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedLessThanColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("deleted < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedLessThanOrEqualToColumn(DtsKeyword.Column column) {
addCriterion(new StringBuilder("deleted <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dts_keyword
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private DtsKeywordExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(DtsKeywordExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DtsKeywordExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLogicalDeleted(boolean deleted) {
return deleted ? andDeletedEqualTo(DtsKeyword.IS_DELETED) : andDeletedNotEqualTo(DtsKeyword.IS_DELETED);
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_keyword
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dts_keyword
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"zhouyworks@163.com"
] | zhouyworks@163.com |
573d53abab958cc7547533c3ae87ba28054158d6 | 28bcb9ac3827021f853f41d727819ec2a30ab7f2 | /src/com/kai/web/controller/OrderManagerController.java | 950eeae20a30d5ac0988fc7adb3f5911e6f5ac0b | [] | no_license | Yaphatesheart/goodStomach | 6d796107af22f30317a787a88697fadaa5ddda28 | e0b0339ac174556410720815579985d0deac34cd | refs/heads/master | 2021-06-05T00:49:45.105354 | 2020-08-17T14:04:41 | 2020-08-17T14:04:41 | 124,157,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,834 | java | package com.kai.web.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import com.kai.bean.Order;
import com.kai.bean.PageBean;
import com.kai.web.service.OrderService;
public class OrderManagerController implements Controller{
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO Auto-generated method stub
OrderService orderService = new OrderService();
List<Order> ordersList = orderService.findAll();
HttpSession session = request.getSession();
String pageId = request.getParameter("id");
int curPage = 0;
if(pageId==null){
curPage = 1;
}else{
curPage = Integer.parseInt(pageId);
}
System.out.println("curPage value is:"+curPage);
PageBean pageBean = new PageBean(ordersList.size());//初始化PageBean对象
//设置当前页
pageBean.setCurPage(curPage);
//这里page是从页面上获取的一个参数,代表页数
//获得分页大小
int pageSize = pageBean.getPageSize();
//获得分页数据在list集合中的索引
int firstIndex = (curPage-1)*pageSize;
int toIndex = curPage*pageSize;
if(toIndex>ordersList.size()){
toIndex = ordersList.size();
}
if(firstIndex>toIndex){
firstIndex = 0;
pageBean.setCurPage(1);
}
List<Order> orderList = ordersList.subList(firstIndex, toIndex);
session.setAttribute("orderList", orderList);
session.setAttribute("pageBean", pageBean);
ModelAndView mv = new ModelAndView();
mv.setViewName("manager/orderManager");
return mv;
}
}
| [
"ouyangrui@ouyangruideMacBook-Pro.local"
] | ouyangrui@ouyangruideMacBook-Pro.local |
55b6dc28651e72ca71c291b780a386d47eec6197 | fdb8d52b59136b0e1e4bf1cb36660538cfa5ab2d | /src/main/java/ssm/pojo/Flightinfor.java | 88ef14b1d707ac500818fa2baa9d90c6cc74ef0b | [] | no_license | rookiePH/airline-reservation-system | ed6c25aff6489f089e6599b6cc9130a223f5c9fe | 1d014ba51acb5695a3b41a458287edd775fc304a | refs/heads/master | 2020-05-01T08:32:38.137871 | 2019-03-24T08:36:23 | 2019-03-24T08:39:15 | 177,381,488 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,392 | java | package ssm.pojo;
import java.util.Date;
public class Flightinfor {
private Integer flightId;
private String company;
private String stacity;
private String tarrcity;
private Date depaturetime;
private Date arrivaltime;
private String flighttype;
private Long price;
private Integer ticketsleft;
private String startariport;
private String arrivingairport;
private String discount;
public Integer getFlightId() {
return flightId;
}
public void setFlightId(Integer flightId) {
this.flightId = flightId;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getStacity() {
return stacity;
}
public void setStacity(String stacity) {
this.stacity = stacity;
}
public String getTarrcity() {
return tarrcity;
}
public void setTarrcity(String tarrcity) {
this.tarrcity = tarrcity;
}
public Date getDepaturetime() {
return depaturetime;
}
public void setDepaturetime(Date depaturetime) {
this.depaturetime = depaturetime;
}
public Date getArrivaltime() {
return arrivaltime;
}
public void setArrivaltime(Date arrivaltime) {
this.arrivaltime = arrivaltime;
}
public String getFlighttype() {
return flighttype;
}
public void setFlighttype(String flighttype) {
this.flighttype = flighttype;
}
public Long getPrice() {
return price;
}
public void setPrice(Long price) {
this.price = price;
}
public Integer getTicketsleft() {
return ticketsleft;
}
public void setTicketsleft(Integer ticketsleft) {
this.ticketsleft = ticketsleft;
}
public String getStartariport() {
return startariport;
}
public void setStartariport(String startariport) {
this.startariport = startariport;
}
public String getArrivingairport() {
return arrivingairport;
}
public void setArrivingairport(String arrivingairport) {
this.arrivingairport = arrivingairport;
}
public String getDiscount() {
return discount;
}
public void setDiscount(String discount) {
this.discount = discount;
}
} | [
""
] | |
dd101451e133ef0f2b08ef9116f0b07c0bf6fadf | 030d15ce96a72a4915ccf7f26e94cf310c7ec05b | /app/src/main/java/com/zbar/lib/NearbyPlaces/PlacesService.java | ff2ea65d949297f07d513f3552bc882ff0413651 | [] | no_license | sushiliu/AugmentedMap | 96a62a6136528deabea079fdb7d9033e8d809d60 | 7f5ce1fc477bf6d10f6341811c3d1733465dacf4 | refs/heads/master | 2021-01-22T05:15:17.397291 | 2015-04-17T09:48:09 | 2015-04-17T09:48:09 | 34,106,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,793 | java | package com.zbar.lib.NearbyPlaces;
/**
* Created by sushi on 08/04/15.
*/
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Create request for Places API.
*
* @author Karn Shah
* @Date 10/3/2013
*
*/
public class PlacesService {
private String API_KEY;
public PlacesService(String apikey) {
this.API_KEY = apikey;
}
public void setApiKey(String apikey) {
this.API_KEY = apikey;
}
public ArrayList<Place> findPlaces(double latitude, double longitude,
String placeSpacification) {
String urlString = makeUrl(latitude, longitude, placeSpacification);
try {
String json = getJSON(urlString);
//System.out.println("jjjjjjjjjjjjjjjjjjjj"+urlString);
System.out.println("json"+json);
JSONObject object = new JSONObject(json);
JSONArray array = object.getJSONArray("results");
ArrayList<Place> arrayList = new ArrayList<Place>();
for (int i = 0; i < array.length(); i++) {
try {
Place place = Place
.jsonToPontoReferencia((JSONObject) array.get(i));
Log.v("Places Services ", "" + place);
arrayList.add(place);
} catch (Exception e) {
}
}
return arrayList;
} catch (JSONException ex) {
Logger.getLogger(PlacesService.class.getName()).log(Level.SEVERE,
null, ex);
}
return null;
}
// https://maps.googleapis.com/maps/api/place/search/json?location=28.632808,77.218276&radius=500&types=atm&sensor=false&key=apikey
private String makeUrl(double latitude, double longitude, String place) {
StringBuilder urlString = new StringBuilder(
"https://maps.googleapis.com/maps/api/place/search/json?");
setApiKey("AIzaSyBuI6tyNRBAMD2EEUnyrJTbcvMQnKQgeYg");
if (place.equals("")) {
urlString.append("&location=");
urlString.append(Double.toString(latitude));
urlString.append(",");
urlString.append(Double.toString(longitude));
urlString.append("&radius=1000");
// urlString.append("&types="+place);
urlString.append("&sensor=false&key="+API_KEY);
} else {
urlString.append("&location=");
urlString.append(Double.toString(latitude));
urlString.append(",");
urlString.append(Double.toString(longitude));
urlString.append("&radius=1000");
urlString.append("&types=" + place);
urlString.append("&sensor=false&key="+API_KEY);
}
return urlString.toString();
}
public JSONObject getPosition() {
String json = "France";
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
return obj;
} catch (Throwable t) {
Log.e("My App", "Could not parse malformed JSON: \"" + json + "\"");
}
return null;
}
public Double latitudeGetter() {
Place place = Place.jsonToPontoReferencia(getPosition());
Double latitude = place.getLatitude();
return latitude;
}
public Double longtitudeGetter() {
Place place = Place.jsonToPontoReferencia(getPosition());
Double longtitude = place.getLatitude();
return longtitude;
}
protected String getJSON(String url) throws JSONException {
return getUrlContents(url);
}
private String getUrlContents(String theUrl) throws JSONException {
StringBuilder content = new StringBuilder();
try {
URL url = new URL(theUrl);
URLConnection urlConnection = url.openConnection();
urlConnection.connect();
//System.out.println("this"+urlConnection);
InputStream in = urlConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(urlConnection.getInputStream()), 8);
String line;
while ((line = bufferedReader.readLine()) != null) {
content.append(line + "\n");
}
bufferedReader.close();
}catch (Exception e) {
e.printStackTrace();
}
return content.toString();
}
}
| [
"sushi@ZiqiLIUs-MacBook-Pro.local"
] | sushi@ZiqiLIUs-MacBook-Pro.local |
cd244da952a5f1d65f4ebd8742b87486d95d4b1b | c43456e97e5aab36d6d26e24b455f490ab2a90fd | /src/test/java/org/weakref/jmx/TestInheritance7.java | 1b367a10a5ea33d1347ffa34fe6b68df8ce02f28 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | electrum/jmxutils | 20878bd8218684fad6db9cff7e7b2cedce7faebe | c9da9cef696538a8a3a3500a115ce937e5383ae6 | refs/heads/master | 2023-04-30T09:51:56.720450 | 2015-12-21T03:13:21 | 2015-12-21T03:13:21 | 18,578,207 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,383 | java | /**
* Copyright 2009 Martin Traverso
*
* 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.weakref.jmx;
// Annotation inherited from parent class and multiple interfaces => A
public class TestInheritance7
extends TestInheritanceBase
{
public TestInheritance7()
{
super(B.class, A.class);
}
private static class A
{
@Managed(description = "A")
protected Object method()
{
return null;
}
}
private static class B
extends A
implements C, D
{
public Object method()
{
return null;
}
}
private static interface C
{
@Managed(description = "C")
Object method();
}
private static interface D
{
@Managed(description = "D")
Object method();
}
} | [
"mtraverso@acm.org"
] | mtraverso@acm.org |
4a2840a2e9e3520d437e00f62e3083aa4cf57c8f | 74922284971e2bc09dfc3adc7d6584040b092675 | /Java-Codes-master/Main Final Project/src/Teacher.java | c8b91abe5ceddcab578bb3d7d811608d7a2ca1ed | [] | no_license | annesha-dash/Java-Codes-master | af7fd4701dd060392ecca7c5d17bd6175df91dfd | 3b99588f570e7aef386e2f44d6fff4cd9301b0b4 | refs/heads/master | 2020-03-17T10:25:10.006101 | 2018-05-15T12:05:10 | 2018-05-15T12:05:10 | 133,511,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,230 | java | package main.teacher;
import javax.swing.*;
import java.awt.event.*;
import java.awt.FlowLayout;
import javax.swing.border.*;
import java.awt.*;
import java.awt.BorderLayout;
import main.course.*;
import main.login.*;
import main.user.*;
import main.course.*;
import main.student.*;
import main.connection.*;
import java.util.*;
import main.grade.*;
import main.excel.*;
public class Teacher {
JButton b1 ;
JButton b2 ;
JButton b3 ;
JButton b4 ;
JButton b5 ;
JButton b6 ;
JButton b7 ;
JButton b8 ;
JPanel topBar,thePanel,midBar;
Box leftBar,rightBar;
JList<String> list = new JList<>();
DefaultListModel<String> model = new DefaultListModel<>();
GridBagConstraints cs = new GridBagConstraints();
public Teacher(TeacherClass t1, UserClass u){
JFrame layout = new JFrame();
layout.setSize(800,640);
layout.setLocationRelativeTo(null);
layout.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
layout.setTitle(t1.getLastName() + " Home");
thePanel = new JPanel();
thePanel.setLayout( new BorderLayout() );
// ########################TOP BAR GOES HERE#############################################
topBar = new JPanel();
topBar.setLayout(new FlowLayout ( FlowLayout.RIGHT) );
b1 = new JButton("HOME");
b1.setForeground(Color.BLACK);
topBar.add(b1);
b1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource() == b1){
layout.setVisible(false);
layout.setVisible(true);
}
}
});
b2 = new JButton("PROFILE");
b2.setForeground(Color.BLACK);
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource() == b2){
layout.setVisible(false);
new TeacherProfile(layout,t1,u);
}
}
});
topBar.add(b2);
b3 = new JButton("LOGOUT");
b3.setForeground(Color.BLACK);
b3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource() == b3){
layout.dispose();
new Login();
}
}
});
topBar.add(b3);
topBar.setBorder(new LineBorder(Color.GRAY));
//############################### LEFT BAR GOES HERE #####################################
leftBar = Box.createVerticalBox();
b4 = new JButton("ALL COURSES");
b4.setForeground(Color.BLACK);
b4.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource() == b4){
layout.setVisible(false);
new Course(layout);
}
}
});
b4.setPreferredSize(new Dimension(180, 120));
leftBar.add(Box.createVerticalStrut(30));
leftBar.add(b4);
leftBar.setBorder(new LineBorder(Color.GRAY));
//############################### MID BAR GOES HERE ##########################################
midBar = new JPanel();
midBar.setLayout(new GridBagLayout());
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ArrayList<CourseClass> courseList = CourseClass.getTeacherCourses(u);
cs.fill= GridBagConstraints.HORIZONTAL;
for(CourseClass x : courseList){
//System.out.println(x.toString());
model.addElement(x.toString());
}
b7 = new JButton("See Students");
b7.addActionListener(e-> {
try{
String cId = new String();
cId=list.getSelectedValue().substring(0,8);
//layout.setVisible(false);
new ViewStudent(layout ,cId);
}catch(Exception a){JOptionPane.showMessageDialog(null, "Nothing is Selected!!");}
});
b8 = new JButton("Create Excel");
b8.addActionListener(e-> {
String cId = new String();
try {
cId=list.getSelectedValue().substring(0,8);
ArrayList<StudentClass> studentList = ResultQuery.viewCourseStudents(cId);
Excel.writeExcel(cId , studentList);
}catch(Exception a){JOptionPane.showMessageDialog(null, "Nothing is Selected!!");}
});
JButton b9 = new JButton("Create Grade Excel");
b9.addActionListener(e-> {
String cId = new String();
try {
cId=list.getSelectedValue().substring(0,8);
ArrayList<StudentClass> studentList = ResultQuery.viewCourseStudents(cId);
Excel.writeResultExcel(cId , studentList);
}catch(Exception a){JOptionPane.showMessageDialog(null, "Nothing is Selected!!");}
});
list.setModel(model);
cs.gridx=0;
cs.gridy=0;
cs.gridwidth=1;
cs.insets = new Insets(5,5,5,5);
midBar.add(new JScrollPane(list),cs);
cs.gridx=0;
cs.gridy=1;
cs.gridwidth=1;
cs.insets = new Insets(5,5,5,5);
midBar.add(b7,cs);
cs.gridx=0;
cs.gridy=2;
cs.gridwidth=1;
cs.insets = new Insets(5,5,5,5);
midBar.add(b8,cs);
cs.gridx=0;
cs.gridy=3;
cs.gridwidth=1;
cs.insets = new Insets(5,5,5,5);
midBar.add(b9,cs);
midBar.setBorder(new LineBorder(Color.GRAY));
//################################## Right bar ######################################################
Box rightBar = Box.createVerticalBox();
b5 = new JButton("Set All course Grade");
b5.setForeground(Color.BLACK);
b5.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource() == b5){
GradeClass.gradeCourse(u);
}
}
});
b5.setPreferredSize(new Dimension(180, 120));
rightBar.add(Box.createVerticalStrut(30));
rightBar.add(b5);
//############################ Add off the Panels ##################################################
thePanel.add(midBar,BorderLayout.CENTER);
thePanel.add(leftBar, BorderLayout.WEST);
thePanel.add(rightBar, BorderLayout.EAST);
thePanel.add(topBar, BorderLayout.NORTH);
layout.add(thePanel);
layout.setVisible(true);
}
} | [
"38961078+annesha-dash@users.noreply.github.com"
] | 38961078+annesha-dash@users.noreply.github.com |
22cec9248d74bfc289161988b2444d3d0c3cd8fa | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-emrserverless/src/main/java/com/amazonaws/services/emrserverless/model/TagResourceRequest.java | d5fa4a0965696265385efbcb0dd23ef725f57a37 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 7,042 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.emrserverless.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/emr-serverless-2021-07-13/TagResource" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TagResourceRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported
* resources are Amazon EMR Serverless applications and job runs.
* </p>
*/
private String resourceArn;
/**
* <p>
* The tags to add to the resource. A tag is an array of key-value pairs.
* </p>
*/
private java.util.Map<String, String> tags;
/**
* <p>
* The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported
* resources are Amazon EMR Serverless applications and job runs.
* </p>
*
* @param resourceArn
* The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported
* resources are Amazon EMR Serverless applications and job runs.
*/
public void setResourceArn(String resourceArn) {
this.resourceArn = resourceArn;
}
/**
* <p>
* The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported
* resources are Amazon EMR Serverless applications and job runs.
* </p>
*
* @return The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the
* supported resources are Amazon EMR Serverless applications and job runs.
*/
public String getResourceArn() {
return this.resourceArn;
}
/**
* <p>
* The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported
* resources are Amazon EMR Serverless applications and job runs.
* </p>
*
* @param resourceArn
* The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported
* resources are Amazon EMR Serverless applications and job runs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TagResourceRequest withResourceArn(String resourceArn) {
setResourceArn(resourceArn);
return this;
}
/**
* <p>
* The tags to add to the resource. A tag is an array of key-value pairs.
* </p>
*
* @return The tags to add to the resource. A tag is an array of key-value pairs.
*/
public java.util.Map<String, String> getTags() {
return tags;
}
/**
* <p>
* The tags to add to the resource. A tag is an array of key-value pairs.
* </p>
*
* @param tags
* The tags to add to the resource. A tag is an array of key-value pairs.
*/
public void setTags(java.util.Map<String, String> tags) {
this.tags = tags;
}
/**
* <p>
* The tags to add to the resource. A tag is an array of key-value pairs.
* </p>
*
* @param tags
* The tags to add to the resource. A tag is an array of key-value pairs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TagResourceRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see TagResourceRequest#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public TagResourceRequest addTagsEntry(String key, String value) {
if (null == this.tags) {
this.tags = new java.util.HashMap<String, String>();
}
if (this.tags.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.tags.put(key, value);
return this;
}
/**
* Removes all the entries added into Tags.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TagResourceRequest clearTagsEntries() {
this.tags = null;
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getResourceArn() != null)
sb.append("ResourceArn: ").append(getResourceArn()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TagResourceRequest == false)
return false;
TagResourceRequest other = (TagResourceRequest) obj;
if (other.getResourceArn() == null ^ this.getResourceArn() == null)
return false;
if (other.getResourceArn() != null && other.getResourceArn().equals(this.getResourceArn()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getResourceArn() == null) ? 0 : getResourceArn().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public TagResourceRequest clone() {
return (TagResourceRequest) super.clone();
}
}
| [
""
] | |
5aea31b2e17e6ede567f914d60a22bdcd9c886a4 | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/bugsjar/logging-log4j2/7c2ce5cf/buggy-version/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/PatternProcessor.java | 5a10f1a98a4d3687c96b2b1934ad22b31bd077aa | [] | no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,195 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache license, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the license for the specific language governing permissions and
* limitations under the license.
*/
package org.apache.logging.log4j.core.appender.rolling;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.lookup.StrSubstitutor;
import org.apache.logging.log4j.core.pattern.ArrayPatternConverter;
import org.apache.logging.log4j.core.pattern.DatePatternConverter;
import org.apache.logging.log4j.core.pattern.FormattingInfo;
import org.apache.logging.log4j.core.pattern.PatternConverter;
import org.apache.logging.log4j.core.pattern.PatternParser;
/**
* Parse the rollover pattern.
*/
public class PatternProcessor {
private static final String KEY = "FileConverter";
private static final char YEAR_CHAR = 'y';
private static final char MONTH_CHAR = 'M';
private static final char[] WEEK_CHARS = {'w', 'W'};
private static final char[] DAY_CHARS = {'D', 'd', 'F', 'E'};
private static final char[] HOUR_CHARS = {'H', 'K', 'h', 'k'};
private static final char MINUTE_CHAR = 'm';
private static final char SECOND_CHAR = 's';
private static final char MILLIS_CHAR = 'S';
private final ArrayPatternConverter[] patternConverters;
private final FormattingInfo[] patternFields;
private long prevFileTime = 0;
private long nextFileTime = 0;
private RolloverFrequency frequency = null;
/**
* Constructor.
* @param pattern The file pattern.
*/
public PatternProcessor(final String pattern) {
final PatternParser parser = createPatternParser();
final List<PatternConverter> converters = new ArrayList<PatternConverter>();
final List<FormattingInfo> fields = new ArrayList<FormattingInfo>();
parser.parse(pattern, converters, fields, false);
final FormattingInfo[] infoArray = new FormattingInfo[fields.size()];
patternFields = fields.toArray(infoArray);
final ArrayPatternConverter[] converterArray = new ArrayPatternConverter[converters.size()];
patternConverters = converters.toArray(converterArray);
for (final ArrayPatternConverter converter : patternConverters) {
if (converter instanceof DatePatternConverter) {
final DatePatternConverter dateConverter = (DatePatternConverter) converter;
frequency = calculateFrequency(dateConverter.getPattern());
}
}
}
/**
* Returns the next potential rollover time.
* @param current The current time.
* @param increment The increment to the next time.
* @param modulus If true the time will be rounded to occur on a boundary aligned with the increment.
* @return the next potential rollover time and the timestamp for the target file.
*/
public long getNextTime(final long current, final int increment, final boolean modulus) {
prevFileTime = nextFileTime;
long nextTime;
if (frequency == null) {
throw new IllegalStateException("Pattern does not contain a date");
}
final Calendar currentCal = Calendar.getInstance();
currentCal.setTimeInMillis(current);
final Calendar cal = Calendar.getInstance();
cal.set(currentCal.get(Calendar.YEAR), 0, 1, 0, 0, 0);
cal.set(Calendar.MILLISECOND, 0);
if (frequency == RolloverFrequency.ANNUALLY) {
increment(cal, Calendar.YEAR, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.YEAR, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
if (frequency == RolloverFrequency.MONTHLY) {
increment(cal, Calendar.MONTH, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.MONTH, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
if (frequency == RolloverFrequency.WEEKLY) {
increment(cal, Calendar.WEEK_OF_YEAR, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.WEEK_OF_YEAR, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
cal.set(Calendar.DAY_OF_YEAR, currentCal.get(Calendar.DAY_OF_YEAR));
if (frequency == RolloverFrequency.DAILY) {
increment(cal, Calendar.DAY_OF_YEAR, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.DAY_OF_YEAR, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
cal.set(Calendar.HOUR, currentCal.get(Calendar.HOUR));
if (frequency == RolloverFrequency.HOURLY) {
increment(cal, Calendar.HOUR, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.HOUR, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
cal.set(Calendar.MINUTE, currentCal.get(Calendar.MINUTE));
if (frequency == RolloverFrequency.EVERY_MINUTE) {
increment(cal, Calendar.MINUTE, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.MINUTE, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
cal.set(Calendar.SECOND, currentCal.get(Calendar.SECOND));
if (frequency == RolloverFrequency.EVERY_SECOND) {
increment(cal, Calendar.SECOND, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.SECOND, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
increment(cal, Calendar.MILLISECOND, increment, modulus);
nextTime = cal.getTimeInMillis();
cal.add(Calendar.MILLISECOND, -1);
nextFileTime = cal.getTimeInMillis();
return nextTime;
}
private void increment(final Calendar cal, final int type, final int increment, final boolean modulate) {
final int interval = modulate ? increment - (cal.get(type) % increment) : increment;
cal.add(type, interval);
}
/**
* Format file name.
* @param buf string buffer to which formatted file name is appended, may not be null.
* @param obj object to be evaluated in formatting, may not be null.
*/
public final void formatFileName(final StringBuilder buf, final Object obj) {
final long time = prevFileTime == 0 ? System.currentTimeMillis() : prevFileTime;
formatFileName(buf, new Date(time), obj);
}
/**
* Format file name.
* @param subst The StrSubstitutor.
* @param buf string buffer to which formatted file name is appended, may not be null.
* @param obj object to be evaluated in formatting, may not be null.
*/
public final void formatFileName(final StrSubstitutor subst, final StringBuilder buf, final Object obj) {
final long time = prevFileTime == 0 ? System.currentTimeMillis() : prevFileTime;
formatFileName(buf, new Date(time), obj);
LogEvent event = new Log4jLogEvent(time);
String fileName = subst.replace(event, buf);
buf.setLength(0);
buf.append(fileName);
}
/**
* Format file name.
* @param buf string buffer to which formatted file name is appended, may not be null.
* @param objects objects to be evaluated in formatting, may not be null.
*/
protected final void formatFileName(final StringBuilder buf, final Object... objects) {
for (int i = 0; i < patternConverters.length; i++) {
final int fieldStart = buf.length();
patternConverters[i].format(buf, objects);
if (patternFields[i] != null) {
patternFields[i].format(fieldStart, buf);
}
}
}
private RolloverFrequency calculateFrequency(final String pattern) {
if (patternContains(pattern, MILLIS_CHAR)) {
return RolloverFrequency.EVERY_MILLISECOND;
}
if (patternContains(pattern, SECOND_CHAR)) {
return RolloverFrequency.EVERY_SECOND;
}
if (patternContains(pattern, MINUTE_CHAR)) {
return RolloverFrequency.EVERY_MINUTE;
}
if (patternContains(pattern, HOUR_CHARS)) {
return RolloverFrequency.HOURLY;
}
if (patternContains(pattern, DAY_CHARS)) {
return RolloverFrequency.DAILY;
}
if (patternContains(pattern, WEEK_CHARS)) {
return RolloverFrequency.WEEKLY;
}
if (patternContains(pattern, MONTH_CHAR)) {
return RolloverFrequency.MONTHLY;
}
if (patternContains(pattern, YEAR_CHAR)) {
return RolloverFrequency.ANNUALLY;
}
return null;
}
private PatternParser createPatternParser() {
return new PatternParser(null, KEY, null);
}
private boolean patternContains(final String pattern, final char... chars) {
for (final char character : chars) {
if (patternContains(pattern, character)) {
return true;
}
}
return false;
}
private boolean patternContains(final String pattern, final char character) {
return pattern.indexOf(character) >= 0;
}
}
| [
"durieuxthomas@hotmail.com"
] | durieuxthomas@hotmail.com |
2b41295866d38969f3ba888c24c1f150f518b72b | d8293246519319657d5115bebacab3d0d0b50c6e | /src/mypro10/cn/zh/iodecorate/SplitFile.java | 909935f0beaa70b93a4017714c7d3c1b8d5ffded | [] | no_license | cai-xiansheng/java300 | dac018f0218f497910ab98b0f559e913f16374aa | 74433b34081b62394dc735d1a4bbde0b1e6d1887 | refs/heads/master | 2021-05-24T12:30:11.131155 | 2020-08-11T11:10:40 | 2020-08-11T11:10:40 | 253,562,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,305 | java | package mypro10.cn.zh.iodecorate;
import javax.sound.midi.Sequence;
import java.io.*;
import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
/**
* @author 张辉
* @Description 面向对象思想封装 分割
* @create 2020-05-05 6:51
*/
public class SplitFile {
/**
* 源头
* 目的地(文件夹)
* 所有分割后的文件存储路径
* 每块的大小
* 块数
*/
private File src;
private String destDir;
private List<String> destPaths;
private int blockSize;
private int size;
public SplitFile() {
}
public SplitFile(String srcPath, String destDir) {
this(srcPath,destDir,1024);
}
public SplitFile(String srcPath, String destDir, int blockSize) {
this.src = new File(srcPath);
this.destDir = destDir;
this.blockSize = blockSize;
this.destPaths = new ArrayList<String>();
init();
}
public void init() {
// 总长度
long len = this.src.length();
// 块数
this.size = (int) (Math.ceil(len * 1.0) / this.blockSize);
// 路径
for (int i = 0; i < this.size; i++) {
this.destPaths.add(this.destDir +"/"+ i + "-" + this.src.getName());
}
}
/**
* 分割
* 1. 计算每一块的起始位置和大小
*
* @throws IOException
*/
private void split() throws IOException {
// 总长度
long len = this.src.length();
// 起始位置和实际大小
int beginPos = 0;
int actualSize = (int) (blockSize > len ? len : blockSize);
for (int i = 0; i < this.size; i++) {
beginPos = i * this.blockSize;
if (i == this.size - 1) {
// 最后一块
actualSize = (int) len;
} else {
actualSize = this.blockSize;
len -= actualSize;
}
this.splitDetail(i, beginPos, actualSize);
}
}
/**
* 指定第i块的起始位置和实际长度
*
* @param i
* @param beginPos
* @param actualSize
* @throws IOException
*/
public void splitDetail(int i, int beginPos, int actualSize) throws IOException {
RandomAccessFile raf = new RandomAccessFile(this.src, "r");
RandomAccessFile raf2 = new RandomAccessFile(this.destPaths.get(i), "rw");
// 随机读取
raf.seek(beginPos);
// 读取(分段读取,也就是操作)
byte[] flush = new byte[1024];
// 缓冲容器
int len = -1;
// 接收长度
while ((len = raf.read(flush)) != -1) {
if (actualSize > len) {
// 获取本次读取的所有内容
raf2.write(flush,0,len);
actualSize -= len;
} else {
raf2.write(flush,0,actualSize);
break;
}
}
raf2.close();
raf.close();
}
/**
* 文件的合并
* @param destPath
* @throws IOException
*/
public void merge(String destPath) throws IOException {
// 输出流
OutputStream os = new BufferedOutputStream(new FileOutputStream(destPath,true));
Vector<InputStream> vi = new Vector<InputStream>();
SequenceInputStream sis = null;
// 输入流
for (int i = 0; i < this.destPaths.size(); i++) {
vi.add(new BufferedInputStream(new FileInputStream(destPaths.get(i))));
}
sis = new SequenceInputStream(vi.elements());
// 拷贝
// 3.操作
byte[] flush = new byte[1024];
// 缓冲容器
int len = -1;
// 接收长度
while ((len = sis.read(flush))!=-1){
os.write(flush,0,len);
}
os.flush();
os.close();
}
public static void main(String[] args) throws IOException {
SplitFile sf = new SplitFile("F:/IDEA_project/Java300/src/mypro10/cn/zh/iodecorate/SplitFile.java", "dest" );
sf.split();
sf.merge("aaa.java");
}
}
| [
"1459578794@qq.com"
] | 1459578794@qq.com |
85e1cbdf17c947c5271dedc8561ee52cbf3f8548 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/DocumentVersionInfo.java | 12f58a96a877087215a51582a2fe8a7212e3ce95 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 24,513 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.simplesystemsmanagement.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Version information about the document.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DocumentVersionInfo" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DocumentVersionInfo implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The document name.
* </p>
*/
private String name;
/**
* <p>
* The friendly name of the SSM document. This value can differ for each version of the document. If you want to
* update this value, see <a>UpdateDocument</a>.
* </p>
*/
private String displayName;
/**
* <p>
* The document version.
* </p>
*/
private String documentVersion;
/**
* <p>
* The version of the artifact associated with the document. For example, "Release 12, Update 6". This value is
* unique across all versions of a document, and can't be changed.
* </p>
*/
private String versionName;
/**
* <p>
* The date the document was created.
* </p>
*/
private java.util.Date createdDate;
/**
* <p>
* An identifier for the default version of the document.
* </p>
*/
private Boolean isDefaultVersion;
/**
* <p>
* The document format, either JSON or YAML.
* </p>
*/
private String documentFormat;
/**
* <p>
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>, and
* <code>Deleting</code>.
* </p>
*/
private String status;
/**
* <p>
* A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value. For
* example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code> message,
* "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
* </p>
*/
private String statusInformation;
/**
* <p>
* The current status of the approval review for the latest version of the document.
* </p>
*/
private String reviewStatus;
/**
* <p>
* The document name.
* </p>
*
* @param name
* The document name.
*/
public void setName(String name) {
this.name = name;
}
/**
* <p>
* The document name.
* </p>
*
* @return The document name.
*/
public String getName() {
return this.name;
}
/**
* <p>
* The document name.
* </p>
*
* @param name
* The document name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withName(String name) {
setName(name);
return this;
}
/**
* <p>
* The friendly name of the SSM document. This value can differ for each version of the document. If you want to
* update this value, see <a>UpdateDocument</a>.
* </p>
*
* @param displayName
* The friendly name of the SSM document. This value can differ for each version of the document. If you want
* to update this value, see <a>UpdateDocument</a>.
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* <p>
* The friendly name of the SSM document. This value can differ for each version of the document. If you want to
* update this value, see <a>UpdateDocument</a>.
* </p>
*
* @return The friendly name of the SSM document. This value can differ for each version of the document. If you
* want to update this value, see <a>UpdateDocument</a>.
*/
public String getDisplayName() {
return this.displayName;
}
/**
* <p>
* The friendly name of the SSM document. This value can differ for each version of the document. If you want to
* update this value, see <a>UpdateDocument</a>.
* </p>
*
* @param displayName
* The friendly name of the SSM document. This value can differ for each version of the document. If you want
* to update this value, see <a>UpdateDocument</a>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withDisplayName(String displayName) {
setDisplayName(displayName);
return this;
}
/**
* <p>
* The document version.
* </p>
*
* @param documentVersion
* The document version.
*/
public void setDocumentVersion(String documentVersion) {
this.documentVersion = documentVersion;
}
/**
* <p>
* The document version.
* </p>
*
* @return The document version.
*/
public String getDocumentVersion() {
return this.documentVersion;
}
/**
* <p>
* The document version.
* </p>
*
* @param documentVersion
* The document version.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withDocumentVersion(String documentVersion) {
setDocumentVersion(documentVersion);
return this;
}
/**
* <p>
* The version of the artifact associated with the document. For example, "Release 12, Update 6". This value is
* unique across all versions of a document, and can't be changed.
* </p>
*
* @param versionName
* The version of the artifact associated with the document. For example, "Release 12, Update 6". This value
* is unique across all versions of a document, and can't be changed.
*/
public void setVersionName(String versionName) {
this.versionName = versionName;
}
/**
* <p>
* The version of the artifact associated with the document. For example, "Release 12, Update 6". This value is
* unique across all versions of a document, and can't be changed.
* </p>
*
* @return The version of the artifact associated with the document. For example, "Release 12, Update 6". This value
* is unique across all versions of a document, and can't be changed.
*/
public String getVersionName() {
return this.versionName;
}
/**
* <p>
* The version of the artifact associated with the document. For example, "Release 12, Update 6". This value is
* unique across all versions of a document, and can't be changed.
* </p>
*
* @param versionName
* The version of the artifact associated with the document. For example, "Release 12, Update 6". This value
* is unique across all versions of a document, and can't be changed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withVersionName(String versionName) {
setVersionName(versionName);
return this;
}
/**
* <p>
* The date the document was created.
* </p>
*
* @param createdDate
* The date the document was created.
*/
public void setCreatedDate(java.util.Date createdDate) {
this.createdDate = createdDate;
}
/**
* <p>
* The date the document was created.
* </p>
*
* @return The date the document was created.
*/
public java.util.Date getCreatedDate() {
return this.createdDate;
}
/**
* <p>
* The date the document was created.
* </p>
*
* @param createdDate
* The date the document was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withCreatedDate(java.util.Date createdDate) {
setCreatedDate(createdDate);
return this;
}
/**
* <p>
* An identifier for the default version of the document.
* </p>
*
* @param isDefaultVersion
* An identifier for the default version of the document.
*/
public void setIsDefaultVersion(Boolean isDefaultVersion) {
this.isDefaultVersion = isDefaultVersion;
}
/**
* <p>
* An identifier for the default version of the document.
* </p>
*
* @return An identifier for the default version of the document.
*/
public Boolean getIsDefaultVersion() {
return this.isDefaultVersion;
}
/**
* <p>
* An identifier for the default version of the document.
* </p>
*
* @param isDefaultVersion
* An identifier for the default version of the document.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withIsDefaultVersion(Boolean isDefaultVersion) {
setIsDefaultVersion(isDefaultVersion);
return this;
}
/**
* <p>
* An identifier for the default version of the document.
* </p>
*
* @return An identifier for the default version of the document.
*/
public Boolean isDefaultVersion() {
return this.isDefaultVersion;
}
/**
* <p>
* The document format, either JSON or YAML.
* </p>
*
* @param documentFormat
* The document format, either JSON or YAML.
* @see DocumentFormat
*/
public void setDocumentFormat(String documentFormat) {
this.documentFormat = documentFormat;
}
/**
* <p>
* The document format, either JSON or YAML.
* </p>
*
* @return The document format, either JSON or YAML.
* @see DocumentFormat
*/
public String getDocumentFormat() {
return this.documentFormat;
}
/**
* <p>
* The document format, either JSON or YAML.
* </p>
*
* @param documentFormat
* The document format, either JSON or YAML.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DocumentFormat
*/
public DocumentVersionInfo withDocumentFormat(String documentFormat) {
setDocumentFormat(documentFormat);
return this;
}
/**
* <p>
* The document format, either JSON or YAML.
* </p>
*
* @param documentFormat
* The document format, either JSON or YAML.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DocumentFormat
*/
public DocumentVersionInfo withDocumentFormat(DocumentFormat documentFormat) {
this.documentFormat = documentFormat.toString();
return this;
}
/**
* <p>
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>, and
* <code>Deleting</code>.
* </p>
*
* @param status
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>,
* and <code>Deleting</code>.
* @see DocumentStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
* <p>
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>, and
* <code>Deleting</code>.
* </p>
*
* @return The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>,
* and <code>Deleting</code>.
* @see DocumentStatus
*/
public String getStatus() {
return this.status;
}
/**
* <p>
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>, and
* <code>Deleting</code>.
* </p>
*
* @param status
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>,
* and <code>Deleting</code>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DocumentStatus
*/
public DocumentVersionInfo withStatus(String status) {
setStatus(status);
return this;
}
/**
* <p>
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>, and
* <code>Deleting</code>.
* </p>
*
* @param status
* The status of the SSM document, such as <code>Creating</code>, <code>Active</code>, <code>Failed</code>,
* and <code>Deleting</code>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DocumentStatus
*/
public DocumentVersionInfo withStatus(DocumentStatus status) {
this.status = status.toString();
return this;
}
/**
* <p>
* A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value. For
* example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code> message,
* "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
* </p>
*
* @param statusInformation
* A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value. For
* example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code> message,
* "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
*/
public void setStatusInformation(String statusInformation) {
this.statusInformation = statusInformation;
}
/**
* <p>
* A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value. For
* example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code> message,
* "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
* </p>
*
* @return A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value.
* For example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code>
* message, "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
*/
public String getStatusInformation() {
return this.statusInformation;
}
/**
* <p>
* A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value. For
* example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code> message,
* "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
* </p>
*
* @param statusInformation
* A message returned by Amazon Web Services Systems Manager that explains the <code>Status</code> value. For
* example, a <code>Failed</code> status might be explained by the <code>StatusInformation</code> message,
* "The specified S3 bucket doesn't exist. Verify that the URL of the S3 bucket is correct."
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DocumentVersionInfo withStatusInformation(String statusInformation) {
setStatusInformation(statusInformation);
return this;
}
/**
* <p>
* The current status of the approval review for the latest version of the document.
* </p>
*
* @param reviewStatus
* The current status of the approval review for the latest version of the document.
* @see ReviewStatus
*/
public void setReviewStatus(String reviewStatus) {
this.reviewStatus = reviewStatus;
}
/**
* <p>
* The current status of the approval review for the latest version of the document.
* </p>
*
* @return The current status of the approval review for the latest version of the document.
* @see ReviewStatus
*/
public String getReviewStatus() {
return this.reviewStatus;
}
/**
* <p>
* The current status of the approval review for the latest version of the document.
* </p>
*
* @param reviewStatus
* The current status of the approval review for the latest version of the document.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReviewStatus
*/
public DocumentVersionInfo withReviewStatus(String reviewStatus) {
setReviewStatus(reviewStatus);
return this;
}
/**
* <p>
* The current status of the approval review for the latest version of the document.
* </p>
*
* @param reviewStatus
* The current status of the approval review for the latest version of the document.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReviewStatus
*/
public DocumentVersionInfo withReviewStatus(ReviewStatus reviewStatus) {
this.reviewStatus = reviewStatus.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getDisplayName() != null)
sb.append("DisplayName: ").append(getDisplayName()).append(",");
if (getDocumentVersion() != null)
sb.append("DocumentVersion: ").append(getDocumentVersion()).append(",");
if (getVersionName() != null)
sb.append("VersionName: ").append(getVersionName()).append(",");
if (getCreatedDate() != null)
sb.append("CreatedDate: ").append(getCreatedDate()).append(",");
if (getIsDefaultVersion() != null)
sb.append("IsDefaultVersion: ").append(getIsDefaultVersion()).append(",");
if (getDocumentFormat() != null)
sb.append("DocumentFormat: ").append(getDocumentFormat()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus()).append(",");
if (getStatusInformation() != null)
sb.append("StatusInformation: ").append(getStatusInformation()).append(",");
if (getReviewStatus() != null)
sb.append("ReviewStatus: ").append(getReviewStatus());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DocumentVersionInfo == false)
return false;
DocumentVersionInfo other = (DocumentVersionInfo) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getDisplayName() == null ^ this.getDisplayName() == null)
return false;
if (other.getDisplayName() != null && other.getDisplayName().equals(this.getDisplayName()) == false)
return false;
if (other.getDocumentVersion() == null ^ this.getDocumentVersion() == null)
return false;
if (other.getDocumentVersion() != null && other.getDocumentVersion().equals(this.getDocumentVersion()) == false)
return false;
if (other.getVersionName() == null ^ this.getVersionName() == null)
return false;
if (other.getVersionName() != null && other.getVersionName().equals(this.getVersionName()) == false)
return false;
if (other.getCreatedDate() == null ^ this.getCreatedDate() == null)
return false;
if (other.getCreatedDate() != null && other.getCreatedDate().equals(this.getCreatedDate()) == false)
return false;
if (other.getIsDefaultVersion() == null ^ this.getIsDefaultVersion() == null)
return false;
if (other.getIsDefaultVersion() != null && other.getIsDefaultVersion().equals(this.getIsDefaultVersion()) == false)
return false;
if (other.getDocumentFormat() == null ^ this.getDocumentFormat() == null)
return false;
if (other.getDocumentFormat() != null && other.getDocumentFormat().equals(this.getDocumentFormat()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
if (other.getStatusInformation() == null ^ this.getStatusInformation() == null)
return false;
if (other.getStatusInformation() != null && other.getStatusInformation().equals(this.getStatusInformation()) == false)
return false;
if (other.getReviewStatus() == null ^ this.getReviewStatus() == null)
return false;
if (other.getReviewStatus() != null && other.getReviewStatus().equals(this.getReviewStatus()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getDisplayName() == null) ? 0 : getDisplayName().hashCode());
hashCode = prime * hashCode + ((getDocumentVersion() == null) ? 0 : getDocumentVersion().hashCode());
hashCode = prime * hashCode + ((getVersionName() == null) ? 0 : getVersionName().hashCode());
hashCode = prime * hashCode + ((getCreatedDate() == null) ? 0 : getCreatedDate().hashCode());
hashCode = prime * hashCode + ((getIsDefaultVersion() == null) ? 0 : getIsDefaultVersion().hashCode());
hashCode = prime * hashCode + ((getDocumentFormat() == null) ? 0 : getDocumentFormat().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime * hashCode + ((getStatusInformation() == null) ? 0 : getStatusInformation().hashCode());
hashCode = prime * hashCode + ((getReviewStatus() == null) ? 0 : getReviewStatus().hashCode());
return hashCode;
}
@Override
public DocumentVersionInfo clone() {
try {
return (DocumentVersionInfo) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.simplesystemsmanagement.model.transform.DocumentVersionInfoMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
911770c3ff970ba418579c5c435dd7871fcd50e1 | 54bba1ea72db97727b607e78cb55b031a3d473c1 | /Chequers/src/test/java/com/endovectors/uta/presentation/voice/VoiceTester.java | 23aafc19be56759321011a48b6ec549970c55609 | [
"MIT"
] | permissive | bmalla6920/Chequers | effde9b11b59f1feec7867c54f0538d7dce0fdcf | 5b98ceb50d725abea2477bf6cf4391fcbe9c3fb4 | refs/heads/master | 2021-01-15T19:50:43.039717 | 2015-08-19T02:56:39 | 2015-08-19T02:56:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.endovectors.uta.presentation.voice;
import com.endovectors.uta.presentation.voice.speech_patterns.SpeechEnum;
import junit.framework.TestCase;
/**
* Created by asham_000 on 7/20/2015.
*/
public class VoiceTester extends TestCase {
public void testSpeak(){
VoiceSelector voiceSelector = new VoiceSelector();
voiceSelector.setSpeech(SpeechEnum.waitingOnProcessing);
}
}
| [
"jsapp1@securustechnologies.com"
] | jsapp1@securustechnologies.com |
861daa56776e383949d0b415722f27a1aa8e935b | 2602290d1b6d86b9a612f780a0cbbdf252fa6bdd | /src/children/lemoon/music/lrc/LrcProcess.java | fffa0863929edabcf25fa6fed4905c56429a3727 | [] | no_license | whittmy/Children | 362bc04019c2a7f0389d1a79ae0cdfad0316df52 | db7606fb60c031af1e57c28d6fa6b697ef789f7d | refs/heads/master | 2020-06-10T16:29:26.236299 | 2015-11-18T04:31:17 | 2015-11-18T04:31:17 | 43,197,706 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,850 | java | package children.lemoon.music.lrc;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import android.util.Xml.Encoding;
import android.widget.SlidingDrawer;
/**
* 2013/6/1
* @author wwj
* 处理歌词的类
*/
public class LrcProcess {
private List<LrcContent> lrcList; //List集合存放歌词内容对象
private LrcContent mLrcContent; //声明一个歌词内容对象
/**
* 无参构造函数用来实例化对象
*/
public LrcProcess() {
mLrcContent = new LrcContent();
lrcList = new ArrayList<LrcContent>();
}
/**
* 读取歌词
* @param path
* @return
*/
public String readLRC(String path) {
//定义一个StringBuilder对象,用来存放歌词内容
StringBuilder stringBuilder = new StringBuilder();
File f = new File(path.replace(".mp3", ".lrc"));
try {
//创建一个文件输入流对象
FileInputStream fis = new FileInputStream(f);
InputStreamReader isr = new InputStreamReader(fis, "utf-8");
BufferedReader br = new BufferedReader(isr);
String s = "";
while((s = br.readLine()) != null) {
//替换字符
s = s.replace("[", "");
s = s.replace("]", "@");
//分离“@”字符
String splitLrcData[] = s.split("@");
if(splitLrcData.length > 1) {
mLrcContent.setLrcStr(splitLrcData[1]);
//处理歌词取得歌曲的时间
int lrcTime = time2Str(splitLrcData[0]);
mLrcContent.setLrcTime(lrcTime);
//添加进列表数组
lrcList.add(mLrcContent);
//新创建歌词内容对象
mLrcContent = new LrcContent();
}
}
} catch (FileNotFoundException e) {
//e.printStackTrace();
stringBuilder.append("木有歌词文件,赶紧去下载!...");
} catch (IOException e) {
//e.printStackTrace();
stringBuilder.append("木有读取到歌词哦!");
}
return stringBuilder.toString();
}
/**
* 解析歌词时间
* 歌词内容格式如下:
* [00:02.32]陈奕迅
* [00:03.43]好久不见
* [00:05.22]歌词制作 王涛
* @param timeStr
* @return
*/
public int time2Str(String timeStr) {
timeStr = timeStr.replace(":", ".");
timeStr = timeStr.replace(".", "@");
String timeData[] = timeStr.split("@"); //将时间分隔成字符串数组
//分离出分、秒并转换为整型
int minute = Integer.parseInt(timeData[0]);
int second = Integer.parseInt(timeData[1]);
int millisecond = Integer.parseInt(timeData[2]);
//计算上一行与下一行的时间转换为毫秒数
int currentTime = (minute * 60 + second) * 1000 + millisecond * 10;
return currentTime;
}
public List<LrcContent> getLrcList() {
return lrcList;
}
}
| [
"1840223551@qq.com"
] | 1840223551@qq.com |
aba960ac28f855a5d37053f2e05df153d0f7fcc0 | 69844c01f2e187e4c3da64494717d1052573c4d4 | /mobile/src/main/java/com/asus/wellness/cm/CmBasePreferenceActivity.java | 1ddf34f04ae8bd9db0bd4bff982e0b75c7095de4 | [] | no_license | zhangjunzhere/wellness | cd8fb2fe4438148d26efbc6fb803fd5497a83b3b | 975e7a27b025f3d941bcc9607136cde9966b7f11 | refs/heads/master | 2021-01-10T01:43:52.335965 | 2016-03-13T03:31:11 | 2016-03-13T03:31:11 | 53,763,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package com.asus.wellness.cm;
import android.preference.PreferenceActivity;
import com.cmcm.common.statistics.CMAgent;
/**
* Created by waylen_wang on 2015/8/25.
*/
public class CmBasePreferenceActivity extends PreferenceActivity {
@Override
protected void onResume(){
super.onResume();
CMAgent.onPageStart(getPageName());
}
@Override
protected void onPause(){
super.onPause();
CMAgent.onPageEnd(getPageName());
}
public String getPageName(){
return CmBasePreferenceActivity.class.getSimpleName();
};
}
| [
"junzheng_zhang@asus.com"
] | junzheng_zhang@asus.com |
a9d69fdd340c71f10aa62f62eea4a99d3090a9f1 | 27c98bf976989380670bd823af53e0365f329071 | /week5/src/main/java/spring/bootcamp/week5/mapper/StudentMapper.java | 7f8033a29a373fd3368c7c098189e4f588ca7502 | [
"MIT"
] | permissive | 113-GittiGidiyor-Java-Spring-Bootcamp/fifth-homework-nejlasahin | 3eea45308491e1adabe2b5d4b684d68bca1a18ce | e5bc2f5d8b97372499ba1598587349b3a6ce0e02 | refs/heads/main | 2023-08-19T20:00:54.771173 | 2021-09-15T13:09:38 | 2021-09-15T13:09:38 | 405,543,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package spring.bootcamp.week5.mapper;
import org.mapstruct.IterableMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Named;
import spring.bootcamp.week5.dto.StudentDto;
import spring.bootcamp.week5.model.Student;
import java.util.List;
@Mapper
public interface StudentMapper {
Student mapFromStudentDtoToStudent(StudentDto studentDto);
@Named("mapFromStudentToStudentDto")
StudentDto mapFromStudentToStudentDto(Student student);
@IterableMapping(qualifiedByName = "mapFromStudentToStudentDto")
List<StudentDto> mapFromStudentsToStudentDto(List<Student> students);
}
| [
"2017123027@cumhuriyet.edu.tr"
] | 2017123027@cumhuriyet.edu.tr |
46d2a8398d64c21e9f5e95f6164bf99a337ae01c | 7658f1fbd69ce14d773621e7faaf21550504224b | /src/main/java/nlu/edu/fit/bookstore/controller/admin/product/user/AddUser.java | 218dcb897e6e6b6cea98837e9499ffecf00ea6d3 | [] | no_license | dungduy02/CNPM | 44a7de684d732c67c9610d86bc20def4cc533ab0 | 1a4da0bb7153fa6dec7bae926557140d475d336d | refs/heads/main | 2023-07-07T22:10:24.495391 | 2021-08-22T12:59:29 | 2021-08-22T12:59:29 | 380,496,918 | 0 | 0 | null | 2021-08-22T12:59:30 | 2021-06-26T12:29:55 | HTML | UTF-8 | Java | false | false | 1,534 | java | package nlu.edu.fit.bookstore.controller.admin.product.user;
import nlu.edu.fit.bookstore.loginRepo.ProductRepo;
import nlu.edu.fit.bookstore.loginRepo.UserRepo;
import nlu.edu.fit.bookstore.model.Product;
import nlu.edu.fit.bookstore.model.User;
import nlu.edu.fit.bookstore.utils.Utils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/admin/user/add")
public class AddUser extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("enter");
req.getRequestDispatcher("../themkhachhang.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int i = Integer.parseInt(req.getParameter("id"));
User u = new User();
u.setId(i);
u.setUsername(req.getParameter("username"));
u.setFullname(req.getParameter("fullname"));
u.setPassword(req.getParameter("pass"));
u.setEmail(req.getParameter("email"));
u.setAddress(req.getParameter("address"));
u.setSex(req.getParameter("sex"));
// dùng class product repo -> insert p xuông db
UserRepo.addUser(u);
resp.sendRedirect(Utils.fullPathAdmin("user"));
}
}
| [
"18130048@st.hcmuaf.edu.vn"
] | 18130048@st.hcmuaf.edu.vn |
4dbde0a8911b1f87947ee750b392bacc883abb6c | b38e36789407ecb8115e282f05f8d2a92eee93fa | /src/main/java/com/vass/retail_price/pvp/domain/PriceList.java | 26db77efaa4e4b7f176dbf98de3ffd97a828e802 | [] | no_license | ferohe27/retail-price | 5fea04261dc0bbb284c2eb6c454816d036e36d42 | 1cb892a99e54824816873559bfb289c811fef82f | refs/heads/master | 2023-06-02T04:25:14.577941 | 2021-06-28T14:07:15 | 2021-06-28T14:07:15 | 380,989,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 237 | java | package com.vass.retail_price.pvp.domain;
import com.vass.retail_price.pvp.shared.domain.IntegerValueObject;
public final class PriceList extends IntegerValueObject {
public PriceList(Integer value) {
super(value);
}
}
| [
"lromeroherazo@gmail.com"
] | lromeroherazo@gmail.com |
cf7b34bf6e7b8d6aa1f9ccb99caf8049887d0433 | b0f1c977ad8124f4b070bb31026443fa9fe98f43 | /app/src/main/java/br/com/heiderlopes/kawabanga/dao/PedidoDAOImpl.java | 66c4bf127c18b28558307e686dd92dd3789b6d7d | [] | no_license | Ibanheiz/kawabanga | 8ecd409a8b92668e3ac786cd525f9ff3f180a59e | 5661395bc0a5e0f17a3dd3ba60cf433c40772a9f | refs/heads/master | 2021-01-24T05:24:14.846910 | 2016-06-29T00:41:10 | 2016-06-29T00:41:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package br.com.heiderlopes.kawabanga.dao;
import java.util.ArrayList;
import java.util.List;
import br.com.heiderlopes.kawabanga.model.Pedido;
/**
* Created by heider on 28/06/16.
*/
public class PedidoDAOImpl implements PedidoDAO{
private static List<Pedido> pedidos = new ArrayList<>();
@Override
public boolean gravar(Pedido pedido) {
pedidos.add(pedido);
return true;
}
@Override
public List<Pedido> getTodosPedidos() {
return pedidos;
}
}
| [
"heidertreinamentos@gmail.com"
] | heidertreinamentos@gmail.com |
7e087f8f1d2ee95b83e4e560f88613a4b819f121 | 8b5e2b57b05edc09e6c063046785f4e8234e8f2b | /mvn-commons/src/main/java/br/com/barcadero/commons/mail/MailException.java | 3d528b688043f2cd4e07ca0e76258795290aebb0 | [] | no_license | Rafasystec/MVN | d3a0e82ecd22852642342196f873127164a20656 | e8a739b27a8cde54579261ebce8771068fd385b3 | refs/heads/master | 2021-01-19T02:40:59.145594 | 2017-11-24T00:38:49 | 2017-11-24T00:38:49 | 54,285,723 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package br.com.barcadero.commons.mail;
/**
*
* @author Rafel Rocha
* @since version 1.0 dia 11/05/2017
*/
public class MailException extends Exception {
/**
*
*/
private static final long serialVersionUID = 325985816092681039L;
public MailException(String message) {
// TODO Auto-generated constructor stub
super(message);
}
}
| [
"rafasystec@yahoo.com.br"
] | rafasystec@yahoo.com.br |
9fee307a2a7a0f2e4e4485c787e6f1a8b84ca237 | c24eabdbbc1c17c77ee47ae9002a5276fa8a5346 | /level14/lesson08/home08/Solution.java | 7abccfab053a0f31d7fc7bde53ebe49dbe53a9e6 | [] | no_license | pecheneg69/JavaRush | a5b6e398faf4b4c9331c7809f4b24ee4ba8c2574 | 77f803332ab5e91e78dc7f8df73adc8177ba0a80 | refs/heads/master | 2021-01-09T20:46:50.371587 | 2016-06-15T01:43:31 | 2016-06-15T01:43:31 | 61,081,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,387 | java | package com.javarush.test.level14.lesson08.home08;
/* Исправление ошибок
1. Подумать, как связаны интерфейсы Swimable(способен плавать) и Walkable(способен ходить) с классом OceanAnimal(животное океана).
2. Расставить правильно наследование интерфейсов и класса OceanAnimal.
3. Подумать, как могут быть связаны классы Orca(Косатка), Whale(Кит), Otter(Выдра) с классом OceanAnimal.
4. Расставить правильно наследование между классами Orca, Whale, Otter и классом OceanAnimal.
5. Подумать, какой класс должен реализовать интерфейс Walkable и добавить интерфейc этому классу.
6. Подумать, какое животное еще не умеет плавать и добавить ему интерфейс Swimable.
*/
public class Solution
{
public static void main(String[] args)
{
Swimable animal = new Orca();
animal.swim();
animal = new Whale();
animal.swim();
animal = new Otter();
animal.swim();
}
public static void test(Swimable animal)
{
animal.swim();
}
static interface Walkable
{
void walk();
}
static interface Swimable
{
void swim();
}
static abstract class OceanAnimal implements Swimable
{
public void swim()
{
OceanAnimal currentAnimal = (OceanAnimal) getCurrentAnimal();
currentAnimal.swimming();
}
private void swimming()
{
System.out.println(getCurrentAnimal().getClass().getSimpleName() + " is swimming");
}
abstract Swimable getCurrentAnimal();
}
static class Orca extends OceanAnimal
{
Swimable getCurrentAnimal()
{
return new Orca();
}
}
static class Whale extends OceanAnimal
{
Swimable getCurrentAnimal()
{
return new Whale();
}
}
static class Otter implements Walkable, Swimable
{
public void walk()
{
}
public void swim()
{
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
62a1b4cc22e86741d40b5e32f02feb126fea5480 | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_8786_ddG.java | ffc350bef1609f1b5b1498b3eba175c8e4541aa3 | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,486 | java | import java.util.ArrayList;
import org.apache.log4j.Logger;
public class ddG extends dRq
implements vn
{
public static final String TAG = "ComboBoxPlus";
public static final String kXi = "ComboBox";
public static final String kXj = "renderable";
public static final String kXk = "list";
public static final String kXl = "button";
private boolean kXm;
private boolean kXn;
private doN fvF;
private doN cGQ;
private doN kXo;
private ccG bah;
private axU bRF;
private biy igL;
private int fdb;
private ajY kXp;
private String cn;
private cpa co;
private aFG aWn;
private aFG drn;
public static final int cs = "content".hashCode();
public static final int fdh = "maxRows".hashCode();
public static final int cv = "selectedValue".hashCode();
public static final int drs = "align".hashCode();
public static final int drt = "hotSpotPosition".hashCode();
public static final int kXq = "behaviour".hashCode();
public ddG()
{
this.kXm = false;
this.kXn = true;
this.bah = null;
this.bRF = null;
this.igL = null;
this.fdb = -1;
this.kXp = ajY.djI;
this.cn = null;
this.co = null;
this.aWn = aFG.ecn;
this.drn = aFG.ech;
}
public void a(aNL paramaNL)
{
int i = 1;
if ((paramaNL instanceof ccG)) {
if (this.bah != null) {
this.bah.release();
}
i = 0;
this.bah = ((ccG)paramaNL);
this.bah.setModalLevel(Ts.cwm);
D(this.bah);
} else if ((paramaNL instanceof axU)) {
if (this.bRF != null) {
this.bRF.release();
}
this.bRF = ((axU)paramaNL);
} else if ((paramaNL instanceof biy)) {
if (this.igL != null) {
this.igL.beH();
}
this.igL = ((biy)paramaNL);
}
if (i != 0)
super.a(paramaNL);
}
public dOc getWidgetByThemeElementName(String paramString, boolean paramBoolean)
{
if ("renderable".equalsIgnoreCase(paramString)) {
if (this.bRF != null)
return this.bRF;
}
else if ("list".equalsIgnoreCase(paramString)) {
if (this.bah != null)
return this.bah;
}
else if ("button".equalsIgnoreCase(paramString)) {
return this.igL;
}
return null;
}
public String getTag()
{
return "ComboBoxPlus";
}
public biy getButton()
{
return this.igL;
}
public ccG getList()
{
return this.bah;
}
public int getMaxRows() {
return this.fdb;
}
public void setMaxRows(int paramInt) {
this.fdb = paramInt;
}
public void setElementMap(cpa paramcpa)
{
super.setElementMap(paramcpa);
if (this.bah != null)
this.bah.setElementMap(paramcpa);
}
public Object getSelectedValue()
{
if (this.bah != null) {
return this.bah.getSelectedValue();
}
return null;
}
public void setSelectedValue(Object paramObject)
{
if (paramObject == null) {
return;
}
if (this.bah != null) {
this.bah.setSelectedValue(paramObject);
Object localObject = this.bah.getSelectedValue();
if ((paramObject != localObject) && ((localObject == null) || (!localObject.equals(paramObject)))) {
K.error("Impossible de retrouver la valeur sélectionnée dans la liste - il faut appliquer l'attribut content AVANT selectedValue - " + paramObject + " - " + localObject);
}
setRenderableContent(localObject, -1);
}
}
public axU getRenderable()
{
return this.bRF;
}
public void setContentProperty(String paramString, cpa paramcpa) {
this.cn = paramString;
this.co = paramcpa;
}
private void setRenderableContent(Object paramObject, int paramInt) {
if (this.bRF != null) {
int i = 0;
Object localObject;
if (this.bah != null) {
localObject = this.bah.getSelectedValue();
i = this.bah.getSelectedOffset();
} else {
localObject = paramObject;
if (paramInt != -1) {
i = paramInt;
}
}
if (localObject != null) {
this.bRF.setContentProperty(this.cn + "#" + i, this.co);
}
this.bRF.setContent(localObject);
}
}
public void setContent(Iterable paramIterable)
{
if (paramIterable != null)
{
int i = 1;
Object localObject1 = null;
if (this.bah != null) {
this.bah.setContentProperty(this.cn, this.co);
this.bah.setContent(paramIterable);
if ((this.bah.size() != 0) && (this.bah.getSelectedValue() == null)) {
i = 0;
localObject1 = this.bah.getItems().get(0);
this.bah.setSelectedOffset(0);
}
}
Object localObject2 = null;
int j = -1;
if (i == 0) {
localObject2 = localObject1;
j = 0;
}
setRenderableContent(localObject2, j);
}
}
public void setContent(Object[] paramArrayOfObject) {
if (paramArrayOfObject != null) {
int i = 1;
Object localObject1 = null;
if (this.bah != null) {
this.bah.setContentProperty(this.cn, this.co);
this.bah.setContent(paramArrayOfObject);
if ((this.bah.size() != 0) && (this.bah.getSelectedValue() == null)) {
i = 0;
localObject1 = this.bah.getItems().get(0);
this.bah.setSelectedOffset(0);
}
}
Object localObject2 = null;
int j = -1;
if (i == 0) {
localObject2 = localObject1;
j = 0;
}
setRenderableContent(localObject2, j);
}
}
public void setHotSpotPosition(aFG paramaFG)
{
if (paramaFG != null)
this.drn = paramaFG;
}
public void setAlign(aFG paramaFG) {
if (paramaFG != null)
this.aWn = paramaFG;
}
public void ajj()
{
super.ajj();
setFocusable(true);
}
public void setBehaviour(ajY paramajY)
{
this.kXp = paramajY;
}
public void setEnabled(boolean paramBoolean)
{
super.setEnabled(paramBoolean);
if (this.igL != null)
this.igL.setEnabled(paramBoolean);
}
public void setNetEnabled(boolean paramBoolean) {
super.setNetEnabled(paramBoolean);
if (this.igL != null)
this.igL.setNetEnabled(paramBoolean);
}
public void rV() {
super.rV();
if (this.igL != null)
this.igL.setVisible(this.kXp.axk());
}
public void cON()
{
this.kXo = new aSb(this);
a(CH.bGw, this.kXo, false);
}
public void a(bsP parambsP)
{
this.fvF = new aSd(this);
parambsP.a(CH.bGu, this.fvF, false);
this.cGQ = new aRW(this);
parambsP.a(CH.bGv, this.cGQ, false);
}
public void D(ccG paramccG)
{
paramccG.a(CH.bGk, new aRY(this), false);
}
public void cdM()
{
if (this.kXm)
closePopup();
else
cdN();
}
private void closePopup()
{
if (this.kXm) {
this.bah.beG();
this.kXm = false;
MQ.WK().WN();
}
}
private void cdN()
{
if (!this.kXm)
{
Or localOr = this.bah.getIdealSize(this.fdb, -1);
int j = localOr.height;
int k = getDisplayY();
bsP localbsP = bsP.getInstance();
aFG localaFG1 = this.aWn;
aFG localaFG2 = this.drn;
int m = getDisplayY() + localaFG1.iP(getHeight()) - localaFG2.iP(j);
if ((m < 0) || (m > localbsP.getAppearance().getContentHeight() - j))
{
localaFG1 = localaFG1.aSd();
localaFG2 = localaFG2.aSd();
}
m = getDisplayY() + localaFG1.iP(getHeight()) - localaFG2.iP(j);
m = Math.max(0, Math.min(m, localbsP.getAppearance().getContentHeight() - j));
if ((k - j < 0) && (k + getHeight() + j > localbsP.getHeight()))
{
j = k;
m = 0;
}
this.bah.setSizeToPrefSize();
int i = Math.max(this.bah.getWidth(), getWidth());
this.bah.setSize(i, j);
this.bah.setPosition(getDisplayX(), m);
this.bah.setNonBlocking(false);
localbsP.getLayeredContainer().b(this.bah, 30000);
this.kXm = true;
this.kXn = true;
MQ.WK().WM();
}
}
public boolean isAppearanceCompatible(Jg paramJg)
{
return paramJg instanceof av;
}
public void bc()
{
super.bc();
bsP.getInstance().b(CH.bGu, this.fvF, false);
bsP.getInstance().b(CH.bGv, this.cGQ, false);
this.cGQ = null;
this.fvF = null;
this.kXo = null;
this.aWn = null;
this.drn = null;
this.bah.beH();
this.igL = null;
this.bah = null;
this.bRF = null;
}
public void aJ()
{
super.aJ();
dEj localdEj = new dEj(this, null);
localdEj.aJ();
a(localdEj);
av localav = new av();
localav.aJ();
localav.setWidget(this);
a(localav);
this.kXp = ajY.djI;
biy localbiy = new biy();
localbiy.aJ();
a(localbiy);
this.bah = new ccG();
this.bah.aJ();
this.bRF = new axU();
this.bRF.aJ();
this.meQ = false;
cON();
a(bsP.getInstance());
}
public void c(bdj parambdj)
{
ddG localddG = (ddG)parambdj;
super.c(localddG);
localddG.kXp = this.kXp;
localddG.fdb = this.fdb;
dOc localdOc = (dOc)this.bah.beO();
localdOc.meW = false;
localdOc.beJ();
localddG.a(localdOc);
localddG.b(CH.bGu, this.fvF, false);
localddG.b(CH.bGv, this.cGQ, false);
localddG.b(CH.bGw, this.kXo, false);
}
public boolean setXMLAttribute(int paramInt, String paramString, aKN paramaKN)
{
if (paramInt == fdh)
setMaxRows(bUD.aR(paramString));
else if (paramInt == drs)
setAlign(aFG.gr(paramString));
else if (paramInt == kXq)
setBehaviour((ajY)paramaKN.b(ajY.class, paramString));
else if (paramInt == drt)
setHotSpotPosition(aFG.gr(paramString));
else {
return super.setXMLAttribute(paramInt, paramString, paramaKN);
}
return true;
}
public boolean setPropertyAttribute(int paramInt, Object paramObject)
{
if (paramInt == fdh)
setMaxRows(bUD.aR(paramObject));
else if (paramInt == drs)
setAlign((aFG)paramObject);
else if (paramInt == drt)
setHotSpotPosition((aFG)paramObject);
else if (paramInt == cs) {
if ((paramObject == null) || (paramObject.getClass().isArray()))
setContent((Object[])paramObject);
else if ((paramObject instanceof Iterable))
setContent((Iterable)paramObject);
else
return false;
}
else if (paramInt == cv)
setSelectedValue(paramObject);
else {
return super.setPropertyAttribute(paramInt, paramObject);
}
return true;
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
3fcbf419f7264442abb1b8d83b5bde1465d2b4db | c893e9c8fc2a1d305262829b7fc1b48c22673ad6 | /src/main/java/projet100h/dao/DataSourceProvider.java | 8cb5ec34eb296035b770817b9ab7cfa5d628cb0e | [] | no_license | benoitlux/mdsmaster | 6531e84a7f6581643267282b222b704c25d1da28 | 0567f321358dd06e4c4982841fa41b55de62d115 | refs/heads/master | 2020-12-30T23:47:46.946815 | 2017-05-02T14:12:57 | 2017-05-02T14:12:57 | 86,595,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package projet100h.dao;
import javax.sql.DataSource;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
public class DataSourceProvider {
private static MysqlDataSource dataSource;
public static DataSource getDataSource() {
if (dataSource == null) {
dataSource = new MysqlDataSource();
dataSource.setServerName("localhost");
dataSource.setPort(3306);
dataSource.setDatabaseName("projet100h");
dataSource.setUser("root");
dataSource.setPassword("0000");
}
return dataSource;
}
}
| [
"benoit.lux@hei.fr"
] | benoit.lux@hei.fr |
f85941c4f774bfca5cb20e03fb05cc9756e9e5d2 | 0b4d30e7c475286ae29c411ccf2132333751861c | /app/src/test/java/com/nerdlauncher/android/bignerdranch/coolweather/ExampleUnitTest.java | 464fbe3ccbc724f450f29c5294d44c8d9a0fbbbe | [] | no_license | BigGift/coolweatherlearn | 6ced3a718e628b5b612617d78d9841d13021c876 | 46b01036a022740c3d0698662d20bbfc67361a58 | refs/heads/master | 2021-01-15T10:35:14.641961 | 2017-08-21T07:24:36 | 2017-08-21T07:24:36 | 99,589,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.nerdlauncher.android.bignerdranch.coolweather;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"363593732@qq.com"
] | 363593732@qq.com |
35c37e24cdcf815d759066fd4a5b3020504cfe6b | b98e6df6700a48c5ca7f2c582c552ec310308638 | /src/de/htwg/checkers/persistence/hibernate/PersistentField.java | c3ea1f55f069b831b51fbb121df463e27c3bdfe6 | [] | no_license | julmayer/checkers | 334bdabcde5756dd93562682b375c04f8e31efa8 | 6ed7e932b9729d8856ac004bda1db006e324a622 | refs/heads/master | 2021-01-10T20:36:41.670227 | 2015-06-30T20:54:28 | 2015-06-30T20:54:28 | 9,192,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,086 | java | package de.htwg.checkers.persistence.hibernate;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import de.htwg.checkers.models.Field;
import de.htwg.checkers.models.Figure;
/**
*
* @author Julian Mayer
*/
@Entity
@Table(name = "field")
public class PersistentField implements Serializable {
private static final long serialVersionUID = 4665155963348140419L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@Column(name = "figures")
private List<PersistentFigure> figures = new LinkedList<PersistentFigure>();
@Column(name = "size")
private int size;
public PersistentField() { }
/**
* Copyconstructor for the Gamefiels
* @param field source field for copy
*/
public PersistentField(Field field) {
for (int i = 0; i < field.getSize(); ++i) {
for (int j = 0; j < field.getSize(); ++j) {
Figure figure = field.getCellByCoordinates(i, j).getOccupier();
if (figure == null) {
continue;
}
PersistentFigure pFigure = new PersistentFigure(figure);
this.figures.add(pFigure);
}
}
this.size = field.getSize();
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public List<PersistentFigure> getFigures() {
return figures;
}
public void setFigures(List<PersistentFigure> figures) {
this.figures = figures;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
} | [
"julmayer@htwg-konstanz.de"
] | julmayer@htwg-konstanz.de |
e41a44dff7de37c75572a83e9dc4cfd3272805b8 | 11b6800897dc9274c42ed57515448db25e3dee8a | /zxing/src/main/java/com/uama/zxing/camera/PreviewCallback.java | 880fc372608c9c7dd948ffe28ed40fa5d45a105a | [] | no_license | UamaHZ/uama-zxing | a65d6db72da745fb7ac93c4a400a5346d4b64314 | 4e495e19788fd36d9ec0eece019057b5590e9222 | refs/heads/master | 2020-05-07T13:27:54.092406 | 2019-04-28T02:56:00 | 2019-04-28T02:56:00 | 180,550,471 | 4 | 0 | null | 2019-04-28T06:31:11 | 2019-04-10T09:39:54 | Java | UTF-8 | Java | false | false | 2,389 | java | /*
* Copyright (C) 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.uama.zxing.camera;
import android.graphics.Point;
import android.hardware.Camera;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
/**
* 用于截取每一帧视频数据的接口
* 目前的manager使用的是setOneShotPreviewCallback:只截取一次
*/
@SuppressWarnings("deprecation") // camera APIs
final class PreviewCallback implements Camera.PreviewCallback {
private static final String TAG = PreviewCallback.class.getSimpleName();
private final CameraConfigurationManager configManager;
private Handler previewHandler;
private int previewMessage;
PreviewCallback(CameraConfigurationManager configManager) {
this.configManager = configManager;
}
/**
* 传入previewHandler message.what
* @param previewHandler 分析处理二维码信息的handler
* @param previewMessage message.what 一个key,目前全部存储在ids.xml资源文件中
*/
void setHandler(Handler previewHandler, int previewMessage) {
this.previewHandler = previewHandler;
this.previewMessage = previewMessage;
}
/**
* 此处分析截取拍摄到的二维码信息:处理者previewHandler
* @param data 一个图片流
* @param camera 摄像头
*/
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Point cameraResolution = configManager.getCameraResolution();
Handler thePreviewHandler = previewHandler;
if (cameraResolution != null && thePreviewHandler != null) {
Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x,
cameraResolution.y, data);
message.sendToTarget();
previewHandler = null;
} else {
Log.d(TAG, "Got preview callback, but no handler or resolution available");
}
}
}
| [
"guozhen.hou@uama.com.cn"
] | guozhen.hou@uama.com.cn |
d0acde547feaa428e1328027edf7337e281bd2d5 | 35e3d6b5fe33f742a429e64082b266129723a7fb | /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/Board/org/apache/jsp/index_jsp.java | 3a7af2d09d136b52188c67ae8798e1f9138ba7b2 | [] | no_license | jiyoniii/JSP_workspace | 6b2ea6a0195d28c05508d47746beee7ec9e66adf | c4a01fe822acebc2358a88b1a297349d14310296 | refs/heads/master | 2022-11-07T19:01:16.135571 | 2020-06-17T11:13:13 | 2020-06-17T11:13:13 | 272,953,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,318 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/9.0.35
* Generated at: 2020-05-26 05:31:43 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
final java.lang.String _jspx_method = request.getMethod();
if ("OPTIONS".equals(_jspx_method)) {
response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
return;
}
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) {
response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSP들은 오직 GET, POST 또는 HEAD 메소드만을 허용합니다. Jasper는 OPTIONS 메소드 또한 허용합니다.");
return;
}
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t<a href=\"/Board/BoardServlet?command=board_list\">게시판으로 가기</a>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"kangjy113@gmail.com"
] | kangjy113@gmail.com |
552d16b65da481e94ba1ea19a8f9af45067df27c | 52bcb340abc4c224b88c6191877019723cd71bcb | /Manish 28-12/Test30.java | f32b690c8370047bb7b1e5b801e48fa5bb006f90 | [] | no_license | ManishChandra2405/Manish2405 | 15228c2ab6fad05ab24e8943589f1d167449aae5 | e7577ee787269f04f16bbc43698887e456d3e997 | refs/heads/master | 2022-12-27T23:21:41.880941 | 2020-01-17T09:46:07 | 2020-01-17T09:46:07 | 230,236,956 | 0 | 2 | null | 2022-12-16T12:16:13 | 2019-12-26T09:40:06 | Java | UTF-8 | Java | false | false | 374 | java | import java.util.TreeSet;
import java.util.Iterator;
class Test30
{
public static void main(String args[])
{
TreeSet<Employee> tset = new TreeSet<Employee>();
tset.add(new Employee(1,"Manish",1000));
tset.add(new Employee(2,"Sunil",2000));
tset.add(new Employee(3,"Kowsy",3000));
for(Employee e : tset)
e.display();
}
} | [
"noreply@github.com"
] | noreply@github.com |
256630363fa415a21cb15a2dcf345edec73a47da | fec4c1754adce762b5c4b1cba85ad057e0e4744a | /jf_manager/src/com/jf/controller/CutPriceProductController.java | 4176cd05f2d9e8412a433d3bdba483fb3804e9ee | [] | no_license | sengeiou/workspace_xg | 140b923bd301ff72ca4ae41bc83820123b2a822e | 540a44d550bb33da9980d491d5c3fd0a26e3107d | refs/heads/master | 2022-11-30T05:28:35.447286 | 2020-08-19T02:30:25 | 2020-08-19T02:30:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 76,678 | java | package com.jf.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.gzs.common.utils.StringUtil;
import com.jf.entity.CutPriceCnf;
import com.jf.entity.CutPriceCnfDtl;
import com.jf.entity.CutPriceCnfDtlExample;
import com.jf.entity.CutPriceCnfExample;
import com.jf.entity.CutPriceCnfTpl;
import com.jf.entity.CutPriceCnfTplCustom;
import com.jf.entity.CutPriceCnfTplCustomExample;
import com.jf.entity.CutPriceCnfTplDtl;
import com.jf.entity.CutPriceCnfTplDtlExample;
import com.jf.entity.CutPriceCnfTplExample;
import com.jf.entity.Product;
import com.jf.entity.SingleProductActivity;
import com.jf.entity.SingleProductActivityAuditLog;
import com.jf.entity.SingleProductActivityAuditLogExample;
import com.jf.entity.SingleProductActivityCustom;
import com.jf.entity.SingleProductActivityCustomExample;
import com.jf.entity.SingleProductActivityExample;
import com.jf.entity.StaffBean;
import com.jf.entity.StateCode;
import com.jf.service.CutPriceCnfDtlService;
import com.jf.service.CutPriceCnfService;
import com.jf.service.CutPriceCnfTplDtlService;
import com.jf.service.CutPriceCnfTplService;
import com.jf.service.SingleProductActivityAuditLogService;
import com.jf.service.SingleProductActivityService;
import com.jf.vo.Page;
@SuppressWarnings("serial")
@Controller
public class CutPriceProductController extends BaseController {
@Autowired
private SingleProductActivityService singleProductActivityService;
@Autowired
private CutPriceCnfService cutPriceCnfService;
@Autowired
private CutPriceCnfDtlService cutPriceCnfDtlService;
@Autowired
private CutPriceCnfTplService cutPriceCnfTplService;
@Autowired
private CutPriceCnfTplDtlService cutPriceCnfTplDtlService;
@Autowired
private SingleProductActivityAuditLogService singleProductActivityAuditLogService;
/**
*
* @Title cutPriceProductManager
* @Description TODO(这里用一句话描述这个方法的作用)
* @author pengl
* @date 2018年6月5日 下午2:43:52
*/
@RequestMapping("/cutPriceProduct/cutPriceProductManager.shtml")
public ModelAndView cutPriceProductManager(HttpServletRequest request) {
ModelAndView m = new ModelAndView("/cutPrice/cutPriceProduct/getCutPriceProductList");
return m;
}
/**
*
* @Title getSignInCnfList
* @Description TODO(这里用一句话描述这个方法的作用)
* @author pengl
* @date 2018年6月5日 下午4:46:25
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/getCutPriceProductList.shtml")
public Map<String, Object> getSignInCnfList(HttpServletRequest request, Page page, Integer singleProductActivityId) {
Map<String, Object> resMap = new HashMap<String, Object>();
List<SingleProductActivityCustom> dataList = null;
Integer totalCount = 0;
try {
SingleProductActivityCustomExample singleProductActivityCustomExample = new SingleProductActivityCustomExample();
SingleProductActivityCustomExample.SingleProductActivityCustomCriteria singleProductActivityCustomCriteria = singleProductActivityCustomExample.createCriteria();
singleProductActivityCustomCriteria.andDelFlagEqualTo("0")
.andIsCloseEqualTo("0")
.andTypeEqualTo("7"); // 7:砍价免费拿
if(singleProductActivityId != null) {
singleProductActivityCustomCriteria.andIdEqualTo(singleProductActivityId);
}
if(!StringUtil.isEmpty(request.getParameter("productCode"))) {
singleProductActivityCustomCriteria.andCodeByEqualTo(request.getParameter("productCode"));
}
if(!StringUtil.isEmpty(request.getParameter("shopName"))) {
singleProductActivityCustomCriteria.andShopNameLike(request.getParameter("shopName"));
}
if(!StringUtil.isEmpty(request.getParameter("productName"))) {
singleProductActivityCustomCriteria.andProductNameLike("%"+request.getParameter("productName")+"%");
}
if(!StringUtil.isEmpty(request.getParameter("firstAuditName"))) {
singleProductActivityCustomCriteria.andFirstAuditNameLike("%"+request.getParameter("firstAuditName")+"%");
}
if(!StringUtil.isEmpty(request.getParameter("auditStatus"))) {
singleProductActivityCustomCriteria.andAuditStatusEqualTo(request.getParameter("auditStatus"));
}
singleProductActivityCustomExample.setOrderByClause(" t.id desc");
singleProductActivityCustomExample.setLimitStart(page.getLimitStart());
singleProductActivityCustomExample.setLimitSize(page.getLimitSize());
totalCount = singleProductActivityService.countByCustomExample(singleProductActivityCustomExample);
dataList = singleProductActivityService.selectByCustomExampl(singleProductActivityCustomExample);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resMap.put("Rows", dataList);
resMap.put("Total", totalCount);
return resMap;
}
/**
*
* @Title updateSingleProductActivity
* @Description TODO(排序)
* @author pengl
* @date 2018年6月5日 下午5:38:03
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/updateSingleProductActivity.shtml")
public Map<String, Object> updateSingleProductActivity(HttpServletRequest request, Integer id, Integer seqNo) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg =null;
try {
SingleProductActivityExample singleProductActivityExample = new SingleProductActivityExample();
SingleProductActivityExample.Criteria singleProductActivityCriteria = singleProductActivityExample.createCriteria();
singleProductActivityCriteria.andDelFlagEqualTo("0")
.andIdEqualTo(id);
SingleProductActivity singleProductActivity = new SingleProductActivity();
singleProductActivity.setSeqNo(seqNo);
singleProductActivityService.updateByExampleSelective(singleProductActivity, singleProductActivityExample);
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
/**
*
* @Title updateIsClose
* @Description TODO(上架或下架)
* @author pengl
* @date 2018年6月5日 下午6:10:54
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/updateStatus.shtml")
public Map<String, Object> updateStatus(HttpServletRequest request, Integer id, String status) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg = null;
try {
Date date = new Date();
String staffId = this.getSessionStaffBean(request).getStaffID();
SingleProductActivity singleProductActivity = new SingleProductActivity();
singleProductActivity.setId(id);
singleProductActivity.setStatus(status);
singleProductActivity.setUpdateBy(Integer.parseInt(staffId));
singleProductActivity.setUpdateDate(date);
singleProductActivityService.updateByPrimaryKeySelective(singleProductActivity);
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
/**
*
* @Title cutPriceCnfManager
* @Description TODO(砍价设置)
* @author pengl
* @date 2018年6月5日 下午6:26:46
*/
@RequestMapping("/cutPriceProduct/addOrUpdateCutPriceCnfManager.shtml")
public ModelAndView addOrUpdateCutPriceCnfManager(HttpServletRequest request) {
ModelAndView m = new ModelAndView("/cutPrice/cutPriceProduct/addOrUpdateCutPriceCnf");
String singleProductActivityId = request.getParameter("singleProductActivityId");
m.addObject("singleProductActivityId", singleProductActivityId);
if(!StringUtil.isEmpty(singleProductActivityId)) {
CutPriceCnfExample cutPriceCnfExample = new CutPriceCnfExample();
CutPriceCnfExample.Criteria cutPriceCnfCriteria = cutPriceCnfExample.createCriteria();
cutPriceCnfCriteria.andDelFlagEqualTo("0").andSingleProductActivityIdEqualTo(Integer.parseInt(singleProductActivityId));
List<CutPriceCnf> cutPriceCnfList = cutPriceCnfService.selectByExample(cutPriceCnfExample);
if(cutPriceCnfList != null && cutPriceCnfList.size() > 0) { //砍价设置(已设置过)
CutPriceCnfDtlExample cutPriceCnfDtlExample = new CutPriceCnfDtlExample();
CutPriceCnfDtlExample.Criteria cutPriceCnfDtlCriteria = cutPriceCnfDtlExample.createCriteria();
cutPriceCnfDtlCriteria.andDelFlagEqualTo("0")
.andCutPriceCnfIdEqualTo(cutPriceCnfList.get(0).getId());
List<CutPriceCnfDtl> cutPriceCnfDtlList = cutPriceCnfDtlService.selectByExample(cutPriceCnfDtlExample);
if(cutPriceCnfDtlList != null && cutPriceCnfDtlList.size() > 0) {
List<CutPriceCnfDtl> cutPriceCnfDtls = new ArrayList<CutPriceCnfDtl>();
for(CutPriceCnfDtl cutPriceCnfDtl : cutPriceCnfDtlList) {
if("1".equals(cutPriceCnfDtl.getRateType())) {
m.addObject("jcCutPriceCnfDtl", cutPriceCnfDtl); // 1 基础比例
}else if("2".equals(cutPriceCnfDtl.getRateType())) {
m.addObject("scCutPriceCnfDtl", cutPriceCnfDtl); // 2 首次砍
}else {
cutPriceCnfDtls.add(cutPriceCnfDtl);
}
}
Collections.sort(cutPriceCnfDtls, new Comparator<CutPriceCnfDtl>() {
@Override
public int compare(CutPriceCnfDtl o1, CutPriceCnfDtl o2) {
if(o1.getEndAmount().compareTo(o2.getEndAmount()) > 0) {
return 1;
}
if(o1.getEndAmount().compareTo(o2.getEndAmount()) == 0) {
return 0;
}
return -1;
}
});
m.addObject("oneCutPriceCnfDtl", cutPriceCnfDtls.get(0));
m.addObject("twoCutPriceCnfDtl", cutPriceCnfDtls.get(1));
m.addObject("threeCutPriceCnfDtl", cutPriceCnfDtls.get(2));
m.addObject("fourCutPriceCnfDtl", cutPriceCnfDtls.get(3));
m.addObject("fiveCutPriceCnfDtl", cutPriceCnfDtls.get(4));
m.addObject("sixCutPriceCnfDtl", cutPriceCnfDtls.get(5));
m.addObject("sevenCutPriceCnfDtl", cutPriceCnfDtls.get(6));
m.addObject("cutPriceCnf", cutPriceCnfList.get(0));
}
}else { //砍价设置(没设置过)
SingleProductActivityCustomExample singleProductActivityCustomExample = new SingleProductActivityCustomExample();
SingleProductActivityCustomExample.SingleProductActivityCustomCriteria singleProductActivityCustomCriteria = singleProductActivityCustomExample.createCriteria();
singleProductActivityCustomCriteria.andDelFlagEqualTo("0")
.andIdEqualTo(Integer.parseInt(singleProductActivityId));
List<SingleProductActivityCustom> singleProductActivityCustomList = singleProductActivityService.selectByCustomExampl(singleProductActivityCustomExample);
BigDecimal tagPriceMax = singleProductActivityCustomList.get(0).getTagPriceMax(); //最大吊牌价
CutPriceCnfTplExample cutPriceCnfTplExample = new CutPriceCnfTplExample();
CutPriceCnfTplExample.Criteria cutPriceCnfTplCriteria = cutPriceCnfTplExample.createCriteria();
cutPriceCnfTplCriteria.andDelFlagEqualTo("0");
List<CutPriceCnfTpl> cutPriceCnfTplList = cutPriceCnfTplService.selectByExample(cutPriceCnfTplExample);
for(CutPriceCnfTpl cutPriceCnfTpl : cutPriceCnfTplList) {
if(tagPriceMax.compareTo(cutPriceCnfTpl.getBeginPrice()) >= 0 && tagPriceMax.compareTo(cutPriceCnfTpl.getEndPrice()) < 0) {
CutPriceCnfTplDtlExample cutPriceCnfTplDtlExample = new CutPriceCnfTplDtlExample();
CutPriceCnfTplDtlExample.Criteria cutPriceCnfTplDtlCriteria = cutPriceCnfTplDtlExample.createCriteria();
cutPriceCnfTplDtlCriteria.andDelFlagEqualTo("0").andCutPriceCnfTplIdEqualTo(cutPriceCnfTpl.getId());
List<CutPriceCnfTplDtl> cutPriceCnfTplDtlList = cutPriceCnfTplDtlService.selectByExample(cutPriceCnfTplDtlExample);
List<CutPriceCnfTplDtl> cutPriceCnfTplDtls = new ArrayList<CutPriceCnfTplDtl>();
for(CutPriceCnfTplDtl cutPriceCnfTplDtl : cutPriceCnfTplDtlList) {
if("1".equals(cutPriceCnfTplDtl.getRateType())) {
m.addObject("jcCutPriceCnfDtl", cutPriceCnfTplDtl); // 1 基础比例
}else if("2".equals(cutPriceCnfTplDtl.getRateType())) {
m.addObject("scCutPriceCnfDtl", cutPriceCnfTplDtl); // 2 首次砍
}else {
cutPriceCnfTplDtls.add(cutPriceCnfTplDtl);
}
}
Collections.sort(cutPriceCnfTplDtls, new Comparator<CutPriceCnfTplDtl>() {
@Override
public int compare(CutPriceCnfTplDtl o1, CutPriceCnfTplDtl o2) {
if(o1.getEndAmount().compareTo(o2.getEndAmount()) > 0) {
return 1;
}
if(o1.getEndAmount().compareTo(o2.getEndAmount()) == 0) {
return 0;
}
return -1;
}
});
m.addObject("oneCutPriceCnfDtl", cutPriceCnfTplDtls.get(0));
m.addObject("twoCutPriceCnfDtl", cutPriceCnfTplDtls.get(1));
m.addObject("threeCutPriceCnfDtl", cutPriceCnfTplDtls.get(2));
m.addObject("fourCutPriceCnfDtl", cutPriceCnfTplDtls.get(3));
m.addObject("fiveCutPriceCnfDtl", cutPriceCnfTplDtls.get(4));
m.addObject("sixCutPriceCnfDtl", cutPriceCnfTplDtls.get(5));
m.addObject("sevenCutPriceCnfDtl", cutPriceCnfTplDtls.get(6));
break;
}
}
}
}
return m;
}
/**
*
* @Title showResult
* @Description TODO(开始计算)
* @author pengl
* @date 2018年6月6日 下午5:50:29
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/showResult.shtml")
public Map<String, Object> showResult(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg = null;
try {
String singleProductActivityId = paramMap.get("singleProductActivityId");
if(!StringUtil.isEmpty(singleProductActivityId)) {
SingleProductActivityCustomExample singleProductActivityCustomExample = new SingleProductActivityCustomExample();
SingleProductActivityCustomExample.SingleProductActivityCustomCriteria singleProductActivityCustomCriteria = singleProductActivityCustomExample.createCriteria();
singleProductActivityCustomCriteria.andDelFlagEqualTo("0")
.andIdEqualTo(Integer.parseInt(singleProductActivityId));
List<SingleProductActivityCustom> singleProductActivityCustomList = singleProductActivityService.selectByCustomExampl(singleProductActivityCustomExample);
BigDecimal tagPriceMax = singleProductActivityCustomList.get(0).getTagPriceMax(); //最大吊牌价
Map<String, CutPriceCnfDtl> cutPriceCnfDtlMap = new HashMap<String, CutPriceCnfDtl>();
CutPriceCnfDtl oneCutPriceCnfDtl = new CutPriceCnfDtl();
if(!StringUtil.isEmpty(paramMap.get("oneBeginAmount"))) {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneBeginAmount")));
}else {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(0));
}
oneCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("oneEndAmount")));
oneCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("oneBeginRate")));
oneCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("oneEndRate")));
cutPriceCnfDtlMap.put("oneCutPriceCnfDtl", oneCutPriceCnfDtl);
CutPriceCnfDtl twoCutPriceCnfDtl = new CutPriceCnfDtl();
twoCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneEndAmount")));
twoCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("twoEndAmount")));
twoCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("twoBeginRate")));
twoCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("twoEndRate")));
cutPriceCnfDtlMap.put("twoCutPriceCnfDtl", twoCutPriceCnfDtl);
CutPriceCnfDtl threeCutPriceCnfDtl = new CutPriceCnfDtl();
threeCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("twoEndAmount")));
threeCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("threeEndAmount")));
threeCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("threeBeginRate")));
threeCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("threeEndRate")));
cutPriceCnfDtlMap.put("threeCutPriceCnfDtl", threeCutPriceCnfDtl);
CutPriceCnfDtl fourCutPriceCnfDtl = new CutPriceCnfDtl();
fourCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("threeEndAmount")));
fourCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fourCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fourBeginRate")));
fourCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fourEndRate")));
cutPriceCnfDtlMap.put("fourCutPriceCnfDtl", fourCutPriceCnfDtl);
CutPriceCnfDtl fiveCutPriceCnfDtl = new CutPriceCnfDtl();
fiveCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fiveCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
fiveCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fiveBeginRate")));
fiveCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fiveEndRate")));
cutPriceCnfDtlMap.put("fiveCutPriceCnfDtl", fiveCutPriceCnfDtl);
CutPriceCnfDtl sixCutPriceCnfDtl = new CutPriceCnfDtl();
sixCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
sixCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sixCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sixBeginRate")));
sixCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sixEndRate")));
cutPriceCnfDtlMap.put("sixCutPriceCnfDtl", sixCutPriceCnfDtl);
CutPriceCnfDtl sevenCutPriceCnfDtl = new CutPriceCnfDtl();
sevenCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sevenCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sevenEndAmount")));
sevenCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sevenBeginRate")));
sevenCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sevenEndRate")));
cutPriceCnfDtlMap.put("sevenCutPriceCnfDtl", sevenCutPriceCnfDtl);
CutPriceCnfDtl jcCutPriceCnfDtl = new CutPriceCnfDtl();
jcCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("jcBeginRate")));
jcCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("jcEndRate")));
cutPriceCnfDtlMap.put("jcCutPriceCnfDtl", jcCutPriceCnfDtl);
String flagBegin = "begin";
float amountMin = tagPriceMax.multiply(new BigDecimal(paramMap.get("scBeginRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
String flagEnd = "end";
float amountMax = tagPriceMax.multiply(new BigDecimal(paramMap.get("scEndRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
Map<String, Object> mapNum = new HashMap<String, Object>();
mapNum.put("daySum", 1);
mapNum.put("oneNum", 0);
mapNum.put("twoNum", 0);
mapNum.put("threeNum", 0);
mapNum.put("fourNum", 0);
mapNum.put("fiveNum", 0);
mapNum.put("sixNum", 0);
mapNum.put("sevenNum", 0);
Map<String, Object> mapMin = this.kjNum(tagPriceMax, cutPriceCnfDtlMap, amountMax, flagEnd, mapNum);
Map<String, Object> mapMax = this.kjNum(tagPriceMax, cutPriceCnfDtlMap, amountMin, flagBegin, mapNum);
resMap.put("mapMin", mapMin);
resMap.put("mapMax", mapMax);
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
/**
*
* @Title kjDay
* @Description TODO(开始结算递归方法)
* @author pengl
* @date 2018年6月7日 上午9:29:19
*/
public Map<String, Object> kjNum(BigDecimal tagPrice, Map<String, CutPriceCnfDtl> cutPriceCnfDtlMap, float amount, String flag, Map<String, Object> map) {
if(cutPriceCnfDtlMap != null) {
if(tagPrice != null && amount < tagPrice.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
Integer daySum = (Integer) map.get("daySum");
Integer oneNum = (Integer) map.get("oneNum");
Integer twoNum = (Integer) map.get("twoNum");
Integer threeNum = (Integer) map.get("threeNum");
Integer fourNum = (Integer) map.get("fourNum");
Integer fiveNum = (Integer) map.get("fiveNum");
Integer sixNum = (Integer) map.get("sixNum");
Integer sevenNum = (Integer) map.get("sevenNum");
CutPriceCnfDtl oneCutPriceCnfDtl = cutPriceCnfDtlMap.get("oneCutPriceCnfDtl");
CutPriceCnfDtl twoCutPriceCnfDtl = cutPriceCnfDtlMap.get("twoCutPriceCnfDtl");
CutPriceCnfDtl threeCutPriceCnfDtl = cutPriceCnfDtlMap.get("threeCutPriceCnfDtl");
CutPriceCnfDtl fourCutPriceCnfDtl = cutPriceCnfDtlMap.get("fourCutPriceCnfDtl");
CutPriceCnfDtl fiveCutPriceCnfDtl = cutPriceCnfDtlMap.get("fiveCutPriceCnfDtl");
CutPriceCnfDtl sixCutPriceCnfDtl = cutPriceCnfDtlMap.get("sixCutPriceCnfDtl");
CutPriceCnfDtl sevenCutPriceCnfDtl = cutPriceCnfDtlMap.get("sevenCutPriceCnfDtl");
CutPriceCnfDtl jcCutPriceCnfDtl = cutPriceCnfDtlMap.get("jcCutPriceCnfDtl");
if(amount >= oneCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < oneCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(oneCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(oneCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++oneNum;
}else if(amount >= twoCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < twoCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(twoCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(twoCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++twoNum;
}else if(amount >= threeCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < threeCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(threeCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(threeCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++threeNum;
}else if(amount >= fourCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < fourCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(fourCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(fourCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++fourNum;
}else if(amount >= fiveCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < fiveCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(fiveCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(fiveCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++fiveNum;
}else if(amount >= sixCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < sixCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(sixCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(sixCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++sixNum;
}else if(amount >= sevenCutPriceCnfDtl.getBeginAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue() && amount < sevenCutPriceCnfDtl.getEndAmount().setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()) {
if("begin".equals(flag)) {
amount = tagPrice.multiply(sevenCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(sevenCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
++sevenNum;
}else{
if("begin".equals(flag)) {
amount = tagPrice.multiply(jcCutPriceCnfDtl.getBeginRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}else if("end".equals(flag)) {
amount = tagPrice.multiply(jcCutPriceCnfDtl.getEndRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(amount)).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
}
++daySum;
Map<String, Object> mapNew = new HashMap<String, Object>();
mapNew.put("daySum", daySum);
mapNew.put("oneNum", oneNum);
mapNew.put("twoNum", twoNum);
mapNew.put("threeNum", threeNum);
mapNew.put("fourNum", fourNum);
mapNew.put("fiveNum", fiveNum);
mapNew.put("sixNum", sixNum);
mapNew.put("sevenNum", sevenNum);
return kjNum(tagPrice, cutPriceCnfDtlMap, amount, flag, mapNew);
}
}
return map;
}
/**
*
* @Title addOrUpdateCutPriceCnf
* @Description TODO(这里用一句话描述这个方法的作用)
* @author pengl
* @date 2018年6月7日 下午2:52:00
*/
@RequestMapping("/cutPriceProduct/addOrUpdateCutPriceCnf.shtml")
public ModelAndView addOrUpdateCutPriceCnf(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
String rtPage = "/success/success";
Map<String, Object> resMap = new HashMap<String, Object>();
String code = "";
String msg = "";
try {
String singleProductActivityId = paramMap.get("singleProductActivityId");
String singleAuditStatus=null;
if(!StringUtil.isEmpty(singleProductActivityId)) {
StaffBean staffBean = this.getSessionStaffBean(request);
Integer staffId = Integer.valueOf(staffBean.getStaffID());
Date date = new Date();
SingleProductActivityCustomExample singleProductActivityCustomExample = new SingleProductActivityCustomExample();
SingleProductActivityCustomExample.SingleProductActivityCustomCriteria singleProductActivityCustomCriteria = singleProductActivityCustomExample.createCriteria();
singleProductActivityCustomCriteria.andDelFlagEqualTo("0")
.andIdEqualTo(Integer.parseInt(singleProductActivityId));
List<SingleProductActivityCustom> singleProductActivityCustomList = singleProductActivityService.selectByCustomExampl(singleProductActivityCustomExample);
if(singleProductActivityCustomList == null || singleProductActivityCustomList.size() == 0) {
resMap.put(this.JSON_RESULT_CODE, StateCode.JSON_AJAX_ERROR.getStateCode());
resMap.put(this.JSON_RESULT_MESSAGE, "单品不存在!");
return new ModelAndView(rtPage,resMap);
}
singleAuditStatus=singleProductActivityCustomList.get(0).getAuditStatus();
BigDecimal tagPriceMax = singleProductActivityCustomList.get(0).getTagPriceMax(); //最大吊牌价
Map<String, CutPriceCnfDtl> cutPriceCnfDtlMap = new HashMap<String, CutPriceCnfDtl>();
CutPriceCnfDtl oneCutPriceCnfDtl = new CutPriceCnfDtl();
if(!StringUtil.isEmpty(paramMap.get("oneBeginAmount"))) {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneBeginAmount")));
}else {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(0));
}
oneCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("oneEndAmount")));
oneCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("oneBeginRate")));
oneCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("oneEndRate")));
cutPriceCnfDtlMap.put("oneCutPriceCnfDtl", oneCutPriceCnfDtl);
CutPriceCnfDtl twoCutPriceCnfDtl = new CutPriceCnfDtl();
twoCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneEndAmount")));
twoCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("twoEndAmount")));
twoCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("twoBeginRate")));
twoCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("twoEndRate")));
cutPriceCnfDtlMap.put("twoCutPriceCnfDtl", twoCutPriceCnfDtl);
CutPriceCnfDtl threeCutPriceCnfDtl = new CutPriceCnfDtl();
threeCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("twoEndAmount")));
threeCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("threeEndAmount")));
threeCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("threeBeginRate")));
threeCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("threeEndRate")));
cutPriceCnfDtlMap.put("threeCutPriceCnfDtl", threeCutPriceCnfDtl);
CutPriceCnfDtl fourCutPriceCnfDtl = new CutPriceCnfDtl();
fourCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("threeEndAmount")));
fourCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fourCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fourBeginRate")));
fourCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fourEndRate")));
cutPriceCnfDtlMap.put("fourCutPriceCnfDtl", fourCutPriceCnfDtl);
CutPriceCnfDtl fiveCutPriceCnfDtl = new CutPriceCnfDtl();
fiveCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fiveCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
fiveCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fiveBeginRate")));
fiveCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fiveEndRate")));
cutPriceCnfDtlMap.put("fiveCutPriceCnfDtl", fiveCutPriceCnfDtl);
CutPriceCnfDtl sixCutPriceCnfDtl = new CutPriceCnfDtl();
sixCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
sixCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sixCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sixBeginRate")));
sixCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sixEndRate")));
cutPriceCnfDtlMap.put("sixCutPriceCnfDtl", sixCutPriceCnfDtl);
CutPriceCnfDtl sevenCutPriceCnfDtl = new CutPriceCnfDtl();
sevenCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sevenCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sevenEndAmount")));
sevenCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sevenBeginRate")));
sevenCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sevenEndRate")));
cutPriceCnfDtlMap.put("sevenCutPriceCnfDtl", sevenCutPriceCnfDtl);
CutPriceCnfDtl jcCutPriceCnfDtl = new CutPriceCnfDtl();
jcCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("jcBeginRate")));
jcCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("jcEndRate")));
cutPriceCnfDtlMap.put("jcCutPriceCnfDtl", jcCutPriceCnfDtl);
String flagBegin = "begin";
float amountMin = tagPriceMax.multiply(new BigDecimal(paramMap.get("scBeginRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
String flagEnd = "end";
float amountMax = tagPriceMax.multiply(new BigDecimal(paramMap.get("scEndRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
Map<String, Object> mapNum = new HashMap<String, Object>();
mapNum.put("daySum", 1);
mapNum.put("oneNum", 0);
mapNum.put("twoNum", 0);
mapNum.put("threeNum", 0);
mapNum.put("fourNum", 0);
mapNum.put("fiveNum", 0);
mapNum.put("sixNum", 0);
mapNum.put("sevenNum", 0);
Map<String, Object> mapMin = this.kjNum(tagPriceMax, cutPriceCnfDtlMap, amountMax, flagEnd, mapNum);
Map<String, Object> mapMax = this.kjNum(tagPriceMax, cutPriceCnfDtlMap, amountMin, flagBegin, mapNum);
CutPriceCnf cutPriceCnf = new CutPriceCnf();
cutPriceCnf.setPredictMinTimes((Integer)mapMin.get("daySum"));
cutPriceCnf.setPredictMaxTimes((Integer)mapMax.get("daySum"));
CutPriceCnfDtl scCutPriceCnfDtl = new CutPriceCnfDtl();
scCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("scBeginRate")));
scCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("scEndRate")));
String cutPriceCnfId = paramMap.get("cutPriceCnfId");
List<CutPriceCnfDtl> cutPriceCnfDtlList = new ArrayList<CutPriceCnfDtl>();
if(!StringUtil.isEmpty(cutPriceCnfId)) { //修改
//砍价方案
cutPriceCnf.setId(Integer.parseInt(cutPriceCnfId));
cutPriceCnf.setUpdateBy(staffId);
cutPriceCnf.setUpdateDate(date);
//砍价方案明细
oneCutPriceCnfDtl.setUpdateBy(staffId);
oneCutPriceCnfDtl.setUpdateDate(date);
oneCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("oneCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(oneCutPriceCnfDtl);
twoCutPriceCnfDtl.setUpdateBy(staffId);
twoCutPriceCnfDtl.setUpdateDate(date);
twoCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("twoCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(twoCutPriceCnfDtl);
threeCutPriceCnfDtl.setUpdateBy(staffId);
threeCutPriceCnfDtl.setUpdateDate(date);
threeCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("threeCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(threeCutPriceCnfDtl);
fourCutPriceCnfDtl.setUpdateBy(staffId);
fourCutPriceCnfDtl.setUpdateDate(date);
fourCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("fourCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(fourCutPriceCnfDtl);
fiveCutPriceCnfDtl.setUpdateBy(staffId);
fiveCutPriceCnfDtl.setUpdateDate(date);
fiveCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("fiveCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(fiveCutPriceCnfDtl);
sixCutPriceCnfDtl.setUpdateBy(staffId);
sixCutPriceCnfDtl.setUpdateDate(date);
sixCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("sixCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(sixCutPriceCnfDtl);
sevenCutPriceCnfDtl.setUpdateBy(staffId);
sevenCutPriceCnfDtl.setUpdateDate(date);
sevenCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("sevenCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(sevenCutPriceCnfDtl);
jcCutPriceCnfDtl.setUpdateBy(staffId);
jcCutPriceCnfDtl.setUpdateDate(date);
jcCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("jcCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(jcCutPriceCnfDtl);
scCutPriceCnfDtl.setUpdateBy(staffId);
scCutPriceCnfDtl.setUpdateDate(date);
scCutPriceCnfDtl.setId(Integer.parseInt(paramMap.get("scCutPriceCnfDtlId")));
cutPriceCnfDtlList.add(scCutPriceCnfDtl);
}else { //新增
//砍价方案
cutPriceCnf.setSingleProductActivityId(Integer.parseInt(singleProductActivityId));
cutPriceCnf.setNeedCutToPrice(new BigDecimal(0));
cutPriceCnf.setMinCutToPrice(new BigDecimal(0));
cutPriceCnf.setCreateBy(staffId);
cutPriceCnf.setCreateDate(date);
//砍价方案明细
oneCutPriceCnfDtl.setCreateBy(staffId);
oneCutPriceCnfDtl.setCreateDate(date);
oneCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(oneCutPriceCnfDtl);
twoCutPriceCnfDtl.setCreateBy(staffId);
twoCutPriceCnfDtl.setCreateDate(date);
twoCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(twoCutPriceCnfDtl);
threeCutPriceCnfDtl.setCreateBy(staffId);
threeCutPriceCnfDtl.setCreateDate(date);
threeCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(threeCutPriceCnfDtl);
fourCutPriceCnfDtl.setCreateBy(staffId);
fourCutPriceCnfDtl.setCreateDate(date);
fourCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(fourCutPriceCnfDtl);
fiveCutPriceCnfDtl.setCreateBy(staffId);
fiveCutPriceCnfDtl.setCreateDate(date);
fiveCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(fiveCutPriceCnfDtl);
sixCutPriceCnfDtl.setCreateBy(staffId);
sixCutPriceCnfDtl.setCreateDate(date);
sixCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(sixCutPriceCnfDtl);
sevenCutPriceCnfDtl.setCreateBy(staffId);
sevenCutPriceCnfDtl.setCreateDate(date);
sevenCutPriceCnfDtl.setRateType("3");
cutPriceCnfDtlList.add(sevenCutPriceCnfDtl);
jcCutPriceCnfDtl.setCreateBy(staffId);
jcCutPriceCnfDtl.setCreateDate(date);
jcCutPriceCnfDtl.setRateType("1");
cutPriceCnfDtlList.add(jcCutPriceCnfDtl);
scCutPriceCnfDtl.setCreateBy(staffId);
scCutPriceCnfDtl.setCreateDate(date);
scCutPriceCnfDtl.setRateType("2");
cutPriceCnfDtlList.add(scCutPriceCnfDtl);
}
cutPriceCnfService.addOrUpdateCutPriceCnf(cutPriceCnf, cutPriceCnfDtlList);
}
//申请中修改为初审通过
if ("0".equals(singleAuditStatus)){
SingleProductActivity singleProductActivity2=new SingleProductActivity();
singleProductActivity2.setId(Integer.parseInt(singleProductActivityId));
singleProductActivity2.setAuditStatus("1");
singleProductActivityService.updateByPrimaryKeySelective(singleProductActivity2);
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
e.printStackTrace();
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return new ModelAndView(rtPage, resMap);
}
/**
*
* @Title updateAuditStatusManager
* @Description TODO(审核)
* @author pengl
* @date 2018年6月7日 下午3:05:05
*/
@RequestMapping("/cutPriceProduct/updateAuditStatusManager.shtml")
public ModelAndView updateAuditStatusManager(HttpServletRequest request) {
ModelAndView m = new ModelAndView("/cutPrice/cutPriceProduct/updateAuditStatus");
String singleProductActivityId = request.getParameter("singleProductActivityId");
if(!StringUtil.isEmpty(singleProductActivityId)) {
SingleProductActivityCustomExample singleProductActivityCustomExample = new SingleProductActivityCustomExample();
SingleProductActivityCustomExample.SingleProductActivityCustomCriteria singleProductActivityCustomCriteria = singleProductActivityCustomExample.createCriteria();
singleProductActivityCustomCriteria.andDelFlagEqualTo("0")
.andIdEqualTo(Integer.parseInt(singleProductActivityId));
List<SingleProductActivityCustom> singleProductActivityCustomList = singleProductActivityService.selectByCustomExampl(singleProductActivityCustomExample);
SingleProductActivityCustom singleProductActivityCustom = singleProductActivityCustomList.get(0);
SingleProductActivityAuditLogExample singleProductActivityAuditLogExample = new SingleProductActivityAuditLogExample();
singleProductActivityAuditLogExample.createCriteria().andDelFlagEqualTo("0")
.andSingleProductActivityIdEqualTo(singleProductActivityCustom.getId())
.andStatusEqualTo(singleProductActivityCustom.getAuditStatus());
singleProductActivityAuditLogExample.setOrderByClause(" id desc");
singleProductActivityAuditLogExample.setLimitStart(0);
singleProductActivityAuditLogExample.setLimitSize(1);
List<SingleProductActivityAuditLog> singleProductActivityAuditLogList = singleProductActivityAuditLogService.selectByExample(singleProductActivityAuditLogExample);
if(singleProductActivityAuditLogList != null && singleProductActivityAuditLogList.size() > 0) {
singleProductActivityCustom.setRemarksLog(singleProductActivityAuditLogList.get(0).getRemarks());
}
m.addObject("singleProductActivityCustom", singleProductActivityCustom);
}
return m;
}
/**
*
* @Title updateAuditStatus
* @Description TODO(审核)
* @author pengl
* @date 2018年6月7日 下午4:09:55
*/
@RequestMapping("/cutPriceProduct/updateAuditStatus.shtml")
public ModelAndView updateAuditStatus(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
String rtPage = "/success/success";
Map<String, Object> resMap = new HashMap<String, Object>();
String code = "";
String msg = "";
try {
String singleProductActivityId = paramMap.get("singleProductActivityId");
if(!StringUtil.isEmpty(singleProductActivityId)) {
StaffBean staffBean = this.getSessionStaffBean(request);
Integer staffId = Integer.valueOf(staffBean.getStaffID());
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR, 1);
SingleProductActivity singleProductActivity = new SingleProductActivity();
singleProductActivity.setId(Integer.parseInt(singleProductActivityId));
singleProductActivity.setBeginTime(date);
singleProductActivity.setEndTime(calendar.getTime());
singleProductActivity.setAuditStatus(paramMap.get("auditStatus"));
if("4".equals(paramMap.get("auditStatus"))) { //审核驳回时,同时要把该商品关闭
singleProductActivity.setIsClose("1");
}else {
if(!StringUtil.isEmpty(paramMap.get("unrealityNum"))) {
singleProductActivity.setUnrealityNum(Integer.parseInt(paramMap.get("unrealityNum")));
}
if(!StringUtil.isEmpty(paramMap.get("tomorrowIncreaseMin"))) {
singleProductActivity.setTomorrowIncreaseMin(Integer.parseInt(paramMap.get("tomorrowIncreaseMin")));
}
if(!StringUtil.isEmpty(paramMap.get("tomorrowIncreaseMax"))) {
singleProductActivity.setTomorrowIncreaseMax(Integer.parseInt(paramMap.get("tomorrowIncreaseMax")));
}
}
if(!StringUtil.isEmpty(paramMap.get("activityPrice"))) {
singleProductActivity.setActivityPrice(new BigDecimal(paramMap.get("activityPrice")));
}
singleProductActivity.setStatus("0"); //下架状态
singleProductActivity.setFirstAuditBy(staffId);
singleProductActivity.setScheduleAuditBy(staffId);
singleProductActivity.setUpdateBy(staffId);
singleProductActivity.setUpdateDate(date);
SingleProductActivityAuditLog singleProductActivityAuditLog = new SingleProductActivityAuditLog();
singleProductActivityAuditLog.setSingleProductActivityId(Integer.parseInt(singleProductActivityId));
singleProductActivityAuditLog.setStatus(paramMap.get("auditStatus"));
singleProductActivityAuditLog.setCreateBy(staffId);
singleProductActivityAuditLog.setCreateDate(date);
singleProductActivityAuditLog.setRemarks(paramMap.get("remarksLog"));
//商品上架、通过
Product product = new Product();
product.setId(Integer.parseInt(request.getParameter("productId")));
product.setStatus("1");
product.setAuditStatus("2");
product.setMinSalePrice(singleProductActivity.getActivityPrice()); // 最低销售价
product.setUpdateDate(new Date());
product.setUpdateBy(staffId);
cutPriceCnfService.updateAuditStatus(singleProductActivity, singleProductActivityAuditLog, product);
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
e.printStackTrace();
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return new ModelAndView(rtPage, resMap);
}
/**
*
* @Title cutPriceCnfTplManager
* @Description TODO(砍价方案模版)
* @author pengl
* @date 2018年6月5日 下午6:20:57
*/
@RequestMapping("/cutPriceProduct/cutPriceCnfTplManager.shtml")
public ModelAndView cutPriceCnfTplManager(HttpServletRequest request) {
ModelAndView m = new ModelAndView("/cutPrice/cutPriceProduct/getCutPriceCnfTplList");
return m;
}
/**
*
* @Title getCutPriceCnfTplList
* @Description TODO(这里用一句话描述这个方法的作用)
* @author pengl
* @date 2018年6月5日 下午6:24:53
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/getCutPriceCnfTplList.shtml")
public Map<String, Object> getCutPriceCnfTplList(HttpServletRequest request, Page page) {
Map<String, Object> resMap = new HashMap<String, Object>();
List<CutPriceCnfTplCustom> dataList = null;
Integer totalCount = 0;
try {
CutPriceCnfTplCustomExample cutPriceCnfTplCustomExample = new CutPriceCnfTplCustomExample();
CutPriceCnfTplCustomExample.CutPriceCnfTplCriteria cutPriceCnfTplCustomCriteria = cutPriceCnfTplCustomExample.createCriteria();
cutPriceCnfTplCustomCriteria.andDelFlagEqualTo("0");
cutPriceCnfTplCustomExample.setOrderByClause(" t.id desc");
cutPriceCnfTplCustomExample.setLimitStart(page.getLimitStart());
cutPriceCnfTplCustomExample.setLimitSize(page.getLimitSize());
totalCount = cutPriceCnfTplService.countByCustomExample(cutPriceCnfTplCustomExample);
dataList = cutPriceCnfTplService.selectByCustomExample(cutPriceCnfTplCustomExample);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resMap.put("Rows", dataList);
resMap.put("Total", totalCount);
return resMap;
}
/**
*
* @Title addOrUpdateOrSeeCutPriceCnfTplManager
* @Description TODO(这里用一句话描述这个方法的作用)
* @author pengl
* @date 2018年6月7日 下午6:04:30
*/
@RequestMapping("/cutPriceProduct/addOrUpdateOrSeeCutPriceCnfTplManager.shtml")
public ModelAndView addOrUpdateOrSeeCutPriceCnfTplManager(HttpServletRequest request) {
ModelAndView m = new ModelAndView("/cutPrice/cutPriceProduct/addOrUpdateOrSeeCutPriceCnfTpl");
String cutPriceCnfTplId = request.getParameter("cutPriceCnfTplId");
if(!StringUtil.isEmpty(cutPriceCnfTplId)) {
CutPriceCnfTpl cutPriceCnfTpl = cutPriceCnfTplService.selectByCustomPrimaryKey(Integer.parseInt(cutPriceCnfTplId));
CutPriceCnfTplDtlExample cutPriceCnfTplDtlExample = new CutPriceCnfTplDtlExample();
CutPriceCnfTplDtlExample.Criteria cutPriceCnfTplDtlCriteria = cutPriceCnfTplDtlExample.createCriteria();
cutPriceCnfTplDtlCriteria.andDelFlagEqualTo("0")
.andCutPriceCnfTplIdEqualTo(cutPriceCnfTpl.getId());
List<CutPriceCnfTplDtl> cutPriceCnfTplDtlList = cutPriceCnfTplDtlService.selectByExample(cutPriceCnfTplDtlExample);
List<CutPriceCnfTplDtl> cutPriceCnfTplDtls = new ArrayList<CutPriceCnfTplDtl>();
for(CutPriceCnfTplDtl cutPriceCnfTplDtl : cutPriceCnfTplDtlList) {
if("1".equals(cutPriceCnfTplDtl.getRateType())) {
m.addObject("jcCutPriceCnfTplDtl", cutPriceCnfTplDtl);
}else if("2".equals(cutPriceCnfTplDtl.getRateType())) {
m.addObject("scCutPriceCnfTplDtl", cutPriceCnfTplDtl);
}else {
cutPriceCnfTplDtls.add(cutPriceCnfTplDtl);
}
}
Collections.sort(cutPriceCnfTplDtls, new Comparator<CutPriceCnfTplDtl>() {
@Override
public int compare(CutPriceCnfTplDtl o1, CutPriceCnfTplDtl o2) {
if(o1.getEndAmount().compareTo(o2.getEndAmount()) > 0) {
return 1;
}
if(o1.getEndAmount().compareTo(o2.getEndAmount()) == 0) {
return 0;
}
return -1;
}
});
m.addObject("flag", request.getParameter("flag"));
m.addObject("cutPriceCnfTpl", cutPriceCnfTpl);
m.addObject("oneCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(0));
m.addObject("twoCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(1));
m.addObject("threeCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(2));
m.addObject("fourCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(3));
m.addObject("fiveCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(4));
m.addObject("sixCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(5));
m.addObject("sevenCutPriceCnfTplDtl", cutPriceCnfTplDtls.get(6));
m.addObject("beginPrice", cutPriceCnfTpl.getBeginPrice().setScale(2, BigDecimal.ROUND_DOWN));
m.addObject("endPrice", cutPriceCnfTpl.getEndPrice().setScale(2, BigDecimal.ROUND_DOWN));
}
return m;
}
/**
*
* @Title showCutPriceCnfTplResult
* @Description TODO(砍价方案模版计算)
* @author pengl
* @date 2018年6月8日 上午10:24:18
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/showCutPriceCnfTplResult.shtml")
public Map<String, Object> showCutPriceCnfTplResult(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg = null;
try {
String beginPriceStr = paramMap.get("beginPrice");
String endPriceStr = paramMap.get("endPrice");
if(!StringUtil.isEmpty(beginPriceStr) && !StringUtil.isEmpty(endPriceStr)) {
BigDecimal beginPrice = new BigDecimal(beginPriceStr);
BigDecimal endPrice = new BigDecimal(endPriceStr);
BigDecimal averagePrice = (beginPrice.add(endPrice)).divide(new BigDecimal(2), 2, BigDecimal.ROUND_HALF_UP);
Map<String, CutPriceCnfDtl> cutPriceCnfDtlMap = new HashMap<String, CutPriceCnfDtl>();
CutPriceCnfDtl oneCutPriceCnfDtl = new CutPriceCnfDtl();
if(!StringUtil.isEmpty(paramMap.get("oneBeginAmount"))) {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneBeginAmount")));
}else {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(0));
}
oneCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("oneEndAmount")));
oneCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("oneBeginRate")));
oneCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("oneEndRate")));
cutPriceCnfDtlMap.put("oneCutPriceCnfDtl", oneCutPriceCnfDtl);
CutPriceCnfDtl twoCutPriceCnfDtl = new CutPriceCnfDtl();
twoCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneEndAmount")));
twoCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("twoEndAmount")));
twoCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("twoBeginRate")));
twoCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("twoEndRate")));
cutPriceCnfDtlMap.put("twoCutPriceCnfDtl", twoCutPriceCnfDtl);
CutPriceCnfDtl threeCutPriceCnfDtl = new CutPriceCnfDtl();
threeCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("twoEndAmount")));
threeCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("threeEndAmount")));
threeCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("threeBeginRate")));
threeCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("threeEndRate")));
cutPriceCnfDtlMap.put("threeCutPriceCnfDtl", threeCutPriceCnfDtl);
CutPriceCnfDtl fourCutPriceCnfDtl = new CutPriceCnfDtl();
fourCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("threeEndAmount")));
fourCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fourCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fourBeginRate")));
fourCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fourEndRate")));
cutPriceCnfDtlMap.put("fourCutPriceCnfDtl", fourCutPriceCnfDtl);
CutPriceCnfDtl fiveCutPriceCnfDtl = new CutPriceCnfDtl();
fiveCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fiveCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
fiveCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fiveBeginRate")));
fiveCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fiveEndRate")));
cutPriceCnfDtlMap.put("fiveCutPriceCnfDtl", fiveCutPriceCnfDtl);
CutPriceCnfDtl sixCutPriceCnfDtl = new CutPriceCnfDtl();
sixCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
sixCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sixCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sixBeginRate")));
sixCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sixEndRate")));
cutPriceCnfDtlMap.put("sixCutPriceCnfDtl", sixCutPriceCnfDtl);
CutPriceCnfDtl sevenCutPriceCnfDtl = new CutPriceCnfDtl();
sevenCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sevenCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sevenEndAmount")));
sevenCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sevenBeginRate")));
sevenCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sevenEndRate")));
cutPriceCnfDtlMap.put("sevenCutPriceCnfDtl", sevenCutPriceCnfDtl);
CutPriceCnfDtl jcCutPriceCnfDtl = new CutPriceCnfDtl();
jcCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("jcBeginRate")));
jcCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("jcEndRate")));
cutPriceCnfDtlMap.put("jcCutPriceCnfDtl", jcCutPriceCnfDtl);
String flagBegin = "begin";
float amountMin = averagePrice.multiply(new BigDecimal(paramMap.get("scBeginRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
String flagEnd = "end";
float amountMax = averagePrice.multiply(new BigDecimal(paramMap.get("scEndRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
Map<String, Object> mapNum = new HashMap<String, Object>();
mapNum.put("daySum", 1);
mapNum.put("oneNum", 0);
mapNum.put("twoNum", 0);
mapNum.put("threeNum", 0);
mapNum.put("fourNum", 0);
mapNum.put("fiveNum", 0);
mapNum.put("sixNum", 0);
mapNum.put("sevenNum", 0);
Map<String, Object> mapMin = this.kjNum(averagePrice, cutPriceCnfDtlMap, amountMax, flagEnd, mapNum);
Map<String, Object> mapMax = this.kjNum(averagePrice, cutPriceCnfDtlMap, amountMin, flagBegin, mapNum);
resMap.put("mapMin", mapMin);
resMap.put("mapMax", mapMax);
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
/**
*
* @Title addOrUpdateCutPriceCnfTpl
* @Description TODO(新增或修改砍价方案模版)
* @author pengl
* @date 2018年6月8日 上午11:38:57
*/
@RequestMapping("/cutPriceProduct/addOrUpdateCutPriceCnfTpl.shtml")
public ModelAndView addOrUpdateCutPriceCnfTpl(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
String rtPage = "/success/success";
Map<String, Object> resMap = new HashMap<String, Object>();
String code = "";
String msg = "";
try {
StaffBean staffBean = this.getSessionStaffBean(request);
Integer staffId = Integer.valueOf(staffBean.getStaffID());
Date date = new Date();
Map<String, CutPriceCnfDtl> cutPriceCnfDtlMap = new HashMap<String, CutPriceCnfDtl>();
List<CutPriceCnfTplDtl> cutPriceCnfTplDtlList = new ArrayList<CutPriceCnfTplDtl>();
//砍价方案模版明细
//首次
CutPriceCnfTplDtl scCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
scCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("scBeginRate")));
scCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("scEndRate")));
//计算
CutPriceCnfDtl oneCutPriceCnfDtl = new CutPriceCnfDtl();
if(!StringUtil.isEmpty(paramMap.get("oneBeginAmount"))) {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneBeginAmount")));
}else {
oneCutPriceCnfDtl.setBeginAmount(new BigDecimal(0));
}
oneCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("oneEndAmount")));
oneCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("oneBeginRate")));
oneCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("oneEndRate")));
cutPriceCnfDtlMap.put("oneCutPriceCnfDtl", oneCutPriceCnfDtl);
CutPriceCnfDtl twoCutPriceCnfDtl = new CutPriceCnfDtl();
twoCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("oneEndAmount")));
twoCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("twoEndAmount")));
twoCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("twoBeginRate")));
twoCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("twoEndRate")));
cutPriceCnfDtlMap.put("twoCutPriceCnfDtl", twoCutPriceCnfDtl);
CutPriceCnfDtl threeCutPriceCnfDtl = new CutPriceCnfDtl();
threeCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("twoEndAmount")));
threeCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("threeEndAmount")));
threeCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("threeBeginRate")));
threeCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("threeEndRate")));
cutPriceCnfDtlMap.put("threeCutPriceCnfDtl", threeCutPriceCnfDtl);
CutPriceCnfDtl fourCutPriceCnfDtl = new CutPriceCnfDtl();
fourCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("threeEndAmount")));
fourCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fourCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fourBeginRate")));
fourCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fourEndRate")));
cutPriceCnfDtlMap.put("fourCutPriceCnfDtl", fourCutPriceCnfDtl);
CutPriceCnfDtl fiveCutPriceCnfDtl = new CutPriceCnfDtl();
fiveCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fiveCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
fiveCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("fiveBeginRate")));
fiveCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("fiveEndRate")));
cutPriceCnfDtlMap.put("fiveCutPriceCnfDtl", fiveCutPriceCnfDtl);
CutPriceCnfDtl sixCutPriceCnfDtl = new CutPriceCnfDtl();
sixCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
sixCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sixCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sixBeginRate")));
sixCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sixEndRate")));
cutPriceCnfDtlMap.put("sixCutPriceCnfDtl", sixCutPriceCnfDtl);
CutPriceCnfDtl sevenCutPriceCnfDtl = new CutPriceCnfDtl();
sevenCutPriceCnfDtl.setBeginAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sevenCutPriceCnfDtl.setEndAmount(new BigDecimal(paramMap.get("sevenEndAmount")));
sevenCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("sevenBeginRate")));
sevenCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("sevenEndRate")));
cutPriceCnfDtlMap.put("sevenCutPriceCnfDtl", sevenCutPriceCnfDtl);
CutPriceCnfDtl jcCutPriceCnfDtl = new CutPriceCnfDtl();
jcCutPriceCnfDtl.setBeginRate(new BigDecimal(paramMap.get("jcBeginRate")));
jcCutPriceCnfDtl.setEndRate(new BigDecimal(paramMap.get("jcEndRate")));
cutPriceCnfDtlMap.put("jcCutPriceCnfDtl", jcCutPriceCnfDtl);
//金额区间
CutPriceCnfTplDtl oneCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
if(!StringUtil.isEmpty(paramMap.get("oneBeginAmount"))) {
oneCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("oneBeginAmount")));
}else {
oneCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(0));
}
oneCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("oneEndAmount")));
oneCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("oneBeginRate")));
oneCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("oneEndRate")));
CutPriceCnfTplDtl twoCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
twoCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("oneEndAmount")));
twoCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("twoEndAmount")));
twoCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("twoBeginRate")));
twoCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("twoEndRate")));
CutPriceCnfTplDtl threeCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
threeCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("twoEndAmount")));
threeCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("threeEndAmount")));
threeCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("threeBeginRate")));
threeCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("threeEndRate")));
CutPriceCnfTplDtl fourCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
fourCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("threeEndAmount")));
fourCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fourCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("fourBeginRate")));
fourCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("fourEndRate")));
CutPriceCnfTplDtl fiveCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
fiveCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("fourEndAmount")));
fiveCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
fiveCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("fiveBeginRate")));
fiveCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("fiveEndRate")));
CutPriceCnfTplDtl sixCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
sixCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("fiveEndAmount")));
sixCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sixCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("sixBeginRate")));
sixCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("sixEndRate")));
CutPriceCnfTplDtl sevenCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
sevenCutPriceCnfTplDtl.setBeginAmount(new BigDecimal(paramMap.get("sixEndAmount")));
sevenCutPriceCnfTplDtl.setEndAmount(new BigDecimal(paramMap.get("sevenEndAmount")));
sevenCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("sevenBeginRate")));
sevenCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("sevenEndRate")));
//基础
CutPriceCnfTplDtl jcCutPriceCnfTplDtl = new CutPriceCnfTplDtl();
jcCutPriceCnfTplDtl.setBeginRate(new BigDecimal(paramMap.get("jcBeginRate")));
jcCutPriceCnfTplDtl.setEndRate(new BigDecimal(paramMap.get("jcEndRate")));
BigDecimal beginPrice = new BigDecimal(paramMap.get("beginPrice"));
BigDecimal endPrice = new BigDecimal(paramMap.get("endPrice"));
BigDecimal averagePrice = (beginPrice.add(endPrice)).divide(new BigDecimal(2), 2, BigDecimal.ROUND_HALF_UP);
String flagBegin = "begin";
float amountMin = averagePrice.multiply(new BigDecimal(paramMap.get("scBeginRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
String flagEnd = "end";
float amountMax = averagePrice.multiply(new BigDecimal(paramMap.get("scEndRate")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).floatValue();
Map<String, Object> mapNum = new HashMap<String, Object>();
mapNum.put("daySum", 1);
mapNum.put("oneNum", 0);
mapNum.put("twoNum", 0);
mapNum.put("threeNum", 0);
mapNum.put("fourNum", 0);
mapNum.put("fiveNum", 0);
mapNum.put("sixNum", 0);
mapNum.put("sevenNum", 0);
Map<String, Object> mapMin = this.kjNum(averagePrice, cutPriceCnfDtlMap, amountMax, flagEnd, mapNum);
Map<String, Object> mapMax = this.kjNum(averagePrice, cutPriceCnfDtlMap, amountMin, flagBegin, mapNum);
//砍价方案模版
CutPriceCnfTpl cutPriceCnfTpl = new CutPriceCnfTpl();
cutPriceCnfTpl.setName(paramMap.get("name"));
cutPriceCnfTpl.setBeginPrice(new BigDecimal(paramMap.get("beginPrice")));
cutPriceCnfTpl.setEndPrice(new BigDecimal(paramMap.get("endPrice")));
cutPriceCnfTpl.setPredictMinTime((Integer)mapMin.get("daySum"));
cutPriceCnfTpl.setPredictMaxTime((Integer)mapMax.get("daySum"));
String cutPriceCnfTplId = paramMap.get("cutPriceCnfTplId");
if(!StringUtil.isEmpty(cutPriceCnfTplId)) { //修改
cutPriceCnfTpl.setId(Integer.parseInt(cutPriceCnfTplId));
cutPriceCnfTpl.setUpdateBy(staffId);
cutPriceCnfTpl.setUpdateDate(date);
scCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("scCutPriceCnfTplDtlId")));
scCutPriceCnfTplDtl.setUpdateBy(staffId);
scCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(scCutPriceCnfTplDtl);
oneCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("oneCutPriceCnfTplDtlId")));
oneCutPriceCnfTplDtl.setUpdateBy(staffId);
oneCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(oneCutPriceCnfTplDtl);
twoCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("twoCutPriceCnfTplDtlId")));
twoCutPriceCnfTplDtl.setUpdateBy(staffId);
twoCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(twoCutPriceCnfTplDtl);
threeCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("threeCutPriceCnfTplDtlId")));
threeCutPriceCnfTplDtl.setUpdateBy(staffId);
threeCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(threeCutPriceCnfTplDtl);
fourCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("fourCutPriceCnfTplDtlId")));
fourCutPriceCnfTplDtl.setUpdateBy(staffId);
fourCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(fourCutPriceCnfTplDtl);
fiveCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("fiveCutPriceCnfTplDtlId")));
fiveCutPriceCnfTplDtl.setUpdateBy(staffId);
fiveCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(fiveCutPriceCnfTplDtl);
sixCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("sixCutPriceCnfTplDtlId")));
sixCutPriceCnfTplDtl.setUpdateBy(staffId);
sixCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(sixCutPriceCnfTplDtl);
sevenCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("sevenCutPriceCnfTplDtlId")));
sevenCutPriceCnfTplDtl.setUpdateBy(staffId);
sevenCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(sevenCutPriceCnfTplDtl);
jcCutPriceCnfTplDtl.setId(Integer.parseInt(paramMap.get("jcCutPriceCnfTplDtlId")));
jcCutPriceCnfTplDtl.setUpdateBy(staffId);
jcCutPriceCnfTplDtl.setUpdateDate(date);
cutPriceCnfTplDtlList.add(jcCutPriceCnfTplDtl);
}else { //新增
cutPriceCnfTpl.setNeedCutToPrice(new BigDecimal(0));
cutPriceCnfTpl.setMinCutToPrice(new BigDecimal(0));
cutPriceCnfTpl.setCreateBy(staffId);
cutPriceCnfTpl.setCreateDate(date);
scCutPriceCnfTplDtl.setRateType("2");
scCutPriceCnfTplDtl.setCreateBy(staffId);
scCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(scCutPriceCnfTplDtl);
oneCutPriceCnfTplDtl.setRateType("3");
oneCutPriceCnfTplDtl.setCreateBy(staffId);
oneCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(oneCutPriceCnfTplDtl);
twoCutPriceCnfTplDtl.setRateType("3");
twoCutPriceCnfTplDtl.setCreateBy(staffId);
twoCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(twoCutPriceCnfTplDtl);
threeCutPriceCnfTplDtl.setRateType("3");
threeCutPriceCnfTplDtl.setCreateBy(staffId);
threeCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(threeCutPriceCnfTplDtl);
fourCutPriceCnfTplDtl.setRateType("3");
fourCutPriceCnfTplDtl.setCreateBy(staffId);
fourCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(fourCutPriceCnfTplDtl);
fiveCutPriceCnfTplDtl.setRateType("3");
fiveCutPriceCnfTplDtl.setCreateBy(staffId);
fiveCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(fiveCutPriceCnfTplDtl);
sixCutPriceCnfTplDtl.setRateType("3");
sixCutPriceCnfTplDtl.setCreateBy(staffId);
sixCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(sixCutPriceCnfTplDtl);
sevenCutPriceCnfTplDtl.setRateType("3");
sevenCutPriceCnfTplDtl.setCreateBy(staffId);
sevenCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(sevenCutPriceCnfTplDtl);
jcCutPriceCnfTplDtl.setRateType("1");
jcCutPriceCnfTplDtl.setCreateBy(staffId);
jcCutPriceCnfTplDtl.setCreateDate(date);
cutPriceCnfTplDtlList.add(jcCutPriceCnfTplDtl);
}
cutPriceCnfTplService.addOrUpdateCutPriceCnfTpl(cutPriceCnfTpl, cutPriceCnfTplDtlList);
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
e.printStackTrace();
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return new ModelAndView(rtPage, resMap);
}
/**
*
* @Title validatePrice
* @Description TODO(验证商品价格区间不能重叠)
* @author pengl
* @date 2018年6月19日 下午3:17:34
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/validatePrice.shtml")
public Map<String, Object> validatePrice(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg = null;
try {
String beginPriceStr = paramMap.get("beginPrice");
String endPriceStr = paramMap.get("endPrice");
String cutPriceCnfTplId = paramMap.get("cutPriceCnfTplId");
if(!StringUtil.isEmpty(beginPriceStr) && !StringUtil.isEmpty(endPriceStr)) {
BigDecimal beginPrice = new BigDecimal(beginPriceStr);
BigDecimal endPrice = new BigDecimal(endPriceStr);
CutPriceCnfTplCustomExample cutPriceCnfTplCustomExample = new CutPriceCnfTplCustomExample();
CutPriceCnfTplCustomExample.CutPriceCnfTplCriteria cutPriceCnfTplCustomCriteria = cutPriceCnfTplCustomExample.createCriteria();
cutPriceCnfTplCustomCriteria.andDelFlagEqualTo("0");
cutPriceCnfTplCustomExample.setOrderByClause(" t.id desc");
List<CutPriceCnfTplCustom> cutPriceCnfTplCustomList = cutPriceCnfTplService.selectByCustomExample(cutPriceCnfTplCustomExample);
for(CutPriceCnfTplCustom cutPriceCnfTplCustom : cutPriceCnfTplCustomList) {
if(StringUtil.isEmpty(cutPriceCnfTplId) || !cutPriceCnfTplId.equals(cutPriceCnfTplCustom.getId().toString())) {
if(beginPrice.compareTo(cutPriceCnfTplCustom.getBeginPrice()) > -1 && beginPrice.compareTo(cutPriceCnfTplCustom.getEndPrice()) == -1 ) {
resMap.put("flag", "此商品价格区间重叠");
break;
}else if(endPrice.compareTo(cutPriceCnfTplCustom.getBeginPrice()) == 1 && endPrice.compareTo(cutPriceCnfTplCustom.getEndPrice()) == -1 ) {
resMap.put("flag", "此商品价格区间重叠");
break;
}else if(beginPrice.compareTo(cutPriceCnfTplCustom.getBeginPrice()) == -1 && endPrice.compareTo(cutPriceCnfTplCustom.getEndPrice()) == 1 ) {
resMap.put("flag", "此商品价格区间重叠");
break;
}
}
}
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
/**
*
* @Title cutPriceCnfTplCountPrice
* @Description TODO(模版计算金额)
* @author pengl
* @date 2018年8月7日 上午10:44:59
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/cutPriceCnfTplCountPrice.shtml")
public Map<String, Object> cutPriceCnfTplCountPrice(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg = null;
try {
String beginPriceStr = paramMap.get("beginPrice");
String endPriceStr = paramMap.get("endPrice");
String priceStr = paramMap.get("price");
if(!StringUtil.isEmpty(beginPriceStr) && !StringUtil.isEmpty(endPriceStr) && !StringUtil.isEmpty(priceStr)) {
BigDecimal beginPrice = new BigDecimal(beginPriceStr);
BigDecimal endPrice = new BigDecimal(endPriceStr);
BigDecimal averagePrice = (beginPrice.add(endPrice)).divide(new BigDecimal(2), 2, BigDecimal.ROUND_HALF_UP);
BigDecimal price = averagePrice.multiply(new BigDecimal(priceStr)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
resMap.put("price", price);
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
/**
*
* @Title cutPriceCnfCountPrice
* @Description TODO(方案计算金额)
* @author pengl
* @date 2018年8月7日 上午11:26:39
*/
@ResponseBody
@RequestMapping("/cutPriceProduct/cutPriceCnfCountPrice.shtml")
public Map<String, Object> cutPriceCnfCountPrice(HttpServletRequest request, @RequestParam HashMap<String, String> paramMap) {
Map<String, Object> resMap = new HashMap<String, Object>();
String code = null;
String msg = null;
try {
String priceStr = paramMap.get("price");
String singleProductActivityId = paramMap.get("singleProductActivityId");
if(!StringUtil.isEmpty(singleProductActivityId) && !StringUtil.isEmpty(priceStr) ) {
SingleProductActivityCustomExample singleProductActivityCustomExample = new SingleProductActivityCustomExample();
SingleProductActivityCustomExample.SingleProductActivityCustomCriteria singleProductActivityCustomCriteria = singleProductActivityCustomExample.createCriteria();
singleProductActivityCustomCriteria.andDelFlagEqualTo("0")
.andIdEqualTo(Integer.parseInt(singleProductActivityId));
List<SingleProductActivityCustom> singleProductActivityCustomList = singleProductActivityService.selectByCustomExampl(singleProductActivityCustomExample);
BigDecimal tagPriceMax = singleProductActivityCustomList.get(0).getTagPriceMax(); //最大吊牌价
BigDecimal price = tagPriceMax.multiply(new BigDecimal(priceStr)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
resMap.put("price", price);
}
code = StateCode.JSON_AJAX_SUCCESS.getStateCode();
msg = StateCode.JSON_AJAX_SUCCESS.getStateMessage();
} catch (Exception e) {
code = StateCode.JSON_AJAX_ERROR.getStateCode();
msg = StateCode.JSON_AJAX_ERROR.getStateMessage();
}
resMap.put(this.JSON_RESULT_CODE, code);
resMap.put(this.JSON_RESULT_MESSAGE, msg);
return resMap;
}
}
| [
"397716215@qq.com"
] | 397716215@qq.com |
c1ce859fd9b0d0a3a4a76ce4b962e57df189756a | 7d8267ccf5cffa531a9e8ad1057f6129467f6042 | /tests/src/tests/Tests.java | 421f8e84eff58e0825ae4b587015202ff63e7875 | [] | no_license | magland/java_jfm | 258468c76db23b6f9dc46ecae38624f57f0c66c6 | b26a71abe485e432e9d252150236660480df093c | refs/heads/master | 2020-09-13T07:16:50.022062 | 2015-03-04T15:17:30 | 2015-03-04T15:17:30 | 30,313,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,377 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tests;
/*
TO DO:
Allow selecting of 3D area ???
Switch cache cleanup back to 1 day ago
*/
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import jviewmda.MdaOpenFileHandler;
import jviewmda.Viewmda3PlaneWidget;
import jviewmda.WFSMda;
import org.magland.jcommon.JUtils;
import org.magland.wfs.DoubleWFSBrowser;
import org.magland.wfs.WFSClient;
/**
*
* @author magland
*/
public class Tests extends Application {
@Override
public void start(Stage primaryStage) {
String fshost;
if (JUtils.connectedToInternet()) {
fshost = "97.107.129.125:8080"; //peregrine01
//fshost="localhost:8006";
//fshost="bbvhub.org:6021"; //hoy05 (bbv)
} else {
System.err.println("Not connected to the internet.");
fshost = "localhost:8006";
}
//WFSClient CC = new WFSClient("localhost:8006", "LesionProbe", "");
WFSClient CC = new WFSClient(fshost, "LesionProbe", "");
String cache_dir = JUtils.createTemporaryDirectory("tests-cache");
System.out.println("Using cach path: " + cache_dir);
CC.setCachePath(cache_dir);
if (false) {
test_double_wfs_browser(primaryStage, CC);
}
if (true) {
test_3plane_view(primaryStage, CC);
}
}
void test_3plane_view(Stage stage, WFSClient CC) {
WFSMda XX = new WFSMda();
XX.setClient(CC);
XX.setPath("Images/ID001_FLAIR.nii");
Viewmda3PlaneWidget WW = new Viewmda3PlaneWidget();
WW.setRemoteArray(XX, () -> {
StackPane root = new StackPane();
root.getChildren().add(WW);
Scene scene = new Scene(root, 300, 250);
stage.setTitle("Hello World!");
stage.setScene(scene);
stage.show();
});
}
void test_double_wfs_browser(Stage stage, WFSClient CC) {
DoubleWFSBrowser BB = new DoubleWFSBrowser();
BB.addOpenFileHandler(new MdaOpenFileHandler());
BB.setClient(CC);
BB.initialize();
StackPane root = new StackPane();
root.getChildren().add(BB);
Scene scene = new Scene(root, 300, 250);
stage.setTitle("Hello World!");
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"jeremy.magland@gmail.com"
] | jeremy.magland@gmail.com |
5216fcbc2f4efadb03fa314ffcf1143178e30f02 | db4fe4cdf1ee49149e9b5edfae069986700c1002 | /src/es/lema/service/resources/FileResource.java | 22f288faecd8d1c2620f884eb863da60e0ebc178 | [] | no_license | delema/JaxRs | 7a56ce02f400f708e6ed1ab2ece82218393ae280 | dd872ca7e840f5181d552bb87a86004d6571a2ab | refs/heads/master | 2021-07-01T22:51:08.531150 | 2017-09-21T12:51:52 | 2017-09-21T12:51:52 | 104,226,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,441 | java | package es.lema.service.resources;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.List;
import javax.json.Json;
import javax.json.JsonException;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.glassfish.jersey.media.multipart.BodyPartEntity;
import org.glassfish.jersey.media.multipart.ContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataParam;
/**
* File resource
*
* @author Enrique de Lema (enrique.de.lema@gmail.com)
*/
@Path("/file")
public class FileResource {
public static String path = "c:/temp/upload";
// @POST
// @Consumes(MediaType.MULTIPART_FORM_DATA)
// public Response post(MultiPart multiPart) throws IOException {
//
// List<BodyPart> bodyParts = multiPart.getBodyParts();
//
// for (BodyPart bodyPart : bodyParts) {
// ContentDisposition contentDisposition = bodyPart.getContentDisposition();
// String name = ((FormDataBodyPart) bodyPart).getName();
// if (name.equalsIgnoreCase("file")) {
// String file = contentDisposition.getFileName();
// BodyPartEntity bodyPartEntity = (BodyPartEntity) bodyPart.getEntity();
// InputStream inputStream = bodyPartEntity.getInputStream();
// writeToFile(inputStream, file);
// }
// else if (name.equalsIgnoreCase("data")) {
// JsonReader jsonReader = null;
// try {
// StringReader reader = new StringReader(bodyPart.getEntityAs(String.class));
// jsonReader = new JsonReader(reader);
// JsonObject Object = jsonReader.readObject();
// System.out.println(Object.toString());
// }
// catch (JsonException e) {
// throw new IOException(e);
// }
// finally {
// if (jsonReader != null) jsonReader.close();
// }
// }
// }
//
// return Response.ok().build();
// }
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response post(
@FormDataParam("file") List<FormDataBodyPart> files,
@FormDataParam("data") FormDataBodyPart data)
throws IOException {
for (FormDataBodyPart file : files) {
ContentDisposition contentDisposition = file.getContentDisposition();
String fileName = contentDisposition.getFileName();
if (StringUtils.isNotEmpty(fileName)) {
BodyPartEntity bodyPartEntity = (BodyPartEntity) file.getEntity();
InputStream inputStream = bodyPartEntity.getInputStream();
writeToFile(inputStream, fileName);
}
}
if (data != null) {
JsonReader jsonReader = null;
try {
StringReader reader = new StringReader(data.getEntityAs(String.class));
jsonReader = Json.createReader(reader);
JsonObject Object = jsonReader.readObject();
String name = Object.getString("name");
String client = Object.toString();
System.out.println(client);
}
catch (JsonException e) {
throw new IOException(e);
}
finally {
if (jsonReader != null) jsonReader.close();
}
}
String output = "OK";
return Response.ok().entity(output).build();
}
@PUT
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public Response put(
@Context HttpServletRequest servletRequest,
@QueryParam("name") String name)
throws IOException {
ServletInputStream in = servletRequest.getInputStream();
writeToFile(in, name);
String output = "OK";
return Response.ok().entity(output).build();
}
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response get(
@Context HttpServletResponse servletResponse,
@QueryParam("name") String name)
throws IOException {
ServletOutputStream out = servletResponse.getOutputStream();
int length = (int) readFromFile(out, name);
servletResponse.setContentLength(length);
String parameters = "attachment;filename=" + name;
return Response.ok()
.header("Content-Disposition",parameters)
.build();
}
private void writeToFile(
InputStream in,
String name) throws IOException {
OutputStream out = null;
try {
int read = 0;
byte[] bytes = new byte[10240];
File file = new File(path, name);
out = new FileOutputStream(file);
while ((read = in.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
}
catch (IOException e) {
throw e;
}
finally {
if (out != null) {
out.flush();
out.close();
}
}
}
private long readFromFile(
OutputStream out,
String name) throws IOException {
InputStream in = null;
long length = 0;
try {
int read = 0;
byte[] bytes = new byte[10240];
File file = new File(path, name);
length = file.length();
in = new FileInputStream(file);
while ((read = in.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
}
catch (IOException e) {
throw e;
}
finally {
out.flush();
if (in != null) {
in.close();
}
}
return length;
}
}
| [
"delema@gmail.com"
] | delema@gmail.com |
d5ff09c4f6bf3e0b5dd15640efc683cd0c3395c0 | c9f1a47956293e61331aba1dc7117d86e97d5273 | /app/src/main/java/com/envigil/extranet/DataPojo.java | 715aba2c0e241414edb698d1caa255492a499d4d | [] | no_license | abhi8422/EITSLDAR | 83179e193970bbcbc86f2e30a04ea7feb47950a1 | 150357607a0fc8120b16dd0c3e8a4bdcb49191ed | refs/heads/master | 2021-02-14T20:09:13.536838 | 2020-03-04T06:51:31 | 2020-03-04T06:51:31 | 244,829,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | package com.envigil.extranet;
public class DataPojo {
String tags, locations, compId, componentSize, inspectionStatus;
public DataPojo(String tags, String locations, String compId, String componentSize, String inspectionStatus) {
this.tags = tags;
this.locations = locations;
this.compId = compId;
this.componentSize = componentSize;
this.inspectionStatus = inspectionStatus;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getLocations() {
return locations;
}
public void setLocations(String locations) {
this.locations = locations;
}
public String getCompId() {
return compId;
}
public void setCompId(String compId) {
this.compId = compId;
}
public String getComponentSize() {
return componentSize;
}
public void setComponentSize(String componentSize) {
this.componentSize = componentSize;
}
public String getInspectionStatus() {
return inspectionStatus;
}
public void setInspectionStatus(String inspectionStatus) {
this.inspectionStatus = inspectionStatus;
}
}
| [
"abhishekg8422@gmail.com"
] | abhishekg8422@gmail.com |
09beebe8d0566ac6cf504ec0d7c8eefc7822bb76 | 84b562b399deb8d4c954c4c9643b54a8ec17ef6d | /src/com/example/java/Queue.java | 58a308c233694c148a85713169bbe7c667715b2c | [] | no_license | AnabetsyR/Restaurant | 99d79e4f64bcffe392af7615c7392555cd68bb2e | d27072deb850f4e3710449ec21f4c9d999e2a872 | refs/heads/master | 2020-12-25T10:59:06.109868 | 2016-07-05T20:53:15 | 2016-07-05T20:53:15 | 61,831,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 813 | java | package com.example.java;
/*******************************************************************************
* Queue Interface
*
* The Queue interface is an interface that contains the transformer, and observer methods.
*
* Preconditions: There must be a party
* Postconditions: Provides the transformer and observer methods for the QueueArray
*
* @author Anabetsy Rivero
* created on June 20, 2016
* @version 1.0
*
******************************************************************************/
public interface Queue<T> {
// Transformers/Mutators
public void enqueue(Party p);
public T dequeue();
//return ;
public void makeEmpty();
// Observers/Accessors
public Object getFront();
public int size();
public boolean isEmpty();
public boolean isFull();
}
| [
"anabetsy001@gmail.com"
] | anabetsy001@gmail.com |
789b8e863dcab077fc46f49a8f8ef4a086ffa310 | c3542a9d6269f6ddf910ca685df87bca6294b9a3 | /jodd/src/main/java/bentolor/grocerylist/persistence/Repository.java | 18d2f90a0faabc085243959a7d0823ad1204ae3e | [
"Apache-2.0"
] | permissive | marhan/microframeworks-showcase | a192dd23a660cc6163925a8db967c56d91c4c9b5 | 5ead155a50c31585ed7b6afde44c27d00be6e882 | refs/heads/master | 2021-04-03T08:54:48.287430 | 2018-03-13T11:38:49 | 2018-03-13T11:38:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,434 | java | /*
* Copyright 2015 Benjamin Schmid, @bentolor
*
* 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 bentolor.grocerylist.persistence;
import bentolor.grocerylist.model.GroceryList;
import bentolor.grocerylist.model.GroceryLists;
import java.io.File;
import java.util.Optional;
import java.util.UUID;
/**
* A minimalistic, file-based persistence repository for {@link GroceryLists}.
*/
public class Repository {
private final File dataFile;
private final GroceryLists groceryLists;
private final ModelSerializer serializer;
public Repository() {
this("grocerylists.json");
}
public Repository(String repoFilePath) {
this.dataFile = new File(repoFilePath);
this.serializer = new ModelSerializer();
this.groceryLists = serializer.deserialize(dataFile);
}
private void save() {
serializer.serialize(dataFile, groceryLists);
}
public synchronized GroceryList createList(GroceryList groceryList) {
UUID newId = UUID.randomUUID();
groceryList.setId(newId);
groceryLists.add(groceryList);
save();
return groceryList;
}
public Optional<GroceryList> getList(UUID id) {
return groceryLists.stream()
.filter(entry -> entry != null && id.equals(entry.getId()))
.findFirst();
}
public GroceryLists getLists() {
return groceryLists;
}
public synchronized boolean updateList(UUID uuid, GroceryList updatedList) {
updatedList.setId(uuid);
groceryLists.replaceAll(list -> uuid.equals(list.getId()) ? updatedList : list);
save();
return groceryLists.contains(updatedList);
}
public synchronized boolean deleteList(UUID uuid) {
boolean success = groceryLists.removeIf(list -> uuid.equals(list.getId()));
save();
return success;
}
}
| [
"benjamin.schmid@exxcellent.de"
] | benjamin.schmid@exxcellent.de |
64bfe59f271810270f109fff8707d351f4e818f4 | 803371eefea7e1a87a1d09b9dd369f06793ac442 | /src/mainApp/SERCommen.java | de627e6380e17ec1114539a4a515662e4067d804 | [] | no_license | santusr/AccountPackage | a38f0188d48be3d2b6f3cc1a2e6d19bb49ff4a20 | 37e0d1c7ef82a5c22d8e180d598a8d4bceba8697 | refs/heads/master | 2021-08-25T09:25:36.455068 | 2021-07-29T14:25:28 | 2021-07-29T14:25:28 | 61,485,014 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mainApp;
import accountpackage.AccountPackage;
import java.sql.Connection;
import java.sql.SQLException;
/**
*
* @author Rabid
*/
public class SERCommen {
public static String getDescription(String tbl, String whr, String Code, String Descrip) {
String name = "";
try {
Connection con = AccountPackage.connect();
con.setAutoCommit(false);
name = DAOCommen.getDescription(tbl, whr, Code, Descrip, con);
con.commit();
} catch (SQLException e) {
core.Exp.Handle(e);
}
return name;
}
public static String getDescription(String qry, String key) {
String name = "";
try {
Connection con = AccountPackage.connect();
con.setAutoCommit(false);
name = DAOCommen.getDescription(qry, key, con);
con.commit();
} catch (SQLException e) {
core.Exp.Handle(e);
}
return name;
}
}
| [
"santusroshan@gmail.com"
] | santusroshan@gmail.com |
ad56c50b42d61906c77219e233eb1f0302eef849 | 60c4056900b741a6b68b9bbaae3458a9e12b2441 | /src/main/java/com/dhruba/java/collection/map/ViewsOverMaps.java | 2598988f0b25a36f05ea411c0343f156f146c63b | [] | no_license | dhrub123/JavaFundamentals | c82b27822d294894f1b35ce853db206c505e38b1 | cd626a3cca500fa3afb9c092aa68692e9a4ae880 | refs/heads/master | 2023-05-12T11:39:04.280928 | 2023-05-05T07:32:44 | 2023-05-05T07:32:44 | 289,631,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,668 | java | package com.dhruba.java.collection.map;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.dhruba.java.collection.arrays.Product;
public class ViewsOverMaps {
public static void main(String[] args) {
final Map<Integer,Product> idToProduct = new HashMap<Integer,Product>();
idToProduct.put(1, ProductFixtures.door);
idToProduct.put(2, ProductFixtures.floorPanel);
idToProduct.put(3, ProductFixtures.window);
Set<Integer> ids = idToProduct.keySet();
System.out.println(ids);
System.out.println(idToProduct);
System.out.println();
ids.remove(1);
System.out.println(ids);
System.out.println(idToProduct);
System.out.println();
//We cannot add using a view
//ids.add(5); //will result in unsupported exception because we will need both key and value
Collection<Product> products = idToProduct.values();
System.out.println(products);
System.out.println(idToProduct);
System.out.println();
products.remove(ProductFixtures.window);
System.out.println(products);
System.out.println(idToProduct);
System.out.println();
//we cannot add window to values because we will need both key and value
Set<Map.Entry<Integer, Product>> entries = idToProduct.entrySet();
for(Map.Entry<Integer, Product> entry : entries) {
System.out.println(entry);
System.out.println(entry.getKey());
System.out.println(entry.getValue());
entry.setValue(ProductFixtures.window);
}
System.out.println(idToProduct);
//From Java 9 Map.entry
//Map.Entry<Integer, Product> entry = Map.entry(3, ProductFixtures.window);
//entries.add(entry);
}
}
| [
"dhrub123@gmail.com"
] | dhrub123@gmail.com |
30ad3d595b49d2e9bfd1e9bac036776a87e73d74 | 00d80738559c016acf43503997ce45fe8f5f5eae | /src/main/java/com/example/course/entities/Category.java | 2ada401781497f3da5eb961a5b06e6bacf6b7b2f | [] | no_license | JoanCristiann/springboot1-java11 | 9d13164afbd2256e82c8a458074e6a540961647b | 030234adecc4f9b29a92e9b361c3bcc9cf2d010b | refs/heads/main | 2023-08-27T04:57:32.028852 | 2021-10-22T16:25:49 | 2021-10-22T16:25:49 | 413,618,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,441 | java | package com.example.course.entities;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "tb_category")
public class Category implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
@JsonIgnore
@ManyToMany(mappedBy = "categories")
private Set<Product> products = new HashSet<>();
public Category() {
}
public Category(Long id, String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Product> getProducts() {
return products;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Category other = (Category) obj;
return Objects.equals(id, other.id);
}
}
| [
"joancristiann@gmail.com"
] | joancristiann@gmail.com |
435be0460e3b0487cb8d4672cd3bd9cb79ab3112 | 0bd8180a0f03bc0a28eadbcb135737ac5818c749 | /Adresse.java | dd138c97732ee3f0a1036a4b7c8f676e53fe4f54 | [] | no_license | lau4225/Laboratoire-6 | 053a73425a5d1696ae2dd509c59b6fcf506b84a3 | 5241cff014ce6d507738520a4ddef41314332c47 | refs/heads/master | 2020-03-12T03:56:16.740052 | 2018-04-21T02:59:35 | 2018-04-21T02:59:35 | 125,401,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,650 | java | import java.util.Scanner;
/**
* Created by BonLa1731834 on 2018-01-22.
*/
public class Adresse {
private int numPorte;
private String nomRue;
private String appart;
private String ville;
private String province;
private String pays;
public int getNumPorte() {return numPorte;}
public void setNumPorte(int numPorte) {this.numPorte = numPorte;}
public String getNomRue() {return nomRue;}
public void setNomRue(String nomRue) {this.nomRue = nomRue;}
public String getAppart() {return appart;}
public void setAppart(String appart) {this.appart = appart;}
public String getVille() {return ville;}
public void setVille(String ville) {this.ville = ville;}
public String getProvince() {return province;}
public void setProvince(String province) {this.province = province;}
public String getPays() {return pays;}
public void setPays(String pays) {this.pays = pays;}
int repNb = 0;
public static Scanner sc = new Scanner(System.in);
public static Adresse nouvAdresse() {
Adresse adresse = new Adresse();
String repPhrase = "";
System.out.println(" Adresse : ");
System.out.print(" Numéro de porte : ");
adresse.numPorte = sc.nextInt();
System.out.print(" Rue : ");
adresse.nomRue = sc.next();
System.out.print(" Appartement (facultatif, Entrée si inexistant) : ");
sc.nextLine();
repPhrase = sc.nextLine().trim();
if (repPhrase.equals("")) {
} else {
adresse.appart = repPhrase;
}
System.out.print(" Ville : ");
adresse.ville = sc.next();
System.out.print(" Province : ");
adresse.province = sc.next();
System.out.print(" Pays : ");
adresse.pays = sc.next();
return adresse;
}
public void afficher(){
System.out.println(" Adresse : ");
System.out.println(" Numéro de porte : " + numPorte);
System.out.println(" Rue : " + nomRue);
System.out.println(" Appartement : " + appart);
System.out.println(" Ville : " + ville);
System.out.println(" Province : " + province);
System.out.println(" Pays : " + pays);
}
public void modifier(){
String modif = "";
System.out.println();
System.out.println("Adresse : ");
System.out.print(" Numéro de porte (" + numPorte + ") : ");
modif = sc.nextLine().trim();
if (modif.equals("")) {}
else {setNumPorte(Integer.parseInt(modif));}
System.out.println();
System.out.print(" Rue (" + nomRue + ") : ");
modif = sc.nextLine().trim();
if (modif.equals("")) {}
else {setNomRue(modif);}
System.out.println();
System.out.print(" Appart (" + appart + ") : ");
modif = sc.nextLine().trim();
if (modif.equals("")) {}
else {setAppart(modif);}
System.out.println();
System.out.print(" Ville (" + ville + ") : ");
modif = sc.nextLine().trim();
if (modif.equals("")) {}
else {setVille(modif);}
System.out.println();
System.out.print(" Province (" + province + ") : ");
modif = sc.nextLine().trim();
if (modif.equals("")) {}
else {setProvince(modif);}
System.out.println();
System.out.print(" Pays (" + pays + ") : ");
modif = sc.nextLine().trim();
if (modif.equals("")) {}
else {setPays(modif);}
}
}
| [
"lauriebonnel@hotmail.com"
] | lauriebonnel@hotmail.com |
60c2b2d51c6adb1785c5e9376b4643b784f4ee4d | 5534d8af1b5a32e1df77eca09bfd0847058efd09 | /Test/Maven/src/main/java/com/demo/Maven/Code_run.java | 9cd0c58ecbdf059a600a277c2cb25c55d3e1bfd6 | [] | no_license | AmalManohar/MediwareRepository | d6086a169c9dd8943d3486023b6d2226e892cf87 | b144e6c130967ecaa7575a03fd48fdca05fe16ba | refs/heads/master | 2022-07-11T17:49:38.325172 | 2019-08-21T07:32:34 | 2019-08-21T07:32:34 | 203,526,942 | 0 | 0 | null | 2022-06-29T17:35:27 | 2019-08-21T07:06:00 | HTML | UTF-8 | Java | false | false | 1,935 | java | package com.demo.Maven;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class Code_run {
WebDriver driver;
@BeforeMethod
public void get_browser() {
System.setProperty("webdriver.chrome.driver","C:\\Users\\SE-MENTOR\\Desktop\\Test\\TestMaven\\chromedriver.exe");
ChromeOptions options=new ChromeOptions();
options.addArguments("--disable-infobars");
driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.get("https://www.google.com/");
}
@Test(priority=1)
public void login_test() {
WebDriverWait wait = getWait();
WebElement ele = driver.findElement(By.xpath("//input[@class='gLFyf gsfi']"));
ele.sendKeys("online java compiler");
ele.submit();
driver.findElement(By.xpath("(//h3[@class='LC20lb'])[1]")).click();
/*
* wait.until(ExpectedConditions.elementToBeClickable(By.xpath(
* "//span[@class='ace_string']")));
* driver.findElement(By.xpath("//span[@class='ace_string']")).sendKeys(
* "TESTING");
*/
wait.until(ExpectedConditions.elementToBeClickable(By.id("control-btn-run")));
driver.findElement(By.id("control-btn-run")).click();
}
public WebDriverWait getWait() {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.pollingEvery(250, TimeUnit.MILLISECONDS);
wait.ignoring(NoSuchElementException.class);
return wait;
}
@AfterMethod
public void close_browser() throws InterruptedException {
Thread.sleep(2000);
//driver.quit();
}
}
| [
"amal.m@se-mentor.com"
] | amal.m@se-mentor.com |
71134a15942bf6d96c45423a1e918ebcca2b4917 | 92cb886d4a5a5c86894d4679f76045e92dfdc986 | /souyue/src/main/java/com/zhongsou/souyue/module/HomePageItem.java | 380054dd63c3bb44a6f7958bbac3fdf33e329aec | [] | no_license | chzh1377/souyue_android | 9602d84fb5fd0360b98fb320cc09f343c32147ff | be27d88f6187a374e3bd611835f6d421c34d7bb7 | refs/heads/master | 2016-09-14T05:12:51.419652 | 2016-05-18T13:01:14 | 2016-05-18T13:01:14 | 59,115,792 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 13,387 | java | package com.zhongsou.souyue.module;
@SuppressWarnings("serial")
public class HomePageItem extends ResponseObject {
public enum CATEGORY {
/**
* category类型 :精彩推荐
*/
system,
/**
* category类型 :srp词组
*/
group,
/**
* category类型 :rss词组
*/
rss,
/**
* category类型 :我的收藏
*/
favorite,
/**
* category类型 :超级分享大赛
*/
srp,
/**
* category类型 :搜悦广场
*/
square,
/**
* category类型 :应用宝典
*/
app,
/**
* category类型 :网址导航
*/
url,
/**
* category类型 :移动商街
*/
discount,
/**
* category类型 :我的商家
*/
business,
/**
* category类型 :我的原创
*/
selfCreate,
/**
* category类型 :老虎机
*/
slotMachine,
/**
* category类型 :我的聊天
*/
im,
/**
* category类型 :中搜零拍
*/
interactWeb,
/**
* category类型 :兴趣圈
*/
interest,
/**
* category类型 :我的订阅
*/
subscibe,
/**
* category类型 :综合搜索
*/
search,
/**
* category类型 :二维码扫描
*/
scan,
/**
* category类型 :增加首页
*/
homepage,
/**
* 添加category类型 :个人中心
*/
pcenter,
/**
* 添加category类型 :移动商城
*/
shop,
/**
* 添加category类型 :中搜币商城
*/
moneyshop,
/**
* 添加category类型 : 零拍
*/
lingpai,
/**
* 添加category类型 :企业黄页
*/
corplist,
/**
* 添加category类型 :行业资讯
*/
infolist,
/**
* 添加category类型 :供应商机
*/
productlist,
/**
* 添加category类型 : 资讯详情
*/
infodetail,
/**
* 添加category类型 :供应详情
*/
productdetail,
/**
* 添加category类型 :询报价列表
*/
supdem,
/**
* 添加category类型 :企业详情
*/
corpdetail,
/**
* category类型 : 预留cma
*/
cma,
/**
* 跳到指定兴趣圈
*/
special_interest,
/**
* 添加category类型 :积分兑换中搜币
*/
exchangeZsb,
/**
* 添加category类型 :充值
*/
rechargeZsb,
/**
* 添加category类型 :跳无头无尾的webview
*/
interactNoHeadWeb;
}
public static final String GROUP = "group";
public static final String RSS = "rss";
public static final String SYSTEM = "system";
public static final String SRP = "srp";
public static final String SELF_CREATE = "selfCreate";
public static final String SQUARE = "square";
public static final String APP = "app";
public static final String URL = "url";
public static final String DISCOUNT = "discount";
public static final String FAVORITE = "favorite";
public static final String BUSSINESS = "business";
public static final String IM = "im";
public static final String CMA = "cma";
// 企业词订阅
public static final int ENT_TYPE = 4; // 合作商家
public static final int ENT_COMMON_TYPE = 41; // 普通商家
private String srpId = ""; // 分享大赛
private String keyword = ""; // 分享大赛
private String title = ""; // 显示的标题
private String category = ""; // 类型
private String url = ""; // url地址
private String cma = ""; // cma
private String english = ""; // 英文显示的标题
private String id = ""; // id,如否是订阅,用于删除订阅
private long subId = 0; // 张亮 新闻源订阅id
private String entId = ""; // 普通商家ID是字符串
private int subscribeType; // 企业词订阅类别,4合作商家,41普通商家
private String images;// 原图
private String imagesGray;// 灰色图
private int subCount;// 订阅的个数
private String image;// icon
private boolean hasNew;
private boolean outBrowser;
// add by trade
// 超A模板
private String action;// 启动商城的action
private String streetname;// 移动商街默认搜索关键词
private String interestinfo; // 左树新增跳到指定兴趣圈类型
private String interest_ID; // 指定兴趣圈ID
private String interest_SRPID; // 指定兴趣圈SRPID
private String interest_SRPWORD; // 指定兴趣圈SRP词
private String interest_name; // 指定兴趣圈名称
// 行业
private String infosecid;// 资讯列表
private String infoid;// 资讯详情
private String productsecid;// 供应列表
private String productid;// 供应详情
private String corpigid;// 企业详情
public String getInterestID() {
return GetIntesetInfo(1);
}
private String getInterestName() {
return GetIntesetInfo(0);
}
public String getInterestSRPWORD() {
return GetIntesetInfo(3);
}
public String getInterestSRPID() {
return GetIntesetInfo(2);
}
private String GetIntesetInfo(int location) {
if (interestinfo == null || ("").equals(interestinfo)) {
return "";
} else {
String[] interestArray = interestinfo.split("\\|");
return interestArray.length > location ? interestArray[location]
: "";
}
}
public void interestinfo_$eq(String interestinfo) {
this.interestinfo = interestinfo;
}
// 搜悦广场
public boolean isSquare() {
return SQUARE.equals(this.category);
}
// 应用宝典
public boolean isApp() {
return APP.equals(this.category);
}
// 网址导航
public boolean isUrl() {
return URL.equals(this.category);
}
public boolean isCma() {
return CMA.equals(this.category);
}
// 优惠商家
public boolean isDiscount() {
return DISCOUNT.equals(this.category);
}
/**
* category类型 是否为 超级分享大赛
*/
public boolean isSrp() {
return SRP.equals(this.category);
}
/**
* category类型 是否为 收藏
*/
@Deprecated
public boolean isFavorite() {
return FAVORITE.equals(this.category);
}
// 是否是系统
public boolean isSystem() {
return SYSTEM.equals(this.category);
}
public boolean isBusiness() {
return BUSSINESS.equals(this.category);
}
// 是否是订阅的srp分组
public boolean isGroup() {
return GROUP.equals(this.category);
}
// 是否是rss订阅
public boolean isRss() {
return RSS.equals(this.category);
}
// 是否是一个简单标签
public boolean isLabel() {
return !isFavorite() && !isSystem() && !isGroup() && !isRss();
}
public String srpId() {
return srpId;
}
public void srpId_$eq(String srpId) {
this.srpId = srpId;
}
public String keyword() {
return keyword;
}
public void keyword_$eq(String keyword) {
this.keyword = keyword;
}
public String title() {
return title;
}
public void title_$eq(String title) {
this.title = title;
}
public String entId() {
return entId;
}
public void entId_$eq(String entId) {
this.entId = entId;
}
public String category() {
return category;
}
public void category_$eq(String category) {
this.category = category;
}
public String url() {
return url;
}
public String cma() {
return cma;
}
public void url_$eq(String url) {
this.url = url;
}
public void cma_$eq(String cma) {
this.cma = cma;
}
public String english() {
return english;
}
public void english_$eq(String english) {
this.english = english;
}
public String id() {
return id;
}
public void id_$eq(String id) {
this.id = id;
}
public long subId() {
return subId;
}
public void subId_$eq(long subId) {
this.subId = subId;
}
public int subscribeType() {
return subscribeType;
}
public void subscribeType_$eq(int subscribeType) {
this.subscribeType = subscribeType;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public String getImagesGray() {
return imagesGray;
}
public void setImagesGray(String imagesGray) {
this.imagesGray = imagesGray;
}
public int getSubCount() {
return subCount;
}
public void setSubCount(int subCount) {
this.subCount = subCount;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public boolean isHasNew() {
return hasNew;
}
public void setHasNew(boolean hasNew) {
this.hasNew = hasNew;
}
public boolean isOutBrowser() {
return outBrowser;
}
public void setOutBrowser(boolean outBrowser) {
this.outBrowser = outBrowser;
}
public String streetname() {
return streetname;
}
public void streetname_$eq(String streetname) {
this.streetname = streetname;
}
public String action() {
return action;
}
public void action_$eq(String action) {
this.action = action;
}
public String infoid() {
return infoid;
}
public void infoid_$eq(String infoid) {
this.infoid = infoid;
}
public String infosecid() {
return infosecid;
}
public void infosecid_$eq(String infosecid) {
this.infosecid = infosecid;
}
public String productid() {
return productid;
}
public void productid_$eq(String productid) {
this.productid = productid;
}
public String productsecid() {
return productsecid;
}
public void productsecid_$eq(String productsecid) {
this.productsecid = productsecid;
}
public String corpigid() {
return corpigid;
}
public void corpigid_$eq(String corpigid) {
this.corpigid = corpigid;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((category == null) ? 0 : category.hashCode());
result = prime * result + ((english == null) ? 0 : english.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((keyword == null) ? 0 : keyword.hashCode());
result = prime * result + ((srpId == null) ? 0 : srpId.hashCode());
result = prime * result + (int) (subId ^ (subId >>> 32));
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + ((url == null) ? 0 : url.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HomePageItem other = (HomePageItem) obj;
if (category == null) {
if (other.category != null)
return false;
} else if (!category.equals(other.category))
return false;
if (english == null) {
if (other.english != null)
return false;
} else if (!english.equals(other.english))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (keyword == null) {
if (other.keyword != null)
return false;
} else if (!keyword.equals(other.keyword))
return false;
if (srpId == null) {
if (other.srpId != null)
return false;
} else if (!srpId.equals(other.srpId))
return false;
if (subId != other.subId)
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (url == null) {
if (other.url != null)
return false;
} else if (!url.equals(other.url))
return false;
return true;
}
}
| [
"zhch1377@163.com"
] | zhch1377@163.com |
7756dfd3c4a47ed1ed914bd8c451fab9cfeee4a4 | 17741fbfba55246e2b75162cb07914ed9905e53d | /spring-boot/spring-boot-mvc/domain/src/main/java/com/mtv/sb/domain/User.java | b8daccee69bc3d3b3577c6f15c8afeb173bee596 | [] | no_license | balanzer/learning | 09c83d624f72627e6d6953e32d744f450fd54bbb | ff6489dd0ddd30a8cde01676f27780d782181689 | refs/heads/master | 2020-03-22T17:58:48.971614 | 2019-02-15T17:47:14 | 2019-02-15T17:47:14 | 140,428,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.mtv.sb.domain;
public class User extends Profile {
@Override
public String toString() {
return "User [toString()=" + super.toString() + "]";
}
public User() {
super();
}
public User(Long uid, String firstName, String lastName, String email) {
super(uid, firstName, lastName, email);
// TODO Auto-generated constructor stub
}
}
| [
"muralitharan.varatharajan@ihg.com"
] | muralitharan.varatharajan@ihg.com |
59b2ce93e064d9ac625b02bbc261e2f808a7e9ab | cf1a356101ddb7f8f90bae0954f440722a57c318 | /riverock-webmill-container/src/main/java/org/riverock/webmill/container/definition/web_xml_v2_3/ParamName.java | b79b51d8a22785a6f5735d884e46a33dc72a3d5d | [] | no_license | sergmain/webmill | 59d83c893705303767f235a04a442a2e643b70d5 | ecb39c2069a0ad9c51c906645af322ad2f294232 | refs/heads/master | 2023-03-06T13:57:34.142084 | 2022-05-31T12:24:07 | 2022-05-31T12:24:07 | 217,777,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,584 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.4-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.10.02 at 06:50:27 PM MSD
//
package org.riverock.webmill.container.definition.web_xml_v2_3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "param-name")
public class ParamName {
@XmlValue
protected String content;
@XmlAttribute
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}
| [
"serg_main@yahoo.com"
] | serg_main@yahoo.com |
4d3cf41aee481d84b56db629099130d4d546ed29 | 45afd16707ea0d01736751dea8456827fa688858 | /src/client/listener/MapListener.java | f6a4cc0bed2382ea599af04b42d77c1c384980ff | [] | no_license | chenming111/AdvancedSoftwareEngineer_Work | f57d2db16d30096764acc987f964139000da1194 | f7ada446748b60305e443d65a72a4dc3f77750ed | refs/heads/master | 2020-04-08T04:40:24.368088 | 2018-11-25T12:24:12 | 2018-11-25T12:24:12 | 159,026,948 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,634 | java | package client.listener;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import client.data.Data;
import client.manager.MessageManager;
import client.net.PlayChess;
import client.ui.ChessBoardCanvas;
public class MapListener extends MouseAdapter {
/**
* 监听棋盘
*/
@Override
public void mousePressed(MouseEvent e) {
ChessBoardCanvas canvas = (ChessBoardCanvas)e.getSource();
// 判断是否登陆
if(Data.connected){
// 判断是否选择了对手
if(Data.oppoId != 0){
if(Data.ready == true){
// 判断是否已经开始
if(Data.started){
if(!Data.wait){
// 判断是否轮到自己落棋
if(Data.turn == Data.myChess){
// 判断是否在棋盘范围内
if(e.getX() < canvas.getMapWidth() - 6 && e.getY() < canvas.getHeight() - 7 ){
int chessX;
int chessY;
chessX = e.getX() / 35;
chessY = e.getY()/ 35;
// 判断此处是否已有棋子
if(Data.chessBoard[chessX][chessY] == 0){
new PlayChess().play(chessX, chessY , Data.myChess);
}
else{
MessageManager.getInstance().addMessage("不能下在这里。。");
}
}
}
else{
// 若为对方落子
if(Data.turn == Data.oppoChess){
MessageManager.getInstance().addMessage("没轮到你下。。。");
}
else{
// 若游戏已经结束
if(Data.turn == 0){
MessageManager.getInstance().addMessage("已经结束啦!");
}
}
}
}
else{
MessageManager.getInstance().addMessage("等待对方回复。。。");
}
}
else{
MessageManager.getInstance().addMessage("等待对方准备。。。");
}
}
else{
MessageManager.getInstance().addMessage("先点击“开始”吧!");
}
}
else{
MessageManager.getInstance().addMessage("选个对手吧!");
}
}
else{
MessageManager.getInstance().addMessage("请先登陆!");
}
}
@Override
public void mouseEntered(MouseEvent e3) {
ChessBoardCanvas canvas = (ChessBoardCanvas)e3.getSource();
if(!Data.wait){
canvas.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
else{
canvas.setCursor(new Cursor(Cursor.WAIT_CURSOR));
}
}
@Override
public void mouseExited(MouseEvent e4) {
ChessBoardCanvas canvas = (ChessBoardCanvas)e4.getSource();
canvas.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
}
| [
"543428992@qq.com"
] | 543428992@qq.com |
3472cd4bf2faa7b8eeda0d523ec54eeb69a46ba2 | 8237d591eb789f0eaa161532c78af0f18a1bf76e | /src/java/objetos/Departamento.java | 8c9e611bc34963b5e4d7b113ba514ae3342febf9 | [] | no_license | Nacho0102/ProyectoStruts | 50b7f01b1bc6b3ff3364b391873a25253661dc72 | f59d02a56d56863555357aae859770fa2b77e0c1 | refs/heads/master | 2021-01-21T12:26:27.087135 | 2015-09-16T07:53:37 | 2015-09-16T07:53:37 | 42,572,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package objetos;
public class Departamento
{
private int numero;
private String nombre;
private String localidad;
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getLocalidad() {
return localidad;
}
public void setLocalidad(String localidad) {
this.localidad = localidad;
}
}
| [
"NachoP@A03CLI02"
] | NachoP@A03CLI02 |
b60cea891ea9dc6c9b2fa33a223e2fccc50f45fe | 895b0002d1ee032180a75c8b39246c07f42ae24d | /guns-film/src/main/java/com/stylefeng/guns/rest/common/persistence/model/MtimeFilmActorT.java | 782bf02f3b8e3c8ccbb52b432bb9c0c734a00795 | [] | no_license | 1cutecoder/MyEasyTickets | 94f9f9d01317c1d449b88659c52da2d30ed49738 | e7ea509c628ba84663dae2c1f7a01a8415e3187f | refs/heads/master | 2022-10-26T18:53:03.378611 | 2019-07-03T02:23:39 | 2019-07-03T02:23:39 | 194,963,926 | 0 | 0 | null | 2022-10-12T20:28:42 | 2019-07-03T02:16:56 | JavaScript | UTF-8 | Java | false | false | 1,917 | java | package com.stylefeng.guns.rest.common.persistence.model;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
/**
* <p>
* 影片与演员映射表
* </p>
*
* @author stylefeng
* @since 2019-06-04
*/
@TableName("mtime_film_actor_t")
public class MtimeFilmActorT extends Model<MtimeFilmActorT> {
private static final long serialVersionUID = 1L;
/**
* 主键编号
*/
@TableId(value = "UUID", type = IdType.AUTO)
private Integer uuid;
/**
* 影片编号,对应mtime_film_t
*/
@TableField("film_id")
private Integer filmId;
/**
* 演员编号,对应mtime_actor_t
*/
@TableField("actor_id")
private Integer actorId;
/**
* 角色名称
*/
@TableField("role_name")
private String roleName;
public Integer getUuid() {
return uuid;
}
public void setUuid(Integer uuid) {
this.uuid = uuid;
}
public Integer getFilmId() {
return filmId;
}
public void setFilmId(Integer filmId) {
this.filmId = filmId;
}
public Integer getActorId() {
return actorId;
}
public void setActorId(Integer actorId) {
this.actorId = actorId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
@Override
protected Serializable pkVal() {
return this.uuid;
}
@Override
public String toString() {
return "MtimeFilmActorT{" +
"uuid=" + uuid +
", filmId=" + filmId +
", actorId=" + actorId +
", roleName=" + roleName +
"}";
}
}
| [
"820861340@qq.com"
] | 820861340@qq.com |
99bf19dedae11313ed718eeec58a92da329f3909 | aa0d303edef33b7f7a5bc1e80271cfd5557421a6 | /SpringWebService_Server/src/ws/HelloWS.java | 2e109b16d3429cbbe5c93cc66c1156d9b04a13f6 | [] | no_license | vinayakbagal7/SpringSoapWebService | b729da3157c549d985a30fc09d426a0e228b7698 | e80e1c7007cfc919ad668aadabc2f4c0cae21d82 | refs/heads/master | 2021-01-17T12:58:40.778637 | 2016-06-15T13:35:50 | 2016-06-15T13:35:50 | 61,210,802 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | package ws;
public class HelloWS {
public String hello(String name) {
return "Hello " + name;
}
public int sum(int a, int b) {
return a + b;
}
}
| [
"vinayakbagal7@gmail.com"
] | vinayakbagal7@gmail.com |
6b3171ca086cd15fd6a65c438bac7a6cc9b2a035 | ba005c6729aed08554c70f284599360a5b3f1174 | /lib/selenium-server-standalone-3.4.0/com/gargoylesoftware/htmlunit/javascript/host/svg/package-info.java | 95191829be57028b864733f4c30acedfd667cea1 | [] | no_license | Viral-patel703/Testyourbond-aut0 | f6727a6da3b1fbf69cc57aeb89e15635f09e249a | 784ab7a3df33d0efbd41f3adadeda22844965a56 | refs/heads/master | 2020-08-09T00:27:26.261661 | 2017-11-07T10:12:05 | 2017-11-07T10:12:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 95 | java | package com.gargoylesoftware.htmlunit.javascript.host.svg;
abstract interface package-info {}
| [
"VIRUS-inside@users.noreply.github.com"
] | VIRUS-inside@users.noreply.github.com |
102d6722276e1cda143a6004c77b33c4bf809832 | 9417890fbbfdd29eaab89cc77d74a737890d6396 | /app/src/main/java/com/conflictwatcher/MyItem.java | 367bee58ed041e1291757eff140f9c893b3f8b02 | [] | no_license | Rolyyy/Conflict_Watcher | 939a62ea6aefb45c4837d8fdac5fccf8e506016a | b383987395268341f0b04453856ec580ef84ebe4 | refs/heads/master | 2020-08-05T06:29:11.668965 | 2020-03-27T10:06:20 | 2020-03-27T10:06:20 | 212,430,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package com.conflictwatcher;
import com.google.android.gms.maps.model.LatLng;
import com.google.maps.android.clustering.ClusterItem;
//Part of this class is sourced from:
//https://developers.google.com/maps/documentation/android-sdk/utility/marker-clustering?hl=nl
//used for the implementation of clustered data items within MapActivity
public class MyItem implements ClusterItem {
private LatLng mPosition;
private String mTitle;
private String mSnippet;
public MyItem(double lat, double lng, String title, String snippet) {
mPosition = new LatLng(lat, lng);
mTitle = title;
mSnippet = snippet;
}
@Override
public LatLng getPosition() {
return mPosition;
}
@Override
public String getTitle() {
return mTitle;
}
@Override
public String getSnippet() {
return mSnippet;
}
}
| [
"1541224@brunel.ac.uk"
] | 1541224@brunel.ac.uk |
fc62e2d61772da7ae9b3be024c20d7bec5fe2aff | a4b7d0bf26778d81f8a34e0e188c805c232fc4ef | /app/src/main/java/io/github/salemlockwood/flyther/engine/Game.java | 63204ca439d87b422f1c81c6c75031080391134c | [
"MIT"
] | permissive | SalemLockwood/Flyther | 0557f19099ea1ce35df01c926aabd088cce2153e | d0a081d7d59264827a1accd9c4948c4ab9b5b7e2 | refs/heads/master | 2020-03-19T07:17:40.723698 | 2018-06-08T00:24:25 | 2018-06-08T00:24:25 | 136,102,373 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,005 | java | package io.github.salemlockwood.flyther.engine;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Toast;
import io.github.salemlockwood.flyther.BuildConfig;
import io.github.salemlockwood.flyther.R;
import io.github.salemlockwood.flyther.elements.Fuel;
import io.github.salemlockwood.flyther.elements.GUI;
import io.github.salemlockwood.flyther.elements.GameOver;
import io.github.salemlockwood.flyther.elements.Ground;
import io.github.salemlockwood.flyther.elements.Grounds;
import io.github.salemlockwood.flyther.elements.Plane;
import io.github.salemlockwood.flyther.elements.Score;
import io.github.salemlockwood.flyther.elements.Spike;
import io.github.salemlockwood.flyther.elements.Spikes;
import io.github.salemlockwood.flyther.elements.Stars;
import io.github.salemlockwood.flyther.utils.Colors;
import io.github.salemlockwood.flyther.utils.Screen;
public class Game extends SurfaceView implements Runnable,View.OnTouchListener {
private static final int NO_ACTION = -1;
private static final int MENU_SCREEN = 0;
private static final int SETTINGS_SCREEN = 1;
private static final int LEARDBOARD_SCREEN = 2;
private static final int CREDITS_SCREEN = 3;
private static final int GAME_SCREEN = 4;
private boolean isRunning = true;
private final SurfaceHolder holder = getHolder();
private Plane plane;
private Bitmap background;
private Screen screen;
private Spike spike;
private Spikes spikes;
private Score score;
private int planeColor;
private int propellerPosition = 0;
private Context context;
private Grounds grounds;
private GUI gui;
private int weather = 0;
private SharedPreferences sp;
private boolean showRateEnabled = false;
private float updateRate = 0.0f;
private boolean planeExploding = false;
private int planeExplodingFrame = 0;
private Fuel fuel;
private Stars stars;
public Game(Context context) {
super(context);
initializeElements(context);
setOnTouchListener(this);
this.context = context;
}
@Override
public boolean onTouch(View v, MotionEvent event) {
if(isRunning) {
switch (screen.getCurrentScreen()){
case GAME_SCREEN:
if(!planeExploding) {
if(fuel.getFuel() > 50) {
plane.fly();
fuel.dropFuel();
}
}
break;
default:
execGuiAction(this.gui.touchAt((int) event.getY()));
break;
}
}
else{
initializeElements(context);
screen.setCurrentScreen(MENU_SCREEN);
new Thread(this).start();
}
return false;
}
private void execGuiAction(int i) {
switch(i){
case GAME_SCREEN:
isRunning = true;
screen.setCurrentScreen(GAME_SCREEN);
break;
case SETTINGS_SCREEN:
screen.setCurrentScreen(SETTINGS_SCREEN);
break;
case LEARDBOARD_SCREEN:
Toast.makeText(context, context.getText(R.string.underDevelopment), Toast.LENGTH_SHORT).show();
break;
case CREDITS_SCREEN:
Toast.makeText(context, context.getText(R.string.underDevelopment), Toast.LENGTH_SHORT).show();
break;
case NO_ACTION:
//Toast.makeText(context, context.getText(R.string.noAction), Toast.LENGTH_SHORT).show();
break;
}
}
@Override
public void run() {
while(isRunning){
if(!holder.getSurface().isValid()) continue;
Canvas canvas = holder.lockCanvas();
canvas.drawBitmap(background, 0, 0, null);
if(screen.getCurrentScreen() == GAME_SCREEN) {
drawGameScreen(canvas);
} else {
gui.drawAt(canvas,screen.getCurrentScreen());
}
holder.unlockCanvasAndPost(canvas);
}
}
private void drawGameScreen(Canvas canvas) {
long currentTime = System.currentTimeMillis();
spikes.move();
spikes.drawAt(canvas);
grounds.drawAt(canvas);
grounds.move();
stars.drawAt(canvas);
stars.move();
if(!planeExploding) {
propellerPosition++;
if(propellerPosition>3) propellerPosition = 0;
plane.drawAt(canvas,propellerPosition);
plane.fall();
stars.collidesWith(plane);
if ((new CollisionVerifier(plane, spikes, screen).haveCrashed())) {
planeExploding = true;
}
} else {
plane.fall();
plane.dead(planeExplodingFrame,canvas,propellerPosition);
planeExplodingFrame++;
if(planeExplodingFrame == 24){
new GameOver(screen, context).drawAt(canvas);
planeExplodingFrame = 0;
planeExploding = false;
isRunning = false;
}
}
score.drawAt(canvas);
fuel.drawAt(canvas);
if(showRateEnabled) {
canvas.drawText(String.format("%.2f",updateRate), 10, screen.getHeight() - 10, Colors.getFPSColor(context));
updateFrameRate(System.currentTimeMillis() - currentTime);
}
}
private void updateFrameRate(float delta) {
updateRate = 1000/delta;
}
private void initializeElements(Context context){
sp = context.getSharedPreferences(BuildConfig.APPLICATION_ID,Context.MODE_PRIVATE);
showRateEnabled = sp.getBoolean("showUpdateRate", false);
screen = new Screen(context);
score = new Score(context);
this.planeColor = (int) (Math.random() * 4);
this.weather = (int) (Math.random() * 5);
this.fuel = new Fuel(screen);
plane = new Plane(screen,context,planeColor,fuel);
Bitmap back = BitmapFactory.decodeResource(getResources(), R.drawable.background);
background = Bitmap.createScaledBitmap(back, back.getWidth(), screen.getHeight(), false);
this.spike = new Spike(screen, 200,context,weather);
this.spikes = new Spikes(screen,score,context,weather);
this.grounds = new Grounds(screen,context,weather);
this.gui = new GUI(screen,context);
this.stars = new Stars(screen,context);
isRunning = true;
}
public void pause(){
isRunning = false;
}
public void inicia(){
isRunning = true;
}
}
| [
"itsalem@live.com"
] | itsalem@live.com |
8596a30602be407e29805e826033111f86e66b6c | 30f428cd42336e516a2d67d8e6ad2d81c75eba0c | /src/main/java/cn/itcast/service/FavoriteService.java | 9a797e4370ddd5069f23d98e04e7a46ff78789a8 | [] | no_license | 365318663/wule-tourism-website | 5daf864f1fe2c4f17bdff58ca3be6983b8529fd6 | 990e853045fe5b12e5be0659c42f46f4fa07835a | refs/heads/master | 2023-01-18T23:46:49.427780 | 2020-11-21T07:54:18 | 2020-11-21T07:54:18 | 294,134,036 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package cn.itcast.service;
public interface FavoriteService {
boolean isFavorite(int uid, String rid);
void addFavorite(int uid, String rid);
void cancelFavorite(int uid, String rid);
}
| [
"365318663@qq.com"
] | 365318663@qq.com |
66b89df8b0b0a1f7a4b6b36e98dd456c219af8d4 | 3dc13ab80e218734fde289c30f1f438921e72742 | /src/main/java/com/backend/helpdesk/exception/FileException/FileExceptionController.java | 1d3470243e36aea349ea8090842b11850c2833ac | [] | no_license | nguyenduykhanh1025/helpdesk-BE | 108b7ae9ff78071fd3e90c563646810bcccc82f8 | a28fdffb5b6a63fd068c2ec98169da0d328d1007 | refs/heads/master | 2022-12-08T03:59:53.416437 | 2020-08-31T04:10:41 | 2020-08-31T04:10:41 | 291,611,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.backend.helpdesk.exception.FileException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
public class FileExceptionController {
@ExceptionHandler(value = FileNotFoundException.class)
public ResponseEntity<Object> exception(FileNotFoundException exception) {
return new ResponseEntity<>("File is not found", HttpStatus.NOT_FOUND);
}
}
| [
"kunlezkunlez1025@gmail.com"
] | kunlezkunlez1025@gmail.com |
cf8cc97c9ac94a331de97fa63b3dbfda6be01daf | 15b260ccada93e20bb696ae19b14ec62e78ed023 | /v2/src/main/java/com/alipay/api/domain/AlipayEcoEprintOrderNotifyModel.java | b561f73f00646c2b5950dc17c0a63b8f2aef4c89 | [
"Apache-2.0"
] | permissive | alipay/alipay-sdk-java-all | df461d00ead2be06d834c37ab1befa110736b5ab | 8cd1750da98ce62dbc931ed437f6101684fbb66a | refs/heads/master | 2023-08-27T03:59:06.566567 | 2023-08-22T14:54:57 | 2023-08-22T14:54:57 | 132,569,986 | 470 | 207 | Apache-2.0 | 2022-12-25T07:37:40 | 2018-05-08T07:19:22 | Java | UTF-8 | Java | false | false | 1,766 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 易联云订单打印完成状态回调接口
*
* @author auto create
* @since 1.0, 2019-09-06 17:57:03
*/
public class AlipayEcoEprintOrderNotifyModel extends AlipayObject {
private static final long serialVersionUID = 6128415668476373264L;
/**
* 签名
*/
@ApiField("eprint_sign")
private String eprintSign;
/**
* 终端号
*/
@ApiField("machine_code")
private String machineCode;
/**
* 授权类型:0=自有应用授权;1=开放应用授权
*/
@ApiField("oauth_type")
private Long oauthType;
/**
* 云平台订单ID
*/
@ApiField("order_id")
private String orderId;
/**
* 回调时间
*/
@ApiField("push_time")
private String pushTime;
/**
* 打印状态 -1=打印取消 0=打印命令发送成功 1=打印完成 2=打印异常
*/
@ApiField("state")
private Long state;
public String getEprintSign() {
return this.eprintSign;
}
public void setEprintSign(String eprintSign) {
this.eprintSign = eprintSign;
}
public String getMachineCode() {
return this.machineCode;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
public Long getOauthType() {
return this.oauthType;
}
public void setOauthType(Long oauthType) {
this.oauthType = oauthType;
}
public String getOrderId() {
return this.orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getPushTime() {
return this.pushTime;
}
public void setPushTime(String pushTime) {
this.pushTime = pushTime;
}
public Long getState() {
return this.state;
}
public void setState(Long state) {
this.state = state;
}
}
| [
"auto-publish"
] | auto-publish |
e6d1f0f28b6c26eb9e8a0216b68af4d36c437695 | fc160694094b89ab09e5c9a0f03db80437eabc93 | /java-dialogflow-cx/samples/snippets/generated/com/google/cloud/dialogflow/cx/v3beta1/intents/listlocations/AsyncListLocations.java | 1f957a158c9a78a860541871bc3f1c6496bcfc56 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | googleapis/google-cloud-java | 4f4d97a145e0310db142ecbc3340ce3a2a444e5e | 6e23c3a406e19af410a1a1dd0d0487329875040e | refs/heads/main | 2023-09-04T09:09:02.481897 | 2023-08-31T20:45:11 | 2023-08-31T20:45:11 | 26,181,278 | 1,122 | 685 | Apache-2.0 | 2023-09-13T21:21:23 | 2014-11-04T17:57:16 | Java | UTF-8 | Java | false | false | 2,163 | java | /*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.dialogflow.cx.v3beta1.samples;
// [START dialogflow_v3beta1_generated_Intents_ListLocations_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.dialogflow.cx.v3beta1.IntentsClient;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.Location;
public class AsyncListLocations {
public static void main(String[] args) throws Exception {
asyncListLocations();
}
public static void asyncListLocations() throws Exception {
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future = intentsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
}
// [END dialogflow_v3beta1_generated_Intents_ListLocations_async]
| [
"noreply@github.com"
] | noreply@github.com |
12b0bfdef86e4747fa8ffc0693df45b1d950cea2 | 704d0585134d79a54c633eeb690cde0eefeeb75b | /components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/util/XKMSCryptoClient.java | 026ce75b220f896c7bb1f13d0a565dc1214cb1d7 | [] | no_license | lmoyaKronos/carbon-commons | c0f7c757ff2d7e3122d6a18636bc8d5f22b1fe96 | 66ca0d8b8579d82937e071ecb90043d19ee02269 | refs/heads/master | 2021-01-17T08:24:02.777391 | 2014-04-02T12:27:18 | 2014-04-02T12:27:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,831 | java | /*
* Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.security.util;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
import org.apache.axiom.om.util.Base64;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.keys.content.KeyName;
//import org.wso2.xkms2.Authentication;
//import org.wso2.xkms2.KeyBinding;
//import org.wso2.xkms2.LocateRequest;
//import org.wso2.xkms2.LocateResult;
//import org.wso2.xkms2.PrototypeKeyBinding;
//import org.wso2.xkms2.QueryKeyBinding;
//import org.wso2.xkms2.RecoverKeyBinding;
//import org.wso2.xkms2.RecoverRequest;
//import org.wso2.xkms2.RecoverResult;
//import org.wso2.xkms2.RegisterRequest;
//import org.wso2.xkms2.ReissueKeyBinding;
//import org.wso2.xkms2.ReissueRequest;
//import org.wso2.xkms2.RespondWith;
//import org.wso2.xkms2.ResultMinor;
//import org.wso2.xkms2.Status;
//import org.wso2.xkms2.StatusValue;
//import org.wso2.xkms2.UnverifiedKeyBinding;
//import org.wso2.xkms2.UseKeyWith;
//import org.wso2.xkms2.ValidateRequest;
//import org.wso2.xkms2.ValidateResult;
//import org.wso2.xkms2.XKMSException;
//import org.wso2.xkms2.builder.LocateResultBuilder;
//import org.wso2.xkms2.builder.RecoverResultBuilder;
//import org.wso2.xkms2.builder.ValidateResultBuilder;
//import org.wso2.xkms2.util.XKMSKeyUtil;
//import org.wso2.xkms2.util.XKMSUtil;
import javax.xml.stream.XMLInputFactory;
import java.io.ByteArrayInputStream;
import java.security.Key;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.List;
public class XKMSCryptoClient {
private static final Log LOG = LogFactory.getLog(XKMSCryptoClient.class
.getName());
public static PrivateKey getPrivateKey(String alias, String serverURL,
String passPhrase) {
// try {
//
// RecoverRequest request = createRecoverRequest();
// request.setServiceURI(serverURL);
//
// Authentication authentication = new Authentication();
// Key authenKey = XKMSKeyUtil.getAuthenticationKey(passPhrase);
// authentication.setKeyBindingAuthenticationKey(authenKey);
// request.setAuthentication(authentication);
//
// RecoverKeyBinding keyBinding = createRecoverKeyBinding();
// keyBinding.setKeyName(alias);
//
// Status status = new Status();
// status.setStatusValue(StatusValue.INDETERMINATE);
// keyBinding.setStatus(status);
//
// request.setRecoverKeyBinding(keyBinding);
//
// request.addRespondWith(RespondWith.PRIVATE_KEY);
//
// OMElement element = getAsOMElement(request);
// OMElement result = sendReceive(element, serverURL);
// result = buildElement(result);
//
// RecoverResult recoverResult = getRecoverResult(result);
//
// ResultMinor resultMinor = recoverResult.getResultMinor();
// if (resultMinor != null && ResultMinor.NO_MATCH.equals(resultMinor)) {
// return null;
// }
//
// org.wso2.xkms2.PrivateKey xkmsPrivateKey = recoverResult
// .getPrivateKey();
// xkmsPrivateKey.setKey(XKMSKeyUtil.getPrivateKey(passPhrase,
// "DESede"));
// KeyPair keyPair = xkmsPrivateKey.getRSAKeyPair();
// return keyPair.getPrivate();
//
// } catch (Exception ex) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("Exception is thrown when invoking XKMS Service", ex);
// }
// return null;
// }
return null;
}
public static X509Certificate[] getCertificates(String alias,
String serviceURL) {
// try {
// LocateRequest request = createLocateRequest();
// request.setServiceURI(serviceURL);
//
// QueryKeyBinding queryKeybinding = createQueryKeyBinding();
// queryKeybinding.setKeyName(alias);
// request.setQueryKeyBinding(queryKeybinding);
//
// request.addRespondWith(RespondWith.X_509_CERT);
//
// OMElement element = getAsOMElement(request);
// OMElement result = sendReceive(element, serviceURL);
// result = buildElement(result);
//
// LocateResult locateResult = getLocateResult(result);
//
// if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
// return null;
//
// } else {
//
// List keybindings = locateResult.getUnverifiedKeyBindingList();
// X509Certificate[] certs = new X509Certificate[keybindings
// .size()];
//
// for (int i = 0; i < keybindings.size(); i++) {
// UnverifiedKeyBinding unverifiedKeybinding = (UnverifiedKeyBinding) keybindings
// .get(i);
// KeyInfo keyInfo = unverifiedKeybinding.getKeyInfo();
// certs[i] = keyInfo.getX509Certificate();
// }
// return certs;
// }
//
// } catch (Exception ex) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("", ex);
// }
// return null;
// }
return null;
}
public static String getAliasForX509Certificate(X509Certificate cert,
String serviceURL) {
// try {
//
// LocateRequest request = createLocateRequest();
// request.setServiceURI(serviceURL);
//
// QueryKeyBinding queryKeybinding = createQueryKeyBinding();
//
// queryKeybinding.setCertValue(cert);
// queryKeybinding.addUseKeyWith(UseKeyWith.PKIX, cert.getSubjectDN()
// .getName());
//
// request.setQueryKeyBinding(queryKeybinding);
//
// request.addRespondWith(RespondWith.KEY_NAME);
//
// OMElement element = getAsOMElement(request);
// OMElement result = sendReceive(element, serviceURL);
// result = buildElement(result);
//
// LocateResult locateResult = getLocateResult(result);
//
// if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
// return null;
//
// } else {
//
// List keybindings = locateResult.getUnverifiedKeyBindingList();
// UnverifiedKeyBinding keybinding = (UnverifiedKeyBinding) keybindings
// .get(0);
// KeyInfo keyInfo = keybinding.getKeyInfo();
// KeyName keyName = keyInfo.itemKeyName(0);
// return keyName.getKeyName();
// }
//
// } catch (Exception ex) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("", ex);
// }
// return null;
// }
return null;
}
public static String getAliasForX509Certificate(byte[] skiValue,
String serviceURL) {
// try {
//
// LocateRequest request = createLocateRequest();
// request.setServiceURI(serviceURL);
//
// QueryKeyBinding queryKeybinding = createQueryKeyBinding();
// queryKeybinding.addUseKeyWith(UseKeyWith.SKI, Base64
// .encode(skiValue));
// request.setQueryKeyBinding(queryKeybinding);
//
// request.addRespondWith(RespondWith.KEY_NAME);
//
// OMElement element = getAsOMElement(request);
// OMElement result = sendReceive(element, serviceURL);
// result = buildElement(result);
//
// LocateResult locateResult = getLocateResult(result);
//
// if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
// return null;
//
// } else {
//
// List keybindings = locateResult.getUnverifiedKeyBindingList();
// UnverifiedKeyBinding keybinding = (UnverifiedKeyBinding) keybindings
// .get(0);
// KeyInfo keyInfo = keybinding.getKeyInfo();
// KeyName keyName = keyInfo.itemKeyName(0);
// return keyName.getKeyName();
// }
//
// } catch (Exception ex) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("", ex);
// }
// return null;
// }
return null;
}
public static String[] getAliasesForDN(String subjectDN, String serviceURL) {
// try {
// LocateRequest request = createLocateRequest();
// request.setServiceURI(serviceURL);
//
// QueryKeyBinding queryKeybinding = createQueryKeyBinding();
// queryKeybinding.addUseKeyWith(UseKeyWith.PKIX, subjectDN);
// request.setQueryKeyBinding(queryKeybinding);
//
// request.addRespondWith(RespondWith.KEY_NAME);
//
// OMElement element = getAsOMElement(request);
// OMElement result = sendReceive(element, serviceURL);
// result = buildElement(result);
//
// LocateResult locateResult = getLocateResult(result);
//
// if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
// return null;
//
// } else {
//
// List keybindings = locateResult.getUnverifiedKeyBindingList();
// String[] aliases = new String[keybindings.size()];
//
// for (int i = 0; i < keybindings.size(); i++) {
// UnverifiedKeyBinding unverifiedKeybinding = (UnverifiedKeyBinding) keybindings
// .get(i);
// KeyInfo keyInfo = unverifiedKeybinding.getKeyInfo();
// aliases[i] = keyInfo.itemKeyName(0).getKeyName();
// }
// return aliases;
// }
//
// } catch (Exception ex) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("", ex);
// }
// return null;
// }
return null;
}
public static boolean validateCertPath(Certificate[] certs,
String serviceURL) {
return validateCertPath((X509Certificate) certs[0], serviceURL);
}
public static boolean validateCertPath(X509Certificate cert,
String serviceURL) {
// try {
//
// ValidateRequest request = createValidateRequest();
// request.setServiceURI(serviceURL);
//
// QueryKeyBinding keyBinding = createQueryKeyBinding();
// keyBinding.setCertValue(cert);
//
// String name = cert.getSubjectDN().getName();
// keyBinding.addUseKeyWith(UseKeyWith.PKIX, name);
//
// request.setQueryKeyBinding(keyBinding);
// request.addRespondWith(RespondWith.X_509_CERT);
//
// OMElement element = getElement(request);
// OMElement result = sendReceive(element, serviceURL);
// result = buildElement(result);
//
// ValidateResult validateResult = getValidateResult(result);
// List keybinds = validateResult.getKeyBindingList();
// KeyBinding keybinding = (KeyBinding) keybinds.get(0);
//
// Status status = keybinding.getStatus();
//
// return StatusValue.VALID.equals(status.getStatusValue());
//
// } catch (Exception ex) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("", ex);
// }
//
// return false;
// }
return false;
}
// private static OMElement getAsOMElement(RecoverRequest request)
// throws XKMSException {
// OMFactory factory = DOOMAbstractFactory.getOMFactory();
// return request.serialize(factory);
// }
//
// private static RecoverResult getRecoverResult(OMElement recoverResultElem)
// throws Exception {
// return (RecoverResult) RecoverResultBuilder.INSTANCE
// .buildElement(recoverResultElem);
// }
// public static RegisterRequest createRegisterRequest() {
// RegisterRequest request = new RegisterRequest();
// request.setId(XKMSUtil.getRamdomId());
// return request;
// }
//
// public static Authentication createAuthenticate() {
// Authentication authentication = new Authentication();
// return authentication;
// }
//
// public static PrototypeKeyBinding createPrototypeKeyBinding() {
// PrototypeKeyBinding keyBinding = new PrototypeKeyBinding();
// keyBinding.setId(XKMSUtil.getRamdomId());
// return keyBinding;
// }
//
// public static QueryKeyBinding createQueryKeyBinding() {
// QueryKeyBinding binding = new QueryKeyBinding();
// binding.setId(XKMSUtil.getRamdomId());
// return binding;
// }
//
// public static ReissueRequest createReissueRequest() {
// ReissueRequest reissueRequest = new ReissueRequest();
// reissueRequest.setId(XKMSUtil.getRamdomId());
// return reissueRequest;
// }
//
// public static ReissueKeyBinding createReissueKeyBinding() {
// ReissueKeyBinding reissueKeyBinding = new ReissueKeyBinding();
// reissueKeyBinding.setId(XKMSUtil.getRamdomId());
// return reissueKeyBinding;
// }
//
// public static RecoverKeyBinding createRecoverKeyBinding() {
// RecoverKeyBinding recoverKeyBinding = new RecoverKeyBinding();
// recoverKeyBinding.setId(XKMSUtil.getRamdomId());
// return recoverKeyBinding;
//
// }
//
// public static RecoverRequest createRecoverRequest() {
// RecoverRequest recoverRequest = new RecoverRequest();
// recoverRequest.setId(XKMSUtil.getRamdomId());
// return recoverRequest;
// }
//
// public static ValidateRequest createValidateRequest() {
// ValidateRequest validate = new ValidateRequest();
// validate.setId(XKMSUtil.getRamdomId());
// return validate;
// }
//
// public static LocateRequest createLocateRequest() {
// LocateRequest locate = new LocateRequest();
// locate.setId(XKMSUtil.getRamdomId());
// return locate;
// }
public static OMElement sendReceive(OMElement element, String serviceURL)
throws AxisFault {
try {
ConfigurationContext configCtx = ConfigurationContextFactory
.createDefaultConfigurationContext();
ServiceClient client = new ServiceClient(configCtx, null);
Options options = client.getOptions();
EndpointReference epr = new EndpointReference(serviceURL);
options.setTo(epr);
options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
OMElement result = client.sendReceive(element);
return result;
} catch (Exception ex) {
throw AxisFault.makeFault(ex);
}
}
public static OMElement buildElement(OMElement element) throws Exception {
String str = element.toString();
ByteArrayInputStream bais = new ByteArrayInputStream(str.getBytes());
StAXOMBuilder builder = new StAXOMBuilder(DOOMAbstractFactory
.getOMFactory(), XMLInputFactory.newInstance()
.createXMLStreamReader(bais));
return builder.getDocumentElement();
}
// private static OMElement getAsOMElement(LocateRequest request)
// throws XKMSException {
// OMFactory factory = DOOMAbstractFactory.getOMFactory();
// return request.serialize(factory);
// }
//
// private static LocateResult getLocateResult(OMElement result)
// throws Exception {
// LocateResult locateResult = (LocateResult) LocateResultBuilder.INSTANCE
// .buildElement(result);
// return locateResult;
// }
//
// private static OMElement getElement(ValidateRequest request)
// throws XKMSException {
// OMFactory factory = DOOMAbstractFactory.getOMFactory();
// return request.serialize(factory);
// }
//
// private static ValidateResult getValidateResult(OMElement element)
// throws XKMSException {
// return (ValidateResult) ValidateResultBuilder.INSTANCE
// .buildElement(element);
//
// }
}
| [
"chamathg@gmail.com"
] | chamathg@gmail.com |
5fe6c07fddc8c2c1c74c4b9ea5a06252fca1e2e9 | 039294d35e94289b8f05cdc59e7327173c8c27f0 | /src/test/java/com/builtbroken/test/as/accelerator/data/TestTubeSide.java | db206f23451cffb7e9939ce5fbcb4c8a82fca3f3 | [
"MIT"
] | permissive | BuiltBrokenModding/Atomic-Science | 284a0127f1b44445485e744e7ba3cede7c8bbb55 | 25af41edf5641a824070ba0e8f7cb42f9ca93c85 | refs/heads/1.12 | 2023-09-04T04:29:18.676495 | 2023-09-02T21:04:15 | 2023-09-02T21:04:15 | 84,383,424 | 30 | 17 | MIT | 2023-09-02T21:04:16 | 2017-03-09T01:25:33 | Java | UTF-8 | Java | false | false | 12,790 | java | package com.builtbroken.test.as.accelerator.data;
import com.builtbroken.atomic.content.machines.accelerator.data.TubeSide;
import net.minecraft.util.EnumFacing;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
/**
* Created by Dark(DarkGuardsman, Robert) on 2019-04-22.
*/
public class TestTubeSide
{
@Test
public void testSides()
{
Assertions.assertEquals(TubeSide.FRONT, TubeSide.SIDES[0]);
Assertions.assertEquals(TubeSide.LEFT, TubeSide.SIDES[1]);
Assertions.assertEquals(TubeSide.RIGHT, TubeSide.SIDES[2]);
Assertions.assertEquals(TubeSide.BACK, TubeSide.SIDES[3]);
}
@Test
public void testInvertBack()
{
Assertions.assertEquals(TubeSide.FRONT, TubeSide.BACK.getOpposite());
}
@Test
public void testInvertFront()
{
Assertions.assertEquals(TubeSide.BACK, TubeSide.FRONT.getOpposite());
}
@Test
public void testInvertLeft()
{
Assertions.assertEquals(TubeSide.RIGHT, TubeSide.LEFT.getOpposite());
}
@Test
public void testInvertRight()
{
Assertions.assertEquals(TubeSide.LEFT, TubeSide.RIGHT.getOpposite());
}
@Test
public void testInvertCenter()
{
Assertions.assertEquals(TubeSide.CENTER, TubeSide.CENTER.getOpposite());
}
@ParameterizedTest
@MethodSource("provideGetFacingData")
public void checkGetFacing(TubeSide side, EnumFacing facing, EnumFacing expected)
{
Assertions.assertEquals(expected, side.getFacing(facing));
}
private static Stream<Arguments> provideGetFacingData()
{
return Stream.of(
Arguments.of(TubeSide.FRONT, EnumFacing.NORTH, EnumFacing.NORTH),
Arguments.of(TubeSide.FRONT, EnumFacing.SOUTH, EnumFacing.SOUTH),
Arguments.of(TubeSide.FRONT, EnumFacing.EAST, EnumFacing.EAST),
Arguments.of(TubeSide.FRONT, EnumFacing.WEST, EnumFacing.WEST),
Arguments.of(TubeSide.BACK, EnumFacing.NORTH, EnumFacing.SOUTH),
Arguments.of(TubeSide.BACK, EnumFacing.SOUTH, EnumFacing.NORTH),
Arguments.of(TubeSide.BACK, EnumFacing.EAST, EnumFacing.WEST),
Arguments.of(TubeSide.BACK, EnumFacing.WEST, EnumFacing.EAST),
Arguments.of(TubeSide.LEFT, EnumFacing.NORTH, EnumFacing.WEST),
Arguments.of(TubeSide.LEFT, EnumFacing.SOUTH, EnumFacing.EAST),
Arguments.of(TubeSide.LEFT, EnumFacing.EAST, EnumFacing.NORTH),
Arguments.of(TubeSide.LEFT, EnumFacing.WEST, EnumFacing.SOUTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.NORTH, EnumFacing.EAST),
Arguments.of(TubeSide.RIGHT, EnumFacing.SOUTH, EnumFacing.WEST),
Arguments.of(TubeSide.RIGHT, EnumFacing.EAST, EnumFacing.SOUTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.WEST, EnumFacing.NORTH),
//Null should always result in null
Arguments.of(TubeSide.FRONT, null, null),
Arguments.of(TubeSide.LEFT, null, null),
Arguments.of(TubeSide.RIGHT, null, null),
Arguments.of(TubeSide.BACK, null, null),
Arguments.of(TubeSide.CENTER, null, null),
//Center should always return null
Arguments.of(TubeSide.CENTER, EnumFacing.UP, null),
Arguments.of(TubeSide.CENTER, EnumFacing.DOWN, null),
Arguments.of(TubeSide.CENTER, EnumFacing.NORTH, null),
Arguments.of(TubeSide.CENTER, EnumFacing.SOUTH, null),
Arguments.of(TubeSide.CENTER, EnumFacing.EAST, null),
Arguments.of(TubeSide.CENTER, EnumFacing.WEST, null)
);
}
@ParameterizedTest
@MethodSource("provideGetSideFacingOutData")
public void checkGetSideFacingOut(EnumFacing facing, EnumFacing side, TubeSide expected)
{
Assertions.assertEquals(expected, TubeSide.getSideFacingOut(facing, side));
}
private static Stream<Arguments> provideGetSideFacingOutData()
{
return Stream.of(
Arguments.of(EnumFacing.NORTH, EnumFacing.NORTH, TubeSide.FRONT),
Arguments.of(EnumFacing.SOUTH, EnumFacing.SOUTH, TubeSide.FRONT),
Arguments.of(EnumFacing.EAST, EnumFacing.EAST, TubeSide.FRONT),
Arguments.of(EnumFacing.WEST, EnumFacing.WEST, TubeSide.FRONT),
Arguments.of(EnumFacing.NORTH, EnumFacing.SOUTH, TubeSide.BACK),
Arguments.of(EnumFacing.SOUTH, EnumFacing.NORTH, TubeSide.BACK),
Arguments.of(EnumFacing.EAST, EnumFacing.WEST, TubeSide.BACK),
Arguments.of(EnumFacing.WEST, EnumFacing.EAST, TubeSide.BACK),
Arguments.of(EnumFacing.NORTH, EnumFacing.WEST, TubeSide.LEFT),
Arguments.of(EnumFacing.SOUTH, EnumFacing.EAST, TubeSide.LEFT),
Arguments.of(EnumFacing.EAST, EnumFacing.NORTH, TubeSide.LEFT),
Arguments.of(EnumFacing.WEST, EnumFacing.SOUTH, TubeSide.LEFT),
Arguments.of(EnumFacing.NORTH, EnumFacing.EAST, TubeSide.RIGHT),
Arguments.of(EnumFacing.SOUTH, EnumFacing.WEST, TubeSide.RIGHT),
Arguments.of(EnumFacing.EAST, EnumFacing.SOUTH, TubeSide.RIGHT),
Arguments.of(EnumFacing.WEST, EnumFacing.NORTH, TubeSide.RIGHT)
);
}
@ParameterizedTest
@MethodSource("provideGetRotationRelativeData")
public void checkGetRotationRelative(TubeSide centerSide, EnumFacing centerFacing,
TubeSide targetSide, EnumFacing expected)
{
Assertions.assertEquals(expected, centerSide.getRotationRelative(centerFacing, targetSide));
}
private static Stream<Arguments> provideGetRotationRelativeData()
{
return Stream.of(
//Front -> Back
Arguments.of(TubeSide.FRONT, EnumFacing.NORTH, TubeSide.BACK, EnumFacing.NORTH),
Arguments.of(TubeSide.FRONT, EnumFacing.SOUTH, TubeSide.BACK, EnumFacing.SOUTH),
Arguments.of(TubeSide.FRONT, EnumFacing.EAST, TubeSide.BACK, EnumFacing.EAST),
Arguments.of(TubeSide.FRONT, EnumFacing.WEST, TubeSide.BACK, EnumFacing.WEST),
//Back -> Front
Arguments.of(TubeSide.BACK, EnumFacing.NORTH, TubeSide.FRONT, EnumFacing.NORTH),
Arguments.of(TubeSide.BACK, EnumFacing.SOUTH, TubeSide.FRONT, EnumFacing.SOUTH),
Arguments.of(TubeSide.BACK, EnumFacing.EAST, TubeSide.FRONT, EnumFacing.EAST),
Arguments.of(TubeSide.BACK, EnumFacing.WEST, TubeSide.FRONT, EnumFacing.WEST),
//Front -> Front
Arguments.of(TubeSide.FRONT, EnumFacing.NORTH, TubeSide.FRONT, EnumFacing.SOUTH),
Arguments.of(TubeSide.FRONT, EnumFacing.SOUTH, TubeSide.FRONT, EnumFacing.NORTH),
Arguments.of(TubeSide.FRONT, EnumFacing.EAST, TubeSide.FRONT, EnumFacing.WEST),
Arguments.of(TubeSide.FRONT, EnumFacing.WEST, TubeSide.FRONT, EnumFacing.EAST),
//Back -> Back
Arguments.of(TubeSide.BACK, EnumFacing.NORTH, TubeSide.BACK, EnumFacing.SOUTH),
Arguments.of(TubeSide.BACK, EnumFacing.SOUTH, TubeSide.BACK, EnumFacing.NORTH),
Arguments.of(TubeSide.BACK, EnumFacing.EAST, TubeSide.BACK, EnumFacing.WEST),
Arguments.of(TubeSide.BACK, EnumFacing.WEST, TubeSide.BACK, EnumFacing.EAST),
//Front -> Left
Arguments.of(TubeSide.FRONT, EnumFacing.NORTH, TubeSide.LEFT, EnumFacing.WEST),
Arguments.of(TubeSide.FRONT, EnumFacing.SOUTH, TubeSide.LEFT, EnumFacing.EAST),
Arguments.of(TubeSide.FRONT, EnumFacing.EAST, TubeSide.LEFT, EnumFacing.NORTH),
Arguments.of(TubeSide.FRONT, EnumFacing.WEST, TubeSide.LEFT, EnumFacing.SOUTH),
//Left -> Front
Arguments.of(TubeSide.LEFT, EnumFacing.NORTH, TubeSide.FRONT, EnumFacing.EAST),
Arguments.of(TubeSide.LEFT, EnumFacing.SOUTH, TubeSide.FRONT, EnumFacing.WEST),
Arguments.of(TubeSide.LEFT, EnumFacing.EAST, TubeSide.FRONT, EnumFacing.SOUTH),
Arguments.of(TubeSide.LEFT, EnumFacing.WEST, TubeSide.FRONT, EnumFacing.NORTH),
//Front -> Right
Arguments.of(TubeSide.FRONT, EnumFacing.NORTH, TubeSide.RIGHT, EnumFacing.EAST),
Arguments.of(TubeSide.FRONT, EnumFacing.SOUTH, TubeSide.RIGHT, EnumFacing.WEST),
Arguments.of(TubeSide.FRONT, EnumFacing.EAST, TubeSide.RIGHT, EnumFacing.SOUTH),
Arguments.of(TubeSide.FRONT, EnumFacing.WEST, TubeSide.RIGHT, EnumFacing.NORTH),
//Right -> Front
Arguments.of(TubeSide.RIGHT, EnumFacing.NORTH, TubeSide.FRONT, EnumFacing.WEST),
Arguments.of(TubeSide.RIGHT, EnumFacing.SOUTH, TubeSide.FRONT, EnumFacing.EAST),
Arguments.of(TubeSide.RIGHT, EnumFacing.EAST, TubeSide.FRONT, EnumFacing.NORTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.WEST, TubeSide.FRONT, EnumFacing.SOUTH),
//Back -> Left
Arguments.of(TubeSide.BACK, EnumFacing.NORTH, TubeSide.LEFT, EnumFacing.EAST),
Arguments.of(TubeSide.BACK, EnumFacing.SOUTH, TubeSide.LEFT, EnumFacing.WEST),
Arguments.of(TubeSide.BACK, EnumFacing.EAST, TubeSide.LEFT, EnumFacing.SOUTH),
Arguments.of(TubeSide.BACK, EnumFacing.WEST, TubeSide.LEFT, EnumFacing.NORTH),
//Left -> Back
Arguments.of(TubeSide.LEFT, EnumFacing.NORTH, TubeSide.BACK, EnumFacing.WEST),
Arguments.of(TubeSide.LEFT, EnumFacing.SOUTH, TubeSide.BACK, EnumFacing.EAST),
Arguments.of(TubeSide.LEFT, EnumFacing.EAST, TubeSide.BACK, EnumFacing.NORTH),
Arguments.of(TubeSide.LEFT, EnumFacing.WEST, TubeSide.BACK, EnumFacing.SOUTH),
//Back -> Right
Arguments.of(TubeSide.BACK, EnumFacing.NORTH, TubeSide.RIGHT, EnumFacing.WEST),
Arguments.of(TubeSide.BACK, EnumFacing.SOUTH, TubeSide.RIGHT, EnumFacing.EAST),
Arguments.of(TubeSide.BACK, EnumFacing.EAST, TubeSide.RIGHT, EnumFacing.NORTH),
Arguments.of(TubeSide.BACK, EnumFacing.WEST, TubeSide.RIGHT, EnumFacing.SOUTH),
//Right -> Back
Arguments.of(TubeSide.RIGHT, EnumFacing.NORTH, TubeSide.BACK, EnumFacing.EAST),
Arguments.of(TubeSide.RIGHT, EnumFacing.SOUTH, TubeSide.BACK, EnumFacing.WEST),
Arguments.of(TubeSide.RIGHT, EnumFacing.EAST, TubeSide.BACK, EnumFacing.SOUTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.WEST, TubeSide.BACK, EnumFacing.NORTH),
//Left -> Right
Arguments.of(TubeSide.LEFT, EnumFacing.NORTH, TubeSide.RIGHT, EnumFacing.NORTH),
Arguments.of(TubeSide.LEFT, EnumFacing.SOUTH, TubeSide.RIGHT, EnumFacing.SOUTH),
Arguments.of(TubeSide.LEFT, EnumFacing.EAST, TubeSide.RIGHT, EnumFacing.EAST),
Arguments.of(TubeSide.LEFT, EnumFacing.WEST, TubeSide.RIGHT, EnumFacing.WEST),
//Right -> Left
Arguments.of(TubeSide.RIGHT, EnumFacing.NORTH, TubeSide.LEFT, EnumFacing.NORTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.SOUTH, TubeSide.LEFT, EnumFacing.SOUTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.EAST, TubeSide.LEFT, EnumFacing.EAST),
Arguments.of(TubeSide.RIGHT, EnumFacing.WEST, TubeSide.LEFT, EnumFacing.WEST),
//Left -> Left
Arguments.of(TubeSide.LEFT, EnumFacing.NORTH, TubeSide.LEFT, EnumFacing.SOUTH),
Arguments.of(TubeSide.LEFT, EnumFacing.SOUTH, TubeSide.LEFT, EnumFacing.NORTH),
Arguments.of(TubeSide.LEFT, EnumFacing.EAST, TubeSide.LEFT, EnumFacing.WEST),
Arguments.of(TubeSide.LEFT, EnumFacing.WEST, TubeSide.LEFT, EnumFacing.EAST),
//Right -> Right
Arguments.of(TubeSide.RIGHT, EnumFacing.NORTH, TubeSide.RIGHT, EnumFacing.SOUTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.SOUTH, TubeSide.RIGHT, EnumFacing.NORTH),
Arguments.of(TubeSide.RIGHT, EnumFacing.EAST, TubeSide.RIGHT, EnumFacing.WEST),
Arguments.of(TubeSide.RIGHT, EnumFacing.WEST, TubeSide.RIGHT, EnumFacing.EAST)
);
}
}
| [
"rseifert.phone@gmail.com"
] | rseifert.phone@gmail.com |
5d59f8ebc70c10915c60fcf307ae4667b1f89873 | 92666986e090d3e5027045bf798395444d6df6ab | /modular-monolith-to-microservices/after/microservices/answer-service/src/main/java/com/example/answerservice/service/AnswerService.java | cdf16f923dc237fe003c80bf16bc6c7ae44c9f57 | [] | no_license | alo9507/monolith-to-microservices-java-spring | 944c32a795e61009a5f1914e9c1bcf8610ddcdb4 | 32f8cf9bb5933559b50169eb00d4f52a59359533 | refs/heads/master | 2022-12-25T05:13:41.342386 | 2020-09-30T15:10:24 | 2020-09-30T16:35:18 | 298,870,393 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package com.example.answerservice.service;
import com.example.answerservice.model.Answer;
import com.example.answerservice.model.ParsedQuestion;
public interface AnswerService {
Answer answer(ParsedQuestion parsedQuestion);
}
| [
"alo42@georgetown.edu"
] | alo42@georgetown.edu |
516a52a4f80cc86a79438d8771e076468af3da81 | b847dd47ae13c43d321563753f61b04933f71f3e | /app/src/main/java/com/dewtip/popgame/LaunchActivity.java | 5aa3c559e91fa4b750e08354b193106ed672c76a | [] | no_license | zhanqin/ViewFlipperCarouselDemo | 5d8560327401bb7a3a403e69754f0f63bb220635 | 7151ecfe4a34bae7b96e8660839148cad40bf562 | refs/heads/master | 2021-01-01T05:54:06.095863 | 2017-07-15T07:18:23 | 2017-07-15T07:18:23 | 97,298,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.dewtip.popgame;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.dewtip.popgame.R;
import static android.R.attr.start;
/**
* Created by qq on 2017/7/8.
*/
//启动页面
public class LaunchActivity extends AppCompatActivity {
private Handler h = new Handler(){
@Override
public void handleMessage(Message msg) {
startActivity(new Intent(LaunchActivity.this, WelcomeActivity.class));
finish();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//加载启动页面
setContentView(R.layout.activity_launch);
//启动页显示3秒后跳转到引导页
h.sendEmptyMessageDelayed(0, 1000);
}
}
| [
"qq@QQdeMacBook-Pro.local"
] | qq@QQdeMacBook-Pro.local |
dd21c41eb74cf285a626e4a2302ced0d87aa4ab6 | 71fe4adaecb0d34b598c9463068cccc096391b28 | /scarabei-aws-android-ses/src/com/jfixby/scarabei/aws/android/ses/AndroidSESClient.java | 0baa73473ec59e2ba1c7895d3ed49d68a827976e | [] | no_license | Scarabei/Scarabei | ea795ddfa0ee83bdc100b54ca88f09c56937c289 | 07ab9cf45eafb3c0bb939792303b4c70e6b50b95 | refs/heads/master | 2023-03-12T11:58:48.401947 | 2021-03-04T13:24:53 | 2021-03-04T13:31:01 | 45,246,099 | 8 | 3 | null | 2017-03-13T11:11:46 | 2015-10-30T11:02:15 | Java | UTF-8 | Java | false | false | 2,609 | java |
package com.jfixby.scarabei.aws.android.ses;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.services.simpleemail.AmazonSimpleEmailService;
import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient;
import com.amazonaws.services.simpleemail.model.ListVerifiedEmailAddressesResult;
import com.amazonaws.services.simpleemail.model.VerifyEmailAddressRequest;
import com.jfixby.scarabei.api.err.Err;
import com.jfixby.scarabei.aws.api.AWSCredentialsProvider;
import com.jfixby.scarabei.aws.api.ses.AmazonSimpleEmail;
import com.jfixby.scarabei.aws.api.ses.SESClient;
import com.jfixby.scarabei.aws.api.ses.SESClientSpecs;
import com.jfixby.scarabei.aws.api.ses.SendEmailResult;
public class AndroidSESClient implements SESClient {
private final AmazonSimpleEmailService aws_client;
public AndroidSESClient (final SESClientSpecs params) {
final AWSCredentialsProvider keys = params.getAWSCredentialsProvider();
final String regionName = params.getSESRegionName();
final com.amazonaws.auth.AWSCredentialsProvider awsKeys = new com.amazonaws.auth.AWSCredentialsProvider() {
@Override
public AWSCredentials getCredentials () {
return new AWSCredentials() {
@Override
public String getAWSAccessKeyId () {
return keys.getAccessKeyID();
}
@Override
public String getAWSSecretKey () {
return keys.getSecretKeyID();
}
};
}
@Override
public void refresh () {
}
};
final AmazonSimpleEmailServiceClient standardclient = new AmazonSimpleEmailServiceClient(awsKeys);
// standardclient.setCredentials(awsKeys);
// standardclient.set
final Region region = com.amazonaws.regions.Region.getRegion(com.amazonaws.regions.Regions.fromName(regionName));
standardclient.setRegion(region);
this.aws_client = standardclient;
}
@Override
public SendEmailResult send (final AmazonSimpleEmail email) {
final AndroidAmazonSimpleEmail r_email = (AndroidAmazonSimpleEmail)email;
verifyEmailAddress(this.aws_client, r_email.from);
return new AndroidSendEmailResult(this.aws_client.sendEmail(r_email.aws_request));
}
private static void verifyEmailAddress (final AmazonSimpleEmailService ses, final String address) {
final ListVerifiedEmailAddressesResult verifiedEmails = ses.listVerifiedEmailAddresses();
if (verifiedEmails.getVerifiedEmailAddresses().contains(address)) {
return;
}
ses.verifyEmailAddress(new VerifyEmailAddressRequest().withEmailAddress(address));
Err.reportError("Please check the email address " + address + " to verify it");
}
}
| [
"github@jfixby.com"
] | github@jfixby.com |
17a0f57870511760ff038fdfd3e3673ab48ea006 | 083245dad5748ca827bc5d04c73bb3d45823dc2e | /src/com/hoiio/sdk/objects/account/Balance.java | 8f90f98fd551b0882d7f9e8d0ba5cbeff5978fed | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Hoiio/hoiio-java | 8cbb43cfb4a73a1f6002309cf2064bfcf819dec7 | fb2d6b9004c90928d2527797ca7deb1dcd34e327 | refs/heads/master | 2021-06-26T02:05:19.424137 | 2017-04-05T09:05:24 | 2017-04-05T09:05:24 | 3,054,579 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,855 | java | package com.hoiio.sdk.objects.account;
/*
Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
import net.sf.json.JSONObject;
import com.hoiio.sdk.objects.HoiioResponse;
import com.hoiio.sdk.objects.enums.Currency;
public class Balance extends HoiioResponse {
private static enum Params {
CURRENCY, BALANCE, POINTS, BONUS;
public String toString() {
return this.name().toLowerCase();
}
}
private Currency currency;
private double balance;
private double points;
private double bonus;
/**
* Constructs a new {@code Balance} object by decoding the {@code JSONObject} as a response from the HTTP Request
* @param output The response of the HTTP Request
*/
public Balance(JSONObject output) {
response = output.toString();
currency = Currency.fromString(output.getString(Params.CURRENCY.toString()));
balance = output.getDouble(Params.BALANCE.toString());
points = output.getDouble(Params.POINTS.toString());
bonus = output.getDouble(Params.BONUS.toString());
}
/**
* Gets the total balance of this account
* @return The total available credit balance for this account. This is the sum of your Hoiio Points and Hoiio Bonus Points.
*/
public double getBalance() {
return balance;
}
/**
* Gets the Bonus Points credit balance of this account
* @return Your Hoiio Bonus Points credit balance. Hoiio Bonus Points cannot be transferred.
*/
public double getBonus() {
return bonus;
}
/**
* Gets the currency used for this account
* @return Currency used for this account.
*/
public Currency getCurrency() {
return currency;
}
/**
* Gets the Hoiio Points credit balance of this account
* @return Your Hoiio Points credit balance. Hoiio Points can be transferred to another account.
*/
public double getPoints() {
return points;
}
}
| [
"daoduytuanduong@gmail.com"
] | daoduytuanduong@gmail.com |
78dbadec1ad07b3c5501d24e2f54809eb4d9b95c | 1926014cb34926d60295bd271bc558e80625dd6e | /library/src/main/java/com/knowbox/base/coretext/TwentyFourPointsCell.java | a3146add4b10ebcc41383d3bd6eadbd83633c3bb | [] | no_license | sunyangyang/CoreText | 6ee35053a9d57e1b7ce7f4365d881984739d9a0d | a039ea43c83a50de22156950d4886459e20f5530 | refs/heads/master | 2020-06-12T10:44:06.617058 | 2019-07-22T12:27:35 | 2019-07-22T12:27:35 | 194,273,893 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,440 | java | package com.knowbox.base.coretext;
import android.graphics.Bitmap;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.Log;
import com.hyena.coretext.blocks.ICYEditable;
import com.hyena.coretext.utils.Const;
/**
* Created by sunyangyang on 2018/4/24.
*/
public class TwentyFourPointsCell {
private Paint mPaint;
private Paint mMaskPaint;
private Matrix mMatrix;
private Bitmap mContentBitmap;
private Bitmap mVarietyBitmap;
private Bitmap mTargetVarietyBitmap;
private Bitmap mTargetContentBitmap;
private RectF mMaskRectF = new RectF();
private float mRy;
private Camera mCamera;
private ICYEditable mEditable;
private boolean mIsFocus = false;
private int mCorner;
public TwentyFourPointsCell(final int id, final String content, Bitmap contentBitmap,
Bitmap varietyBitmap,
int corner,
int maskColor) {
mCamera = new Camera();
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(Color.WHITE);
mMaskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
int alpha = 77;
if (maskColor == -1) {
mMaskPaint.setColor(0x4d4F6171);
} else {
mMaskPaint.setColor(maskColor);
alpha = maskColor >>> 24;
}
mCorner = corner;
mMaskPaint.setAlpha(alpha);
mMatrix = new Matrix();
mContentBitmap = contentBitmap;
mVarietyBitmap = varietyBitmap;
mEditable = new ICYEditable() {
@Override
public int getTabId() {
return id;
}
@Override
public void setText(String s) {
}
@Override
public String getText() {
return content;
}
@Override
public void setTextColor(int i) {
}
@Override
public String getDefaultText() {
return null;
}
@Override
public void setEditable(boolean b) {
}
@Override
public boolean isEditable() {
return false;
}
@Override
public boolean hasBottomLine() {
return false;
}
@Override
public void setFocus(boolean b) {
mIsFocus = b;
}
@Override
public boolean hasFocus() {
return mIsFocus;
}
@Override
public void setFocusable(boolean b) {
}
@Override
public boolean isFocusable() {
return true;
}
@Override
public Rect getBlockRect() {
return null;
}
};
}
public void setData(Bitmap contentBitmap,
Bitmap varietyBitmap) {
if (contentBitmap != null) {
mContentBitmap = contentBitmap;
}
if (varietyBitmap != null) {
mVarietyBitmap = varietyBitmap;
}
if (mCamera == null) {
mCamera = new Camera();
}
}
public void draw(Canvas canvas, Rect rect, Bitmap cardBitmap) {
canvas.save();
canvas.translate(rect.left + rect.width(), rect.top + rect.height() / 2);
if (mCamera != null) {
mCamera.save();
mCamera.translate(0, rect.height() / 2, 0);
mCamera.rotateY(mRy);
mCamera.getMatrix(mMatrix);
mCamera.restore();
}
mMatrix.preTranslate(-rect.width() / 2, 0);
mMatrix.postTranslate(-rect.width() / 2, 0);
if (mTargetVarietyBitmap == null && mVarietyBitmap != null) {
mTargetVarietyBitmap = Bitmap.createScaledBitmap(mVarietyBitmap, rect.width(), rect.height(), false);
}
if (mTargetContentBitmap == null && (mContentBitmap != null)
&& (mVarietyBitmap != null)) {
float sx = rect.width() * 1.0f / mVarietyBitmap.getWidth();
float sy = rect.height() * 1.0f / mVarietyBitmap.getHeight();
mTargetContentBitmap = Bitmap.createScaledBitmap(mContentBitmap, (int) (mContentBitmap.getWidth() * sx), (int) (mContentBitmap.getHeight() * sy), false);
mVarietyBitmap = null;
mContentBitmap = null;
}
float tx = 0;
float ty = 0;
if (mTargetContentBitmap != null && !mTargetContentBitmap.isRecycled()) {
tx = (rect.width() - mTargetContentBitmap.getWidth()) / 2;
ty = (rect.height() - mTargetContentBitmap.getHeight()) / 2;
}
if (mRy > 90) {
if (cardBitmap != null) {
canvas.drawBitmap(cardBitmap, mMatrix, mPaint);
}
} else {
if (mTargetVarietyBitmap != null) {
canvas.drawBitmap(mTargetVarietyBitmap, mMatrix, mPaint);
}
if (mTargetContentBitmap != null) {
mMatrix.preTranslate(tx, ty);
canvas.drawBitmap(mTargetContentBitmap, mMatrix, mPaint);
mMatrix.postTranslate(tx, ty);
}
}
canvas.restore();
if (mEditable != null && mEditable.hasFocus()) {
canvas.save();
canvas.translate(rect.left, rect.top);
mMaskRectF.set(0, 0, rect.width(), rect.height());
canvas.drawRoundRect(mMaskRectF, mCorner, mCorner, mMaskPaint);
canvas.restore();
}
mMatrix.reset();
}
public void setR(float ry) {
mRy = ry;
}
public ICYEditable findEditable() {
return mEditable;
}
public void release() {
if (mVarietyBitmap != null) {
mVarietyBitmap = null;
}
if (mContentBitmap != null) {
mContentBitmap = null;
}
if (mTargetContentBitmap != null) {
mTargetContentBitmap = null;
}
if (mTargetContentBitmap != null) {
mTargetContentBitmap = null;
}
if (mCamera != null) {
mCamera = null;
}
}
}
| [
"sunyy@knowbox.cn"
] | sunyy@knowbox.cn |
96e556fad6979932cff13b18ad0413954bb3fda1 | 40e41f03435283f2a835d7dba04e5c39c7a60580 | /storage/core/src/main/java/com/hortonworks/iotas/storage/exception/IllegalQueryParameterException.java | 6ff7a9ae52fd863ca9275cbc735699b2fd97ff06 | [
"Apache-2.0"
] | permissive | csivaguru/streamline | 013308c21cbab871982a3020a87b8c736290671a | c4219506dc18572123fa63c143f58e0cd433e8b7 | refs/heads/master | 2021-03-22T02:07:25.450687 | 2016-10-14T10:50:58 | 2016-10-14T10:50:58 | 70,907,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,739 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hortonworks.iotas.storage.exception;
/**
* Exception thrown when the value specified for a query parameter is not compatible with the type of that parameter.
* Query parameters are typically specified for a column or key in a database table or storage namespace, hence type is important
*/
public class IllegalQueryParameterException extends RuntimeException {
public IllegalQueryParameterException() {
}
public IllegalQueryParameterException(String message) {
super(message);
}
public IllegalQueryParameterException(String message, Throwable cause) {
super(message, cause);
}
public IllegalQueryParameterException(Throwable cause) {
super(cause);
}
public IllegalQueryParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"hmclouro@gmail.com"
] | hmclouro@gmail.com |
c21ddf6f022ea343d7dc98eae3b56960b3a06d40 | a6d007b186ec5ef6d82c2a59d8c59958d9916a34 | /Core_Java_LabBook/Lab9/Exercise2.java | fd166148ad897276697eb9c24251111e3337f150 | [] | no_license | amruth99/Capgemini_Training | 8ad24239e7209fab87526985c03811da61364c9c | 6a3b6ce3f14f29d42f225179f5270f542b4b7a05 | refs/heads/main | 2023-03-24T11:45:30.259898 | 2021-03-22T10:12:42 | 2021-03-22T10:12:42 | 347,030,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package Lab9;
import java.util.Scanner;
import java.util.function.Function;
public class Exercise2 {
public static String addSpaces(String str) {
Function<String, String> stringFormatter = (string) -> string.replace("", " ");
return stringFormatter.apply(str).trim();
Function<String, String> addSpace = (x) -> x.replace(""," ");
return addSpace.apply(str).trim();
}
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
String string = read.nextLine();
System.out.println(addSpaces(string)); // trim is important to avoid space before and after
// first and last character
}
}
| [
"noreply@github.com"
] | noreply@github.com |
56973830533ebc5c6acf47d4fb239bf35f0b3476 | 4d5b80fe4c54bd766ed95a00aacc6d5916017044 | /src/第三部分生成实例/建造者模式/Sample/TextBuilder.java | f55471e17e1fd31877da8be09e8df48a2186f93a | [] | no_license | coolcoolercool/GraphicDesignPattern | bf4314dba83d71e1cf6ec8c3d6b488168d054ee2 | e6eff89dd18bf7d33a6d18549bc35bd97e3d3daa | refs/heads/master | 2020-03-27T23:52:30.503901 | 2018-09-04T14:00:31 | 2018-09-04T14:00:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | package 第三部分生成实例.建造者模式.Sample;
/**
* author: zzw5005
* date: 2018/9/1 10:07
*/
/*
* 具体的建造者角色。它负责实现Builder角色的接口类,定义了在生成实例时候实际被调用的方法。
* 它还定义了获取最终生成的结果的方法
* */
public class TextBuilder extends Builder {
private StringBuffer buffer = new StringBuffer(); //文档内容保存在该字段中
public void makeTitle(String title){ //纯文本的标题
buffer.append("=====================\n");
buffer.append("[" + title + "] \n");
buffer.append("\n");
}
public void makeString(String str){
buffer.append(" " +'■' + " " + str + "\n");
buffer.append("\n");
}
public void makeItems(String[] items){
for(int i = 0; i < items.length; i++){
buffer.append(" ・" + items[i] + "\n");
}
buffer.append("\n");
}
public void close(){
buffer.append("======================\n");
}
public String getResult(){
return buffer.toString();
}
}
| [
"1827952880@qq.com"
] | 1827952880@qq.com |
41408202a991bfc917e64272544bdbc2a0d4def7 | b2037d5b2d9078542b06d4acb5f719ef99471445 | /java-capstone-module-2-team-5/tenmo-client/src/main/java/com/techelevator/tenmo/models/User.java | 9a2c88f1b9cac37ba764f266c5b89ec4cacc42d4 | [] | no_license | momohibaaq/Tenmo-Applicaiton | d3e63b39dab96fc12e1734d723e4a229f93685eb | 7bdf3380cd60c307444b16b162d53792617506d9 | refs/heads/main | 2023-01-31T12:04:35.502224 | 2020-12-08T02:55:59 | 2020-12-08T02:55:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java |
package com.techelevator.tenmo.models;
public class User {
private Integer id;
private String username;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
d66ccc96753af49763eb5452e4387e016b845e14 | 5f691411613718020f36713a89a29d04e60a19c8 | /app/src/main/java/com/example/workitchat/ProfileActivity.java | ec58167a12945d8c0e0d84bc2765850f4b21d4ec | [] | no_license | michalshuvi/WorkitChat | 4054dfff0f0d5e0a2f329743673786faaa535c94 | c4138e7e654b9fa7d7e444bc9c213fe5306cedfb | refs/heads/master | 2020-05-17T17:59:11.525191 | 2019-04-28T12:14:25 | 2019-04-28T12:14:25 | 183,869,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,151 | java | package com.example.workitchat;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ServerValue;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class ProfileActivity extends AppCompatActivity {
private String profileUserId;
private ImageView mProfileImg;
private TextView mProfileName;
private TextView mProfileStatus;
private Button mSendReqBtn;
private Button mDeclineReqBtn;
private DatabaseReference mProfileUserDatabase;
private DatabaseReference mFriendRequestDatabase;
private DatabaseReference mFriendsDatabase;
private DatabaseReference mNotificationDatabase;
private DatabaseReference mRootRef;
private FirebaseUser mCurUser;
private ProgressDialog mProgress;
private int mCurrentFriendState;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
profileUserId = getIntent().getStringExtra("userId");
mProfileImg = (ImageView) findViewById(R.id.profile_image);
mProfileName = (TextView) findViewById(R.id.profile_user_name);
mProfileStatus = (TextView) findViewById(R.id.profile_user_status);
mSendReqBtn = (Button) findViewById(R.id.profile_send_req);
mDeclineReqBtn = (Button) findViewById(R.id.profile_decline_req);
mDeclineReqBtn.setEnabled(false);
setProgressBar("Loading Profile", "Please wait while we load user data");
mProgress.show();
mProfileUserDatabase = FirebaseDatabase.getInstance().getReference().child(WorkitContract.USERS_SCHEMA).child(profileUserId);
mFriendRequestDatabase = FirebaseDatabase.getInstance().getReference().child(WorkitContract.FRIEND_REQUEST_SCHEMA);
mFriendsDatabase = FirebaseDatabase.getInstance().getReference().child(WorkitContract.FRIENDS_SCHEMA);
mNotificationDatabase = FirebaseDatabase.getInstance().getReference().child(WorkitContract.NOTIFICATIONS_SCHEMA);
mRootRef = FirebaseDatabase.getInstance().getReference();
mCurUser = FirebaseAuth.getInstance().getCurrentUser();
//not friends
mCurrentFriendState = WorkitContract.FRIENDS_STATE_NOT_FRIENDS;
mProfileUserDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
String name = dataSnapshot.child(WorkitContract.USERS_COLUMN_NAME).getValue().toString();
String image = dataSnapshot.child(WorkitContract.USERS_COLUMN_IMAGE).getValue().toString();
String status = dataSnapshot.child(WorkitContract.USERS_COLUMN_STATUS).getValue().toString();
mProfileName.setText(name);
mProfileStatus.setText(status);
if (!image.equals("default")) {
Picasso.get().load(image).placeholder(R.drawable.avatar).into(mProfileImg);
}
//choose text on friend request button
setBtnText();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(ProfileActivity.this, databaseError.getMessage(), Toast.LENGTH_LONG).show();
}
});
mDeclineReqBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSendReqBtn.setEnabled(false);
mDeclineReqBtn.setEnabled(false);
setProgressBar("Processing", "Please wait a moment");
mProgress.show();
Map declineMap = new HashMap();
declineMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + profileUserId + "/" + mCurUser.getUid(), null);
declineMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + mCurUser.getUid() + "/" + profileUserId, null);
mRootRef.updateChildren(declineMap, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
if (databaseError == null){
mCurrentFriendState = WorkitContract.FRIENDS_STATE_NOT_FRIENDS;
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mSendReqBtn.setText(R.string.profile_send_friend_request);
}
else {
mDeclineReqBtn.setEnabled(true);
}
mSendReqBtn.setEnabled(true);
mProgress.dismiss();
}
});
}
});
mSendReqBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSendReqBtn.setEnabled(false);
setProgressBar("Sending", "Please wait a moment");
mProgress.show();
// friends state - functionality of the mSendRequestBtn:
// 1. Non friends - send request
// 2. request sent (from current user) - cancel request
// 3. request received - accept friendship
// 4. friends - unfriend
switch (mCurrentFriendState){
// -------- NON-FRIENDS STATE --------
case WorkitContract.FRIENDS_STATE_NOT_FRIENDS:
DatabaseReference notificationRef = mRootRef.child(WorkitContract.NOTIFICATIONS_SCHEMA).push();
String newNotificationId = notificationRef.getKey();
HashMap<String, String> notifications = new HashMap<>();
notifications.put(WorkitContract.NOTIFICATIONS_COLUMN_FROM, mCurUser.getUid());
notifications.put(WorkitContract.NOTIFICATIONS_COLUMN_TYPE, String.valueOf(WorkitContract.NOTIFICATIONS_REQ_TYPE));
Map requestMap = new HashMap();
requestMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + mCurUser.getUid() + "/" + profileUserId + "/" + WorkitContract.FRIENDS_REQ_TYPE, WorkitContract.FRIENDS_STATE_SENT);
requestMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + profileUserId + "/" + mCurUser.getUid() + "/" + WorkitContract.FRIENDS_REQ_TYPE, WorkitContract.FRIENDS_STATE_RECEIVED);
requestMap.put(WorkitContract.NOTIFICATIONS_SCHEMA + "/" + profileUserId + "/" + newNotificationId + "/" + WorkitContract.NOTIFICATIONS_COLUMN_FROM, mCurUser.getUid());
requestMap.put(WorkitContract.NOTIFICATIONS_SCHEMA + "/" + profileUserId + "/" + newNotificationId + "/" + WorkitContract.NOTIFICATIONS_COLUMN_TYPE,String.valueOf(WorkitContract.NOTIFICATIONS_REQ_TYPE));
mRootRef.updateChildren(requestMap, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
if (databaseError != null){
Toast.makeText(ProfileActivity.this, databaseError.getMessage(), Toast.LENGTH_LONG).show();
}
else {
mCurrentFriendState = WorkitContract.FRIENDS_STATE_SENT;
mSendReqBtn.setText(R.string.profile_cancel_friend_request);
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mDeclineReqBtn.setEnabled(false);
}
mSendReqBtn.setEnabled(true);
}
});
mProgress.dismiss();
break;
//-------- REQUEST SENT STATE - Cancel Friend request -------------
case WorkitContract.FRIENDS_STATE_SENT:
Map deleteReqMap = new HashMap();
deleteReqMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + mCurUser.getUid() + "/" + profileUserId, null);
deleteReqMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + profileUserId + "/" + mCurUser.getUid(), null);
mRootRef.updateChildren(deleteReqMap, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
if (databaseError != null){
Toast.makeText(ProfileActivity.this, databaseError.getMessage(), Toast.LENGTH_LONG).show();
}
else {
mCurrentFriendState = WorkitContract.FRIENDS_STATE_NOT_FRIENDS;
mSendReqBtn.setText(R.string.profile_send_friend_request);
}
mSendReqBtn.setEnabled(true);
}
});
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mDeclineReqBtn.setEnabled(false);
mProgress.dismiss();
break;
//-------------- Request received -------------
case WorkitContract.FRIENDS_STATE_RECEIVED:
final String currDate = DateFormat.getDateTimeInstance().format(new Date());
Map friendsMap = new HashMap();
friendsMap.put(WorkitContract.FRIENDS_SCHEMA + "/" + mCurUser.getUid() + "/" + profileUserId + "/" + WorkitContract.FRIEND_FRIENDSHIP_DATE, currDate);
friendsMap.put(WorkitContract.FRIENDS_SCHEMA + "/" + profileUserId + "/" + mCurUser.getUid() + "/" + WorkitContract.FRIEND_FRIENDSHIP_DATE, currDate);
friendsMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + mCurUser.getUid() + "/" + profileUserId, null);
friendsMap.put(WorkitContract.FRIEND_REQUEST_SCHEMA + "/" + profileUserId + "/" + mCurUser.getUid(), null);
mRootRef.updateChildren(friendsMap, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
if(databaseError != null) {
Toast.makeText(ProfileActivity.this, databaseError.getMessage(), Toast.LENGTH_LONG).show();
}
else {
mCurrentFriendState = WorkitContract.FRIENDS_STATE_FRIENDS;
mSendReqBtn.setText(R.string.profile_unfriend);
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mDeclineReqBtn.setEnabled(false);
}
mSendReqBtn.setEnabled(true);
mProgress.dismiss();
}
});
break;
//----- FRIENDS STATE - unfriend ------
case WorkitContract.FRIENDS_STATE_FRIENDS:
mSendReqBtn.setEnabled(false);
Map unfriend = new HashMap();
unfriend.put(WorkitContract.FRIENDS_SCHEMA + "/" + profileUserId + "/" + mCurUser.getUid(), null);
unfriend.put(WorkitContract.FRIENDS_SCHEMA + "/" + mCurUser.getUid() + "/" + profileUserId, null);
mRootRef.updateChildren(unfriend, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
if (databaseError == null){
mCurrentFriendState = WorkitContract.FRIENDS_STATE_NOT_FRIENDS;
mSendReqBtn.setText(R.string.profile_send_friend_request);
mSendReqBtn.setEnabled(true);
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mDeclineReqBtn.setEnabled(false);
}
else {
Toast.makeText(ProfileActivity.this, databaseError.getMessage(), Toast.LENGTH_LONG).show();
}
mProgress.dismiss();
}
});
}
}
});
}
@Override
protected void onStart() {
super.onStart();
//change online field in users database to true.
mRootRef.child(WorkitContract.USERS_SCHEMA).child(mCurUser.getUid()).child(WorkitContract.USERS_COLUMN_ONLINE).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
boolean online = (boolean) dataSnapshot.getValue();
if (!online){
mRootRef.child(WorkitContract.USERS_SCHEMA).child(mCurUser.getUid()).child(WorkitContract.USERS_COLUMN_ONLINE).setValue(true);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
protected void onPause() {
super.onPause();
//update online field in users -> user, also update last seen field.
mRootRef.child(WorkitContract.USERS_SCHEMA).child(mCurUser.getUid()).child(WorkitContract.USERS_COLUMN_ONLINE).setValue(false);
mRootRef.child(WorkitContract.USERS_SCHEMA).child(mCurUser.getUid()).child(WorkitContract.USERS_COLUMN_LAST_SEEN).setValue(ServerValue.TIMESTAMP);
}
/**
* set profile button text according to friends state.
*
*/
private void setBtnText() {
if (mCurUser.getUid().equals(profileUserId)){
mSendReqBtn.setVisibility(View.GONE);
}
mFriendRequestDatabase.child(mCurUser.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.hasChild(profileUserId)){
int reqType = Integer.parseInt(dataSnapshot.child(profileUserId).child(WorkitContract.FRIENDS_REQ_TYPE).getValue().toString());
switch (reqType){
case WorkitContract.FRIENDS_STATE_RECEIVED:
mCurrentFriendState = WorkitContract.FRIENDS_STATE_RECEIVED;
mSendReqBtn.setText(R.string.profile_accept_req);
mDeclineReqBtn.setVisibility(View.VISIBLE);
mDeclineReqBtn.setEnabled(true);
break;
case WorkitContract.FRIENDS_STATE_SENT:
mCurrentFriendState = WorkitContract.FRIENDS_STATE_SENT;
mSendReqBtn.setText(R.string.profile_cancel_friend_request);
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mDeclineReqBtn.setEnabled(false);
break;
}
mProgress.dismiss();
}
else {
mFriendsDatabase.child(mCurUser.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.hasChild(profileUserId)){
mCurrentFriendState = WorkitContract.FRIENDS_STATE_FRIENDS;
mSendReqBtn.setText(R.string.profile_unfriend);
mDeclineReqBtn.setVisibility(View.INVISIBLE);
mDeclineReqBtn.setEnabled(false);
}
mProgress.dismiss();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
mProgress.dismiss();
}
});
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
mProgress.dismiss();
}
});
}
/**
*
* @param title
* @param message
* set progress dialog
*/
private void setProgressBar(String title, String message) {
mProgress = new ProgressDialog(this);
mProgress.setTitle(title);
mProgress.setMessage(message);
mProgress.setCanceledOnTouchOutside(false);
}
}
| [
"shuvim95@gmail.com"
] | shuvim95@gmail.com |
5d72697b02fcfbea733d4ac21f7289933b4b6995 | c2eb17133d3c657d779e655565c0e69537075190 | /src/main/java/com/example/backend/controller/UserController.java | 55f533e4d16e643c6e1536298d02a6f4bc49b516 | [] | no_license | ahmetbibi/spring-api | 821df3b2e7dcb90fce184fa19574cb562d19afd1 | 7b30329ae13df5f984d6fd5cff59cd13919fe261 | refs/heads/master | 2020-11-27T22:33:19.069221 | 2019-12-22T23:26:18 | 2019-12-22T23:26:18 | 229,629,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,928 | java | package com.example.backend.controller;
import com.example.backend.model.User;
import com.example.backend.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/v1")
public class UserController {
@Autowired
private UserRepository userRepository;
@GetMapping("/users")
public List<User> getAllUsers() {
return userRepository.findAll();
}
@GetMapping("/users/{id}")
public ResponseEntity<User> getUsersById(@PathVariable(value = "id") Long userId) {
User user = userRepository.findById(userId).orElse(null);
return ResponseEntity.ok().body(user);
}
@PostMapping("/users")
public User createUser(@Valid @RequestBody User user) {
return userRepository.save(user);
}
@PutMapping("/users/{id}")
public ResponseEntity<User> updateUser(@PathVariable(value = "id") Long userId, @Valid @RequestBody User userDetails ) {
User user = userRepository.findById(userId).orElse(null);
user.setEmail(userDetails.getEmail());
user.setFirstName(userDetails.getFirstName());
user.setLastName(userDetails.getLastName());
user.setPassword(userDetails.getPassword());
final User updateUser = userRepository.save(user);
return ResponseEntity.ok(updateUser);
}
@DeleteMapping("/users/{id}")
public Map<String, Boolean> deleteUser(@PathVariable(value = "id") Long userId) {
User user = userRepository.findById(userId).orElse(null);
userRepository.delete(user);
Map<String, Boolean> response = new HashMap<>();
response.put("deleted", Boolean.TRUE);
return response;
}
}
| [
"ahmetbibi@gmail.com"
] | ahmetbibi@gmail.com |
be9e8a7df6e70ed44aeeda8e58b6c23b5a512d24 | ed564f037941556ada495478b394dc002341ebbe | /RepastProject/EDProject/src/simcore/utilities/aStarPathFinder.java | 4fc8eca0e995679db1c189c2335b6782f14cfa57 | [] | no_license | thomasGodfrey/StaffRapidTesting | 3031ab639449d183c6c95feeb5f46648a8c2990d | 91541adc92597d6cff860ae9283913c031e620f3 | refs/heads/master | 2023-01-13T06:01:27.765859 | 2020-11-18T17:57:08 | 2020-11-18T17:57:08 | 312,330,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,520 | java | package simcore.utilities;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import simcore.basicStructures.ToolBox;
import simcore.utilities.*;
import repast.simphony.space.grid.GridPoint;
import repast.simphony.util.collections.Pair;
import repast.simphony.valueLayer.GridValueLayer;
public class aStarPathFinder {
private Queue<GridPoint> actionList;
private PriorityQueue<PathNode> openList;
private PathNode startPos;
private PathNode destPos;
private HashMap<GridPoint, PathNode> closeList;
private GridValueLayer vl;
public aStarPathFinder(GridPoint startPos, GridPoint destPos, GridValueLayer vl){
this.startPos = new PathNode (0, 0, 0, startPos, null);
this.destPos = new PathNode (0, 0, 0, destPos, null);
this.vl = vl;
this.closeList = new HashMap<GridPoint, PathNode>();
this.openList = new PriorityQueue<PathNode>(new myComparator());
}
public Stack<GridPoint> getPath() {
// Add the start node
openList.add(this.startPos);
Stack<GridPoint> path = new Stack<GridPoint>();
// grid w x h
int loopStop = 50*50;
int counter = 0;
int prevMax = 0;
while (!openList.isEmpty()) {
//System.out.println(openList.size());
// Get the current node, lowest f value
PathNode currentNode = openList.poll();
//System.out.println(currentNode.getF() + " prev: " + prevMax +" cou: " + counter);
if(prevMax == currentNode.getF()) {
counter++;
}else {
counter = 0;
}
if(counter == loopStop) {
// unreachable within loopStop
break;
}
prevMax = currentNode.getF();
openList.remove(currentNode);
closeList.put(currentNode.getPos(), currentNode);
// If we have reached the final destination, then return the full gridpoint path reversed
if(currentNode.getPos().getX() == destPos.getPos().getX() && currentNode.getPos().getY() ==destPos.getPos().getY()) {
PathNode current = currentNode;
while(current != null) {
path.add(current.getPos());
current = current.getParent();
}
// remove current pos
path.pop();
return path;
}
for(GridPoint neig: getNeighbours(currentNode.getPos())) {
if(closeList.containsKey(neig)) {
continue;
}
int g = currentNode.getG() + 1;
int h = tester(neig, this.destPos.getPos());
int f = g + h;
for( PathNode node : openList) {
if (node.getPos() == neig && g > node.getG()) {}
continue;
}
openList.add(new PathNode(f, g, h, neig, currentNode));
}
}
return path;
}
private int tester(GridPoint currentPos, GridPoint pt) {
int xDiff = currentPos.getX() - pt.getX();
int yDiff = currentPos.getY() - pt.getY();
int h = Math.abs(xDiff) + Math.abs(yDiff) ;
return h;
}
public ArrayList<GridPoint> getNeighbours(GridPoint currentPos){
//a list stores the neighbours (legal) of currentPoint passed into this function
ArrayList<GridPoint> result = new ArrayList<GridPoint>();
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("Sanity Test");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
// first, use currentPoint to create neighbours positions at all directions
int x = currentPos.getX();
int y = currentPos.getY();
if(vl.get(25,10) == 10) {
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("Wall Found");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
System.out.println("()()()()()()()(()()(()()()()()()())()()()()()()()()())()()()()()()()()()()()()()()()()()");
}
if( vl.get(x, y + 1) == 0 || vl.get(x, y + 1) == 4) {
// north
result.add(new GridPoint(x, y + 1));
}
if( vl.get(x, y - 1) == 0 || vl.get(x, y - 1) == 4 ) {
// south
result.add(new GridPoint(x, y - 1));
}
if( vl.get(x + 1, y) == 0 || vl.get(x + 1, y) == 4) {
// east
result.add(new GridPoint(x + 1, y));
}
if( vl.get(x - 1, y) == 0 || vl.get(x - 1, y) == 4 ) {
// west
result.add(new GridPoint(x - 1, y));
}
// return result list with all legal neighbours positions
return result;
}
public class PathNode{
private int f;
private int g;
private int h;
private GridPoint pos;
private PathNode parent;
public PathNode(int f, int g, int h, GridPoint pos, PathNode parent) {
this.f = f;
this.g = g;
this.h = h;
this.pos = pos;
this.parent = parent;
}
public int getF() {
return f;
}
public void setF(int gotNew) {
this.f = gotNew;
}
public int getG() {
return g;
}
public void setG(int gotNew) {
this.g = gotNew;
}
public int getH() {
return h;
}
public void setH(int gotNew) {
this.h = gotNew;
}
public GridPoint getPos() {
return pos;
}
public PathNode getParent() {
return parent;
}
public void setParent(PathNode gotParent) {
this.parent = gotParent;
}
}
public class myComparator implements Comparator<PathNode>{
// Overriding compare()method of Comparator
// for descending order of cgpa
public int compare(PathNode s1, PathNode s2) {
if (s1.getF() < s2.getF())
return -1;
else if (s1.getF() > s2.getF())
return 1;
return 0;
}
}
}
| [
"thomas.godfrey97@yahoo.com"
] | thomas.godfrey97@yahoo.com |
e9d51d67fb63a41f73e85dfc079730980906b03b | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/transform/CampaignEventFilterMarshaller.java | 7eab2f95b968055eda14d1892a57a50a77a12bb3 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,326 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.pinpoint.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.pinpoint.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* CampaignEventFilterMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class CampaignEventFilterMarshaller {
private static final MarshallingInfo<StructuredPojo> DIMENSIONS_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("Dimensions").build();
private static final MarshallingInfo<String> FILTERTYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("FilterType").build();
private static final CampaignEventFilterMarshaller instance = new CampaignEventFilterMarshaller();
public static CampaignEventFilterMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(CampaignEventFilter campaignEventFilter, ProtocolMarshaller protocolMarshaller) {
if (campaignEventFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(campaignEventFilter.getDimensions(), DIMENSIONS_BINDING);
protocolMarshaller.marshall(campaignEventFilter.getFilterType(), FILTERTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
95e63f29bdd37fe310f908b1f2f3c7857c22149b | 2d1c79143199f49381d16180a2a3dd1bf03f9b19 | /app/src/test/java/com/texpediscia/myrupeazedelivery/ExampleUnitTest.java | 8150d5a4e76fc31abcff0a0a6d4d8eab8a40287d | [] | no_license | manoj1985del/MyRupeaze_Delivery | 895c35063ef466df61ec8a7d7c07cbca8cc89dfc | bd898acbe7c745f6dff46311eacc16bbeb8eba83 | refs/heads/master | 2023-06-21T23:33:52.869165 | 2021-07-27T10:04:57 | 2021-07-27T10:04:57 | 389,090,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.texpediscia.myrupeazedelivery;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"manoj1985del"
] | manoj1985del |
f511f80538fa4c8720903476a945ca807db26588 | ba5857f30dbf9408794079cdd52b9e4a051ea358 | /src/main/java/pl/coderslab/tennisApi/service/PlayerService.java | c8c1100e092ae9f3390effbd1f857340349612fc | [] | no_license | ZiebaWojciech/tennis-api | 065e81724481071ebb2f02f5b8ae08ea9174638d | a658e4be1aecf73b3662355cff21d6e9d62d7de6 | refs/heads/master | 2020-03-28T18:52:36.392131 | 2018-09-25T12:35:19 | 2018-09-25T12:35:19 | 148,921,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package pl.coderslab.tennisApi.service;
import pl.coderslab.tennisApi.entity.AtpRankingPosition;
import pl.coderslab.tennisApi.entity.Player;
import java.util.List;
public interface PlayerService {
Player getOne(int id);
List<Player> getAll();
Player save(Player player);
}
| [
"34630361+ZiebaWojciech@users.noreply.github.com"
] | 34630361+ZiebaWojciech@users.noreply.github.com |
406b21b8eb8df580dd9c18480a28b790f4f65817 | 9ceacddb244af781a8cf6746eca6cc85689a8330 | /src/main/java/javaBean/House.java | 3b4fe079b8ece577638bb31923769f06dfd4fd02 | [] | no_license | zhouliangzl/lab2 | d77c8291af50c7802120d0965753a636355aee74 | 85c2bbe500ddd44b9a807908399e08b65c56f966 | refs/heads/master | 2020-05-24T01:26:33.342646 | 2019-05-18T03:24:23 | 2019-05-18T03:24:23 | 187,034,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,707 | java | package javaBean;
public class House
{
int hid;
String uid;
int status;
String address;
int area;
int floor;
int rent;
String region;
String type;
String orient;
String environ;
String decoration;
String connect;
String phone;
String title;
String description;
String photo;
public int getHid() {
return hid;
}
public void setHid(int hid) {
this.hid = hid;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public int getFloor() {
return floor;
}
public void setFloor(int floor) {
this.floor = floor;
}
public int getRent() {
return rent;
}
public void setRent(int rent) {
this.rent = rent;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getOrient() {
return orient;
}
public void setOrient(String orient) {
this.orient = orient;
}
public String getEnviron() {
return environ;
}
public void setEnviron(String environ) {
this.environ = environ;
}
public String getDecoration() {
return decoration;
}
public void setDecoration(String decoration) {
this.decoration = decoration;
}
public String getConnect() {
return connect;
}
public void setConnect(String connect) {
this.connect = connect;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
}
| [
"867679310@qq.com"
] | 867679310@qq.com |
60f5d0adfaf00b3a00bb2c41e08420207f08c87e | fca385cf292e1ba10c699626c857787f41f9da05 | /xianzhiSYLJdynamiclcz/src/com/xianzhisylj/dynamiclcz/SecuityInfoActivity.java | fc5ac5af5eeeddbe54b3f3b9cf2de5ffd284f07c | [] | no_license | cuiyaoDroid/xianzhiSYLJdynamic | 7537851132ef483d82a34541e8ecd4040850e588 | 0b379a41577e7e203ad4ad5a207f010a2041ad00 | refs/heads/master | 2021-01-22T09:55:57.860061 | 2015-01-06T01:56:52 | 2015-01-06T01:56:52 | 23,815,625 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,409 | java | package com.xianzhisylj.dynamiclcz;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import com.xianzhi.tool.db.MapHolder;
import com.xianzhialarm.listener.OnTabActivityResultListener;
import com.xianzhisecuritycheck.main.AddnotifiUserListActivity;
import com.xianzhisecuritycheck.main.SecurityDetailActivity;
import com.xianzhisecuritycheck.main.SecurityMainActivity;
import com.xianzhisecuritycheck.main.addNewInforActivity;
import com.xianzhisylj.dynamiclcz.R;
public class SecuityInfoActivity extends TabActivity {
private static TabHost m_tabHost;
public static int id=-1;
public static MapHolder holder;
private static Animation slide_left_out;
private static Animation slide_right_in;
private static Animation slide_right_out;
private static Animation slide_left_in;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_secuity_info);
slide_left_out=AnimationUtils.loadAnimation(this, R.anim.slide_left_out);
slide_right_in=AnimationUtils.loadAnimation(this, R.anim.slide_right_in);
slide_right_out=AnimationUtils.loadAnimation(this, R.anim.slide_right_out);
slide_left_in=AnimationUtils.loadAnimation(this, R.anim.slide_left_in);
init();
Log.i("SecuityInfoActivity","onCreate");
}
public static String mTextviewArray[] = { "车次信息", "编组情况", "重点工作", "乘务记录" };
@SuppressWarnings("rawtypes")
public static Class mTabClassArray[] = { SecurityMainActivity.class,
SecurityDetailActivity.class, addNewInforActivity.class,
AddnotifiUserListActivity.class };
public static int currentTab=-1;
private void init() {
m_tabHost = getTabHost();
int count = mTabClassArray.length;
for (int i = 0; i < count; i++) {
TabSpec tabSpec = m_tabHost.newTabSpec(mTextviewArray[i])
.setIndicator(mTextviewArray[i])
.setContent(getTabItemIntent(i));
m_tabHost.addTab(tabSpec);
}
m_tabHost.setCurrentTabByTag(mTextviewArray[0]);
}
public static void setCurrentTabWithAnim(int now, int next, String tag) {
// 这个方法是关键,用来判断动画滑动的方向
if (now < next) {
m_tabHost.getCurrentView().startAnimation(slide_left_out);
m_tabHost.setCurrentTabByTag(tag);
m_tabHost.getCurrentView().startAnimation(slide_right_in);
} else {
m_tabHost.getCurrentView().startAnimation(slide_right_out);
m_tabHost.setCurrentTabByTag(tag);
m_tabHost.getCurrentView().startAnimation(slide_left_in);
}
currentTab=m_tabHost.getCurrentTab();
}
private Intent getTabItemIntent(int index) {
Intent intent = new Intent(this, mTabClassArray[index]);
return intent;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Activity subActivity = getLocalActivityManager().getCurrentActivity();
if (subActivity instanceof OnTabActivityResultListener) {
OnTabActivityResultListener listener = (OnTabActivityResultListener) subActivity;
listener.onTabActivityResult(requestCode, resultCode, data);
}
super.onActivityResult(requestCode, resultCode, data);
}
} | [
"592425690@qq.com"
] | 592425690@qq.com |
4d2c7d0f0c4376575bcb7155507bd929f4b1f1da | 9b42ea9ad715606e723afb542b2815f1258f7c06 | /src/com/application/Test/daoModelTest/PersonImplDaoTest.java | 19f2e9619a85c15f9314c8ade17e05119d05172a | [] | no_license | houmedhassan/AnProjJEE | 700cea72c7233cf2cf78a541979b0e6d514a5685 | 51352280eaadb15175c22856ae6a69e0469888b3 | refs/heads/master | 2020-06-10T21:12:44.517389 | 2016-12-07T20:25:55 | 2016-12-07T20:25:55 | 75,872,749 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,320 | java | package com.application.Test.daoModelTest;
import static org.junit.Assert.*;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import javax.sql.DataSource;
import org.dbunit.DatabaseUnitException;
import org.dbunit.database.IDatabaseConnection;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;
import com.github.springtestdbunit.DbUnitTestExecutionListener;
import com.github.springtestdbunit.annotation.DatabaseSetup;
import com.github.springtestdbunit.annotation.DatabaseTearDown;
import com.github.springtestdbunit.annotation.ExpectedDatabase;
import com.github.springtestdbunit.assertion.DatabaseAssertionMode;
import com.application.business.DaoException;
import com.application.business.PersonImpDao;
import com.application.beans.Person;
import com.application.beans.Group;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "file:WebContent/WEB-INF/springDataSource_test.xml")
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class,
TransactionalTestExecutionListener.class, DbUnitTestExecutionListener.class })
@ActiveProfiles(profiles="PersonDAO")
@DatabaseSetup(value= {"Groups.xml", "Person.xml"})
@DatabaseTearDown(value = { "cleanGroups.xml", "cleanPerson.xml" })
public class PersonImplDaoTest {
@Autowired
private PersonImpDao persDao;
@Autowired
DataSource dataSource;
@Before
public void setUp() throws SQLException, DatabaseUnitException{
this.persDao.setDataSource(dataSource);
}
@After
public void tearDown() throws Exception {
}
@Test
public void findAllPersonsTest() throws DaoException {
Collection<Person> allPersons = persDao.findAllPersons(1);
assertEquals(3, allPersons.size());
}
@Ignore
public void findAllGroupsTest()throws DaoException{
Collection<Group> allGroups = persDao.findAllGroups();
assertEquals(2, allGroups.size());
}
@Test
public void findPersonTest()throws DaoException{
Person per = persDao.findPerson(2);
assertEquals("Rébecca", per.getLastName());
assertEquals("Armand", per.getFirstName());
assertEquals("Saint-Didier-des-Bois", per.getMail());
assertEquals("ara.com", per.getWebSite());
assertEquals("1929-02-03", per.getBirthDay());
assertEquals("lskss", per.getPassword());
//assertEquals(1L, per.getIdGroup());
}
@Test
public void findGroupTest()throws DaoException{
Group gr = persDao.findGroup(1);
assertEquals("isl", gr.getName());
}
@Test
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value ="personAfterCreation.xml")
public void savePersonTest() throws DaoException{
//creation of person
Person p = new Person();
p.setIdPerson(5L);
p.setLastName("Bob");
p.setFirstName("Alice");
p.setMail("azerty@amu-mrs.fr");
p.setWebSite("AliceBob.com");
p.setBirthDay("2016-12-31");
p.setPassword("Password123");
p.setIdGroup(1L);
persDao.savePerson(p);
}
@Test
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value="groupsAfterCreation.xml")
public void saveGroupTest() throws DaoException{
Group g = new Group();
g.setIdGroup(3);
g.setName("gth");
persDao.saveGroup(g);
}
@Test
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value="personAfterModif.xml")
public void editPersonTest() throws DaoException{
//creation of person
Person p = new Person();
p.setIdPerson(3L);
p.setLastName("Bob");
p.setFirstName("Alice");
p.setMail("azerty@amu-mrs.fr");
p.setWebSite("AliceBob.com");
p.setBirthDay("2016-12-31");
p.setPassword("Password123");
p.setIdGroup(1L);
persDao.editPerson(3, p);
}
}
| [
"houmedhassan20@gmail.com"
] | houmedhassan20@gmail.com |
73546f2beac3672ffe245c46b427a64433a47dea | cb1b8bd7646254bfd139e159d1bf84768a6ca0bb | /backend/src/main/java/com/devjuior/dsdelivery/repositories/OrderRepository.java | f84e9627cf8db9c8573b0ececbc2348031d08681 | [] | no_license | Celinaldo/dsdelivery-sds2 | 11f9d49646b8bb28edb1023883bb58f217beb31b | 2aee9aaf7f4fa7ea564a6244afe73a9a26bd148a | refs/heads/main | 2023-02-21T22:21:29.332618 | 2021-01-11T00:05:10 | 2021-01-11T00:05:10 | 327,454,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package com.devjuior.dsdelivery.repositories;
import com.devjuior.dsdelivery.entities.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface OrderRepository extends JpaRepository<Order, Long> {
@Query("SELECT DISTINCT obj FROM Order obj JOIN FETCH obj.products "
+ " WHERE obj.status = 0 ORDER BY obj.moment ASC")
List<Order> findOrderWithProducts();
}
| [
"celinaldoalvesferre@gmail.com"
] | celinaldoalvesferre@gmail.com |
f870121994883afc8061bb583a70ed5df0409f75 | ecb8bde2ab6cd0064eb835d8e62fa0781782e2f3 | /archivemanagement/src/main/java/com/younes/ArchivemanagementApplication.java | 1d0576535da863827d0c719e868feffde94a8d1a | [] | no_license | younis05/archivespringboot | aaba0ab3b38a0f8dee269d5736605c3439397abb | 2096b3c21c4cb831123a060faa2f13fc7e914677 | refs/heads/master | 2023-08-03T03:52:07.516551 | 2021-09-23T10:33:28 | 2021-09-23T10:33:28 | 405,552,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.younes;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ArchivemanagementApplication {
public static void main(String[] args) {
SpringApplication.run(ArchivemanagementApplication.class, args);
}
}
| [
"younesboukhtache@gmail.com"
] | younesboukhtache@gmail.com |
d966a4247162ad4abca4e6b4f85ffa08a4e6b06b | 544c523ef35f7684f31b92683b845a234f879c6a | /library/src/main/java/com/example/wsq/library/view/loadding/SysLoading.java | 433cb15f7e7a767e40f865c6c29114c88e8e5f3c | [] | no_license | 123wsq/AndroidFrame | bef765790ba0fc49432ca72ffe061925d5168143 | ca86482605c2840beddc210e749a323250f824f0 | refs/heads/master | 2020-03-19T23:36:27.512806 | 2018-06-15T09:21:20 | 2018-06-15T09:21:20 | 137,011,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,081 | java | package com.example.wsq.library.view.loadding;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.example.wsq.library.R;
/**
* Created by wsq on 2017/12/23.
*/
public class SysLoading extends LinearLayout {
private View view;
//自定义动画
private AnimationDrawable mAnimation;
//加载失败视图
private RelativeLayout sys_loading_dialog_fail;
//加载中图片
private ImageView sys_loading_dialog_img;
//加载中文本
private TextView sys_loading_dialog_tv;
//加载失败文本
private TextView sys_loading_dialog_fail_tv;
//加载时文本
private String loadingText;
private int resId = R.drawable.sys_loading;
public SysLoading(Context context) {
super(context);
initView(context);
}
public SysLoading(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
private void initView(Context context){
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.sys_loading_dialog, this);
//加载失败视图
sys_loading_dialog_fail = (RelativeLayout) view.findViewById(R.id.sys_loading_dialog_fail);
//加载时图片
sys_loading_dialog_img = (ImageView) view.findViewById(R.id.sys_loading_dialog_img);
//加载时文本
sys_loading_dialog_tv = (TextView) view.findViewById(R.id.sys_loading_dialog_tv);
sys_loading_dialog_fail_tv = (TextView) view.findViewById(R.id.sys_loading_dialog_fail_tv);
}
public void setText(String loadingText){
this.loadingText = loadingText;
}
public void showAnim(){
//设置动画特效
initData();
}
public void stopAnim(){
mAnimation.stop();
}
public void initData() {
//设置文本
sys_loading_dialog_tv.setText(loadingText);
//设置显示
view.setVisibility(View.VISIBLE);
//设置加载时图片显示
sys_loading_dialog_img.setVisibility(View.VISIBLE);
//设置加载时文本显示
sys_loading_dialog_tv.setVisibility(View.VISIBLE);
//设置失败视图隐藏
sys_loading_dialog_fail.setVisibility(View.GONE);
//获取动画
sys_loading_dialog_img.setBackgroundResource(resId);
//通过ImageView拿到AnimationDrawable
mAnimation = (AnimationDrawable) sys_loading_dialog_img.getBackground();
sys_loading_dialog_img.setBackgroundResource(R.drawable.anim_loading_progress);
//为了防止只显示第一帧
sys_loading_dialog_img.post(new Runnable() {
@Override
public void run() {
mAnimation.start();
}
});
}
//加载失败调用的方法
public void fialLoad(String failStr, OnClickListener listener){
//动画停止
if(null != mAnimation && mAnimation.isRunning()){
mAnimation.stop();
}
//失败视图显示
sys_loading_dialog_fail.setVisibility(View.VISIBLE);
//设置失败事件监听
sys_loading_dialog_fail.setOnClickListener(listener);
//设置失败文本
sys_loading_dialog_fail_tv.setText(failStr);
//设置加载时图片隐藏
sys_loading_dialog_img.setVisibility(View.GONE);
//设置加载时文本隐藏
sys_loading_dialog_tv.setVisibility(View.GONE);
}
public void setAnimationId(int resId){
this.resId = resId;
}
/**
* 设置加载动画
* @param drawableId
*/
public void setAnimLodding(int drawableId){
sys_loading_dialog_img.setBackgroundResource(drawableId);
}
}
| [
"w1037704496@163.com"
] | w1037704496@163.com |
f5d5a872b19a29dac54b4862f99687055fa8cff9 | 96a1a4222ec59ce471be4da3e791b9102d7fd9b5 | /src/jav/fileio/Simple_Wait_Notify.java | 41152ab55f704691eb6217b24a8a6a6d475a605c | [] | no_license | yrosario/JavaIO | fdde6cbf037002ff3fbb5932e42e20c0fdccf063 | 2612f93fe4cc1b2977d9bda3021737ee1a0dff25 | refs/heads/master | 2023-04-07T13:00:22.577789 | 2021-04-11T15:42:38 | 2021-04-11T15:42:38 | 356,907,217 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package jav.fileio;
class Customer{
int amount = 10000;
synchronized void withdraw(int amount) {
System.out.println("going to withdraw");
if(this.amount < amount) {
System.out.println("Insufficent funds");
try {
wait();
}catch(Exception e) {
e.printStackTrace();
}
}
}
synchronized void deposit(int amount) {
System.out.println("going to deposit");
this.amount += amount;
System.out.println("deposit completed..." + this.amount);
notify();
}
}
public class Simple_Wait_Notify {
public static void main(String args[]) {
final Customer c=new Customer();
}
}
| [
"yusselrosario@gmail.com"
] | yusselrosario@gmail.com |
389832b087c78be954c9926abdb8fc86bcb0c04b | 40c71210eee2bd764b16ebd9b6697ec5e20490b2 | /src/test/java/facade/ActionQuitTest.java | 0b0bdcb9c64f0d7580e1c99828e6e07d60980237 | [] | no_license | ZofiaBajerska/java-clean_code | b9b0b59d4a00e5f539f54b031c1150a11c1a2879 | 82c94db3d41a074ae39479844b9217a995199eda | refs/heads/master | 2022-04-19T09:20:21.627453 | 2019-12-10T18:30:40 | 2019-12-10T18:30:40 | 257,087,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package facade;
import org.junit.Test;
import java.util.Scanner;
import static org.assertj.core.api.Assertions.assertThat;
public class ActionQuitTest {
@Test
public void test_Get_Info() {
Scanner scanner = new Scanner(System.in);
ActionQuit aa = new ActionQuit(scanner);
assertThat(aa.getInfo()).isNotEqualTo(null);
}
}
| [
"b.zocha@gmail.com"
] | b.zocha@gmail.com |
156229b7e8b5f5de8e0bcace69b966c00c6d2227 | ba0a6d39c8b33278f3b061837aaf2c4a8113b81b | /proto-google-cloud-dataproc-metastore-v1alpha/src/main/java/com/google/cloud/metastore/v1alpha/DeleteServiceRequest.java | 6e3e7ad0369448595bc7cd08392cf548c78d9f47 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Tryweirder/java-dataproc-metastore | 385c8db6d1d3367e17805613702e029c70ea295c | 39f25ebc4843aac12cfeb6d06ab6bc0802597759 | refs/heads/master | 2023-04-04T10:25:51.613007 | 2021-04-14T00:49:30 | 2021-04-14T00:49:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,646 | java | /*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/metastore/v1alpha/metastore.proto
package com.google.cloud.metastore.v1alpha;
/**
*
*
* <pre>
* Request message for [DataprocMetastore.DeleteService][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService].
* </pre>
*
* Protobuf type {@code google.cloud.metastore.v1alpha.DeleteServiceRequest}
*/
public final class DeleteServiceRequest extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.cloud.metastore.v1alpha.DeleteServiceRequest)
DeleteServiceRequestOrBuilder {
private static final long serialVersionUID = 0L;
// Use DeleteServiceRequest.newBuilder() to construct.
private DeleteServiceRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private DeleteServiceRequest() {
name_ = "";
requestId_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new DeleteServiceRequest();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
}
private DeleteServiceRequest(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
java.lang.String s = input.readStringRequireUtf8();
name_ = s;
break;
}
case 18:
{
java.lang.String s = input.readStringRequireUtf8();
requestId_ = s;
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.metastore.v1alpha.MetastoreProto
.internal_static_google_cloud_metastore_v1alpha_DeleteServiceRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.metastore.v1alpha.MetastoreProto
.internal_static_google_cloud_metastore_v1alpha_DeleteServiceRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.metastore.v1alpha.DeleteServiceRequest.class,
com.google.cloud.metastore.v1alpha.DeleteServiceRequest.Builder.class);
}
public static final int NAME_FIELD_NUMBER = 1;
private volatile java.lang.Object name_;
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int REQUEST_ID_FIELD_NUMBER = 2;
private volatile java.lang.Object requestId_;
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The requestId.
*/
@java.lang.Override
public java.lang.String getRequestId() {
java.lang.Object ref = requestId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
requestId_ = s;
return s;
}
}
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for requestId.
*/
@java.lang.Override
public com.google.protobuf.ByteString getRequestIdBytes() {
java.lang.Object ref = requestId_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
requestId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!getNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (!getRequestIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, requestId_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (!getRequestIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, requestId_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.metastore.v1alpha.DeleteServiceRequest)) {
return super.equals(obj);
}
com.google.cloud.metastore.v1alpha.DeleteServiceRequest other =
(com.google.cloud.metastore.v1alpha.DeleteServiceRequest) obj;
if (!getName().equals(other.getName())) return false;
if (!getRequestId().equals(other.getRequestId())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER;
hash = (53 * hash) + getRequestId().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseDelimitedFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(
com.google.cloud.metastore.v1alpha.DeleteServiceRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
* <pre>
* Request message for [DataprocMetastore.DeleteService][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService].
* </pre>
*
* Protobuf type {@code google.cloud.metastore.v1alpha.DeleteServiceRequest}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
implements
// @@protoc_insertion_point(builder_implements:google.cloud.metastore.v1alpha.DeleteServiceRequest)
com.google.cloud.metastore.v1alpha.DeleteServiceRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.metastore.v1alpha.MetastoreProto
.internal_static_google_cloud_metastore_v1alpha_DeleteServiceRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.metastore.v1alpha.MetastoreProto
.internal_static_google_cloud_metastore_v1alpha_DeleteServiceRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.metastore.v1alpha.DeleteServiceRequest.class,
com.google.cloud.metastore.v1alpha.DeleteServiceRequest.Builder.class);
}
// Construct using com.google.cloud.metastore.v1alpha.DeleteServiceRequest.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
}
@java.lang.Override
public Builder clear() {
super.clear();
name_ = "";
requestId_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.cloud.metastore.v1alpha.MetastoreProto
.internal_static_google_cloud_metastore_v1alpha_DeleteServiceRequest_descriptor;
}
@java.lang.Override
public com.google.cloud.metastore.v1alpha.DeleteServiceRequest getDefaultInstanceForType() {
return com.google.cloud.metastore.v1alpha.DeleteServiceRequest.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.metastore.v1alpha.DeleteServiceRequest build() {
com.google.cloud.metastore.v1alpha.DeleteServiceRequest result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.metastore.v1alpha.DeleteServiceRequest buildPartial() {
com.google.cloud.metastore.v1alpha.DeleteServiceRequest result =
new com.google.cloud.metastore.v1alpha.DeleteServiceRequest(this);
result.name_ = name_;
result.requestId_ = requestId_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.metastore.v1alpha.DeleteServiceRequest) {
return mergeFrom((com.google.cloud.metastore.v1alpha.DeleteServiceRequest) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.metastore.v1alpha.DeleteServiceRequest other) {
if (other == com.google.cloud.metastore.v1alpha.DeleteServiceRequest.getDefaultInstance())
return this;
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
if (!other.getRequestId().isEmpty()) {
requestId_ = other.requestId_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.cloud.metastore.v1alpha.DeleteServiceRequest parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage =
(com.google.cloud.metastore.v1alpha.DeleteServiceRequest) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object name_ = "";
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @return The bytes for name.
*/
public com.google.protobuf.ByteString getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
*
*
* <pre>
* Required. The relative resource name of the metastore service to delete, in the
* following form:
* `projects/{project_number}/locations/{location_id}/services/{service_id}`.
* </pre>
*
* <code>
* string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
* </code>
*
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
private java.lang.Object requestId_ = "";
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The requestId.
*/
public java.lang.String getRequestId() {
java.lang.Object ref = requestId_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
requestId_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for requestId.
*/
public com.google.protobuf.ByteString getRequestIdBytes() {
java.lang.Object ref = requestId_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
requestId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The requestId to set.
* @return This builder for chaining.
*/
public Builder setRequestId(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
requestId_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return This builder for chaining.
*/
public Builder clearRequestId() {
requestId_ = getDefaultInstance().getRequestId();
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. A request ID. Specify a unique request ID to allow the server to ignore the
* request if it has completed. The server will ignore subsequent requests
* that provide a duplicate request ID for at least 60 minutes after the first
* request.
* For example, if an initial request times out, followed by another request
* with the same request ID, the server ignores the second request to prevent
* the creation of duplicate commitments.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
* A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
* </pre>
*
* <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The bytes for requestId to set.
* @return This builder for chaining.
*/
public Builder setRequestIdBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
requestId_ = value;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.metastore.v1alpha.DeleteServiceRequest)
}
// @@protoc_insertion_point(class_scope:google.cloud.metastore.v1alpha.DeleteServiceRequest)
private static final com.google.cloud.metastore.v1alpha.DeleteServiceRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.metastore.v1alpha.DeleteServiceRequest();
}
public static com.google.cloud.metastore.v1alpha.DeleteServiceRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<DeleteServiceRequest> PARSER =
new com.google.protobuf.AbstractParser<DeleteServiceRequest>() {
@java.lang.Override
public DeleteServiceRequest parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new DeleteServiceRequest(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<DeleteServiceRequest> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<DeleteServiceRequest> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.cloud.metastore.v1alpha.DeleteServiceRequest getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
84b35ddf32767aada80208c82a0d9803c7329188 | 4376ac2bf8805d7b0846887155a0aa96440ba21f | /src/org/openbravo/dal/xml/StaxXMLEntityConverter.java | bddee2c00de6a39b97aff34cbf0d55fd97c0b9fb | [] | no_license | rarc88/innovativa | eebb82f4137a70210be5fdd94384c482f3065019 | 77ab7b4ebda8be9bd02066e5c40b34c854cc49c7 | refs/heads/master | 2022-08-22T10:58:22.619152 | 2020-05-22T21:43:22 | 2020-05-22T21:43:22 | 266,206,020 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 16,356 | java | /*
*************************************************************************
* The contents of this file are subject to the Openbravo Public License
* Version 1.1 (the "License"), being the Mozilla Public License
* Version 1.1 with a permitted attribution clause; you may not use this
* file except in compliance with the License. You may obtain a copy of
* the License at http://www.openbravo.com/legal/license.html
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2009-2013 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
*/
package org.openbravo.dal.xml;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.apache.log4j.Logger;
import org.openbravo.base.exception.OBException;
import org.openbravo.base.model.Entity;
import org.openbravo.base.model.ModelProvider;
import org.openbravo.base.model.Property;
import org.openbravo.base.model.domaintype.PrimitiveDomainType;
import org.openbravo.base.provider.OBNotSingleton;
import org.openbravo.base.provider.OBProvider;
import org.openbravo.base.structure.BaseOBObject;
import org.openbravo.base.structure.ClientEnabled;
import org.openbravo.base.structure.OrganizationEnabled;
import org.openbravo.base.util.Check;
import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.security.SecurityChecker;
import org.openbravo.model.ad.system.Client;
import org.openbravo.model.common.enterprise.Organization;
/**
* Converts a XML string to an objectgraph with objects using a Stax approach. It can handle very
* large XML Documents (> 500mb). It can not handle OneToMany properties, for this the
* {@link XMLEntityConverter} should be used. The StaxXMLEntityConverter is mainly used for client
* import and export which has larger datasets. During the XML parse phase this converter will match
* XML tags with new or existing (in the database) business objects. The matching logic is
* implemented in the {@link EntityResolver}.
* <p>
* The XMLEntityConverter keeps track of which objects are new, which exist but do not need to be
* updated or which objects exist but need to be updated.
* <p>
* This converter does not update the database directly. However, it changes the properties of
* existing objects. This means that a commit after calling the process method on the converter can
* result in database updates by Hibernate.
*
* @see Entity
*
* @author mtaal
*/
public class StaxXMLEntityConverter extends BaseXMLEntityConverter implements OBNotSingleton {
// This class should translate the
private static final Logger log = Logger.getLogger(EntityXMLConverter.class);
public static StaxXMLEntityConverter newInstance() {
return OBProvider.getInstance().get(StaxXMLEntityConverter.class);
}
/**
* The main entry point. This method creates a XMLStreamReader and then calls
* process(XMLStreamReader).
*
* @param reader
* the xml
* @return the list of BaseOBObject present in the root of the xml. This list contains the
* to-be-updated, to-be-inserted as well as the unchanged business objects
*/
public List<BaseOBObject> process(Reader reader) {
try {
final XMLInputFactory factory = XMLInputFactory.newInstance();
final XMLStreamReader xmlReader = factory.createXMLStreamReader(reader);
int event = xmlReader.getEventType();
if (event != XMLStreamConstants.START_DOCUMENT) {
error("XML document is invalid, can not be passed");
return new ArrayList<BaseOBObject>();
}
return process(xmlReader);
} catch (final EntityXMLException xe) {
throw xe;
} catch (final Exception e) {
throw new EntityXMLException(e);
}
}
/**
* The main entry point. This method walks through the elements in the root and parses them. The
* children of a business object (in the xml) are also parsed. Referenced objects are resolved
* through the {@link EntityResolver}.
* <p>
* After a call to this method the to-be-inserted objects can be retrieved through the
* {@link #getToInsert()} method and the to-be-updated objects through the {@link #getToUpdate()}
* method.
*
* @param xmlReader
* the xml to parse
* @return the list of BaseOBObject present in the root of the xml. This list contains the
* to-be-updated, to-be-inserted as well as the unchanged business objects
*/
public List<BaseOBObject> process(XMLStreamReader xmlReader) {
clear();
getEntityResolver().setClient(getClient());
getEntityResolver().setOrganization(getOrganization());
try {
// check that the rootelement is the openbravo one
xmlReader.nextTag();
final LocalElement rootElement = getElement(xmlReader);
if (!rootElement.getName().equals(XMLConstants.OB_ROOT_ELEMENT)) {
throw new OBException("Root tag of the xml document should be: "
+ XMLConstants.OB_ROOT_ELEMENT + ", but it is " + rootElement.getName());
}
// walk through the elements
final Set<BaseOBObject> checkDuplicates = new HashSet<BaseOBObject>();
final List<BaseOBObject> result = new ArrayList<BaseOBObject>();
while (true) {
xmlReader.nextTag();
// we are the end
if (isAtEndElement(xmlReader, XMLConstants.OB_ROOT_ELEMENT)) {
break;
}
final LocalElement element = getElement(xmlReader);
final BaseOBObject bob = processEntityElement(element, xmlReader, false);
if (hasErrorOccured()) {
return result;
}
// only add it if okay
if (bob != null && !checkDuplicates.contains(bob)) {
result.add(bob);
checkDuplicates.add(bob);
}
}
repairReferences();
checkDanglingObjects();
return result;
} catch (XMLStreamException e) {
log.error("Error parsing", e);
throw new EntityXMLException(e);
}
}
// processes a xml tag which denotes an instance of a business object
private BaseOBObject processEntityElement(LocalElement obElement, XMLStreamReader xmlReader,
boolean theReferenced) {
// note: referenced is true for both childs and many-to-one references
// it is passed to the entityresolver to allow searches in other
// organization
final String entityName = obElement.getName();
// note id maybe null for new objects
final String id = obElement.getAttributes().get(XMLConstants.ID_ATTRIBUTE);
if (entityName == null) {
error("Element " + obElement.getName() + " has no entityname attribute, not processing it");
return null;
}
try {
log.debug("Converting entity " + entityName);
final boolean hasReferenceAttribute = obElement.getAttributes().get(
XMLConstants.REFERENCE_ATTRIBUTE) != null;
// resolve the entity, using the id, note that
// resolve will create a new object if none is found
BaseOBObject bob = resolve(entityName, id, false);
// should never be null at this point
Check.isNotNull(bob, "The business object " + entityName + " (" + id
+ ") can not be resolved");
// warn/error is logged below if the entity is updated
// update is prevented below
final boolean writable = OBContext.getOBContext().isInAdministratorMode()
|| SecurityChecker.getInstance().isWritable(bob);
// do some checks to determine if this one should be updated
// a referenced instance should not be updated if it is not new
// note that embedded children are updated but non-embedded children
// are not updated!
final boolean preventRealUpdate = !writable
|| (hasReferenceAttribute && !bob.isNewOBObject());
final Entity entity = ModelProvider.getInstance().getEntity(obElement.getName());
boolean updated = false;
// now parse the property elements
while (true) {
xmlReader.nextTag();
if (isAtEndElement(xmlReader, entityName)) {
break;
}
final LocalElement childElement = getElement(xmlReader);
final Property p = entity.getProperty(childElement.getName());
log.debug(">>> Importing property " + p.getName());
// TODO: make this option controlled
final boolean isNotImportableProperty = p.isTransient(bob)
|| (p.isAuditInfo() && !isOptionImportAuditInfo()) || p.isInactive()
|| p.isComputedColumn();
if (isNotImportableProperty) {
log.debug("Property " + p + " is inactive, transient, computed or auditinfo, ignoring it");
skipElement(xmlReader);
continue;
}
// ignore the id properties as they are already set, or should
// not be set
if (p.isId()) {
skipElement(xmlReader);
continue;
}
if (p.isOneToMany()) {
throw new EntityXMLException("This XML converter can not handle one-to-many properties");
}
final Object currentValue = bob.get(p.getName());
// do the primitive values
if (p.isPrimitive()) {
// NOTE: I noticed a difference between running from Eclipse and from the commandline
// after some searching, there is a jar file wstx-asl-3.0.2.jar used in
// src-db/database/lib
// which provides the woodstox XMLStreamReader. From the commandline the xerces
// XMLStreamReader
// is used. They differ in the handling of the getText method in handling entities. For
// example the following text: <text>Tom&Jerry</text> now assume that the pointer is
// at the content of the text tag, and you do getText, then woodstox will return Tom&Jerry
// while xerces will return Tom, this because the & is an entity which is a separate
// event.
// below we use the getElementText which works correctly in both cases apparently
// element value, note that getElementText means that it is not required anymore
// to go to element end, that is done by the xmlReader
final String elementText = xmlReader.getElementText();
Object newValue = ((PrimitiveDomainType) p.getDomainType()).createFromString(elementText);
// correct the value
newValue = replaceValue(bob, p, newValue);
log.debug("Primitive property with value " + newValue);
// only update if changed
if ((currentValue != null && newValue == null)
|| (currentValue == null && newValue != null)
|| (currentValue != null && newValue != null && !currentValue.equals(newValue))) {
log.debug("Value changed setting it");
if (!preventRealUpdate) {
bob.set(p.getName(), newValue);
updated = true;
}
}
} else {
Check.isTrue(!p.isOneToMany(), "One to many property not allowed here");
// never update the org or client through xml!
final boolean clientUpdate = bob instanceof ClientEnabled
&& p.getName().equals(Organization.PROPERTY_CLIENT);
final boolean orgUpdate = bob instanceof OrganizationEnabled
&& p.getName().equals(Client.PROPERTY_ORGANIZATION);
if (!isOptionClientImport() && currentValue != null && (clientUpdate || orgUpdate)) {
skipElement(xmlReader);
continue;
}
// determine the referenced entity
Object newValue;
// handle null value
if (childElement.getAttributes().get(XMLConstants.ID_ATTRIBUTE) == null) {
newValue = null;
} else {
// get the info and resolve the reference
final String refId = childElement.getAttributes().get(XMLConstants.ID_ATTRIBUTE);
final String refEntityName = p.getTargetEntity().getName();
newValue = resolve(refEntityName, refId, true);
}
newValue = replaceValue(bob, p, newValue);
final boolean hasChanged = (currentValue == null && newValue != null)
|| (currentValue != null && newValue != null && !currentValue.equals(newValue));
if (hasChanged) {
log.debug("Setting value " + newValue);
if (!preventRealUpdate) {
bob.set(p.getName(), newValue);
updated = true;
}
}
checkEndElement(xmlReader, childElement.getName());
}
}
// do the unique constraint matching here
// this check can not be done earlier because
// earlier no properties are set for a new object
bob = replaceByUniqueObject(bob);
// add to the correct list on the basis of different characteristics
addToInsertOrUpdateLists(id, bob, writable, updated, hasReferenceAttribute, preventRealUpdate);
// do a check that in case of a client/organization import that the
// client and organization are indeed set
if (isOptionClientImport()) {
checkClientOrganizationSet(bob);
}
return bob;
} catch (final Exception e) {
error("Exception when parsing entity " + entityName + " (" + id + "):" + e.getMessage());
log.error("Error processing entity " + entityName, e);
return null;
}
}
private void skipElement(XMLStreamReader xmlReader) throws XMLStreamException {
int skipEndElements = 1;
while (skipEndElements > 0) {
xmlReader.next();
if (xmlReader.getEventType() == XMLStreamConstants.END_ELEMENT) {
skipEndElements--;
}
if (xmlReader.getEventType() == XMLStreamConstants.START_ELEMENT) {
skipEndElements++;
}
}
}
private LocalElement getElement(XMLStreamReader xmlReader) throws XMLStreamException {
if (xmlReader.getEventType() != XMLStreamConstants.START_ELEMENT) {
throw new EntityXMLException("Not a START_ELEMENT event but a " + xmlReader.getEventType()
+ " with name " + xmlReader.getLocalName());
}
final LocalElement element = new LocalElement();
element.setName(xmlReader.getLocalName());
final Map<String, String> attrs = new HashMap<String, String>();
for (int i = 0, n = xmlReader.getAttributeCount(); i < n; ++i) {
attrs.put(xmlReader.getAttributeLocalName(i), xmlReader.getAttributeValue(i));
}
element.setAttributes(attrs);
return element;
}
private void checkEndElement(XMLStreamReader xmlReader, String name) throws XMLStreamException {
xmlReader.nextTag();
if (xmlReader.getEventType() != XMLStreamConstants.END_ELEMENT) {
throw new EntityXMLException("Expected an END_ELEMENT event but it was a "
+ xmlReader.getEventType() + " " + xmlReader.getName());
}
if (!xmlReader.getLocalName().equalsIgnoreCase(name)) {
throw new EntityXMLException("Expected an END_ELEMENT for tag: " + name
+ " but it was an END_ELEMENT for tag: " + xmlReader.getLocalName());
}
}
private boolean isAtEndElement(XMLStreamReader xmlReader, String name) {
return xmlReader.isEndElement() && xmlReader.getLocalName().compareTo(name) == 0;
}
// convenience class
private class LocalElement {
private String name;
private Map<String, String> attributes;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;
}
}
} | [
"rarc88@gmail.com"
] | rarc88@gmail.com |
cc005b98fb5ef66fd4028105221ddfa94e52b98a | 7f467488ffbf68a31554df7690aa385699ebac86 | /app/src/main/java/com/technorizen/doctor/fragments/NewAppointmentFragment.java | 5ccaf75be6292c11b8f22084a25f3b536c655ace | [] | no_license | technorizenshesh/Doctor | 6b3b73fdf330f1726c837e55c3770f0016407050 | 2446bbe981978e685fd65b4a3c486d616b7366f7 | refs/heads/master | 2022-12-29T05:01:45.974511 | 2020-10-17T13:33:22 | 2020-10-17T13:33:22 | 304,884,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package com.technorizen.doctor.fragments;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.technorizen.doctor.R;
import com.technorizen.doctor.databinding.FragmentNewAppointmentBinding;
/**
* A simple {@link Fragment} subclass.
*/
public class NewAppointmentFragment extends Fragment {
Context mContext;
FragmentNewAppointmentBinding binding;
public NewAppointmentFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mContext = getActivity();
binding = DataBindingUtil.inflate(inflater,R.layout.fragment_new_appointment, container, false);
init();
return binding.getRoot();
}
private void init() {
}
}
| [
"devveloperamit3@gmail.com"
] | devveloperamit3@gmail.com |
fc5cba6d7f3b4d3e048f763d212d8c2c3ce9cda6 | dc386da1ba1b75a3b391b47f4241615e73beb7e2 | /src/entities/zombiesEntities/roof/LadderZombie.java | 1a163f81b546aabcee01061e19cb3468a8172c44 | [] | no_license | iFairPlay22/PlantsVsZombies | dfa1abd399624305830dd7fde0539f30ff8fcaf8 | 7c9db7b178540e166ccea41d9601bdfcec897166 | refs/heads/master | 2022-07-23T17:01:05.159906 | 2022-07-05T16:02:16 | 2022-07-05T16:02:16 | 192,293,751 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package entities.zombiesEntities.roof;
import java.util.ArrayList;
import control.BoardGame;
import control.Cell;
import control.Coordinates;
import display.PVZView;
import entities.Zombie;
public class LadderZombie extends Zombie {
private static final long serialVersionUID = 1L;
private boolean hasLadder = true;
public LadderZombie(Coordinates coord) {
super(400, 50, 2, 0, coord, 2);
}
@Override
public String printClass() {
return "LadderZombie";
}
@Override
public boolean isReadyToSummon() {
return hasLadder;
}
@Override
public void summon(BoardGame data, PVZView view, ArrayList<Zombie> zombieAlive) {
if (!hasLadder) {
return ;
}
int line = view.lineFromY(this.getY()), column = view.columnFromX(this.getX());
Cell cell = data.getElement(line, column);
if (cell.isAttackable() && !cell.hasLadder()) {
data.addLadder(line, column);
hasLadder = false;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3dcc19daa6273a84b02b03dfd8ee601b21d9f127 | ec381218cf3e10e11784b1b6307925a9f340e777 | /test-interview/src/main/java/com/example/testinterview/Solution.java | b808a2b902ca687667b39b0c713e97e5695a70c4 | [] | no_license | chenruiyue/test-code | eb6b4859dacdad9a7d5f7f5030b1598b82e415ef | 66b8cf118611ec85f1d03de075df61b9368fbce4 | refs/heads/main | 2023-03-12T08:15:25.004815 | 2021-02-21T18:07:54 | 2021-02-21T18:07:54 | 340,935,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,843 | java | package com.example.testinterview;
import java.util.ArrayList;
import java.util.List;
public class Solution {
//Declares a 2-D array used to store 10 1-D arrays
final static char[][] map = new char[][]{
{},
{},
{'a','b','c'},
{'d','e','f'},
{'g','h','i'},
{'j','k','l'},
{'m','n','o'},
{'p','q','r','s'},
{'t','u','v'},
{'w','x','y','z'}};
List<String> result;
char[] chars;
public void dfs(String tmp,int index){
if(index==chars.length){
result.add(tmp);
return ;
}
else{
for(int j=0;j<map[chars[index]].length;j++){
dfs(tmp+map[chars[index]][j],index+1);
}
}
}
public String letterCombinations(int[] data) {
StringBuilder sb = new StringBuilder();
for(int x=0;x<data.length;x++){
sb.append(data[x]);
}
result=new ArrayList<String>();
chars=sb.toString().toCharArray();
StringBuilder rs = new StringBuilder();
if(chars.length==0){
return "";
}
for(int j=0;j<chars.length;j++){
chars[j]-='0';
}
dfs("",0);
for (int i = 0; i < result.size(); i++) {
rs.append(result.get(i)).append(" ");
}
//Remove space before and after,return
return rs.toString().trim();
}
}
| [
"357523662@qq.com"
] | 357523662@qq.com |
b2876670bec02ddd86a9163d88d99e38bf857de1 | 22bbbdec4684a28b0a522b0eb3dd8cd5f46933d4 | /app/src/main/java/com/qx/mstarstoretv/fragment/ProductingFragment.java | 3d0b30fcff3c948eb7a31752a5773c177e72f0d7 | [] | no_license | tianfeng94666/MstarStoreTV-master | aca0e652095e3c3002aecdedfac96aeced27eb90 | e6514457bb06b190f06ef79b17c169fae6d8cd7d | refs/heads/master | 2021-01-22T21:12:45.591473 | 2018-06-20T02:22:04 | 2018-06-20T02:22:04 | 100,680,383 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 9,793 | java | package com.qx.mstarstoretv.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.qx.mstarstoretv.R;
import com.qx.mstarstoretv.activity.AddressListActivity;
import com.qx.mstarstoretv.activity.ProgressDialog;
import com.qx.mstarstoretv.activity.SearchOrderMainActivity;
import com.qx.mstarstoretv.adapter.BaseViewHolder;
import com.qx.mstarstoretv.adapter.CommonAdapter;
import com.qx.mstarstoretv.base.AppURL;
import com.qx.mstarstoretv.base.BaseApplication;
import com.qx.mstarstoretv.base.BaseFragment;
import com.qx.mstarstoretv.json.ModelListEntity;
import com.qx.mstarstoretv.json.OrderInfoEntity;
import com.qx.mstarstoretv.json.ProductListResult;
import com.qx.mstarstoretv.json.SearchOrderMainResult;
import com.qx.mstarstoretv.net.ImageLoadOptions;
import com.qx.mstarstoretv.net.OKHttpRequestUtils;
import com.qx.mstarstoretv.net.VolleyRequestUtils;
import com.qx.mstarstoretv.utils.L;
import com.qx.mstarstoretv.utils.ToastManager;
import com.qx.mstarstoretv.viewutils.PullToRefreshView;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by Administrator on 2017/3/16 0016.
*/
public class ProductingFragment extends BaseFragment implements PullToRefreshView.OnHeaderRefreshListener, PullToRefreshView.OnFooterRefreshListener {
@Bind(R.id.id_ig_back)
ImageView idIgBack;
@Bind(R.id.title_text)
TextView titleText;
@Bind(R.id.tv_right)
ImageView ivRight;
@Bind(R.id.id_rel_title)
RelativeLayout idRelTitle;
@Bind(R.id.id_order_num)
TextView idOrderNum;
@Bind(R.id.id_order_date)
TextView idOrderDate;
@Bind(R.id.id_update_date)
TextView idUpdateDate;
@Bind(R.id.id_tv_invo)
TextView idTvInvo;
@Bind(R.id.id_tv_detail)
TextView idTvDetail;
@Bind(R.id.tv_remark)
TextView tvRemark;
@Bind(R.id.id_pd_lv)
ListView idPdLv;
@Bind(R.id.id_tv_confirfilterr)
TextView idTvConfirfilterr;
@Bind(R.id.id_tv_showdialog)
TextView idTvShowdialog;
@Bind(R.id.tips_loading_msg)
TextView tipsLoadingMsg;
@Bind(R.id.lny_loading_layout)
LinearLayout lnyLoadingLayout;
@Bind(R.id.root_view)
RelativeLayout rootView;
@Bind(R.id.pull_refresh_view)
PullToRefreshView pullRefreshView;
private SearchOrderMainResult.DataBean.OrderProduceBean bean;
private OrderInfoEntity orderInfoBean;
private String orderNum;
private List<ModelListEntity> modelListBeen;
private List<ModelListEntity> orderlList;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = View.inflate(getActivity(), R.layout.activity_production, null);
ButterKnife.bind(this, view);
idRelTitle.setVisibility(View.GONE);
getIntentData();
initView();
getData();
return view;
}
public void getIntentData() {
Bundle extras = getActivity().getIntent().getExtras();
orderNum = extras.getString("orderNum");
}
public void getData() {
bean = ((SearchOrderMainActivity) getActivity()).getOrderProduceBean();
if (bean != null) {
modelListBeen = bean.getModelList();
orderInfoBean = bean.getOrderInfo();
if (orderInfoBean != null) {
initViewData(modelListBeen, orderInfoBean);
}
}
}
public String isEmpty(String st) {
if (st == null || st.equals("") || st.equals("null")) {
return "暂无数据";
} else {
return st;
}
}
private void initViewData(List<ModelListEntity> modelList, OrderInfoEntity orderInfoBean) {
idOrderNum.setText("订单编号:" + isEmpty(orderInfoBean.getOrderNum() + ""));
idOrderDate.setText("下单日期:" + isEmpty(orderInfoBean.getOrderDate()));
idUpdateDate.setText("审核日期:" + isEmpty(orderInfoBean.getConfirmDate()));
idTvInvo.setText("发票: " + "类型:" + isEmpty(orderInfoBean.getInvoiceType() + "") + " 抬头:" + isEmpty(orderInfoBean.getInvoiceTitle() + ""));
tvRemark.setText("备注:" + isEmpty(orderInfoBean.getOrderNote()));
idTvDetail.setText(isEmpty(orderInfoBean.getOtherInfo()));
if (pullStauts != PULL_LOAD) {
orderlList.clear();
}
orderlList.addAll(modelList);
adapter.setListData(orderlList);
endNetRequse();
}
ProductionAdapter adapter;
private void initView() {
titleText.setText("生产中");
pullRefreshView.setOnFooterRefreshListener(this);
pullRefreshView.setOnHeaderRefreshListener(this);
orderlList = new ArrayList<>();
adapter = new ProductionAdapter(orderlList, R.layout.layout_order);
idPdLv.setAdapter(adapter);
idTvShowdialog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ProgressDialog progressDialog = new ProgressDialog(getActivity(), orderInfoBean.getOrderNum(), 2);
progressDialog.showAsDropDown(rootView);
}
});
idTvConfirfilterr.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadNetData();
}
});
}
public void loadNetData() {
String url = AppURL.URL_PD_ORDER_DETAIL2 + "orderNum=" + orderNum + "&tokenKey=" + BaseApplication.getToken();
L.e("ProductionListActivity" + url);
VolleyRequestUtils.getInstance().getCookieRequest(getActivity(), url, new VolleyRequestUtils.HttpStringRequsetCallBack() {
@Override
public void onSuccess(String result) {
int error = OKHttpRequestUtils.getmInstance().getResultCode(result);
if (error == 0) {
lnyLoadingLayout.setVisibility(View.GONE);
ProductListResult productListResult = new Gson().fromJson(result, ProductListResult.class);
if (productListResult.getData() == null) {
endNetRequse();
return;
}
ProductListResult.DataEntity productListResultData = productListResult.getData();
List<ModelListEntity> modelList = productListResultData.getModelList();
OrderInfoEntity orderInfo = productListResultData.getOrderInfo();
initViewData(modelList, orderInfo);
}
if (error == 1) {
String message = new Gson().fromJson(result, JsonObject.class).get("message").getAsString();
L.e(message);
ToastManager.showToastReal(message);
}
if (error == 2) {
loginToServer(AddressListActivity.class);
}
}
@Override
public void onFail(String fail) {
endNetRequse();
}
});
}
public void endNetRequse() {
tempCurpage = cupage;
if (pullStauts == PULL_LOAD) {
pullRefreshView.onFooterRefreshComplete();
}
if (pullStauts == PULL_REFRESH) {
pullRefreshView.onHeaderRefreshComplete();
}
pullStauts = 0;
}
public static final int PULL_LOAD = 1;
public static final int PULL_REFRESH = 2;
public int pullStauts;
public int cupage;
public int tempCurpage;
private int listCount = 0;
@Override
public void onFooterRefresh(PullToRefreshView view) {
if (listCount > adapter.getCount()) {
tempCurpage = cupage;
cupage++;
pullStauts = PULL_LOAD;
loadNetData();
} else {
ToastManager.showToastReal("没有更多数据");
pullRefreshView.onFooterRefreshComplete();
}
}
@Override
public void onHeaderRefresh(PullToRefreshView view) {
tempCurpage = cupage;
cupage = 1;
pullStauts = PULL_REFRESH;
loadNetData();
}
@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
}
public class ProductionAdapter extends CommonAdapter<ModelListEntity> {
public ProductionAdapter(List<ModelListEntity> mDatas, int itemLayoutId) {
super(mDatas, itemLayoutId);
L.e("ProductionAdapter");
}
@Override
public void convert(int position, BaseViewHolder helper, ModelListEntity item) {
RelativeLayout reView = helper.getView(R.id.item_button_layout);
ImageView productImg = helper.getView(R.id.product_img);
reView.setVisibility(View.GONE);
helper.setText(R.id.product_name, item.getTitle());
helper.setText(R.id.product_price, item.getPrice());
helper.setText(R.id.product_norms, item.getBaseInfo());
helper.setText(R.id.product_number, item.getNumber() + "");
helper.setText(R.id.id_tv_information, item.getInfo());
ImageLoader.getInstance().displayImage(item.getPic(), productImg, ImageLoadOptions.getOptions());
}
}
}
| [
"tianfeng94666@gmail.com"
] | tianfeng94666@gmail.com |
7a3506a51f70afbd2342fd68fc4a4d6187bf4a89 | f5677d3495f110117420231f120aa3a68bc9c38c | /app/src/main/java/com/mobtecnica/wafiapps/model/productsInCategories/productsInCategoriesResponse/AvailableSortOptions.java | 7601c132435dc644ef514b20136058fb103bf9c3 | [] | no_license | PersausiveTech/WafiApp | 5f87f19749df4a0525a21189512843df8f4cf03c | 8d2cf23d7fdcaa9243882783c136f4b5e7c97a5e | refs/heads/master | 2020-06-17T00:41:32.674715 | 2019-07-08T06:52:56 | 2019-07-08T06:52:56 | 195,746,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.mobtecnica.wafiapps.model.productsInCategories.productsInCategoriesResponse;
/**
* Created by SIby on 16-02-2017.
*/
public class AvailableSortOptions {
private String Text;
private String Value;
private String Disabled;
private String Selected;
private String Group;
public String getText() {
return Text;
}
public void setText(String Text) {
this.Text = Text;
}
public String getValue() {
return Value;
}
public void setValue(String Value) {
this.Value = Value;
}
public String getDisabled() {
return Disabled;
}
public void setDisabled(String Disabled) {
this.Disabled = Disabled;
}
public String getSelected() {
return Selected;
}
public void setSelected(String Selected) {
this.Selected = Selected;
}
public String getGroup() {
return Group;
}
public void setGroup(String group) {
Group = group;
}
@Override
public String toString() {
return "ClassPojo [Text = " + Text + ", Value = " + Value + ", Disabled = " + Disabled + ", Selected = " + Selected + ", Group = " + Group + "]";
}
}
| [
"rohit@persausive.com"
] | rohit@persausive.com |
58a8a33eb3b920aa46a6488b2bbd71ea86b600bb | 2a21901a47d589d7140a89f67044a05b7b64c273 | /src/main/java/com/atmecs/practise/util/DataProviderClass.java | 3ed634c75d04783877aa22723180923531e6074a | [] | no_license | Alfin-xavier/Your-Logo-Online-Shopping | aecb285ce0e74ede281ca760cb85d0a95c78540c | a4117588ee7357b5c85ffc74732e73f3767791cc | refs/heads/master | 2023-01-22T16:03:34.712222 | 2020-12-11T10:28:42 | 2020-12-11T10:28:42 | 319,606,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.atmecs.practise.util;
import java.lang.reflect.Method;
import org.testng.annotations.DataProvider;
public class DataProviderClass
{
@DataProvider(name = "testData")
public Object[][] readData(Method method)
{
Object[][] data = ReadDataFromExcel.readExcelData(method.getName());
return data;
}
}
| [
"alfin.anthonyraj@atmecs.com"
] | alfin.anthonyraj@atmecs.com |
4e572f53c23a5de2538c249245ef3c0f2dcfaad9 | 1c800459d8686e55ca8c466423796b3315a1e60f | /app/src/main/java/com/arnold/anek/HelperActivities/Weight.java | 6e9c8bf85e1669d80a904e599f489b1803c0c6c1 | [
"MIT"
] | permissive | arnoldvaz27/Anek | b991ce9f5b3079e5d1fef5474fc0e2b0eee37115 | c6c9280c3e3a32dd441a4369182c8d96d4f5a59b | refs/heads/master | 2023-07-19T07:48:55.324658 | 2021-08-28T04:53:35 | 2021-08-28T04:53:35 | 384,443,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.arnold.anek.HelperActivities;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.arnold.anek.R;
public class Weight extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setStatusBarColor(getResources().getColor(R.color.light_red));
getWindow().setNavigationBarColor(getResources().getColor(R.color.colorPrimaryDark));
setContentView(R.layout.weight);
}
} | [
"arnoldvaz27.github@gmail.com"
] | arnoldvaz27.github@gmail.com |
444553609d9e962cf3e5cf68cbd41de77f4584e3 | d86af457d83c30c20daa5589099845d57b47e73e | /fireflow-fpdl20/src/main/java/org/fireflow/pdl/fpdl/misc/ExtendedAttributeNames.java | 3826d93cb59a5203069f5ee4f044153dc578a0aa | [] | no_license | liudianpeng/FireflowEngine20 | f407251e12c9c8b4aeda2d6043b121949187911d | 774bdd82b27b8d4822168038a86aa33ae14185ab | refs/heads/master | 2021-01-11T03:18:44.600542 | 2015-03-29T15:37:06 | 2015-03-29T15:37:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,411 | java | /**
* Copyright 2007-2008 非也
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation。
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses. *
*/
package org.fireflow.pdl.fpdl.misc;
/**
* Fire workflow保留的扩展属性的名称,工作流自定义的扩展属性不要使用这些名字
* @author 非也,nychen2000@163.com
*/
public interface ExtendedAttributeNames {
public static final String BOUNDS_X = "FIRE_FLOW.bounds.x";
public static final String BOUNDS_Y = "FIRE_FLOW.bounds.y";
public static final String BOUNDS_WIDTH = "FIRE_FLOW.bounds.width";
public static final String BOUNDS_HEIGHT = "FIRE_FLOW.bounds.height";
public static final String EDGE_POINT_LIST = "FIRE_FLOW.edgePointList";
public static final String LABEL_POSITION = "FIRE_FLOW.labelPosition";
public static final String ACTIVITY_LOCATION = "FIRE_FLOW.activityLocation";
}
| [
"nychen2000@163.com"
] | nychen2000@163.com |
c16f71ab213ee75b5db034ff154157bac926947e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_90d67bf4934a9831182bc4078c8219bcc7ab60b8/PanelActivity/17_90d67bf4934a9831182bc4078c8219bcc7ab60b8_PanelActivity_t.java | 9d29634c6f06e7c0bfd5f32517833ff143d0c0b0 | [] | 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 | 6,611 | java | package com.portman.panel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import org.json.JSONObject;
import org.json.JSONTokener;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
public class PanelActivity extends Activity implements OnClickListener {
ServerSocket ss = null;
Thread myCommsThread = null;
protected static final int MSG_ID = 0x1337;
public static final int SERVERPORT = 6000;
private static String mClientMsg = "";
// UI controls
private static Airspeed mAirspeed;
private static Altimeter mAltimeter;
private static Manifold mManifold;
private static RPM mRPM;
private static TurnIndicator mTurnIndicator;
private static ArtificialHorizon mArtificialHorizon;
private static DirectionalGyro mDirectionalGyro;
private static Variometer mVariometer;
private static EngineGauge mEngineGauge;
private static FuelGauge mFuelGaugeLeft;
private static FuelGauge mFuelGaugeRight;
private static FuelGauge mFuelGaugeFuselage;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_panel);
// find controls
mAirspeed = (Airspeed) findViewById(R.id.airspeed);
mAltimeter = (Altimeter) findViewById(R.id.altimeter);
mManifold = (Manifold) findViewById(R.id.manifold);
mRPM = (RPM) findViewById(R.id.rpm);
mTurnIndicator = (TurnIndicator) findViewById(R.id.turn_indicator);
mArtificialHorizon = (ArtificialHorizon) findViewById(R.id.artificial_horizon);
mDirectionalGyro = (DirectionalGyro) findViewById(R.id.directional_gyro);
mVariometer = (Variometer) findViewById(R.id.variometer);
mEngineGauge = (EngineGauge) findViewById(R.id.engine_gauge);
mFuelGaugeLeft = (FuelGauge) findViewById(R.id.fuel_gauge_left);
mFuelGaugeRight = (FuelGauge) findViewById(R.id.fuel_gauge_right);
mFuelGaugeFuselage = (FuelGauge) findViewById(R.id.fuel_gauge_fuselage);
// set titles
mFuelGaugeLeft.setTitle("Fuel Left Tank");
mFuelGaugeRight.setTitle("Fuel Right Tank");
mFuelGaugeFuselage.setTitle("Fuel Fuselage Tank");
// set click handlers
mRPM.setOnClickListener(this);
mEngineGauge.setOnClickListener(this);
mFuelGaugeLeft.setOnClickListener(this);
mFuelGaugeRight.setOnClickListener(this);
mFuelGaugeFuselage.setOnClickListener(this);
this.myCommsThread = new Thread(new CommsThread());
this.myCommsThread.start();
}
// Implement the OnClickListener callback
public void onClick(View v) {
if (mRPM.getVisibility() == View.VISIBLE) { // show engine gauges
mRPM.setVisibility(View.GONE);
mEngineGauge.setVisibility(View.VISIBLE);
}
else if (mEngineGauge.getVisibility() == View.VISIBLE) {
mEngineGauge.setVisibility(View.GONE);
mFuelGaugeLeft.setVisibility(View.VISIBLE);
}
else if (mFuelGaugeLeft.getVisibility() == View.VISIBLE) {
mFuelGaugeLeft.setVisibility(View.GONE);
mFuelGaugeRight.setVisibility(View.VISIBLE);
}
else if (mFuelGaugeRight.getVisibility() == View.VISIBLE) {
mFuelGaugeRight.setVisibility(View.GONE);
mFuelGaugeFuselage.setVisibility(View.VISIBLE);
}
else if (mFuelGaugeFuselage.getVisibility() == View.VISIBLE) {
mFuelGaugeFuselage.setVisibility(View.GONE);
mRPM.setVisibility(View.VISIBLE);
}
}
@Override
protected void onStop() {
super.onStop();
try {
// make sure you close the socket upon exiting
ss.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private static Handler myUpdateHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_ID:
try {
// parse json
JSONObject object = (JSONObject) new JSONTokener(mClientMsg).nextValue();
mAirspeed.setAirspeed((float)object.getDouble("AirspeedNeedle"));
mAltimeter.setAltimeter((float)object.getDouble("Altimeter_10000_footPtr")/10000f,
(float)object.getDouble("Altimeter_1000_footPtr")/1000f,
(float)object.getDouble("Altimeter_100_footPtr")/100f);
mManifold.setManifold((float)object.getDouble("Manifold_Pressure"));
mRPM.setRPM((float)object.getDouble("Engine_RPM")/100f);
mTurnIndicator.setTurnNeedlePosition((float)object.getDouble("TurnNeedle"));
mTurnIndicator.setSlipballPosition((float)object.getDouble("Slipball"));
mArtificialHorizon.setPitchAndBank((float)object.getDouble("AHorizon_Pitch"), (float)object.getDouble("AHorizon_Bank"));
mDirectionalGyro.setGyroHeading((float)object.getDouble("GyroHeading"));
mVariometer.setVariometer((float)object.getDouble("Variometer")/1000f);
mEngineGauge.setValues((float)object.getDouble("Oil_Temperature"), (float)object.getDouble("Oil_Pressure"), (float)object.getDouble("Fuel_Pressure"));
mFuelGaugeLeft.setFuel((float)object.getDouble("Fuel_Tank_Left"));
mFuelGaugeRight.setFuel((float)object.getDouble("Fuel_Tank_Right"));
mFuelGaugeFuselage.setFuel((float)object.getDouble("Fuel_Tank_Fuselage"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
default:
break;
}
super.handleMessage(msg);
}
};
class CommsThread implements Runnable {
public void run() {
Socket s = null;
try {
ss = new ServerSocket(SERVERPORT );
} catch (IOException e) {
e.printStackTrace();
}
while (!Thread.currentThread().isInterrupted()) {
Message m = new Message();
m.what = MSG_ID;
try {
if (s == null)
s = ss.accept();
BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream()));
String st = null;
st = input.readLine();
if (st == null) {
input.close();
s.close();
s = null;
} else {
mClientMsg = st;
myUpdateHandler.sendMessage(m);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
ded41e812699af652e64f4da02507e06f73fd5fb | 8f79919586f2d9b0d74d5d5ce572adfba6bd690a | /app/src/main/java/com/example/sony/proyecto/Descripcion_libro.java | 6f92f1baeabd9fe1862c25d99bf32ca2b25b2868 | [] | no_license | EdwinCC/login | 5ec9aa21d6ea7ea3de2190a19100d21ccb190a31 | 1f3815298500d274400ca7f0b7e51a537948248b | refs/heads/master | 2021-01-20T05:43:55.794053 | 2017-05-10T13:20:48 | 2017-05-10T13:20:48 | 89,804,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,068 | java | package com.example.sony.proyecto;
import android.content.Intent;
import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
public class Descripcion_libro extends AppCompatActivity {
private String currentUser;
private Button buttonSelected;
private ConstraintLayout cl;
private int buttonCount;
private String bookNames[] = {"asuitableboy", "infernaldevices", "lifeofpi"};
Button add;
Button boton;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_descripcion_libro);
cl = (ConstraintLayout) findViewById(R.id.conlay);
currentUser = "user1";
Log.d("IdfindViewById", "" + findViewById(R.id.imageButton1));
buttonCount = cl.getChildCount()-2;
initButtons();
/////////////////////////////////77
add = (Button) findViewById(R.id.newLibro);
add.setOnClickListener(new View.OnClickListener () {
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(),NewBook.class);
intent.putExtra("userN",currentUser);
startActivity(intent);
}
}
);
/////////////////////////////////7
boton= (Button)findViewById(R.id.noti);
boton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), notificaciones.class);
startActivity(intent);
}
});
}
public void initButtons() {
int id;
ImageButton[] imageButton = new ImageButton[buttonCount];
for (int i = 0; i < buttonCount; i++) {
id = getResources().getIdentifier("imageButton" + (i + 1), "id", getPackageName());
imageButton[i] = (ImageButton) findViewById(id);
String uri = "@drawable/" + bookNames[i];
int resourceId = getResources().getIdentifier(uri, "drawable", getPackageName());
imageButton[i].setImageResource(resourceId);
imageButton[i].setTag(bookNames[i]);
imageButton[i].setOnClickListener(new Listener());
}
}
class Listener implements View.OnClickListener {
public void onClick(View v) {
String name = (String) v.getTag();
Intent intent = new Intent(getApplicationContext(), BookDescription.class);
Log.i("getTag",name);
String message = name;
intent.putExtra("title", message);
intent.putExtra("user", currentUser);
startActivity(intent);
}
}
}
| [
"SONY VAIO"
] | SONY VAIO |
05ddc0d74dc2154956436999a4ae01d3db599f1f | 1fc6412873e6b7f6df6c9333276cd4aa729c259f | /JavaPatterns/src/com/javapatterns/bridge/peer/MotifButtonPeer.java | a5339dcb130dab47fe8916eafbf49106651622bb | [] | no_license | youzhibicheng/ThinkingJava | dbe9bec5b17e46c5c781a98f90e883078ebbd996 | 5390a57100ae210dc57bea445750c50b0bfa8fc4 | refs/heads/master | 2021-01-01T05:29:01.183768 | 2016-05-10T01:07:58 | 2016-05-10T01:07:58 | 58,379,014 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 97 | java | package com.javapatterns.bridge.peer;
public class MotifButtonPeer extends ButtonPeer {
}
| [
"youzhibicheng@163.com"
] | youzhibicheng@163.com |
ea744d72a50e0c8b694fd973649b2526ed0668ec | 7ef1dd54f442f747f63fe6dd2c988088dc5aee5c | /4.JavaCollections/src/com/javarush/task/task31/task3104/Solution.java | 4a69852383ada087e8c408b4d4af2b8679fc6547 | [] | no_license | IvanBlinov/JavaRushTasks | c6d689db66aee4024c2f559ab0375f7fa55eec66 | ee84c6fd67636c206bb257aba7acef037229e57f | refs/heads/master | 2021-01-23T05:25:33.985794 | 2017-05-25T17:32:51 | 2017-05-25T17:32:51 | 86,307,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,742 | java | package com.javarush.task.task31.task3104;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
/*
Поиск скрытых файлов
*/
public class Solution extends SimpleFileVisitor<Path> {
public static void main(String[] args) throws IOException {
EnumSet<FileVisitOption> options = EnumSet.of(FileVisitOption.FOLLOW_LINKS);
final Solution solution = new Solution();
Files.walkFileTree(Paths.get("D:/"), options, 20, solution);
List<String> result = solution.getArchived();
System.out.println("All archived files:");
for (String path : result) {
System.out.println("\t" + path);
}
List<String> failed = solution.getFailed();
System.out.println("All failed files:");
for (String path : failed) {
System.out.println("\t" + path);
}
}
private List<String> archived = new ArrayList<>();
private List<String> failed = new ArrayList<>();
public List<String> getArchived() {
return archived;
}
public List<String> getFailed() {
return failed;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file.toString().endsWith("rar") || file.toString().endsWith("zip"))
archived.add(file.toString());
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
failed.add(file.toString());
return FileVisitResult.SKIP_SUBTREE;
}
}
| [
"iv.blinovv@gmail.com"
] | iv.blinovv@gmail.com |
fe1de1ce7e2be555124c72a41283526dde299902 | 939db89fb332a557831a17bdb2192d0f3ae5a3fa | /Expedia/src/Remove_Nth_Node_From_End_of_List.java | c3aaa0b81ba624cc7f7d71790b1a11de5fbf58d5 | [] | no_license | Lorreina/Coding_Challenge | a3f7df50c589fa2798dbb86df7fc78c5f5cd0967 | b1bf0539571abc5bd4393293e174a2cb420efffc | refs/heads/master | 2021-01-24T17:45:49.496242 | 2016-10-22T02:04:15 | 2016-10-22T02:04:15 | 53,908,823 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | /**
* LeetCode
* 19. Remove Nth Node From End of List
* @author lorreina
*
*/
public class Remove_Nth_Node_From_End_of_List {
public ListNode removeNthFromEnd(ListNode head, int n) {
if (head == null) {
return head;
}
ListNode fast = head;
ListNode slow = head;
ListNode prev = null;
int count = 1;
for (int i = 1; i < n; i++) {
fast = fast.next;
}
while (fast.next != null) {
fast = fast.next;
prev = slow;
slow = slow.next;
}
if (prev == null) {
return head.next;
} else {
prev.next = slow.next;
}
return head;
}
public class ListNode {
int val;
ListNode next;
ListNode(int x) { val = x; }
}
}
| [
"lorreina@sina.com.cn"
] | lorreina@sina.com.cn |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.