branch_name stringclasses 149 values | text stringlengths 23 89.3M | directory_id stringlengths 40 40 | languages listlengths 1 19 | num_files int64 1 11.8k | repo_language stringclasses 38 values | repo_name stringlengths 6 114 | revision_id stringlengths 40 40 | snapshot_id stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|
refs/heads/main | <repo_name>hc5duke/ffmpeg<file_sep>/metadata/frame_test.go
package metadata
import (
"github.com/stretchr/testify/assert"
"io/ioutil"
"strings"
"testing"
)
func TestNewFrame(t *testing.T) {
dat, err := ioutil.ReadFile("../fixtures/time.txt")
assert.Nil(t, err)
strs := strings.Split(string(dat), "\n")
f, err := NewFrame(strs[2], strs[3])
assert.Nil(t, err)
assert.Equal(t, 1, f.Index)
assert.Equal(t, 1867, f.Pts)
assert.Equal(t, 1.867, f.PtsTime)
assert.Equal(t, 0.002595, f.SceneScore)
}
func TestParseError(t *testing.T) {
dat, _ := ioutil.ReadFile("../fixtures/time.txt")
strs := strings.Split(string(dat), "\n")
// bad first line
_, err := NewFrame("x", strs[1])
assert.ErrorIs(t, err, ParseError)
_, err = NewFrame("frame:0 pts:1825 pts_time:1.8.2.5", strs[1])
assert.Error(t, err)
// bad second line
_, err = NewFrame(strs[2], "x")
assert.ErrorIs(t, err, ParseError)
_, err = NewFrame(strs[2], "lavfi.scene_score=0.011.56.8")
assert.Error(t, err)
}<file_sep>/metadata/metadata_test.go
package metadata
import (
"bufio"
"bytes"
"github.com/stretchr/testify/assert"
"io"
"os"
"testing"
)
func TestParseSingleFrame(t *testing.T) {
data := "frame:0 pts:1825 pts_time:1.825\nlavfi.scene_score=0.011568"
br := bytes.NewReader([]byte(data))
r := bufio.NewReader(br)
f, err := ParseSingleFrame(r)
assert.Nil(t, err)
assert.NotNil(t, f)
}
func TestParseSingleFrameNotEnoughData(t *testing.T) {
data := "frame:0 pts:1825 pts_time:1.825\n"
br := bytes.NewReader([]byte(data))
r := bufio.NewReader(br)
f, err := ParseSingleFrame(r)
assert.Equal(t, err, io.EOF)
assert.Nil(t, f)
}
func TestParseSingleFrameBadData(t *testing.T) {
data := "frame:0 pts:1825 pts_time:1.825\nsomething"
br := bytes.NewReader([]byte(data))
r := bufio.NewReader(br)
f, err := ParseSingleFrame(r)
assert.Equal(t, err, ErrBadFrame)
assert.Nil(t, f)
}
func TestNewMetadata(t *testing.T) {
filename := "./fixtures/time.txt"
f, _ := os.Open(filename)
r := bufio.NewReader(f)
m, e := New(r)
assert.Nil(t , e)
assert.NotNil(t , m)
}<file_sep>/README.md
package for parsing ffmpeg data<file_sep>/metadata/frame.go
package metadata
import (
"errors"
"regexp"
"strconv"
)
type Frame struct {
Index int
Pts int
PtsTime float64
SceneScore float64
}
var (
//frame:0 pts:1825 pts_time:1.825
r1, _ = regexp.Compile(`frame:(\d+)\s+pts:(\d+)\s+pts_time:([\d.]+)\b`)
//lavfi.scene_score=0.011568
r2, _ = regexp.Compile(`scene_score=([\d.]+)\b`)
ParseError = errors.New("Unexpected input string")
)
func NewFrame(s0 string, s1 string) (*Frame, error) {
m0 := r1.FindStringSubmatch(s0)
m1 := r2.FindStringSubmatch(s1)
if len(m0) != 4 {
return nil, ParseError
}
if len(m1) != 2 {
return nil, ParseError
}
f, err := strconv.Atoi(m0[1])
if err != nil {
return nil, err
}
p, err := strconv.Atoi(m0[2])
if err != nil {
return nil, err
}
pt, err := strconv.ParseFloat(m0[3], 64)
if err != nil {
return nil, err
}
ss, err := strconv.ParseFloat(m1[1], 64)
if err != nil {
return nil, err
}
return &Frame{
f,
p,
pt,
ss,
}, nil
}
<file_sep>/metadata/metadata.go
package metadata
import (
"bufio"
"errors"
"regexp"
"strconv"
)
type Metadata struct {
Frames []*Frame
}
var (
frameRegexp = regexp.MustCompile(`^\s*frame:(\d+)\s+pts:(\d+)\s+pts_time:([\d\.]+)\s*$`)
scoreRegexp = regexp.MustCompile(`^\s*lavfi.scene_score=([\d\.]+)\s*$`)
ErrBadFrame = errors.New("each frame must contain two valid lines of metadata")
ErrBadSequence = errors.New("input frames sequence is invalid")
)
func New(r *bufio.Reader) (m *Metadata, err error) {
var (
f *Frame
fs []*Frame
)
// call ReadLine until EOL
for err == nil {
f, err = ParseSingleFrame(r)
// bad parse
if f == nil {
break
}
// bad frame index
if len(fs) != f.Index {
return nil, ErrBadSequence
}
fs = append(fs, f)
}
return &Metadata{fs}, nil
}
func ParseSingleFrame(r *bufio.Reader) (*Frame, error) {
frame, _, err := r.ReadLine()
score, _, err := r.ReadLine()
if err != nil {
return nil, err
}
m1 := frameRegexp.FindAllSubmatch(frame, -1)
m2 := scoreRegexp.FindAllSubmatch(score, -1)
if len(m1) != 1 || len(m2) != 1 || len(m1[0]) != 4 || len(m2[0]) != 2 {
return nil, ErrBadFrame
}
f, err := strconv.Atoi(string(m1[0][1]))
if err != nil {
return nil, err
}
p, err := strconv.Atoi(string(m1[0][2]))
if err != nil {
return nil, err
}
pt, err := strconv.ParseFloat(string(m1[0][3]), 64)
if err != nil {
return nil, err
}
s, err := strconv.ParseFloat(string(m2[0][1]), 64)
if err != nil {
return nil, err
}
line := &Frame{
Index: f,
Pts: p,
PtsTime: pt,
SceneScore: s,
}
return line, nil
}
| c12dcf215eef4d4198b5881d95ed7fccfc00621a | [
"Markdown",
"Go"
] | 5 | Go | hc5duke/ffmpeg | a2816c2e20b8a94dcb6c99c26481ff0b646ccc1f | 113a9687ace91d5065715a3b1d2393490161b8c7 |
refs/heads/master | <repo_name>tingansob/JavaHomework<file_sep>/java1/sandbox/c/main.c
#include <gtk/gtk.h>
int main(int argc, char* argv[])
{
gtk_init(&argc,&argv);
GtkWidget* window;
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window,"delete-event",G_CALLBACK(gtk_main_quit),NULL);
gtk_widget_show(window);
gtk_main();
return 0;
}
<file_sep>/C/pointing.C
#include<iostream>
using namespace std;
int main() {
int x=12;
int * j;
j=&x;
x = 12;
*j = 300;
cout<<"x= "<<x<<"\n"
<<"&x= "<<&x<<"\n"
<<"j= "<<j<<"\n"
<<"*j= "<< *j;
//cout <<" &x="<<&x<<" &y="<<&y;
cout<<"\n\n";
return 0;
}
<file_sep>/C/DATATYPES/main.cpp
#include<iostream>
using namespace std;
int main() {
struct Patient{
string name;
int patientNo;
char gender;
string condition;
};
int choice, Pindex = 0;
Patient regPat[100];
do{
cout<<"\n\n\n Patients\n---------------"
<<"\n1. Add New Record"
<<"\n2. Print All Records"
<<"\n3. Quit\n\nSelection? => ";
cin>>choice;
if(choice == 1){
cout<<"\nPatient "<<Pindex<<" Name? ";
cin>>regPat[Pindex].name;
cout<<"\nPatient ID number? ";
cin>>regPat[Pindex].patientNo;
cout<<"\nPatient gender? ";
cin>>regPat[Pindex].gender;
cout<<"\nPatient Condition? ";
cin>>regPat[Pindex].condition;
Pindex++;
}
if (choice == 2){
cout<<"\n\nPatient Database\n----------------";
cout<<"\nNAME\tID NUM\tGENDER\tCONDITIONS\n----\t------\t------\t---------\n";
for(int i=1; i,i<=Pindex; i++) {
cout<<regPat[i].name<<"\t"
<<regPat[i].patientNo<<"\t"
<<regPat[i].gender<<"\t"
<<regPat[i].condition<<"\t"; }
}
}while (choice != 3);
cout<<"\n\n";
return 0;
}
<file_sep>/C/CLASSWORK/Gambling.C
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
int roll, n, ones, twos, threes, fours, fives, sixes;
srand(time(0));
do { ones=twos=threes=fours=fives=sixes=0;
cout<<"How many times to roll? ";
cin>>n;
for (int i=1;i<=n;i++){
roll = rand()%6+1;
if (roll == 1){ones++;}
if (roll == 2){twos++;}
if (roll == 3){threes++;}
if (roll == 4){fours++;}
if (roll == 5){fives++;}
if (roll == 6){sixes++;}
cout<<"\n\nTally:\n\n"
<<"\nOnes : "<<ones
<<"\nTwos : "<<twos
<<"\nThrees : "<<threes
<<"\nFours : "<<fours
<<"\nFives : "<<fives
<<"\nSixes : "<<sixes;
}
}while (true);
cout<<"\n\n";
return 0;
}
<file_sep>/C/GAMES/Likam.C
//C++ ADVENTURE! Copyright(c) 2018 by
//<NAME>, <NAME>, <NAME>, <NAME>
//"Choose the door at the hallway each door has its own adventure.
#include<iostream>
#include<cstring>
#include<ctime>
#include<cstdlib>
using namespace std;
void oceanSwim();
void casino();
void blueDoor();
void rollingDice();
void slotMachine();
void mine();
void building();
int main ()
{
srand(time(0));
int choice;
string color, red, green, blue;
do{ cout<<"\n\nYou at a hallway!"
<<"\nThere are three doors\n"
<<"which one to choose?\n\n"
<<"Red door is in front of you\n\n"
<<"Green door on the left\n\n"
<<"Blue door on the right\n\n";
cin>>color;
if(color=="red")oceanSwim();
if(color=="green")casino();
if(color=="blue")blueDoor();
}while(choice!=1);
return 0;
}
void blueDoor()
{
int game;
char flag;
do{cout<<"\n\nFortune test Game!\n Select? "
<<"\n1)Mine"
<<"\n2)Building\n";
cin>>game;
if(game==1) mine();
if(game==2) building();
cout<<"\nPlay again?(y/n)";
cin>>flag;
}while(flag=='y');
}
void oceanSwim()
{
char answer;
string yell;
cout<<"Hello there!!!\n"
<<"You have fallen into the Ocean!!!\n"
<<"Good news: No sharks around!\n"
<<"Hurry up! Swim to the shore, QUICKLY!!!\n"
<<"Ohh, ..do you know how to swim?\n"
<<"y/n?";
cin>>answer;
if(answer=='y'||answer=='Y')cout<<"Good for you!";
if(answer=='n'||answer=='N'){
cout<<"Yell \"HELP!!!\"\n";
cin>>yell;
if((yell=="HELP!!!")||(yell=="help!!!"))cout<<"\nGOOD!!! Lifeguards will help you soon!!!";}
}
void casino()
{
char choiceP;
int choiceD;
cout<<"Welcome to Casino!!!\n";
cout<<"Do you want to play?\n";
cout<<"Y/N?";
cin>>choiceP;
if(choiceP=='n'||choiceP=='N'){cout<<"If you change your mind, our door open for you 24/7!!!";}
if(choiceP=='y'||choiceP=='Y'){cout<<" Rolling Dice(1) or Slot Machine(2)?\n";
cin>>choiceD;
if(choiceD==1)rollingDice();
if(choiceD==2)slotMachine();}
}
void rollingDice()
{
int dice,n,choice;
srand(time(0));
do{
cout<<"Rolling dice how many times?";
cin>>n;
for(int x=1;x<=n;x++)
{dice=rand()%6+1;
cout<<"\nRolled: "<<dice<<" prize: ";
if(dice==1)cout<<"$1";
if(dice==2)cout<<"$2";
if(dice==3)cout<<"$3";
if(dice==4)cout<<"$4";
if(dice==5)cout<<"$5";
if(dice==6)cout<<"$6";}
}while(choice==1);
}
void slotMachine()
{
string slotR1[100];
string slotR2[100];
string slotR3[100];
int slot1,slot2,slot3,times;
char answer;
cout<<"How many times do you want to play?";
cin>>times;
for(int i=0;i<times;i++){
slot1=rand()%23+1;
slot2=rand()%23+1;
slot3=rand()%23+1;
if(slot1==1){cout<<"BAR";slotR1[i]="BAR";}
if(slot1>1&&slot1<=3){cout<<"777";slotR1[i]="777";}
if(slot1>3&&slot1<=6){cout<<"Cherry";slotR1[i]="Cherry";}
if(slot1>6&&slot1<=10){cout<<"Orange";slotR1[i]="Orange";}
if(slot1>10&&slot1<=15){cout<<"Banana";slotR1[i]="Banana";}
if(slot1>15&&slot1<=23){cout<<"Lemon";slotR1[i]="Lemon";}
if(slot2==1){cout<<"BAR";slotR2[i]="BAR";}
if(slot2>1&&slot2<=3){cout<<"777";slotR2[i]="777";}
if(slot2>3&&slot2<=6){cout<<"Cherry";slotR2[i]="Cherry";}
if(slot2>6&&slot2<=10){cout<<"Orange";slotR2[i]="Orange";}
if(slot2>10&&slot2<=15){cout<<"Banana";slotR2[i]="Banana";}
if(slot2>15&&slot2<=23){cout<<"Lemon";slotR2[i]="Lemon";}
if(slot3==1){cout<<"BAR";slotR3[i]="BAR";}
if(slot3>1&&slot3<=3){cout<<"777";slotR3[i]="777";}
if(slot3>3&&slot3<=6){cout<<"Cherry";slotR3[i]="Cherry";}
if(slot3>6&&slot3<=10){cout<<"Orange";slotR3[i]="Orange";}
if(slot3>10&&slot3<=15){cout<<"Banana";slotR3[i]="Banana";}
if(slot3>15&&slot3<=23){cout<<"Lemon";slotR3[i]="Lemon";}
if((slotR1[i]=="BAR")&&(slotR2[i]=="BAR")&&(slotR3[i]=="BAR")){cout<<"You have won $1,000,000";}
if((slotR1[i]=="777")&&(slotR2[i]=="777")&&(slotR3[i]=="777")){cout<<"You have won $10,000";}
if((slotR1[i]=="Cherry")&&(slotR2[i]=="Cherry")&&(slotR3[i]=="Cherry")){cout<<"You have won $999";}
if((slotR1[i]=="Orange")&&(slotR2[i]=="Orange")&&(slotR3[i]=="Orange")){cout<<"You have won $100";}
if((slotR1[i]=="Banana")&&(slotR2[i]=="Banana")&&(slotR3[i]=="Banana")){cout<<"You have won $50";}
if((slotR1[i]=="Lemon")&&(slotR2[i]=="Lemon")&&(slotR3[i]=="Lemon")){cout<<"You have won $5";} cout<<endl;}
}
void building()
{
int floor;
char sel;
int chance;
floor=rand()%15+1;
cout<<"\nYou're on "<<floor<<" floor(s)!"
<<"\nDo you want to jump or go back?(j/b)";
cin>>sel;
if(sel=='j')
{
if(floor>3)
{
chance=rand()%5;
if(chance!=0) cout<<"\nYou're dead!";
else cout<<"\nYou're lucky enough. ";
}
else
{
chance=rand()%5;
if(chance!=0) cout<<"\nNot bad, you're survived";
else cout<<"\nHead to the ground, you have been killed!";
}
}
if(sel=='b')
{chance=rand()%2;
if(chance==0)
{cout<<"\nOMG! ";
mine();
}
else cout<<"\nGood choice";
}
}
void mine()
{
char sel;
int line;
int run;
cout<<"\nYou stepped on a mine.."
<<"Do you want to disassemble it or run away?(d/r): ";
cin>>sel;
if(sel=='d')
{cout<<"\nWhich line do you want to cut?(1/2): ";
cin>>line;
int chance=rand()%2+1;
if(line==chance) cout<<"\nYou have been killed!";
else cout<<"\nYou're lucky enough.";
}
if(sel=='r')
{int chance=rand()%4;
if(chance==0) cout<<"\nYou're lucky enough. ";
else cout<<"\nYou have been killed!";
}
}
<file_sep>/java1/sandbox/java/java_teachersCode/evote.java
import java.util.*;
public class evote
{public static void main(String[] args)
{int clinton=0,trump=0,obama=0,iTrump=0,total=0,vote,max=0;
Scanner in=new Scanner(System.in);
System.out.println("2020 EVOTE STSTEM\n================\n");
vote=ballot(in);
while(vote !=5)
{if(vote>=1&&vote<=4)
{total++;
System.out.println("\nVOTED\n");
if(vote==1)
{clinton++;
if(clinton>max)
max=clinton;
}
else if(vote==2)
{trump++;
if(trump>max)
max=trump;
}
else if(vote==3)
{obama++;
if(obama>max)
max=obama;
}
else
{iTrump++;
if(iTrump>max)
max=iTrump;
}
}
else
System.out.println("***ERROR***invalid entry");
vote=ballot(in);
}
summary(clinton, trump, obama, iTrump, total,max);
}
public static void summary(int clinton,int trump,int obama,int iTrump, int total,int max)
{
int maxes;
System.out.println("\n==================================");
System.out.println("FINAL TALLY: ["+total+" total votes cast]");
System.out.println("<NAME>- \t"+clinton);
System.out.println("<NAME>- \t"+trump);
System.out.println("<NAME>- \t"+obama);
System.out.println("<NAME>- \t"+iTrump);
maxes=countMax(clinton, trump, obama, iTrump,max);
if(maxes>1)
reportTie(clinton, trump, obama, iTrump,max,maxes);
else
reportWinner(clinton, trump, obama, iTrump,max);
}
public static int countMax(int clinton,int trump,int obama,int iTrump, int max)
{int maxes=0;
if(clinton==max)
maxes++;
if(trump==max)
maxes++;
if(obama==max)
maxes++;
if(iTrump==max)
maxes++;
return maxes;
}
public static void reportTie(int clinton,int trump,int obama,int iTrump,int max,int high)
{System.out.println("The vote is tied between "+high+" people\nThey are");
output(clinton, trump, obama, iTrump,max);
}
public static void output(int clinton,int trump,int obama,int iTrump,int max)
{if(clinton==max)
System.out.println("<NAME>");
if(trump==max)
System.out.println("<NAME>");
if(obama==max)
System.out.println("Barack Obama");
if(iTrump==max)
System.out.println("Ivanka Trump");
}
public static void reportWinner(int clinton,int trump,int obama,int iTrump,int max)
{System.out.print("The Winner is ");
output(clinton, trump, obama, iTrump,max);
}
public static int ballot(Scanner in)
{int vote;
System.out.println("Electronic Voting System\n------------------------\n");
System.out.println("1)<NAME>");
System.out.println("2)<NAME>");
System.out.println("3)Barack Obama");
System.out.println("4)Ivanka Trump");
System.out.print("Cast your ballot for? (1, 2, 3, or 4)");
vote=in.nextInt();
return vote;
}
}
<file_sep>/C/SANDBOX/guessing.C
#include<iostream>
#include<ctime>
#include<cmath>
using namespace std;
int main()
{
int secretNum;
int yourGuess;
srand(time(0));
secretNum=(rand()%100);
do
{
cout << "\n\nWhat is your guess? ";
cin >> yourGuess ;
if(yourGuess<secretNum) cout << "\nHigher! " ;
if(yourGuess>secretNum) cout << "\nLower! " ;
} while (yourGuess != secretNum);
cout << "\n\nYou finally got it!!";
cout << "\n\n";
return 0;
}
<file_sep>/C/MARITIME/base.C
/* <NAME> */
/******************************
Maritime Requirements
*******************************
*
*
* Prolonged Blast - 4 to 6 seconds (-----)
* Short Blast - 1 Second (-)
*******************************
SOUND DEVICE TYPES
*******************************
* * Whistle
* * Gong
* * Bell
* * Horn
*
*
* Whistle details
* length Hertz Decibles Range
* 12 <= 20m 280-700(250-525) 120 0.5nm
* 20 <= 75m 280-700(250-525) 130 1.0nm
*
* Requirements for sound equipment
* * International
* length Any Means Whistle Bell Gong
*
* < 12 m X
* 12 to < 20 m X
* 20 to < 100 m X X
* >= 100 m X X X
*
* * Local
* length Any Means Whistle Bell Gong
*
* < 12 m X
* 12 to < 100 m X X
* >= 100 m X X X
*
*
*******************************
LIGHTING
*******************************
* => colors
*
* * Red
* * Green
* * White
* * Yellow
* * Blue
*
*
* => range/location
*
* * side lights
* * stern light
* * Masthead Light
* * Deck Lights
*
*
* => Arc of Coverage
*
* * Side light abc degrees
* * Stern light abc degrees
* * Masthead light abc degrees
* * all around lilght
*
*******************************
SHAPES
*******************************
* * Day Shapes
* Diamond
* Ball
* Triangle UP
* Triangle Down
* Basket
* Cilinder
*
* TO DEFINE
* Meter vs feet
* Fathom
* Nautical Mile
* True North
* Magenetic North
* Boat Sizes
*
* local rules
* international rules
* rules for clear visibiity situations
* rules for reduced visibility
*
*
*******************************
*
*/
#include<iostream>
#include<string>
using namespace std;
//-Constants
const int CAPACITY = 25;
//-Main
int main() {
//-Function prototypes
void space();
void space(int);
//
string colors[] = {"red","green","white","yellow","blue"};
space();
cout<<" The color of the port light is? _\t"<<colors[0]<<"\n";
cout<<" The color of the starbord light is? _\t"<<colors[1]<<"\n";
/* */
space(2);
return 0;
} // END main
/* Utility */
void space(){cout<<"\n";}
void space(int x){ for (int i=1;i<=x;i++) cout<<"\n"; }
<file_sep>/java1/ch01/completedExercises/StarFigures.java
import java.util.*; // Import java utilities
/*
* Author: <NAME>
* Professor: <NAME>
* Class: Introduction to Computer Programming - CP 500 02[3995]
* Textbook: Building Java Programs: A Back to Basics Approach. 4th Edition
* Date:: Sun Oct 22 09:10:03
*
* Assignment:
*
*/
public class StarFigures // Application name
{
public static void main(String[] args) // Beginning of main
{
hangX();
System.out.println();
hangX();
printBar();
System.out.println();
xCore3();
hangX();
} // END main
// print blocks of graphics at one time
public static void hangX()
{
printBar();
printX();
} // END hangX
public static void printX()
{
xEdge();
xCore();
xEdge();
} // END printX
// printing individual components of above methods
public static void printBar()
{
System.out.println("*****\n*****");
} // END printBar
public static void xEdge()
{
System.out.println(" * * ");
} // END xEdge
public static void xCore()
{
System.out.println(" * ");
} // END xCore
public static void xCore3()
{
System.out.println(" * ");
System.out.println(" * ");
System.out.println(" * ");
} // END xCore3
} // End of ap
/*
* email: <EMAIL>
* <EMAIL>
*/
<file_sep>/C/GAMES/Yeun.C
//Copyright (c) 2018 by <NAME>, HuaBin.Liang, <NAME>
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
void a();
void b();
void c();
int main()
{
char choose1;
srand(time(0));
double rolll;
cout<<"\n Yor are on the way to KBCC.";
//------------------------------------------------------------------------
do{
rolll=rand()%4+1;
if(rolll==1)cout<<"\n A professor ";
if(rolll==2)cout<<"\n A police ";
if(rolll==3)cout<<"\n A beggar ";
if(rolll==4)cout<<"\n A beggar ";
cout<<"attacks you!";
if(rolll==1)a();
if(rolll==2)b();
if(rolll==3)c();
if(rolll==4)c();
}while(true);
}
/////////////////////////////////////////////////////////
void a(){
char choose1;
double roll;
char o;
srand(time(0));
roll=rand()%100;
cout<<"\n Fight(F) or run(Z)";
cin >>choose1;
if(choose1 =='f') {cout <<"\n You have "
<<roll
<<" % to win!"
<<"\n continue? Y/N";
cin>>o;
if(o=='n') cout<<"\n you survived!\n\n";
if(roll>=60&&o=='y') cout<<"\n you win!\n\n";
if(roll<=60&&o=='y') cout <<"\n you died!\n\n";}
if(choose1 =='z') {cout <<"\n You have "
<<roll
<<" % to run!"
<<"\n continue? Y/N";
cin>>o;
if(o=='n') cout<<"\n you died!\n\n";
if(roll>=50&&o=='y') cout<<"\n you survived!\n\n";
if(roll<=50&&o=='y') cout<<"\n you died!\n\n";}
}
void c(){
int food;
char choice , feed , donate ;
cout << "\n What do you want to do ?\n Feed(f) or donate(d) ?";
cin >> choice ;
if(choice=='f')
cout << "\n You have only one piece of your favorite chocolate, and you gave him, he appreciated it.\n";
if(choice=='d'){
cout << "\n You have only one dollar in your pocket, do you want to donate?(Yes/No)";
cin >> choice;
if(choice=='y') cout << "\nThe begger return you a big smile and wish you have a good day.\n";
else cout <<"\n The begger kicked you and robbed your one dollar!!!\n";
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void b(){
char b;
double k;
char x;
double roll;
char l;
srand(time(0));
roll=rand()%100 +1;
cout<<" police arrest you!!";
cout<<"\n Struggle against police(a) or stand compliantly (s)\n";
cin>>x;
if(x=='a'){cout<<"\nYou have"
<<roll
<<" % to get killed"
<<"\n continue? y/n";
cin>>b;
if(roll>=70&&b=='y') cout<<"\n you died\n\n";
if(roll<=70&&b=='y') k++ ;}
if(x=='s'){cout <<"\n You have "
<<roll
<<" % to jail"
<<"\n continue? y/n";
cout<<"\n";
cin>>l;
if(roll>=60&&l=='y') cout<<"\n You are arrested\n\n";
if(roll<=60&&l=='y') l++ ;}
if(l=='n') cout<<"Do you want to run away? Y/N";
if(l=='y'){cout <<"\n You have "
<<roll
<<" % to save your life"
<<"\n continue? y/n";}
cin>>l;
if(roll>=50&&l=='y')
cout<<" You save your life!\n";
else cout<<" Police killed you..\n";
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<file_sep>/C/CLASSWORK/source/tempConversion.C
#include<iostream>
using namespace std;
int main(){
void askUser(double&, char&);
void FtoC(double);
void CtoF(double);
double temp;
char choice;
do{
askUser(temp, choice);
if ((choice == 'f')||(choice == 'F')){FtoC(temp);}
if ((choice == 'c')||(choice == 'C')){CtoF(temp);}
cout<<"\n\n";
} while (true);
cout<<"\n\n";
return 0;
}
void askUser(double& temp, char& choice){
cout<<"\nDegrees? ";
cin>>temp;
cout<<"\nIs that 'c' or 'f'? ";
cin>>choice;
}
void FtoC(double temp){ cout<<"\n"<<temp<<" F = "<<(temp-32)*.5556<<" C."; }
void CtoF(double temp){ cout<<"\n"<<temp<<" C = "<<temp*1.8+32<<" F."; }
<file_sep>/java1/ch01/RedundantlessRocket.java
import java.util.*;
/*
* Author: <NAME>
* Professor: <NAME>
* Class: CP 500 02[3995] Introduction to Computer Programming
* Text: Building Java Programs: A Back to Basics Approach. 4th Edition
*/
public class RedundantlessRocket
{
public static void main(String[] args)
{
drawRocket();
} // END main
// Assemble Rocket
public static void drawRocket()
{
drawCabin();
drawJets();
} // END drawRocket
// Draw The Box
public static void drawLid()
{
drawEdge();
} // END drawLid
public static void drawWalls()
{
drawSide();
} // END drawWalls
public static void drawBottom()
{
drawWalls();
drawSide();
drawLid();
} // END drawBottom
public static void drawBox()
{
drawLid();
drawBottom();
} // END drawBox
public static void drawCabin()
{
drawCone();
drawBox();
} // drawCabin
public static void drawJets()
{
drawBottom();
drawCone();
} // END drawJetes
// Create the smallest elements of the rocket
public static void drawCone()
{
System.out.println(" /\\ ");
System.out.println(" / \\ ");
System.out.println(" / \\");
} // END drawCone
public static void drawEdge()
{
System.out.println("+------+");
} // END drawEdge
public static void drawSide()
{
System.out.println("| |");
} // END drawSide
public static void printMessage()
{
System.out.println("|United|");
System.out.println("|States|");
} // END printMessage
} // END RedundantlessRocket
<file_sep>/C/BarGraph.C
#include<iostream>
using namespace std;
int main(){
int points [100];
int data;
//char bar = "\u25A0";
cout<<"\nHow many data points? ";
cin>>data;
for (int i=0; i<data; i++)
{
cout<<"Data Point "<<i<<"? ";
cin>>points[i];
}
cout<<"\n\nData Values\n-----------\n";
for (int i=0; i<data; i ++)
{
cout<<i<<": ";
for (int j =0; j<=points[i]; j++) {cout<<"\u25A0";}
cout<<"\n\n";
}
cout<<"\n\n";
return 0;
}
<file_sep>/java1/Java2/STRINGSWORK/palindromeCheck.java
public class palindromeCheck
{
public static void main(String [] args)
{
String word = "adfefda"; //"racecar"; //"dad"; //"stars"; //"sorts"; //"kayak";
int s, e = word.length()-1;
boolean isPal = true;
for(s = 0; s<e && isPal; s++, e--)
{
if(word.charAt(s) != word.charAt(e))
isPal = false;
}
if(isPal)
System.out.println(word + " is a palindrome");
else
System.out.println(word + " is NOT a palindrome");
}
}
<file_sep>/java1/sandbox/ForBool.java
import java.util.*;
public class ForBool
{
public static final int TEST_NUMBER = 7;
public static void main(String[] args)
{
testBool();
/*
System.out.println(345 / 10 / 3 * 55 / 5 / 6 + 10 / (5 / 2.0));
System.out.println(1 / 2 > 0 || 4 == 9 % 5 || 1 + 1 < 1 - 1 );
*/
}
// METHODS
public static void testBool() {
System.out.print("+");
for (int i = 0; i ==(TEST_NUMBER % 2); i++) {
System.out.println("TRUE");
for (int line = 1; line <=TEST_NUMBER/2; line++) {
System.out.print("*");
}
System.out.println();
}
for (int i = 1; i == (TEST_NUMBER % 2); i++) {
System.out.println("FALSE");
for (int line = 1; line <=TEST_NUMBER/2; line++) {
System.out.print("*");
}
System.out.println();
}
System.out.println();
}
}
<file_sep>/C/SWITCH/Receipt.C
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int choice ;
double pizza=3 , icecream=2.25 , soda=1 ;
double cost = 0 , tip , tax , service ;
cout<<fixed<<setprecision(2);
do{
cout<<"\n\n\nMENU\n----\n1)Pizza $"<<pizza
<<"\n2)Ice Cream $"<<icecream
<<"\n3)Soda $"<<soda<<"\n4)ORDER DONE"
<<"\n\nSelection? ";
cin>>choice;
switch(choice) {
case 1:
cost = cost + pizza;
cout<<"\n*************Pizza $"<<pizza
<<"\n*************(total:"<<cost<<")\n";
break;
case 2:
cost = cost + icecream;
cout<<"\n*************Ice Cream $"<<icecream
<<"\n*************(total:"<<cost<<")\n";
break;
case 3:
cost = cost + soda ;
cout<<"\n*************Soda $"<<soda
<<"\n*************(total:"<<cost<<")\n";
break;
}
}while(choice!=4);
cout<<"\n\nTotal: $"<<cost;
tax=cost*.08;
cout<<"\nTax: $"<<tax;
cout<<"\nTip ? %";
cin>>service;
tip= cost*(service/100);
cout<<"\nTip: $"<<tip;
cout<<"\n\n*************SUBTOTAL: $"<<cost+tax+tip;
cout<<"\n\n";
return 0;
}
<file_sep>/java1/sandbox/c/helloworld/main.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%d integer\n",47);
printf("%ld large integer\n",4712374249345);
printf("%f float\n",47.8);
printf("%lf large float\n",483988.384285);
printf("%c char\n",'%');
printf("%s string\n","Hello George!");
printf("%x hex\n\n",47);
puts("This is my c pgragram");
puts("Does puts include a carriage return?");
puts("It appers that c uses the same commenting style as java..or perhaps it's the other way around.");
/*
* The math operators are the same in c
*/
int a=10, b=83;
int sum;
sum=a+b;
printf("sum = %d\n\n",sum);
// if loops
int age;
printf("Please enter the age ");
scanf("%d",&age);
if( age < 18 ) {
printf("Age is less than 18");
}
if( age == 18 ) {
printf("Age is 18");
}
if( age > 18 ) {
printf("Age is greater than 18");
}
return 0;
}
<file_sep>/C/header_linked_info/listnode.h
// Template ListNode class definition.
#ifndef LISTNODE_H
#define LISTNODE_H
// forward declaration of class List
template< class NODETYPE > class List;
template< class NODETYPE >
class ListNode {
friend class List< NODETYPE >; // make List a friend
public:
ListNode( const NODETYPE & ); // constructor
NODETYPE getData() const; // return data in node
private:
NODETYPE data; // data
ListNode< NODETYPE > *nextPtr; // next node in list
}; // end class ListNode
// constructor
template< class NODETYPE >
ListNode< NODETYPE >::ListNode( const NODETYPE &info )
: data( info ),
nextPtr( 0 )
{
// empty body
} // end ListNode constructor
// return copy of data in node
template< class NODETYPE >
NODETYPE ListNode< NODETYPE >::getData() const
{
return data;
} // end function getData
#endif
<file_sep>/C/SWITCH/Grades.C
#include<iostream>
using namespace std;
int main(){
int grade;
int counter;
cout<<"Please enter your grade? ";
cin>>grade;
switch (grade)
{
case 100-90:
cout<<"You got an A+";
break;
::case 89-80;
}
}
<file_sep>/java1/sandbox/js/testing/rusty.js
const upperName = (name) => name.toUpperCase();
function sayHello() {
alert("Hello World")
}
var linebreak = "<br />";
//sayHello();
document.write(linebreak);
var myVar = "Global"; // declare global variable
document.write(myVar);
function checkscope() {
var myVar="Local"; // declare local variable
document.write(myVar);
document.write(linebreak);
}
checkscope();
document.write(linebreak);
const log = (...args) => {
console.log(...args);
};
log('hello', ' <NAME>.', 'How are you today?');
const head = ([x]) => x;
console.log(head([1, 2, 3]));
document.getElementById("rusty").innerHTML = "Kevin, thre learning JavaScript.";
<file_sep>/C/Testing.C
#include<iostream>
using namespace std;
int main() {
cout<<"\n\n";
int nums[5] = {0, 2, 3, 4, 2};
cout<<"\n\n";
for (int i =0; i<=nums.; i++) cout<<nums[i];
cout<<"\n\n";
for (int i =0; i<=4; i++) cout<<nums[i];
cout<<"\n\n";
return 0;
}
<file_sep>/go/HelloAgain.go
package main
import (
"fmt"
"time"
)
func main() {
t0 := time.Now()
// Version 1: use accurate capacity for slice.
for i := 0; i < 100000; i++ {
values := make([]int, 1000)
for x := 0; x < 1000; x++ {
values = append(values, x)
}
if values[0] != 0 {
fmt.Println(0)
}
}
t1 := time.Now()
// Version 2: use empty slice.
for i := 0; i < 100000; i++ {
values := []int{}
for x := 0; x < 1000; x++ {
values = append(values, x)
}
if values[0] != 0 {
fmt.Println(0)
}
}
t2 := time.Now()
// Benchmark results.
fmt.Println(t1.Sub(t0))
fmt.Println(t2.Sub(t1))
}
<file_sep>/C/GAMES/Sinclair.C
// LIAPLANDIA ADVENTURE
// Copyright (c) 2018 by <NAME>, <NAME>
// and <NAME>
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
// BOOLS: 0 = playerName, 1 = shadyPlayer seen, 2 = hasSword, 3 = hasLilacs, 4 = tiedLifestone , 5 = inTown, 6 = inOutpost, 7 = inGrotto, 8 = deathFlag, 9 = inBlacksmith, 10 = inTailor, 11 = DoubleCheck, 12 = witsCheck
bool flags[13] = {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0};
int inventoryFlag = 0;
string inventory[50];
int whereToGo();
void addToInventory(string);
void removeFromInventory(string);
void townCrier(string);
void blacksmith();
void tailor();
void grotto();
void outpost();
void inTown(int);
void openVendor();
void showInventory();
void hold();
int main()
{
string playerName;
int playerDirection;
cout << "ENTER YOUR NAME: ";
cin >> playerName;
do{
townCrier(playerName);
playerDirection = whereToGo();
inTown(playerDirection);
}while (flags[8] == 0);
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void inTown(int pDirection)
{
flags[5] = 1;
if (pDirection == 1) blacksmith();
if (pDirection == 2) tailor();
if (pDirection == 3) {flags[7] = 1; flags[6] = 0; flags[5] = 0; grotto();}
if (pDirection == 4) {flags[6] = 1; flags[7] = 0; flags[5] = 0; outpost();}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int whereToGo()
{
int myNewDirection;
if(flags[5] == 1) // If the player is in town..
{
if(flags[1] == 1) // if the player has encountered the shadyPlayer at the outpost yet..
{
cout << "\"I've seen a sketchy fellow hiding about..Keep your wits about you.\" - Town Crier";
flags[12] = 1;
}
cout << "\nYou are in the center of town. There is a blacksmith to the North, a tailor to the South, a dangerous portal to the West just outside of town, and an outpost to the East. Where do you go?"
<< "\n1. North \t2. South \t3. West \t4. East\nYour Choice: ";
cin >> myNewDirection;
flags[5] = 0; // we 'leaving' town in any of following cases
if (myNewDirection == 1) // if we're going to blacksmith
flags[9] = 1; // set inBlacksmith true
if(myNewDirection == 2) // if we're going to tailor
flags[10] = 1; // set inTailor true
if(myNewDirection == 3) // if we're going to the grotto
flags [7] = 1; // setting inGrotto true.. maybe??++++++++++++++++++++++++++++++++++++++++++++++++++++
if(myNewDirection ==4) // if we're going outpost..
flags[6] = 1; // setting inOutpost true
return myNewDirection;
}
if(flags[6] == 1) // If the player is at the outpost..
{
cout << "\nYou are in the Eastern outpost. There is nothing but wilderness to the North, South, and East, and is unexplorable for now. What direction do you want to go?"
<< "\n1. West\nYour Choice: ";
cin >> myNewDirection;
if (myNewDirection == 1)
{
flags[5] = 1; // sets the player's location to inTown since they are leaving the outpost.
flags[6] = 0; // sets inOutpost to false since they are leaving
}
}
if(flags[7] == 1) // If the player is at the grotto..
{
cout << "\nAfter flowing through portal space, you arrive at the Grotto. There are strange creatures afoot..\nFeeling unsafe, you waver for just a moment before fleeing back through the portal and running to town.";
hold();
flags[5] = 1; // we are returning to town after this
flags[7] = 0; // we are leaving the grotto
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void blacksmith()
{
system("cls");
flags[9] = 1; // Sets inBlacksmith to true.
int choice;
cout << "\n\"Hi there. I am <NAME> Blacksmith.\"";
if (flags[2] == 0) // if the player hasn't received a sword yet..
{
cout << "\n\"I see you're new here. Take this sword.\"";
flags[2] = 1;
addToInventory("Sword");
}
cout << "\nWould you like to browse my wares?\n1. Yes\t2. No\nYour choice: ";
cin >> choice;
if(choice == 2) {flags[9] = 0; return;}
else
{openVendor();}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void tailor()
{
int choice;
flags[10] = 1;
system("cls");
cout << "\n\"Welcome! I am Olga, a special tailor.";
openVendor();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void outpost()
{
int choice;
system("cls");
flags[5] = 0; flags[6] = 1; flags[7] = 0; // setting player to inOutpost, and NOT inGrotto or inOutpost.
cout << "\nYou head East out of town, towards an outpost.";
if(flags[1] == 0) cout << "\nOn your way there, you noticed a shady person heading in to town.";
cout << "\nArriving at the outpost, you see a lifestone. If you attune yourself with the lifestone, you will resurrect here if you die."
<< "\nDo you want to attune to the lifestone?"
<< "\n1. Yes\t2. No.\nYour Choice: ";
cin >> choice;
flags[1] = 1;
if (choice == 1)
{
flags[4] = 1; // Ties you to the lifestone
cout << "\nYou feel your soul intertwine with the magic of the lifestone.";
hold();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void grotto()
{
int choice;
flags[7] = 1; // enabling inGrotto, disabling inTown and inOutpost
if(flags[7] == 1 && flags[3] == 0) // also checks to make sure you don't have lilacs already
{
cout << "\nIn front of you is a patch of flowers. They are lilacs. Do you loot some? Perhaps the tailor can use these to dye clothing."
<< "\n1.Yes \t2. No\nYour Choice: ";
cin >> choice;
if (choice == 1)
{
flags[3] = 1;
addToInventory("Lilacs");
cout << "\nContinue to the Grotto, or head back to town?\n1. Continue\t2. Go back to town\nYour Choice: ";
cin >> choice;
if(choice == 1) flags[7] = 1;
if(choice == 2)
{
flags[7] = 0;
flags[5] = 1;
return;
}
}
if (choice == 2)
{
cout << "You continue up the hill to the portal.";
hold();
flags[7] = 1; flags[9] = 0;
whereToGo();
}
}
if(flags[7] == 1 && flags[3] == 1)
{
cout << "You continue up the hill to the portal.";
hold();
flags[9] = 0;
whereToGo();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void townCrier(string pName)
{
system("cls");
if(flags[2] == 0 && flags[11] == 0) // if the player has not received a weapon yet..
{cout << "\n\"Welcome to Liaplandia, " << pName << ". I am the Town Crier. Let me know if you encounter any suspicious people. You can do whatever you like, but I suggest picking up a weapon at the blacksmith first.\"";
flags[11] = 1;
hold();}
return;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void addToInventory(string newItem) // add strings to the inventory array, increment the inventory number slot to place next item in. 0 is skipped.
{
inventoryFlag++;
inventory[inventoryFlag] = newItem;
cout << "\n+++ " << newItem << " has been added to your inventory! +++\n";
showInventory();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void removeFromInventory(string remItem)
{
int holdThis;
cout << "\n--- " << remItem << " has been removed from your inventory! ---\n";
for(int i = 0; i <= inventoryFlag; i++)
{ if(inventory[i] == remItem) holdThis = i;}
for(int i = holdThis; i <= inventoryFlag; i++) inventory[i] = inventory[i+1];
inventoryFlag--;
showInventory();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void showInventory()
{
cout << "\nYOUR INVENTORY:\n";
for(int i = 1;i <= inventoryFlag;i++)
cout << i << ". " << inventory[i] << endl;
hold();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void openVendor()
{
int choice;
//Tailor
if (flags[10] == 1) // if inTailor is true..
{
if (flags[3] == 1) // if hasLilacs is true..
{
cout << "\n\"I see you have Lilacs! I can dye your clothes a beautiful purple color if you hand them over. What do you say? \n1. Yes\t2. No\nYour Choice: ";
cin >> choice;
if (choice == 1)
{
removeFromInventory("Lilacs");
flags[3] = 0;
cout << "\nThere! Now you have a beautiful purple outfit!";
hold();
flags[5] = 1; // in town
flags[10] = 0; // out of shop
return;
}
if (choice != 1)
{
cout << "\nThat's fine, no big deal. Just don't come crying to me when people insult your dull clothing!";
hold();
flags[5] = 1; // in town
flags[10] = 0; // out of shop
return;
}
}
if (flags[3] == 0) // if you don't have any lilacs..
{
cout << "\nUnfortunately you're absolutely broke! But there is one way I can help you out... \nWould you mind getting me some Lilacs from out of town? They're just outside, to the West!\n1. Okay\t2. Walk away awkwardly";
cout << "\nYour Choice: "; cin >> choice;
return;
}
}
//Blacksmith
if (flags[9] == 1) // if inBlacksmith is true...
{
cout << "I don't have much for wares to be honest. This town is broke. We need more people to bring in supplies!";
hold();
flags[9] = 0; flags[5] = 1; // Since you're leaving the blacksmith, set it to false.
return;
}
}
void hold()
{
string continues;
cout << "\n\n\n\n\n\nPress 'k' to continue: ";
cin >> continues;
}
<file_sep>/C/CLASSWORK/source/pointing.C
#include<iostream>
using namespace std;
int a = 10, b = 20;
void Thing1 (int, int);
int main(){
/*
int x;
int * y;
x = 4;
y = &x;
*y = 7814;
cout<<"\n x= "<<x
<<"\n &x= "<< &x
<<"\n y= "<< y // set what's at *y addy to the mem address of
<<"\n *y= "<< *y
;
*/
int b = 0 ;
int e = 0 ;
int r = 1 ;
cout << "\nBase? ";
cin >>b ;
cout << "\nExponent? ";
cin >> e;
for(int i=1;i<=e;i++) r=r*b;
cout<<"\n\n"<<b<<" to the "<<e<<" is "<<r;
cout<<"\n\n";
return 0;
}
void Thing1 (int a, int b)
{}
<file_sep>/java1/Java2/homework/src/Sound.java
public class Sound{
public void honk(){
System.out.println("Hello From Horn");
}
}
<file_sep>/java1/ch02/completedExercises/java/PrintSumOf2Numbers.java
/*
* INFO: PrintSumOf2Numbers
* Created by tingansob on 10/30/2017 at 09:32:25 AM
* Assignment:
*
*/
import java.util.*;
/*
* MAIN
*/
public class PrintSumOf2Numbers {
public static void main(String[] args) {
getNumbers();
// doMath();
} // END main
/*
* METHODS
*/
public static void getNumbers() // Beginning of the getNumbers method
{
Scanner scan = new Scanner(System.in);
System.out.print("Please enter your first number >\t");
int num1 = scan.nextInt();
Scanner scan2 = new Scanner(System.in);
System.out.print("Please enter your second number >\t");
int num2 = scan2.nextInt();
System.out.println("Thus the sum of "+num1+" + "+num2+" = " +(num1 + num2));
} // END getNumbers
/*
public static void doMath() // Now's time to calculate the sum of the 2 numbers.
{
System.out.println("The sum of "+num1+" and "+num2);
}
*/
} // End of application
<file_sep>/java1/sandbox/js/BouncyName/main.js
var red = [0, 100, 63];
var orange = [40, 100, 60];
var green = [75, 100, 40];
var blue = [196, 77, 55];
var purple = [280, 50, 60];
var color =[red, orange, green, blue, purple];
var myName="Rusty";
drawName(myName, color);
bounceBubbles();
<file_sep>/java1/ch01/completedExercises/Hello.java
/*
Importing java utilities. We will not be using this currently but it's reuired for java to process math and calculations
*/
import java.util.*;
// This is the beginning of the actual "Hello World" class
public class Hello
{
public static void main(String[] args)
{
/*
Exprimenting with escape sequences, and the difference between print and println. The difference is that print does not include a carrage return where println does.
*/
System.out.println("Hello World!");
System.out.println("Now we're cooking with gas!");
System.out.print("This string has no new line or carrage return after it.....");
System.out.println("This is a new line in the program but is attached to the line before it.");
System.out.println("So to put escape sequences like \" \" ");
System.out.println("\tWe can also indent using the \\t escape sequence");
System.out.println("\t\tWe can also indent using the \\t escape sequence");
}
}
<file_sep>/java1/Java2/StringManip.java
import java.util.*;
public class StringManip{
public static void main(String[] args){
String name1 = "<NAME>";
String name2 = "<NAME>";
System.out.println(fixName(name1));
}
public static String fixName(String name){
name = name.toLowerCase();
//name.substring(0,1);
(name.substring(0,1));
return name;
}
}
<file_sep>/C/BEAR/Dungeon001.cpp
// <NAME>
#include<iostream>
#include<string>
#include<ctime>
#include<cstdlib>
using namespace std;
void intro();
int main() {
srand(time(0));
struct player {
string name;
int strength;
int charisma;
int speed;
int bonus;
};
//
//Variable Declarations
string choice;
string name;
char ch;
//
// Monster array declarations
player monster[50];
for (int i=0; i<=5; i++) {
monster[i].strength = rand()%10;
monster[i].charisma = rand()%10;
monster[i].speed = rand()%10;
monster[i].bonus = rand()%5;
}
//
//Character creation
player self;
self.name=name;
self.strength= rand()%10;
self.charisma= rand()%10;
self.speed= rand()%10;
self.bonus= rand()%5;
do{
cout<<"So, what shall I call you? ";
cin>>name;
intro();
cin>>choice;
cout<<"\n\nAwesome, I'm so glad you've choosen to take this adventure with me."
<<"\n\n\nLet's ";
}while (choice != "bye");
cout<<"\n\n";
return 0;
}// END main
void intro()
{
cout<<"\n\nLong ago in a land far, far away, there was a great forest out on the edge of the city of Eldridge. Eldridge, home to a variety of friends and foes, has been over run by the most offensive monsters and you, our valiant warior, have been called upon to fight the monsters and return the town to the good people of Eldridge.\n\n)"
<<"Legend states that there is one monster that is unusually difficult to kill. For that monster you will need to find the magic staff located somewhere in the forest. I'm sure you'll stumble across it in your travels so keep your eyes open\n\n"
<<"Other than your dagger, you have on armor that makes it hard to do mortal damage with one blow, though your leather armor isn't very strong. I am told that somewhere out there is a shield and helmet that have magical powers, but beware, they are guarded by a beast so strong you may not survive...but if you do it will totally be worth it.\n\n"
<<"Anyway, I could go on for hours, but that will keep you from your adventure. Are you ready to go? (go/bye)";
}
<file_sep>/java1/Java2/PalindromeChecker.java
import java.util.*;
public class PalindromeChecker{
public static void main(String[] args){
String word = "kayak";
int s, e = word.length()-1;
boolean isPal - true;
for (s = 0 ; s<e && isPal; s++, e--) {
{
if(word.charAt(s)!= word.charAt(e))
isPal = false;
}
if
}
}
}
<file_sep>/C/BEAR/BearFight.cpp
#include<iostream>
#include<ctime>
#include<string>
using namespace std;
int main(){
int alive=25;
char choice;
srand(time(0));
struct player{
string name;
int speed;
int strength;
int charisma;
};
player self;
self.speed = rand()%10+1;
self.strength = rand()%10+1;
self.charisma = rand()%10+1;
player
cout<<self.speed<<" "<<self.strength<<" "<<self.charisma;
cout<<"\n\n";
return 0;
}
<file_sep>/C/drawCard.C
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
while(true) {
int suit, value, card;
char draw;
srand(time(0));
//for (int x=1;x<=100;x++) cout<<rand()%4<<" ";
do{
cout <<"\nReady to draw a card? ";
cin >> draw;
} while (draw!='y');
cout << "\n\n";
card=rand()%13+1;
if((card>=2)&&(card<10)) cout << card;
else if(card==1)cout<<" Ace ";
else if(card==11)cout<<" Jack ";
else if(card==12)cout<<" Queen ";
else if(card==13)cout<<" King ";
suit = rand()%4;
if(suit == 0 )cout<<" of hearts";
if(suit == 1 )cout<<" of clubs";
if(suit == 2 )cout<<" of spades";
if(suit == 3 )cout<<" of diamonds";
}
cout << "\n\n";
return 0;
}
<file_sep>/java1/ch03/ImputTests.java
/* Testing Scanner Constructor */
import java.util.*;
public class ImputTests
{
public static void main(String[] args)
{
// Obtain value
Scanner console = new Scanner(System.in);
System.out.println("Testing user imput using the Scanner function.\n");
System.out.println("This particular function calls the Scaner function once although \nit uses multiple iterations of the new constructor.\n\n");
System.out.print("Please enter a string => ");
String test1 = console.nextLine();
System.out.print("Please enter a double value => ");
double test2 = console.nextDouble();
System.out.print("Please enter an integer =>");
int test3 = console.nextInt();
System.out.println();
System.out.println("The string was "+test1);
System.out.println("The double value was "+test2);
System.out.println("The int is "+test3);
}
}
<file_sep>/C/day2.cpp
// <NAME>
#include<iostream>
using namespace std;
int main() {
int sn = 6, guess , tally = 0;
do {
cout << "\n\nWhat's your guess? ";
cin >> guess;
if (guess<sn) cout << "\nHigher!! ";
if (guess>sn) cout << "\nLower!! ";
tally++;
} while(guess!=sn);
cout << "\n\nYou got it!";
cout << "\n\nAnd it only took you "<< tally <<" tries to figure it out.";
cout << "\n\n";
return 0;
}
<file_sep>/C/TEST_REVIEW/TestTest.C
#include<iostream>
using namespace std;
int main()
{
int choice = 0;
int total=0;
do{
cout<<"\n\n KBCC Bookstore\n-------------------"
<<"\n\n(1) Notebook\t$1"
<<"\n(2) Pen\t\t$5"
<<"\n(3) Mug\t\t$3"
<<"\n(4) Quit"
<<"\n\nYour Selection => ";
cin>>choice;
if(choice == 1)total = total+1;
if(choice == 2)total = total+5;
if(choice == 3)total = total+3;
}while (choice != 4);
cout<<"Total = "<<total;
cout<<"\n\n";
return 0;
}
<file_sep>/java1/sandbox/go/src/greeting.go
package main
import (
"fmt"
"math"
"math/rand"
"time"
)
func main() {
fmt.Println("Greetings, fellow gopher")
fmt.Println("The time is ", time.Now())
fmt.Println()
fmt.Println("My favorite number is", rand.Intn(10))
fmt.Println(math.Pi)
fmt.Println(add(23, 77))
a, b := swap("hello", "world")
fmt.Println(a, b)
}
func add(x int, y int) int {
return x + y
}
func swap(x, y string) (string, string) {
return y, x
}
<file_sep>/java1/sandbox/java/java_teachersCode/drawboxes2.java
public class drawboxes2
{public static void main(String[] args)
{ drawBox();
drawBox();
drawRectangle();
}
public static void drawRectangle()
{drawEdge();
drawRectangleCenter();
drawEdge();
}
public static void drawBox()
{drawEdge();
drawCenter();
drawEdge();
}
public static void drawCenter()
{draw3Empty();
}
public static void drawRectangleCenter()
{draw3Empty();
draw2Empty();
}
public static void draw2Empty()
{drawEmpty();
drawEmpty();
}
public static void draw3Empty()
{draw2Empty();
drawEmpty();
}
public static void drawEmpty()
{System.out.println("| |");
}
public static void drawEdge()
{System.out.println(" --------");
}
}<file_sep>/java1/sandbox/java/java_teachersCode/drawRocket.java
public class drawRocket
//draw a rocket
{public static void main(String[] args)
{/*the rocket is a trianle on top
with a rectangle divided in 2
in the middle
*/
drawTriangle(); //triangle
line(); //top of rectangle(includes line on the bottom
drawbox(); //top half of rectangle
drawbox(); //bottom half of rectangle
drawTriangle(); //triangle
}
public static void drawTriangle() //draw the triangle
{System.out.println(" /\\");
System.out.println(" / \\");
System.out.println(" / \\");
System.out.println(" / \\");
System.out.println(" / \\");
}
public static void drawbox() //a box is 5 middle lines, followed by a bottom line
{
draw3Lines();
draw2Lines();
line();
}
public static void draw2Lines()
{centerLine();
centerLine();
}
public static void draw3Lines()
{draw2Lines();
centerLine();
}
public static void centerLine()
{System.out.println("| |");
}
public static void line()
{System.out.println(" ----------");
}
}
<file_sep>/java1/sandbox/python/formatting_text.py
#!/usr/bin/python3
fn = 'Kevin'
mn = 'George'
ln = 'Rusty'
on = 'Lee'
bm = 10
bd = 12
by = 1970
age = 47
print('Hello',fn,mn,ln,sep=' ')
print(bm,bd,by,sep='/')
print('My original sir name wasn\'t %s it was %s' %(ln,on) )
print('I was %s %s %s first.\nMy name was changed to %s when I was 9.' %(fn,mn,on,ln))
a = 0
while ( a <= 10 ):
print('a = %d' % a)
a+=2
else:
print('The current value of a is %d' % a)
print('Done!')
<file_sep>/C/WEEK2/grades.C
//<NAME>
#include<iostream>
using namespace std;
int main()
{
int grade;
do {
cout << "\nPlease enter student grade or 101 to exit : ";
cin >> grade;
if (grade == 101) {cout<<"\n"; return 0; }
if (grade < 65) { cout << "F\n"; }
else if (grade >=65 && grade <= 69) { cout << "D\n"; }
else if (grade >=70 && grade <=79) { cout << "C\n"; }
else if (grade >=80 && grade <= 89) { cout << "B\n"; }
else if (grade >=90 && grade <=100) cout << "A\n"; }
while (grade !=0);
cout<<"\n\n";
return 0;
}
<file_sep>/C/CodeBlocks/Pointing.cpp
#include<iostream>
using namespace std;
int main(){
string name;
cout<<"What's your name? ";
cin>>name;
cout<<"Hello "<<name<<", nice to meet you.";
cout<<"\n\n";
return 0;
}
<file_sep>/C/README/GeometryCalculator.C
//geometry solver
#include<iostream>
using namespace std;
void squares();
void rectangles();
void circles();
int main()
{
int choice;
do{
cout<<"\n\nGEOMETRY\n---------\n"
<<"\n1.Squares\n2.Rectangles"
<<"\n3.Circles\n4.QUIT"
<<"\n\nYour Selection? ";
cin>>choice;
if(choice==1) squares() ;
if(choice==2) rectangles() ;
if(choice==3) circles() ;
}while(choice !=4);
cout<<"\n\n";
return 0;
}
void squares()
{double s ;
cout<<"\n\nSQUARES\n\nside length? ";
cin>>s;
cout<<"\nperimeter: "<<s*4
<<"\narea: "<<s*s<<"\n\n";
}
void rectangles()
{double l,w;
cout<<"\n\nRECTANGLES\n\nlength? ";
cin>>l;
cout<<"\nwidth? ";
cin>>w;
cout<<"\nperimeter: "<<l+l+w+w
<<"\narea: "<<l*w<<"\n\n";
}
void circles()
{double r , pi=3.14159 ;
cout<<"\n\nCIRCLES\n\nradius? ";
cin>>r;
cout<<"\ndiameter: "<<r*2
<<"\ncircumference "<<pi*r*2
<<"\narea: "<<pi*(r*r)<<"\n\n";
}
<file_sep>/java1/ch02/completedExercises/Answer.java
/* <NAME>
* Fri Nov 10 17:29:01 EST 2017
*
* What a shame that I didn't see this during the exam. You even gave us all the clues in the test. The answers to many of the questions led us to the program you were asking for.
*
* I lamented over that problem after the exam and decided that drawing nice shapes was helpful but learning to use a for loop beyond repeating print statements would be useful...so I pondered and tought and worked...AND THEN, as my eyes were crossed and I could barely see...laying down after hours of coding it all hit me.
*
* Now I totally understand that this is of no influence on my grade but just for my own knowledge I wanted to make sure I understood what you were asking in the program we were to submit for the exam.
*
* The goal was to create a class variable N and we were to add the reciprocal of N to N itterations. I thought about how I would use a for loop to calculate, to date I'd only printed pretty picutres on the screen, I hadn't done more complex variable assignments. I realized that I wasn't really using the full body of knowledge I'd learned so far.
*
* Surely I could be more creative.
*
* I downloaded a ton or free online resources about computer science, programming philosophy, other languages, logic, and all sorts of examples...I've looked at more ways that people have used this set of knowledge (which has been hard since we've really only scratched the surface).
*
* I wanted to share this code with you to make sure I understood what you were asking for. I think this is more akin to what we were supposed to achieve. I did try to advance my application a bit by using printf to format the output of the double...once N got to 3 the output becme quite wild, I also figured I'd read ahead and include a version with some features I've seen in the pipeline.
*
*
*
*/
import java.util.*;
public class Answer
{
// Variables
public static final int N = 8;
/* Here is wehre I will set the reciprocal of N */
public static double recip;
/* Here's where I will += the previous reciprocal value to the sum of the N */
public static float total = 0;
public static void main(String[] args)
{
for (double i=1; i<=N; i++)
{
System.out.printf(" 1/"+(int)i+" = %.2f += ", (1/i)); // I wanted to format the output
recip = (1/i); // so that it would ine up better
total += recip;
System.out.println(total);
}
for (int j=1; j<=15 ; j++) // Altough you said no nested loops
{ // you didn't say we couldn't
System.out.print("-"); // include other loops for style
} // enhancements.
System.out.printf("\ntotal = %.2f or %.8f \n", total, (double)total);
}
}
<file_sep>/java1/ch02/completedExercises/ShadowV.java
/* ShadowV */
import java.util.*;
public class ShadowV
{
/* static class variables */
public static final char CHECK = '\u2713';
public static final char RECYCLE = '\u2672';
public static final char ARROW = '\u2BC8';
public static final char ARROW2 = '\u2BC7';
public static final char TIME = '\u23F3';
public static final char FIVER = '\u2B1F';
public static final char DNRT = '\u21D8';
public static final char DNLF = '\u21D9';
public static final char DOTF = '\u22F0';
public static final char DOTB = '\u22F1';
public static final char DOTU = '\u22EE';
public static final char DOTD = '\u22EF';
public static final int SIZE = 9;
public static void main(String[] args)
{
System.out.println();
greeting();
System.out.println();
looping();
System.out.println();
loop2();
}
public static void greeting()
{
System.out.println("I wasn't sure what the homework assignment was...");
System.out.println("So I decided to try and recreate it from memory...");
System.out.println("...I hope this is close enough. "+CHECK);
System.out.println();
System.out.println("The unicode character's I'm using are \n\n\t"+CHECK+" "+RECYCLE+" "+ARROW+" "+ARROW2+" "+TIME+" "+FIVER+" "+DNRT+" "+DNLF+" "+DOTF+" "+DOTB+" "+DOTU+" "+DOTD);
System.out.println();
}
public static void looping()
{
int z = 0;
for (int i = 1; i <= SIZE; i++)
{
System.out.print(" "+ARROW+""+DOTU);
for (int j=SIZE; j>=i; j--)
{
System.out.print(DOTF+""+DNRT);
}
for (int j=z+2; j<=i*2; j++)
{
System.out.print(FIVER);
}
for (int j=z ; j<i*2-2; j++)
{
System.out.print(FIVER);
}
for (int j=SIZE; j>=i; j--)
{
System.out.print(DNLF+""+DOTB);
}
System.out.print(DOTU+""+ARROW2+" "+DOTD+TIME+DOTD+" |");
for (int j=SIZE; j>=i; j--)
{
System.out.print(DNLF+"/");
}
for (int j=1; j<=(i*2-1); j++)
{
System.out.print("^");
}
for (int j=z ; j<i*2-2; j++)
{
System.out.print("^");
}
for (int j=SIZE; j>=i; j--)
{
System.out.print("\\"+DNRT);
}
System.out.print("|");
System.out.println();
}
}
public static void loop2()
{
for (int i=1; i<=SIZE; i++)
{
for (int j=1; j<i; j++)
{
System.out.print(" ");
}
System.out.println(ARROW+" "+i);
}
}
} // ShadowV _EOF_
<file_sep>/C/multiples.C
#include<iostream>
using namespace std;
int main(){
cout << "\nX\tX*X\tX*X*X\n-\t---\t-----";
for (int i=4;i<=9;i++) {
cout << "\n"<<i<<"\t"<<i*i<<"\t"<<i*i*i;
}
cout << "\n";
return 0;
}
<file_sep>/C/evote.C
#include<iostream>
using namespace std;
int main(){
int castVote, tally=0, AE=0, IT=0, MO=0;
bool again;
while (again){
cout<<"\nEVOTE\n-----\n";
cout << "1 - <NAME>\n2 - <NAME>\n3 - Anyone Else\n4 - EXIT\n\nPlease Cast Your Vote => ";
cin >> castVote;
if (castVote<1||castVote>4){
cout << "\nINVALID ENTRY\fPlease limit selections to the candidates on the ballot\n ";
} else if (castVote==4) {
again==false;
} else if (castVote==1) {
MO++;tally++;
} else if (castVote==2) {
IT++;tally++;
} else if (castVote==3) {
AE++;tally++;
}
cout <<"1 = "<<MO<<"\n";
cout <<"2 = "<<IT<<"\n";
cout <<"3 = "<<AE<<"\n";
cout <<"Total Votes Cast = "<<tally<<"\n";
if (MO<)
} //END while
cout<<"\n\n";
return 0;
}
<file_sep>/C/CLASSWORK/source/intro2Functions.C
// Functions practice
#include<iostream>
using namespace std;
void squared(int);
void space(int x){for(int i=1;i<=x;i++) cout<<"\n"; }
int main(){
int a;
cout <<"\nWhat is x? ";
cin >>a;
squared(a);
space(4);
return 0;
}// END main
/* @squared --- square value */
void squared(int value){
cout <<"\n"<<value<<" squared is "<<value*value;
} //END squared
<file_sep>/java1/ch02/completedExercises/Loops.java
/*
* Loops * Created by tingansob on 11/06/2017 at 06:00:44 PM
* Assignment: Master Loops
*
*/
// loops MAIN
import java.util.*;
public class Loops {
// variables & constants
public static final int COUNT = 5;
public static final char ALPHA1 = 'A';
public static final char ALPHA2 = 'E';
public static void main(String[] args) {
intro();
loopSquares();
loopTri01(); // right triangles - low to high
loopTri02();
loopTri03();
} // END main
// METHODS
public static void intro() {
System.out.println("\nUsing a '#' char I want to print some ascii art...let's see how this goes.\n");
}
// SQUARE LOOPS
public static void loopSquares()
{
loop01();
loop02();
loop03();
loop04();
loop05();
loop06();
loop07();
loop08();
dottedDiagnal();
}
public static void loop01() {
System.out.println("Single loop, i=1, i<=5; i++; # ");
for (int i = 1; i <= COUNT; i++){
System.out.print("# ");
}
System.out.println();
} // END loop01
public static void loop02() {
for (int i=1; i<=COUNT; i++)
{
for (int j=1; j<=COUNT; j++) {
System.out.print("* "); }
System.out.println(); }
}
public static void loop03()
{
System.out.println();
for (int i=1; i<=COUNT; i++)
{
for (int j=1; j<=COUNT; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void loop04()
{
System.out.println();
for (int i=1; i<=COUNT; i++)
{
for (int j=1; j<=COUNT; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void loop05()
{
System.out.println();
for (char i=ALPHA1; i<=ALPHA2; i++)
{
for (char j=ALPHA1; j<=ALPHA2; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void loop06()
{
System.out.println();
for (char i=ALPHA1; i<=ALPHA2; i++)
{
for (char j=ALPHA1; j<=ALPHA2; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void loop07()
{
System.out.println();
for (int i=COUNT;i>=1;i--)
{
for (int j=COUNT;j>=1;j--)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void loop08()
{
System.out.println();
for (int i=COUNT;i>=1;i--)
{
for (int j=COUNT;j>=1;j--)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void dottedDiagnal ()
{
int z = 1;
System.out.println();
for (int i=1; i<=5; i++) {
for (int j=5; j>i; j--)
{
System.out.print(". ");
}
System.out.print(i);
for (int j=1; j<i ;j++)
{
System.out.print(" .");
}
z++;
System.out.println();
}
}
// TRIANGLE LOOPS 01
// image
// *
// * *
// * * *
// * * * *
// * * * * *
public static void loopTri01()
{
tri01Reference();
tri02();
tri03();
tri04();
tri05();
}
public static void tri01Reference()
{
System.out.println();
for (int i=1; i <= COUNT; i++)
{
for (int j=1; j <=i; j++)
{
System.out.print("* ");
}
System.out.println();
}
}
public static void tri02()
{
System.out.println();
for (int i=1; i<=COUNT; i++)
{
for (int j=1; j<=i; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void tri03()
{
System.out.println();
for (int i=1; i<=COUNT; i++)
{
for (int j=1; j<=i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void tri04()
{
System.out.println();
for (char i=ALPHA1; i<=ALPHA2; i++)
{
for (char j=ALPHA1; j<=i; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void tri05()
{
System.out.println();
for (char i=ALPHA1; i<=ALPHA2; i++)
{
for (char j=ALPHA1; j<=i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
// TRIANGLE LOOPS 02
// reference image
//
// * * * * *
// * * * *
// * * *
// * *
// *
//
public static void loopTri02()
{
tri02Reference();
tri02_1();
tri02_2();
tri02_3();
tri02_4();
tri02_5();
tri02_6();
tri02_7();
tri02_8();
}
public static void tri02Reference()
{
System.out.println();
System.out.println("Reference Image");
for (int i=1; i<=COUNT; i++)
{
for (int j=COUNT; j>=i; j--)
{
System.out.print("* ");
}
System.out.println();
}
}
public static void tri02_1()
{
System.out.println();
System.out.println("Img 1");
for (int i=1; i<=COUNT; i++)
{
for (int j=COUNT; j>=i; j--)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void tri02_2()
{
System.out.println();
System.out.println("Img 2");
for (int i=COUNT; i>=1; i--)
{
for (int j=1; j<=i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void tri02_3()
{
System.out.println();
System.out.println("Img 3");
for (char i=ALPHA1; i<=ALPHA2; i++)
{
for (char j=ALPHA2; j>=i; j--)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void tri02_4()
{
System.out.println();
System.out.println("Img 4");
for (char i=ALPHA2; i>=ALPHA1; i--)
{
for (char j=ALPHA1; j<=i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void tri02_5()
{
System.out.println();
System.out.println("Img 5");
for (int i=COUNT; i>=1; i--)
{
for (int j=1; j<=i; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void tri02_6()
{
System.out.println();
System.out.println("Img 6");
for (int i=1; i<=COUNT; i++)
{
for (int j=COUNT; j>=i; j--)
{
System.out.print(j+" ");
}
System.out.println();
}
}
public static void tri02_7()
{
System.out.println();
System.out.println("Img 7");
for (char i=ALPHA2; i>=ALPHA1; i--)
{
for (char j=ALPHA1; j<=i; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
public static void tri02_8()
{
System.out.println();
System.out.println("Img 8");
for (char i=ALPHA1; i<=ALPHA2; i++)
{
for (char j=ALPHA2; j>= i; j--)
{
System.out.print(j+" ");
}
System.out.println();
}
}
// TRIANGLE LOOPS 03
public static void loopTri03()
{
System.out.println();
System.out.println("LOOP SERIES 3");
tri03Reference();
tri03_1();
tri03_2();
tri03_3();
tri03_4();
}
public static void tri03Reference()
{
System.out.println("Triange 3 Reference image");
System.out.println();
for (int i=1; i<=COUNT; i++)
{
System.out.println(i+". Hello world");
}
}
public static void tri03_1() {System.out.println("Hello");}
public static void tri03_2() {System.out.println("Hello");}
public static void tri03_3() {System.out.println("Hello");}
public static void tri03_4() {System.out.println("Hello");}
} // loops _EOF_
/*
*
*/
<file_sep>/java1/ch02/completedExercises/Rusty.java
/* Created by tingansob on 11/10/2017 at 08:00:40 AM */
import java.util.*;
public class Rusty {
/* constants */
public static final String NAME = "Kevin";
public static final int COUNT = 19;
// end constants
/* main */
public static void main(String[] args)
{
//helloWorld();
printSum();
}
// end main
/* methods */
public static void helloWorld()
{
System.out.println("\nHello "+NAME+"\n");
}
public static void printSum()
{
int i, j, k, m = 10;
for (i=COUNT-2; i>=0; i--)
{
System.out.println(i);
}
for (i=1; i<=COUNT*2; i++)
{
System.out.print(".");
}
System.out.println();
for (i=COUNT/2; i>=0; i--)
{
System.out.println(i);
}
}
// end methods
} // end rusty
<file_sep>/C/SANDBOX/src/welcome.h
int hello(){
cout<<"hello World";
}
<file_sep>/C/testAverage.C
#include<iostream>
using namespace std;
int main() {
int counter, grades[100], average=0;
cout << "\nHow many exams were there? ";
cin >> counter;
cout << "\nPlease enter the grades below \n\n";
for (int i=1; i<=counter;i++)
{
cout << " - Exam "<<i<<" grade: ";
cin >> grades[i];
average += grades[i];
}
cout << "\nYour test average is "<<average/counter;
cout << "\nTest 2 grade was "<<grades[2];
cout << "\n\n";
return 0;
}
<file_sep>/C/header_linked_info/LinkedList.cpp
// DYNAMIC Data Structures: The LINKED LIST - test program.
#include <iostream>
#include <string>
#include "list.h" // List class definition
using std::cin;
using std::endl;
using std::string;
// display program instructions to user
void instructions()
{
cout << "Enter one of the following:\n"
<< " 1 to insert at beginning of list\n"
<< " 2 to insert at end of list\n"
<< " 3 to delete from beginning of list\n"
<< " 4 to delete from end of list\n"
<< " 5 to end list processing\n";
} // end function instructions
// function to test a List
template< class T >
void testList( List< T > &listObject, const string &typeName )
{
cout << "Testing a List of " << typeName << " values\n";
instructions(); // display instructions
int choice;
T value;
do {
cout << "? ";
cin >> choice;
switch ( choice ) {
case 1:
cout << "Enter " << typeName << ": ";
cin >> value;
listObject.insertAtFront( value );
listObject.print();
break;
case 2:
cout << "Enter " << typeName << ": ";
cin >> value;
listObject.insertAtBack( value );
listObject.print();
break;
case 3:
if ( listObject.removeFromFront( value ) )
cout << value << " removed from list\n";
listObject.print();
break;
case 4:
if ( listObject.removeFromBack( value ) )
cout << value << " removed from list\n";
listObject.print();
break;
} // end switch
} while ( choice != 5 ); // end do/while
cout << "End list test\n\n";
} // end function testList
int main()
{
// test List of int values
List< int > integerList;
testList( integerList, "integer" );
// test List of double values
List< double > doubleList;
testList( doubleList, "double" );
system("pause");
return 0;
} // end main
<file_sep>/java1/Java2/ExampleGNOME.java
public class ExampleGNOME {
private LibGlade libglade;
private static final String GLADE_FILE =
"ExampleGNOME.glade";
public ExampleGNOME () throws IOException {
libglade = new LibGlade(GLADE_FILE, this);
}
public void on_noButton_released(GtkEvent event) {
Gtk.mainQuit();
System.exit(1);
}
public void on_yesButton_released(GtkEvent event) {
Gtk.mainQuit();
System.exit(0);
}
public static void main(String args[]) {
ExampleGNOME gui;
Gtk.init(args);
try {
gui = new ExampleGNOME();
} catch (IOException e) {
System.err.println(e);
System.exit(1);
}
Gtk.main();
}
}
<file_sep>/java1/sandbox/RustyBreifing.java
import java.util.*;
/*
* Briefing
*
* Thu Nov 2 17:43:50 EDT 2017
*
*
* Name and introduction - see briefing in appendix.
*
*/
public class RustyBreifing {
/*
* constants
*/
public static final String myName="George";
// END constants
public static void main(String[] args) {
security();
welcome();
}
/*
* security
*/
public static void security() {
System.out.println("I'd love to have some sort of security here.");
System.out.println("There was that loop that checked for user ID!!!");
System.out.println();
} // END security
/*
* welcome
*/
public static void welcome() {
System.out.println("Hello "+myName);
System.out.println("I should be able to write loops naturally.");
System.out.println("'She said you would be there for me.'");
} // END WELCOME
}
/*
Briefing Title
Customer: WEMEUS
Champ: <NAME>
Date: Fri Nov 3 13:33:16 EDT 2017
Situation - Facts and figures. Verifiable. Style: Wikipedia. What is the state you are currently in? What do others need to know to get "the big picture?"
Purpose - What is the customer's purpose - why is the customer doing, what he is doing - part 1: external - part 2: internal. Use generic purpose, if purpose is not clear "x wants to delight y with z. And x wants to have a good time doing so.
Road Map - What initiatives are planned to pursue the purpose. What is planned now, what comes then, what comes later, what comes maybe.
Goals - Why is the customer coming to you? Try to keep this simple! Use the description as cycle title.
General Goals - What are the general goals? How is the project embedded? Where do you want to arrive in the long run?
Project Related Goals - Why are you coming to me? What part of the general goals should be covered by this project? What should be the ideal outcome from this project? Describe the ideal outcome (must be part of the general goals)
Scope - What are the parts of the cycle. What is the expected minimal scope? What resources (money, manpower, Online Tools) is the customer ready to make available (not including BrainStore's part). What are the deadlines?
Success Criteria - How do we measure the projects success. Only measurable parameters.
*/
<file_sep>/C/README/STRING_EXAMPLE.C
#include<iostream>
#include<cstring>
using namespace std;
int main()
{string thing;
cout<<"\nType any word ";
cin>>thing;
cout<<"\n\nThere are "<<thing.length()
<<" letters in "<<thing;
cout<<"\nFirst letter is "<<thing[0]
<<"\nLast letter is "
<<thing[thing.length()-1];
cout<<"\nBackwards : ";
for(int c=thing.length()-1 ; c>=0 ; c--)
cout<<thing[c];
cout<<"\n\n";
return 0;
}
<file_sep>/C/GAMES/Kovo.C
//Copyright (c) 2018 by <NAME>, <NAME>, <NAME>
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
void pulledover();
void license();
void comply();
void ticket();
void stepout();
void illegal();
void search();
main()
{srand(time(0));
char choice;
cout<<"\nWelcome to Every Monday Morning\n-------------------------------";
cout<<"\nYou are running late to work."
<<"You are on the your last warning from your boss about tardiness."
<<"\nYou can make on time if you speed while driving,"
<<" but run the risk of being pulled over by the police. "
<<"\nDo you speed? (y/n)";
cin>>choice;
if(choice=='y')pulledover();
if(choice=='n')cout<<"\n\nYou get to work late. ";
cout<<"\n\n";
return 0;
}
void pulledover()
{int p;
p=rand()%4;
if(p==0)cout<<"\n\nCongradulations! You lucked out and didn't get pulled over.\nYou made it to work just in time! ";
if(p!=0){cout<<"\nYou got pulled over by the Police. ";license();}
}
void license()
{char choice;
cout<<"\n\nThe Officer asks you for your license and registration. Do you have them on you? (y/n) ";
cin>>choice;
if(choice=='y')comply();
if(choice=='n')cout<<"\nSorry but you're going to have to tell your boss that you're not making it in to work\nbecause you're going jail. ";
}
void comply()
{char choice;
cout<<"\nDo you comply with the Officer? (y/n) ";
cin>>choice;
if(choice=='y')ticket();
if(choice=='n'){cout<<"\nYou decide to tell the Officer to F**K Off. ";stepout();}
}
void stepout()
{char choice;
cout<<"\n\nThe Officer tells you to step out of your vehicle.\n Do you do so? (y/n) ";
cin>>choice;
if(choice=='n')cout<<"\nThe Officer tases you, then arrrests you and brings you to jail."
<<"\nBetter call your boss because you're not making it to work today... ";
if(choice=='y'){cout<<"\nYou are detained and searched. ";illegal();}
}
void ticket()
{int t;
t=rand()%2;
if(t==0)cout<<"\nYou lucked out.\nThe Officer was in a good mood and let you off with only a warning."
<<"\nHowever, you are now getting to work really late. ";
if(t==1)cout<<"\nYou're not so lucky.\nIt's the end of the month and the Officer has to fill his Quota."
<<"\nYou get a ticket for speeding AND are running really late to work. ";
}
void illegal()
{char choice;
cout<<"\nDo you have anything illegal on you? (y/n)";
cin>>choice;
if(choice=='y')search();
if(choice=='n')cout<<"\nOfficer gives you a speeding ticket AND a summons for obstruction of justice.\nYou get to work really late. ";
}
void search()
{int d;
d=rand()%4;
if(d==0)cout<<"\nYou lucked out and the Officer didn't check under the seat."
<<"\nYou still are getting a ticket and a summons for obstruction of justice.\nAND you are now extremely late to work..."
<<"\nBut hey, at least you still have your pot.";
if(d!=0)cout<<"\nNot only are you getting a speeding ticket.\nBut your also getting a summons for obstruction of justice and going to jail."
<<"Oh and you better call your boss, because you're not going to make it to work today...and maybe the rest of the week.";
}
<file_sep>/C/first_proj.cpp
// <NAME>
#include<iostream>
using namespace std;
int main() {
double x, y ;
cout<< "x ? ";
cin>> x;
cout<< "y ? ";
cin>> y;
cout<<"\nsum is " << x+y;
cout<<"\ndifference "<<x-y;
cout<<"\nproduct"<<x*y;
cout<<"\nquotient"<<x/y;
cout<<"\n\n";
return 0;
}
<file_sep>/java1/sandbox/js/scripts/script.js
var a = 20;
var b = 30;
var result = a + b;
var c = (a > b) ? alert("True") : document.write("Okay, a is less than b. ");
if ( a < b ) {
var result = a + b;
document.write("<br>");
document.write("The result of a + b is ", result);
} else {
document.write("a is less than b, invalid data.");
}
document.write("<br>");
document.write("<br>");
document.write("<br>");
for (var i=1; i<=5; i++)
{
for (var j=1; j<=i; j++)
document.write(" *")
document.write("<br>");
}
document.write("<h2>HELLO WORLD</h2>");
var dog = "pekingese";
switch (dog) {
case "pekingese":
document.write("I miss CHooea");
break;
case "poodle":
document.write("I miss Lauren");
break;
default:
alert("Sorry, that dog isn't available.")
}
var count = 0;
while (count < 5)
{
document.write("<br /> *");
count++;
}
function callArea(w, h) {
var area = w * h;
document.write("<br />"+area);
}
callArea(5, 3);
document.write("<br />");
function calc() {
var w = document.getElementById("width").value;
var h = document.getElementById("height").value;
var area = w * h;
document.getElementById("answer").value = area;
}
var value = Math.floor(Math.random() *6) + 1;
document.write(value + "<br />");
function draw(x,y)
{
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.save();
ctx.clearRect(0,0,250,200);
ctx.fillStyle = "rgba (0,200,0,1)";
ctx.fillRect (x, 20, 50, 50);
ctx.restore();
x += 5;
var loopTimer = setTimeout('draw('+x+','+y+')'m200);
}
<file_sep>/C/FILE_IO/file_test.C
#include<iostream>
#include<fstream>
using namespace std;
int main(){
string song;
int choice;
ofstream x;
x.open("songlist.txt", ios::app);
do{
cout<<"\n1. Add new song to song list file"
<<"\n2. Print Out my complete song list."
<<"\n3. Quit"<<"\n\nYour selection? ";
cin>>choice;
if(choice==1){
cout<<"What is the name of your song?";
cin>>song;
x << song;
}
}while(choice!=3);
/*
x.open ("Rusty.txt", ios::app);
x << "\n";
for (int i=1; i<=100;i++){
x << i<<" ";
}
x << "\n\n";
x.close();
*/
cout<<"\n\n";
return 0;
}
<file_sep>/java1/Java2/TESTS/SavingsAccount.java
// <NAME>
public class SavingsAccount extends BankAccount{
protected double interestRate;
//constructors
SavingsAccount(){
this(.4);
}
SavingsAccount(double rate){
interestRate = rate;
super.currBalance = 500.00;
}
// Accessors
public double getIRate(){
return interestRate;
}
// toString
public String toString(){
int num = getAcctNum();
double bal = getAcctBal();
return "This is the Savings Account # " +num+ "\nBalance = "+bal;
}
}
<file_sep>/java1/ch01/completedExercises/FightSong.java
import java.util.*; // Import java utilities
/*
* Author: <NAME>
* Professor: <NAME>
* Class: CP 500 02[3995] Introduction to Computer Programming
* Text: Building Java Programs: A Back to Basics Approach. 4th Edition
* Date Started
*/
public class FightSong // App name
{
public static void main(String[] args) // start of main class
{
printFightSong();
} // END main
/*
* This is where we create the actual fight song methods.
*/
public static void printFightSong()
{
printChant();
System.out.println();
printLoop();
System.out.println();
printLoop();
System.out.println();
printChant();
} // END printFightSong
public static void printLoop()
{
printChant();
printHook();
printChant();
} // END printLoop
public static void printChant()
{
System.out.println("Go, team, go!\nYou can do it.");
} // END printChant
public static void printHook()
{
System.out.println("You\'re the best,\nIn the West.");
} // END printChant
}
/*
* email: <EMAIL>
* <EMAIL>
*/
<file_sep>/java1/sandbox/java/java_teachersCode/triangle.java
import java.util.*;
public class triangle
{public static void main(String[] args)
{Scanner in=new Scanner(System.in);
int a,b,c,asq,bsq,csq;
System.out.print("Enter side 1: ");
a=in.nextInt();
System.out.print("Enter side 2: ");
b=in.nextInt();
System.out.print("Enter side 3: ");
c=in.nextInt();
if(a<=0||b<=0||c<=0)
System.out.println("Invalid data entered. This data will be ignored");
else if( b+c>a&& a+c>b&& a+b>c)
{if(a==b&&b==c)
System.out.println("all sides equal-equilateral");
else if(a==b||a==c||b==c)
System.out.println("2 sides equal-isosceles");
else
System.out.println("no sides equal-scalene");
asq=a*a;
bsq=b*b;
csq=c*c;
if(asq+bsq==csq||asq+csq==bsq||bsq+csq==asq)
System.out.println("It is a right triangle triangle");
else
System.out.println("It is not a right triangle triangle");
}
else
System.out.println("Not sides of a triangle");
}
}<file_sep>/java1/sandbox/java/java_teachersCode/input.java
import java.util.*;
public class input
{public static void main(String[] args)
{Scanner in = new Scanner(System.in);
int n,m;
double a,b;
String s1,s2;
System.out.print("Enter an integer: "); //get 2 integers
n=in.nextInt();
System.out.print("Enter an integer: ");
m=in.nextInt();
System.out.println("n= "+n+" m= "+m); //and output them
System.out.print("Enter a real number: "); //get a real
a=in.nextDouble();
System.out.println("a= "+a); //and outputit
in.nextLine(); //since each of the above inputs until it gets to a whitespace
//I have to get rid of the enter before I use nextLine(), because nextLine does read the enter
//not before next() since that also reads until a whitespace and therefore doesn't read the enter
System.out.print("Enter a string: ");
s2=in.nextLine();
System.out.println("s2= "+s2);
System.out.print("Enter a string: ");
s1=in.nextLine();
System.out.println("s1= "+s1);
}
}<file_sep>/java1/Java2/homeworkTest.java
import java.util.*;
public class homeworkTest {
public static void main(String[] args) {
ques1();
/* quest2 for (int k=100;k>10;k++) {System.out.println(k*5);}*/
ques3();
ques4();
for (int i=5;i<=18;i+=3)
for (int j=10;j<=i;j+=2)
System.out.println("Hello "+ i);
}
public static void ques1() {
System.out.print(" Question One - ");
int n=8,
sum=5;
for (int val=14;val>=n;val-=2)
{
sum +=val;
}
System.out.println(sum);
System.out.println();
}
public static void ques3(){
System.out.println(" Question Three - ");
int j=10,
k=40;
while(j<k)
{
j+=k/10;
System.out.println(j);
}
} // END question 3
public static void ques4() {
int i, j;
for (i=1;i<=4;i++)
{
j=4;
while(i != j && j > 1)
{
System.out.println(i+" " +j);
j--;
}
System.out.println(i+" " +j);
}
}
} // END class homeworkTest
<file_sep>/C/Untitled.C
// <NAME>
#include<iostream>
using namespace std;
int squares();
int rectangles();
double circles();
int main() {
int choice=0;
do {
cout<< "\n\nGeometry Solver"
<<"\n---------------"
<<"\n1. Squares"
<<"\n2. Rectangles"
<<"\n3. Circles"
<<"\n4. QUIT";
cout<<"\n Please choose an option: ";
cin>>choice;
if (choice==1){squares();}
if (choice==2){rectangles();}
if (choice==3){circles();}
}while (choice!=4);
cout<<"\n";
return 0;
}
int squares(){
int side;
cout<<"Please enter the length of a side => ";
cin>>side;
cout<<"\nThe perimeter is "<<side*4;
cout<<"\nThe area is "<<side*side;
cout<<"\n";
}
int rectangles() {
int l, w;
cout<<"\nPlease enter a length => ";
cin>>l;
cout<<"\nPlease enter a width => ";
cin>>w;
cout<<"\nThe perimeter is "<<l+l+w+w;
cout<<"\nThe area is "<<l*w;
cout<<"\n";
}
double circles() {
int radius;
cout<<"Please enter a radius => ";
cin>>radius;
cout<<"\nThe diameter is "<<2*radius;
cout<<"\nThe circumference is "<<2*3.14159*radius;
cout<<"\n";
}
<file_sep>/java1/sandbox/gtk/007.c
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
static GtkWidget *number1;
static GtkWidget *number2;
static GtkWidget *result;
void do_calculate(GtkWidget *calculate, gpointer data)
int num1 = atoi((char *)gtk_entry_get_text(GTK_ENTRY(number1)));
int num2 = atoi((char *)gtk_entry_get_text(GTK_ENTRY(number2)));
<file_sep>/java1/ch01/LoopyRocket.java
import java.util.*;
/*
* Author: <NAME>
* Professor: <NAME>
* Class: CP 500 02[3995] Introduction to Computer Programming
* Text: Building Java Programs: A Back to Basics Approach. 4th Edition
*/
public class LoopyRocket{
public static final int width=6;
public static void main(String[] args)
{
drawRocket();
} // END main
// Assemble Rocket
public static void drawRocket()
{
drawCone();
drawCabin();
drawEdge();
drawCone();
} // END drawRocket
// Draw The Box
public static void drawCabin()
{
for ( int i = 1; i <=2; i++ ){
drawEdge();
drawSide();
}
}
/*
public static void drawLid()
{
drawEdge();
} // END drawLid
public static void drawWalls()
{
drawSide();
} // END drawWalls
public static void drawBottom()
{
drawWalls();
drawSide();
drawLid();
} // END drawBottom
public static void drawBox()
{
drawLid();
drawBottom();
} // END drawBox
public static void drawCabin()
{
drawCone();
drawBox();
} // drawCabin
public static void drawJets()
{
drawBottom();
drawCone();
} // END drawJetes
*/
// Create the smallest elements of the rocket
public static void drawCone()
{
System.out.println(" /\\ ");
System.out.println(" / \\ ");
System.out.println(" / \\");
} // END drawCone
public static void drawEdge()
{
for ( int i = 1; i <= 8; i++ ){
System.out.print("-");
}
System.out.println();
} // END drawEdge
/*
public static void drawSide()
{
for ( int i = 1; i <= 2; i++ ){
System.out.println("| |");
}
} // END drawSide
*/
public static void drawSide()
{
System.out.print("|");
for (int i = 1 ; i <=width; i++ ){
System.out.print(" ");
}
System.out.println("|");
}
}// END LoopyROcket
<file_sep>/src/Util.java
import java.util.*;
public class Util{
// INSTANCE VARIABLES
private int choice;
public void space(){System.out.println();}
public void space(int x){for (int i=0;i<x;i++)System.out.println();}
// CONSTRUCTORS
// ACESSORS
// MODIFIERS
// toString
// METHODS
public int choice(Scanner in){
System.out.print("What's your choice => ");
choice = in.nextInt();
return choice; }
/** User Scanner to get name
*
*/
public String getName(Scanner in){
System.out.print("What is your name? ");
String name = in.nextLine();
space();
return name; }
} // END Util class
<file_sep>/java1/ch02/completedExercises/DrawLine1.java
import java.util.*;
import java.awt.*;
public class DrawLine1
{
public static void main(String[] args)
{
DrawingPanel panel = new DrawingPanel(200, 100);
Graphics g = panel.getGraphics();
g.drawLine(25, 75, 175, 25);
}
}
<file_sep>/java1/sandbox/js/firstCanvas.js
var canvas = document.getElementById('firstCanvas');
var c = canvas.getContext('2d');
c.font = "40px Bungee";
c.strokeText("Hello Kevin",5,70);
<file_sep>/java1/sandbox/java/FinalProject.java
/* Final Project
Author: <NAME>
Date: December 2, 2017 */
import java.util.*;
public class FinalProject {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int proj, vote, value;
System.out.println("Welcome to the Final Project\n");
do{ // main app menu
System.out.println(" 1 - EVote");
System.out.println(" 2 - Bad Key Board");
System.out.println(" 0 - exit\n");
System.out.print("What is your selection: ");
proj=in.nextInt(); // verify that user entry is valid selection option
if ( proj >= 0 && proj < 3 ) {
if ( proj == 1 ){
evote(in);
} else if (proj == 2){
badKeyBoard(in);
} space();
} else {
space(); // error message for invalid project selection
System.out.println("Selection out of range,\nplease enter a valid project ID");
space();
}
} while ( proj != 0 ); { // gracefully exit application on sentinel 0
space();
System.out.println("Thank you for a great semester. ");
space();
}
} // end main
public static void evote(Scanner in) {
int vote, cast, hc = 0, dt = 0, bo = 0, it = 0, tvc=0, winner, tie; //create scanner method to take user data for both methods
space();
System.out.println("Welcome to EVote");
do {
vote = ballot(in); // add 1 to tvc(total votes cast) each time a vote is entered
if (vote < 5){ // incerment by 1 each candidate tally for votes cast
tvc++; // vote ++h
if (vote == 1){
hc++;
} else if (vote == 2){
dt++;
} else if (vote == 3){
bo++;
} else {
it++;
}
}
if (vote <= 0 || vote > 5 ) { // error message for votes outside range 1 -4 and sentinel of 5
System.out.println("Invalid entry");
}
} while (vote != 5);
space();
tally(hc, dt, dt, bo, tvc); //display results of winner and total votes cast upon exit
}
public static void tally(int hc, int dt, int bo, int it, int tvc) {
int winner = 0; // display tvc and calculate winner
System.out.println("Total Number of Votes Cast: "+tvc); // sort highest # votes cast
System.out.println("\n <NAME> "+hc+"\n <NAME> "+dt+"\n Barak Obama "+bo+"\n Ivanka Trump "+it);
space();
}
public static int ballot(Scanner in) {
int vote; // voting ballot using scanner input
space();
System.out.println("1 - <NAME>");
System.out.println("2 - <NAME>");
System.out.println("3 - Barak Obama");
System.out.println("4 - Ivanka Trump");
System.out.println("5 - Voting Complete");
space();
System.out.print("\tPlease enter # and press <enter> to cast vote: ");
vote=in.nextInt();
return vote;
}
/* bad key pad*/
public static void badKeyBoard(Scanner in) {
int desiredTemp, temp; // get users input for desired temperature
do{
desiredTemp=getTemp(in);
}while (desiredTemp <0 || desiredTemp > 999 ); // set condition for sentinel and valid valie range
if (desiredTemp != 0) { // 1 > temp > 1000 && 0 is exit value
evaluate(desiredTemp);
} else
System.out.println("\n\t- 0 - OVEN OFF - 0 -\n"); // exit method on sentinel
space();
} // end badKeyBoard
public static int getTemp(Scanner in) {
boolean valid; // get value for desiredTemp from user
int desiredTemp; // verify number in proper temp range
// verify that number does not contain invalid digits (1, 4, 7)
System.out.print("\n Please enter temperature setting: "); // calcuate & dispaly next high & low temps
desiredTemp=in.nextInt();
valid=verifyTemp(desiredTemp);
if (valid != false) {
return desiredTemp;
} else do {
System.out.println("\n \""+desiredTemp+"\" is not within the valid temperature range,");
System.out.println("\n Please enter a temperature from \"1 - 999\" or \"0\" to Shut off the oven.");
System.out.print("\n Please enter temperature setting: "); // if desiredTemp invalid get new temp
desiredTemp=in.nextInt();
} while (valid=verifyTemp(desiredTemp) == false);
return desiredTemp;
}
public static boolean verifyTemp(int x) { // test to see that number is within proper range
if (x < 0 || x > 999 ){
return false;
} else {
return true;
}
}
public static boolean evaluate(int temp) {
int x, y, z, m;
x = temp/100; y=(temp%100)/10; z=(temp%100)%10%10; // evaluate individual digits of # for broken keys
// 235 / 100 = 2 and 235%100 =35 thus we can
// break a 3 digit # into 3 parts and analyze each
for (int i=7; i<1; i-=3) {
if (x == i) {
System.out.println(i);
changeTemp(temp);
}
else if (y == i) {
System.out.println(i);
changeTemp(temp);
}
else if (z == i) {
System.out.println(i);
changeTemp(temp);
} else {
System.out.println("Valid Temperature");
return true;
}
}
return false;
}
public static void changeTemp(int temp) {
while (evaluate(temp)==false) {
temp++;
}
}
public static void space() { System.out.println(); }
} // end FinalProject _EOF_
<file_sep>/C/Coord.C
#include<iostream>
using namespace std;
int main(){
int x, y;
cout<<"Enter an X coord => ";
cin>>x;
cout<<"Enter a Y coord => ";
cin>>y;
cout<<"\n\n";
return 0;
}
<file_sep>/java1/Java2/TEXTBOOK/src/Book.java
import java.util.*;
public class Book{
public static void main(String[] args){
Util make = new Util();
Scanner console = new Scanner(System.in);
Chapter01 ch1 = new Chapter01();
RedundantlessRocket zoom = new RedundantlessRocket();
boolean finished = false;
make.space();
System.out.println("Put the name and info of book here");
do {
make.space(2);
System.out.print(ch1.chInfo());
System.out.println(" 1 - Draw Rocket");
//int choice = console.nextInt();
int choice = make.choice(console);
if (choice == 1){
make.space();
zoom.drawRocket();
make.space();
}
if (choice == -1){
finished = false;
}
} while (finished);
}
}
<file_sep>/java1/sandbox/python/imput.py
#!/usr/bin/python3
myname = input('What is your name? ')
print('Hello '+ myname)
print(myname + ', let\'s add two numbers!')
a = input('Enter the first number: ')
b = input('Enter the second number: ')
c = int(a) + int(b)
print('The total of a & b is ' + repr(c))
<file_sep>/C/eclipse/KBCCHonors/Puppies.h
/*
* Puppies.h
*
* Created on: Apr 17, 2018
* Author: tingansob
*/
#ifndef PUPPIES_H_
#define PUPPIES_H_
class Puppies {
public:
Puppies();
virtual ~Puppies();
};
#endif /* PUPPIES_H_ */
<file_sep>/C/FILE_IO/update.C
#include<iostream>
#include<fstream>
#include<cstring>
#include<math>
using namespace std;
//
int main()
{
ofstream outFile;
outFile.open
cout<<"\n\n";
return 0;
}
<file_sep>/C/foo_testing/basics.C
// <NAME>
#include<iostream>
using namespace std;
int main()
{
cout << "Programming is great fun\n";
return 0;
}
<file_sep>/Eclipse/ShipsProject/src/Marina.java
import java.util.*;
public class Marina {
private int numSlips = 8;
private boolean slipsFull = false;
public static void main(String[] args) {
int numShips = 0;
// create objects
Scanner in = new Scanner(System.in);
Util make = new Util();
Ships demoBoat = new PartyBoat();
Ships[] vessels = new Ships[20];
Marina homeDock = new Marina();
make.space();
intro();
System.out.println(homeDock);
System.out.print("\nHow many ships would you like to dock in the marina? ");
numShips = in.nextInt();
in.nextLine();
make.space(2);
for (int i = 0 ; i < numShips ; i++)
{vessels[i] = new Ships(in);}
for (int i = 0 ; i < numShips ; i++)
{System.out.println(vessels[i]);}
System.out.println(demoBoat.getSchedule());
} // END main
// toString for Marina Class
public String toString(){
return "Hello from Marina";
//private int numSlips = 8;
//private boolean slipsFull = false;
}
// Methods
public static String intro(Scanner in) {
System.out.print("Please tell me your name => ");
String name = in.nextLine();
return name;
}
public static void intro() {
System.out.println("Welcome to the Kingsboroug Student Marina");
System.out.println("-----------------------------------------");
}
} // END _EOF_
<file_sep>/C/TempTestArray.C
#include<iostream>
using namespace std;
int main(){
char again = 'y';
int choice;
int count;
int daysTemp;
int runningTotal=0;
int min = 999;
int max = 0;
int maxX=0;
int minX = 0;
do{
cout<<"Days to track? ";
cin>>count;
int temps [count];
for (int i=1; i<=count; i++){
cout<<"Day "<<i<<"? ";
cin>>daysTemp;
runningTotal += daysTemp;
if (daysTemp > max){ max = daysTemp; maxX=i; }
if (daysTemp < min){ min = daysTemp; minX=i; }
}
cout << "\nAverage Temp "<<runningTotal/count<<".\n";
cout << "Min temp of "<<min<<" on "<<minX<<" day.\n";
cout << "Max temp of "<<max<<" on "<<maxX<<" day.\n";
cout<<"Go again? ";
cin>>again;
}while (again=='y');
cout<<"\n\n";
return 0;
}
<file_sep>/Eclipse/.metadata/version.ini
#Mon May 14 06:35:41 EDT 2018
org.eclipse.core.runtime=2
org.eclipse.platform=4.7.3.v20180330-0640
<file_sep>/C/favColor.C
#include<iostream>
#include<cstring>
using namespace std;
int main() {
do {
string favColor;
cout << "\n\nWhat is your favorite color? ";
cin >> favColor;
for (int i=0;i<=favColor.length()-1;i++)
cout <<"\n color["<<i<<"] = "<<favColor[i];
cout <<"\n";
cout <<"\n"<<favColor<<" Well, "<<favColor<<" backwards is: ";
for (int i=favColor.length()-1;i>=0;i--)cout<<favColor[i];
} while (true);
cout <<"\n\n";
return 0;
}
<file_sep>/java1/Java2/TESTS/CheckingAccount.java
// <NAME>
public class CheckingAccount extends BankAccount{
protected double monthlyFee;
protected double minBalance;
CheckingAccount(){}
public String toString(){
return "Hello from Checking Account";
}
}
<file_sep>/java1/sandbox/python/control_if_foo.py
#!/usr/bin/python3
country = "America"
if country == "America":
print("Hello America!")
else:
print("Hello World!")
<file_sep>/java1/ch01/completedExercises/Stewie2.java
import java.util.*;
public class Stewie2
{
public static void main(String[] args)
{
drawTop();
drawBody();
}
public static void drawTop()
{
System.out.println("//////////////////////");
}
public static void drawMessage()
{
System.out.println("|| Victory is mine! ||");
System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
}
public static void drawBody()
{
drawMessage();
drawMessage();
drawMessage();
drawMessage();
drawMessage();
}
}
<file_sep>/java1/Java2/homework/Card/Card.java
import java.util.*;
public class Card{
public static void main(String[] args){
// Declaration & create objects
Scanner in = new Scanner(System.in);
Util make = new Util(in);
CreditCard defaultCard = new CreditCard("<NAME>", 15, .18);
CCard newCard = new CCard();
System.out.println(defaultCard);
}
}
<file_sep>/java1/sandbox/python/hello.py
#!/usr/bin/python3
print("helo world")
<file_sep>/java1/Java2/ArraySpread.java
// print out list of doubles from 0 to 100
import java.util.*;
public class ArraySpread{
public static void main(String[] args) {
double [] spread = new double[100];
for (int i=0;i<=spread.length-1;i++)
spread[i]=i+1;
for (int i=0;i<=spread.length-1;i++)
System.out.print(spread[i]+" ");
System.out.println();
}
}
<file_sep>/java1/Java2/Assignment2b.java
/* <NAME>
Assignment 2b: Tuition Increase
Due: March 18, 2018 */
import java.util.*;
public class Assignment2b {
/* MAIN */
public static void main(String[] args) {
/* variables */
double tuition=8000,increase;
int currentYear=2018,endYear=currentYear+10; // set amount of years to calculate
heading(tuition);
while (currentYear<=endYear) {
System.out.printf(" %2d $%8.2f \n",currentYear,tuition);
increase=tuition*.04; // calcuate the annual 4% increase
tuition+=increase; // increase tuition by 4% of current tuition rate
currentYear++;
} System.out.println();
} // END main
/* METHODS */
public static void heading(double tuition) {
System.out.println("\nAssignment 2b: Tuition Increase\n-------------------------------\n");
System.out.printf("Tuition at the LINUXversity in 2018 is $%6.2f.\n",tuition);
System.out.println("Adding an annual 4% increase, what will tuition be in 10 years?\n");
} // END heading
} // END class
/* Assignment instructions:
Suppose that the tuition for a university is currently $8,000 per year and increases by 4% every year.
Use a loop to compute the tuition rate in ten years from now.
Realize that the second year's tuition will be $8,320 and the third year's tuition will be $8,652.80 and so on.
*/
<file_sep>/C/VectorIntro.C
#include<iostream>
#include<cstring>
using namespace std;
int main() {
string name;
cout << "\n\n";
cout << "\nWhat is your name? ";
cin >> name;
cout << "\n\nHi "<<name<<" !!! ";
cout << "\nInitial is: "<<name[0];
cout << "\n";
cout << "Reversed ";
for(int i=name.length()-1;i>=0;i--){cout<< name[i];}
cout << "\n\n";
return 0;
}
<file_sep>/java1/sandbox/java/java_teachersCode/RegesPage61Num6_BoughtMeACat.java
import java.util.*;
public class RegesPage61Num6_BoughtMeACat
{public static void main(String[] arg)
{cat();
hen();
duck();
goose();
sheep();
}
public static void cat()
{ System.out.println("Bought me a cat and the cat pleased me");
System.out.println("I fed my cat under yonder tree");
fiddle_i_fee();
}
public static void fiddle_i_fee()
{ System.out.println("cat goes fiddle-i-fee\n");
}
public static void hen()
{System.out.println("Bought me a hen and the hen pleased me");
System.out.println("I fed my hen under yonder tree");
chimmy_chuck();
}
public static void chimmy_chuck()
{ System.out.println("Hen goes chimmy-chuck, chimmy-chuck");
fiddle_i_fee();
}
public static void duck()
{System.out.println("Bought me a duck and the duck pleased me");
System.out.println("I fed my duck under yonder tree");
quack();
}
public static void quack()
{System.out.println("Duck goes quack, quack.");
chimmy_chuck();
}
public static void goose()
{System.out.println("Bought me a goose and the goose pleased me");
System.out.println("I fed my goose under yonder tree");
hissy();
}
public static void hissy()
{System.out.println("Duck goes hissy, hissy.");
quack();
}
public static void sheep()
{System.out.println("Bought me a sheep and the sheep pleased me");
System.out.println("I fed my sheep under yonder tree");
baa();
}
public static void baa()
{System.out.println("Sheep goes baa, baa,");
hissy();
}
}<file_sep>/C/SORTING/TestSorting.C
#include<iostream>
using namespace std;
int main()
{
int data[10] = {10, 9, 83, 27, 16, 50, 42, 93, 12, 120};
int tempData = 0;
cout<<"\n";
for (int i = 0; i<=9; i++)
cout<<data[i]<<" ";
cout<<"\n\n";
for (int loop = 0; loop<=8; loop++)
for (int x=0; x<=8; x++)
if(data[x] > data[x+1])
{
tempData = data[x];
data[x] = data[x+1];
data[x+1] = tempData;
}
for (int i = 0; i<=9; i++)
cout<<data[i]<<" ";
cout<<"\n\n";
return 0;
}
<file_sep>/java1/Java2/Lcp.java
import java.util.*;
public class Lcp {
public static void main(String[] args){
/*
Scanner in = new Scanner(System.in);
String [] word;
System.out.println("Please enter two strings ");
for (int i=1;i<=2;i++) {
System.out.print(word=in.nextLine());
}
*/
String s1 = "distance";
}
}
<file_sep>/java1/sandbox/java/triangle.java
/* triangle Class Project 3
Author: <NAME>
Professor: <NAME>
Class: CP 500 02[3995] Introduction to Computer Programming
Textbook: Building Java Programming: A Back To Basics Approach. 4th Edition
Completion Date: December 2, 2017 */
import java.util.*;
public class triangle {
public static void main(String[] args) {
Scanner in=new Scanner(System.in); // call Scanner method
int a, b, c; // set variables (int a, b, c) (double area)
double area;
instructions(); // call method to display instructions
a=getValues(in, 1); // assign user input to varaibles
b=getValues(in, 2);
c=getValues(in, 3);
System.out.println();
if (a<=0 || b<=0 || c<=0) {
System.out.println("\n\tInvalid data was entered.\n");
} else if (a+b>c && b+c>a && a+c>b) { // check for valid triangle
typeOfTriangle(a, b, c); // evaluate the type of triangle
check4RightAngle(a, b, c); // check if shape is rt triangle
System.out.println("Area: "+area(a, b, c)); // calculate & display area
} else {
System.out.println("Not sides of a triangle"); // error message when invalid data is entered.
}
System.out.println();
} // end main
public static void instructions() {
System.out.println("Welcome to the triangle program.\nPlease enter 3 integers.\n");
} // end instructions
public static int getValues(Scanner in, int count) {
int value;
System.out.print("Enter side "+count+": "); // prompt for user to input value
value=in.nextInt();
return value;
} // end getValues
public static void typeOfTriangle(int a, int b, int c) {
if (a!=b && b!=c && c!=a) { // if ALL sides different
System.out.println("No sides equal - scalene"); // then SCALENE
} else if (a==b && b==c) { // if all 3 sides equal
System.out.println("Three sides equal - equlilateral"); // then EQUILATERAL
drawTriangle(a, b, c); // draw triangle
} else if (a==b || b==c || a==c) { // if 2 sides equal
System.out.println("Two sides equal - isoceles"); // then ISOCELES
drawTriangle(a, b, c); // draw triangle
}
} // end typeOfTriangle
public static void check4RightAngle(int a, int b, int c) {
if (Math.pow(a,2)+Math.pow(b,2)==Math.pow(c,2)) { // check for right triangle
System.out.println("This is a right triangle."); // print appropriate status
} else
System.out.println("This is not a right triangle.");
} // end typeOfTriangle
public static double area(double a, double b, double c) {
double p, area;
p = (a+b+c)/2; // calculate area of
area = Math.sqrt(p*(p-a)*(p-b)*(p-c)); // triangle and return value
return area;
} // end area
public static void drawTriangle(int a, int b, int c) {
if (a==b || a==c) { // check for matching sides and use
for (int i=1; i<=a; i++) // that value as loop to print triangle
{
for (int j=1; j<=i; j++)
System.out.print("* ");
System.out.println();
}
} else {
for (int i=1; i<=b; i++)
{
for (int j=1; j<=i; j++)
System.out.print("* ");
System.out.println();
}
}
} // end drawTriangle
} // end triangle class _EOF_
<file_sep>/C/SWITCH/Pointing.C
#include<iostream>
using namespace std;
int main(){
/*
int a[5]={12,3, 96,67,1};
int * ptr;
ptr = a ;
cout <<*(ptr+3);
*/
do {
int x, y;
cout<<"\nWhat is X? ";
cin>>x;
cout<<"\nWhat is Y? ";
cin>>y;
((x==0)&&(y==0))?
cout<<"\n("<<x<<","<<y<<")"<<" is at the Origin ":
cout<<"\n("<<x<<","<<y<<")"<<" is not at the origin";
((x<0)&&(y<0))?
cout<<"\n("<<x<<","<<y<<")"<<" is in quadrant III":
cout<<"\n("<<x<<","<<y<<")"<<" is in quadrant I";
((x>0)&&(y<0))?
cout<<"\n("<<x<<","<<y<<")"<<" is in quadrant II":
cout<<"\n("<<x<<","<<y<<")"<<" is in quadrant IV";
}while (true);
cout<<"\n\n";
return 0;
}
<file_sep>/java1/Java2/homework/Card/CreditCard.java
public class CreditCard{
/*---Instance Variables-------------------------------------------------------------------- */
private String name;
private int cardNumber;
private int balance;
private int cvc;
private int memberPoints;
private double spendingLimit;
private double interestRate;
/*---Constructors--------------------------------------------------------------------------- */
CreditCard(){
cardNumber = 10000000;
spendingLimit = 2000;
balance = 0;
}
CreditCard(String n, int mp, double i){
this();
name = n;
memberPoints = mp;
interestRate = i;
cardNumber++;
// include a way for random secure cvc assignment
}
/*---Accessors--------------------------------------------------------------------------- */
public String getName() { return name; }
public int getCardNumber() { return cardNumber; }
public int getBalance() { return balance; }
public int getMemberPoints() { return memberPoints; }
public double getSpendingLimit() { return spendingLimit; }
public double getInterestRate() { return interestRate; }
/*---Modifiers--------------------------------------------------------------------------- */
public void setName(String n) { name = n; }
public void setMemberPoints(int p) { memberPoints = p; }
public void setSpendingLimit(double nl) { spendingLimit =nl; }
public void setInterestRate(double ir) {interestRate = ir; }
/*---Methods--------------------------------------------------------------------------- */
public double increaseMemberPoints(int points) {
// increase member points with purchases
memberPoints += points;
return memberPoints;
}
/*
public double buyItem(Scanner in, Item[] thing , int x){
System.out.println("Got it");
for (int i=0; i<=x; i++)
{
thing[i] = new Item(in);
}
balance += thing[i].getSalePrice();
*Pass array for creation of shopping cart.
* TODO
* make shopping cart do the foloowing
* add item to cart/array
* increase balance by purchase amount
* calculate tax
* present bill
* update shopping cart
* increase member points
return balance;
}
*/
/*---ToString--------------------------------------------------------------------------- */
public String toString(){
return "Card Info"+"\n"+"---------"+"\n"+
"-> Name On Card\t\t"+name+"\n"+
"-> Card Number\t\t"+cardNumber+"\n"+
"-> Balance\t\t"+balance+"\n"+
"-> Spendign Limit\t"+spendingLimit+"\n"+
"-> Interest Rate\t"+interestRate+"\n"+
"-> Memeber Points\t"+memberPoints+"\n";
} //END toString
} // END CreditCard class
<file_sep>/java1/ch01/README.md
Chapter 1
-----
**Topics Covered in Chapter 1**
- [x] java programs fundamental structure
- [x] print()
- [x] println()
- [ ] printf()
- [x] methods
- [x] redundantless code without the use of loops
- [x] string literals
<file_sep>/java1/ch02/completedExercises/Designing.java
import java.util.*;
/*
Designing - information & briefing
Information
-----------------------------------------------------------------
Author: <NAME>
Date: Sun Nov 5 09:21:50 EST 2017
Email: <EMAIL>
Class: Intro to Programming @ Kingsboroug CC
Professor: <NAME>
Text: Intro To Java Programming by AUTHOR
-----------------------------------------------------------------
Briefing
-----------------------------------------------------------------
* Situation: You can use java to print out patterns on the screen
* using the 'for' control structure.
*
* Purpose: My purpose is to be a fantastic programmer
* and have a good time doing so.
*
* Road Map: Now - Create various for loop constructs to explore
* -
*
* Then - What comes next
* -
*
* Later - What comes later
* -
*
* Maybe - Might or might not do
* -
*
* Goals Create pretty pictures with for loops
*
* General Goals: I should be able to write for loops without much struggle
* this shouldn't be difficult to do, nested for loops
*
* Project Goals: In the end I should have a pretty set of patterns that
* demonstrate my knowledge and use of for loops as well as
* string literals. I should be able to use complex nested
* loop structures to print designs with multiple unicode
* characters on each line - aka: ascii art
* I am limited to what we have learned in class so far
* ** include what topics we've discussed here
*
* Scope: I have am using VIM on an Ubuntu 17.04 system.
* ** use :r! to scan in sys specs
* I have until ____ days to complete the project
* I am using ___ textbook
*
* Success Criteria: I can create a method to print a complex shape
* - using only for, print, & println
* - the shape is dynamic using CONSTANT variables
* - the shape has multiple parts that are interchangeable
* and create new contiguous shapes.
* - I complete the examples in the book
* I properly document my code
* I meet the deadline
* I take a walk on the beach
*/
public class Designing
{
/*
* VARIABLES
*/
public static final String NAME = "George";
public static final int SUB_HEIGHT = 8;
public static final int BOX_WIDTH = SUB_HEIGHT*2;
public static final int HEIGHT = BOX_WIDTH/2-1;
public static final int PYRAMID = SUB_HEIGHT+1;
public static final int TEST = 10;
// END CLASS VARIABLES
/*
* MAIN
*/
public static void main(String[] args)
{
greeting();
printBoxes();
hourglass();
shadowPyramid();
printPyramid();
printBottom();
}// END MAIN
/*
* METHODS
*/
/*
* shadowPyramid()
*/
public static void shadowPyramid()
{
// local varaibles
int i, j, k, width = 8;
for (i = 1; i <= SUB_HEIGHT; i++ ) {
System.out.print("|");
for (j = i; j <= SUB_HEIGHT; j++) {
System.out.print("-"); }
for (k = 1; k < (i * 2); k++) {
System.out.print("*"); }
for (j = SUB_HEIGHT; j >= i; j--) {
System.out.print("-"); }
// System.out.println();
System.out.println("|");
}
} // END shadowPyramid
/*
* printPyramid
*/
public static void printPyramid()
{
for (int i = 1; i <= PYRAMID; i++)
{
for (int j = i; j < PYRAMID; j++)
System.out.print(" ");
for (int k = 1; k < (i * 2); k++)
System.out.print("*");
System.out.println();
}
}
// END printPyramid
/*
* greeting
*/
public static void greeting()
{
System.out.println("Welcome "+NAME+"\n");
}
/*
* hourglass
*/
// assemble hourglass
public static void hourglass() {
printLine();
printTop();
printBottom();
printLine();
}
// hourglass edges
public static void printLine() {
System.out.print("+");
for (int i = 1; i <= ( 2 * SUB_HEIGHT ); i++){
System.out.print("-");
}
System.out.println("+");
}
// top half hourglass
public static void printTop() {
for (int line = 1; line <= SUB_HEIGHT; line++ ) {
System.out.print("|");
for (int i = 1; i <= (line - 1); i++) {
System.out.print(" ");
}
System.out.print("\\");
int dots = 2 * SUB_HEIGHT - 2 * line;
for (int i = 1; i <= dots; i++) {
System.out.print(".");
}
System.out.print("/");
for (int i = 1; i <= (line - 1); i++) {
System.out.print(" ");
}
System.out.println("|");
}
}
// bttom half hourglass
public static void printBottom()
{
for (int line = 1; line <= SUB_HEIGHT; line++)
{
System.out.print("|");
for (int i = 1; i <= (SUB_HEIGHT - line); i++)
{
System.out.print(" ");
}
System.out.print("/");
for (int i = 1; i <= 2 * (line - 1); i++)
{
System.out.print(".");
}
System.out.print("\\");
for (int i = 1; i <= (SUB_HEIGHT - line); i++)
{
System.out.print(" ");
}
System.out.println("|");
}
}
// END hourglass
/*
* printBoxes
*/
public static void printBoxes() {
openBox();
closeBox();
}
public static void openBox() {
System.out.print("+");
for (int i = 1; i <= BOX_WIDTH; i++) {
System.out.print("-");
}
System.out.println("+");
}
public static void closeBox() {
for (int i = 1; i <= HEIGHT; i++) {
System.out.print("|");
for (int j = 1; j <= BOX_WIDTH; j++) {
System.out.print(" ");
}
System.out.println("|");
}
openBox();
}
// END printBoxes
// END METHODS
}// END Designing
<file_sep>/C/CLASSWORK/source/TempConversion1.C
/* <NAME> */
//temperature Converstion
#include<iostream>
using namespace std;
int main() {
// function prototypes
void CtoF();
// @reference int - value of C
void FtoC();
// @reference int - value of F
// variable declarations
int choice =0;
do {
cout<<"\n\nTemperature Conversion"
<<"\n----------------------\n"
<<"1) Fahrenheit to Celcius\n"
<<"2) Celcius to Fahrenheit\n"
<<"3) Quit\n"
<<"Your Choice => ";
cin>>choice;
if (choice==1){
FtoC(); }
if (choice==2){
CtoF();}
} while (choice!=3);
cout<<"\n\n";
return 0;
}
void CtoF() {
double temp, tempConverted;
cout<<"\nDegrees C => ";
cin>>temp;
tempConverted=temp*1.8+32;
cout<<"\n"<<temp<<" Celcius = "<<tempConverted<<" Fahrenheit.";
cout<<"\n\n";
}
void FtoC() {
double temp, tempConverted;
cout<<"\nDegrees F => ";
cin>>temp;
tempConverted=(temp-32)*.5556;
cout<<"\n"<<temp<<" Fahrenheit = "<<tempConverted<<" Celcius.";
cout<<"\n\n";
}
<file_sep>/C/BILGE/src/Bilge.C
/*
<NAME>
After student enters information present testing options
6 bug boxes
at Start of test all bug boxes illuminate red
User has option of saving work and returning later - save data and state
All tests marked red = incomplete
for choice select appropriate test
Display 9 possible solutions for bug
Have user select an answer and check for validity
IF selection is wrong incremet bug counter and display message.
*** FIND OUT what are the alternative teaching methods for distance/online learning that can augment the error checking portion of the app.
IF bug was correctly fixed stop timer and make mark of correct answer and flip bug fix swithces to green.
Offer user list of more bugs.
*/
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
bool bilge(string);
int main()
{
string fname, lname, idNum;
char takeTest = false;
ofstream saveResults;
// string fl;
string StudentID(string, string, string);
int choice = -1;
cout<<"\n\n Bug Boxes Main\n--------------------\n";
cout<<"\n\n***TEST INSTRUCTIONS***\n\n"
<<"\nAre you ready to begin? (y/n) => ";
string again;
getline(cin,again);
takeTest = again.at(0);
if (takeTest=='Y'||takeTest=='y'){
cout<<"\nFirst Name? ";
cin>>fname;
cout<<"Last Name? ";
cin>>lname;
cout<<"Last 2 of EmplID? ";
cin>>idNum;
/*TODO
it would be nice to also get the following:
- class
- section
- professor
That info shoulc be added as a heading on the output file
in the file.
It would also be cool to have the users selection append to the file name. */
saveResults.open(StudentID(fname, lname, idNum)+".txt", ios::app);
cout<<"\nTest Started\n"; //include a timer
} else { cout<<"\n\nThank you.\fGood Bye for now\n"; }
/*
do {
cout<<"\nBilge menu goes here"
<<"\n--------------\n"
<<"\nStudent Name"
<<"\nLast 4 of Student ID#"
<<"\nReady to begin...";
cout<<"\n\tMake sure to include a timer";
cin>>choice;
if(choice ==1 ){
}
//cout<<"Hello "<<lname<<idNum;
//cout<<"\n\nfirst initial "<<fname.at(0);
//string fl = fname.at(0);
//cout<<"\n\n\t first initial "<<fname.at(0);
fl = fname.at(0);
cout<<fl;
//lname = lname.tolower();
//string tester = fl+lname+idNum;
//cout<<"Welcome "<<tester;
// figure out the getLine() here to get user full name
// Open unique file for student using name & ID# as filename args use append to open file
}while (choice != 0);
*/
cout<<"\n\n";
return 0;
}
string StudentID(string f, string l, string id){
//f = f.at(0);
string testing = f.at(0)+l+id;
return testing;
}
<file_sep>/java1/ch01/completedExercises/Mantra07.java
import java.util.*;
/*
* Author: <NAME>
* Professor: <NAME>
* Class: CP 500 02[3995] Introduction to Computer Programming
* Text: Building Java Programs: A Back to Basics Approach. 4th Edition
*
* Briefing - See Appendix 1
* Name of Project
* - Situation
* - Purpose
* - Road Map
* - Project Goals
* - Expected Results
* - Success Criteria
*
* Date Started
* Date Last Touched
*/
public class Mantra07
{
public static void main(String[] args)
{
// System.out.println("\t// Mantra");
printMantra();
printMantra();
}
public static void printMantra()
{
System.out.println();
System.out.println("There's one thing every coder must understand:");
System.out.println("The System.out.println command.");
}
/*
System.out.println("import java.util.*:\n");
System.out.println("public class Meta\n{");
System.out.println("\tpublic static void main(String[] args)\n\t{");
System.out.println("\t\tSystem.out.println(\"Hello World\");\n\t}\n}");
*/
// System.out.println("Hello Kevin--you've installed the template successfully.");
}
/*
* APPENDIX 1
*
* Briefing
* Situation
* Relevant facts and figures. Wikipedia style: who, when, what.
* Purpose
* What is the customer's purpose? Why is the customer doing what they're doing?
* The why. The reason. The driver. The focus.
* Road Map
* What initiatives are planned to pursue the purpose?
* What is planned now, what comes then, what comes later, What comes maybe?
* Project Goals
* Why is the customer coming to you?
* Try to keep this simple. Only one topic!
* Expected Results
* What are the expected results?
* What would the customer like to take home? Define the minimal scope.
* It's better to exceed the minimal scope than to promise a lot and not keep your promise.
* What resources (money, manpower, tools) is the customer ready to make available?
* By when would the customer like the results?
* Success Criteria
* How do we measure the projects success?
* Source: http://www.brainstore.com
*/
// email: <EMAIL>
// <EMAIL>
// www.practiceit.com
<file_sep>/C/SWITCH/Couting.C
#include<iostream>
using namespace std;
int main(){
int count;
int sum = 0;
int factorial = 0;
cout<<"Enter an ending number => ";
cin >>count;
for (int i = 0 ; i <= count; i++) { sum += i; }
//for (int i = 0 ; i <= count; i++) { factorial *= i; }
cout<<"The sum of all numbers from 1 to "<<count<<" is "<<sum;
//cout<<"The sum of all numbers from 1 to "<<count<<" is "<<factorial;
cout<<"\n\n";
return 0;
}
<file_sep>/java1/ch01/Strange2.java
import java.util.*;
// Created by tingansob on 10/29/2017 at 12:17:15 AM
public class Strange2
{
public static void main(String[] args)
{
first();
third();
second();
third();
test();
}
public static void first() {
System.out.println("Inside first method.");
}
public static void second() {
System.out.println("Inside second method.");
first();
}
public static void third() {
first();
second();
System.out.println("Inside third method.");
}
public static void test()
{
System.out.println("\n\tTesting Self Check 2.17 maxMin");
int max;
int min = 10;
max = 17 - 4 / 10;
max = max + 6;
min = max - min;
System.out.println(max * 2);
System.out.println(max + min);
System.out.println(max);
System.out.println(min);
}
}
<file_sep>/java1/Java2/homework/creditCard/NOTES.txt
How do I create a complex card number. An int is too small for a 16 digit number and a I don't need any fractional part for a double. Most credit cards have card numbers broken into a series of 4/5 digit numbers seperated by a space. I know there's some algorhytm that allows for that unique number creation. Any suggestions? I created the app using a small ID number...starting with 1.
modifiers
- set name
- setMemberPoints
- setSpendingLimit
- setInterestRate
increase member points
<file_sep>/C/navigate.C
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
while(true){
int ftHrs=40, hrsW, oTime, numD;
bool dep=(false), otH;
double rate=18.28,
ot=rate+(rate/2),
ss=.06,
fed=.13,
state=.05,
uDue=11.00,
grossPay,
netPay,
ftPay=ftHrs*rate;
cout << "How many hours worked? ";
cin >> hrsW;
if (hrsW>ftHrs)
{
oTime=hrsW-ftHrs ;
double overTimePay=oTime*ot;
grossPay=ftPay+overTimePay;
cout << "Gross Pay of "<<grossPay<<" : "<<ftHrs<<" hours @ "<<rate<<"/hr\n";
cout << "Including "<<overTimePay<<" : "<<oTime<<" hours @ "<<ot<<"/hr\n";
} else if (hrsW<1) {
cout << "That is not a valid answer, please try again.\n";
} else if (hrsW<=ftHrs){
grossPay=hrsW*rate;
break;
cout << "Gross Pay of "<<grossPay<<" for "<<hrsW<<" hours worked.\n";
}
cout << "How many dependents? ";
cin >> numD;
}
cout<<"\n\n";
return 0;
}
<file_sep>/java1/Java2/STRINGSWORK/STest.java
import java.util.*;
public class STest{
// MAIN
public static void main(String[] args){
Scanner in = new Scanner(System.in);
space();
System.out.println("\nWelcome "+getName(in));
space(4);
} // END main
// METHODS
// get user name
public static String getName(Scanner in){
System.out.print("Please enter your name: ");
return in.nextLine(); }
// generate spaces - overloading the space() method
public static void space(){System.out.println();}
public static void space(int x){for (int i=1;i<=x;i++)System.out.println();}
}
<file_sep>/C/README/MOVING.C
#include<windows.h>
#include<iostream>
#include<conio.h>
#include<cstdlib>
using namespace std;
void Coordinate(int x1,int y1)
{
COORD pos = {x1,y1};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
cout<<"X";
}
int main()
{
int x,y;
l1: for(int x = 1 ; x<=10 ; x++)
for(int y = 1 ; y <= 10; y++)
{
Coordinate(x,y);
cout<<"X";
for(int delay=1;delay<=10000000;delay++);
}
for(int x = 10 ; x>=1 ; x--)
for(int y = 10 ; y >= 1; y--)
{
Coordinate(x,y);
cout<<".";
for(int delay=1;delay<=100000000;delay++);
}
goto l1;
return 0;
}
<file_sep>/C/eclipse/KBCCHonors/Puppies.cpp
/*
* Puppies.cpp
*
* Created on: Apr 17, 2018
* Author: tingansob
*/
#include "Puppies.h"
Puppies::Puppies() {
// TODO Auto-generated constructor stub
}
Puppies::~Puppies() {
// TODO Auto-generated destructor stub
}
<file_sep>/java1/README.md
Java Homework
=======
>
> ### [Kingsborough Community College](http://www.kingsborough.edu)
> **Introduction To Computer Programming: CP500 - Java 1**
>
> Textbook: Building Java Programs *A Back To Basics Approach* 4th Edition\
> Author: <NAME> & <NAME>
>
> Professor: <NAME>
>
Hello World,\
I'm creating this site to share my work with my fellow students. I'm trying to learn programming so that I can augment my skills as a System Administrator. If you stop by and read this leave me some notes...I'd love to hear from you.
###### THINGS TO DO
- [x] figure out how to write markdown to fix this README file
- [x] Include my test dir and my ruby code
- [ ] Orgaize files with better names that reference chapter titles and numbers
- [ ] Become proficient in manipulating control structures
- [ ] Go out to celebrate at the end of the week!
----
> **Dev sites**
> - [Code Step By Step](http://www.codestepbystep.com)
Today's homework:
###### Triangles with for loops

Today I came to appreciate comments
----
> Fri Nov 10, 2017 3:37PM EST
I've written so much code that when I look back at it I am lost. I can see a direct need for well documented code, as well as making variables that are easy to understand and read, thus making it easy for revew.\
I add comments to all my work, I just fail to document more thoroughly. I had studied a bit of technical wirting while at Bloomberg and I do have a penchant for prose...\
Perhaps what I need to do is spend more time while creating my work adding comments that are more narrative and interesting so they provide the person following with quality information and useful directions.
### The Audience
It's just as important to know what to say as it is to know how to say it, but none of that is of any use if it's not useful to the reader. You have to know your audience.
- Who is my audience?
- What is my subject?
- What is the purpose of this documentation?
- What is the scope?
<file_sep>/C/CLASSWORK/structs.C
#include<iostream>
#include<string>
using namespace std;
int main()
{
struct employee
{ string name;
int id ;
char gender;
};
struct contractor
{ string name;
int id ;
char gender;
};
int choice , count=0 ;
char t;
employee fullTime[1000];
employee contractor[1000];
do{cout<<"\n\nHR Database\n-----------"
<<"\n1)Add new employee"
<<"\n2)Print Employee Database"
<<"\n3)Go to All Contract employees"
<<"\n4)Quit\n\nYour selection? ";
cin>>choice;
if(choice==1)
{count++;
cout<<"\nEmployee "<<count<<" name? ";
cin.ignore();
getline(cin,fullTime[count].name);
//cin>> fullTime[count].name;
cout<<"\nEmployee "<<count<<" ID ? ";
cin>> fullTime[count].id;
cout<<"\nEmployee "<<count<<" gender ? ";
cin>> fullTime[count].gender;
cout<<"\n\nDATABASE UPDATED \n\n";
}
if(choice==2) {
cout<<"Full Time (f) or Contractors (c) ";
cin>>t;
if (t=='f') {
cout<<"\n\n--FULL TIME-------------------------";
cout<<"\n\nID\tgender\tName\n--\t------\t----";
for(int i=1 ; i<=count ; i++)
cout<<"\n"<<fullTime[i].id
<<"\t"<<fullTime[i].gender
<<"\t"<<fullTime[i].name;
cout<<"\n\n------------------------------------"; }
if (t=='c') {
cout<<"\n\n--CONTRACTORS----------------------";
cout<<"\n\nID\tgender\tName\n--\t------\t----";
for(int i=1 ; i<=count ; i++)
cout<<"\n"<<contractor[i].id
<<"\t"<<contractor[i].gender
<<"\t"<<contractor[i].name;
cout<<"\n\n------------------------------------"; }
}
if(choice==3)
{
cout<<"Transferring all Full Time Employees to contractors. ";
for (int i=1;i<=count; i++ ){ contractor[i].name = fullTime[i].name; contractor[i].id = fullTime[i].id;
contractor[i].gender = fullTime[i].gender;
cout<<"\nClearing Full Time Records";
fullTime[i].name = " ";
fullTime[i].id = 0;
fullTime[i].gender = ' ';
cout<<"\nDone\n";
}
}
}while(choice!=4);
cout<<"\n\n";
return 0;
}
<file_sep>/java1/sandbox/js/codek.tv/script.js
function substitute() {
var myValue = document.getElementById('myTextBox').value;
if (myValue == 0) {
alert('Please enter a value in the text box!');
return;
}
var myTitle = document.getElementById('title');
myTitle.innerHTML = myValue;
}
function circle() {
}
<file_sep>/java1/ch01/completedExercises/TextManipulation.java
// Import the entire java.utilities - We're not using this now but it's a good habit to get into for the future.
import java.util.*;
/*
This is the start of my application called ESCAPE. This is my homework/testing of the print & println commands with the use of escape sequences and characters. I have a few questions for the professor so I'll ask her in class today.
*/
public class TextManipulation
{
public static void main(String[] args)
{
// the basic "Hello World" line
System.out.println("Hello World!\n");
// expanding on yesterday's work.
System.out.println("Today's lesson was about the difference between \"print\" and \"println\".\n");
System.out.println("For Instance:\n");
System.out.println("\tPRINT\f");
System.out.print("This is an example of a line using the \"print\" command which does not have a natural carriage return at the end. Hence the cursor would naturally stop here.");
System.out.println(" ----- This is just the next line in the program but it will be appended to the previous line because of the \"print\" command from the previous line.\n");
System.out.println("As a result, if you wanted to get a new line but didn't want to use \"println\" you could use a \"\\n\" newline escape sequence.\n");
System.out.println("So in my research I've found the following excape sequences:\n\n");
System.out.println("\\b backspace \t \\f formfeed \t \\n linefeed \t \\r carriage return \t \\t horizontal tab \t \\' \\\" single and double quotes as well as the \t \\ backslash\f\f");
// The formatting above is horrible. I figured I could do better. I wonder if there's a way to number or bullet the lines.
// TODO Find out how to format lists
System.out.println("I could format that better:");
System.out.println("\t\\b backspace");
System.out.println("\t\\f formfeed");
System.out.println("\t\\n linefeed");
System.out.println("\t\\r carriage return");
System.out.println("\t\\t horizontal tab");
System.out.println("\t\\' single quotes");
System.out.println("\t\\\" double quotes");
System.out.println("\t\\\\ backslash\f");
// QUESTION discuss the following issues in class...as well as research them on my own
// NOTE the \f line feed escape produces strange - often unpredictable results. I have to figure out what that's about.
System.out.println("Things to discuss with the teacher:");
System.out.println("\tWhat if we want to print a list?");
System.out.println("\tWhat is the PrintStream method?");
System.out.println("\tHow do we see all the options/args in a method?");
System.out.println("\tRegarding the \"printf\" command, how does it work?");
System.out.println("\tWhat is the difference between printf and format commands?");
}
}
<file_sep>/java1/Java2/homework.java
import java.util.*;
public class homework {
public static void main(String[] args){
/*
int [] array = {20, 8, 6, 2, 15, 10};
for (int i = 0; i < array.length; i++)
{
array[i] = array[i] / array[0];
}
for(int i = 0; i < array.length; i++)
System.out.print(array[i]+" ");
int [] array = {20, 8, 6, 2, 15, 10};
int sum = 0;
for (int i = 0; i < array.length; i++)
sum += array[i];
for (int i = 0; i < array.length; i++)
array[i] = (int)(((double)array[i]) / sum * 100);
for(int i = 0; i < array.length; i++)
System.out.print(array[i]+" ");
*/
String str1 = "Java Programming";
String str2 = "Arrays are fun!";
String str3 = "Hello";
System.out.println(str3.substring(2)+str1.substring(10, 11)+str2.substring(3, 6)+str1.substring(13, 16));
System.out.println(str2.indexOf("!"));
str2.replace("are","is");
System.out.println(str2);
String s1="my name is khan my name is java";
String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"
System.out.println(replaceString);
}
}
<file_sep>/C/GAMES/Oscar.C
//Text Adventure Copyright (c) 2018 by <NAME>
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int talk();
int fight();
int run();
int main()
{
char again;
do
{
char choice;
cout<<"You are being mugged in a dark alley. What do you do?"
<<endl<<"A. Talk"<<endl<<"B. Fight"<<endl<<"C. Run"<<endl;
cin>>choice;
cout<<endl;
if (choice=='a' || choice=='A')talk(); //Starts 'talk' scenario
if (choice=='b' || choice=='B')fight(); //Starts 'fight' scenario
if (choice=='c' || choice=='C')run(); //Starts 'run' scenario
cout<<endl<<"Play again? (Y/N)"<<endl;
cin>>again;
}while (again=='y' || again=='Y'); //Replay loop
}
int talk() //Talk scenario.
{
int chance;
char choice, choice2;
srand (time(0)); //Random number generator for some choices.
cout<<"Robber: Give me your money or else!"<<endl<<endl
<<"A. Try to convice him it is not worth it."<<endl
<<"B. Tell him you have no money."<<endl
<<"C. Tell him you'll help him rob someone else."<<endl;
cin>>choice;
cout<<endl;
if (choice=='a' || choice=='A')
{
chance=rand()%2+1; //Random number decides ending. Either 1 or 2 for this choice. Some choices have more randomness.
if (chance==1)cout<<"You: Listen, man. I've got no time for this. Let me go."<<endl<<"The mugger shoots you.";
if (chance==2)cout<<"You: Is this what you want to do all your life? You're better than this."<<endl
<<"Robber: Y'know what, you right. I'm better than this."
<<"The robber leaves."<<endl;
}
if (choice=='b' || choice=='B')
{
cout<<"Robber: Okay then, give me your clothes."<<endl
<<"A. No."<<endl
<<"B. Okay."<<endl
<<"C. How about I trade you my clothes?"<<endl;
cin>>choice2;
if (choice2=='a' || choice2=='A')cout<<"The robber shoots you and steals your clothes. He then washes the blood off when he gets home.";
if (choice2=='b' || choice2=='B')cout<<"You strip and give the robber your clothes and he walks away. At least you didn't die, right?";
if (choice2=='c' || choice2=='C')
{
chance=rand()%2+1;
if (chance==1)cout<<"Robber: Hm... Okay."<<endl
<<"You and the robber part way with a new(?) set of clothes each.";
if (chance==2)cout<<"Robber: How 'bout I shoot you and take your clothes?"<<endl
<<"You died AND lost your clothes";
}
}
if (choice=='c' || choice=='C')
{
cout<<"Robber: Do you have any experience robbing people?"<<endl
<<"You: My professor says I'm a fast learner."<<endl;
chance=rand()%2+1;
if (chance==1)cout<<"Robber: Fine, let's go, my protege."<<endl;
if (chance==2)cout<<"Robber: Consider this your first and only lesson. Make your target listen to the guy the with the gun and give them no second chances."<<endl
<<endl<<"Your new professor demostrates what he means on you.";
}
}
int fight() //Fight scenario
{
int chance;
char choice, choice2, choice3;
srand (time(0));
cout<<"Robber: Give me your money or else!"<<endl<<endl
<<"A. 'Else what?' "<<endl
<<"B. Punch him."<<endl;
cin>>choice;
cout<<endl;
if (choice=='a' || choice=='A')
{
cout<<"Robber: What do you mean 'else what'? I have a gun, idiot."<<endl
<<"A. 'So? I got these two!' (Kiss your biceps)"<<endl
<<"B. Try to take his gun."<<endl;
cin>>choice2;
if (choice2=='a' || choice2=='A')
{
cout<<"Robber: You ain't gonna do anyth--"<<endl
<<"A. Punch him"<<endl
<<"B. Kick him"<<endl
<<"C. Let him finish"<<endl;
cin>>choice3;
if (choice3=='a' || choice3=='A')cout<<"You caught him off guard and knocked him out. Nice.";
if (choice3=='b' || choice3=='B')cout<<"You kick him in the groin and knocked him down."<<endl
<<"You: I also got these two! (You kiss your legs and walk away from him"<<endl;
if (choice3=='c' || choice3=='C')cout<<"Robber:...thing against a gun."<<endl
<<"(The robber shoots you since you did nothing)"<<endl
<<"Robber:See?"<<endl;
}
if (choice2=='b' || choice2=='B')
{
chance=rand()%2+1;
if (chance==1)
{
cout<<"You manage to take his gun. What do you do now?"<<endl
<<"A. Rob him."<<endl
<<"B. Tell him to run away."<<endl;
cin>>choice3;
if(choice3=='a' || choice3=='A')cout<<"You robbed him and now you have $20. Dick move.";
if(choice3=='b' || choice3=='B')cout<<"The robber runs away and now you have a brand new gun.";
}
if (chance==2)cout<<"While wrestling him, the gun went off and hit both of you after ricocheting off the walls. What poor luck.";
}
}
if (choice=='b' || choice=='B')
{
chance=rand()%2+1;
if (chance==1)cout<<"You catch the robber off guard and knock him out. Nice one.";
if (chance==2)cout<<"You sucker punch the robber causing him to drop his gun. However, the gun goes off and hits you. At least you tried.";
}
}
int run() //Run scenario
{
int chance;
char choice, choice2, choice3;
srand (time(0));
cout<<"Robber: Give me your money or else!"<<endl<<endl
<<"A. Run away now."<<endl
<<"B. Distract him."<<endl;
cin>>choice;
cout<<endl;
if (choice=='a' || choice=='A')
{
chance=rand()%2+1;
if (chance==1)cout<<"You managed to run away without getting shot.";
if (chance==2)cout<<"While running away the robber shoots you in the leg and then robs you."<<endl
<<"Robber: You tried.";
}
if (choice=='b' || choice=='B')
{
cout<<"How do you distract him?"<<endl
<<"A. 'The cops are behind you!'"<<endl
<<"B. 'There's another robber behind you!'"<<endl
<<"C. Sneeze on him."<<endl;
cin>>choice2;
if (choice2=='a' || choice2=='A')
{
chance=rand()%3+1;
if (chance==1)cout<<"Robber: Nice try, idiot. I'm not fall--"<<endl
<<"A cop quietly rushes up behind him and knocks him out. Looks like you don't have to run away now.";
if (chance==2)cout<<"Robber: Nice try, idiot. I'm not falling for that!"<<endl
<<"The robber shoots you. Dead end.";
if (chance==3)cout<<"Robber: Huh?"<<endl
<<"The robber spots the cops and takes you hostage. Let's just say it doesn't end well for you.";
}
if (choice2=='b' || choice2=='B')
{
chance=rand()%4+1;
if (chance==1)cout<<"A second robber comes up behind your robber and robs him."<<endl
<<"2nd Robber: You owe me one. Get outta here."<<endl;
if (chance==2)cout<<"Your rubber spots the second robber and shoots him. You take this opportunity to run away."<<endl;
if (chance==3)cout<<"A second robber comes up behind your robber and robs him."<<endl
<<"He then tries to rob you, but you're already long gone."<<endl;
if (chance==4)cout<<"A second robber comes up behind your robber and robs him."<<endl
<<"He then robs you because you stood there watching."<<endl;
}
if (choice2=='c' || choice2=='C')
{
cout<<"Robber: What the hell?!"<<endl;
chance=rand()%2+1;
if (chance==1)cout<<"You sneezed on his gun and he dropped in disgust. You take the opportunity to run away. Gross. Nice, but gross.";
if (chance==2)cout<<"You sneezed on his shirt and the robber shoots you in disgust."<<endl
<<"Robber: Ew!";
}
}
}
<file_sep>/SANDBOX/java-1-basics/Exercise1.java
import java.util.*;
public class Exercise1{
public static void main(String[] args){
String[] nums = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};
System.out.println("*************");
for (int i = 0; i<=nums.length-1; i++){
System.out.println("* "+(i+1)+" * "+nums[i]+" *");
//System.out.println(nums[i]);
}
System.out.println("*************");
}
}
<file_sep>/go/helloIsh.go
package main
import (
"fmt"
)
func main() {
//var i int
//i = 42
var j int = 58
//k := 99
fmt.Printf("%v, %T\n", j, j)
}
<file_sep>/C/TERNIARY/AgeTest.C
#include<iostream>
using namespace std;
int main(){
int age;
cout<<"What is your age? ";
cin>>age;
/*
if (age>=18){
cout<<"You have 0 years left to vote.";
} else cout<<"You have "<<(18-age)<<" years left to vote";
*/
int toVote = (age>=18 ? 0 : 18-age );
cout<<"Wait "<<toVote<<" year(s) to vote";
cout<<"\n\n";
return 0;
}
<file_sep>/C/GAMES/Kagna.C
//Copyright (c) 2018 by KagnaKellyPatapauAnas
//<NAME>
//<NAME>
//<NAME>
//<NAME>
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<ctime>
using namespace std;
double hp = 100; //att = 5+rand()%5 , def = 5+rand()%5;
int moved = 0;
char input[256];
bool gameOver();
void getEvent(int,int);
void getFruit(int);
void getTree(int);
void getDeer(int);
void getCougar(int);
void getBear(int);
void getStream(int);
void getCabin(int);
void getTrap(int);
void getCamp(int);
void getSnake(int);
void getMan(int);
void getPond(int);
int main(){
srand(time(0));
cout << "\nYou find yourself at the entrance of a forest.";
while ( true ){
cout << "\n\nHP: " << hp; //<< "\nAtt: " << att << "\nDef: " << def;
cout << " Distance: " << moved;
cout << "\nMove forward?(y/n) ";
cin >> input;
if (input[0] == 'y' || input[0] == 'Y'){
getEvent(rand()%6+1,rand()%6+1);
} else if (input[0] == 'n' || input[0] == 'N'){
if (gameOver()) continue;
break;
} else {
cout << "Invalid input";
}
if(hp <= 0){
if (gameOver()) continue;
break;
}
}
return 0;
}
void getEvent(int fDice, int sDice){
cout << "\n\nDice Roll: " << fDice << " " << sDice
<< "\nYou move " << fDice+sDice << " spaces.";
moved = moved + fDice + sDice;
cout << "\n\n\nYou walk for half a day....";
int randChance = rand()%3;
int rEvent = fDice+sDice+randChance;
if (rEvent == 2) getCougar(randChance); //Cougar
else if (rEvent == 3) getCabin(randChance); //Cabin
else if (rEvent == 4) getPond(randChance); //pond
else if (rEvent == 5) getSnake(randChance); //snake
else if (rEvent == 6) getCamp(randChance); //Campsite
else if (rEvent == 7) getTree(randChance); //Fallen Tree
else if (rEvent == 8 || rEvent == 9)
cout << "\nBut nothing happened\n";
else if (rEvent == 10)getFruit(randChance); //Fruit
else if (rEvent == 11)getStream(randChance); //Stream
else if (rEvent == 12)getDeer(randChance); //Deer
else if (rEvent == 13)getTrap(randChance); //Trap
else if (rEvent == 14)getMan(randChance); //Deadman
else if (rEvent == 15)getBear(randChance); //Bear
}
bool gameOver(){
system("cls"); //on windows
// system("clear"); //on linux
cout << "\nYou travelled "<< moved << " space(s)."
<< "\nTry Again?(y/n) ";
cin >> input;
if (input[0] == 'y' || input[0] == 'Y') {
hp = 100;
//att = 5+rand()%5;
//def = 5+rand()%5;
moved = 0;
system("cls"); //on windows
// system("clear"); //on linux
cout << "\nYou find yourself at the entrance of a forest.";
return true;
} else {
return false;
}
}
void getFruit(int randChance){
cout << "\nYou've found some berries, ";
if(randChance == 0){
cout << "they're edible.\t+10 hp";
hp+=10;
} else if(randChance == 1){
cout << "they're poisonous.\t-10 hp";
hp-=10;
} else {
cout << "but nothing happened.";
}
}
void getTree(int randChance){
cout <<"\nYou find a fallen tree, ";
if(randChance == 0){
cout <<"you make a shield from its bark!\nYou feel stronger!";
} else if(randChance == 1){
cout <<"you use it to cross a chasm!";
moved=moved+5;
} else {
cout <<"nothing interesting happens.";
}
}
void getTrap(int randChance){
cout <<"\nSNAP!!! A trap goes off!\n";
if(randChance == 0){
cout <<"It crushes your leg!\t-25hp";
hp=hp-25;
} else if(randChance == 1){
cout <<"It's broken, you live another day.";
} else {
cout <<"Through deft skill you avoid the trap, congratulations.";
}
}
void getBear(int randChance){
cout <<"\nYou turn around and a bear is standing in front of you!";
if(randChance == 0){
cout<<"\nThe bear doesn't notice you, lucky.";
} else if(randChance == 1){
cout<<"\nYou flee at top speed.";
moved=moved-7;
} else {
cout<<"\nYou get slashed! -75hp";
hp=hp-75;
}
}
void getPond(int randChance){
cout <<"\nYou come across a small pond, ";
if(randChance == 0){
cout <<"you decide to bathe, you feel clean";
} else if(randChance == 1){
cout <<"you catch some fish! +15hp";
} else {
cout <<"your longtime fear of sharks repels you from the body of water.";
moved=moved-10;
}
}
void getStream(int randChance){
cout <<"\nYou hear a stream nearby, ";
if(randChance == 0){
cout <<"you hazard a dip, and the river pulls you downstream! You've moved 15 spaces back";
moved = moved-15;
} else if(randChance == 1){
cout <<"you slip on some wet rocks. -25hp, and your dignity";
} else {
cout <<"you walk along the stream. You move 10 spaces forward.";
moved = moved + 10;
}
}
void getSnake(int randChance){
cout <<"\nSnakes, why'd it have to be snakes!\nA snake blocks your path.";
if(randChance == 0){
cout <<"\nYou stare intensely at the snake, nothing happens";
} else if(randChance == 1){
cout <<"\nIt strikes! -40hp.";
hp=hp-20;
} else {
cout <<"\nYou kill the snake, and consume it. +15hp";
hp=hp+15;
}
}
void getDeer(int randChance){
cout <<"\nYou see a deer on the trail ahead of you, ";
if(randChance == 0){
cout <<"you run after it and kill it, moving 10 spaces forward and gaining 20hp";
moved = moved + 15;
hp = hp + 20;
} else if(randChance == 1){
cout <<"it flees!";
} else {
cout <<"you try to chase it down, but its long gone, you move 20 spaces forward";
moved = moved + 20;
}
}
void getMan(int randChance){
cout <<"The corpse of a man who met a fate much worse than yours is on the trail ahead of you ";
if(randChance == 0){
cout <<"you ransack his corpse, finding some beef jerky. +10hp";
hp = hp + 10;
} else if(randChance == 1){
cout <<"an eerie noise can be heard in the distance, it scares you back.";
moved = moved - 10;
} else {
cout <<"you contemplate your own mortality";
}
}
void getCougar(int randChance){
cout <<"\nThe bushes near you shake, a cougar attacks!";
if(randChance == 0){
cout <<"\nYour years in scouts haven't prepared you for this, you die.";
hp = 0;
} else if(randChance == 1){
cout <<"\nYou sprint as far as you can in the other direction, moving 40 spaces back";
moved = moved - 40;
} else {
cout <<"\nIt strikes! You take heavy damage!";
hp = hp - 50;
if(hp>0)cout <<"You live another day.";
}
}
void getCamp(int randChance){
cout <<"\nYou come across an abondoned camp, ";
if(randChance == 0){
cout <<"and find some food. +10hp";
hp=hp+10;
} else if(randChance == 1){
cout <<"and take some long deserved rest. +20hp";
hp=hp+20;
} else {
cout <<"and eat some spoiled food. -15hp";
hp=hp-15;
}
}
void getCabin(int randChance){
cout <<"\nYou find an old cabin, ";
if(randChance == 0){
cout <<"its empty.";
} else if(randChance == 1){
cout <<"there's some food in the pantry";
hp=hp+10;
} else {
cout <<"someone's left a stew on, you steal some.";
hp = hp+10;
}
}
<file_sep>/C/POINTERS/main.cpp
#include<iostream>
using namespace std;
void RaiseToPower() (int, int, int);
int main() {
cout<<"\n\n";
return 0;
}
<file_sep>/Eclipse/MainFoo/Puppies.java
//import java.util.*;
public class Puppies
{
public static void main(String[] args) {
Dog fido = new Dog();
Dog sparky = new Dog("Pekingese", 10);
Dog max = new Dog("Bulldog", 45);
sparky.bark();
fido.bark();
max.bark();
}// END main
}// END class Puppies
<file_sep>/C/GAMES/Adan.C
//Copyright (c) 2018 by <NAME> Adan
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
// declaring function for hit power
//int power( int str, int def);
int command;
class character
{
public:
character();
//~character();
string name;
float str;
float def;
float health; // hit points
float regen; // health regen amount
float roll; // for random value
float ouch; // amount of attack damage
float getAttack(character& opponent);
float getHeal(void);
void setRegen(float reg);
bool IsAlive() const;
//void setHeal(float healAmt);
private:
};
character::character()
{
str = rand() % 30 + 5;
def = rand() % 30 + 5;
health = 100;
//Output to check the constructor is running properly
cout<< "Character has been created.\n";
}
bool character::IsAlive() const
{
return health > 0.0f;
}
void character::setRegen( float reg )
{
regen = reg;
}
float character::getAttack(character& opponent)
{
//defines the magnitude/power of attack
//function shows how much damage is inflicted
// ouch is how much damage is done
roll = rand() % 20 + 1; // range between 1 &20
if (roll <= 11)
{
ouch = str - (def /2);
}
else if ((roll <= 17) && (roll >= 12))
{
ouch = (str * 2) - (def / 2);
}
else if ((roll <= 20) && (roll >= 18))
{
ouch = (str * 3) - (def / 2);
//cout << "CRITICAL HIT!!";
}
opponent.health -= ouch;
return ouch;
}
float character::getHeal()
{
//this is what happens when you chose to heal
regen = rand() % 20 + 3;
cout << "regen value= " << regen<< ".\n";
health += regen;
return regen;
}
/*character::~character()
{
str = 0;
def = 0;
health = 0;
// Output to check the destructor is running properly
cout << "Character has been destroyed\n";
} */
int main()
{
srand(time_t(NULL));
//Class objects
character user, computer;
//Hard code in a name for the computer's player
computer.name = "ZOID\n";
float attackDamage;
float healthAdded;
user.setRegen(42.0);
//Recieve data for the user's player
cout<< "Please enter a name for your character:\n";
cin>> user.name;
//Output name and stats to the user
cout<< "\nYour name is: " << user.name << endl;
cout << "here are your statistics: \n"
<< "strength: " << user.str << endl
<< "Defense: " << user.def << endl
<< "Health: " << user.health << endl;
cout<< "oh no an oppenent appeared!!!\n";
cout<< "you will have to fight him!" << endl<< endl;
cout << "opponent's health: 100" << endl;
while (user.IsAlive() && computer.IsAlive())
{
cout << "Str: " << user.str << "\t"
<< "Def: " << user.def << "\t"
<< "Health: " << user.health << "\t"
<< "\n";
cout << "what would you like to do: heal (1), attack(2), or run(3).\n";
cin>> command;
switch(command)
{
case 1 :
healthAdded = user.getHeal();
cout<< ""<<user.name <<" has regenerated " << healthAdded << " health.\n";
break;
case 2 :
attackDamage = user.getAttack(computer);
cout << "" <<user.name <<" did " << attackDamage << " damage to the opponent!\n";
break;
case 3:
cout<< ""<<user.name<<" got away!\n";
break;
default:
cout<< "Please enter a valid choice!";
} //end switch
cout<<"Play again ? " << endl;
}
return 0;
}
<file_sep>/C/eclipse/FooTesting/src/Makefile.am
bin_PROGRAMS=a.out
a_out_SOURCES=FooTesting.cpp
<file_sep>/java1/sandbox/java/java_teachersCode/badKeyboard.java
import java.util.*;
public class badKeyboard
{public static void main(String [] args)
{int temp;
Scanner in = new Scanner(System.in);
System.out.print("Please enter temperature setting (0 to exit): ");
temp=in.nextInt();
while(temp!=0)
{while(temp<0||temp>999)
{System.out.print("INVALID TEMPERATURE \nPlease re-enter temperature setting: ");
temp=in.nextInt();
}
if(!goodDigits(temp))
reportBad(temp);
else
reportGood(temp);
System.out.print("\nPlease enter temperature setting(0 to exit): ");
temp=in.nextInt();
}
}
public static boolean goodDigits(int temp)
{int d1,d2,d3;
d1=temp%10;
d2=temp/10%10;
d3=temp/100;
if(d1==1||d2==1||d3==1||d1==4||d2==4||d3==4||d1==7||d2==7||d3==7)
return false;
else
return true;
}
public static void reportBad(int temp)
{int large,small;
small=temp-1;
while(!goodDigits(small))
{small--;
}
large=temp+1;
while(!goodDigits(large))
{large++;
}
System.out.println("The keypad circuitry is not working properly.");
System.out.println("The temperature setting of "+temp+" does not work.");
System.out.println("The next smallest temperature is "+small+".");
System.out.println("and the next largest temperature is "+large+".");
}
public static void reportGood(int temp)
{System.out.println("The temperature will be set to "+temp+".");
}
}
<file_sep>/java1/Java2/Testing.java
import java.util.*;
public class Testing {
public static void main(String[] args) {
int [] a1 = {1, 2, 3, 4, 5, 6};
int [] a2 = {5, 10, 15, 20, 25};
for(int i = 0; i < a1.length; i++)
a1[i] = a1[i] + a2[i % (a2.length)];
for(int i = 0; i < a1.length; i++)
System.out.print(a1[i]+" ");
}
}
<file_sep>/java1/ch02/ClassWork1030.java
import java.util.*;
/*
* Created by tingansob on 10/30/2017 at 11:49:08 AM
* Assignment:
*
*/
public class ClassWork1030 // Application name
{
public static void main(String[] args) // Beginning of main method
{
System.out.println("This comes before the loop");
int i;
for (i =1; i <=5 ; i++)
{
System.out.println(i);
System.out.println("Done");
i++;
}
} // END main
} // End of application
/*
*
*/
<file_sep>/java1/Java2/STRINGSWORK/test.java
/* Created by tingansob on 04/09/2018 at 09:52:17 AM */
import java.util.*;
public class test{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String name=helloWorld(in);
System.out.println("\nHello "+name);
} // END main
/* METHODS */
/* @helloWorld --- get user input and return as name */
public static String helloWorld(Scanner in) {
System.out.print("\nHello, what is your name? ");
return in.nextLine();
} // END helloWorld
public static void space(){System.out.println();}
public static void space(int x){for(int i=1;i<=x;i++)System.out.println();}
} // END class
<file_sep>/C/code/guessNumber.cpp
// <NAME>
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
srand(time(0));
int sn=6, tally=0, guess;
sn=rand()%100+1;
do{
cout << "\n\nWhat's your guess? ";
cin >> guess;
if (guess<sn) cout <<"\nHigher!!";
if (guess>sn) cout <<"\nLower!!";
tally++;
}while(guess!=sn);
cout << "\n\nYou got it";
cout << "\n\nIt only took you "<<tally<<" guess(es) to figure it out.";
cout << "\n\n";
return 0;
}
<file_sep>/C/Untitled.cpp
// <NAME>
#include<iostream>
using namespace std;
int squares();
int rectangles();
int circles();
int main{
int a, b, choice=0;
do {
cout<< "\n\nGeometry Solver"
<<"\n---------------"
<<"\n1. Squares"
<<"\n2. Rectangles"
<<"\n3. Circles"
<<"\n4. QUIT";
cout
}while (choice!=4);
}
<file_sep>/c/src/hello.c
#include<stdio.h>
int main(int argc, char *argv[])
{
int i = 0;
printf("Content-typ:text/plain\n\n");
printf("Hello, you are learning C!\n");
printf("Number of arguments to the main function.%d\n",argc);
for(i=0;i<argc;i++)
{
printf("argument number %d is %s\n",i,argv[i]);
}
return 0;
}
<file_sep>/C/FILE_IO/Songs.cpp
// CS13 Fall 2013 - File Operations techniques demonstration
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
using namespace std;
void addSong(void);
void listSong(void);
void searchSong(void);
void deleteSong(void);
int main()
{
int x = 0;
while (x < 5) {
cout << "My Music Database\n"
<< "-----------------\n\n"
<< "Options\n"
<< "-------\n"
<< "1. Add a new song.\n"
<< "2. Display my song list.\n"
<< "3. Search for a song.\n"
<< "4. Delete a song.\n"
<< "5. Quit.\n\n"
<< "Enter choice: ";
cin >> x;
cin.ignore();
switch (x)
{
case 1:
{
addSong();
break;
}
case 2:
{
listSong();
break;
}
case 3:
{
searchSong();
break;
}
case 4:
{
deleteSong();
break;
}
}
cout << "\n\n\n";
}
cout << "\n\n\n";
return 0;
}
void addSong (void)
{
ofstream SongListIn ("mysongs.txt", ios::app);
string line;
int x;
cout << "How many songs? ";
cin >> x;
cin.ignore();
for (int songNum = 1 ; songNum <= x ; songNum++)
{
cout << "\nSong name? ";
getline (cin, line); //gets entire line instead of one word
SongListIn << line << "\n"; //delimiter default is \n
}
SongListIn.close();
}
void listSong (void)
{
ifstream SongListOut ("mysongs.txt");
string line;
if (SongListOut.is_open())
{
while (SongListOut.good()) //true until end of file
{
getline (SongListOut, line);
cout << "\n" << line;
}
}
else cout << "\nUnable to open file";
SongListOut.close();
}
void searchSong (void)
{
ifstream SongListSearch ("mysongs.txt");
string search, line;
if (SongListSearch.is_open())
{
cout << "Song name? ";
getline (cin, search);
while (SongListSearch.good())
{
getline (SongListSearch, line);
if (line.find (search) != string::npos) //As a return value, it is usually used to indicate no matches.
{
cout << "\nSong found.";
break;
}
if (!SongListSearch.good())
cout << "\nSong not found.";
}
}
else cout << "\nUnable to open file.";
SongListSearch.close();
}
void deleteSong (void)
{
ifstream SongListDelete ("mysongs.txt");
ofstream temp ("temp.txt");
string del, line, deleted;
bool flag = false;
cout << "Song name? ";
getline (cin, del);
if (SongListDelete.is_open())
{
while (getline(SongListDelete,line))
{
if (line != del) //reads every line to a new file except the one entered
temp << line << "\n";
else
{
flag = true;
deleted = line;
}
}
if (flag) cout << "\nSong \"" << deleted << "\" found and deleted.";
else cout << "\nSong not found.";
}
else cout << "\nUnable to open file.";
SongListDelete.close();
temp.close();
remove("mysongs.txt");
rename("temp.txt","mysongs.txt");
}
<file_sep>/java1/Java2/CLASS_WORK/PointMain.java
import java.util.*;
public class PointMain{
public static void main(String[] args){
Point p1 = new Point(7, 2);
Point p2 = new Point(4, 3);
System.out.println("p1 is "+p1);
System.out.println("Distance from origin = " + p1.distanceFromOrigin());
System.out.println("p2 is "+p2);
System.out.println("Distance from origin = " + p2.distanceFromOrigin());
p1.translate(11,6);
p2.translate(1, 7);
System.out.println("p1 is "+p1);
System.out.println("p2 is "+p2);
}// END main
public class Point{
private int x;
private int y;
// Constructors
public Point() {
this(0,0);
}
public Point(int x, int y) {
setLocation(x,y);
}
public double distanceFromOrigin() {
return Math.sqrt(x*x+y*y);
}
public int getX(){
return x;
}
public int getY(){
return y;
}
public void setLocation(int x, int y){
this.x = x;
this.y = y;
}
public String toString(){
return "("+x+", "+y+")";
}
public void translate(int dx, int dy){
setLocation(x+dx, y+dy);
}
}
}
<file_sep>/myjs.js
document.getElementById("demo").innerHTML = "I Hope I can see this change.";
<file_sep>/C/SANDBOX/src/Main.C
#include<iostream>
#include<cmath>
#include<fstream>
#include<string>
using namespace std;
int main(){
char filename[50];
ifstream inputFile;
getline(filename, 50);
inputFile.open(filename);
if(!inputFile.is_open()){
exit(EXIT_FAILURE);
}
char word[50];
inputFile >> word;
while(inputFile.good()){
cout << word << "\n";
inputFile >> word;
}
inputFile.close();
}
<file_sep>/C/TERNIARY/Coord.C
#include<iostream>
using namespace std;
int main(){
int x, y;
do {
cout<<"Enter an X coord => ";
cin>>x;
cout<<"Enter a Y coord => ";
cin>>y;
((x!=0)&&(x!=y))?
cout<<"("<<x<<", "<<y<<") is not at the origin":
cout<<"("<<x<<", "<<y<<") is at the origin";
/*
if ((x==0)&&(y==0)) {cout<<"At the origin";}
else if (x==0) {cout<<"On the Y axis";}
else if (y==0) {cout<<"On the X axis";}
else if ((x>0)&&(y>0)) {cout<<"In quadrant I\n\n";}
else if ((x<0)&&(y>0)) {cout<<"In quadrant II\n\n";}
else if ((x<0)&&(y<0)) {cout<<"In quadrant III\n\n";}
else if ((x>0)&&(y<0)) {cout<<"In quadrant IV\n\n";}
*/
cout<<"\n";
} while (true);
cout<<"\n\n";
return 0;
}
<file_sep>/C/GAMES/Feng.C
//Copyright (c) 2018 by <NAME>,<NAME>,ali zaka
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
void loss();
int main()
{
int hp=100,rt,s1,s2,s3;
int i=0,num,guess,tries=0;
char x;
cout<<"\nYou wake up in a forest. You don't know what is going on.\nYou try to find a way out of the forest and keep walking on the path."
<<"\nUnfortunately, you are surround by wolves!\nYou only have two chooses!\n1)Fight or 2)Flight\n";
cin>>s1;
if(s1==1) loss();
if(s1==2)
{rt=hp-15;
cout<<"\nYour made it. Break through the siege of wolves. But you lost 15 hp.\nThe wolves are still chasing you. You come to the edge of the cliff."
<<"\nThere is a woodeb hut near by."
<<"\n Cliff Wooden hut"
<<"\n (1) (2)\nYour Choose?";
cin>>s2;
if(s2==1){cout<<"\nYou try to jump to the other side, but fall in to the cliff";rt=0;}
if(s2==2){
{cout<<"\n\nHp remain"<<rt<<"\nYou come in front of the wooden hut.\n**(Hint:Make the right chooce to avoid the attack from the wolves!)**";
cout<<"\nWhat should you do?\n1)Check the door\n2)Check the windows\n";
cin>>s3;
if(s3==1)
{cout<<"\nThe door is locked,but you bust down the door";i=i++;rt=rt-15;}
if(s3==2){cout<<"\nThe window is not lock. You open the windows and jump into the hut.";i=i++;rt=rt-0;}
}
cout<<"\n\nHp remain" <<rt;
cout<<"\n\nYou get in the hut but you are bleeding. You need bandage. There are 10 First aid kits on the wall.\n**(There are 9 of them are empty)**";
cout<<"\n**(Every one wrong selection will let you lost 20hp!)**";
cout<<"\nSelection(1-10)";
srand(time(0));
num=rand()%10+1;
do{
do{
cin>>guess;
if(num<guess)cout<<"\nThis one is empty.Select another one\n";
if(num>guess)cout<<"\nThis one is empty.Select another one\n";
tries++;
}while(guess!=num);
cout<<"\nYou found it.\n"<<tries<<"tries";
cout<<"\nYou lost "<<tries*20<<" hp";
rt=rt-20*tries;
cout<<"\nhp remain "<<rt;
}while(hp<=0);
}
if(rt<=0)loss();
if(rt>0)cout<<"\n\nYou Survived! End!"; }
return 0;
}
void loss(){
cout<<"\n You Lost\tGame Over!";
}
<file_sep>/go/pointing.go
package main
import (
"fmt"
)
func main() {
a := [4]int{1,2,3,4}
b := &a[0]
c := &a[1]
fmt.Printf("%v %p %p\n", a, b, c)
}
<file_sep>/C/WorkingArrays.cpp
/* create an app that loops through an array to gather temps. Report coldest and warmest day. Use an array to figure it out.
*/
#include<namespace>
using namespace std;
int main(){
int temp =0,
month
cout << "Hello World";
cout<<"\n\n";
return 0;
}
}
<file_sep>/Eclipse/MainFoo/Dog.java
public class Dog {
private String breed;
private double weight;
Dog(){
breed = "Mixed";
weight = convertWeight(-1);
}
Dog(String type, int w){
breed = type;
weight = convertWeight(w);
}
private double convertWeight(double a) {
return a * 0.45;
}
public void growl() {
System.out.println("I am fragile.");
}
public void bark() {
if (breed == "Mixed") {
System.out.println("I'm a "+breed+" breed dog.");}
else {
System.out.println("I am a "+breed+".");}
if (weight>0) {
System.out.println("I am a healthy "+weight+" kilo dog.");}
else {
growl();}
System.out.println();
}
}
<file_sep>/java1/Java2/testScores.java
import java.util.*;
public class testScores {
public static void main(String[] args){
int count=0;
int [] grades = new int[5];
Scanner in = new Scanner(System.in);
for (int i=0; i<=grades.length-1;i++){
System.out.print("Please enter grade "+(i+1)+" : ");
grades[i]=in.nextInt();
}
for (int i=0;i<=grades.length-1;i++){
if (grades[i]<0){
count++;
System.out.println("Score "+i+" = "+grades[i]);
}
}
System.out.println("That's "+count+" negative grades");
}
}
<file_sep>/C/structExample.cpp
#include<iostream>
using namespace std;
int main() {
int x=437;
int * p;
p = &x ;
*p = 12;
cout<<"\nx= "<<x
<<"\n&x= "<<&x
<<"\np= "<<p
<<"\n*p= "<<*p;
cout <<"\n\n";
return 0;
}
<file_sep>/C/BurgerJoint.C
/*
<NAME>
*/
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
// Variabbles
double burger=5.00,
frank=3.00,
fries=2.50,
soda=1.25,
total=0.00,
taxes=0.08877, //taxes at 8.877%
tip12=.12,
tip15=.15,
tip20=.2;
int order=0, b=0, f=0, ff=0, s=0;
bool done=(false);
// set spacing for 2 decimal places.
cout << fixed << setprecision(2);
// start menu presentation
while (done!=true) {
cout<<"\n------------\n Lunch Menu\n------------\n";
cout<<"1 - Burger\t$"<<burger<<"\n"
<<"2 - Hot Dog\t$"<<frank<<"\n"
<<"3 - Fries\t$"<<fries<<"\n"
<<"4 - Soda\t$"<<soda<<"\n"
<<"5 - Done\n"
<<"\nPlease select an item from the menu: ";
cin >> order; // get user order
// increase count of item purchased and increase total
if(order==1){
total = total+burger;
b++;
cout<<"\n\tBurger added to order\n";}
else if (order==2){
total = total+frank;
f++;
cout<<"\n\tHot Dog added to order\n";}
else if (order==3){
total= total+fries;
ff++;
cout<<"\n\tFrench Fries added to order\n";}
else if (order==4){
total=total+soda;
s++;
cout<<"\n\tSoda added to order\n";}
else if (order==5){
done=true;
cout << "\n\tThank you for your order!\n\n"; }
else if ((order<1)||(order>5)){
cout<<"Sorry, "<<order
<<" is not on the menu.\nPlease select from the menu.\n"; }
} // END while loop (Menu presentation)
// presentation of itemized list
cout<<"---------------------------------------"
<<"\n"<<b+f+ff+s<<" Items Ready For Pickup\n";
cout<<"---------------------------------------\n";
// Display itemized list only of items ordered
if (b>0) {cout<<b<<" Burgers "<<"\t @ $"<<burger<<" = $"<< b*burger<<"\n"; }
if (f>0) {cout<<f<<" Hot Dogs"<<"\t @ $"<<frank<<" = $"<<f*frank<<"\n" ; }
if (ff>0) {cout<<ff<<" French Fries"<<"\t @ $"<<fries<<" = $"<<ff*fries<<"\n"; }
if (s>0) {cout<<s<<" Soda"<<"\t\t @ $"<<soda<<" = $"<<s*soda<<"\n"; }
cout<<"---------------------------------------\n";
cout<<" - Subtotal \t\t= $"<<total; // Display the subtotal
cout << "\n - Taxes 8.877% \t= $"<<taxes*total; // Calculate taxes at 8.877%
double grandTotal = total+(taxes*total); // Calcuate grand total
cout<<"\n---------------------------------------\n";
cout << " - Total \t\t= $"<<grandTotal<<"\n";
cout<<"---------------------------------------\n";
cout<<"---------------------------------------\n";
// Sugested Gratuity @ 12%, 15%, & 20%
cout << "\nSuggested Gratuity\n------------------";
cout << "\n+ 12% gratuity "<<"($"<<tip12*grandTotal<<") = total $"<<grandTotal+(tip12*grandTotal);
cout << "\n+ 15% gratuity "<<"($"<<tip15*grandTotal<<") = total $"<<grandTotal+(tip15*grandTotal);
cout << "\n+ 20% gratuity "<<"($"<<tip20*grandTotal<<") = total $"<<grandTotal+(tip20*grandTotal);
cout<<"\n\n";
return 0;
}
<file_sep>/C/SORTING/AdvancedSort.C
#include<iostream>
using namespace std;
int main()
{int n , data[100] , temp , swap;
cout<<"\ndata points? ";
cin>> n;
for(int i=1;i<=n;i++)
{cout<<"\ndata "<<i<<" ? ";
cin>>data[i];}
cout<<"\nUNSORTED: ";
for(int i=1;i<=n;i++) cout<<data[i]<<" ";
cout<<"\n . . . sorting now . . .\n";
for(int pass=1;pass<=(n-1);pass++)
{
swap = 0;
for(int x=1;x<=(n-1);x++)
{
cout<<"\nPASS= "<<pass<<" index= "<<x
<<" data["<<x<<"] ("<<data[x]
<<") compared with data["<<x+1
<<"] ("<<data[x+1]<< ") ";
if(data[x]>data[x+1])
{cout<<"SWAP needed!";
swap = 1 ;
temp=data[x];
data[x]=data[x+1];
data[x+1]=temp;
} //ending the if
} // inner loop (each individual pass)
if(swap==0) break;
} // repeat the process
cout<<"\nSORTED: ";
for(int i=1;i<=n;i++) cout<<data[i]<<" ";
cout<<"\n\n";
return 0;
}
<file_sep>/C/Experiment.cpp
#include<iostream>
using namespace std;
int main(){
int grades
cout<<"\n\n";
return 0;
}
<file_sep>/C/README/CARDS.C
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{int suit , card;
char draw ;
srand(time(0));
while(true)
{
do{
cout<<"\n\nready to draw a card? (y/n) ";
cin >> draw ;
}while(draw!='y');
cout<<"\n\n";
card=rand()%13+1;
if((card>=2)&&(card<=10)) cout<< card;
else if(card==1) cout<<" ace ";
else if(card==11) cout<<" jack ";
else if(card==12) cout<<" queen ";
else if(card==13) cout<<" king ";
suit = rand()%4 ;
if(suit==0)cout<<" of hearts";
if(suit==1)cout<<" of clubs";
if(suit==2)cout<<" of spades";
if(suit==3)cout<<" of diamonds";
}
cout<<"\n\n";
return 0;
}
<file_sep>/java1/ch02/completedExercises/java/Looping.java
import java.util.*;
// Created by tingansob on 10/29/2017 at 01:18:13 PM
public class Looping
{
public static void main(String[] args)
{
while (x > 12) {
x = x +1;
}
for (int x = 0; x < 10; x = x + 1) {
System.out.print("x is now "+x);
}
}
}
<file_sep>/C/SORTING/Sorting.C
#include<iostream>
using namespace std;
int main(){
int data[10] = {10, 9, 9, 7, 6, 5, 4, 3, 2, 1};
int temp=0;
cout<<"\nYour data is ";
for (int i = 0; i<=9; i++){ cout<<data[i]<<" ";}
// Bubble Sort
for (int pass=0; pass <=8; pass++)
for(int x=0; x<=8; x++)
if(data[x]>data[x+1]) {
temp = data[x];
data[x]=data[x+1];
data[x+1]= temp; }
cout<<"\nYour sorted data is ";
for (int i = 0; i<=9; i++){ cout<<data[i]<<" ";}
cout<<"\n\n";
return 0;
}
<file_sep>/C/payment.C
#include<iostream>
using namespace std;
int main()
{
// Variable Declarations
double hrlyRate , hrsWorked=0, otHrs=0 ,paycheck ;
cout << "\nHello Kevin\n\n";
// get user input # of hours worked and hourly rate
cout << "How many hours? ";
cin >> hrsWorked;
cout << "What is the hourly rate: ";
cin >> hrlyRate;
// calcuate paycheck taking into account ot hours over 40
if (hrsWorked <= 40) {
paycheck=(hrsWorked*hrlyRate);
} else {
double otRate=(hrlyRate+(hrlyRate/2));
otHrs=(hrsWorked-40);
cout << "The overtime rate is "<<otRate<<"\n";
paycheck=(hrsWorked*hrlyRate)+(otHrs*otRate);
}
cout << "You made "<<paycheck;
cout << "\n\n";
return 0;
}
<file_sep>/java1/sandbox/java/testFoo.java
import java.util.*;
public class testFoo {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
greeting(in);
}
public static void greeting(Scanner in) {
System.out.print("What is your name? ");
String name = in.nextLine();
System.out.println("Hello "+name);
}
}
<file_sep>/C/GAMES/Arif.C
/* Copyright (c) 2018 by <NAME> <NAME>*/
#include <iostream>
#include<cstring>
using namespace std ;
void west();
void east();
int main()
{ string name ;
char play,cont,choose;
cout <<" hello type your name to start the game : ";
cin >> name;
do
{
cout <<" hello "<< name <<" Press y to start : ";
cin >> play ;
}while (play != 'y');
cout<<"\n\n you are alone in abandond \n"
<<"asylum in hope to communicate to dead relative \n"
<<"through a ouija board \n"
<<"the asylum was abandond 30 years ago \n"
<<"and only thing that runs there are \n"
<<"spirits of the relatives \n";
cout << "Press c to continue : ";
cin >> cont ;
cout <<"\n\n"<< name <<" enter the facility \n";
cout <<"there are two sector you can explore \n"
<<"west and east \n"
<<"please choose one E OR W: ";
cin >> choose ;
if (choose == 'E' || choose == 'e') east();
if (choose == 'W' || choose == 'w') west();
}
void east()
{ char var ;
cout<<"walks in and start exploring the sector \n"
<<" he goes to 6 floor \n"
<<" the 6 floor is full of lunatics\n"
<< "are you gonna run or face the lunatics \n"
<<" chose run R or fight F \n";
cin >> var;
if (var == 'r') cout <<" you survived the lunatic ";
if(var == 'f') cout << "you died !!";
}
void west ()
{
char var ;
cout <<"walks in and start explore the sector \n"
<<"he encounter lunatics and he get chase by them \n"
<<"hide or run ? ";
cin >> var ;
if (var == 'h') cout << "he survived";
if (var == 'r') cout << "he falls from building ";
}
<file_sep>/java1/Java2/testingStuff.java
import java.util.*;
import javax.swing.JOptionPane;
public class testingStuff {
public static void main(String[] args) {
int numberOfStore = 5;
String userStringInput;
double storeSales;
int numOfHunDivisions;
for (int store=1;store<=numberOfStore;store++ ) {
userStringInput=JOptionPane.showInputDialog("Enter Toays Sales "+store);
storeSales=Double.parseDouble(userStringInput);
numOfHunDivisions=storeSales/100;
for(int printAsterisk=1;printAsterisk<=numOfHunDivisions;printAsterisk++)
System.out.println("hello World");
}
}
}
<file_sep>/java1/sandbox/ruby/WhoAreYou.rb
print "What is your name? "
name = gets.chomp
puts "Hello, #{name}"
puts %Q{Expected long string
But what happens over multiple
lines.}
<file_sep>/java1/sandbox/java/java_teachersCode/triangleHEC.java
import java.util.*;
public class triangleHEC
{public static void main(String[] args)
{Scanner in=new Scanner(System.in);
int a,b,c,asq,bsq,csq;
double s,area;
System.out.print("Enter side 1: ");
a=in.nextInt();
System.out.print("Enter side 2: ");
b=in.nextInt();
System.out.print("Enter side 3: ");
c=in.nextInt();
if(a<=0||b<=0||c<=0)
System.out.println("Invalid data entered. This data will be ignored");
else if( b+c>a&& a+c>b&& a+b>c)
{if(a==b&&b==c)
{System.out.println("all sides equal-equilateral");
draw(a);
}
else if(a==b||a==c||b==c)
{System.out.println("2 sides equal-isosceles");
if(a==b||a==c)
draw(a);
else
draw(b);
}
else
System.out.println("no sides equal-scalene");
asq=a*a;
bsq=b*b;
csq=c*c;
if(asq+bsq==csq||asq+csq==bsq||bsq+csq==asq)
System.out.println("It is a right triangle triangle");
else
System.out.println("It is not a right triangle triangle");
s=(a+b+c)/2.;
area=Math.sqrt(s*(s-a)*(s-b)*(s-c));
System.out.println("Area="+area);
}
else
System.out.println("Not sides of a triangle");
}
public static void draw(int a)
{int i,j;
for(i=1;i<=a;i++)
{for(j=1;j<=i;j++)
System.out.print("*");
System.out.println();
}
}
}<file_sep>/C/FunctionsPractice.C
// FUNCTIONS practice
#include<iostream>
using namespace std;
void NothingPassedOrReturned() ;
void NothingReturned(int) ;
int PassedAndReturned(int);
int main()
{
int choice;
do{cout<<"\n\n\nMENU\n----\n"
<<"\n1.Print Stuff"
<<"\n2.Square a number, print in function"
<<"\n3.Square a number, print in main"
<<"\n4.Quit\n\nYour choice? ";
cin>>choice;
if(choice==1) NothingPassedOrReturned() ;
if(choice==2)
{int x;
cout<<"what number? ";
cin>>x;
NothingReturned(x) ;
}
if(choice==3)
{int x;
cout<<"what number? ";
cin>>x;
cout<<"\n\n"<<x<<" squared is "
<<PassedAndReturned(x);
}
}while(choice!=4);
cout<<"\n\n";
return 0;
}
void NothingPassedOrReturned()
{
for(int x = 1 ; x<=10 ; x++)
cout<<"This function just prints this message repeatedly\t";
}
void NothingReturned(int a)
{
cout<<"\n\n"<<a<<" squared is "<<a*a;
}
int PassedAndReturned(int a)
{
return a*a;
}
| 0a7c413dc03c9c4bcd6158e87e1f1e5a0044e80f | [
"Ruby",
"JavaScript",
"Markdown",
"Makefile",
"INI",
"Java",
"Python",
"Text",
"C",
"Go",
"C++"
] | 153 | C | tingansob/JavaHomework | 6011e23fdd1cbde7b3ba962a8897bd1a366fee51 | 89cc9b9ed3a974db97c6c2ec260af16645b18855 |
refs/heads/master | <repo_name>DeepakKumar138/store-using-observable<file_sep>/src/Components/counter.js
import React, { Component } from 'react';
import { counterService } from '../Store/Counter';
export class Counter extends Component {
constructor(props){
super(props)
this.state = {
count: 0
}
}
componentDidMount(){
this.subscription = counterService.getCount().subscribe(value => {
this.setState({count: value.value})
})
}
increase = () =>{
counterService.increase(this.state.count+1)
}
decrease = () =>{
counterService.decrease(this.state.count-1)
}
render() {
return (
<div>
<button onClick={this.increase}>Increase</button>
<button onClick={this.decrease}>Decrease</button>
<h2>{this.state.count}</h2>
</div>
);
}
}
export default Counter;
<file_sep>/src/Store/Counter.js
import {Subject} from 'rxjs'
const subject = new Subject();
export const counterService = {
increase: value => subject.next({ value: value }),
decrease: value => subject.next({ value: value }),
getCount: () => subject.asObservable()
} | 6289e7b27e9f33ba83f6ef56f77b2e5f393568da | [
"JavaScript"
] | 2 | JavaScript | DeepakKumar138/store-using-observable | edb50a69c3bd6aeefd9d2cf386cd1d8e83f02fc4 | e26f4ff14292adb31b513bd8a1b1dd21a8c68db5 |
refs/heads/master | <file_sep>package fr.rbs.http.client;
import jdk.incubator.http.HttpClient;
import jdk.incubator.http.HttpRequest;
import jdk.incubator.http.HttpResponse;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
public class Http2Client {
public Http2Client() {
}
public static void main(String[] args) throws Exception {
try {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://romain:8181/test/http2"))
.GET()
.build();
//String body handler
HttpResponse<String> strResponse = client.send(request, HttpResponse.BodyHandler.asString());
System.out.println(strResponse.statusCode());
SSLParameters sslParameters = strResponse.sslParameters();
System.out.println("Maximum packet size : "+sslParameters.getMaximumPacketSize());
//System.out.println(response.body());
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
/*
System.out.println("SYNC CALL");
callSyncHttp();
System.out.println("END");
System.out.println("ASYNC CALL");
callASyncHttp();
System.out.println("END");*/
}
public static void callSyncHttp() {
try {
SSLContext sslcontext = SSLContext.getDefault();
HttpClient httpClient = HttpClient.newHttpClient(); //Create a HttpClient
System.out.println(httpClient.version());
//HttpRequest httpRequest = HttpRequest.newBuilder().uri(new URI("https://www.google.com/")).GET().build(); //Create a GET request for the given URI
HttpRequest httpRequest = HttpRequest.newBuilder().uri(new URI("https://localhost:8181/test/http2")).GET().build(); //Create a GET request for the given URI
Map<String, List<String>> headers = httpRequest.headers().map();
headers.forEach((k, v) -> System.out.println(k + "-" + v));
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandler.asString());
System.out.println("Status code : " + httpResponse.statusCode());
System.out.println("body : " + httpResponse.body());
} catch (Exception e) {
System.out.println("message " + e);
}
}
public static void callASyncHttp() throws InterruptedException {
try {
HttpClient httpClient = HttpClient.newHttpClient(); //Create a HttpClient
System.out.println(httpClient.version());
//HttpRequest httpRequest = HttpRequest.newBuilder().uri(new URI("https://www.google.com/")).GET().build(); //Create a GET request for the given URI
HttpRequest httpRequest = HttpRequest.newBuilder().uri(new URI("https://localhost:8181/test/http2")).GET().build(); //Create a GET request for the given URI
Map<String, List<String>> headers = httpRequest.headers().map();
headers.forEach((k, v) -> System.out.println(k + "-" + v));
CompletableFuture<HttpResponse<String>> httpResponse = httpClient.sendAsync(httpRequest, HttpResponse.BodyHandler.asString());
httpResponse.whenComplete((t, k) -> {
System.out.println("Status is :" + t.statusCode());
System.out.println("body is :" + t.body());
});
httpResponse.get();
} catch (
Exception e)
{
System.out.println("message " + e);
}
}
}
| b8e317e9070bc5af647e21f0c2b285928f4c0288 | [
"Java"
] | 1 | Java | rbelfils/http2-client | 0a71610d103850b3d54ea6840d12b678e61239f3 | 324be8b4a1012117556aceae55e2ad07bb689234 |
refs/heads/master | <file_sep>
 
* ### Info
This is simple Langton's ant simulation written by TheAmmiR and IceFox-L.
* ### Rules
There is a grid. Each cell of The Grid can be filled in any color.
The Grid is populated by ant. Ant is implemented as one cell of The Grid.
Each move the ant fills the cell he's standing on with next declared color and turns left or right.
If cell is filled with last set color, the ant fills it with default one.
* ### Running
* First, you have to open `colors_config.txt` and fill it. The template is already in the file - it looks like
```fix
COLOR - DIRECTION
COLOR - DIRECTION
COLOR
COLOR
```
If you do not set the direction, it is choosing randomly before starting each game.
You can see list of possible colors in `colorreader.py`
___
* Open `ants.py`. You can see some variables named in UPPER_SNAKE_CASE. You can freely edit it.
___
* Run `ants.py`
<file_sep>RU = 'Шагов: '
ENG = 'Steps: '
EN = ENG
JP = '手順:'
JAP = JP
JPN = JP
UKR = 'Кроків: '<file_sep>import random
COLORS = {
'def': (10, 10, 10),
'white': (240, 240, 240),
'red' : (250, 10, 10),
'green' : (12, 250, 12),
'blue' : (8, 8, 250),
'purple' : (139, 20, 255),
'yellow' : (255, 255, 30),
'pink' : (252, 15, 192),
'palegreen': (152, 251, 152),
'mediumslateblue': (123, 104, 238),
'thistle': (216, 191, 216),
'skyblue' : (117, 187, 253),
'lightseagreen' : (32, 178, 170),
'springgreen' : (0, 255, 127),
'crimson' : (220, 20, 60),
'orange' : (255, 128, 0),
}
def receive_sequences():
global COLORS
color_list = []
with open('colors_config.txt', 'r') as f:
result = f.read().split('\n')
for i in result:
seqlist = i.split(' - ')
if (len(seqlist) == 2):
color_list.append({'color' : COLORS[seqlist[0].lower()], 'dir' : seqlist[1].lower()})
else:
color_list.append({'color' : COLORS[seqlist[0].lower()], 'dir' : random.choice(['left', 'right'])})
return color_list<file_sep>import pygame
import colorreader
import numpy as np
from locals import *
from pygame import gfxdraw
pygame.init() # инициализация модулей pygame
global DRAW_LINES, DEFAULT_COLOR, GRID_COLOR, CURRENT_COLOR, TEXT_COLOR, SEQUENCES, SIZE, STEPS_PER_FRAME, LOCALISATION
DRAW_LINES = True # рисовать ли сетку
DEFAULT_COLOR = colorreader.COLORS['def'] # цвет мёртвой клетки
GRID_COLOR = (80, 80, 80) # цвет сетки
CURRENT_COLOR = (200, 200, 200, 150) # цвет текущей клетки
TEXT_COLOR = (255, 255, 255) # цвет текста
SEQUENCES = colorreader.receive_sequences()
CELLSIZE = 10 # размер в пикселях одной клетки
FIELDSIZE = 75 # размер поля в клетках
STEPS_PER_FRAME = 3 # шагов за кадр
LOCALISATION = ENG # RU, ENG, JP, UKR
class GameField:
def __init__(self, size_of_grid: int, size_of_cell: int, spf: int):
self.gridsize = size_of_grid
self.cellsize = size_of_cell
self.grid = np.array([[Gridcell() for _ in range(size_of_grid)] for _ in range(size_of_grid)]) # 2д массив из клеток
for y in range(len(self.grid)):
for x in range(len(self.grid[y])):
self.grid[x, y].x = x
self.grid[x, y].y = y
self.display = pygame.display.set_mode((size_of_grid * size_of_cell, size_of_grid * size_of_cell)) # дисплей размером с длину массива умноженную на размер одной клетки
self.clock = pygame.time.Clock()
self.spf = spf
self.steps = 0
self._current_cell = self.grid[size_of_grid // 2, size_of_grid // 2]
self._current_dir = 'up'
pygame.display.set_caption('ANTS') # название окна
def _update_cells(self, iters = 1):
for seq in range(len(SEQUENCES)):
if (self._current_cell.color == SEQUENCES[seq]['color']):
_dir = SEQUENCES[seq]['dir']
try:
oldcell = self._current_cell
if (_dir == 'left'):
if (self._current_dir == 'up'):
self._current_dir = 'left'
elif (self._current_dir == 'down'):
self._current_dir = 'right'
elif (self._current_dir == 'left'):
self._current_dir = 'down'
elif (self._current_dir == 'right'):
self._current_dir = 'up'
elif (_dir == 'right'):
if (self._current_dir == 'up'):
self._current_dir = 'right'
elif (self._current_dir == 'down'):
self._current_dir = 'left'
elif (self._current_dir == 'left'):
self._current_dir = 'up'
elif (self._current_dir == 'right'):
self._current_dir = 'down'
if (self._current_dir == 'up'):
self._current_cell = self.grid[self._current_cell.x, self._current_cell.y - 1]
elif (self._current_dir == 'down'):
self._current_cell = self.grid[self._current_cell.x, self._current_cell.y + 1]
elif (self._current_dir == 'left'):
self._current_cell = self.grid[self._current_cell.x - 1, self._current_cell.y]
elif (self._current_dir == 'right'):
self._current_cell = self.grid[self._current_cell.x + 1, self._current_cell.y]
except IndexError:
pass
try:
oldcell.fill(SEQUENCES[seq + 1]['color']) # закрашивание клетки
except IndexError:
oldcell.fill(SEQUENCES[0]['color'])
break
self.steps += 1
if (iters <= 1):
return
else:
return self._update_cells(iters - 1)
def _draw_cells(self):
for y in range(len(self.grid)): # зарисовка всех клеток матрицы
for x in range(len(self.grid[y])):
# зарисовка одной клетки её цветом
if (self.grid[x, y] == self._current_cell):
gfxdraw.box(self.display, (x * self.cellsize, y * self.cellsize, self.cellsize, self.cellsize), CURRENT_COLOR)
else:
gfxdraw.box(self.display, (x * self.cellsize, y * self.cellsize, self.cellsize, self.cellsize), self.grid[x, y].color)
def _draw_text(self):
fontsize = (self.gridsize * self.cellsize) // 20
if (LOCALISATION != JP):
font = pygame.font.Font('Thintel.ttf', fontsize)
else:
font = pygame.font.Font('ChiaroStd-B.otf', int(fontsize // 1.5))
steps = font.render(f'{LOCALISATION}{self.steps}', 0, TEXT_COLOR)
self.display.blit(steps, (self.gridsize, fontsize * 2))
def _draw_gridlines(self): # отрисовка сетки
for index in range(1, len(self.grid)):
gfxdraw.line(self.display, 0, index * self.cellsize, self.gridsize * self.cellsize, index * self.cellsize, GRID_COLOR)
for index in range(1, len(self.grid[0])):
gfxdraw.line(self.display, index * self.cellsize, 0, index * self.cellsize, self.gridsize * self.cellsize, GRID_COLOR)
def draw(self): # цикл отрисовки клеток
self.clock.tick(60)
self._update_cells(self.spf)
self._draw_cells()
if (DRAW_LINES):
self._draw_gridlines()
self._draw_text()
class Gridcell:
def __init__(self):
self.color = DEFAULT_COLOR
def fill(self, color): # изменяет цвет клетки
self.color = color
game = GameField(FIELDSIZE, CELLSIZE, STEPS_PER_FRAME)
while True:
for e in pygame.event.get(): # слежение за тем, что пользователь нажмёт крестик
if (e.type == pygame.QUIT):
quit()
game.draw()
pygame.display.update() | 717699c4dac1fdbd90f5cfd93e84503edd2e5d8c | [
"Markdown",
"Python"
] | 4 | Markdown | TheAmmiR/langtons-ant | 83f4ffa46dd35b2e752ab8493eca0f51fd760071 | 61049c14f07b98cb7a9a7f16b82b4c10eb62386c |
refs/heads/master | <file_sep>package com.example.katia.five_books_of_the_genre_fiction;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onClick1(View view) {
Intent intent = new Intent(MainActivity.this, ScrollingActivity1.class);
startActivity(intent);
}
public void onClick2(View view) {
Intent intent = new Intent(MainActivity.this, ScrollingActivity2.class);
startActivity(intent);
}
public void onClick3(View view) {
Intent intent = new Intent(MainActivity.this, ScrollingActivity3.class);
startActivity(intent);
}
public void onClick4(View view) {
Intent intent = new Intent(MainActivity.this, ScrollingActivity4.class);
startActivity(intent);
}
public void onClick5(View view) {
Intent intent = new Intent(MainActivity.this, ScrollingActivity5.class);
startActivity(intent);
}
}
<file_sep># Final_project
5 books of the genre fiction
Version 1.0
16/04/2016
The idea of this program is to show the best books of the genre fiction and to attract readers to read these books.
Copyright 2016 Cherkasy Corporation. All rights reserved
<file_sep>package com.example.katia.five_books_of_the_genre_fiction;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
public class ScrollingActivity3 extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrolling3);
}
}
| 116bd1ef06c1afdce6b9617c72b2de3dde6bec8a | [
"Markdown",
"Java"
] | 3 | Java | katerina-5/Final_project | 295b21929d09e4af26717bb69182fec6c0586504 | 1b3237b3e5c3338043e0a7e8ae13fb29ade4d00b |
refs/heads/master | <file_sep>/*
Copyright 2021 The cert-manager 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 util
import (
"crypto/x509"
certificatesv1 "k8s.io/api/certificates/v1"
)
var keyUsagesKube = map[certificatesv1.KeyUsage]x509.KeyUsage{
certificatesv1.UsageSigning: x509.KeyUsageDigitalSignature,
certificatesv1.UsageDigitalSignature: x509.KeyUsageDigitalSignature,
certificatesv1.UsageContentCommitment: x509.KeyUsageContentCommitment,
certificatesv1.UsageKeyEncipherment: x509.KeyUsageKeyEncipherment,
certificatesv1.UsageKeyAgreement: x509.KeyUsageKeyAgreement,
certificatesv1.UsageDataEncipherment: x509.KeyUsageDataEncipherment,
certificatesv1.UsageCertSign: x509.KeyUsageCertSign,
certificatesv1.UsageCRLSign: x509.KeyUsageCRLSign,
certificatesv1.UsageEncipherOnly: x509.KeyUsageEncipherOnly,
certificatesv1.UsageDecipherOnly: x509.KeyUsageDecipherOnly,
}
var extKeyUsagesKube = map[certificatesv1.KeyUsage]x509.ExtKeyUsage{
certificatesv1.UsageAny: x509.ExtKeyUsageAny,
certificatesv1.UsageServerAuth: x509.ExtKeyUsageServerAuth,
certificatesv1.UsageClientAuth: x509.ExtKeyUsageClientAuth,
certificatesv1.UsageCodeSigning: x509.ExtKeyUsageCodeSigning,
certificatesv1.UsageEmailProtection: x509.ExtKeyUsageEmailProtection,
certificatesv1.UsageSMIME: x509.ExtKeyUsageEmailProtection,
certificatesv1.UsageIPsecEndSystem: x509.ExtKeyUsageIPSECEndSystem,
certificatesv1.UsageIPsecTunnel: x509.ExtKeyUsageIPSECTunnel,
certificatesv1.UsageIPsecUser: x509.ExtKeyUsageIPSECUser,
certificatesv1.UsageTimestamping: x509.ExtKeyUsageTimeStamping,
certificatesv1.UsageOCSPSigning: x509.ExtKeyUsageOCSPSigning,
certificatesv1.UsageMicrosoftSGC: x509.ExtKeyUsageMicrosoftServerGatedCrypto,
certificatesv1.UsageNetscapeSGC: x509.ExtKeyUsageNetscapeServerGatedCrypto,
}
// KeyUsageTypeKube returns the relevant x509.KeyUsage or false if not found
func KeyUsageTypeKube(usage certificatesv1.KeyUsage) (x509.KeyUsage, bool) {
u, ok := keyUsagesKube[usage]
return u, ok
}
// ExtKeyUsageTypeKube returns the relevant x509.KeyUsage or false if not found
func ExtKeyUsageTypeKube(usage certificatesv1.KeyUsage) (x509.ExtKeyUsage, bool) {
eu, ok := extKeyUsagesKube[usage]
return eu, ok
}
<file_sep>module github.com/jetstack/cert-manager
go 1.16
// This fork allows us to add alternative certificate chains for ACME see
// https://github.com/cert-manager/crypto#cert-manager-fork-of-golangxcrypto .
// It will be replaced after
// https://go-review.googlesource.com/c/crypto/+/277294/ gets merged.
replace golang.org/x/crypto => github.com/cert-manager/crypto v0.0.0-20210409161129-d4c19753215a
require (
github.com/Azure/azure-sdk-for-go v43.0.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.12
github.com/Azure/go-autorest/autorest/adal v0.9.5
github.com/Azure/go-autorest/autorest/to v0.2.0
github.com/Azure/go-autorest/autorest/validation v0.1.0 // indirect
github.com/Venafi/vcert/v4 v4.13.1
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.1.0
github.com/aws/aws-sdk-go v1.34.30
github.com/cloudflare/cloudflare-go v0.13.2
github.com/cpu/goacmedns v0.0.3
github.com/digitalocean/godo v1.44.0
github.com/go-logr/logr v0.4.0
github.com/google/gofuzz v1.2.0
github.com/googleapis/gnostic v0.5.4
github.com/hashicorp/vault/api v1.0.4
github.com/hashicorp/vault/sdk v0.1.13
github.com/kr/pretty v0.2.1
github.com/miekg/dns v1.1.31
github.com/mitchellh/go-homedir v1.1.0
github.com/munnerz/crd-schema-fuzz v1.0.0
github.com/onsi/ginkgo v1.16.1
github.com/onsi/gomega v1.11.0
github.com/pavel-v-chernykh/keystore-go v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.9.0
github.com/sergi/go-diff v1.1.0
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.6.1
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
gomodules.xyz/jsonpatch/v2 v2.2.0
google.golang.org/api v0.20.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
k8s.io/api v0.21.0
k8s.io/apiextensions-apiserver v0.21.0
k8s.io/apimachinery v0.21.0
k8s.io/apiserver v0.21.0
k8s.io/cli-runtime v0.21.0
k8s.io/client-go v0.21.0
k8s.io/code-generator v0.21.0
k8s.io/component-base v0.21.0
k8s.io/klog/v2 v2.8.0
k8s.io/kube-aggregator v0.21.0
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7
k8s.io/kubectl v0.21.0
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
// To be replaced when there are stable versions that use k8s 1.21 libraries available
sigs.k8s.io/controller-runtime v0.9.0-beta.2
sigs.k8s.io/controller-tools v0.6.0-beta.0
sigs.k8s.io/testing_frameworks v0.1.2
sigs.k8s.io/yaml v1.2.0
software.sslmate.com/src/go-pkcs12 v0.0.0-20200830195227-52f69702a001
)
replace golang.org/x/net => golang.org/x/net v0.0.0-20210224082022-3d97a244fca7
// To be replaced once there is a release of kubernetes/apiserver that uses gnostic v0.5. See https://github.com/jetstack/cert-manager/pull/3926#issuecomment-828923436
replace github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1
// See https://github.com/jetstack/cert-manager/issues/3999
replace github.com/onsi/ginkgo => github.com/onsi/ginkgo v1.12.1
replace github.com/onsi/gomega => github.com/onsi/gomega v1.10.1
// See https://github.com/kubernetes/kubernetes/issues/101567
replace k8s.io/code-generator => github.com/kmodules/code-generator v0.21.1-rc.0.0.20210428003838-7eafae069eb0
replace k8s.io/gengo => github.com/kmodules/gengo v0.0.0-20210428002657-a8850da697c2
// See https://github.com/kubernetes/kubernetes/pull/99817
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7
<file_sep>/*
Copyright 2021 The cert-manager 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 certificatesigningrequests
import (
"context"
"github.com/go-logr/logr"
certificatesv1 "k8s.io/api/certificates/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
authzclient "k8s.io/client-go/kubernetes/typed/authorization/v1"
certificatesclient "k8s.io/client-go/kubernetes/typed/certificates/v1"
certificateslisters "k8s.io/client-go/listers/certificates/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
"k8s.io/utils/clock"
cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"
controllerpkg "github.com/jetstack/cert-manager/pkg/controller"
"github.com/jetstack/cert-manager/pkg/issuer"
logf "github.com/jetstack/cert-manager/pkg/logs"
)
const (
ControllerName = "certificatesigningrequests"
)
var keyFunc = controllerpkg.KeyFunc
// Signer is an implementation of a Kubernetes CertificateSigningRequest
// signer, backed by a cert-manager Issuer.
type Signer interface {
Sign(context.Context, *certificatesv1.CertificateSigningRequest, cmapi.GenericIssuer) error
}
// Controller is a base Kubernetes CertificateSigningRequest controller. It is
// responsible for orchestrating and performing shared operations that all
// CertificateSigningRequest controllers do, before passing the
// CertificateSigningRequest to a Singer implementation who instantiated this
// controller.
type Controller struct {
helper issuer.Helper
// clientset used to update CertificateSigningRequest API resources
certClient certificatesclient.CertificateSigningRequestInterface
csrLister certificateslisters.CertificateSigningRequestLister
sarClient authzclient.SubjectAccessReviewInterface
queue workqueue.RateLimitingInterface
// logger to be used by this controller
log logr.Logger
// used to record Events about resources to the API
recorder record.EventRecorder
// Signer to call sign function
signer Signer
// the signer kind to react to when a certificate signing request is synced
signerType string
// used for testing
clock clock.Clock
}
func New(signerType string, signer Signer) *Controller {
return &Controller{
signerType: signerType,
signer: signer,
}
}
func (c *Controller) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {
// construct a new named logger to be reused throughout the controller
c.log = logf.FromContext(ctx.RootContext, ControllerName)
// create a queue used to queue up items to be processed
c.queue = workqueue.NewNamedRateLimitingQueue(controllerpkg.DefaultItemBasedRateLimiter(), ControllerName)
c.sarClient = ctx.Client.AuthorizationV1().SubjectAccessReviews()
issuerInformer := ctx.SharedInformerFactory.Certmanager().V1().Issuers()
// obtain references to all the informers used by this controller
csrInformer := ctx.KubeSharedInformerFactory.Certificates().V1().CertificateSigningRequests()
// build a list of InformerSynced functions that will be returned by the Register method.
// the controller will only begin processing items once all of these informers have synced.
mustSync := []cache.InformerSynced{
csrInformer.Informer().HasSynced,
issuerInformer.Informer().HasSynced,
}
// if scoped to a single namespace
// if we are running in non-namespaced mode (i.e. --namespace=""), we also
// register event handlers and obtain a lister for clusterissuers.
clusterIssuerInformer := ctx.SharedInformerFactory.Certmanager().V1().ClusterIssuers()
if ctx.Namespace == "" {
// register handler function for clusterissuer resources
clusterIssuerInformer.Informer().AddEventHandler(&controllerpkg.BlockingEventHandler{WorkFunc: c.handleGenericIssuer})
mustSync = append(mustSync, clusterIssuerInformer.Informer().HasSynced)
}
// set all the references to the listers for used by the Sync function
c.csrLister = csrInformer.Lister()
// register handler functions
csrInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: c.queue})
issuerInformer.Informer().AddEventHandler(&controllerpkg.BlockingEventHandler{WorkFunc: c.handleGenericIssuer})
// create an issuer helper for reading generic issuers
c.helper = issuer.NewHelper(issuerInformer.Lister(), clusterIssuerInformer.Lister())
c.clock = ctx.Clock
// recorder records events about resources to the Kubernetes api
c.recorder = ctx.Recorder
c.certClient = ctx.Client.CertificatesV1().CertificateSigningRequests()
c.log.V(logf.DebugLevel).Info("new certificate signing request controller registered",
"type", c.signerType)
return c.queue, mustSync, nil
}
func (c *Controller) ProcessItem(ctx context.Context, key string) error {
log := logf.FromContext(ctx)
dbg := log.V(logf.DebugLevel)
_, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
log.Error(err, "invalid resource key")
return nil
}
csr, err := c.csrLister.Get(name)
if apierrors.IsNotFound(err) {
dbg.Info("certificate signing request in work queue no longer exists", "error", err.Error())
return nil
}
if err != nil {
return err
}
ctx = logf.NewContext(ctx, logf.WithResource(log, csr))
return c.Sync(ctx, csr)
}
| 909e985c44086f436f23dbd5b6fcd826f3d713ae | [
"Go Module",
"Go"
] | 3 | Go | Marfeel/cert-manager | 21bbdaced68a9af90a6ea1c18b332fda49f527d4 | 7b1d9e188c9ab47e9cb794900cec2b0f8e99c22a |
refs/heads/master | <file_sep>const { Router } = require("express");
const basicAuth = require("../middleware/basic-auth");
const bearerAuth = require("../middleware/bearer-auth");
const { register, getToken, getUser } = require("../controllers/user");
const userRouter = Router();
userRouter.post("/", register);
userRouter.get("/token", basicAuth, getToken);
userRouter.get("/:id", bearerAuth, getUser);
module.exports = { userRouter };
<file_sep>const debug = require("debug")("app:middleware:basic-auth");
module.exports = (req, res, next) => {
const authHeader = req.headers.authorization;
if (!authHeader) {
throw new Error("Authorization header not provided.");
}
const [type, data] = authHeader.split(" ");
if (type !== "Basic") {
throw new Error(
"Incorrect authorization type provided. Basic auth header required."
);
}
const decoded = Buffer.from(data, "base64").toString();
const [username, password] = decoded.split(":");
if (!username || !password) {
throw new Error("Invalid credentials.");
}
res.locals.auth = { username, password };
debug({ username, password });
next();
};
<file_sep>const { expect } = require("chai");
const jwt = require("jsonwebtoken");
const debug = require("debug")("test:user");
const app = require("../src/index");
const User = require("../src/models/user");
const request = require("supertest")(app);
describe("User", function () {
const sampleUser = {
username: "xkcd",
email: "<EMAIL>",
password: "<PASSWORD>"
};
describe("registration", async function () {
it("should create a new user", async function () {
return request
.post("/api/user")
.send(sampleUser)
.expect(201)
.expect(res => {
debug(res);
expect(
jwt.verify(res.text, process.env.APP_SECRET).username
).to.equal(sampleUser.username);
});
});
after(async function () {
const user = await User.findOne({ username: sampleUser.username });
user.remove({});
});
});
describe("login", async function () {
before(async function () {
await User.createUser(sampleUser);
});
it("should return a token", async function () {
return request
.get("/api/user/token")
.auth(sampleUser.username, sampleUser.password)
.expect(200)
.expect(res => {
expect(
jwt.verify(res.text, process.env.APP_SECRET).username
).to.equal(sampleUser.username);
});
});
after(async function () {
const user = await User.findOne({ username: sampleUser.username });
user.remove({});
});
});
describe("GET", async function () {
let testUser;
let token;
before(async function () {
const { id, username, email, generateToken } = await User.createUser(
sampleUser
);
token = generateToken();
testUser = { id, username, email };
});
it("should return a user object", async function () {
return request
.get("/api/user/" + testUser.id)
.auth(token, { type: "bearer" })
.expect(200)
.expect(res => {
expect(res.body).to.deep.equal(testUser);
});
});
after(async function () {
const user = await User.findOne({ username: sampleUser.username });
user.remove({});
});
});
});
<file_sep>const User = require("../models/user");
const debug = require("debug")("app:user");
const register = async (req, res, next) => {
debug("register new user");
const { username, email, password } = req.body;
User.createUser({ username, email, password })
.then(user => user.generateToken())
.then(token => res.status(201).send(token))
.catch(next);
};
const getUser = async (req, res, next) => {
debug("get user data");
const user = await User.findById(req.params.id);
if (!user) {
throw new Error("User not found");
}
res.send({ id: user.id, username: user.username, email: user.email });
};
const getToken = async (req, res) => {
debug("GET /api/user/token");
const { username, password } = res.locals.auth;
debug("validating user");
const user = await User.findOne({ username }).catch(err => new Error(err));
if (!user) {
throw new Error("user not found");
}
const isValidPassword = user.verifyPassword(password);
if (!isValidPassword) {
throw new Error("Invalid credentials.");
}
const token = user.generateToken();
res.send(token);
};
module.exports = { register, getToken, getUser };
<file_sep>const jwt = require("jsonwebtoken");
const debug = require("debug")("app:middleware:basic-auth");
module.exports = async (req, res, next) => {
debug("validating token");
const authHeader = req.header("Authorization");
const [type, token] = authHeader.split(" ");
if (type?.toLowerCase() !== "bearer") {
throw new Error(
"Incorrect auth type provided, expected Bearer token authorization"
);
}
const decoded = jwt.verify(token, process.env.APP_SECRET);
debug(decoded);
if (!decoded) {
throw new Error("Invalid credentials provided");
}
next();
};
<file_sep># grocery-helper-api
<file_sep>"use strict";
const mongoose = require("mongoose");
const debug = require("debug")("app:mongodb");
mongoose.Promise = Promise;
mongoose.connection.db || mongoose.connect(process.env.MONGODB_URI);
mongoose.connection.once("open", () => {
debug("connected");
});
mongoose.connection.on("error", err => {
debug(err);
});
<file_sep>const { readFile } = require("fs").promises;
const getQuery = async path =>
// allow paths to be referenced from root directory
await readFile(__dirname + "/../" + path).then(buffer => buffer.toString());
module.exports = { getQuery };
| 47b7fdeea935cc1973867b9699393be2b4363c26 | [
"JavaScript",
"Markdown"
] | 8 | JavaScript | dustinyschild/grocery-helper-api | d4216057e0c3925b28991b80d944ce4506a331ca | 797cd7a76fc8e17c2ca280cf6573b9ed52af9295 |
refs/heads/master | <repo_name>gaoqian506/im2scene<file_sep>/temp/model.py
import torch
import torchvision
class Model:
def __init__(self):
# self.net = torchvision.models.resnet18()
self.net1 = torch.nn.Sequential(
torch.nn.Conv2d(3, 10, 3, padding=1), # input: 3x200x200 3x400x600
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(10, 15, 3, padding=1), # input:10x100x100 10x200x300
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(15, 20, 3, padding=1), # input:15x50x50 15x100x150
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(20, 25, 3, padding=1), # input:20x25x25 20x50x75
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(25, 30, 3, padding=1), # input:25x12x12 25x25x37
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2) # output:30x12x18
)
self.net2 = torch.nn.Sequential(
torch.nn.Dropout(),
torch.nn.Linear(30*12*18, 1024),
torch.nn.ReLU(),
torch.nn.Dropout(),
torch.nn.Linear(1024, 512),
torch.nn.ReLU(),
torch.nn.Dropout(),
torch.nn.Linear(512, 256),
torch.nn.ReLU(),
torch.nn.Dropout(),
torch.nn.Linear(256, 128),
torch.nn.ReLU(),
torch.nn.Dropout(),
torch.nn.Linear(128, 64),
)
print 'net1:', self.net1
print 'net2:', self.net2
return
def step(self, x):
print('input:', x.data.size())
x = self.net1(x)
print('conved:', x.data.size())
x = x.view(x.size(0), -1)
print('viewed:', x.data.size())
x = self.net2(x)
print('output:', x.data.size())
return x
# return
def learn(self, reverd):
pass
<file_sep>/temp/env.py
from renderer import Renderer
from appreciator import Appreciator2D, Appreciator3D
import torch
class Env:
def __init__(self):
self.counter = 0
self.renderer = Renderer()
self.appreciator2d = Appreciator2D()
self.appreciator3d = Appreciator3D()
return
def evaluate(self, image, scene):
self.counter += 1
reverd3d = self.appreciator3d.appreciate(scene)
rendered = self.renderer.render(scene)
reverd2d = self.appreciator2d.appreciate(image, rendered)
print 'reverd:', reverd2d+reverd3d
return reverd2d+reverd3d
def done(self):
return self.counter % 5 == 0
<file_sep>/lib/config.py
class Config:
ImageSize = 244
ImageHeight = 244
ImageWidth = 244
SnapshotCount = 10
"""
def __init__(self):
pass
"""<file_sep>/lib/tracer/tracer.h
/*
* 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.
*/
/*
* File: tracer.h
* Author: gq
*
* Created on March 21, 2018, 11:10 AM
*/
#ifndef TRACER_H
#define TRACER_H
#include <string>
#include "sceneloader.h"
class Tracer {
public:
Tracer();
virtual ~Tracer();
void trace(std::string objfile);
private:
SceneLoader loader;
};
#endif /* TRACER_H */
<file_sep>/doc/code/scene.py
from object import CreatorObject
class Scene:
def __init__(self):
self.objects.add(CreatorObject())
return
def next_ojbect(self):
self.index += 1
if self.index >= objects.count:
self.index = 0
return objects[self.index]
<file_sep>/README.md
# im2scene
Convert an image to 3d graphical scene using deep learning method.
# install
pip install torch
pip install opencv
pip install numpy
<file_sep>/lib/renderer.py
class Renderer:
def __init__(self):
pass
def render(self, scene):
# scene.write(scenefile)
# rendererpp.render(scenefile, snapshots)
# return read(snapshots)
return
<file_sep>/doc/code/builder.py
from scene import Scene
class Builder:
def __init__(self):
self.scene = Scene()
return
def step(self, snapshots):
self.object = self.scene.next_object()
action = object.tend(snapshots)
self.scene.perform(action)
return
def learn(self, reverd):
self.object.learn(reverd)
return
<file_sep>/lib/model.py
import torch
from lib.config import Config
class CreatorModel(torch.nn.Module):
"""
a CreatorModel is responsible for create secene objects like box
shpere etc..
the input is image and shapshots of the scene
the size and channels should be defined in cfg structure
the output is the action of creator
for example, create a box at the position: x, y, x
"""
def __init__(self):
super(CreatorModel, self).__init__()
channels = (1 + Config.SnapshotCount) * 3
self.encoder = torch.nn.Sequential(
torch.nn.Conv2d(channels, 10, 3, padding=1), # input: 3x200x200 3x400x600
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(10, 15, 3, padding=1), # input:10x100x100 10x200x300
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(15, 20, 3, padding=1), # input:15x50x50 15x100x150
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(20, 25, 3, padding=1), # input:20x25x25 20x50x75
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2),
torch.nn.Conv2d(25, 30, 3, padding=1), # input:25x12x12 25x25x37
torch.nn.ReLU(),
torch.nn.MaxPool2d(2, 2) # output:30x12x18
)
def forward(self, state):
x = self.encoder(state)
return x
"""
# input is a scene-state, including ref-image, shapshots
channels = (1+Config.SnapshotCount)*3
self.conv1 = torch.nn.Conv2d(channels, 20, 3, padding=1)
self.pool = torch.nn.MaxPool2d(2, 2)
self.conv2 = torch.nn.Conv2d(20, 30, 3, padding=1)
self.fc1 = torch.nn.Linear(16 * 5 * 5, 120)
self.fc2 = torch.nn.Linear(120, 84)
self.fc3 = torch.nn.Linear(84, 10)
x = state # combine(state.image, state.snapshots)
x = self.pool(torch.nn.functional.relu(self.conv1(x)))
x = self.pool(torch.nn.functional.relu(self.conv2(x)))
x = x.view(-1, 16 * 5 * 5)
x = torch.nn.functional.relu(self.fc1(x))
x = torch.nn.functional.relu(self.fc2(x))
x = self.fc3(x)
# return state
# def backward(self, reverd):
# pass
# # self.net.backward(reverd)
"""
<file_sep>/doc/code/config.py
class Config:
ImageSize = 244
def __init__(self):
pass
<file_sep>/temp/environment.py
class Environment:
def __init__(self):
self.state = None
self.done = False
self.counter = 0
return
def start(self):
return
def apply(self, actions):
self.counter += 1
self.done = self.counter % 3 == 0
return None
<file_sep>/temp/data.py
import cv2
# from skimage import io
import numpy as np
import torch
from torch.autograd import Variable
class Data:
def __init__(self, path):
self.path = path
def load_image(self):
# return io.imread(self.path).astype(np.float32)/255.0
image = cv2.imread(self.path).transpose(2, 0, 1).astype(np.float32)/255.0
variable = Variable(torch.from_numpy(image)).unsqueeze(0)
print(variable.data.size())
return variable
<file_sep>/debug.py
from lib.model import CreatorModel
from lib.config import Config
from lib.renderer import Renderer
from lib.scene import Scene
import torch
if __name__ == '__main__':
test_model = False
test_renderer = True
if test_model:
model = CreatorModel()
height = Config.ImageHeight
width = Config.ImageWidth
channels = (1+Config.SnapshotCount)*3
state = torch.autograd.Variable(torch.rand(1, channels, height, width))
print(state.data.size())
output = model.forward(state)
print(output.data.size())
if test_renderer:
renderer = Renderer()
scene = Scene()
renderer.render(scene)
<file_sep>/doc/code/model.py
import torch
class CreatorModel(torch.nn.Model)
def __init__(self):
super(CreatorModel, self).__init__()
# input is a scene-state, including ref-image, shapshots
self.conv1 = torch.nn.Conv2d(3, 6, 5)
self.pool = torch.nn.MaxPool2d(2, 2)
self.conv2 = torch.nn.Conv2d(6, 16, 5)
self.fc1 = torch.nn.Linear(16 * 5 * 5, 120)
self.fc2 = torch.nn.Linear(120, 84)
self.fc3 = torch.nn.Linear(84, 10)
def forward(self, state):
x = combine(state.image, state.snapshots)
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 16 * 5 * 5)
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x
def backward(self, reverd):
self.net.backward(reverd)
class ModelList():
creator_model = CreatorModel()
'''
class Model()
def __init__(self):
super(Model, self).__init__()
self.net = None
return
def forward(self, input):
return self.net.predict(input)
def backward(self, reverd):
self.net.backward(reverd)
'''<file_sep>/temp/im2scene.py
from lib.player import Player
from lib.environment import Environment
def train():
env = Environment()
player = Player()
for episode in range(2):
env.start()
while True:
actions = player.act(env.state)
reverd = env.apply(actions)
player.learn(reverd)
if env.done:
break
return
if __name__ == '__main__':
# if -train
train()
# else
# test()
<file_sep>/doc/code/object.py
from model import ModelList
class Object:
def __init__(slef):
return
class CreatorObject(Object):
"""docstring for ClassName"""
def __init__(self):
super(CreatorObject, self).__init__()
self.model = ModelList.creator_model
return
def tend(self, image, snapshots):
return self.model.predict(image, snapshots)
def perform(self, action):
# perform action respectively
return
def learn(self, reverd):
self.model.backward(reverd)
return
<file_sep>/temp/renderer.py
class Renderer:
def __init__(self):
self.rendered = None
pass
def render(self, scene):
# render scene to an image
return self.rendered
<file_sep>/temp/player.py
class Player:
def __init__(self):
return
def act(self, state):
x1 = image_encoder.encode(state.image)
x2 = render_encoder.encode(state.render)
for obj in state.objs:
x = obj_encoder.encode(obj)
y = decoder.decode(x1, x2, x)
y = decoder.decode(x1, x2, )
return None
def learn(self, reverd):
return
<file_sep>/temp/appreciator.py
class Appreciator3D:
def __init__(self):
self.reverd = 0
pass
def appreciate(self, scene):
# evaluate the realibility of scene
return self.reverd
class Appreciator2D:
def __init__(self):
self.reverd = 0
pass
def appreciate(self, image, rendered):
# evaluate the similability between image and rendered
return self.reverd
<file_sep>/doc/code/converter.py
from builder import Builder
from renderer import Renderer
from reviewer import Reviewer
class Converter:
def __init__(self):
self.builder = Builder()
self.renderer = Render()
self.reviewer = Reviewer()
return
def learn(self, image):
self.builder.init()
self.renderer.init()
scene = self.builder.get_scene()
earlier = self.renderer.render(scene_1)
while Ture:
maks = self.builder.step(earlier)
later = self.renderer.render(scene)
reverd = self.reviewer.review(image, earlier, later, mask)
self.builder.learn(reverd)
later = earlier
if self.reviewer.done:
break
<file_sep>/doc/code/main.py
from lib.imageloader import ImageLoader
from lib.converter import Converter
EPOCHS = 2
def train():
image_loader = ImageLoader('data/images')
converter = Converter()
for i in range(EPOCHS):
image = image_loader.load_image()
converter.learn(image)
# main -train
if __name__ == 'main':
if '-train':
train()<file_sep>/lib/tracer/Makefile
SRCS= tracer.cpp sceneloader.cpp
OBJS=$(SRCS:%.cpp=%.o)
all : trace
trace : $(OBJS) trace.cpp
g++ -g $(OBJS) trace.cpp -o $@
%.o : %.cpp
g++ -c -g $< -o $@
clean:
rm -f trace.o trace
#all : trace
#
#trace : trace.o
# g++ -g $< -o $@
#trace.o : trace.cpp
# g++ -c -g $< -o $@
#
#
#clean:
# rm -f trace.o trace | aba3ceed0b5e03fe7e064998b0a55f3ce25447b0 | [
"Markdown",
"Python",
"Makefile",
"C++"
] | 22 | Python | gaoqian506/im2scene | 6ffe33c42c345c2f16e028a6c38838444334db30 | 6e9479c4f4975b44ad549b342721602b735b97c2 |
refs/heads/master | <file_sep>#pragma once
//create this as a template that allows the use of different classes as its Type
template <class T>
class SafeArray
{
//create a double pointer named _array
T** _array;
int _length;
int _position = 0;
//private method resizeArray, This creates a new array transfers the elements from the previous and overwrites the original
void resizeArray()
{
//create new double pointer with the length of the previous plus 1
T** newArray = new T*[_length + 1];
//itterate equal to the length of the old pointer
for (int i = 0; i < _length; i++)
{
//assign the data from the old array variable to the newArray
newArray[i] = _array[i];
}
//assign the newArray to _array overwriting the original data
_array = newArray;
//increament length
_length++;
//assign the newArray variable null to write over the information stored in memory to prevent memory leaks
newArray = NULL;
}
public:
//SafeArray Constructor
SafeArray(int length) {
//assign array a new pointer with the passed length argument
_array = new T*[length];
//assign length to the passed argument
_length = length;
}
//SafeArray Destructor
~SafeArray() {
//assign the array null to wipe the information
_array = NULL;
}
//getLength function
int getLength()
{
return _length;
}
//getItem function returns a pointer to the item
T* getItem(int index)
{
return _array[index];
}
//setItem procedure
void setItem(T* item, int index)
{
//assign to array the item passed in to the index location
_array[index] = item;
}
//addItem procedure
void addItem(T* item)
{
//determine if the array is at max size
if (_position >= _length)
{
//call resizeArray
resizeArray();
}
//assign item to the last position of array
_array[_position] = item;
//increment position by 1
_position++;
}
};
| 418d9263742d286c03cbf8a9b65712fcab48634b | [
"C++"
] | 1 | C++ | NexusFlight/CppSafeArray | 2609a2327bd58b08dba5b9808a2560a8bfe74457 | d95ca947bda764267987ffd8e0654e334ca05ccb |
refs/heads/master | <repo_name>MargoJoy/php1<file_sep>/07_OOP/data/news.php
<?php
return
[ ['title' => 'Фантастические твари: Преступления Грин-де-Вальда',
'text' => 'В конце первого фильма могущественный темный волшебник Геллерт Грин-де-Вальд был пойман сотрудниками
МАКУСА (Магического Конгресса Управления по Северной Америке), не без помощи Ньюта Саламандера. Выполняя свое
обещание, темный маг устраивает грандиозный побег и начинает собирать сторонников, большинство из которых не знают
о его истинной цели: добиться превосходства волшебников над всеми немагическими существами на планете. Чтобы сорвать
планы Грин-де-Вальда, <NAME> обращается к своему бывшему студенту Ньюту Саламандеру, который соглашается
помочь, не подозревая, какая опасность ему грозит. В раскалывающемся на части волшебном мире любовь и верность
проверяются на прочность, а конфликт разделяет даже настоящих друзей и членов семей.',
],
['title' => 'Гамбит (Gambit)',
'text' => 'Реми Лебо — искусный вор и картёжник, который ещё и является мутантом, умеющим преобразовать
энергию любого предмета в кинетическую, превращая этот самый предмет в грозное, взрывающееся оружие. Лебо не
наделён никакими высокоморальными качествами, живя исключительно для себя, абсолютно не обращая внимания на
конфликт между мутантами и человечеством.
Но настаёт день, когда Реми предстоит проявить все свои силы и умения, чтобы спасти не только себя, но и другого
человека. В сражении с новыми врагами Лебо предстоит пройти совершенно новый путь, отойдя от своего привычного
образа циничного вора, и стать чем-то большим, чем просто мутант-одиночка с прозвищем Гамбит.',
],
['title' => 'Мир Юрского периода 2 (Jurassic World: Fallen Kingdom)',
'text' => 'На острове Исла-Нублар, где не так давно располагался парк развлечений с динозаврами, правит бал
дикая природа. Но без людей все далеко не так спокойно, как могло бы показаться. Основатели парка приняли
решение построить его, несмотря на активный вулкан, расположенный в сердце острова. Вулкан пробудился и
рискует потопить остров в лаве. Управляющая парка Клэр Дэринг уговаривает дрессировщика Оуэна Грэди
вернуться в бывший парк и спасти динозавров от неминуемой гибели.',
],
];<file_sep>/09_SPB/App/Model/gallery/Gallery.php
<?php
namespace App\Model\gallery;
use App\Model\database\DB;
class Gallery
{
protected $data;
public function getImages()
{
$this->data = [];
$db = new DB();
$images = $db->query('SELECT * FROM spb.images');
foreach ($images as $image){
$this->data[] = new Image($image['id'], $image['description'], $image['name']);
}
return $this->data;
}
public function getImage(int $id)
{
$db = new DB();
$image = $db->query('SELECT * FROM spb.images WHERE id=:id',[':id' => $id]);
return $image;
}
public function setImage($fileName, $fileDesc)
{
$db = new DB();
$query = 'INSERT INTO spb.images (name, description) VALUES (:fileName, :fileDesc)';
$filleData = [':fileName' => $fileName, ':fileDesc' => $fileDesc];
$db->query($query, $filleData);
}
}
<file_sep>/08_DataBase/article.php
<?php
require_once __DIR__ . '/classes/View.php';
require_once __DIR__ . '/classes/News.php';
$template = __DIR__ . '/templates/article.php';
$view = new View();
$news = new News();
if (isset($_GET['id']) && !empty($_GET['id'])) {
$data = [':id' => $_GET['id']];
$view->assign('oneArticle', $news->getData($data));
} else {
header('Location: /index.php');
}
$view->display($template);
<file_sep>/09_SPB/App/Controller/image.php
<?php
require __DIR__ . '/../../autoload.php';
$template = __DIR__ . '/../View/templates/image.php';
$view = new \App\View\classes\View();
$gallery = new \App\Model\gallery\Gallery();
$id = $_GET['id'];
if (isset($id) && !empty($id)) {
$view->assign('idImages', $gallery->getImage($id));
}
$view->display($template);<file_sep>/04_Upload/image.php
<?php
if (isset($_GET['id']) && !empty($_GET['id'])) {
$photo = $_GET['id'];
} else {
header('Location: /index.php');
}
?>
<img width="600px" src="/img/<?php echo $photo; ?>" alt=""><file_sep>/04_Upload/gBookRecord.php
<?php
include __DIR__ . '/funcGb.php';
$path = __DIR__ . '/text.txt';
$line = $_POST['text'];
//если установленна переменная отличная от нуля
if (isset($line)) {
//имеющийся массив
$data = read();
//добавляет новый элемент
$data[] = $line;
//обьеденяет весь массив в строку, разделяет переносом
$newArr = implode("\n", $data);
//пишет строку в файл
file_put_contents($path, $newArr);
//перенаправляет на страницу гостевой книги
header('Location: /gBook.php');
}<file_sep>/07_OOP/index.php
<?php
session_start();
require_once __DIR__ . '/classes/View.php';
require_once __DIR__ . '/classes/Gallery.php';
if (isset( $_GET['do'] )&& $_GET['do'] == 'exit' ) {
unset($_SESSION['name']);
}
$template = __DIR__ . '/templates/gallery.php';
$gallery = new Gallery(__DIR__ . '/images');
$view = new View();
$view->assign('gallery', $gallery->getData());
$view->display($template);<file_sep>/07_OOP/data/users.php
<?php
return [
'User1' => '$2y$10$9eFlBdVse1G0VQinxVVh7.YEcNJMKQw9HW4kCQbUVIrP9U7E1bsWa',
'User2' => '$2y$10$AlpXYuM/3AvK9kIH73ly.uUjNwQT5qSfuNuEJ/iWaxvYTnERhTLBy',
];
<file_sep>/04_Upload/gBook.php
<?php
include __DIR__ . '/funcGb.php';
$strings = read();
?>
<?php foreach ($strings as $string){ ?>
<p><?php echo $string; ?></p>
<?}?>
<form action="/gBookRecord.php" method="post">
<label for="">
<input type="text" name="text">
</label>
<label for="">
<input type="submit">
</label>
</form>
<file_sep>/09_SPB/index.php
<?php
require __DIR__ . '/autoload.php';
$template = __DIR__ . '/App/View/templates/home.php';
$cityText = __DIR__ . '/App/data/cityText.txt';
$view = new \App\View\classes\View();
$city = new \App\Model\city\City($cityText);
$view->assign('aboutSpb', $city->getText());
$view->display($template);<file_sep>/09_SPB/App/Model/database/DB.php
<?php
namespace App\Model\database;
class DB
{
protected $dbh;
public function __construct()
{
$config = include __DIR__ . '/../../data/config.php';
$this->dbh = new \PDO($config['dsn'], $config['user'], $config['password']);
}
public function execute(string $sql)
{
$sth = $this->dbh->prepare($sql);
return $sth->execute();
}
public function query(string $sql, array $data = [])
{
$sth = $this->dbh->prepare($sql);
if ($sth->execute($data)) {
$data = $sth->fetchAll();
return $data;
} else {
return false;
}
}
}
<file_sep>/09_SPB/App/Controller/admin.php
<?php
require __DIR__ . '/../../autoload.php';
$template = __DIR__ . '/../View/templates/admin.php';
$view = new \App\View\classes\View();
//-------------------
$cityText = __DIR__ . '/../../App/data/cityText.txt';
$city = new \App\Model\city\City($cityText);
$view->assign('aboutSpb', $city->getText());
//-------------------
$gallery = new \App\Model\gallery\Gallery();
$view->assign('allImages', $gallery->getImages());
//-------------------
$info = new \App\Model\schedule\TrainSchedule();
$view->assign('schedule', $info->getInfo());
$view->display($template);
<file_sep>/09_SPB/App/Record/uploadImage.php
<?php
require __DIR__ . '/../../autoload.php';
$typePuth = include __DIR__ . '/../data/imageType.php';
$file = $_FILES['newImg'];
$fileName = $_FILES['newImg']['name'];
$fileType = $_FILES['newImg']['type'];
$fileDes = $_POST['description'];
$uploadImage = new \App\Model\gallery\UploadImage('newImg');
$gallery = new \App\Model\gallery\Gallery();
if (isset($file) && !empty($file)) {
if ($uploadImage->isUploaded() && $uploadImage->setAllowedTypes($typePuth, $fileType)) {
$uploadImage->upload();
$gallery->setImage($fileName, $fileDes);
}
header('Location: /../App/Controller/admin.php');
}<file_sep>/07_OOP/login.php
<?php
session_start();
require_once __DIR__ . '/classes/Authentication.php';
require_once __DIR__ . '/classes/View.php';
$template = __DIR__ . '/templates/login.php';
$users = __DIR__ . '/data/users.php';
$authentication = new Authentication($users);
if (null !== $authentication->getCurrentUser()){
header('Location: /index.php');
} else {
if (isset($_POST['login']) && isset($_POST['password']) && $authentication->checkPassword($_POST['login'], $_POST['password'])) {
$_SESSION['name'] = $_POST['login'];
header('Location: /index.php');
}
}
$view = new View();
$view->display($template);<file_sep>/07_OOP/news.php
<?php
require_once __DIR__ . '/classes/View.php';
require_once __DIR__ . '/classes/News.php';
$temlpate = __DIR__ . '/templates/news.php';
$dataNews = __DIR__ . '/data/news.php';
$news = new News($dataNews);
$view = new View();
$view->assign('news', $news->getData());
$view->display($temlpate);<file_sep>/06_Classes/gallery/uploaer.php
<?php
session_start();
include __DIR__ . '/../functions.php';
include __DIR__ . '/../classes/Uploader.php';
$uploader = new Uploader('newImg');
$type = $_FILES['newImg']['type'];
$array = include __DIR__ . '/typeArr.php';
$userName = getCurrentUser();
$date = date('c');
$fileName = $_FILES['newImg']['name'];
$log = $userName . ' | ' . $date . ' | ' . $fileName . "\n";
$logPath = __DIR__ . '/log.txt';
if (isset($userName) && $uploader->isSetAllowedTypes($array, $type)) {
$uploader->upload();
file_put_contents($logPath, $log, FILE_APPEND);
};
header('Location: /index.php');
<file_sep>/06_Classes/gallery/image.php
<?php
if (isset($_GET['id']) && !empty($_GET['id'])) {
$imgId = $_GET['id'];
} else {
header('Location: /index.php');
}
?>
<a href="/index.php" style="display:block;">На главную</a>
<img width="600px" src="/gallery/img/<?php echo $imgId; ?>" alt=""><file_sep>/09_SPB/App/Model/city/City.php
<?php
namespace App\Model\city;
class City
{
protected $path;
protected $data;
public function __construct(string $path)
{
$this->path = $path;
$this->data = file($this->path, FILE_APPEND);
}
public function getText()
{
foreach ($this->data as $text) {
$this->data = $text;
}
return $this->data;
}
public function upCity(string $data)
{
file_put_contents($this->path, $data);
}
}
<file_sep>/03_Arrays/gallery.php
<?php
$image = include __DIR__ . '/imgArray.php';
?>
<h3>Галерея</h3>
<!--перебор массива по ключу, сам массив и переменная $image в файле imgArray.php-->
<?php foreach ($image as $kay => $img) { ?>
<!--в идентификатор ссылки передается ключ от имени каждой картинуи в массиве-->
<a href="/image.php?id=<?php echo $kay; ?>">
<!--выводится все что есть в массиве в путь до изображения, по очереди, если по такому пути есть изображение,
с таким именем, оно будет выведено-->
<img width="600px" src="/img/<?php echo $img; ?>" alt="">
</a>
<?php } ?>
<file_sep>/09_SPB/App/View/templates/js/script.js
$(function(){
$('.menuTuggle').on('click', function () {
$('.menu').slideToggle(300, function () {
if($(this).css('display') === 'none'){
$(this).removeAttr('style');
}
});
})
});
$(document).ready( function() {
$(".file-upload input[type=file]").change(function(){
var filename = $(this).val().replace(/.*\\/, "");
$("#filename").val(filename);
});
});<file_sep>/07_OOP/uploadImg.php
<?php
session_start();
require_once __DIR__ . '/classes/Authentication.php';
require_once __DIR__ . '/classes/Uploader.php';
$users = __DIR__ . '/data/users.php';
$authentication = new Authentication($users);
$uploader = new Uploader('newImg');
$type = $_FILES['newImg']['type'];
$array = include __DIR__ . '/data/typeArr.php';
$userName = $authentication->getCurrentUser();
$date = date('c');
$fileName = $_FILES['newImg']['name'];
$log = $userName . ' | ' . $date . ' | ' . $fileName . "\n";
$logPath = __DIR__ . '/data/log.txt';
if (isset($userName) && $uploader->isSetAllowedTypes($array, $type)) {
$uploader->upload();
file_put_contents($logPath, $log, FILE_APPEND);
};
header('Location: /index.php');<file_sep>/04_Upload/funcGb.php
<?php
function read()
{
//читает файл и возвращает массив записей гостевой книги
return file(__DIR__ . '/text.txt', FILE_IGNORE_NEW_LINES);
}
<file_sep>/09_SPB/autoload.php
<?php
//авто подключение нужного класса при работы с ним
function __autoload($class)
{
require __DIR__ . '/' . str_replace('\\', '/', $class) . '.php';
}
<file_sep>/07_OOP/templates/guestBook.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Гостевая книга</title>
</head>
<body>
<h3>Гостевая книга</h3>
<a href="/index.php">Главная</a>
<?php foreach ($data['gbook'] as $line){?>
<p><?php echo $line->getMessage()?></p>
<?php } ?>
<form action="/guestBook.php" method="post">
<label for="">
<input type="text" name="text">
</label>
<label for="">
<input type="submit">
</label>
</form>
</body>
</html>
<file_sep>/09_SPB/spb.sql
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Авг 19 2018 г., 19:16
-- Версия сервера: 5.7.20
-- Версия PHP: 7.2.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- База данных: `spb`
--
-- --------------------------------------------------------
--
-- Структура таблицы `images`
--
CREATE TABLE `images` (
`id` bigint(20) UNSIGNED NOT NULL,
`description` varchar(100) DEFAULT NULL,
`name` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `images`
--
INSERT INTO `images` (`id`, `description`, `name`) VALUES
(1, 'Александровская колонна', 'AlexColumn.jpg'),
(2, 'Банковский мост', 'bankBridge.jpg'),
(3, 'Исаакиевский собор', 'isacSabor.jpg'),
(4, 'Здание Главного штаба', 'PalaceSquare.jpg'),
(5, 'Дом Зингера', 'singerHouse.jpg'),
(6, 'Площадь Восстания', 'AreaRevolt.jpg'),
(7, 'Казанский Собор', 'KazanCathedral.jpg');
-- --------------------------------------------------------
--
-- Структура таблицы `train_schedule`
--
CREATE TABLE `train_schedule` (
`id` bigint(20) UNSIGNED NOT NULL,
`departure` varchar(100) DEFAULT NULL,
`dep_time` datetime DEFAULT NULL,
`arival` text,
`ariv_time` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `train_schedule`
--
INSERT INTO `train_schedule` (`id`, `departure`, `dep_time`, `arival`, `ariv_time`) VALUES
(1, 'Санкт-Петербург', '2018-08-23 10:25:00', 'Москва', '2018-08-24 18:30:00'),
(2, 'Москва', '0018-08-23 18:30:00', 'Санкт-Петербург', '2018-08-24 10:30:00');
-- --------------------------------------------------------
--
-- Структура таблицы `users_admin`
--
CREATE TABLE `users_admin` (
`id` bigint(20) UNSIGNED NOT NULL,
`login` varchar(50) DEFAULT NULL,
`password` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `users_admin`
--
INSERT INTO `users_admin` (`id`, `login`, `password`) VALUES
(1, 'User1', '<PASSWORD>');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `images`
--
ALTER TABLE `images`
ADD UNIQUE KEY `id` (`id`);
--
-- Индексы таблицы `train_schedule`
--
ALTER TABLE `train_schedule`
ADD UNIQUE KEY `id` (`id`);
--
-- Индексы таблицы `users_admin`
--
ALTER TABLE `users_admin`
ADD UNIQUE KEY `id` (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `images`
--
ALTER TABLE `images`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT для таблицы `train_schedule`
--
ALTER TABLE `train_schedule`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT для таблицы `users_admin`
--
ALTER TABLE `users_admin`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<file_sep>/07_OOP/classes/News.php
<?php
require_once __DIR__ . '/Article.php';
class News
{
public $path;
protected $data = [];
public function __construct(string $path)
{
$this->path = $path;
$arrNews = include $path;
foreach ($arrNews as $article){
$this->data[] = new Article($article['title'], $article['text']);
}
}
public function getData()
{
return $this->data;
}
}
<file_sep>/07_OOP/templates/gallery.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Галлерея</title>
</head>
<body>
<?php if (isset($_SESSION['name'])) {?>
<p>Имя пользователя: <?php echo $_SESSION['name']; ?> </p>
<a href="/index.php?do=exit" style="display:block;">Выйти </a>
<?php } else {?>
<a href="/login.php" style="display:block;">Войти</a>
<?php } ?>
<h3>Галлерея</h3>
<a href="/guestBook.php">Гостевая книга</a>
<a href="/news.php">Новости</a>
<?php
foreach ($data['gallery'] as $image) { ?>
<a href="/image.php?id=<?php echo $image->getFile(); ?>">
<img src="/images/<?php echo $image->getFile(); ?>" alt="" width="300px">
</a>
<?php } ?>
<form action="/uploadImg.php" method="post" enctype="multipart/form-data">
<label for="">
<input type="file" name="newImg">
</label>
<input type="submit">
</form>
</body>
</html>
<file_sep>/06_Classes/gbook/guestbook.php
<?php
include __DIR__ . '/../classes/GuestBook.php';
$guestbook = new GuestBook(__DIR__ . '/text.txt');
?>
<a href="/index.php">На глаавную</a>
<?php foreach ($guestbook->getData() as $line){?>
<p><?php echo $line; ?></p>
<?php } ?>
<form action="/gbook/gbookUploader.php" method="post">
<label for="">
<input type="text" name="text">
</label>
<input type="submit">
</form>
<file_sep>/01_Start/index.php
<?php
var_dump(2*2);
var_dump(3 / 1);
var_dump(1 / 3);
var_dump('20cats' + 40);
var_dump(18 % 4);
//=============================
echo ($a = 2);
$x = ($y = 12) - 8;
echo $x;
//=============================
var_dump(1 == 1.0);
var_dump(1 === 1.0);
var_dump('02' == 2);
var_dump('02' === 2);
var_dump('02' == '2');
//=============================
$x = true xor true;
var_dump($x);
<file_sep>/09_SPB/App/Controller/gallery.php
<?php
require __DIR__ . '/../../autoload.php';
$template = __DIR__ . '/../View/templates/gallery.php';
$view = new \App\View\classes\View();
$gallery = new \App\Model\gallery\Gallery();
$view->assign('allImages', $gallery->getImages());
$view->display($template);<file_sep>/07_OOP/guestBook.php
<?php
session_start();
require_once __DIR__ . '/classes/Authentication.php';
require_once __DIR__ . '/classes/View.php';
require_once __DIR__ . '/classes/GuestBook.php';
$authentication = new Authentication(__DIR__ . '/data/users.php');
$textGB = __DIR__ . '/data/text.txt';
$template = __DIR__ . '/templates/guestBook.php';
$userName = $authentication->getCurrentUser();
$gbook = new GuestBook($textGB);
$newLines = $_POST['text'];
if (isset($userName) && null !== $newLines) {
$gbookrecord = new GuestBookRecord($newLines);
$gbook->append($gbookrecord)->save();
header('Location: /guestBook.php');
}
$view = new View();
$view->assign('gbook', $gbook->getData());
$view->display($template);
<file_sep>/08_DataBase/classes/News.php
<?php
require_once __DIR__ . '/Article.php';
require_once __DIR__ . '/Db.php';
class News
{
protected $database;
public function getData(array $data = [])
{
$db = new DB();
if (!empty($data)) {
$sql = 'SELECT * FROM news WHERE id=:id';
$dbquery = $db->query($sql, $data);
} else {
$sql = 'SELECT * FROM news';
$dbquery = $db->query($sql);
}
foreach ($dbquery as $article) {
$this->database[] = new Article(
$article['id'],
$article['title'],
$article['text'],
$article['author']);
}
return $this->database;
}
}
<file_sep>/02_Functions/table.php
<?php
//функция bool_and принимает 2 аргумента
function bool_and($a, $b)
{
// если оба аргумента равни 1 true, иначе false
if ($a && $b) {
$res = 1;
} else {
$res = 0;
}
//возвращается значение
return $res;
}
function bool_or($a, $b)
{
if ($a || $b) {
$res = 1;
} else {
$res = 0;
}
return $res;
}
function bool_xor($a, $b)
{
if ($a xor $b) {
$res = 1;
} else {
$res = 0;
}
return $res;
}
?>
<h3>Пункт 1. Таблица истинности </h3>
<table border="1" cellpadding="5">
<tr>
<td> $a , $b </td>
<td> $a && $b </td>
<td> $a || $b </td>
<td> $a XOR $b </td>
</tr>
<tr>
<td><?php echo $a = 1, ' , ' , $b = 1; ?></td>
<td><?php echo bool_and( $a , $b ); ?></td>
<td><?php echo bool_or( $a , $b ); ?></td>
<td><?php echo bool_xor( $a , $b ); ?></td>
</tr>
<tr>
<td><?php echo $a = 0, ' , ' , $b = 1; ?></td>
<td><?php echo bool_and( $a , $b ); ?></td>
<td><?php echo bool_or( $a , $b ); ?></td>
<td><?php echo bool_xor( $a , $b ); ?></td>
</tr>
<tr>
<td><?php echo $a = 1, ' , ' , $b = 0; ?></td>
<td><?php echo bool_and( $a , $b ); ?></td>
<td><?php echo bool_or( $a , $b ); ?></td>
<td><?php echo bool_xor( $a , $b ); ?></td>
</tr>
<tr>
<td><?php echo $a = 0, ' , ' , $b = 0;?></td>
<td><?php echo bool_and( $a , $b ); ?></td>
<td><?php echo bool_or( $a , $b ); ?></td>
<td><?php echo bool_xor( $a , $b ); ?></td>
</tr>
</table>
<file_sep>/03_Arrays/image.php
<?php
$image = include __DIR__ . '/imgArray.php';
//в переиенную полученное методом get значение
$photo = $_GET['id'];
?>
<a href="/gallery.php">↩</a>
<!--вывод отдельного элемента массива, в качестве ключа, полученное get-ом значение-->
<img width="600px" src="/img/<?php echo $image[$photo]; ?>" alt=""><file_sep>/06_Classes/classes/Uploader.php
<?php
class Uploader
{
public $formName;
public function __construct($formName)
{
$this->formName = $formName;
}
public function isUploaded()
{
if (isset($_FILES[$this->formName]) && 0 == $_FILES[$this->formName]['error']){
return true;
} else {
return false;
}
}
public function isSetAllowedTypes($array, $types)
{
return in_array($types, $array);
}
public function upload()
{
if ($this->isUploaded()) {
move_uploaded_file(
$_FILES[$this->formName]['tmp_name'],
__DIR__ . '/../gallery/img/' . $_FILES[$this->formName]['name']
);
} else {
return null;
}
}
}
<file_sep>/09_SPB/App/Controller/schedule.php
<?php
require __DIR__ . '/../../autoload.php';
$template = __DIR__ . '/../View/templates/schedule.php';
$info = new \App\Model\schedule\TrainSchedule();
$view = new \App\View\classes\View();
$view->assign('schedule', $info->getInfo());
$view->display($template);<file_sep>/07_OOP/templates/news.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Новости</title>
</head>
<body>
<h3>Новости</h3>
<a href="/index.php">На главную</a>
<?php foreach ($data['news'] as $id => $article){ ?>
<h4><a href="/article.php?id=<?php echo $id; ?>"><?php echo $article->title; ?></a></h4>
<p><?php echo $article->text; ?></p>
<?php }; ?>
</body>
</html>
<file_sep>/06_Classes/gbook/gbookUploader.php
<?php
session_start();
include __DIR__ . '/../functions.php';
include __DIR__ . '/../classes/GuestBook.php';
$guestbook = new GuestBook(__DIR__ . '/text.txt');
$line = $_POST['text'];
$userName = getCurrentUser();
if (isset($line) && isset($userName)) {
$guestbook->append($line)->save();
}
header('Location: /gbook/guestbook.php');<file_sep>/09_SPB/App/View/templates/admin.php
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/App/View/templates/css/style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="<KEY>" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Marck+Script&subset=cyrillic,latin-ext" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="/App/View/templates/js/script.js"></script>
<title>Админ панель</title>
</head>
<body>
<nav>
<div class="wrapper">
<div class="menuTuggle"><i class="fa fa-bars" aria-hidden="true"></i></div>
<ul class="menu clearfix">
<li><a href="/index.php">Главная</a></li>
<li><a href="/App/Controller/gallery.php">Галерея</a></li>
<li><a href="/App/Controller/schedule.php">Расписание поездов</a></li>
<li><a href="/App/Controller/admin.php">Админ панель</a></li>
</ul>
</div>
</nav>
<div class="wrapper">
<div class="adminAbout">
<h1>Описание</h1>
<p><?php echo $data['aboutSpb'];?></p>
<div class="form">
<p>Редактировать описание</p>
<form action="/App/Record/changeCity.php" method="post">
<label for="">
<textarea name="changeCity"></textarea>
</label>
<br>
<input type="submit">
</form>
</div>
</div>
<div class="adminGallery">
<h1>Галлерея</h1>
<div class="previewGallery">
<?php foreach ($data['allImages'] as $image){?>
<img src="/App/data/img/<?php echo $image->name; ?>" alt="<?php echo $image->description; ?>">
<?php }?>
</div>
<div class="form">
<p>Добавить изображение</p>
<form action="/App/Record/uploadImage.php" method="post" enctype="multipart/form-data" >
<label for="">
<input type="text" name="description" placeholder="Описание">
</label>
<div class="file-upload">
<label>
<input type="file" name="newImg">
<span>Выбрать файл</span>
</label>
</div>
<input type="hidden" id="filename" class="filename">
<input type="submit" value=Загрузить>
</form>
</div>
</div>
<div class="adminSchedule">
<h1>Расписание поездов</h1>
<table >
<tr class="title">
<td>Редактировать</td>
<td>Город отправления</td>
<td>Дата и время отправления</td>
<td>Город прибытия</td>
<td>Дата и время прибытия</td>
</tr>
<?php foreach ($data['schedule'] as $line) { ?>
<tr>
<td><a href="/App/Record/scheduleUpdate.php?id=<?php echo $line->id; ?>">Изменить</a></td>
<td><?php echo $line->departure; ?></td>
<td><?php echo $line->dep_time; ?></td>
<td><?php echo $line->arival; ?></td>
<td><?php echo $line->ariv_time; ?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
<div class="footer"></div>
</body>
</html><file_sep>/09_SPB/App/Model/gallery/UploadImage.php
<?php
namespace App\Model\gallery;
class UploadImage
{
public $formName;
public $myTypes;
public $type;
public function __construct($formName)
{
$this->formName = $formName;
}
public function isUploaded()
{
if ((isset($_FILES[$this->formName])) && (0 == $_FILES[$this->formName]['error'])) {
return true;
} else {
return false;
}
}
public function setAllowedTypes($myTypes, $type)
{
$this->myTypes = $myTypes;
$this->type = $type;
foreach ($this->myTypes as $key => $line) {
if ($line == $this->type) {
return true;
}else {
return false;
}
}
return null;
}
public function upload()
{
if ($this->isUploaded() && $this->setAllowedTypes($this->myTypes, $this->type)) {
move_uploaded_file(
$_FILES[$this->formName]['tmp_name'],
__DIR__ . '/../../data/img/' . $_FILES[$this->formName]['name']
);
} else {
return null;
}
}
}<file_sep>/07_OOP/classes/Authentication.php
<?php
class Authentication
{
protected $data;
public function __construct($data)
{
$this->data = $data;
}
public function getUsersList(){
$users = include $this->data;
return $users;
}
public function existsUser($login)
{
return isset($this->getUsersList()[$login]);
}
public function checkPassword($login, $password)
{
if($this->existsUser($login) && password_verify($password, $this->getUsersList()[$login])) {
return true;
} else {
return false;
}
}
public function getCurrentUser()
{
if (!empty($_SESSION['name'] && $this->existsUser($_SESSION['name']))) {
return $_SESSION['name'];
} else {
return null;
}
}
}
<file_sep>/07_OOP/article.php
<?php
require_once __DIR__ . '/classes/View.php';
require_once __DIR__ . '/classes/News.php';
$temlpate = __DIR__ . '/templates/article.php';
$dataNews = __DIR__ . '/data/news.php';
$news = new News($dataNews);
$view = new View();
if (isset($_GET['id'])) {
$id = $_GET['id'];
$article = $news->getData()[$id];
$view->assign('article', $article);
} else {
header('Location: /index.php');
}
$view->display($temlpate);
<file_sep>/06_Classes/index.php
<?php
session_start();
if (isset($_GET['do']) && $_GET['do'] == 'exit') {
unset($_SESSION['name']);
}
$images = scandir(__DIR__ . '/gallery/img');
$images = array_diff($images, ['.', '..']);
?>
<?php if (isset($_SESSION['name'])) {?>
<p>Имя пользователя: <?php echo $_SESSION['name']; ?> </p>
<a href="/index.php?do=exit" style="display:block;">Выйти </a>
<?php } else {?>
<a href="/login.php" style="display:block;">Войти</a>
<?php } ?>
<a href="/gbook/guestbook.php">Гостевая книга</a>
<form action="/gallery/uploaer.php" method="post" enctype="multipart/form-data">
<label for="">
<input type="file" name="newImg">
</label>
<input type="submit">
</form>
<? foreach ($images as $image){ ?>
<a href="/gallery/image.php?id=<? echo $image; ?>">
<img src="/gallery/img/<? echo $image; ?>" alt="" width="300px">
</a>
<?}?>
<file_sep>/07_OOP/classes/Gallery.php
<?php
require_once __DIR__ . '/Image.php';
class Gallery
{
protected $path;
protected $data = [];
public function __construct($path)
{
$this->path = $path;
$images = scandir($this->path);
foreach ($images as $image){
if ($image == '.' || $image == '..') {
$images = array_diff($images, ['.', '..']);
} else {
$this->data[] = new Image($image);
}
}
}
public function getData()
{
return $this->data;
}
}
<file_sep>/02_Functions/disc.php
<?php
$a = 5;
$b = 9;
$c = 3;
//вычисление дискриминанта
function dis($a, $b, $c)
{
//формула
$d = $b * $b - 4 * $a * $c;
return $d;
}
assert( dis( 5, 9, 3 ) == 21 );
assert( dis( 9, 5, 3 ) == -83 );
assert( dis( 3, 6, 3 ) == 0 );
//корень из дискриминанта
$D = sqrt(dis($a, $b, $c));
//если дискриминант меньше нуля, корней нет
if (dis($a, $b, $c ) < 0 ) {
$res = 'Корней нет!';
//если дискриминант больше нуля, корней 2
} elseif (dis($a, $b, $c) > 0 ) {
//вычисление корней
$x1 = (-1 * $b - $D) / (2 * $a);
$x2 = (-1 * $b + $D) / (2 * $a);
//кол-во корней
$res = 'Корней 2';
//если дискриминант равен нулю, корень один
} elseif (dis( $a, $b, $c) == 0) {
//вычисление корня
$x1 = (-1 * $b) / (2 * $a);
$res = 'Корень 1';
}
?>
<h3>Пункт 2. Корень квадратного уравнения </h3>
<p>Дискриминант = <?php echo dis($a, $b, $c); ?> </p>
<p><?php echo $res; ?> </p>
<p><?php echo $x1; ?> </p>
<p><?php echo $x2; ?> </p><file_sep>/09_SPB/App/Model/schedule/TrainSchedule.php
<?php
namespace App\Model\schedule;
use App\Model\database\DB;
class TrainSchedule
{
protected $data;
public function getInfo()
{
$data = [];
$db = new DB();
$information = $db->query('SELECT * FROM spb.train_schedule');
foreach ($information as $info) {
$this->data[] = new Schedule($info['id'], $info['departure'], $info['dep_time'], $info['arival'], $info['ariv_time']);
}
return $this->data;
}
public function findById($id)
{
$db = new DB();
$sql = 'SELECT * FROM spb.train_schedule WHERE id=:id';
$data = [':id' => $id];
$result = $db->query($sql, $data);
if (!empty($result)) {
return $result[0];
} else {
return false;
}
}
public function setSchedule($id, $departure, $dep_time, $arival, $ariv_time)
{
$db = new DB();
$query = 'UPDATE spb.train_schedule SET departure=:departure, dep_time=:dep_time, arival=:arival, ariv_time=:ariv_time WHERE id=:id';
$cangeInfo = [':id' => $id, ':departure' => $departure, ':dep_time' => $dep_time, ':arival' => $arival, ':ariv_time' => $ariv_time];
$db->query($query, $cangeInfo);
}
}
<file_sep>/02_Functions/gender.php
<?php
function gender($name)
{
//возвращает часть строки
$genderString = mb_substr($name, - 1);
//переводит эту часть строки к нижнему регистру
$genderName = mb_strtolower($genderString);
$women = 'Женский пол';
$men = 'Мужской пол';
//если полученная часть строки совпадает с перечисленными то
if ($genderName == 'а' || $genderName == 'я' || $genderName == 'ь') {
//вернет значение
return $women;
//если раньше не нашлось совпадений, то сравнить с другими
} elseif ($genderName == 'л' || $genderName == 'р' || $genderName == 'й'||
$genderName == 'н'|| $genderName == 'м' || $genderName == 'т' ||
$genderName == 'с' || $genderName == 'в') {
//если совпало то вернется
return $men;
//если снова не нашлось совпадений, то вернется null
} else {
return null;
}
}
assert( gender( 'Александр' ) == 'Мужской пол' );
assert( gender( 'Елена' ) == 'Женский пол' );
assert( gender( 'Ц' ) == null );
?>
<h3>Пункт 4. Определение пола по имени человека </h3>
<p><?php echo $name = 'Александра'; ?></p>
<p><?php echo gender($name); ?></p>
<file_sep>/09_SPB/App/Model/schedule/Schedule.php
<?php
namespace App\Model\schedule;
class Schedule
{
public $id;
public $departure;
public $dep_time;
public $arival;
public $ariv_time;
public function __construct($id, $departure, $dep_time, $arival, $ariv_time)
{
$this->id = $id;
$this->departure = $departure;
$this->dep_time = $dep_time;
$this->arival = $arival;
$this->ariv_time = $ariv_time;
}
}<file_sep>/06_Classes/functions.php
<?php
function getUsersList(){
$users = include __DIR__ . '/users.php';
return $users;
}
function existsUser($login){
if (isset(getUsersList()[$login])) {
return true;
} else {
return false;
}
}
function checkPassword($login, $password){
if(existsUser($login) && password_verify($password, getUsersList()[$login])) {
return true;
} else {
return false;
}
}
function getCurrentUser() {
if (!empty($_SESSION['name']) && existsUser($_SESSION['name'])) {
return $_SESSION['name'];
} else {
return null;
}
}
<file_sep>/09_SPB/App/Record/scheduleUpdate.php
<?php
require __DIR__ . '/../../autoload.php';
$template = __DIR__ . '/../View/templates/scheduleUpdate.php';
$view = new \App\View\classes\View();
$info = new \App\Model\schedule\TrainSchedule();
if(isset($_POST['departure']) && isset($_POST['dep_time']) && isset($_POST['arival']) && isset($_POST['ariv_time'])){
$info->setSchedule($_POST['id'], $_POST['departure'], $_POST['dep_time'], $_POST['arival'], $_POST['ariv_time']);
header('Location: /../App/Controller/admin.php');
}
$view->assign('schedule', $info->findById($_GET['id']));
$view->display($template);
<file_sep>/09_SPB/App/Record/changeCity.php
<?php
require __DIR__ . '/../../autoload.php';
if ((isset($_POST['changeCity'])) && (!empty($_POST['changeCity']))) {
$cityRec = new \App\Model\city\City(__DIR__ . '/../data/cityText.txt');
$cityRec->upCity($_POST['changeCity']);
header('Location: /../App/Controller/admin.php');
} else {
header('Location: /../App/Controller/admin.php');
return null;
}<file_sep>/05_Session/login.php
<?php
session_start();
include __DIR__ . '/functions.php';
if (null !== getCurrentUser()){
header('Location: /index.php');
} else {
if (isset($_POST['login']) && isset($_POST['password']) && checkPassword($_POST['login'], $_POST['password'])){
$_SESSION['name'] = $_POST['login'];
header('Location: /index.php');
}
}
?>
<a href="/index.php">На главную</a>
<form action="/login.php" method="post">
<input type="text" name="login" placeholder="Логин">
<input type="password" name="password" placeholder="<PASSWORD>">
<button type="submit">Войти</button>
</form><file_sep>/03_Arrays/funCalc.php
<?php
//функция принимает 3 оператора (переменные в которых хранятся полученные значения)
function calc($x, $y, $oper)
{
//если значения равны null, или одно значение равно null возвращается просьба заполнить паля
if ($x == null || $y == null || $oper == null) {
return null;
//иначе начинаем проверять какие значения введены
} else {
//проводит мат. операции, с поправкой / 0
if ($oper == '+') {
return $x + $y;
} elseif ($oper == '-'){
return $x - $y;
} elseif ($oper == '*'){
return $x * $y;
} elseif ($oper == '/'){
if($x == 0 || $y == 0 ){
return null;
} else {
return $x / $y;
}
}
}
}
<file_sep>/09_SPB/App/View/templates/schedule.php
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/App/View/templates/css/style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="<KEY>" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Marck+Script&subset=cyrillic,latin-ext" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="/App/View/templates/js/script.js"></script>
<title>Расписание поездов</title>
</head>
<body>
<nav>
<div class="wrapper">
<div class="menuTuggle"><i class="fa fa-bars" aria-hidden="true"></i></div>
<ul class="menu clearfix">
<li><a href="/index.php">Главная</a></li>
<li><a href="/App/Controller/gallery.php">Галерея</a></li>
<li><a href="/App/Controller/schedule.php">Расписание поездов</a></li>
<li><a href="/App/Controller/admin.php">Админ панель</a></li>
</ul>
</div>
</nav>
<div class="schedule">
<h1>Расписание поездов</h1>
<table>
<tr class="title">
<td>Город отправления</td>
<td>Дата и время отправления</td>
<td>Город прибытия</td>
<td>Дата и время прибытия</td>
</tr>
<?php foreach ($data['schedule'] as $line) { ?>
<tr>
<td><?php echo $line->departure; ?></td>
<td><?php echo $line->dep_time; ?></td>
<td><?php echo $line->arival; ?></td>
<td><?php echo $line->ariv_time; ?></td>
</tr>
<?php } ?>
</table>
</div>
<div class="footer"></div>
</body>
</html><file_sep>/04_Upload/upload.php
<?php
$type = include __DIR__ . '/upType.php';
//если файл сушествует
if (isset($_FILES['newImg'])) {
//если в файле нет ошибок если последний последний элемент массива соответствует
if ((0 == $_FILES['newImg']['error']) && in_array($_FILES['newImg']['type'], $type)) {
//имя полученное от пользователя
$name = $_FILES['newImg']['name'];
//загрузка в указанную директорию с именем полученным от пользователя
move_uploaded_file(
$_FILES['newImg']['tmp_name'],
__DIR__ . '/img/' . $name
);
}
//перенаправляет на страницу галереи
header('Location: /index.php');
}
<file_sep>/04_Upload/upType.php
<?php
return [
'image/jpeg',
'image/png',
];
<file_sep>/04_Upload/index.php
<?php
include __DIR__ . '/upload.php';
//выводит файл из папки
$list = scandir(__DIR__ . '/img');
$list = array_diff($list, ['.','..']);
?>
<a href="/gBook.php">Гостевая книга</a>
<form action="/upload.php" method="post" enctype="multipart/form-data" >
<label for="img">Загрузить файл<br>
<input type="file" name="newImg">
</label>
<label for="">
<input type="submit" value=Загрузить>
</label>
</form>
<? foreach ($list as $name){ ?>
<a href="/image.php?id=<? echo $name; ?>">
<img src="/img/<? echo $name; ?>" alt="" width="300px">
</a>
<?}?><file_sep>/03_Arrays/calc.php
<?php
include __DIR__ . '/funCalc.php';
//если были установлены переменные
if (isset($_GET['x']) || isset($_GET['y']) || isset($_GET['arithmetic'])) {
//то присваиваем их значение новым переменным для дальнейшей работы
$x = $_GET['x'];
$y = $_GET['y'];
$oper = $_GET['arithmetic'];
//иначе присваиваем переменным значение null
} else {
$x = null;
$y = null;
$oper = null;
}
//вывод получившегося значения
$z = calc($x, $y, $oper);
?>
<h3>Калькулятор</h3>
<form action="/calc.php" method="get">
<label for="">
<!--Вывод введенных значений-->
<input type="number" name="x" value="<?php echo $x; ?>">
</label>
<select name="arithmetic" id="">
<option value="+"> + </option>
<option value="-"> - </option>
<option value="*"> * </option>
<option value="/"> / </option>
</select>
<label for="">
<!--Вывод введенных значений-->
<input type="number" name="y" value="<?php echo $y; ?>">
</label>
<label for="">
<input type="submit" value="=">
</label>
<!--Вывод результата-->
<span> <?php echo $z; ?></span>
</form>
<file_sep>/08_DataBase/index.php
<?php
require_once __DIR__ . '/classes/View.php';
require_once __DIR__ . '/classes/News.php';
$template = __DIR__ . '/templates/index.php';
$view = new View();
$news = new News();
$view->assign('news', $news->getData());
$view->display($template);
<file_sep>/09_SPB/App/View/templates/scheduleUpdate.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/App/View/templates/css/style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="<KEY>" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Marck+Script&subset=cyrillic,latin-ext" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="/App/View/templates/js/script.js"></script>
<title>Document</title>
</head>
<body>
<nav>
<div class="wrapper">
<div class="menuTuggle"><i class="fa fa-bars" aria-hidden="true"></i></div>
<ul class="menu clearfix">
<li><a href="/index.php">Главная</a></li>
<li><a href="/App/Controller/gallery.php">Галерея</a></li>
<li><a href="/App/Controller/schedule.php">Расписание поездов</a></li>
<li><a href="/App/Controller/admin.php">Админ панель</a></li>
</ul>
</div>
</nav>
<div class="wrapper scheduleChange">
<div class="form">
<P>Изменить Расписание</P>
<form action="/App/Record/scheduleUpdate.php" method="post">
<input type="hidden" name="id" value="<?php echo $data['schedule']['id']; ?>">
<label for="">
<span>Город отправления</span><br>
<input type="text" name="departure" value="<?php echo $data['schedule']['departure']; ?>">
</label><br>
<label for="">
<span>Дата и время отправления</span><br>
<input type="text" name="dep_time" value="<?php echo $data['schedule']['dep_time']; ?>">
</label><br>
<label for="">
<span>Город прибытия</span><br>
<input type="text" name="arival" value="<?php echo $data['schedule']['arival']; ?>">
</label><br>
<label for="">
<span>Дата и время прибытия</span><br>
<input type="text" name="ariv_time" value="<?php echo $data['schedule']['ariv_time'] ?>">
</label><br>
<input type="submit">
</form>
</div>
</div>
<div class="footer"></div>
</body>
</html><file_sep>/08_DataBase/classes/Article.php
<?php
class Article
{
public $id;
public $title;
public $text;
public $author;
public function __construct($id, $title, $text, $author)
{
$this->id = $id;
$this->title = $title;
$this->text = $text;
$this->author = $author;
}
}<file_sep>/02_Functions/inc.php
<?php
$inc = include __DIR__ . '/include.php';
//$incTest = include __DIR__ . '/includeNull.php';
?>
<h3>Пункт 3. Изучение Include в виде функции </h3>
<p><?php var_dump($inc); ?></p>
<p><?php var_dump($includeNull);?></p>
<p><?php echo $inc; ?></p>
<p>
Оператор include, если его использовать как функцию возвращает int 1 если файл существует,
и boolean false если файл не найден, если в подключаемом файле использовать конструкцию return то вернет
значение полученное от return (string 'hello world' (length=11)).
</p>
<file_sep>/06_Classes/classes/GuestBook.php
<?php
include __DIR__ . '/TextFile.php';
class GuestBook extends TextFile
{
public function append($text)
{
$this->data[] = $text;
return $this;
}
public function save()
{
$newLine = implode("\n", $this->data);
file_put_contents($this->path, $newLine);
}
}
<file_sep>/06_Classes/users.php
<?php
return [
//123
'User1' => <PASSWORD>',
//456
'User2' => <PASSWORD>',
];<file_sep>/07_OOP/templates/image.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Одна картика</title>
</head>
<body>
<h1>Одна картинка</h1>
<a href="/index.php" style="display:block;">На главную</a>
<img width="600px" src="/images/<?php echo $data['image']; ?>" alt="">
</body>
</html>
<file_sep>/08_DataBase/classes/DB.php
<?php
/*
Создайте класс DB
1. В конструкторе устанавливается и сохраняется соединение с базой данных. Параметры соединения берем из файла конфига
2. Метод execute(string $sql) выполняет запрос и возвращает true либо false в зависимости от того, удалось ли выполнение
3. Метод query(string $sql, array $data) выполняет запрос, подставляет в него данные $data, возвращает данные результата запроса либо false, если выполнение не удалось
* */
class DB
{
//В конструкторе устанавливается и сохраняется соединение с базой данных.
// Параметры соединения берем из файла конфига
protected $dbh;
public function __construct()
{
$config = include __DIR__ . '/../data/config.php';
$this->dbh = new PDO($config['dsn'], $config['user'], $config['password']);
}
//Метод execute(string $sql) выполняет запрос и возвращает true либо false в зависимости от того, удалось ли выполнение
public function execute(string $sql)
{
$sth = $this->dbh->prepare($sql);
return $sth->execute();
}
//Метод query(string $sql, array $data) выполняет запрос, подставляет в него данные $data, возвращает данные результата запроса либо false, если выполнение не удалось
public function query(string $sql, array $data = [])
{
$sth = $this->dbh->prepare($sql);
if ($sth->execute($data)) {
return $sth->fetchAll();
} else {
return false;
}
}
}
//$database = new DB();
//
//var_dump($database->query('SELECT * FROM news'));
//подстановки!!!!!!!!!!!!
//var_dump($database->query('SELECT * FROM news WHERE id=:id', [':id' => $_GET['id']]));<file_sep>/05_Session/index.php
<?php
session_start();
$list = scandir(__DIR__ . '/images');
$list = array_diff($list, ['.','..']);
if (isset( $_GET['do'] )&& $_GET['do'] == 'exit' ) {
unset($_SESSION['name']);
}
?>
<?php if (isset($_SESSION['name'])) {?>
<p>Имя пользователя: <?php echo $_SESSION['name']; ?> </p>
<a href="/index.php?do=exit" style="display:block;">Выйти </a>
<?php } else {?>
<a href="/login.php" style="display:block;">Войти</a>
<?php } ?>
<form action="/upload.php" method="post" enctype="multipart/form-data">
<label for="img">
<input type="file" name="newImg">
</label>
<input type="submit">
</form>
<? foreach ($list as $name){ ?>
<a href="/image.php?id=<? echo $name; ?>">
<img src="/images/<? echo $name; ?>" alt="" width="300px">
</a>
<?}?><file_sep>/07_OOP/image.php
<?php
require_once __DIR__ . '/classes/View.php';
$template = __DIR__ . '/templates/image.php';
$view = new View();
if (isset($_GET['id']) && !empty($_GET['id'])) {
$imgId = $_GET['id'];
$view->assign('image', $imgId);
} else {
header('Location: /index.php');
}
$view->display($template); | a644cdbb65aea86bf92d419446771b0bb2b7275a | [
"JavaScript",
"SQL",
"PHP"
] | 68 | PHP | MargoJoy/php1 | 3a09ccaf412e1df14a70919844529366ee1f3770 | cc18db1ea2b67408c731bc5e76a670a7bfd618a0 |
refs/heads/master | <file_sep>require 'rails_helper'
RSpec.describe PassengerRide, type: :model do
# Associations
it { should have_one(:network).through(:user) }
it { should belong_to(:user) }
it { should belong_to(:ride) }
it { should belong_to(:driver_ride).optional }
end
<file_sep>require "rails_helper"
RSpec.describe "Ride sharing between a driver and a passenger", :type => :request do
let(:network) { Network.create(name: "Paris") }
let(:driver){ User.create(email: "<EMAIL>", network: network) }
let(:passenger){User.create(email: "<EMAIL>", network: network)}
let(:ride){Ride.create(departure: "ici", arrival: "la", network: network) }
let(:header_value) { Base64.encode64(network.name) }
it "creates a Widget and redirects to the Widget's page" do
post "/graphql",
params: {
query: "mutation{
createDriverRide(
input: {
userId: #{driver.id},
rideId: #{ride.id}
}
){
driverRide{
id
}
errors
}
}"
},
headers: {
'x-network-name': header_value
}
expect(DriverRide.last.user).to eq(driver)
expect(DriverRide.last.ride).to eq(ride)
post "/graphql",
params: {
query: "mutation{
createPassengerRide(
input: {
userId: #{passenger.id},
rideId: #{ride.id}
}
){
passengerRide{
id
}
errors
}
}"
},
headers: {
'x-network-name': header_value
}
expect(PassengerRide.last.user).to eq(passenger)
expect(PassengerRide.last.ride).to eq(ride)
post "/graphql",
params: {
query: "mutation{
shareRide(
input: {
driverRideId: #{DriverRide.last.id},
passengerRideId: #{PassengerRide.last.id}
}
){
passengerRide{
id
}
errors
}
}"
},
headers: {
'x-network-name': header_value
}
p response.body
expect(PassengerRide.last.driver_ride).to eq(DriverRide.last)
end
end
<file_sep>require 'rails_helper'
describe CreatePassengerRide, type: :interactor do
let(:network) { Network.create(name: "Paris") }
let(:user){ User.create(email: "<EMAIL>", network: network) }
let(:ride){Ride.create(departure: "ici", arrival: "la", network: network) }
describe '#call' do
context 'when driver ride does not save' do
it 'return data with errors' do
result = CreatePassengerRide.call(
network: network,
options: {}
)
expect(result.success?).to be_falsey
expect(result.data).to be
expect(result.data[:passenger_ride]).to be_nil
expect(result.data[:errors]).to be
end
end
context 'when driver ride saves' do
it 'should return a result with a driver ride instance' do
result = CreatePassengerRide.call(
network: network,
options: {
user_id: user.id,
ride_id: ride.id
}
)
expect(result.success?).to be_truthy
expect(result.data).to be
expect(result.data[:passenger_ride]).to be
expect(result.data[:errors]).to be_empty
end
end
end
end
<file_sep>require 'rails_helper'
RSpec.describe GraphqlController, type: :request do
let(:network) { Network.create(name: "Paris") }
let(:header_value) { Base64.encode64(network.name) }
describe "#execute" do
context "HTTP_X_NETWORK_NAME" do
it "should return 403 if no header is provided" do
post "/graphql", params: {
query: "query{
users{
id
}
}"
}
expect(response.status).to eq(403)
end
it "should retyrb 400 if the header value is not valid" do
post "/graphql",
params: {
query: "query{
users{
id
}
}"
},
headers: {
'x-network-name': ''
}
expect(response.status).to eq(400)
end
it "should execute query if header value is right" do
post "/graphql",
params: {
query: "query{
users{
id
}
}"
},
headers: {
'x-network-name': header_value
}
expect(response.status).to eq(200)
end
end
end
end<file_sep>require 'rails_helper'
RSpec.describe User, type: :model do
# Associations
it { should belong_to(:network) }
it { should have_many(:driver_rides) }
it { should have_many(:passenger_rides) }
# Validations
it { should validate_presence_of(:email) }
end
<file_sep>require 'rails_helper'
RSpec.describe Ride, type: :model do
# Associations
it { should belong_to(:network) }
it { should have_many(:driver_rides) }
it { should have_many(:passenger_rides) }
# Validations
it { should validate_presence_of(:departure) }
it { should validate_presence_of(:arrival) }
end
<file_sep>require 'rails_helper'
RSpec.describe DriverRide, type: :model do
# Associations
it { should have_one(:network).through(:user) }
it { should belong_to(:user) }
it { should belong_to(:ride) }
it { should have_many(:passenger_rides) }
end
<file_sep>module Mutations
class CreatePassengerRideMutation < Mutations::BaseMutation
description "A passenger requests a ride"
argument :user_id, ID, "The id of the passenger", required: true
argument :ride_id, ID, "The id of the ride", required: true
field :passenger_ride, Types::PassengerRideType, "The created passenger ride", null: true
field :errors, [String], "The list of errors if it failed. Empty if succeed.", null: true
def resolve(**options)
result = CreatePassengerRide.call(
options: options,
network: object
)
result.data
end
end
end
<file_sep>class CreateDriverRide
include Interactor
include NetworkSupport
include RideSupport
delegate :network, :options, to: :context
def call
driver_ride = ride.driver_rides.build(options)
if driver_ride.save
context.data = {
driver_ride: driver_ride,
errors: []
}
else
context.data = {
driver_ride: nil,
errors: driver_ride.errors.full_messages
}
context.fail!
end
rescue
context.data = {
errors: ["See logs for details"]
}
context.fail!
end
end<file_sep>module Mutations
class ShareRideMutation < Mutations::BaseMutation
description "A passenger goes with a driver"
argument :driver_ride_id, ID, "The id of the driver ride", required: true
argument :passenger_ride_id, ID, "The id of the passenger ride", required: true
field :passenger_ride, Types::PassengerRideType, "The updated passenger ride", null: true
field :errors, [String], "The list of errors if it failed. Empty if succeed.", null: true
def resolve(passenger_ride_id:, **options)
result = ShareRide.call(
options: options,
passenger_ride_id: passenger_ride_id,
network: object
)
result.data
end
end
end
<file_sep>require 'rails_helper'
describe ShareRide, type: :interactor do
let(:network) { Network.create(name: "Paris") }
let(:driver){ User.create(email: "<EMAIL>", network: network) }
let(:passenger){User.create(email: "<EMAIL>", network: network)}
let(:ride){Ride.create(departure: "ici", arrival: "la", network: network) }
let(:passenger_ride) { PassengerRide.create(network: network, user: passenger, ride: ride)}
let(:driver_ride) { DriverRide.create(network: network, user: driver, ride: ride)}
describe '#call' do
context 'when driver ride does not save' do
it 'return data with errors' do
result = ShareRide.call(
network: network,
options: {}
)
expect(result.success?).to be_falsey
expect(result.data).to be
expect(result.data[:passenger_ride]).to be_nil
expect(result.data[:errors]).to be
end
end
context 'when driver ride saves' do
it 'should return a result with a driver ride instance' do
result = ShareRide.call(
network: network,
passenger_ride_id: passenger_ride.id,
options: {
driver_ride: driver_ride
}
)
expect(result.success?).to be_truthy
expect(result.data).to be
expect(result.data[:passenger_ride]).to be
expect(result.data[:errors]).to be_empty
end
end
end
end
<file_sep>require 'rails_helper'
RSpec.describe Network, type: :model do
# Associations
it { should have_many(:users) }
it { should have_many(:rides) }
it { should have_many(:driver_rides).through(:rides) }
it { should have_many(:passenger_rides).through(:rides) }
# Validations
it { should validate_presence_of(:name) }
it { should validate_uniqueness_of(:name) }
end
<file_sep>module Types
class NetworkType < Types::BaseObject
description "Network"
field :name, String, null: false
end
end
<file_sep># We flush the DB
PassengerRide.delete_all
DriverRide.delete_all
Ride.delete_all
User.delete_all
Network.delete_all
#Create networks
toulouse_network = Network.create!(name: "Toulouse")
paris_network = Network.create!(name: "Paris")
# We start by creating some rides,
# These are the available routes our users will be able to use
toulouse_intra = Ride.create!(departure: "Cite de l'espace", arrival: "Capitole", network: toulouse_network)
toulouse_navette = Ride.create!(departure: "Capitole", arrival: "Aeroport", network: toulouse_network)
paris_intra = Ride.create!(departure: "Louvre", arrival: "Nation", network: paris_network)
paris_suburb = Ride.create!(departure: "Clichy", arrival: "Louvre", network: paris_network)
[toulouse_network, paris_network].each do |network|
suffix = "+#{network.name.downcase}"
# Now, some users have signed up to our platform
# David, with a "D" as in "Driver"
david = User.create!(email: "<EMAIL>", network: network)
# Patrice, with a "P" as in "Passenger"
patrice = User.create!(email: "<EMAIL>", network: network)
# Peter, with a "P" as in "Passenger"
peter = User.create!(email: "<EMAIL>", network: network)
# Next, our users start to use our transport service
# David inform us that he will drive his car on the toulouse_intra route
david_ride = DriverRide.create!(user: david, ride: network.rides.first)
# And at the same time, Patrice made a passenger request on the same route
patrice_ride = PassengerRide.create!(user: patrice, ride: network.rides.first)
# So both of them meet, and David invites Patrice to share the ride
patrice_ride.update!(driver_ride: david_ride)
# At the last time, Peter also make a request for the same route
peter_ride = PassengerRide.create!(user: peter, ride: network.rides.first)
# So David can also take him in his car, he now has two passenger, and his car is almost full.
# So much co2 saved compared to if the three of them had used their own car
peter_ride.update!(driver_ride: david_ride)
end
<file_sep>module RideSupport
extend ActiveSupport::Concern
included do
delegate :ride, to: :context
before :check_ride
end
private
def check_ride
# byebug
context.ride = network.rides.find(options[:ride_id])
rescue ActiveRecord::RecordNotFound => e
context.data = {
errors: ["ride_id is required"]
}
context.fail!
end
end<file_sep>class Network < ApplicationRecord
has_many :users
has_many :rides
has_many :driver_rides, through: :rides
has_many :passenger_rides, through: :rides
validates_presence_of :name
validates_uniqueness_of :name
end
<file_sep>class PassengerRide < ApplicationRecord
belongs_to :user
belongs_to :ride
belongs_to :driver_ride, optional: true
has_one :network, through: :user
end
<file_sep>class DriverRide < ApplicationRecord
# Associations
belongs_to :user
belongs_to :ride
has_many :passenger_rides
has_one :network, through: :user
end
<file_sep>module NetworkSupport
extend ActiveSupport::Concern
included do
before :check_network
end
private
def check_network
if !network
context.data = {
errors: ["Network is required"]
}
context.fail!
end
end
end<file_sep>class ShareRide
include Interactor
delegate :network, :passenger_ride_id, :options, to: :context
def call
passenger_ride = network.passenger_rides.find(passenger_ride_id)
if passenger_ride.update(options)
context.data = {
passenger_ride: passenger_ride,
errors: []
}
else
context.data = {
passenger_ride: nil,
errors: passenger_ride.errors.full_messages
}
context.fail!
end
rescue
context.data = {
errors: ["See logs for details"]
}
context.fail!
end
end<file_sep>class Ride < ApplicationRecord
# Associations
belongs_to :network
has_many :driver_rides
has_many :passenger_rides
# Validations
validates_presence_of :departure, :arrival
# Scopes
scope :by_network, ->(network) { where(network: network) }
end
<file_sep>class CreatePassengerRide
include Interactor
include NetworkSupport
include RideSupport
delegate :network, :options, to: :context
def call
passenger_ride = ride.passenger_rides.build(options)
if passenger_ride.save
context.data = {
passenger_ride: passenger_ride,
errors: []
}
else
context.data = {
passenger_ride: nil,
errors: passenger_ride.errors.full_messages
}
context.fail!
end
rescue
context.data = {
errors: ["See logs for details"]
}
context.fail!
end
end<file_sep>module Types
class QueryType < Types::BaseObject
field :users, [Types::UserType], null: false, description: "A list of users scoped to a network"
field :rides, [Types::RideType], null: false, description: "A list of rides scoped to a network"
field :driver_rides, [Types::DriverRideType], null: false, description: "A list of driver rides scoped to a network"
field :passenger_rides, [Types::PassengerRideType], null: false, description: "A list of passenger rides scoped to a network"
end
end
<file_sep>module Mutations
class CreateDriverRideMutation < Mutations::BaseMutation
description "A driver declares he will drive trhough a ride"
argument :user_id, ID, "The id of the driver", required: true
argument :ride_id, ID, "The id of the ride", required: true
field :driver_ride, Types::DriverRideType, "The created driver ride", null: true
field :errors, [String], "The list of errors if it failed. Empty if succeed.", null: true
def resolve(**options)
result = CreateDriverRide.call(
options: options,
network: object
)
result.data
end
end
end
| 67b383b78ce3097fa9744e4add627685fd70723e | [
"Ruby"
] | 24 | Ruby | cedricnjanga/backend_recruitment_test | e34b3d962d4620e41d467d3270bfa8a089864680 | c59f1f4827d107988e91c5ce5943e7f497c78d23 |
refs/heads/master | <repo_name>sagormohammedyousuf/test<file_sep>/dist/index.dev.js
"use strict";
// typeof("sagor ali");
/*
jaflk
alfjlk*/
// onload="alert(' please wait');"
// var name = "sagor"
// var age = 21
// // document.write(name + age);
// var name ,age ;
// name = "murshida";
// age = 19;
// // document.write( name + age );
// age = toString(num)
// console.log(typeof(num));
// var number = "20.5426";
// num = toString(num)
// num = parseFloat (num)
// document.write(typeof(num));
// document.write(number.toFixed(3))
// document.write(number.toPrecision(1));
// document.write(typeof(Number("23")))
// document.write(Number("23"))
// var firstName = "<NAME>"
// var lastName = "Yousuf "
// var fullName = firstName + lastName;
// document.write("My name is " + fullName);
// var num1 = 34;
// var num2 = 45;
// document.write("nu1 = " + num1 +"num2 = "+ num2);
// var text = "bangladesh vs pakistan";
// var len = text.length;
// document.write("number of character" + text.length);
/* var text = prompt("Please enter your name : ");
// var len = text.length;
document.write("My Name is" + text); */
// var base = prompt('Enter Base = ');
// var height = prompt ("Enter Base = ")
// var area = base * height;
// document.write("area = " + area);
// var base = parseFloat(prompt('Enter Base = '));
// var height = parseFloat(prompt ("Enter hieght = "));
// var area = base * height;
// document.write("area = " + area);
// var num1 = "20";
// var num2 =20 ;
// document.write(num1===num2);
// var num = 34 ;
// if(num%2==0)
// document.write("Even");
// else
// document.write("odd")
// var mark = prompt("Enter Your mark:");
// if (mark < 33 )
// document.write("fail");
// else if (mark > 33)
// document.write("pass");
// else if (mark < 50 )
// document.write("a-");
// else("a+")
// mark check if else pracice
/*
var marks = prompt("Enter Your marks : ");
if (marks >= 80)
document.write("A+");
else if (marks >= 70)
document.write("A");
else if (marks >= 60)
document.write("A-");
else if (marks >= 50)
document.write("B");
else if (marks >= 40)
document.write("C");
else if (marks >= 33)
document.write("D");
else
document.write("Fail");
*/
// large number check
/*
var num1 = prompt("enter num1 : ");
var num2 = prompt("enter num2 : ");
var num3 = prompt("enter num3 : ");
if (num1 > num2 && num1 > num3)
document.write("large Number =" + num1);
else if (num2 > num1 && num2 > num3)
document.write("large Number =" + num2);
else
document.write("Large number = " + num3);
*/
// vowel consonat check //
/*
var letter = prompt("Ener a letter : ");
if (letter=="a" || letter =="e" || letter=="i" || letter=="o" || letter=="u" )
document.write("vowel");
else
document.write("consonat");
*/
/*
var digit = prompt("Enter any digit : ");
switch (digit) {
case "0":
document.write("zero");
break;
case "1" :
document.write("one");
break;
case "2" :
document.write("tow");
break;
case "3" :
document.write("three");
break;
case "4" :
document.write("four");
break;
case "5" :
document.write("five");
break;
case "6" :
document.write("six");
break;
case "7" :
document.write("seven");
break;
case "8" :
document.write("eight");
break;
case "9" :
document.write("nine");
break;
case "10" :
document.write("ten");
break;
case "11" :
document.write("eleven");
break;
case "12" :
document.write("twelve3");
break;
default:
document.write("not a digit ");
}
*/
/*
var digit = prompt("Enter Your Roll : ");
switch (digit) {
case "1" :
document.write("Yousuf");
break;
case "2" :
document.write("sagor");
break;
case "3" :
document.write("Murshida");
break;
case "4" :
document.write("Mim");
break;
case "5" :
document.write("Eva");
break;
case "6" :
document.write("আতিফ");
break;
default:
document.write("<h2> Sorry invalid </h2> ");
}
*/
/*
var letter = prompt("Enter any single letter : ");
letter = letter.toLowerCase();
switch(letter){
case "a":
document.write("vowel")
break
case "e":
document.write("vowel")
break
case "i":
document.write("vowel")
break
case "o":
document.write("vowel")
break
case "u":
document.write("vowel")
break
default:
document.write("consonat");
}
*/
/*
var letter = prompt("Enter any single letter : ");
letter = letter.toLowerCase();
switch(letter){
case "a":
case "i":
case "e":
case "o":
document.write("vowel");
break;
default:
document.write("consonant");
}
*/
/*
var marks = prompt("Please Enter Any letter : ");
marks = marks.toLowerCase();
switch(marks){
case "a":
case "i" :
case "e" :
case "o" :
document.write("vowel");
break;
default:
document.write("consonat");
}
*/
// লুপ for loop
// for( var x = 1; x <= 10; x = x + 1 )
// {
// document.write("pakistan");
// }
// document.write("end");
// for (var x = 1; x <=10; x++1){
// document.write('' + x);
// }
// while loop
// var i = 1;
// while (i <= 10) {
// document.write(" " + i );
// i = i + 2
// }
// var vaterDam = prompt("enter Your buget : ");
// if (vaterDam < 30 ){
// document.write("bhat den vat khabo ")
// }
// else{
// document.write("vat nei porota khan");
// }
// var age = prompt("Enter Your ege ");
// if(age >= 18 ){
// document.write("vote dite parbe ");
// }
// else{
// document.write("E tui ekhane ki koris ja vag , 18 na hole vote dite parbi na bujhli ")
// }
// var age = prompt("Enter Your Age : ");
// switch(age){
// case "age >= 18" :
// document.write("ja vote di");
// break
// default:
// document.write("ja vag kiser vote re tor ")
// }
// var budget = prompt("Enter Yousr Budget : ");
// if(budget >= 200){
// document.write("ha niye jan apple ")
// }
// else{
// document.write("na hobe na")
// }
// var letter = prompt("Enter Eny Letter : ");
// letter = letter.toLowerCase();
// switch(letter){
// case "a":
// case "e":
// case "i":
// case "o":
// case "u":
// document.write("Vowel");
// break
// // case "1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 0":
// // document.write("number")
// // break
// default:
// document.write("consonat")
// }
// var beton = prompt("Please offer Your tiution fee, how much you can pay : ");
// var isChatri = prompt(" meye student = Yes or No ");
// if(beton >= 4000 || isChatri == yes){
// document.write("Kopal khule geche ");
// }
// else{
// document.write("fokira marka tiutioni");
// }
// var friends = ["sagor" , "yousuf" , "murshida" , "mim" ];
// document.write("yousuf");
// var kotoBar = 0;
// while(kotoBar < 10){
// document.write("ek bar kan dhore uthbos korchi ");
// kotoBar ++;
// }
// for (var x=1; x <= 10; x=x){
// document.write("<h1> Bangladesh </h1>");
// }
// document.write("end")
// for (var x = 1; x x <= 10; x = x ++){
// document.write("<h1>Pakistan</h1>");
// }
// for ( var x = 1; x <= 20; x = x ++ ;){
// }
// document.write("end")
// var x = 0 ;
// while(x <=10){
// x ++
// document.write(" " + x);
// }
// var x = 0 ;
// do{
// document.write(" " + x );
// x ++;
// }while (x <= 50);
// for ( var x = 1; x <= 100; x++){
// if (x == 10 ){
// break;
// }
// document.write(" " + x );
// }
// document.write("<h1>I Love Murshida Mim </h1>");
// for ( var x = 1; x <= 100; x++){
// if (x == 10 ){
// continue;
// }
// document.write(" " + x + " <br> ");
// }
// document.write("<h1>I Love Murshida Mim </h1>");
// function
// function sagor(){
// var num = 5 ;
// var result = num * num ;
// document.write("Result = "+ result + "<br>");
// }
// sagor();
// function sagor(num,num1,num2){
// var result = num * num1 * num2 ;
// document.write("Result = "+ result + "<br>");
// }
// sagor(2, 3,3);
// function sagor(num, num1){
// var result = num * num1 ;
// // return result;
// }
// // var a = sagor(7,9);
// // document.write(a )
// sagor(10,90);
// sagor(78,30);
// var num = ["0","1", "2", "3" , "4","5"]
// for( var i = 0; i <= 5; i++){
// document.write(num[i]);
// }
// var x = 0 ;
// while( x <= 100){
// x++
// document.write(" " + x);
// }
// var num = ["0","1", "2", "3" , "4","5"];
// num.shift();
// console.log(num);
// var num = ["0","1", "2", "3" , "4","5"];
// num.unshift("sagor");
// console.log(num);
// var n = ["0","1", "2", "3" , "4","5"];
// document.write(n);
// adding Element
// n.splice(2,0,"karim","rahim");
// removeEvent
// n.splice(1,2);
// document.write(n);
// var nw = n.slice();
// document.write(nw);
// console.log(n)
// var n = [ "sagor ", "yousuf", "anower" , " sharmin", "mama"]
// var sortedn = n.sort();
// console.log(sortedn);
// document.write(sagor);
// var nams = ["sagor" ,"mim" ,"Yousuf" ,"murshida"];
// names.push("eva");
// console.log(names);
// function obj (nam , age , gpa, lang){
// this.nam = nam ;
// this.age = age ;
// this.gpa = gpa ;
// this.lang = lang ;
// }
// var stu = new obj("sagor " , 20 , 3.93 , ["Bangla " , "hindi" , " English ", "urdu"]);
// var st = new obj("yousuf" , 21 , 3.44 , ["Bangla " , "hindi" , " English ", "urdu"]);
// console.log(st.age);
// function obj (nam , age , gpa, lang){
// this.nam = nam ;
// this.age = age ;
// this.gpa = gpa ;
// this.lang = lang ;
// this.display = function(){
// console.log(this.nam);
// console.log(this.age);
// console.log(this.gpa);
// console.log(this.lang);
// }
// }
// var stu = new obj("sagor " , 20 , 3.93 , ["Bangla " , "hindi" , " English ", "urdu"]);
// var st = new obj("yousuf" , 21 , 3.44 , ["Bangla " , "hindi" , " English ", "urdu"]);
// st.display(nam);
// console.log("ssgo");
// document.getElementById("love").innerHTML = "hello kolija";
// var change = document.getElementById("murshida")
// .innerHTML = " ami murdhida ke biye korte chai ";
// document.getElementsByTagName(" h1 ") [0].innerHTML = " Hi kolija ";
// document.getElementsByClassName("head0")[0].innerHTML = " ami murshida ke biye korte chai , amr tar jonno pagol hoye jabo ";
// // var kolija = document.getElementsByClassName("head1")[1].innerHTML = " ami murdhida ke biye korbo ";
// document.querySelector(".head1").innerHTML = " ami murdhida ke biye korbo ";
// function myImg(){
// document.write("who are You ?");
// }
// var myVar = document.querySelector("#myImg");
// function myPic(){
// myVar.src ="img/y.png";
// }
// function myKobita(){
// myVar.src ="img/kobita.png";
// }
// var h1 = document.getElementsByTagName("h1")[0];
// h1.innerHTML = " <h3> km farzana mim apu ami apner dudu chuste chai</h3>"
// var head1 = document.createElement("h3");
// var text = document.createTextNode("oh km mim apu apner sathe ses korte chai");
// head1.appendChild(text);
// var maydiv = document.getElementById("my-div");
// maydiv.appendChild(head1);
// var head2 = document.getElementsByTagName("h1")[1];
// maydiv.removeChild(head2);
// var img = ["img/y.png;", "img/kobita.png"]
// var imgTag = document.querySelector("img");
// var count = o;
// function next(){
// count++;
// if(count >= img.length){
// count = 0;
// imgTag.src = img [count];
// } else{
// imgTag.src = img [count];
// }
// // imgTag.src=img[count];
// }
// function prev(){
// }
// var nam = "murshida";
// function first (){
// var welcome = " hello";
// second ();
// document.write( welcome + " " + nam);
// }
// function second(){
// var welcome2 = " i love you"
// third();
// document.write(welcome2 + " "+ nam + "<br>");
// }
// function third(){
// var welcome3 = " i want to marry you ";
// document.write(welcome3 + nam + "<br>");
// }
// first();
// var len = document.querySelectorAll(".myButton").length;
// for(var i=0; i <len ; i++){
// document.querySelectorAll(".myButton")[i].addEventListener("click", function(){
// var text = this.innerHTML;
// document.querySelector("h1").innerHTML = text + " is clicked";
// });
// }
// for(var i = 0 ; i < 3; i++){
// ocument.querySelectorAll(".myButton")[i].addEventListener("click", function(){
// var text = this.innerHTML;
// console.log(text);
// switch(text){
// case "a":
// var audio = new Audio("audio/at.mp3");
// audio.play();
// break ;
// case "b":
// var audio = new Audio("audio/ar.mp3");
// audio.play();
// break ;
// case "c":
// var audio = new Audio("audio/am.mp3");
// audio.play();
// break ;
// }
// });
// }
// var myCustomObj ={
// nam: "yousuf",
// age: 20,
// job:"sutudent",
// msg: function(){
// document.write(this);
// }
// }
// myCustomObj.msg();
// function myFunc(){
// console.log(this)
// }
// new myFunc()
// var rect = {
// width: 100,
// height: 40,
// draw: function(){
// document.write('I am a rectangle ' + ' ')
// // document.write('my width is ' + this.width)
// // document.write('my height' + this.height)
// this.printProperties()
// },
// printProperties: function(){
// document.write('my width is ' + this.width + ' ')
// document.write('my height' + this.height + ' ')
// }
// }
// rect.draw()
// function myFunc(){
// console.log(this)
// }
// myFunc()
// var createRect = function (width, height){
// return{
// width: width,
// height:height,
// draw: function(){
// console.log(' I am a rectangel')
// this.printProperties()
// console.loge(this)
// },
// printProperties: function (){
// console.log('my width is ' + this.width + ' ')
// console.log('my height' + this.height + ' ')
// }
// }
// }
// var rect1 = createRect(20,78 )
var love = " <h1> I love you</h1> ";
var nam = " <h1>Murshida </h1>";
for (x = 0; x <= 100; x++) {
document.write(x + love + " " + nam + " " + "<hr>");
} | d560b5a346c2d3b8e4dd1cd83de6e58915aabef0 | [
"JavaScript"
] | 1 | JavaScript | sagormohammedyousuf/test | 003ba0169eff025b7789ba49472a72fd2684779a | c8398064428c7d69ffbf9d9801c8e3db608630e3 |
refs/heads/master | <repo_name>AntonPoturaev/RegistryScaner<file_sep>/RegistryScaner/ValueInfo.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "ValueInfo.h"
#include "StringCnv.h"
#include <boost/format.hpp>
namespace RegistryScanner {
std::wstring ToWideString(ValueInfo const& info)
{
return boost::str(boost::wformat(
L"\tValue info: name: %1%, type: %2%, data: %3%"
)
% info.name
% ValueToType<Value_t>::GetTypeName(info.value)
% Value2WideString(info.value)
);
}
std::string ToString(ValueInfo const& info)
{
return boost::str(boost::format(
"\tValue info: name: %1%, type: %2%, data: %3%"
)
% Details::StringCnv::w2a(info.name)
% Details::StringCnv::w2a(ValueToType<Value_t>::GetTypeName(info.value))
% Value2String(info.value)
);
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/stdafx.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
<file_sep>/RegistryScaner/SimpleSingletonTpl.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
namespace RegistryScanner { namespace Details {
template<typename T>
struct SimpleSingleton
{
static T& Instance()
{
static T instance;
return instance;
}
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/Value.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <string>
#include <vector>
#include <windows.h>
#include <boost/variant.hpp>
#include <boost/shared_array.hpp>
/*
В этом файле определяются типы данных хранимые в реестре и вспомогательные методы для работы с ними
*/
namespace RegistryScanner {
enum class ValueType
{
kVTAny = -1,
kVTNone = REG_NONE,
kVTExpandString = REG_EXPAND_SZ,
kVTString = REG_SZ,
kVTBinary = REG_BINARY,
kVTDwordLittleEndian = REG_DWORD_LITTLE_ENDIAN,
kVTDwordBigEndian = REG_DWORD_BIG_ENDIAN,
kVTLink = REG_LINK,
kVTMultiString = REG_MULTI_SZ,
kVTResourceList = REG_RESOURCE_LIST,
kVTFullResourceDescriptor = REG_FULL_RESOURCE_DESCRIPTOR,
kVTResourceRequierementsList = REG_RESOURCE_REQUIREMENTS_LIST,
kVTQwordLittleEndian = REG_QWORD_LITTLE_ENDIAN,
};
typedef std::wstring String_t;
typedef std::vector<String_t> MultiString_t;
typedef DWORD Dword_t;
typedef struct {} None_t;
typedef BYTE Byte_t;
typedef std::vector<Byte_t> RawByteData_t;
struct IrregularValue
: public std::logic_error
{
public:
explicit IrregularValue(RawByteData_t const& data);
public:
RawByteData_t m_Data;
};
typedef union
{
unsigned long long qword;
Byte_t bytes[8];
}
Qword_t;
class ExpandString
{
public:
ExpandString();
ExpandString(ExpandString &&other);
ExpandString(String_t &&other);
ExpandString& operator=(ExpandString const& other);
ExpandString& operator=(ExpandString&& other);
ExpandString& operator=(String_t const& other);
bool Equal(ExpandString const& other) const;
bool Equal(String_t const& other) const;
String_t& GetValue();
String_t const& GetValue() const;
private:
String_t m_String;
};
bool operator==(ExpandString const& l, ExpandString const& r);
bool operator!=(ExpandString const& l, ExpandString const& r);
bool operator==(ExpandString const& l, String_t const& r);
bool operator!=(ExpandString const& l, String_t const& r);
typedef boost::variant<RawByteData_t, String_t, MultiString_t, ExpandString, Dword_t, Qword_t> Value_t;
typedef union
{
DWORD dword;
BYTE bytes[4];
} DwordBE_t;
struct Link {};
struct ResourceList {};
struct FullResourceDescriptor {};
struct ResourceRequierementsList {};
typedef std::wstring Name_t;
bool IsConvertible(ValueType left, ValueType right);
template<typename T>
struct ValueConstructor
{
static T Construct(ValueType type, Byte_t const* data, size_t size);
};
template<typename T>
struct ValueToType
{
static ValueType GetType(T const&) {
return ValueType:kVTNone;
}
static ValueType GetType() {
return ValueType:kVTNone;
}
static std::wstring GetTypeName(T const&) {
return L"REG_NONE";
}
static std::wstring GetTypeName() {
return L"REG_NONE";
}
};
template<>
struct ValueToType<Value_t>
{
static ValueType GetType(Value_t const& value);
static ValueType GetType();
static std::wstring GetTypeName(Value_t const&);
static std::wstring GetTypeName();
};
std::wstring Value2WideString(Value_t const& value);
std::string Value2String(Value_t const& value);
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/HiLevelScannerUseCase1.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "HiLevelScannerUseCase1.h"
#include "StringCnv.h"
#include "FileHelpers.h"
#include "TimeStamp.h"
#include <cassert>
#include <iostream>
#include <condition_variable>
#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
#include <boost/format.hpp>
namespace RegistryScanner { namespace UseCase {
namespace {
boost::filesystem::path _GenUseCaseFileName() {
return boost::str(boost::format("HiLevelScannerUseCase1_%1%_%2%.log") % ::GetCurrentProcessId() % Details::TimeStamp());
}
} /// end unnamed namespace
int HiLevelScannerUseCase1::Run()
{
HiLevelScannerUseCase1 self;
return self._Run();
}
HiLevelScannerUseCase1::HiLevelScannerUseCase1()
: m_Controller(
boost::assign::list_of
(HKEY_CURRENT_USER)
/*(HKEY_LOCAL_MACHINE) /// раскоментировать для тестов ;)
(HKEY_USERS)
(HKEY_CLASSES_ROOT)
(HKEY_CURRENT_CONFIG)*/ /// этого хватит чтобы посмотреть на принцип работы... но все ветки лучше не перебирать - консоль загнётся! если перебирать всё то надо в файл или на форму выводить!
, 100 /// это кол-во записей показываемых на экран за 1 раз
)
, m_Stoped(false)
, m_Started(false)
, m_FilePath(_GenUseCaseFileName())
{
m_ConnectionStore.emplace_back(m_Controller.AttachOnScanStartSignal(boost::bind(&HiLevelScannerUseCase1::_OnScanStart, this)));
m_ConnectionStore.emplace_back(m_Controller.AttachOnScanEndSignal(boost::bind(&HiLevelScannerUseCase1::_OnScanEnd, this, _1)));
m_ConnectionStore.emplace_back(m_Controller.AttachNextScanResultsCompleteSignal(boost::bind(&HiLevelScannerUseCase1::_OnNextScanResultsComplete, this, _1)));
}
int HiLevelScannerUseCase1::_Run()
{
m_Controller.ScanRegistryAssync();
while (!m_Started)
{
std::unique_lock<std::mutex> lock(m_Access);
m_Condition.wait(lock);
}
while (!m_Stoped)
{
std::cout << "\nScanning in process... patience" << std::endl;
static std::chrono::seconds const g_TimeOut(3);
std::unique_lock<std::mutex> lock(m_Access);
m_Condition.wait_for(lock, g_TimeOut);
}
std::cout << "*** END OF USE CASE ***" << std::endl;
::getchar();
return 0;
}
void HiLevelScannerUseCase1::_OnScanStart()
{
std::cout << "HiLevelScannerUseCase1 is started." << std::endl;
std::cout << "Wait for first results..." << std::endl;
m_Started = true;
m_Condition.notify_one();
}
void HiLevelScannerUseCase1::_OnScanEnd(bool aborted)
{
m_Stoped = true;
m_ConnectionStore.clear();
m_StopLasyReporter = [aborted]() {
std::cout << boost::str(boost::format("HiLevelScannerUseCase1 is %1%.") % (aborted ? "aborted" : "complete")) << std::endl;
};
Details::FileHelpers::CloseFile(m_File);
m_Condition.notify_one();
}
void HiLevelScannerUseCase1::_OnNextScanResultsComplete(HiLevelScannerController::ScanInfoStorePtr_t store)
{
assert(store && !store->empty() && "Bad params.");
#if defined(_DEBUG)
for (size_t i = 0; i < store->size(); ++i)
assert(store->at(i) && store->at(i)->data.is_initialized());
#endif /// _DEBUG
try
{
std::string infoStr;
for (auto currentScanInfo : *store)
infoStr += ToString(*currentScanInfo) + '\n';
_File().rdbuf()->sputn(infoStr.data(), infoStr.size());
}
catch (...) {}
}
std::ofstream& HiLevelScannerUseCase1::_File() {
return Details::FileHelpers::LazyFile(m_File, m_FilePath);
}
}} /// end namespace RegistryScanner::UseCase
<file_sep>/RegistryScaner/Handle2Path.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "Handle2Path.h"
#include "SimpleSingletonTpl.h"
#include "ntdll.h"
namespace RegistryScanner { namespace Details {
std::wstring Handle2Path(HKEY key)
{
std::wstring result;
if (key == nullptr)
result = L"Bad registry handle(is null)!";
else if (key == HKEY_CURRENT_USER)
result = L"HKEY_CURRENT_USER";
else if (key == HKEY_LOCAL_MACHINE)
result = L"HKEY_LOCAL_MACHINE";
else if (key == HKEY_USERS)
result = L"HKEY_USERS";
else if (key == HKEY_CLASSES_ROOT)
result = L"HKEY_CLASSES_ROOT";
else if (key == HKEY_CURRENT_CONFIG)
result = L"HKEY_CURRENT_CONFIG";
else
result = SimpleSingleton<NtDll>::Instance().GetKeyPathFromHKEY(key);
return result;
}
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/StaticBuffer.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <windows.h>
#include <string>
#include <type_traits>
namespace RegistryScanner { namespace Details {
template<typename CharT, size_t Capacity>
struct StaticBuffer
{
public:
typedef CharT Char_t;
typedef std::basic_string<Char_t> String_t;
public:
StaticBuffer(size_t s = 0)
: size(s)
{
::memset(data, 0, capacity * sizeof(Char_t));
}
String_t ToString() const {
return String_t(data, size);
}
template<typename Size_t>
typename std::enable_if<
std::is_integral<Size_t>::value
, Size_t
>::type const* GetSizePtr() const {
return reinterpret_cast<Size_t const*>(&size);
}
template<typename Size_t>
typename std::enable_if<
std::is_integral<Size_t>::value
, Size_t
>::type* GetSizePtr() {
return reinterpret_cast<Size_t*>(&size);
}
public:
static size_t const capacity = Capacity;
Char_t data[capacity];
size_t size;
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/HiLevelScannerController.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "HiLevelScannerController.h"
#include "ScannerFactory.h"
#include "HiLevelScanner.h"
#include "DBG_SetThreadName.h"
#include "Handle2Path.h"
#include "StringCnv.h"
#include "FileHelpers.h"
#include "TimeStamp.h"
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/format.hpp>
namespace RegistryScanner {
HiLevelScannerController::HiLevelScannerController(Descriptors_t&& params, size_t chunkSize)
: m_HkeyStore(std::forward<Descriptors_t>(params))
, m_ChunkSize(chunkSize)
, m_Out(nullptr)
{
}
HiLevelScannerController::~HiLevelScannerController() {
_StopScan(true, false);
}
void HiLevelScannerController::SetOutput(std::ostream& os) {
m_Out = std::addressof(os);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachOnScanStartSignal(OnScanStartSignal_t::slot_type slot) {
return m_OnScanStartSignal.connect(slot);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachOnScanEndSignal(OnScanEndSignal_t::slot_type slot) {
return m_OnScanEndSignal.connect(slot);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachNextScanResultsCompleteSignal(OnNextScanResultsCompleteSignal_t::slot_type slot) {
return m_OnNextScanResultsCompleteSignal.connect(slot);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachOnPathFoundSignal(OnPathFoundSignal_t::slot_type slot) {
return m_Scanner->AttachOnPathFoundSignal(slot);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachOnErrorFoundSignal(OnErrorFoundSignal_t::slot_type slot) {
return m_Scanner->AttachOnErrorFoundSignal(slot);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachOnOperationSuccessSignal(OnOperationSuccess_t::slot_type slot) {
return m_Scanner->AttachOnOperationSuccessSignal(slot);
}
HiLevelScannerController::Connection_t HiLevelScannerController::AttachOnInformationSignal(OnInformation_t::slot_type slot) {
return m_Scanner->AttachOnInformationSignal(slot);
}
void HiLevelScannerController::ScanRegistryAssync() {
m_Worker.reset(new std::thread(&HiLevelScannerController::_Routine, this));
}
void HiLevelScannerController::StopScan() {
_StopScan(true, true);
}
namespace {
boost::filesystem::path _GenScannerFileName(HKEY root) {
return boost::str(boost::format("HiLevelScanner_%1%_%2%_%3%.log")
% Details::StringCnv::w2a(Details::Handle2Path(root))
% ::GetCurrentProcessId()
% Details::TimeStamp()
);
}
class _ScannerObserver
{
public:
typedef HiLevelScannerController::ConnectionStore_t ConnectionStore_t;
typedef HiLevelScannerController::Connection_t Connection_t;
typedef IScanerDispatcher::OnPathFoundSignal_t OnPathFoundSignal_t;
public:
_ScannerObserver(IScanerDispatcher& disp, OnPathFoundSignal_t::slot_type&& slot, boost::filesystem::path&& filePath)
: m_FilePath(std::forward<boost::filesystem::path>(filePath))
, m_ConnectionStore(_Build(disp, std::forward<OnPathFoundSignal_t::slot_type>(slot)))
{
assert(!m_FilePath.empty());
}
~_ScannerObserver() {
Details::FileHelpers::CloseFile(m_File);
}
private:
ConnectionStore_t _Build(IScanerDispatcher& disp, OnPathFoundSignal_t::slot_type&& slot)
{
ConnectionStore_t connectionStore;
connectionStore.emplace_back(
disp.AttachOnPathFoundSignal([this](ScanInfoPtr_t scanInfo) {
m_OnPathFoundSignal(scanInfo);
})
);
connectionStore.emplace_back(
disp.AttachOnErrorFoundSignal([this](LONG erroCode, std::wstring message) {
_OnErrorFound(erroCode, message);
})
);
connectionStore.emplace_back(
disp.AttachOnOperationSuccessSignal([this](std::wstring message) {
_OnOperationSuccess(message);
})
);
connectionStore.emplace_back(
disp.AttachOnInformationSignal([this](std::wstring message) {
_OnInformation(message);
})
);
connectionStore.emplace_back(m_OnPathFoundSignal.connect(slot));
return connectionStore;
}
private:
void _OnErrorFound(LONG erroCode, std::wstring message) {
_File() << boost::str(boost::format("\n*** Error found. Reason: error code: %1%, message: %2% \n") % erroCode % Details::StringCnv::w2a(message)) << std::endl;
}
void _OnOperationSuccess(std::wstring message) {
_File() << boost::str(boost::format("\n*** Operation success. Info: %1% \n") % Details::StringCnv::w2a(message)) << std::endl;
}
void _OnInformation(std::wstring message) {
_File() << boost::str(boost::format("\n*** Information: %1% \n") % Details::StringCnv::w2a(message)) << std::endl;
}
std::ofstream& _File() {
return Details::FileHelpers::LazyFile(m_File, m_FilePath);
}
private:
boost::filesystem::path m_FilePath;
boost::filesystem::ofstream m_File;
OnPathFoundSignal_t m_OnPathFoundSignal;
ConnectionStore_t m_ConnectionStore;
};
} /// end unnamed namespace
void HiLevelScannerController::_Routine()
{
SetThisThreadName("HiLevelScannerController thread");
m_OnScanStartSignal();
for (auto currentHkey : m_HkeyStore)
{
static DWORD const accessMask =
KEY_READ
#if defined(_WIN64)
| KEY_WOW64_64KEY
#else
| KEY_WOW64_32KEY
#endif
;
m_Scanner = ScannerFactory::CreateScanner(HiLevelScanner::CreationParams(currentHkey, accessMask));
_DoScan(currentHkey);
m_Scanner.reset();
}
_PostScan();
m_OnScanEndSignal(false);
}
void HiLevelScannerController::_DoScan(HKEY hkey)
{
_ScannerObserver const observeer(*m_Scanner
, boost::bind(&HiLevelScannerController::_OnPathFound, this, _1)
, _GenScannerFileName(hkey)
);
m_Scanner->Scan();
}
void HiLevelScannerController::_PostScan()
{
std::lock_guard<std::mutex> const lock(m_Access);
if (m_ScanInfoStore && !m_ScanInfoStore->empty())
{
auto const size = m_ScanInfoStore->size();
assert(size <= m_ChunkSize && "Bad data. Logic error.");
m_OnNextScanResultsCompleteSignal(m_ScanInfoStore);
m_ScanInfoStore.reset();
}
}
void HiLevelScannerController::_StopScan(bool aborted, bool needSignal)
{
if (m_Worker)
{
if (m_Worker->joinable())
m_Worker->join();
if (m_Worker->joinable())
m_Worker->detach();
m_Worker.reset();
if (needSignal)
m_OnScanEndSignal(aborted);
}
}
void HiLevelScannerController::_OnPathFound(ScanInfoPtr_t scanInfo)
{
std::lock_guard<std::mutex> const lock(m_Access);
if (m_Out)
*m_Out << "\n*** ScanInfo is received successfully.\n" << std::endl;
assert(scanInfo && scanInfo->handle && scanInfo->data.is_initialized() && "Bad params.");
if (!m_ScanInfoStore)
{
m_ScanInfoStore.reset(new ScanInfoStore_t);
m_ScanInfoStore->reserve(m_ChunkSize);
}
m_ScanInfoStore->push_back(scanInfo);
assert(m_ScanInfoStore && m_ScanInfoStore->back() && m_ScanInfoStore->back()->handle && m_ScanInfoStore->back()->data.is_initialized() && "Bad data.");
assert(m_ScanInfoStore && m_ScanInfoStore->front() && m_ScanInfoStore->front()->handle && m_ScanInfoStore->front()->data.is_initialized() && "Bad data.");
if (m_ScanInfoStore->size() == m_ChunkSize)
{
m_OnNextScanResultsCompleteSignal(m_ScanInfoStore);
m_ScanInfoStore.reset();
}
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/StringCnv.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "StringCnv.h"
#include <locale>
#include <codecvt>
namespace RegistryScanner { namespace Details {
std::wstring StringCnv::a2w(std::string const& str) {
return a2w(str.c_str());
}
std::wstring StringCnv::a2w(char const* str)
{
try {
return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes(str);
} catch (...) {
return L"*** Failed to call a2w";
}
}
std::string StringCnv::w2a(wchar_t const* str)
{
try {
return std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(str);
} catch (...) {
return "*** Failed to call w2a";
}
}
std::string StringCnv::w2a(std::wstring const& str) {
return w2a(str.c_str());
}
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/RegistryScanerMain.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "HiLevelScannerUseCase1.h"
int _tmain(int argc, _TCHAR* argv[]) {
return RegistryScanner::UseCase::HiLevelScannerUseCase1::Run();
}
<file_sep>/RegistryScaner/Dll.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "StdAfx.h"
#include "Dll.h"
namespace RegistryScanner { namespace Details {
Dll::Dll(String const& libName, DWORD flags)
: m_LibName(_T(""))
, m_Flags(0)
, m_Handle(nullptr)
{
Load(libName, flags);
}
Dll::~Dll() {
Free();
}
Dll::Dll(Dll const& obj)
: m_LibName(_T(""))
, m_Flags(0)
, m_Handle(nullptr)
{
Load(obj.m_LibName, obj.m_Flags);
}
Dll &Dll::operator=(Dll const& obj)
{
if (this != &obj)
Load(obj.m_LibName, obj.m_Flags);
return *this;
}
bool Dll::Load(String const& libName, DWORD flags)
{
Free();
if (flags != 0)
m_Handle = LoadLibraryEx(libName.c_str(), nullptr, flags);
else
m_Handle = LoadLibrary(libName.c_str());
if (IsLoad())
{
m_LibName.assign(libName);
m_Flags = flags;
return true;
}
return false;
}
void Dll::Free()
{
if (IsLoad())
{
FreeLibrary(m_Handle);
m_Handle = nullptr;
}
}
bool Dll::IsLoad() const {
return m_Handle != nullptr;
}
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/ScanInfo.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "ScanInfo.h"
#include "Handle2Path.h"
#include "StringCnv.h"
#include <boost/format.hpp>
namespace RegistryScanner {
namespace {
template<typename StringT>
struct _DataDecoder;
template<>
struct _DataDecoder<std::wstring>
: public boost::static_visitor<std::wstring>
{
result_type operator()(ValueInfo const& info) const {
return ToWideString(info);
}
result_type operator()(KeyInfo const& info) const {
return ToWideString(info);
}
};
template<>
struct _DataDecoder<std::string>
: public boost::static_visitor<std::string>
{
result_type operator()(ValueInfo const& info) const {
return ToString(info);
}
result_type operator()(KeyInfo const& info) const {
return ToString(info);
}
};
} /// end unnamed namespace
std::wstring ToWideString(ScanInfo::Data_t const& infoData) {
return boost::apply_visitor(_DataDecoder<std::wstring>(), infoData);
}
std::wstring ToWideString(ScanInfo const& info)
{
static std::wstring const messageFormat(
L"****************Info for handle:[%1%]****************\n"
L"\tPath:[%2%]\n"
L"\tAdditional info: %3%exists\n"
L"%4%\n\n"
);
std::wstring result =
boost::str(boost::wformat(messageFormat)
% info.handle
% Details::Handle2Path(info.handle)
% (info.data ? L"" : L"not ")
% (info.data ? ToWideString(info.data.get()) : L"")
);
return result;
}
std::string ToString(ScanInfo::Data_t const& infoData) {
return boost::apply_visitor(_DataDecoder<std::string>(), infoData);
}
std::string ToString(ScanInfo const& info)
{
static std::string const messageFormat(
"****************Info for handle:[%1%]****************\n"
"\tPath:[%2%]\n"
"\tAdditional info: %3%exists\n"
"%4%\n\n"
);
std::string result =
boost::str(boost::format(messageFormat)
% info.handle
% Details::StringCnv::w2a(Details::Handle2Path(info.handle))
% (info.data ? "" : "not ")
% (info.data ? ToString(info.data.get()) : "")
);
return result;
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/TimeStamp.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <xstring>
namespace RegistryScanner { namespace Details {
std::string TimeStamp();
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/stdafx.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <vector>
#include <string>
<file_sep>/RegistryScaner/HiLevelRegistryToolset.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "HiLevelRegistryToolset.h"
#include "Value.h"
#include <cassert>
namespace RegistryScanner {
LONG HiLevelRegistryToolset::OpenKey(HKEY handle, std::wstring const& subkeyName, DWORD accessMask, PHKEY outHandle) const
{
assert(handle != nullptr && "Bad params.");
return ::RegOpenKeyEx(handle, subkeyName.empty() ? nullptr : subkeyName.c_str(), 0, accessMask, outHandle);
}
LONG HiLevelRegistryToolset::CloseKey(HKEY handle) const
{
LONG result = ERROR_SUCCESS;
if (handle != nullptr)
{
if ((result = RegCloseKey(handle)) == ERROR_SUCCESS)
handle = nullptr;
}
return result;
}
LONG HiLevelRegistryToolset::QueryInfoKey(HKEY handle, KeyInfo& keyInfo) const
{
assert(handle != nullptr && "Bad params.");
return ::RegQueryInfoKey(handle
, keyInfo.classNameBuffer.data, keyInfo.classNameBuffer.GetSizePtr<DWORD>()
, nullptr /// reserved
, &keyInfo.subKeysCount, &keyInfo.subKeyLongset, &keyInfo.classNameLongset
, &keyInfo.valuesForKeyCount, &keyInfo.valueNameLongset, &keyInfo.valueDataLongset
, &keyInfo.securityDescriptorSize, &keyInfo.lastWriteTime);
}
LONG HiLevelRegistryToolset::GetKeyNameAtIndex(HKEY handle, DWORD index, std::wstring& name) const
{
assert(handle != nullptr && "Bad params.");
Details::WideStaticBuffer<KeyInfo::maxKeyLength> keyNameBuffer(KeyInfo::maxKeyLength);
LONG const result = ::RegEnumKeyEx(handle, index, keyNameBuffer.data, keyNameBuffer.GetSizePtr<DWORD>()
, nullptr /// reserved
, nullptr, nullptr, nullptr);
if (result == ERROR_SUCCESS)
name = keyNameBuffer.ToString();
return result;
}
LONG HiLevelRegistryToolset::GetValueInfoAtIndex(HKEY handle, DWORD index, ValueInfo& valueInfo) const
{
assert(handle != nullptr && "Bad params.");
Details::WideStaticBuffer<ValueInfo::maxValueName> valueNameBuffer(ValueInfo::maxValueName);
DWORD dataSize = 0;
DWORD type = -1;
LONG result = ::RegEnumValue(handle, index, valueNameBuffer.data, valueNameBuffer.GetSizePtr<DWORD>()
, nullptr/// reserved
, &type, nullptr, &dataSize);
if (result == ERROR_SUCCESS)
{
valueInfo.name = valueNameBuffer.ToString();
std::unique_ptr<Byte_t> buffer(dataSize ? new Byte_t[dataSize] : nullptr);
result = ::RegQueryValueEx(handle, valueInfo.name.c_str(), nullptr
, nullptr/// reserved
, buffer.get(), &dataSize);
if (result == ERROR_SUCCESS)
valueInfo.value = ValueConstructor<Value_t>::Construct(static_cast<ValueType>(type), buffer.get(), dataSize);
}
return result;
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/Value.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "Value.h"
#include "SystemError.h"
#include "StringCnv.h"
#include <cassert>
namespace RegistryScanner {
IrregularValue::IrregularValue(RawByteData_t const& data)
: std::logic_error("The value content isn't comply with the value type.")
, m_Data(data)
{
}
ExpandString::ExpandString() {}
ExpandString::ExpandString(ExpandString&& other)
: m_String(std::forward<String_t>(other.m_String))
{
}
ExpandString::ExpandString(String_t&& other)
: m_String(std::forward<String_t>(other))
{
}
ExpandString& ExpandString::operator=(ExpandString const& other)
{
if (this != &other)
m_String = other.m_String;
return *this;
}
ExpandString& ExpandString::operator=(ExpandString&& other)
{
if (this != &other)
m_String = std::forward<String_t>(other.m_String);
return *this;
}
ExpandString& ExpandString::operator=(String_t const& other)
{
m_String = other;
return *this;
}
bool ExpandString::Equal(ExpandString const& other) const {
return Equal(other.m_String);
}
bool ExpandString::Equal(String_t const& other) const {
return m_String == other;
}
String_t& ExpandString::GetValue() {
return m_String;
}
String_t const& ExpandString::GetValue() const {
return m_String;
}
bool operator==(ExpandString const& l, ExpandString const& r) {
return l.Equal(r);
}
bool operator!=(ExpandString const& l, ExpandString const& r) {
return !(l == r);
}
bool operator==(ExpandString const& l, String_t const& r) {
return l.Equal(r);
}
bool operator!=(ExpandString const& l, String_t const& r) {
return !(l == r);
}
bool IsConvertible(ValueType left, ValueType right)
{
return (left == right)
|| (right == ValueType::kVTAny)
|| (right == ValueType::kVTBinary)
|| (left == ValueType::kVTDwordBigEndian && right == ValueType::kVTDwordLittleEndian)
|| (left == ValueType::kVTExpandString && right == ValueType::kVTString)
|| (left == ValueType::kVTLink && right == ValueType::kVTString)
;
}
template<>
Value_t ValueConstructor<Value_t>::Construct(ValueType type, Byte_t const* data, size_t size)
{
switch (type)
{
case ValueType::kVTNone: return ValueConstructor<RawByteData_t>::Construct(type, data, size);
case ValueType::kVTString: case ValueType::kVTExpandString: return ValueConstructor<String_t>::Construct(type, data, size);
case ValueType::kVTMultiString: return ValueConstructor<MultiString_t>::Construct(type, data, size);
case ValueType::kVTBinary: return ValueConstructor<RawByteData_t>::Construct(type, data, size);
case ValueType::kVTDwordLittleEndian: case ValueType::kVTDwordBigEndian: return ValueConstructor<Dword_t>::Construct(type, data, size);
case ValueType::kVTLink: return ValueConstructor<String_t>::Construct(type, data, size);
case ValueType::kVTResourceList: return ValueConstructor<RawByteData_t>::Construct(type, data, size);
case ValueType::kVTFullResourceDescriptor: return ValueConstructor<RawByteData_t>::Construct(type, data, size);
case ValueType::kVTResourceRequierementsList: return ValueConstructor<RawByteData_t>::Construct(type, data, size);
case ValueType::kVTQwordLittleEndian: return ValueConstructor<Qword_t>::Construct(type, data, size);
default: throw IrregularValue(RawByteData_t(data, data + size));
}
}
namespace {
template<typename Container, typename T>
Container _SafeConstruct(T const* data, size_t size) {
return (data && size) ? Container(data, data + size) : Container();
}
} /// end unnamed namespace
template<>
RawByteData_t ValueConstructor<RawByteData_t>::Construct(ValueType type, Byte_t const* data, size_t size) {
return _SafeConstruct<RawByteData_t>(data, size);
}
template<>
String_t ValueConstructor<String_t>::Construct(ValueType type, Byte_t const* data, size_t size)
{
assert(IsConvertible(type, ValueType::kVTString));
if (size % sizeof(wchar_t) == 0)
{
wchar_t const* const dataAlias = reinterpret_cast<wchar_t const*>(data);
switch(type)
{
case ValueType::kVTString: case ValueType::kVTLink: return _SafeConstruct<String_t>(dataAlias, size / sizeof(wchar_t) - 1);
case ValueType::kVTExpandString:
{
/// http://msdn.microsoft.com/en-us/library/ms724265(v=VS.85).aspx
if (size > 32768)
throw std::logic_error("The size of the buffer is limited to 32K.");
String_t result;
size_t sourceCharCount = size / sizeof(wchar_t);
size_t needCharCount = sourceCharCount;
std::unique_ptr<wchar_t> expandedString;
do
{
expandedString.reset(new wchar_t[needCharCount]);
sourceCharCount = needCharCount;
needCharCount = ::ExpandEnvironmentStrings(dataAlias, expandedString.get(), needCharCount);
if (needCharCount == 0)
throw SystemError();
}
while (needCharCount > sourceCharCount);
return _SafeConstruct<String_t>(expandedString.get(), needCharCount - 1);
}
default:
break;
}
}
throw IrregularValue(_SafeConstruct<RawByteData_t>(data, size));
}
template<>
MultiString_t ValueConstructor<MultiString_t>::Construct(ValueType type, Byte_t const* data, size_t size)
{
assert(IsConvertible(type, ValueType::kVTMultiString));
if (size % sizeof(wchar_t) != 0)
throw IrregularValue(_SafeConstruct<RawByteData_t>(data, size));
wchar_t const* const dataAlias = reinterpret_cast<wchar_t const*>(data);
wchar_t const* const endData = dataAlias + (size / sizeof(wchar_t)) - 1;
//assert(*endData == L'\0' && "Incorrect REG_MULTI_SZ format.");
MultiString_t multiString;
if (dataAlias && endData)
{
wchar_t const* stringStart = dataAlias;
wchar_t const* stringEnd = stringStart;
while (stringEnd != endData)
{
if (*stringEnd == L'\0')
{
multiString.emplace_back(stringStart, stringEnd);
stringStart = ++stringEnd;
}
else
++stringEnd;
}
if (stringStart != stringEnd)
{
//assert(!"Incorrect REG_MULTI_SZ format.");
multiString.emplace_back(stringStart, stringEnd);
}
}
return multiString;
}
template<>
ExpandString ValueConstructor<ExpandString>::Construct(ValueType type, Byte_t const* data, size_t size)
{
assert(IsConvertible(type, ValueType::kVTExpandString));
/// http://msdn.microsoft.com/en-us/library/ms724265(v=VS.85).aspx
if (size > 32768)
throw std::logic_error("The size of the buffer is limited to 32K.");
if (size % sizeof(wchar_t) != 0)
throw IrregularValue(_SafeConstruct<RawByteData_t>(data, size));
wchar_t const* const dataAlias = reinterpret_cast<wchar_t const*>(data);
return _SafeConstruct<String_t>(dataAlias, size / sizeof(wchar_t) - 1);
}
template<>
Dword_t ValueConstructor<Dword_t>::Construct(ValueType type, Byte_t const* data, size_t size)
{
assert(IsConvertible(type, ValueType::kVTDwordLittleEndian));
if (size != 4)
throw IrregularValue(_SafeConstruct<RawByteData_t>(data, size));
Dword_t value = 0;
if (data)
{
switch (type)
{
case ValueType::kVTDwordLittleEndian:
memcpy(&value, data, 4);
break;
case ValueType::kVTDwordBigEndian:
value = static_cast<Dword_t>((data[3] << 24) | (data[2] << 16) | (data[1] << 8) | data[0]);
break;
default:
break;
}
}
return value;
}
template<>
Qword_t ValueConstructor<Qword_t>::Construct(ValueType type, Byte_t const* data, size_t size)
{
if (size != 8)
throw IrregularValue(_SafeConstruct<RawByteData_t>(data, size));
Qword_t value;
if (data)
memcpy(value.bytes, data, 8);
return value;
}
namespace {
struct _ValueToType
: public boost::static_visitor<ValueType>
{
template <typename T>
ValueType operator()(T const& value) const {
return ValueToType<T>::GetType(value);
}
ValueType operator()(Value_t const&) const {
return ValueType::kVTAny;
}
};
struct _ValueToTypeName : public boost::static_visitor<std::wstring>
{
template <typename T>
std::wstring operator()(T const& value) const {
return ValueToType<T>::GetTypeName();
}
};
} /// end unnamed namespace
ValueType ValueToType<Value_t>::GetType(Value_t const& value) {
return boost::apply_visitor(_ValueToType(), value);
}
ValueType ValueToType<Value_t>::GetType() {
return ValueType::kVTAny;
}
std::wstring ValueToType<Value_t>::GetTypeName(Value_t const& value) {
return boost::apply_visitor(_ValueToTypeName(), value);
}
std::wstring ValueToType<Value_t>::GetTypeName() {
return L"ANY";
}
template<>
struct ValueToType<None_t>
{
static ValueType GetType() {
return ValueType::kVTNone;
}
static ValueType GetType(None_t const&) {
return GetType();
}
static std::wstring GetTypeName(None_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_NONE";
}
};
template<>
struct ValueToType<RawByteData_t>
{
static ValueType GetType() {
return ValueType::kVTBinary;
}
static ValueType GetType(RawByteData_t const&) {
return GetType();
}
static std::wstring GetTypeName(RawByteData_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_BINARY";
}
};
template<>
struct ValueToType<String_t>
{
static ValueType GetType() {
return ValueType::kVTString;
}
static ValueType GetType(String_t const&) {
return GetType();
}
static std::wstring GetTypeName(String_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_SZ";
}
};
template<>
struct ValueToType<MultiString_t>
{
static ValueType GetType() {
return ValueType::kVTMultiString;
}
static ValueType GetType(MultiString_t const&) {
return GetType();
}
static std::wstring GetTypeName(MultiString_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_MULTI_SZ";
}
};
template<>
struct ValueToType<ExpandString>
{
static ValueType GetType() {
return ValueType::kVTExpandString;
}
static ValueType GetType(ExpandString const&) {
return GetType();
}
static std::wstring GetTypeName(ExpandString const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_EXPAND_SZ";
}
};
template<>
struct ValueToType<Dword_t>
{
static ValueType GetType() {
return ValueType::kVTDwordLittleEndian;
}
static ValueType GetType(Dword_t const&) {
return GetType();
}
static std::wstring GetTypeName(Dword_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_DWORD_LITTLE_ENDIAN";
}
};
template<>
struct ValueToType<DwordBE_t>
{
static ValueType GetType() {
return ValueType::kVTDwordBigEndian;
}
static ValueType GetType(DwordBE_t const&) {
return GetType();
}
static std::wstring GetTypeName(DwordBE_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_DWORD_BIG_ENDIAN";
}
};
template<>
struct ValueToType<Link>
{
static ValueType GetType() {
return ValueType::kVTLink;
}
static ValueType GetType(Link const&) {
return GetType();
}
static std::wstring GetTypeName(Link const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_LINK";
}
};
template<>
struct ValueToType<ResourceList>
{
static ValueType GetType() {
return ValueType::kVTResourceList;
}
static ValueType GetType(ResourceList const&) {
return GetType();
}
static std::wstring GetTypeName(ResourceList const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_RESOURCE_LIST";
}
};
template<>
struct ValueToType<FullResourceDescriptor>
{
static ValueType GetType() {
return ValueType::kVTFullResourceDescriptor;
}
static ValueType GetType(FullResourceDescriptor const&) {
return GetType();
}
static std::wstring GetTypeName(FullResourceDescriptor const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_FULL_RESOURCE_DESCRIPTOR";
}
};
template<>
struct ValueToType<ResourceRequierementsList>
{
static ValueType GetType() {
return ValueType::kVTResourceRequierementsList;
}
static ValueType GetType(ResourceRequierementsList const&) {
return GetType();
}
static std::wstring GetTypeName(ResourceRequierementsList const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_RESOURCE_REQUIREMENTS_LIST";
}
};
template<>
struct ValueToType<Qword_t>
{
static ValueType GetType() {
return ValueType::kVTQwordLittleEndian;
}
static ValueType GetType(Qword_t const&) {
return GetType();
}
static std::wstring GetTypeName(Qword_t const& value) {
return GetTypeName(value);
}
static std::wstring GetTypeName() {
return L"REG_QWORD_LITTLE_ENDIAN";
}
};
namespace {
struct _Value2WideStringDecoder
: public boost::static_visitor<std::wstring>
{
result_type operator()(RawByteData_t const& data) const
{
result_type result(data.begin(), data.end());
return L'[' + result + L']';
}
result_type operator()(String_t const& data) const {
return data;
}
result_type operator()(MultiString_t const& data) const
{
result_type result;
for (auto const& i : data)
result += L'{' + i + L'}';
return result;
}
result_type operator()(ExpandString const& data) const {
return data.GetValue();
}
result_type operator()(Dword_t const& data) const {
return std::to_wstring(data);
}
result_type operator()(Qword_t const& data) const {
return std::to_wstring(data.qword);
}
};
struct _Value2StringDecoder
: public boost::static_visitor<std::string>
{
result_type operator()(RawByteData_t const& data) const
{
result_type result(data.begin(), data.end());
return '[' + result + ']';
}
result_type operator()(String_t const& data) const {
return Details::StringCnv::w2a(data);
}
result_type operator()(MultiString_t const& data) const
{
result_type result;
for (auto const& i : data)
result += '{' + Details::StringCnv::w2a(i) + '}';
return result;
}
result_type operator()(ExpandString const& data) const {
return operator()(data.GetValue());
}
result_type operator()(Dword_t const& data) const {
return std::to_string(data);
}
result_type operator()(Qword_t const& data) const {
return std::to_string(data.qword);
}
};
} /// end unnamed namespace
std::wstring Value2WideString(Value_t const& value) {
return boost::apply_visitor(_Value2WideStringDecoder(), value);
}
std::string Value2String(Value_t const& value) {
return boost::apply_visitor(_Value2StringDecoder(), value);
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/ValueInfo.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "Value.h"
#include <string>
namespace RegistryScanner {
/*
@struct ValueInfo -
*/
struct ValueInfo
{
std::wstring name;
Value_t value;
static DWORD const maxValueName = 16383;
};
std::wstring ToWideString(ValueInfo const& info);
std::string ToString(ValueInfo const& info);
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/FileHelpers.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
namespace RegistryScanner { namespace Details {
struct FileHelpers
{
static void CloseFile(boost::filesystem::ofstream& ofs);
static boost::filesystem::ofstream& LazyFile(boost::filesystem::ofstream& ofs, boost::filesystem::path const& filePath);
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/FileHelpers.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "FileHelpers.h"
#include <stdexcept>
#include <boost/format.hpp>
namespace RegistryScanner { namespace Details {
void FileHelpers::CloseFile(boost::filesystem::ofstream& ofs)
{
if (ofs.is_open())
{
ofs.flush();
ofs.close();
assert(!ofs.is_open());
}
}
boost::filesystem::ofstream& FileHelpers::LazyFile(boost::filesystem::ofstream& ofs, boost::filesystem::path const& filePath)
{
assert(!filePath.empty());
if (!ofs.is_open())
{
ofs.open(filePath);
assert(ofs.is_open() && "Error - open file is failed.");
if (!ofs.is_open())
throw std::runtime_error(boost::str(boost::format("Error - open file: [%1%] - is failed.") % filePath.string()));
ofs.unsetf(std::ios::skipws);
}
return ofs;
}
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/SystemError.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "SystemError.h"
#include <sstream>
#include <string>
#include <memory>
namespace RegistryScanner {
namespace {
std::string _ConstructError(DWORD errorCode)
{
std::shared_ptr<char> message(nullptr, ::LocalFree);
DWORD const messageRequestResult = ::FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS
, nullptr
, errorCode
, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
, reinterpret_cast<char*>(&message)
, 0
, nullptr
);
if (messageRequestResult == 0)
throw std::logic_error("Invalid error message formatting.");
std::ostringstream stream;
stream << "Error " << errorCode << ": " << message.get();
return stream.str();
}
} /// end unnamed namespace
SystemError::SystemError()
: std::domain_error(_ConstructError(GetLastError()))
, m_ErrorCode(GetLastError())
{
}
SystemError::SystemError(LONG error)
: std::domain_error(_ConstructError(error))
, m_ErrorCode(error)
{
}
LONG SystemError::GetErrorCode() const {
return m_ErrorCode;
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/KeyInfo.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "KeyInfo.h"
#include "StringCnv.h"
#include <boost/format.hpp>
namespace RegistryScanner {
KeyInfo::KeyInfo() {
::memset(this, 0, sizeof(KeyInfo));
}
std::wstring ToWideString(KeyInfo const& info)
{
return boost::str(boost::wformat(L"\tKey info: name: %1%, sub key count: %2%, value count: %3%")
% info.classNameBuffer.ToString()
% info.subKeysCount
% info.valuesForKeyCount
);
}
std::string ToString(KeyInfo const& info)
{
return boost::str(boost::format("\tKey info: name: %1%, sub key count: %2%, value count: %3%")
% Details::StringCnv::w2a(info.classNameBuffer.ToString())
% info.subKeysCount
% info.valuesForKeyCount
);
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/RegistryToolsetBase.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "RegistryToolsetBase.h"
namespace RegistryScanner {
RegistryToolsetBase::~RegistryToolsetBase() {}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/ntdll.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "Dll.h"
namespace RegistryScanner { namespace Details {
class NtDll
: public Dll
{
typedef DWORD(__stdcall *NtQueryKeyProc_t)(
HANDLE keyHandle, int keyInformationClass, PVOID keyInformation, ULONG length, PULONG resultLength);
public:
NtDll();
std::wstring GetKeyPathFromHKEY(HKEY key);
private:
NtQueryKeyProc_t m_NtQueryKeyProc;
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/HiLevelScannerUseCase1.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "HiLevelScannerController.h"
#include <windows.h>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
namespace RegistryScanner { namespace UseCase {
class HiLevelScannerUseCase1
{
typedef std::function<void()> StopLasyReporter_t;
public:
static int Run();
private:
HiLevelScannerUseCase1();
int _Run();
void _OnScanStart();
void _OnScanEnd(bool aborted);
void _OnNextScanResultsComplete(HiLevelScannerController::ScanInfoStorePtr_t store);
std::ofstream& _File();
private:
HiLevelScannerController m_Controller;
HiLevelScannerController::ConnectionStore_t m_ConnectionStore;
volatile bool m_Stoped;
volatile bool m_Started;
boost::filesystem::path m_FilePath;
boost::filesystem::ofstream m_File;
StopLasyReporter_t m_StopLasyReporter;
std::mutex m_Access;
std::condition_variable m_Condition;
};
}} /// end namespace RegistryScanner::UseCase
<file_sep>/RegistryScaner/RegistryToolsetBase.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "IRegistryToolset.h"
namespace RegistryScanner {
struct RegistryToolsetBase
: public IRegistryToolset
{
virtual ~RegistryToolsetBase();
};
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/IRegistryToolset.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "ValueInfo.h"
#include "KeyInfo.h"
namespace RegistryScanner {
/*
@struct IRegistryToolset - предаставляет инструментарий для работы с реестром
*/
struct IRegistryToolset
{
virtual LONG OpenKey(HKEY handle, std::wstring const& subkeyName, DWORD accessMask, PHKEY outHandle) const = 0;
virtual LONG CloseKey(HKEY handle) const = 0;
virtual LONG QueryInfoKey(HKEY handle, KeyInfo& keyInfo) const = 0;
virtual LONG GetKeyNameAtIndex(HKEY handle, DWORD index, std::wstring& ame) const = 0;
virtual LONG GetValueInfoAtIndex(HKEY handle, DWORD index, ValueInfo& valueInfo) const = 0;
};
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/ntdll.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "ntdll.h"
#include <memory>
namespace RegistryScanner { namespace Details {
NtDll::NtDll()
: Dll(L"ntdll.dll")
, m_NtQueryKeyProc(nullptr)
{
}
std::wstring NtDll::GetKeyPathFromHKEY(HKEY key)
{
std::wstring result;
if (!m_NtQueryKeyProc && !GetProc("NtQueryKey", m_NtQueryKeyProc))
return result;
typedef LONG NTSTATUS;
#if !defined(STATUS_SUCCESS)
# define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#endif /// !STATUS_SUCCESS
#if !defined(STATUS_BUFFER_TOO_SMALL)
# define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023L)
#endif /// !STATUS_BUFFER_TOO_SMALL
DWORD size = 0, errCode = 0;
errCode = m_NtQueryKeyProc(key, 3, 0, 0, &size);
if (errCode == STATUS_BUFFER_TOO_SMALL)
{
size = size + 2;
std::unique_ptr<wchar_t[]> buffer(new (std::nothrow) wchar_t[size / sizeof(wchar_t)]); /// size is in bytes
if (buffer)
{
errCode = m_NtQueryKeyProc(key, 3, buffer.get(), size, &size);
if (errCode == STATUS_SUCCESS)
{
buffer[size / sizeof(wchar_t)] = L'\0';
result = std::wstring(buffer.get() + 2);
}
}
}
return result;
}
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/IScanner.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "ScanInfo.h"
#include <memory>
#include <windows.h>
#include <boost/signals2.hpp>
namespace RegistryScanner {
/*
@struct IScanerDispatcher - предаставляет интерфейс для наблюдения за процессом сканирования
*/
struct IScanerDispatcher
{
public:
typedef boost::signals2::signal<void(ScanInfoPtr_t scanInfo)> OnPathFoundSignal_t;
typedef boost::signals2::signal<void(LONG erroCode, std::wstring message)> OnErrorFoundSignal_t;
typedef boost::signals2::signal<void(std::wstring message)> OnOperationSuccess_t;
typedef boost::signals2::signal<void(std::wstring message)> OnInformation_t;
typedef boost::signals2::connection Connection_t;
public:
virtual Connection_t AttachOnPathFoundSignal(OnPathFoundSignal_t::slot_type slot) = 0;
virtual Connection_t AttachOnErrorFoundSignal(OnErrorFoundSignal_t::slot_type slot) = 0;
virtual Connection_t AttachOnOperationSuccessSignal(OnOperationSuccess_t::slot_type slot) = 0;
virtual Connection_t AttachOnInformationSignal(OnInformation_t::slot_type slot) = 0;
};
/*
@struct IScanner - интерфейс сканера реестра
*/
struct IScanner
: public IScanerDispatcher
{
virtual void Scan() const = 0;
};
typedef std::unique_ptr<IScanner> IScannerPtr_t;
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/StringCnv.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <xstring>
namespace RegistryScanner { namespace Details {
struct StringCnv
{
static std::wstring a2w(std::string const& str);
static std::wstring a2w(char const* str);
static std::string w2a(wchar_t const* str);
static std::string w2a(std::wstring const& str);
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/KeyInfo.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "WideStaticBuffer.h"
namespace RegistryScanner {
struct KeyInfo
{
KeyInfo();
Details::WideStaticBuffer<MAX_PATH> classNameBuffer;
DWORD classNameLongset; /// longest class string
DWORD subKeysCount; /// number of subkeys
DWORD subKeyLongset; /// longest subkey size
DWORD valuesForKeyCount; /// number of values for key
DWORD valueNameLongset; /// longest value name
DWORD valueDataLongset; /// longest value data
DWORD securityDescriptorSize; /// size of security descriptor
FILETIME lastWriteTime; /// last write time
static DWORD const maxKeyLength = 255;
};
std::wstring ToWideString(KeyInfo const& info);
std::string ToString(KeyInfo const& info);
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/ScannerFactory.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "IScanner.h"
namespace RegistryScanner {
struct ScannerFactory
{
template<typename TScannerCreationParams>
static IScannerPtr_t CreateScanner(TScannerCreationParams&& params);
};
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/HiLevelScanner.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "HiLevelScanner.h"
#include "SystemError.h"
#include "StringCnv.h"
#include <boost/scope_exit.hpp>
#include <boost/format.hpp>
namespace RegistryScanner {
HiLevelScanner::CreationParams::CreationParams(HKEY rootHandle_, DWORD accessMask_)
: rootHandle(rootHandle_)
, accessMask(accessMask_)
{
}
IScanner::Connection_t HiLevelScanner::AttachOnPathFoundSignal(OnPathFoundSignal_t::slot_type slot) {
return m_OnPathFoundSignal.connect(slot);
}
IScanner::Connection_t HiLevelScanner::AttachOnErrorFoundSignal(OnErrorFoundSignal_t::slot_type slot) {
return m_OnErrorFoundSignal.connect(slot);
}
IScanner::Connection_t HiLevelScanner::AttachOnOperationSuccessSignal(OnOperationSuccess_t::slot_type slot) {
return m_OnOperationSuccessSignal.connect(slot);
}
IScanner::Connection_t HiLevelScanner::AttachOnInformationSignal(OnInformation_t::slot_type slot) {
return m_OnInformationSignal.connect(slot);
}
void HiLevelScanner::Scan() const
{
try {
_ScanRoutine(m_Params.rootHandle, L"");
}
catch (...) {
m_OnErrorFoundSignal(-1, L"Undefined exception cached. Scanning process is aborted.");
}
}
HiLevelScanner::HiLevelScanner(CreationParams&& params)
: m_Params(std::forward<CreationParams>(params))
{
}
namespace {
class _HandleValue
{
public:
_HandleValue(HKEY handle)
: m_ValueHolder(reinterpret_cast<DWORD>(reinterpret_cast<DWORD*>(handle)))
{
}
DWORD const* Get() const {
return &m_ValueHolder;
}
private:
DWORD m_ValueHolder;
};
} /// end unnamed namespace
void HiLevelScanner::_ScanRoutine(HKEY parent, std::wstring const& name) const
{
HKEY handle(nullptr);
LONG erroCode(ERROR_SUCCESS);
BOOST_SCOPE_EXIT((erroCode)(handle)(this_))
{
_HandleValue const handelValue(handle);
erroCode = this_->m_Toolset.CloseKey(handle);
if (erroCode == ERROR_SUCCESS)
this_->m_OnOperationSuccessSignal(boost::str(boost::wformat(L"Handle: %1% is successfully closed.") % handelValue.Get()));
else
this_->m_OnErrorFoundSignal(erroCode, boost::str(boost::wformat(L"Failed to close handle: %1%.") % handelValue.Get()));
} BOOST_SCOPE_EXIT_END;
erroCode = m_Toolset.OpenKey(parent, name, m_Params.accessMask, &handle);
if (erroCode == ERROR_SUCCESS)
m_OnOperationSuccessSignal(boost::str(boost::wformat(L"Path: %1%, by handle: %2% is successfully opened.") % name % parent));
else
{
m_OnErrorFoundSignal(erroCode, boost::str(boost::wformat(L"Failed to open path: %1%, by handle: %2%. This iteration aborted.") % name % parent));
return;
}
KeyInfo keyInfo;
erroCode = m_Toolset.QueryInfoKey(handle, keyInfo);
DWORD valuesForKeyCount = 0, subKeysCount = 0;
subKeysCount = keyInfo.subKeysCount;
valuesForKeyCount = keyInfo.valuesForKeyCount;
if (erroCode == ERROR_SUCCESS)
m_OnOperationSuccessSignal(
boost::str(boost::wformat(L"Information for path: %1% by handle: %2% is successfully received. Key count: %3%, value count: %4%")
% name % handle
% (subKeysCount = keyInfo.subKeysCount)
% (valuesForKeyCount = keyInfo.valuesForKeyCount)
)
);
else
{
m_OnErrorFoundSignal(erroCode, boost::str(boost::wformat(L"Failed to query info for handle: %1%. This iteration aborted.") % handle));
return;
}
if (valuesForKeyCount == 0 && subKeysCount == 0)
{
m_OnPathFoundSignal(std::make_shared<ScanInfo>(handle, keyInfo));
return;
}
else
{
for (size_t i = 0; i < valuesForKeyCount; ++i)
{
try
{
ValueInfo valueInfo;
erroCode = m_Toolset.GetValueInfoAtIndex(handle, i, valueInfo);
if (erroCode == ERROR_SUCCESS)
m_OnOperationSuccessSignal(boost::str(boost::wformat(L"Value info: %1% for handle: %2% is successfully received.") % i % handle));
else
{
m_OnErrorFoundSignal(erroCode, boost::str(boost::wformat(L"Failed to get value info: %1% for handle: %2%. This iteration aborted.") % i % handle));
continue;
}
m_OnPathFoundSignal(std::make_shared<ScanInfo>(handle, valueInfo));
}
catch (SystemError const& err)
{
m_OnErrorFoundSignal(err.GetErrorCode()
, boost::str(boost::wformat(L"Failed to get value info: %1% for handle: %2%. Reason: %3% This iteration aborted.")
% i % handle % Details::StringCnv::a2w(err.what()))
);
}
catch (IrregularValue const& err)
{
m_OnErrorFoundSignal(-1, boost::str(boost::wformat(L"Failed to get value info: %1% for handle: %2%. Reason: %3% This iteration aborted.")
% i % handle % Details::StringCnv::a2w(err.what()))
);
}
catch (std::exception const& err)
{
m_OnErrorFoundSignal(-1, boost::str(boost::wformat(L"Failed to get value info: %1% for handle: %2%. Reason: %3% This iteration aborted.")
% i % handle % Details::StringCnv::a2w(err.what()))
);
}
}
for (size_t i = 0; i < subKeysCount; ++i)
{
std::wstring nextName;
erroCode = m_Toolset.GetKeyNameAtIndex(handle, i, nextName);
if (erroCode == ERROR_SUCCESS)
m_OnOperationSuccessSignal(boost::str(boost::wformat(L"Key name: %1% for handle: %2% is successfully received. Name: %3%") % i % handle % nextName));
else
{
m_OnErrorFoundSignal(erroCode, boost::str(boost::wformat(L"Failed to get key name: %1% for handle: %2%. This iteration aborted.") % i % handle));
continue;
}
_ScanRoutine(handle, nextName);
}
}
}
template<>
IScannerPtr_t ScannerFactory::CreateScanner(HiLevelScanner::CreationParams&& params) {
return IScannerPtr_t(new HiLevelScanner(std::forward<HiLevelScanner::CreationParams>(params)));
}
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/Dll.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <winbase.h>
#include <xstring>
#include <assert.h>
namespace RegistryScanner { namespace Details {
class Dll
{
public:
typedef std::basic_string<TCHAR> String;
public:
explicit Dll(String const& libName, DWORD flags = 0);
virtual ~Dll();
Dll(Dll const&);
Dll& operator= (Dll const&);
bool Load(String const& libName, DWORD flags = 0);
void Free();
bool IsLoad() const;
template<typename PROCADDR>
bool GetProc(LPCSTR procName, PROCADDR& addr)
{
if (IsLoad())
{
addr = reinterpret_cast<PROCADDR>(::GetProcAddress(m_Handle, procName));
assert(addr);
if (!addr)
return false;
return true;
}
return false;
}
protected:
String m_LibName;
DWORD m_Flags;
HMODULE m_Handle;
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/Handle2Path.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <string>
#include <windows.h>
namespace RegistryScanner { namespace Details {
std::wstring Handle2Path(HKEY key);
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/HiLevelScannerController.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "IScanner.h"
#include <thread>
#include <mutex>
#include <ostream>
namespace RegistryScanner {
class HiLevelScannerController
: public IScanerDispatcher
{
public:
typedef boost::signals2::scoped_connection ScopedConnection_t;
typedef std::vector<ScopedConnection_t> ConnectionStore_t;
typedef std::vector<HKEY> Descriptors_t;
typedef std::shared_ptr<ScanInfoStore_t> ScanInfoStorePtr_t;
typedef boost::signals2::signal<void()> OnScanStartSignal_t;
typedef boost::signals2::signal<void(bool aborted)> OnScanEndSignal_t;
typedef boost::signals2::signal<void(ScanInfoStorePtr_t store)> OnNextScanResultsCompleteSignal_t;
typedef boost::signals2::connection Connection_t;
public:
HiLevelScannerController(Descriptors_t&& params, size_t chunkSize = 15);
~HiLevelScannerController();
void SetOutput(std::ostream& os);
Connection_t AttachOnScanStartSignal(OnScanStartSignal_t::slot_type slot);
Connection_t AttachOnScanEndSignal(OnScanEndSignal_t::slot_type slot);
Connection_t AttachNextScanResultsCompleteSignal(OnNextScanResultsCompleteSignal_t::slot_type slot);
virtual Connection_t AttachOnPathFoundSignal(OnPathFoundSignal_t::slot_type slot) override;
virtual Connection_t AttachOnErrorFoundSignal(OnErrorFoundSignal_t::slot_type slot) override;
virtual Connection_t AttachOnOperationSuccessSignal(OnOperationSuccess_t::slot_type slot) override;
virtual Connection_t AttachOnInformationSignal(OnInformation_t::slot_type slot) override;
void ScanRegistryAssync();
void StopScan();
private:
void _Routine();
void _DoScan(HKEY hkey);
void _PostScan();
void _StopScan(bool aborted, bool needSignal);
void _OnPathFound(ScanInfoPtr_t scanInfo);
private:
Descriptors_t m_HkeyStore;
size_t const m_ChunkSize;
std::ostream* m_Out;
ScanInfoStorePtr_t m_ScanInfoStore;
OnScanStartSignal_t m_OnScanStartSignal;
OnScanEndSignal_t m_OnScanEndSignal;
OnNextScanResultsCompleteSignal_t m_OnNextScanResultsCompleteSignal;
IScannerPtr_t m_Scanner;
std::mutex m_Access;
std::unique_ptr<std::thread> m_Worker;
};
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/WideStaticBuffer.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "StaticBuffer.h"
namespace RegistryScanner { namespace Details {
template<DWORD Capacity>
class WideStaticBuffer
: public StaticBuffer<wchar_t, Capacity>
{
typedef StaticBuffer<wchar_t, Capacity> Super_t;
public:
WideStaticBuffer(size_t s = 0)
: Super_t(s)
{
}
};
}} /// end namespace RegistryScanner::Details
<file_sep>/RegistryScaner/DBG_SetThreadName.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#if !defined(NDEBUG)
#include <windows.h>
namespace {
#pragma pack(push,8)
typedef struct
{
DWORD dwType;
LPCSTR szName;
DWORD dwThreadID;
DWORD dwFlags;
}
THREADNAME_INFO;
#pragma pack(pop)
inline void _Do_SetThisThreadName(char const* name)
{
static DWORD const ExceptionCode = 0x406D1388;
static DWORD const ExceptionFlags = 0L;
THREADNAME_INFO info =
{
0x1000, /// Must be 0x1000
name, /// Pointer to name (in user addr space).
-1, /// Thread ID (-1 = caller thread).
0 /// Reserved for future use, must be zero.
};
DWORD NumberOfArguments = sizeof(info) / sizeof(ULONG_PTR);
ULONG_PTR* ArgumentsPtr = reinterpret_cast<ULONG_PTR*>(&info);
__try {
RaiseException(ExceptionCode, ExceptionFlags, NumberOfArguments, ArgumentsPtr);
} __except (EXCEPTION_EXECUTE_HANDLER) { }
}
} /// end unnamed namespace
# define SetThisThreadName(NAME_ARG) _Do_SetThisThreadName(NAME_ARG)
#else
# define SetThisThreadName(NAME_ARG) ((void)0)
#endif /// !NDEBUG
<file_sep>/RegistryScaner/SystemError.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include <stdexcept>
#include <windows.h>
namespace RegistryScanner {
class SystemError
: public std::domain_error
{
public:
SystemError();
explicit SystemError(LONG error);
LONG GetErrorCode() const;
private:
LONG m_ErrorCode;
};
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/ScanInfo.h
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#pragma once
#include "ValueInfo.h"
#include "KeyInfo.h"
#include <boost/optional.hpp>
namespace RegistryScanner {
struct ScanInfo
{
public:
typedef boost::variant<KeyInfo, ValueInfo> Data_t;
public:
template<typename DataT>
ScanInfo(HKEY handle_, DataT data_)
: handle(handle_)
, data(data_)
{
}
public:
HKEY handle;
boost::optional<Data_t> data;
};
typedef std::shared_ptr<ScanInfo> ScanInfoPtr_t;
typedef std::vector<ScanInfoPtr_t> ScanInfoStore_t;
std::wstring ToWideString(ScanInfo::Data_t const& infoData);
std::wstring ToWideString(ScanInfo const& info);
std::string ToString(ScanInfo::Data_t const& infoData);
std::string ToString(ScanInfo const& info);
} /// end namespace RegistryScanner
<file_sep>/RegistryScaner/TimeStamp.cpp
/**
Project - Registry Scanner
Copyright (c) 2015 <NAME>.
e-mail: <EMAIL>
*/
#include "stdafx.h"
#include "TimeStamp.h"
#include <boost/date_time/posix_time/posix_time_io.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/replace.hpp>
namespace RegistryScanner { namespace Details {
std::string TimeStamp() {
return boost::algorithm::replace_all_copy(boost::lexical_cast<std::string>(boost::posix_time::second_clock::universal_time()), ":", "-");
}
}} /// end namespace RegistryScanner::Details
| 0b75560eb4350ec7336ca55c127a8e15672f6c1c | [
"C",
"C++"
] | 40 | C++ | AntonPoturaev/RegistryScaner | cd3c4330107fb60fbfc3946867df2027b90cea6c | 8cff8db072a6f82433c0fba7566ef0826fe89c1e |
refs/heads/master | <file_sep>package main
import (
"fmt"
)
func main() {
/*jidu := 1
switch jidu {
case 1 :
fmt.Println("第一季度")
case 2:
fmt.Println("第二季度")
case 3:
fmt.Println("第三季度")
case 4:
fmt.Println("第四季度")
default:
fmt.Println("重新输入")
}
fmt.Println("main...over...")*/
year := 2020
month := 2
day := 0
switch month {
case 1, 3, 5, 7, 8, 10, 12:
day = 31
case 4, 6, 9, 11:
day = 30
case 2:
if year%4 == 0 {
day = 28
} else {
day = 29
}
default:
fmt.Println("输入有误")
}
fmt.Printf("%d年%d有%d天", year, month, day)
}
/*
{{ define "__subject" }}
[
{{ .Status | toUpper }}
{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}
]
{{ .GroupLabels.SortedPairs.Values | join " " }}
{{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}
{{ end }}
*/
<file_sep>package main
import (
"fmt"
)
func main() {
/*
变量:是一小段内存, 用于存储数据, 在程序运行过程中数值可以改变
使用:1、申明
2、访问,赋值和读取
*/
//第一种申明方法:
var a int
a = 1
var b string = "1000"
fmt.Printf("a is %d,b is %s\n", a, b)
//第二种申明方法: 类型推断
var m = 100
var n = "thisis"
fmt.Printf("m is : %d,n is %s\n", m, n)
// 第三种:简短定义
student := "lixiaohua"
age := 10
sex := "male"
fmt.Printf("student:%s,age:%d,sex:%s", student, age, sex)
// 多个变量同时定义
var a1, b1, c1 int = 1, 2, 111
fmt.Println(a1, b1, c1)
}
<file_sep>### test
Lets's Go!! | d23a52d7320e76a222441a0e0707be75abda7521 | [
"Markdown",
"Go"
] | 3 | Go | xiaocaisgit/demo | 87c15ed64fcb330a5c95c8baa4fe304bb4164ec0 | 9a83fe1fa562c92e6d51db73aa8395ab2506b071 |
refs/heads/master | <repo_name>mike79212001/oveweb<file_sep>/NOVA.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="NOVA"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Nova/300_300/NOVY.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:NOVY</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:700(每等+110)<br><br>生命回復:1.457(每等+0.227)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:39(每等+10)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
乃是人族帝國麾下的最難以捉摸的戰士,也是迄今為止為人所知最強大的靈能戰士之一。她意志堅定也非常致命,任何人都絕對不願意被她的瞄準鏡鎖定。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
不在戰斗狀態下時將會隱形。除此之外,她還能從遠處狙擊敵人,並設置自己的鏡像來迷惑敵手。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Nova/Abilities/Snipe.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Snipe(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>指向技,造成100+(等級*35)傷害。</font>
</span>
<br>
<img src="picture/Nova/Abilities/Pinning Shot.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Pinning Shot(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">80mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>造成50+(等級*18)傷害,並減少目標移動速度30%,持續2.25秒。</font>
</span>
<br>
<img src="picture/Nova/Abilities/Holo Decoy.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Holo Decoy(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>創造一個持續5秒鏡像攻擊敵人,但是不會造成傷害,使用此既能不會解除隱身。</font>
</span>
<br>
<img src="picture/Nova/Abilities/Triple Tap.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Triple Tap(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>鎖定一個目標英雄,對第一個接觸的英雄或建築打出三發射擊傷害,每次傷害為80+(等級*33)。</font>
</span>
<br>
<img src="picture/Nova/Abilities/Precision Strike.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Precision Strike(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">60秒</font>
<br class="fon2"><font color="fffff"><br>延遲3秒後,對目標範圍內的敵人造成335+(等級*35)的傷害。</font>
</span>
<br>
<img src="picture/Nova/Abilities/Permanent CloakSniper.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Permanent Cloak, Sniper </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>脫離戰鬥2秒後進入隱身狀態,受到傷害或攻擊時會解除隱身。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/1/Psi-Op Rangefinder.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Psi-Op Rangefinder(Q)</span></font><br><font color="00ffff">Snipe(Q)射程增加20%。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/1/Ambush Snipe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ambush Snipe(Q)</span></font><br><font color="00ffff">隱形的時候使用Snipe(Q)增加20%傷害。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/1/Tazer Rounds.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tazer Rounds(W)</span></font><br><font color="00ffff">Pinning Shot(W)緩速時間增加至3秒。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/4/FN92 Sniper Rifle.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">FN92 Snier Rifle</span></font><br><font color="00ffff">基礎攻擊距離從6.5增加至7.5。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回覆自身生命。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack</span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/4/Extended Projection.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Extended Projection(E)</span></font><br><font color="00ffff">Holo Decoy(E)施放範圍增加100%。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">主動技,使一個敵人中毒,造成180+(等級*30)傷害。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/7/Digital Shrapnel.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Digital Shrapnel(E)</span></font><br><font color="00ffff">Holo Decoy(E)鏡像消失時會爆炸,對附近敵人造成50+(等級*18)傷害。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/7/Explosive Round.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Explosive Round(Q)</span></font><br><font color="00ffff">Snipe(Q)擊中目標時,周圍敵人受到50%傷害。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/7/Explosive Round.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Follow Through</span></font><br><font color="00ffff">使用技能後,下一次基礎攻擊增加25%傷害。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/10/Triple Tap.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Triple Tap(R)</span></font><br><font color="00ffff">鎖定一個目標英雄,對第一個接觸的英雄或建築打出三發射擊傷害,每次傷害為80+(等級*33)。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/10/Precision Strike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Precision Strike(R)</span></font><br><font color="00ffff">延遲3秒後,對目標範圍內的敵人造成335+(等級*35)的傷害。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/13/Advanced Cloaking.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Advanced Cloaking</span></font><br><font color="00ffff">當隱身時,移動速度增加25%,每2秒回復1%的生命。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield</span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。
</font></span>
</div>
<div>
<img src="picture/Nova/Talents/13/Holo Drone.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Holo Drone(E)</span></font><br><font color="00ffff">Holo Decoy(E)產生的鏡像可以對敵人造成傷害,可以使用Snipe(Q)和Pinning Shot(W),但所造成的傷害較少。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/13/Remote Access.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Remote Access(E)</span></font><br><font color="00ffff">可以控制Holo Decoy(E)產生的鏡像,該鏡像的視野增加100%。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/13/Overdrive.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Overdrive </span></font><br><font color="00ffff">主動技,增加技能25%傷害,但是耗魔增加40%,持續5秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/16/Crippling Shot.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Crippling Shot(W)</span></font><br><font color="00ffff">被Pinning Shot(W)擊中的敵人,在2秒內會承受額外25%的傷害。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/16/Railgun.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Railgun(Q)</span></font><br><font color="00ffff">Snipe(Q)穿透第一個敵人後對後面的敵人造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/16/Blood for Blood.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blood for Blood </span></font><br><font color="00ffff">主動技,吸取目標敵人15%最大生命值,並使其移動速度降低30%,持續3秒。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Nova/Talents/20/Onslaught of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Onslaught of the storm</span></font><br><font color="00ffff">被技能擊殺的敵人會爆炸造成500傷害。 </font></span>
</div>
<div>
<img src="picture/Nova/Talents/20/Onslaught of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/20/Fast Reload.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fast Reload(R)</span></font><br><font color="00ffff">Triple Tap(R)擊殺敵方英雄,冷卻時間歸零。</font></span>
</div>
<div>
<img src="picture/Nova/Talents/20/Precision Barrage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Precision Barrage(R)</span></font><br><font color="00ffff">Precision Strike(R)有兩次充能,兩次間隔冷卻時間為3秒。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li>Welly Tung</li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/UTHER.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="UTHER"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Uther/300_300/Uther.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:Uther</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:890(每等+190)<br><br>生命回復:1.855(每等+0.0.395)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:38(每等+7)<br><br>攻擊速度:1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
一名人類聖騎士,也是白銀之手騎士團的創辦人之一,作為對聖光懷有無限虔誠的僕人,光明使者烏瑟爾用他手中的戰鎚伸張正義,他本人即是真理的壁壘,也是聯盟英勇無畏的象徵。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
烏瑟爾既能治療友軍,又能暈眩敵人,在死亡後也能化為聖靈提供治癒並繼續奮戰。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Uther/Abilities/Holy Light.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Holy Light(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">90mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>治療目標單位150+(等級*44)的生命值。</font>
</span>
<br>
<img src="picture/Uther/Abilities/Holy Radiance.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Holy Radiance(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">65mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>在直線上治癒我方80+(等級*20)的生命值和對敵方造成50+(等級*15)傷害</font>
</span>
<br>
<img src="picture/Uther/Abilities/Hammer of Justice.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hammer of Justice(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">40mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>造成對目標40+(等級*8)的傷害並暈眩單位目標一秒。</font>
</span>
<br>
<img src="picture/Uther/Abilities/Divine Shield.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Divine Shield(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">90秒</font>
<br class="fon2"><font color="fffff"><br>令一個友方英雄進入無敵狀態,並增加其20%移動速度,持續3秒。</font>
</span>
<br>
<img src="picture/Uther/Abilities/Divine Storm.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Divine Storm(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">70秒</font>
<br class="fon2"><font color="fffff"><br>對周圍的敵人造成75+(等級*25)傷害並擊暈他們1.5秒。</font>
</span>
<br>
<img src="picture/Uther/Abilities/Eternal Devotion.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Eternal Devotion(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>死亡後會變成無敵的聖靈持續10秒此,期間內提高所以技能與攻擊的50%治癒量和傷害量。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/1/Reach.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reach(Q)</span></font><br><font color="00ffff">Holy Light增加2治癒施放範圍。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/1/Dense Weightstone.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dense Weighstone(E)</span></font><br><font color="00ffff">增加Hammer of Justice的40%傷害。</font></span>
</div>
<div>
<img src="picture/Uther/Talents/1/Blessed Champion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blessed Champions</span></font><br><font color="00ffff">基本攻擊的25%傷害轉為對周圍友軍的治療量。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/4/Hammer of the Lightbringer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hammer of the Lightbringer </span></font><br><font color="00ffff">基本攻擊或的5點魔力</font></span>
</div>
<div>
<img src="picture/Uther/Talents/4/Protect the Weak.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protect the Weak(Q)</span></font><br><font color="00ffff">將Holy Light使用在小兵或僱傭兵身上時會返還75%的魔力消耗跟冷卻時間。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/4/Fist of Justice.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fist of Justice(E)</span></font><br><font color="00ffff">每次基本攻擊將減少Hammer of Justice的冷卻時間1秒。</font></span>
</div>
<div>
<img src="picture/Uther/Talents/4/Protective Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protective Shield</span></font><br><font color="00ffff">為一個友方英雄放置一個300+(等級*30)的護盾持續5秒。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/7/Wave of Light.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Wave of Light(W)</span></font><br><font color="00ffff">Holy Radiance每治癒一個友方單位返還10魔力並減少冷卻時間1秒最高到達50魔力跟5秒。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Rebuke.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rebuke(E)</span></font><br><font color="00ffff">Hammer of Justice此技能施放後並擊退周遭敵方目標。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Holy Devotion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Holy Devotion</span></font><br><font color="00ffff">Eternal Devotion效果由50%增至100%。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Clairvoyance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Clairvoyance</span></font><br><font color="00ffff">施放後始目標區域的所有單位顯形,持續4秒。</font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Cleanse.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Cleanse</span></font><br><font color="00ffff">解除目標所有暈眩、沉默、緩速、定身效果並保護此目標在一秒內不再受到影響。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/10/Divine Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Divine Shield(R)</span></font><br><font color="00ffff">令一個友方英雄進入無敵狀態,並增加其20%移動速度,持續3秒。</font></span>
</div>
<div>
<img src="picture/Uther/Talents/10/Divine Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Divine Storm(R)</span></font><br><font color="00ffff">對周圍的敵人造成75+(等級*25)傷害並擊暈他們1.5秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/7/Wave of Light.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield</span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Rebuke.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Burning Rage</span></font><br><font color="00ffff">對周圍敵人每秒造成10+(等級*2)傷害。Hammer of Justice此技能施放後並擊退周遭敵方目標。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Holy Devotion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hardened Focus</span></font><br><font color="00ffff">當血量再80%以上基本技能冷卻時間減少50%。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Clairvoyance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sprint</span></font><br><font color="00ffff">主動技,增加75%移動速度,持續3秒。</font></span>
</div>
<div>
<img src="picture/Uther/Talents/7/Cleanse.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shrink Ray</span></font><br><font color="00ffff">在四秒內使一個敵方英雄減少50%傷害和50%的移動速度。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/16/Imposing Presence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Presence</span></font><br><font color="00ffff">受到攻擊時,攻擊者降低30%攻擊速度。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/16/Holy Shock.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Holy Shock(Q)</span></font><br><font color="00ffff">Holy Light可以作用於敵方並造成治癒量50%的傷害 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/16/Gathering Radiance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gathering Radiance(W)</span></font><br><font color="00ffff">每增加一個目標就增加10%傷害與治療量最高增加至50%傷害與治療量。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Uther/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。</font></span>
</div>
<div>
<img src="picture/Uther/Talents/20/Storm Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm Shield</span></font><br><font color="00ffff">自身和周圍隊友產生最大生命值30%的護盾,持續時間3秒。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/20/Bulwark of Light.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bulwark of Light(R)</span></font><br><font color="00ffff">使用Divine Shield時延長1秒技能作用時間並治癒目標單位40%最大生命值。 </font></span>
</div>
<div>
<img src="picture/Uther/Talents/20/Divine Hurricane.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Divine Hurricane(R)</span></font><br><font color="00ffff">Divine Storm技能範圍增加100%並減少20秒的冷卻時間。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/BRITHTWING.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="BRITHTWING"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Brightwing/300_300/Brightwing.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:BRITHTWING</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:775(每等+140)<br><br>生命回復:1.163(每等+0.289)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:34(每等+8)<br><br>攻擊速度:0.9</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
精靈龍一族,調皮的性格且喜歡突發奇想而為人們所知。她經常突然出現幫助盟友,或者喜愛放肆的嘲弄敵人。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
是一名高機動性輔助型治療,除了能強化友軍也能使敵軍失去攻擊的能力。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Brightwing/Abilities/Arcane Flare.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Arcane Flore(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>對中心區域造成70+(等級*20)傷害對外圍區域造成35+(等級*10)傷害。</font>
</span>
<br>
<img src="picture/Brightwing/Abilities/Polymorph.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Polymorph(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>把目標便成動物並造成25+(等級*5)的傷害,變成動物時不能攻擊與使用技能持續2秒。</font>
</span>
<br>
<img src="picture/Brightwing/Abilities/Pixie Dust.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Pixie Dust(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>增加目標的移動速度25%並在4秒內擁有2次格檔機會,每次格擋可以抵消50%的普通攻擊傷害。
</font>
</span>
<br>
<img src="picture/Brightwing/Abilities/Emerald Wind.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Emerald Wind (R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">90mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">60秒</font>
<br class="fon2"><font color="fffff"><br>在範圍內從自身釋放強風推開敵方單位並造成100+(等級*30)傷害。</font>
</span>
<br>
<img src="picture/Brightwing/Abilities/Blink Heal.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Blink Heal(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">40mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">1秒</font>
<br class="fon2"><font color="fffff"><br>傳送至目標友軍並對的附近友軍治癒100+(等級*15)的生命值。可充能2次每次需要8秒。</font>
</span>
<br>
<img src="picture/Brightwing/Abilities/Soothing Mist.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Soothing Mist(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>4秒治癒附近的友方英雄32+(等級*8)點生命值。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/1/Arcane Precision.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Arcane Precision(Q)r</span></font><br><font color="00ffff">Arcane Flore中心區域的傷害提升33%。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/1/Shield Dust.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shield Dust(E)</span></font><br><font color="00ffff">Pixie Dust格擋機會提升至3次。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/1/Bribe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bribe</span></font><br><font color="00ffff">擊殺敵方小兵,可以獲得賄賂層數,疊加到20層時,可直接擊敗一個傭兵營地,但對骷髏無效。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/4/Anti-magic Powder.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ani-magic Powder(E)/span></font><br><font color="00ffff">Reduce damage taken from nonPixie Dust使用這招時可以抵擋一次技能,降低50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/4/Protective Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protective Shield</span></font><br><font color="00ffff">A為一個友方英雄放置一個300+(等級*30)的護盾持續5秒。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">給敵方英雄下毒,6秒內造成180+(等級*30)點傷害。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/4/Promote.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Promote </span></font><br><font color="00ffff">使用後增加小兵200%的血量與100%的傷害,能充能2次。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/7/Gust of Healing.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gust of Healing(Trait)</span></font><br><font color="00ffff">啟動後,Soothing Mist的治癒效果每秒發生1次,持續4秒。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/7/Regenerative Rains.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regenerative Rains(Trait)</span></font><br><font color="00ffff">每次使用技能後都會激發Soothing Mist的效果。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/7/CalldownMULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/7/Cleanse.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Cleanse</span></font><br><font color="00ffff">解除目標所有暈眩、沉默、緩速、定身效果並保護此目標在一秒內不再受到影響。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/10/Emerald Wind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Emerald Wind (R)</span></font><br><font color="00ffff">在範圍內從自身釋放強風推開敵方單位並造成100+(等級*30)傷害。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/10/Blink HealCharge Cooldown 8 seconds.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blink Heal(R)</span></font><br><font color="00ffff">傳送至目標友軍並對的附近友軍治癒100+(等級*15)的生命值。可充能2次每次需要8秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/13/Sticky Flare.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sticky Flare(Q)</span></font><br><font color="00ffff">減少Arcane Flore區域內的敵方目標30%的移動速度持續3秒 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/13/Phase Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Phase Shield(Z)</span></font><br><font color="00ffff">傳送後對方目標會在3秒內獲得200+(等級*25)的護盾。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/13/Sprint.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sprint</span></font><br><font color="00ffff">主動技,增加75%移動速度,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/13/Ice Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ice Block </span></font><br><font color="00ffff">使自身無敵無法動作持續3秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/16/Sticky Powder.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sticky Powder(W)</span></font><br><font color="00ffff">變成小動物後減少50%移動速度。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/16/Critterize.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Critterize(W)</span></font><br><font color="00ffff">提升25%的技能傷害。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。</font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Brightwing/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/20/Storm Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm Shield</span></font><br><font color="00ffff">自身和周圍隊友產生最大生命值20%的護盾,持續時間3秒。 </font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/20/Continuous Winds.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Continuous Winds(R)</span></font><br><font color="00ffff">Emerald Wind額外釋出2陣風,每陣風造成25%的傷害。</font></span>
</div>
<div>
<img src="picture/Brightwing/Talents/20/Ysera's Blessing.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ysera's Blessing(R)</span></font><br><font color="00ffff">Blink Heal能充能三次</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/hero_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$heroID = $_GET['id'];
$output = "";
$list = getAllHero();
$output = '
<h1>所有英雄</h1>
<div class="lead">
<table class="table hero_table">';
foreach ($list as $hero) {
$output = $output.'
<tr>
<td class="title">'.$hero['name'].'</td>
<td>
<form method="post" action="list_hero_ability.php">
<input type="hidden" name="id" value="'.$hero['id'].'">
<button class="btn btn-primary" type="submit">設定 技能/天賦</button>
</form>
</td>
</tr>';
}
$output = $output.'
</table>
</div>';
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/modify_hero.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$output = "";
$heroID = $_POST['id'];
$name = $_POST['name'];
$come_from = $_POST['come_from'];
$major = $_POST['major'];
$story = $_POST['story'];
$suggest = $_POST['suggest'];
$health = $_POST['health'];
$health_per_level = $_POST['health_per_level'];
$health_regain = $_POST['health_regain'];
$health_regain_per_level = $_POST['health_regain_per_level'];
$mana = $_POST['mana'];
$mana_per_level = $_POST['mana_per_level'];
$mana_regain = $_POST['mana_regain'];
$mana_regain_per_level = $_POST['mana_regain_per_level'];
$attack = $_POST['attack'];
$attack_per_level = $_POST['attack_per_level'];
$attack_speed = $_POST['attack_speed'];
$attack_speed_per_level = $_POST['attack_speed_per_level'];
if(isset($name)) {
$data = new HeroData();
$data->name_ = $name;
$data->come_from_ = $come_from;
$data->major_ = $major;
$data->second_major_ = "";
$data->story_ = $story;
$data->suggest_ = $suggest;
$data->health_ = $health;
$data->health_regain_ = $health_regain;
$data->mana_ = $mana;
$data->mana_regain_ = $mana_regain;
$data->attack_ = $attack;
$data->attack_speed_ = $attack_speed;
$data->health_per_level_ = $health_per_level;
$data->health_regain_per_level_ = $health_regain_per_level;
$data->mana_per_level_ = $mana_per_level;
$data->mana_regain_per_level_ = $mana_regain_per_level;
$data->attack_per_level_ = $attack_per_level;
$data->attack_speed_per_level_ = $attack_speed_per_level;
updateHero($heroID, $data);
header("Location:/admin/hero.php");
}
else if(isset($heroID)) {
$hero = getHero($heroID);
$output = ' <h1>修改英雄</h1>
<div class="lead">
<form method="post" action="">
<input type="hidden" name="id" value="'.$heroID.'">
<div>
<h3>英雄名稱:</h3>
<input type="text" name="name" value="'.$hero['name'].'">
</div>
<div>
<h3>源自:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="come_from" value="魔獸" '.getComefromCheck($heroID, "魔獸").'>魔獸<br></div>
<div class="float"><input type="radio" name="come_from" value="暗黑" '.getComefromCheck($heroID, "暗黑").'>暗黑<br></div>
<div class="float"><input type="radio" name="come_from" value="星海" '.getComefromCheck($heroID, "星海").'>星海<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>角色:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="major" value="刺客" '.getMajorCheck($heroID, "刺客").'>刺客<br></div>
<div class="float"><input type="radio" name="major" value="專家" '.getMajorCheck($heroID, "專家").'>專家<br></div>
<div class="float"><input type="radio" name="major" value="戰士" '.getMajorCheck($heroID, "戰士").'>戰士<br></div>
<div class="float"><input type="radio" name="major" value="輔助" '.getMajorCheck($heroID, "輔助").'>輔助<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>英雄介紹:</h3>
<textarea rows="10" cols="80%" name="story">'.nl2br($hero['story']).'</textarea>
</div>
<div>
<h3>英雄小知識:</h3>
<textarea rows="10" cols="80%" name="suggest">'.nl2br($hero['suggest']).'</textarea>
</div>
<div>
<table class="ability">
<tr>
<td></td>
<td><h3>等級一:</h3></td>
<td><h3>每級提昇:</h3></td>
</tr>
<tr>
<td><h3>生命:</h3></td>
<td><input type="text" name="health" value="'.$hero['health'].'"></td>
<td><input type="text" name="health_per_level" value="'.$hero['health_per_level'].'"></td>
</tr>
<tr>
<td><h3>生命恢復:</h3></td>
<td><input type="text" name="health_regain" value="'.$hero['health_regain'].'"></td>
<td><input type="text" name="health_regain_per_level" value="'.$hero['health_regain_per_level'].'"></td>
</tr>
<tr>
<td><h3>魔力:</h3></td>
<td><input type="text" name="mana" value="'.$hero['mana'].'"></td>
<td><input type="text" name="mana_per_level" value="'.$hero['mana_per_level'].'"></td>
</tr>
<tr>
<td><h3>魔力恢復:</h3></td>
<td><input type="text" name="mana_regain" value="'.$hero['mana_regain'].'"></td>
<td><input type="text" name="mana_regain_per_level" value="'.$hero['mana_regain_per_level'].'"></td>
</tr>
<tr>
<td><h3>攻擊力:</h3></td>
<td><input type="text" name="attack" value="'.$hero['attack'].'"></td>
<td><input type="text" name="attack_per_level" value="'.$hero['attack_per_level'].'"></td>
</tr>
<tr>
<td><h3>攻速:</h3></td>
<td><input type="text" name="attack_speed" value="'.$hero['attack_speed'].'"></td>
<td><input type="text" name="attack_speed_per_level" value="'.$hero['attack_speed_per_level'].'"></td>
</tr>
</table>
</div>
</br>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin/hero.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
else {
echo "error: modify hero <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/about_us.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>傲飛娛樂</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body class="star_background">
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<div class="block"></div>
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<div class="lead ove_block">
<div class="ove_logo"><img src="picture/OVE.LOGO.png"></div>
<br/>
<div class="ove_title">
傲飛娛樂
</div>
<div class="ove_cotent">
是由7位志同道合的夥伴所成立的新創公司<br/>
<br/>
鑑於直播與影片在全球的娛樂產業中越做越大,且有許多優質實況主沒被發現,<br/>
我們因此建立起一個新的平台來加強實況品質以提供更好的娛樂效果。<br/>
<br/>
為您打造精品活動是我們的榮幸<br/>
如有任何相關問題與疑問, 歡迎免費聯絡!!!<br/>
<br/>
</div>
<div class="ove_message">
<table class="ove_message">
<tr><td>Phone:</td><td>0911-839-846</td></tr>
<tr><td>Email:</td><td><EMAIL></td></tr>
<tr><td>統編:</td><td>54714519</td></tr>
</table>
</div>
</div>
</div><!-- /.container -->
<div class="block"></div>
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/test/index.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
function dirToArray($dir) {
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
{
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
{
$list = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
foreach($list as $value2) {
$result[] = $value2;
}
}
else
{
$result[] = $dir.DIRECTORY_SEPARATOR.$value;
}
}
}
return $result;
}
$list = dirToArray($_SERVER['DOCUMENT_ROOT']."/picture");
echo json_encode($list);
// echo dirname("0313153947222126587.jpg");
// print_r($list);
?>
<!-- jquery and bootstrap -->
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
</body>
</html>
<file_sep>/class/201406_ming.php
<?php
require_once 'class/DB.php';
function join201406_ming($id, $notebook, $focusming, $comment) {
$db = new DB();
$result = $db->insert("INSERT INTO 201406_ming (id, notebook, focusming, comment)
VALUES ('$id', '$notebook', '$focusming', '$comment')");
return $result;
}
function leave201406_ming($id) {
$db = new DB();
$result = $db->delete("DELETE FROM 201406_ming WHERE id='$id'");
return $result;
}
function update201406_ming($id, $notebook, $focusming, $comment) {
$db = new DB();
$result = $db->update(" UPDATE 201406_ming SET notebook='$notebook', focusming='$focusming', comment='$comment'
WHERE id='$id'");
return $result;
}
function hasJoinProfile($id) {
$db = new DB();
$result = $db->query("SELECT * FROM 201406_ming WHERE id='$id'");
return $result;
}
function show201406_ming($id) {
$db = new DB();
$result = $db->query("SELECT * FROM 201406_ming WHERE id='$id'");
return $db->fetch_array();
}
function getNotebookChecked($id, $flag) {
$result = show201406_ming($id);
$notebook = $result['notebook'];
if($notebook == null) {
return $flag ? "" : "checked";
}
else if($notebook == "是") {
return $flag ? "checked" : "";
}
else {
return $flag ? "" : "checked";
}
}
function getFocusChecked($id, $flag) {
$result = show201406_ming($id);
$focusming = $result['focusming'];
if($focusming == null) {
return $flag ? "" : "checked";
}
else if($focusming == "有") {
return $flag ? "checked" : "";
}
else {
return $flag ? "" : "checked";
}
}
function getComment($id) {
$result = show201406_ming($id);
return $result['comment'];
}
function getDataArray($id) {
$db = new DB();
$db->query("SELECT * FROM 201406_ming WHERE id='$id'");
$result = $db->fetch_array();
$list = array();
array_push($list, $result['notebook']);
array_push($list, $result['focusming']);
array_push($list, nl2br($result['comment']));
return $list;
}
function getTitleArray() {
$list = array();
array_push($list, "是否帶筆電?");
array_push($list, "是否訂閱小銘?");
array_push($list, "備註");
return $list;
}
?>
<file_sep>/admin/log_out.php
<?php
require_once 'class/User.php';
logout();
ini_set("default_charset","utf-8");
echo '
<script type="text/javascript">
alert("( ^ω^) 登出成功");
location.href="/admin"
</script>';
?><file_sep>/LILI.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="LILI"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Li Li/300_300/LILI.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:LILI</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:835(每等+135)<br><br>生命回復:1.738(每等+0.281)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:20(每等+6)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
出生在迷?島。麗麗是傳奇的熊貓人的侄女,最喜歡的事情莫過於探索陌生新奇的世界、並認識新朋友。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
所扮演的是一名輔助型英雄,通過治療與支援盟友或使敵人失去攻擊能力來幫助團隊。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Li Li/Abilities/Healing Brew.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Healing Brew(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">30mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">3秒</font>
<br class="fon2"><font color="fffff"><br>治療附近生命最少的友軍單位100+(等級*13)並回復20魔力,優先治療友方英雄,魔力回復效果對自身無效。</font>
</span>
<br>
<img src="picture/Li Li/Abilities/Cloud Serpent.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Cloud Serpent(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">40mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>召喚1隻擁有15+(等級*4)傷害的法力龍跟隨友軍單位,持續10秒。</font>
</span>
<br>
<img src="picture/Li Li/Abilities/Blinding Wind.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Blinding Wind(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">120秒</font>
<br class="fon2"><font color="fffff"><br>對附近三個敵方單位釋出矇蔽之風造成50+(等級*12)的傷害,英雄優先。被擊中的目標在4秒內下1個普通攻擊失效。</font>
</span>
<br>
<img src="picture/Li Li/Abilities/Jug of 1,000 Cups.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Jug of 1000 Cups(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">70秒</font>
<br class="fon2"><font color="fffff"><br>在6秒內快速治癒附近受傷最重的單位600+(等級*72)生命值並回復120點魔力,英雄優先且自身不會獲得魔力回復效果。</font>
</span>
<br>
<img src="picture/Li Li/Abilities/Water Dragon.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Water Dragon(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">45秒</font>
<br class="fon2"><font color="fffff"><br>對敵方目標英雄召喚一隻水龍造成260+(等級*25)的傷害,附近敵軍承受50%的傷害值。受到攻擊的單位在3秒內減少40%的移動速度。</font>
</span>
<br>
<img src="picture/Li Li/Abilities/Fast Feet.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Fast Feet(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>受到傷害時在1秒內提高15%移動速度。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/1/Gale Force.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gale Force(E)</span></font><br><font color="00ffff">Blinding WindG傷害提高25%。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/1/Mass Vortex.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mass Vortes(E)</span></font><br><font color="00ffff">Blinding Wind能傷害5個敵方單位。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/1/Bribe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bribe</span></font><br><font color="00ffff">擊殺敵方小兵,可以獲得賄賂層數,疊加到20層時,可直接擊敗一個傭兵營地,但對骷髏無效。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/1/Healing Ward.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Healing Ward</span></font><br><font color="00ffff">放置一根治癒圖騰再地板上對附近友軍每秒造成2%最大生命回復持續10秒。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/4/Bringer of Gifts.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bringer of Gifts(W)</span></font><br><font color="00ffff">Cloud Serpent同時會治癒目標100+(等級*13)的生命值與20的魔力。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/4/Lingering Blind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ligering Blind(E)</span></font><br><font color="00ffff">Blinding Wind的攻擊失效效果變成2次。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/4/Protective Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protective Shield Dance Your Pants Off</span></font><br><font color="00ffff">為一個友方英雄放置一個300+(等級*30)的護盾持續5秒。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">給敵方英雄下毒,6秒內造成180+(等級*30)點傷害。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/7/First Sip.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Sip(Q)</span></font><br><font color="00ffff">Healing Brew可回復額外50+(等級*6.5)的生命值。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/7/The Good Stuff.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">The Good Stuff(Q)</span></font><br><font color="00ffff">Healing Brew治癒效果提升25%。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/7/CalldownMULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/7/Clairvoyance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Clairvoyance </span></font><br><font color="00ffff">施放後始目標區域的所有單位顯形,持續4秒。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/10/Jug of 1,000 Cups.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Jug of 1000 Cups(R)</span></font><br><font color="00ffff">在6秒內快速治癒附近受傷最重的單位600+(等級*72)生命值並回復120點魔力,英雄優先且自身不會獲得魔力回復效果。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/10/Water Dragon.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Water Dragon(R)</span></font><br><font color="00ffff">對敵方目標英雄召喚一隻水龍造成260+(等級*25)的傷害,附近敵軍承受50%的傷害值。受到攻擊的單位在3秒內減少40%的移動速度。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/13/Elusive Feet (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Elusive Feet(Trait)</span></font><br><font color="00ffff">在10秒內承受傷害時獲得2次的格擋機會(減少50%普通攻擊傷害),此效果每10秒只能觸發1次。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/13/Lightning Serpent.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lightning Serpent(W)</span></font><br><font color="00ffff">Cloud Serpent可以額外攻擊3個附近敵方單位造成4+(等級*2)的傷害。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/13/Hindering Winds.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hindering Winds(E)</span></font><br><font color="00ffff">Blinding Wind同時減緩敵軍25%移動速度,持續2秒。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/13/Shrink Ray.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shrink Ray</span></font><br><font color="00ffff">在四秒內使一個敵方英雄減少50%傷害和50%的移動速度。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/13/Ice Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ice Block</span></font><br><font color="00ffff">使自身無敵無法動作持續3秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/16/Magical Essence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Magical Essence</span></font><br><font color="00ffff">增加一般技能25%的施法距離。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/16/Herbal Cleanse.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Herbal Cleanse(Q)</span></font><br><font color="00ffff">Healing Brew會解除目標單位所受到的控場技能並增加20%的移動速度,持續2秒。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/16/Two For One.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Two For One(Q)</span></font><br><font color="00ffff">Healing Brew可以治療附近2個受傷最重的單位。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/16/Timeless Creature.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Timeless Creature(W)</span></font><br><font color="00ffff">法力龍持續時間增加50%。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Li Li/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/20/Storm Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm Shield</span></font><br><font color="00ffff">自身和周圍隊友產生最大生命值20%的護盾,持續時間3秒。 </font></span>
</div>
<div>
<img src="picture/Li Li/Talents/20/Jug of 1,000,000 Cups.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Jug of 1000000 Cups(R)</span></font><br><font color="00ffff">治癒效果提升成2倍同樣時間內。</font></span>
</div>
<div>
<img src="picture/Li Li/Talents/20/Double Dragon.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Double Dragon(R)</span></font><br><font color="00ffff">水龍擊中對方英雄後會再產生1隻水龍攻擊施法目標所在地點。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li>Welly Tung</li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/class/graph_setting.php
<?php
require_once "HOS.php";
echo getcwd();
return;
$method = $_POST['method'];
if(strcmp($method, "LIST_HERO")==0) {
echo $_POST['test'];
}
else {
echo false;
}
?><file_sep>/NAZEEBO.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="NAZEEBO"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Nazeebo/300_300/NAZEEBO.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:ZAZEEBO</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:740(每等+150)<br><br>生命回復:1.539(每等+0.313)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:41(每等+8)<br><br>攻擊速度:0.9</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
穿戴著羽毛與骨頭裝飾的神秘祭祀,巫醫從無形之地中召喚靈魂來幫助他們戰鬥。只有少數外來人遇到了巫醫,而未奉獻出他們的血肉。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
巫醫專精於應對成群的敵人,他能召喚蜘蛛、殭屍和蟾蜍,也能從瀕死的敵人身上吸取法力和生命。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Nazeebo/Abilities/Corpse Spiders.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Corpse Spiders(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>對目標範圍造成40+(等級*8)的傷害並招喚出3隻有10+(等級*1)傷害的蜘蛛,持續4秒。</font>
</span>
<br>
<img src="picture/Nazeebo/Abilities/Zombie Wall.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Zombie Wall(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">70mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">14秒</font>
<br class="fon2"><font color="fffff"><br>短暫延遲後,對目標範圍招喚出9隻環繞範圍的僵屍,每隻僵屍擁有20+(等級*2)的攻擊力,持續3秒。</font>
</span>
<br>
<img src="picture/Nazeebo/Abilities/Plague of Toads.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Plague of Toads(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">10mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>對錐形範圍釋放出5隻蟾蜍,每隻爆炸會造成30+(等級*8)的傷害。</font>
</span>
<br>
<img src="picture/Nazeebo/Abilities/Ravenous Spirit.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Ravenous Spirit(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">90秒</font>
<br class="fon2"><font color="fffff"><br>在目標範圍內招喚出一隻惡靈對其周圍產生每秒50+(等級*18)的傷害,引導惡靈時自身無法移動。</font>
</span>
<br>
<img src="picture/Nazeebo/Abilities/Gargantuan.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Gargantuan(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">90mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">60秒</font>
<br class="fon2"><font color="fffff"><br>招喚出巨像對目標範圍造成30+(等級*15)的傷害,巨像能抓捕小兵並撞擊地面對周圍敵軍造成30+(等級*15)的傷害並緩速30%,持續20秒。</font>
</span>
<br>
<img src="picture/Nazeebo/Abilities/Voodoo Ritua.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Voodoo Ritual(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>普通攻擊與技能在4秒內對敵軍造成額外20+(等級*4)的毒藥傷害,如果中毒的敵軍死亡,自身能回復1%的最大生命與最大魔力。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/1/Demolitionist.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Demolitionist</span></font><br><font color="00ffff">基礎攻擊建築時減少一發彈藥並額外造成10%傷害。</font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/1/Blood Ritual.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blood Ritual(Trait)</span></font><br><font color="00ffff">Voodoo Ritual的回復效果提升100%</font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/1/Death Ritual.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Death Ritual(Trait)</span></font><br><font color="00ffff">當敵軍在Voodoo Ritual效果下死亡,自身永久增加4點生命與2點魔力。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/1/Bribe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bribe</span></font><br><font color="00ffff">擊殺敵方小兵,可以獲得賄賂層數,疊加到20層時,可直接擊敗一個傭兵營地,但對骷髏無效。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/4/Minion Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Minion Killer</span></font><br><font color="00ffff">對小兵、僱傭兵與招喚物增加25%的傷害。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/4/Spider Cluster.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spider Cluster(Q)</span></font><br><font color="00ffff">使用Corpse Spiders時額外招喚出3隻蜘蛛,持續3秒。</font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">主動技,使一個敵人中毒,在6秒內造成180+(等級*30)傷害。</font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/4/Promote.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Promote</span></font><br><font color="00ffff">使用後增加小兵200%的血量與100%的傷害,能充能2次。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/7/Gidbinn.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gidbinn</span></font><br><font color="00ffff">增加Plague of Toads的蟾蜍爆炸範圍,並增加所有非英雄技能的25%持續時間。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/7/Fresh Corpses.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fresh Corpses(W)</span></font><br><font color="00ffff">Zombie Wall的僵屍增加50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/7/Calldown MULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/7/Clairvoyance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Clairvoyance</span></font><br><font color="00ffff">施放後始目標區域的所有單位顯形,持續4秒。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/10/Ravenous Spirit.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ravenous Spirit(R)</span></font><br><font color="00ffff">在目標範圍內招喚出一隻惡靈對其周圍產生每秒50+(等級*18)的傷害,引導惡靈時自身無法移動。</font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/10/Gargantuan.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gargantuan(R) </span></font><br><font color="00ffff">招喚出巨像對目標範圍造成30+(等級*15)的傷害,巨像能抓捕小兵並撞擊地面對周圍敵軍造成30+(等級*15)的傷害並緩速30%,持續20秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/13/Dead Rush.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dead Rush(W)</span></font><br><font color="00ffff">Zombie Wall持續時間結束後留下5隻僵屍攻擊周圍的敵人,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/13/Toads of Hugeness.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Toads of Hugeness(E)</span></font><br><font color="00ffff">Plague of Toads的蟾蜍每跳一下就提高10%的傷害。</font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/13/Sprint.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sprint </span></font><br><font color="00ffff">主動技,增加75%移動速度,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/13/Ice Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ice Block</span></font><br><font color="00ffff">使自身無敵無法動作持續3秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/16/Leaping Spiders.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Leaping Spiders(Q)</span></font><br><font color="00ffff">Corpse Spiders會跳向目標且增加25%的傷害。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/16/Infested Toads.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Infested Toads(E)</span></font><br><font color="00ffff">Plague of Toads的蟾蜍爆炸後會各自生出一隻蜘蛛。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Nazeebo/Talents/20/Swift StormYour Hero is no longer dismounted from taking damage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Swift Storm</span></font><br><font color="00ffff">承受傷害時不會解除坐騎並增加60%的騎馬移動速度。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/20/Annihilating Spirit.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Annihilating Spirit(R)</span></font><br><font color="00ffff">增加Ravenous Spirit的50%攻擊範圍與移動速度30%。 </font></span>
</div>
<div>
<img src="picture/Nazeebo/Talents/20/Humongoid (R).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Humongoid(R)</span></font><br><font color="00ffff">巨像會持續到死亡,並對非英雄單位增加100%的傷害。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/list_hero_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$heroID = $_POST['id'];
if(isset($heroID) == false)
$heroID = $_COOKIE['heroID'];
setcookie('heroID', $heroID);
$passiveAbilityList = getHeroPassiveAbility($heroID);
$abilityList = getHeroSkills($heroID);
$telentList = getHeroTelents($heroID);
$output = '
<h2>'.getHeroName($heroID).'</h2>
</br>
<div class="lead">
<form action="add_hero_ability.php" method="post">
<input type="hidden" name="uid" value="'.$heroID.'">
<button class="btn btn-primary" type="submit">設定 技能/天賦</button>
</form>
<h3>擁有特性</h3>
<table class="table hero_table">
<thead>
<tr>
<th>名稱</th>
<th>對應按鍵</th>
<th>需求等級</th>
<th>種類</th>
</tr>
</thead>';
foreach($passiveAbilityList as $passiveAbility) {
$output = $output.'
<div>
<tr>
<td class="share">'.$passiveAbility['name'].'</td>
<td class="share">'.$passiveAbility['button'].'</td>
<td class="share">'.$passiveAbility['level'].'</td>
<td class="share">'.$passiveAbility['type'].'</td>
<td>
<form method="post" action="modify_hero_ability.php">
<input type="hidden" name="uid" value="'.$heroID.'">
<input type="hidden" name="id" value="'.$passiveAbility['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_hero_ability.php">
<input type="hidden" name="uid" value="'.$heroID.'">
<input type="hidden" name="id" value="'.$passiveAbility['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>
</div>';
}
$output = $output.'
</table>
<h3>擁有技能</h3>
<table class="table hero_table">
<thead>
<tr>
<th>名稱</th>
<th>對應按鍵</th>
<th>需求等級</th>
<th>種類</th>
</tr>
</thead>';
foreach($abilityList as $ability) {
$output = $output.'
<div>
<tr>
<td class="share">'.$ability['name'].'</td>
<td class="share">'.$ability['button'].'</td>
<td class="share">'.$ability['level'].'</td>
<td class="share">'.$ability['type'].'</td>
<td>
<form method="post" action="modify_hero_ability.php">
<input type="hidden" name="uid" value="'.$heroID.'">
<input type="hidden" name="id" value="'.$ability['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_hero_ability.php">
<input type="hidden" name="uid" value="'.$heroID.'">
<input type="hidden" name="id" value="'.$ability['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>
</div>';
}
$output = $output.
'</table>
<h3>擁有天賦</h3>
<table class="table hero_table">
<thead>
<tr>
<th>名稱</th>
<th>對應按鍵</th>
<th>需求等級</th>
<th>種類</th>
</tr>
</thead>';
foreach($telentList as $telent) {
$output = $output.'
<div>
<tr>
<td class="share">'.$telent['name'].'</td>
<td class="share">'.$telent['button'].'</td>
<td class="share">'.$telent['level'].'</td>
<td class="share">'.$telent['type'].'</td>
<td>
<form method="post" action="modify_hero_ability.php">
<input type="hidden" name="uid" value="'.$heroID.'">
<input type="hidden" name="id" value="'.$telent['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_hero_ability.php">
<input type="hidden" name="uid" value="'.$heroID.'">
<input type="hidden" name="id" value="'.$telent['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>
</div>';
}
$output = $output.
'</table>
</div>';
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/class/Frame.php
<?php
require_once 'class/User.php';
class Frame {
function get_main_frame($main_text) {
echo ' <html lang="zh-TW">';
$this->print_head_tag();
echo ' <body>';
$this->print_header();
$this->print_mainpage($main_text);
$this->print_javascript_config();
echo ' </body>
</html>';
}
function print_mainpage($main_text) {
echo ' <!-- main page -->
<div class="wrapper">
<div class="container">
<div class="main-page text-left">';
echo $main_text;
echo ' </div>
</div>
<!-- /.container -->
<!-- page tail -->
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright © 2014 OVE Entertainment All Rights Reserved</li>
<li>|</li>
<li><NAME></li>
</ul>
</div>
</div>';
}
function print_head_tag() {
echo ' <head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="MikeKao">
<title>OVE</title>
<link href="module/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/OVE.css" rel="stylesheet">
<link href="css/graph_setting.css" rel="stylesheet">
</head>';
}
function print_header() {
echo ' <!-- page head -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand header_title_font" href="/admin">OVE 管理介面</a>
</div>
<div class="collapse navbar-collapse header_content_font">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">活動<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="add_activity.php">新增 活動</a></li>
<li><a href="activity.php">修改/刪除 活動</a></li>
</ul>
</li>
<li><a href="announcement.php">公告</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">暴雪英霸<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="add_hero.php">新增 英雄</a></li>
<li><a href="hero.php">修改/刪除 英雄</a></li>
<li> </li>
<li><a href="add_ability.php">新增 技能/天賦</a></li>
<li><a href="skill.php">修改/刪除 技能</a></li>
<li><a href="telent.php">修改/刪除 天賦</a></li>
<li> </li>
<li><a href="hero_ability.php">設定 英雄技能/天賦</a></li>
<li> </li>
<li><a href="add_hero_graph.php">設定 英雄 圖片</a></li>
<li><a href="add_ability_graph.php">設定 技能/天賦 圖片</a></li>
<li><a href="list_graph.php">修改 圖片設定</a></li>
<li> </li>
<li><a href="graph_setting.php">設定已有圖片</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">';
if(isLogin()) {
echo ' <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="log_out.php">登出</a></li>
</ul>
</li>';
}
else {
echo ' <li><a href="sign_in.php">登入</a></li>';
}
echo ' </ul>
</div>
<!--/.nav-collapse -->
</div>
</div>';
}
function print_javascript_config() {
echo ' <!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="module/bootstrap/js/bootstrap.min.js"></script>
<script src="js/graph_setting.js"></script>';
}
}
/* should like this
<html lang="zh-TW">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="zh-tw">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="MikeKao">
<title>OAZ Virtual Entertainment - OVE</title>
<link href="module/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="module/OVE.css" rel="stylesheet">
</head>
<body>
<!-- page head -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand header_title_font" href="/OVE">傲飛虛擬娛樂公司</a>
</div>
<div class="collapse navbar-collapse header_content_font">
<ul class="nav navbar-nav">
<li><a href="2014_HKES.php">2014_HKES</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="contact_us.php">聯絡我們</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
if(isset($_COOKIE['user_name'])) {
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['real_name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="log_out.php">Log Out</a></li>
</ul>
</li>';
}
else {
echo '<li><a href="sign_in.php">登入</a></li>';
}
?>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- main page -->
<div class="wrapper">
<div class="container">
<div class="main-page text-left">
<?php
$announcement->getPost($post_id);
?>
</div>
</div>
<!-- /.container -->
<!-- page tail -->
<div class="footer small text-center">
<ul class="list-inline">
<li>©</li>
<li><NAME></li>
<li>傲飛虛擬娛樂公司</li>
</ul>
</div>
</div>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="module/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
*/
?><file_sep>/STGHAMMER.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="STGHAMMER"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Sgt. Hammer/300_300/STGHAMMER.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:Sgt.Hammer</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:770(每等+170)<br><br>生命回復:1.605(每等+0.305)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:44(每等+13)<br><br>攻擊速度:1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
外號“重錘”,曾在星區服役,經歷了許多艱辛困苦的戰役。她的嘉農砲發出的震天巨響,能使勇悍的敵人恐懼......有時候也包含一些友軍。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
能切換模式獲得額外的射程、濺射傷害,還能對遠方的敵人造成更大的傷害。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Sgt. Hammer/Abilities/Spider Mines.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Spider Mines(Q)) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">14秒</font>
<br class="fon2"><font color="fffff"><br>釋放三個持續35秒的地雷,踩到地雷會造成50+(等級*8)的傷害並在1.5秒內緩速25%。</font>
</span>
<br>
<img src="picture/Sgt. Hammer/Abilities/Concussive Blast.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Concussive Blast(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>對前方錐形範圍造成50+(等級*13)的傷害並擊退敵軍。</font>
</span>
<br>
<img src="picture/Sgt. Hammer/Abilities/Siege Mode.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Siege Mode(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">45mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">5秒</font>
<br class="fon2"><font color="fffff"><br>轉換成Siege模式,普通攻擊會有25%濺射傷害且範圍增加5,視野增加3並對小兵與建築提高30%傷害,此模式不能移動。</font>
</span>
<br>
<img src="picture/Sgt. Hammer/Abilities/Blunt Force Gun.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Blunt Force Gun(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">80秒</font>
<br class="fon2"><font color="fffff"><br>發出一個飛彈對路徑上的敵人造成220+(等級*29)的傷害並獲得飛彈的視野。</font>
</span>
<br>
<img src="picture/Sgt. Hammer/Abilities/Napalm Strike.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Napalm strile(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">35mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">6秒</font>
<br class="fon2"><font color="fffff"><br>對目標區域造成50+(等級*16)的傷害,並在目標區域額外造成30+(等級*4)的持續傷害持續4秒。</font>
</span>
<br>
<img src="picture/Sgt. Hammer/Abilities/Artiller.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Artillery(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>對距離4.5以外的敵人提高20%的傷害。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回复。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/1/Advanced Artillery.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Advanced Artillery(Trait)</span></font><br><font color="00ffff">Artillery的效果額外提升10%傷害。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/1/Lethal Blast.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lethal Blast(W)</span></font><br><font color="00ffff">提高Concussive Blast的傷害25%。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/1/Resistant.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resistant(E)</span></font><br><font color="00ffff">在Siege模式下,受到沉默、暈眩、緩速與纏繞的時間減少50%。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/1/Ambush.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ambush(E)</span></font><br><font color="00ffff">進入Siege時會進入隱形,下一發普通攻擊會增加額外100%的傷害。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack</span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回復自身生命。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/4/Maelstrom Shells.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Maelstrom Shells</span></font><br><font color="00ffff">普通攻擊範圍提高1單位。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/4/Excessive Force.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Excessive Force(W)</span></font><br><font color="00ffff">兩倍擊退的距離。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/7/Fortify Position.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fortify Position(E)</span></font><br><font color="00ffff">Siege模式下敵方無視敵方的位移效果且會獲的兩次格檔機會,每次吸收普通攻擊的50%。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/7/Hover Siege Mode.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hover Siege Mode(E)</span></font><br><font color="00ffff">BSiege模式下可以用50%的移動速度行動。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/7/Hyper-Cooling Engines.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hyper-Cooling Engines(Z)</span></font><br><font color="00ffff">減少Thrusters(Z)的冷卻時間10秒且在祭壇範圍內隨時可以啟動。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/7/First Aid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Aid</span></font><br><font color="00ffff">主動技,在6秒內回復35%最大生命值的生命。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/10/Blunt Force Gun.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blunt Force Gun(R) Mosh Pit</span></font><br><font color="00ffff">發出一個飛彈對路徑上的敵人造成220+(等級*29)的傷害並獲得飛彈的視野。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/10/Napalm Strike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Napalm strile(R)</span></font><br><font color="00ffff">對目標區域造成50+(等級*16)的傷害,並在目標區域額外造成30+(等級*4)的持續傷害持續4秒。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/13/Crucio X-2 Cannon.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Crucio X-2 Cannon)</span></font><br><font color="00ffff">增加2單位的普通攻擊範圍。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/13/First Strike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Strike(E)</span></font><br><font color="00ffff">在5秒內未受到傷害則普通攻擊增加25%的傷害。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/13/Barricade.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Barricade(W)</span></font><br><font color="00ffff">Concussive Blast使用後產生一個路障,持續4秒。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/13/Bullhead Mines.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bullhead Mines(Q)</span></font><br><font color="00ffff">地雷爆炸時會有些微的擊退效果。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner)</span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/16/Mine Field.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mine Field(Q)</span></font><br><font color="00ffff">額外增加2個地雷。 </font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/16/Slowing Mines.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Slowing Mines(Q)</span></font><br><font color="00ffff">增加地雷的緩速效果為50%,且持續時間增至2.5秒。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/16/Graduating Range.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Graduating Range(E)</span></font><br><font color="00ffff">Siege模式下,普通攻擊距離每3秒增加1單位,最高增至5單位。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Sgt. Hammer/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/20/Orbital BFG.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Orbital BFG(R)</span></font><br><font color="00ffff">Blunt Force Gun飛彈發射後,每5秒會依原軌道再次發射導彈,最後一次的飛彈才有導彈的效果。</font></span>
</div>
<div>
<img src="picture/Sgt. Hammer/Talents/20/Advanced Lava Strike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Advanced Lava Strike(R)</span></font><br><font color="00ffff">Napalm strile的射程增加75%並提高50%的傷害。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>傲飛娛樂</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body class="star_background">
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<div class="block"></div>
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="picture/herostorm.jpg" alt="Second slide">
</div>
<div class="item">
<img src="picture/herostorm.jpg" alt="Second slide">
</div>
<div class="item">
<img src="picture/herostorm.jpg" alt="Second slide">
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- /.carousel -->
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container contentboard">
<table class="table">
<tr>
<th>
<font color="fffff"><h2>重要公告</h2></font>
</th>
<th>
<font color="fffff"><h2>近期活動</h2></font>
</th>
</tr>
<tr>
<?php
require_once 'class/Post.php';
require_once 'class/activity.php';
$postlist = showTopPage();
$ACTlist = showActiveACT();
echo ' <td>';
foreach($postlist as $post) {
echo '
<div class="list-group">
<a href="announcement.php?id='.$post['id'].'" class="list-group-item ">
<h4 class="list-group-item-heading">'.$post['title'].'</h4>
<p class="list-group-item-text color_red">'.date("Y-m-d",strtotime($post['date'])).'</p>
<p class="list-group-item-text">'.mb_substr($post['content'], 0, 20, "UTF-8").'...</p>
</a>
</div>
';
}
echo ' </td>
<td>';
foreach($ACTlist as $ACT) {
echo '
<div class="list-group">
<a href="activity.php?id='.$ACT['id'].'" class="list-group-item ">
<h4 class="list-group-item-heading">'.$ACT['title'].'</h4>
<p class="list-group-item-text color_red">'.date("Y-m-d",strtotime($ACT['date'])).'</p>
<p class="list-group-item-text">'.mb_substr($ACT['content'], 0, 20, "UTF-8").'...</p>
</a>
</div>
';
}
echo ' </td>';
?>
</tr>
</table>
</div><!-- /.container -->
<div class="block"></div>
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/test.php
<?php
require_once 'class/Frame.php';
require_once 'class/HOS.php';
$list = getHeroPassiveAbility(2);
foreach ($list as $ability) {
echo $ability['name']."</br>";
}
?>
<file_sep>/admin/announcement.php
<?php
require_once 'class/Frame.php';
require_once 'class/Post.php';
require_once 'class/User.php';
require_once 'class/admin.php';
if(isLogin()) {
$title = $_POST['title'];
$description = $_POST['description'];
$content = $_POST['content'];
$top = $_POST['top'];
if(isset($title)) {
addPost($title, $description, $content, $top);
header("Location:/admin");
}
else {
$frame = new Frame();
$output = ' <h1>新增公告</h1>
<form method="post" action="">
<h3>主旨:</h3>
<input type="text" size="90%" name="title">
<br/><br/>
<input type="radio" name="top" value="1">置頂公告
<input type="radio" name="top" value="0" checked>一般公告
<h3>摘要:</h3>
<textarea rows="10" cols="90%" name="description"></textarea>
<h3>內容:</h3>
<textarea rows="10" cols="90%" name="content"></textarea>
<br/><br/>
<button class="btn btn-primary" type="submit">新增</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>';
$frame->get_main_frame($output);
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/STITCHES.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="STITCHES"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Stitches/300_300/STITCHES.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:STITCHES</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:1060(每等+260)<br><br>生命回復:2.207(每等+0.534)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:48(每等+6)<br><br>攻擊速度:1.1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
在通過暮色森林昏暗的小道時可得提高警覺:自從藏尸者把他製造的憎惡從夜色鎮放了出來,縫合怪便開始在路上漫無目的地遊蕩, 渴求著低等聯盟軍的血肉。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
活躍於前線的重型戰士,使用鉤子將敵人拖向自己,並在受到傷害時釋放毒霧。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Stitches/Abilities/Hook.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hook(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">14秒</font>
<br class="fon2"><font color="fffff"><br>將勾到的第一個敵人拉向自己,造成40+(等級*8)傷害。</font>
</span>
<br>
<img src="picture/Stitches/Abilities/Slam.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Slam(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>對錐形範圍內的敵人造成55+(等級*6)傷害。</font>
</span>
<br>
<img src="picture/Stitches/Abilities/Devour.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Devour(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">30秒</font>
<br class="fon2"><font color="fffff"><br>對小兵造成300+(等級*20)傷害或對英雄造成50+(等級*10)傷害,並回復最大生命值20%。</font>
</span>
<br>
<img src="picture/Stitches/Abilities/Vile Gas.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Vile Gas </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>受到傷害時,會釋放持續4秒的毒霧,對進入毒霧的敵人在3秒內造成56+(等級*8)傷害。</font>
</span>
<br>
<img src="picture/Stitches/Abilities/Putrid Bile.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Putrid Bile(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">秒</font>
<br class="fon2"><font color="fffff"><br>在身後留下膽汁,對經過的敵人每秒造成23+(等級*3)傷害,並將他們減速35%,持續8秒。</font>
</span>
<br>
<img src="picture/Stitches/Abilities/Gorge.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Gorge(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">80</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">80</font>
<br class="fon2"><font color="fffff"><br>吞噬一個敵方英雄3.5秒,造成200+(等級*50)傷害。在此期間,被吞噬的英雄無法行動,但也不會受到其他傷害。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回复。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/1/Heavy Slam.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Heavy Slam(W)</span></font><br><font color="00ffff">增加Slam(W)50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/1/Chew Your Food.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Chew Your Food(E)</span></font><br><font color="00ffff">Devour(E)額外在3秒內回復10%最大生命值。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/4/Amplified Healing.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Amplified Healing</span></font><br><font color="00ffff">提升30%治療與回復效果。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/4/Superiority.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Superiority</span></font><br><font color="00ffff">來自非英雄的傷害減少50%。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/4/Vile Cleaver.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vile Cleaver</span></font><br><font color="00ffff">基礎攻擊會在目標身上製造毒霧。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/4/Putrid Ground.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Putrid Ground(W)</span></font><br><font color="00ffff">被Slam(W)擊中的敵人會被毒氣感染。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Tenderizer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tenderizer</span></font><br><font color="00ffff">基礎攻擊會減少敵人移動速度25%,持續1.5秒。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Last Bite.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Last Bite(E)</span></font><br><font color="00ffff">若Devour(E)擊殺敵人,冷卻時間減少15秒。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Savor the Flavor.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Savor the Flavor(E)</span></font><br><font color="00ffff">對敵方英雄使用Devour(E),會獲得永久2點生命回復。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Toxic Gas.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Toxic Gas</span></font><br><font color="00ffff">毒霧範圍增加25%,持續時間增加2秒。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/10/Putrid Bile.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon"><NAME>(R) </span></font><br><font color="00ffff">在身後留下膽汁,對經過的敵人每秒造成23+(等級*3)傷害,並將他們減速35%,持續8秒。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/10/Gorge.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gorge(R)</span></font><br><font color="00ffff">吞噬一個敵方英雄3.5秒,造成200+(等級*50)傷害。在此期間,被吞噬的英雄無法行動,但也不會受到其他傷害。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Relentless</span></font><br><font color="00ffff">減少50%被沉默、擊暈、減速、定身的持續時間。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Tenderizer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mega Smash(W)/span></font><br><font color="00ffff">Slam(W)範圍增加25%。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Last Bite.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Indigestion(E)</span></font><br><font color="00ffff">使用Devour(E)會創造一隻Retchling。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Savor the Flavor.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Helping Hand(Q)</span></font><br><font color="00ffff">Hook(Q)可以拉回友方英雄。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/7/Toxic Gas.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sprint </span></font><br><font color="00ffff">主動技,增加75%移動速度,持續3秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/16/Imposing Presence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Presence</span></font><br><font color="00ffff">受到攻擊時,攻擊者降低30%攻擊速度。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/16/Fishing Hook.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fishing Hook(Q)</span></font><br><font color="00ffff">Hook(Q)距離增加50%。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/16/Shish Kabob.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shish Kabob(Q)</span></font><br><font color="00ffff">可以抓兩個目標。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents//16/Pulverize.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Pulverize(W))</span></font><br><font color="00ffff">Slam(W)傷害增加50%,並暈眩0.5秒。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Stitches/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。</font></span>
</div>
<div>
<img src="picture/Stitches/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/20/Regenerative Bile.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regenerative Bile(R)</span></font><br><font color="00ffff">Putrid Bile(R)持續時間增加2秒,造成傷害的50%轉為治療。 </font></span>
</div>
<div>
<img src="picture/Stitches/Talents/20/Hungry Hungry Stitches.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hungry Hungry Stiches(R)</span></font><br><font color="00ffff">在吐出第一個目標之前能在次使用Gorge(R),持續時間延長1秒。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/ajax/graph_setting.php
<?php
require_once $_SERVER['DOCUMENT_ROOT']."/admin/class/HOS.php";
$method = $_POST['method'];
if(strcmp($method, "LIST_HERO")==0) {
$allHero = getAllHero();
$array = array();
foreach($allHero as $hero) {
$array[$hero['id']] = $hero['name'];
}
echo json_encode($array);
}
else if(strcmp($method, "LIST_HERO_ABILITY")==0) {
$uid = $_POST['uid'];
$allAbility = getHeroAllAbility($uid);
$array = array();
foreach($allAbility as $ability) {
$array[$ability['id']] = $ability['name']."-".$ability['type'];
}
echo json_encode($array);
}
else if(strcmp($method, "LIST_GRAPH")==0) {
$list = dirToArray($_SERVER['DOCUMENT_ROOT']."/picture");
echo json_encode($list);
}
else if(strcmp($method, "UPDATE_ABILITY_GRAPH")==0) {
$result = getAbilityGraph($_POST['id']);
if($result == false) {
// add graph
$rc = addGraph($_POST['id'], $_POST['type'], $_POST['path'], "");
if($rc != false) echo "add successful!";
else "add false";
}
else {
// update graph
$rc = updateGraph($_POST['id'], $_POST['type'], $_POST['path'], "");
if($rc != false) echo "update successful";
else echo "update false";
}
}
else {
echo false;
}
function dirToArray($dir) {
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
{
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
{
$list = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
foreach($list as $value2) {
$result[] = $value2;
}
}
else
{
$result[] = $dir.DIRECTORY_SEPARATOR.$value;
}
}
}
return $result;
}
?><file_sep>/TYCHUS.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="TYCHUS"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Tychus/300_300/Tychus.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:Tychus</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:725(每等+140)<br><br>生命回復:1.512(每等+0.289)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:24(每等+6)<br><br>攻擊速度:1.5</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
是個有大抱負還拿著巨型機槍的壯漢。不過還好他的忠誠很容易獲得,只要給他買個幾杯威士忌並給他足夠的誠意,宇宙裡就沒有可以讓他恐懼的事了。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
能在短時間內爆發恐怖的破壞力,不過先需要一點點上膛的時間。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Tychus/Abilities/Overkill.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Overkill(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>在5秒內對目標造成300+(等級*60)的傷害並以椎形範圍對周圍敵人造成150+(等級*30)的傷害,可更換目標也可行走而不會失去鎖定。</font>
</span>
<br>
<img src="picture/Tychus/Abilities/Frag Grenade.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Frag Grenade(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>對目標區域造成60+(等級*25)的傷害並擊退敵軍。</font>
</span>
<br>
<img src="picture/Tychus/Abilities/Run and Gun.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Run and Gun(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">120秒</font>
<br class="fon2"><font color="fffff"><br>After a short delay, channel to stun nearby enemies for 4 seconds.</font>
</span>
<br>
<img src="picture/Tychus/Abilities/Commandeer Odin.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Commandeer Odin(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>呼叫Odin而獲得第二條生命並強化生命與傷害並擁有2個新技能,持續23秒。<br>Annihilate:對直線所有敵人造成造成70+(等級*13)的傷害 冷卻時間:7<br>Ragnarok Missiles:對周圍所有敵軍發射導彈造成各別70+(等級*13)的傷害。 冷卻時間:7</font>
</span>
<br>
<img src="picture/Tychus/Abilities/Drakken Laser Drill.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Drakken Laser Drill(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>呼叫Laser Drill攻擊附近敵軍造成每秒15+(等級*7)的傷害,可更換目標並持續22秒。</font>
</span>
<br>
<img src="picture/Tychus/Abilities/Minigun.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Minigun(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>在普通攻擊前需要先上膛,但上膛後卻有極快的攻擊速度。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回复。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/1/Armor Piercing Rounds.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Armor Piercing Rounds(Q)</span></font><br><font color="00ffff">Overkill對主要目標傷害提高20%。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/1/Dash.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dash(E)</span></font><br><font color="00ffff">Run and Gun衝刺距離提高25%。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack</span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回復自身生命。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/4/Melting Point (W).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Melting Point(W)</span></font><br><font color="00ffff">Frag Grenade對小兵與建築在10秒內造成額外120+(等級*50)的傷害。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/7/Rapid Fire.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rapid Fire(Trait)</span></font><br><font color="00ffff">開始攻擊3秒後提高50%的攻擊速度。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/7/Quarterback.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Quarterback(W)</span></font><br><font color="00ffff">增加Frag Grenade的拋投距離50%。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/7/First Aid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Aid</span></font><br><font color="00ffff">主動技,在6秒內回復35%最大生命值的生命。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/7/Searing Attacks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Attacks</span></font><br><font color="00ffff">主動技,基礎攻擊提升50%持續5秒。每次攻擊消耗15點法力值。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/10/Commandeer Odin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Commandeer Odin(R)</span></font><br><font color="00ffff">呼叫Odin而獲得第二條生命並強化生命與傷害並擁有2個新技能,持續23秒。<br>Annihilate:對直線所有敵人造成造成70+(等級*13)的傷害<br>Ragn<NAME>對周圍所有敵軍發射導彈造成各別70+(等級*13)的傷害。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/10/Drakken Laser Drill.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Drakken Laser Drill(R)</span></font><br><font color="00ffff">呼叫Laser Drill攻擊附近敵軍造成每秒15+(等級*7)的傷害,可更換目標並持續22秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/13/Relentless.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Relentless</span></font><br><font color="00ffff">減少50%被沉默、擊暈、減速、定身的持續時間。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/13/Lead Rain.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lead Rain(Q)</span></font><br><font color="00ffff">Overkill會跌加緩速效果,最高跌至40%。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/13/Stim Pack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stim Pack(E)</span></font><br><font color="00ffff">使用Run and Gun後,在3秒內會增加20%的攻擊速度與移動速度。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner</span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/16/Lock and Load.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lock and Load</span></font><br><font color="00ffff">上膛後會增加15%的移動速度。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/16/Concussion Grenade.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Concussion Grenade(W)</span></font><br><font color="00ffff">兩倍Frag Grenade的震退距離。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Tychus/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Tychus/Talents/20/Big Red Button.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Big Red Button(R)</span></font><br><font color="00ffff">Odin延長持續時間50%並獲得新能力。<br>Nuclear Blast:呼叫核彈,在短暫延遲後對目標區域造成200+(等級*25)的傷害。</font></span>
</div>
<div>
<img src="picture/Tychus/Talents/20/Focusing Diodes.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focusing Diodes(R)</span></font><br><font color="00ffff">增加Laser Drill的50%攻擊距離,對相同單位傷害會因時間越長而越高,最高造成額外100%傷害。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/class/Post.php
<?php
require_once 'class/DB.php';
function addPost($title, $description, $content, $top) {
$db = new DB();
$result = $db->insert("INSERT INTO post (title, description, content, top)
VALUES ('$title', '$description', '$content', '$top')");
return $result;
}
function removePost($id) {
$db = new DB();
$result = $db->delete("DELETE FROM post WHERE id='$id'");
return $result;
}
function updatePost($id, $title, $description, $content, $top) {
$db = new DB();
$result = $db->update("UPDATE post SET title='$title', description='$description', content='$content', top='$top'
WHERE id='$id'");
return $result;
}
function getPostPerPage() {
return 15;
}
function showPage($page) {
// fool-proof
if($page < 0) return null;
// page number must greater than 1
$postPerPage = getPostPerPage();
$minPost = ($page-1) * $postPerPage;
$db = new DB();
$result = $db->query(" SELECT *
FROM post
ORDER BY date DESC
LIMIT $minPost, $postPerPage");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function showTopPage() {
$postPerPage = getPostPerPage();
$db = new DB();
$result = $db->query(" SELECT *
FROM post
WHERE top>0
ORDER BY top DESC ,date DESC
LIMIT $postPerPage");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getTotalPageNumber() {
$postPerPage = getPostPerPage();
$db = new DB();
$result = $db->query(" SELECT *
FROM post");
$number = ceil($result/$postPerPage);
return $number==0? 1: $number;
}
function updateTop($id, $top) {
$db = new DB();
$result = $db->update("UPDATE post SET top='$top' WHERE id='$id'");
return $result;
}
function showPost($id) {
$db = new DB();
$result = $db->query(" SELECT * FROM post WHERE id='$id'");
return $db->fetch_array();
}
function hasPost($id) {
$db = new DB();
$result = $db->query("SELECT * FROM post WHERE id='$id'");
return $result;
}
?>
<file_sep>/class/SqlProtecter.php
<?php
function hasIllegalChar($input) {
//$input
//$input = sprint("%s", $input);
//$hasDot = strpos($input, ".");
//$hasSpace = strpos($input, " ");
$hasApostrophe = strpos($input, "'");
$hasSlash = strpos($input, "\\");
//$hasPercent = strpos($input, "%");
$hasPipe = strpos($input, "|");
$hasQuotation = strpos($input, "\"");
if( $hasApostrophe !== false ||
$hasSlash !== false ||
$hasPipe !== false ||
$hasQuotation !== false)
return true;
else
return false;
}
?>
<file_sep>/MURKY.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="MURKY"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Murky/300_300/MURKY.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:MURKY</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:250(每等+60)<br><br>生命回復:5(每等+0.125)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:xx(每等+xx)<br><br>魔力回復:xx(每等+xx)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:18(每等+6)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
Mrgglglbrlg rmrmgllg mrggggm. Mrrglglgy, mgllglgl mgggrrmgl? MRGGGLGLLM! Mrrggllgggllggll mrrglrlg mrrg mrrg mrrrg.
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
擅長騷擾對手並呼叫同伴與投擲河豚,而他的蛋能讓他在死亡後快速復活。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Murky/Abilities/Slime.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Slime(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">4秒</font>
<br class="fon2"><font color="fffff"><br>對附近敵人造成7+(等級*3)的傷害,且在6秒內造成額外42+(等級*18)的傷害;被擊中的目標會顯形並減少20%的移動速度。</font>
</span>
<br>
<img src="picture/Murky/Abilities/Pufferfish.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Puffer Fish(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">9秒</font>
<br class="fon2"><font color="fffff"><br>對目標區域投擲1隻河豚並在4秒後爆炸並對區域內敵人造成87+(等級*10)的傷害(對建築物造成4倍的傷害);敵人可以先殺死河豚阻止其爆炸。</font>
</span>
<br>
<img src="picture/Murky/Abilities/Safety Bubble.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Safety Bubble(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">14秒</font>
<br class="fon2"><font color="fffff"><br>在2秒內無敵但無法攻擊或使用技能。</font>
</span>
<br>
<img src="picture/Murky/Abilities/March of the Murlocs.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">March of the Murlocs(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>在區域內呼叫一群魚人大軍,魚人會直線前進並衝向第一個發現的敵方英雄或建築;每個魚人會在5秒內造成61+(等級*7)的傷害並緩速目標10%。</font>
</span>
<br>
<img src="picture/Murky/Abilities/Octo-Grab.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Octo-Grap(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">30秒</font>
<br class="fon2"><font color="fffff"><br>召喚1隻章魚並暈眩敵方目標英雄3秒,每秒造成1點傷害。</font>
</span>
<br>
<img src="picture/Murky/Abilities/Spawn Egg.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Spawn Egg(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">45秒</font>
<br class="fon2"><font color="fffff"><br>在目標區域放置1顆可顯示附近視野的蛋,當你死亡5秒後將會自蛋中復活。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/1/Demolitionist.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Demolitionist</span></font><br><font color="00ffff">基礎攻擊建築時減少一發彈藥並額外造成10%傷害。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/1/Bigger Slime.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bigger Slime(Q)</span></font><br><font color="00ffff">Slime的傷害範圍增加30%。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/1/Bubble Breeze.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bubble Breeze(E)</span></font><br><font color="00ffff">Satety Bubble獲得20%移動加速。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/1/Bribe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bribe</span></font><br><font color="00ffff">擊殺敵方小兵,可以獲得賄賂層數,疊加到20層時,可直接擊敗一個傭兵營地,但對骷髏無效。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/4/Minion Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Minion Killer</span></font><br><font color="00ffff">對小兵、僱傭兵與招喚物增加25%的傷害。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/4/Slimy End.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Slimy End(Q)</span></font><br><font color="00ffff">死亡時自動觸發Slime。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">給敵方英雄下毒,6秒內造成180+(等級*30)點傷害。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/4/Promote.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Promote</span></font><br><font color="00ffff">使用後增加小兵200%的血量與100%的傷害,能充能2次。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/7/Out With A Bang.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Out With A Bang(W)</span></font><br><font color="00ffff">死亡時留下1隻河豚。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/7/Wrath of Cod.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Wrath of Cod(W)</span></font><br><font color="00ffff">原本Puffer Fish對建築的傷害加乘將適用於其它敵軍。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/7/Assault Egg.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Assault Egg(Trait)</span></font><br><font color="00ffff">Spawn Egg冷卻時間減少20秒並增加200%生命值。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/7/Clairvoyance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Clairvoyance </span></font><br><font color="00ffff">施放後始目標區域的所有單位顯形,持續4秒。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/10/March of the Murlocs.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">March of the Murlocs(R)</span></font><br><font color="00ffff">在區域內呼叫一群魚人大軍,魚人會直線前進並衝向第一個發現的敵方英雄或建築;每個魚人會在5秒內造成61+(等級*7)的傷害並緩速目標10%。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/10/Octo-Grab.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Octo-Grap(R)</span></font><br><font color="00ffff">召喚1隻章魚並暈眩敵方目標英雄3秒,每秒造成1點傷害。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/13/Slime Advantage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Slime Advantage(Q)</span></font><br><font color="00ffff">你的普通攻擊會對受到Slime影響之目標產生額外50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/13/Tufferfish.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tuffer Fish(W)</span></font><br><font color="00ffff">河豚爆炸前會對敵人造成一次額外傷害。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/13/Bubble Machine.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bubble Machine(E)</span></font><br><font color="00ffff">Safety Bubble減少5秒冷卻時間。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/13/Hidden Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hidden Assault(Trait) </span></font><br><font color="00ffff">當你從蛋中復活時會維持隱形10秒,並增加蛋的視野150%。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/16/Master of Slime.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Master of Slmie(Q)</span></font><br><font color="00ffff">Slime持續時間增加2秒,效果持續期間再次受到Slime傷害將會額外造成21+(等級*9)的傷害。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/16/Pufferfish School.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Puffer Fish School(W)</span></font><br><font color="00ffff">Puffer Fish可充能2次。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/16/Compressed Air.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Compressed Air(W)</span></font><br><font color="00ffff">Puffer Fish傷害範圍增加50%。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/16/Beneath Contempt.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Beneath Contempt(E)</span></font><br><font color="00ffff">使用Satety Bubble後,建築與小兵將無法攻擊你,持續5秒。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/16/Blood for Blood.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blood for Blood</span></font><br><font color="00ffff">主動技,吸取目標敵人15%最大生命值,並使其移動速度降低30%,持續3秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Murky/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/20/Swift StormYour Hero is no longer dismounted from taking damage..png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Swift Storm</span></font><br><font color="00ffff">承受傷害時不會解除坐騎並增加60%的騎馬移動速度。 </font></span>
</div>
<div>
<img src="picture/Murky/Talents/20/Never-Ending Murlocs.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Never-ending Murlocs(R)</span></font><br><font color="00ffff">March of the Murlocs攻擊距離變長且黏住目標時間延長2秒。</font></span>
</div>
<div>
<img src="picture/Murky/Talents/20/And A Shark Tool.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">... And A Shark TOO!(R)</span></font><br><font color="00ffff">章魚的傷害增加10000%+(等級*1000)%。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/RAYNOR.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="RAYNOR"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Raynor/300_300/RAYNOR.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:Raynor</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:725(每等+120)<br><br>生命回復:1.512(每等+0.125)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:40(每等+12)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
前同盟軍的元帥,帝國反抗軍的領導人。曾在宇宙中最大的危機下生還,如今的他,也是充滿未知與冰冷的宇宙中,唯一仍能指引人們的希望之光。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
是個極其靈活的英雄,可以擊退敵人或是鼓舞友軍,同時也能在瀕死的情況下快速回復生命。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Raynor/Abilities/Penetrating Round.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Penetrating Round(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>指向技,對路徑上的敵人造成85+(等級*22)的傷害,並擊退他們。</font>
</span>
<br>
<img src="picture/Raynor/Abilities/Inspire.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Inspire(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>增加額外15%的攻擊速度及傷害,附近友軍得到50%的效果,持續8秒。</font>
</span>
<br>
<img src="picture/Raynor/Abilities/Adrenaline Rush.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Adrenaline Rush(E </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">45秒</font>
<br class="fon2"><font color="fffff"><br>當生命低於30%自動回復160+(等級*40)的生命。</font>
</span>
<br>
<img src="picture/Raynor/Abilities/Hyperion.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hyperion(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>呼叫Hyperion緩慢的向前移動,對路徑上隨機最多4個敵人造成25+(等級*6)的傷害,持續12秒。</font>
</span>
<br>
<img src="picture/Raynor/Abilities/Raynor's Raiders.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Raynor's Raiders(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>呼叫2台女妖轟炸機跟隨自己,每架女妖的傷害為9+(等級*3)。</font>
</span>
<br>
<img src="picture/Raynor/Abilities/Lead from the Front.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Lead from the Front </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>在短時間內受到Raynor傷害的敵人被殺死後使技能冷卻時間減少1秒。殺死敵方英雄使技能冷卻時間減少10秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/1/Path of the Assassin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Assassin</span></font><br><font color="00ffff">每提升一級,增加額外2點傷害。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/1/Demolitionist.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Demolitionist</span></font><br><font color="00ffff">基礎攻擊建築時減少一發彈藥並額外造成10%傷害。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/1/Give Me More!.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Give Me More!(E)</span></font><br><font color="00ffff">Adrenaline Rush(E)治癒量增加50%。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/1/Bribe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bribe</span></font><br><font color="00ffff">擊殺敵方小兵,可以獲得賄賂層數,疊加到20層時,可直接擊敗一個傭兵營地,但對骷髏無效。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/4/Advanced Optics.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Advanced Optics</span></font><br><font color="00ffff">基礎攻擊範圍增加20%,事也增加10%。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack</span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回復自身生命。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/4/Quick Fingers.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Quick Fingers</span></font><br><font color="00ffff">Lead from the Front效果2倍。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/7/Heavy Ammo.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Heavy Ammo(Q)</span></font><br><font color="00ffff">Penetrating Round(Q)增加擊退距離,對建築造成額外100%傷害。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/7/Revolution Overdrive.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Revolution Overdrive(W)</span></font><br><font color="00ffff">使用Inspire(W)時,增加10%移動速度,附近每多一個友方英雄得到Inspire(W)效果,額外增加5%移動速度。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/7/Fight or Flight.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fight or Flight(E)</span></font><br><font color="00ffff">Adrenaline Rush(E)可以移除所有移動負面效果,接下來2秒不會受到控場影響。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/7/Searing Attacks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Attacks</span></font><br><font color="00ffff">主動技,基礎攻擊提升50%持續5秒。每次攻擊消耗15點法力值。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/10/Hyperion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hyperion(R)</span></font><br><font color="00ffff">呼叫Hyperion緩慢的向前移動,對路徑上隨機最多4個敵人造成25+(等級*6)的傷害,持續12秒。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/10/Raynor's Raiders.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Raynor's Raiders(R)</span></font><br><font color="00ffff">呼叫2台隱形女妖轟炸機跟隨自己,每架女妖的傷害為9+(等級*3)。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield</span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/13/The Art of War.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">The Art of War(W)</span></font><br><font color="00ffff">使用Inspire(W)時,附近敵人的攻擊速度和移動速度減少10%。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/13/Activated Rush.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Activated Rush(E)</span></font><br><font color="00ffff">Adrenaline Rush(E)變為主動技不受血量限制,並減少15秒冷卻時間。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner</span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/16/Cluster Round.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Cluster Round(Q)</span></font><br><font color="00ffff">Penetrating Round(Q)每擊中一個敵人增加10%額外傷害,技能寬度增加50%。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/16/Bullseye.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bullseye(Q)</span></font><br><font color="00ffff">Penetrating Round(Q)第一個擊中的目標會被暈眩1秒,並承受50%額外傷害。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/16/Berserk.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Berserk </span></font><br><font color="00ffff">主動技,增加攻擊速度40%和移動速度10%,持續4秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Raynor/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
<div>
<img src="picture/Raynor/Talents/20/Battle Hyperion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Hyperion(R)</span></font><br><font color="00ffff">Hyperion(R)對每個攻擊目標造成兩次傷害,每4秒發射對敵方建築Yamato cannon。 </font></span>
</div>
<div>
<img src="picture/Raynor/Talents/20/Hel's Angels.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hel's Angels(R)</span></font><br><font color="00ffff">女妖轟炸機在攻擊時會保持隱形,每次攻擊時額外發射一枚飛彈。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/class/Frame.php
<?php
require_once 'class/User.php';
class Frame {
function get_main_frame($main_text) {
echo ' <html lang="zh-TW">';
$this->print_head_tag();
echo ' <body>';
$this->print_header();
$this->print_mainpage($main_text);
$this->print_javascript_config();
echo ' </body>
</html>';
}
function print_mainpage($main_text) {
echo ' <!-- main page -->
<div class="wrapper">
<div class="container">
<div class="main-page text-left">';
echo $main_text;
echo ' </div>
</div>
<!-- /.container -->
<!-- page tail -->
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright © 2014 OVE Entertainment All Rights Reserved</li>
<li>|</li>
<li><NAME></li>
</ul>
</div>
</div>';
}
function print_head_tag() {
echo ' <head>
<meta http-equiv="Content-Language" content="zh-tw" charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="MikeKao">
<title>OVE</title>
<link href="module/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/OVE.css" rel="stylesheet">
</head>';
}
function print_header() {
echo ' <!-- page head -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand header_title_font" href="/">OVE</a>
</div>
<div class="collapse navbar-collapse header_content_font">
<ul class="nav navbar-nav">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">';
if(isLogin()) {
echo ' <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="log_out.php">登出</a></li>
</ul>
</li>';
}
else {
echo ' <li><a href="sign_in.php">登入</a></li>
<li><a href="register.php">註冊</a></li>';
}
echo ' </ul>
</div>
<!--/.nav-collapse -->
</div>
</div>';
}
function print_javascript_config() {
echo ' <!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="module/bootstrap/js/bootstrap.min.js"></script>';
}
}
/* should like this
<html lang="zh-TW">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="zh-tw">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="MikeKao">
<title>OAZ Virtual Entertainment - OVE</title>
<link href="module/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="module/OVE.css" rel="stylesheet">
</head>
<body>
<!-- page head -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand header_title_font" href="/OVE">傲飛虛擬娛樂公司</a>
</div>
<div class="collapse navbar-collapse header_content_font">
<ul class="nav navbar-nav">
<li><a href="2014_HKES.php">2014_HKES</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="contact_us.php">聯絡我們</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
if(isset($_COOKIE['user_name'])) {
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['real_name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="log_out.php">Log Out</a></li>
</ul>
</li>';
}
else {
echo '<li><a href="sign_in.php">登入</a></li>';
}
?>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- main page -->
<div class="wrapper">
<div class="container">
<div class="main-page text-left">
<?php
$announcement->getPost($post_id);
?>
</div>
</div>
<!-- /.container -->
<!-- page tail -->
<div class="footer small text-center">
<ul class="list-inline">
<li>©</li>
<li><NAME></li>
<li>傲飛虛擬娛樂公司</li>
</ul>
</div>
</div>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="module/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
*/
?><file_sep>/GAZLOWE.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="GAZLOWE"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Gazlowe/300_300/Gazlowe.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:GAZLOWE</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:770(每等+170)<br><br>生命回復:1.605(每等+0.355)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:37(每等+9)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
很少會有人把地精工程師當成戰士,雖然個子小,但他們所建造的精密機械卻彌補了這個缺陷。當然,撇開他們糟糕的個性不談。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
善於使用砲台和高爆炸藥進行陣地戰,還能利用他的雷射蓄能造成大範圍的高傷害。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Gazlowe/Abilities/Gazlowe.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Rock-It!Turret(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">70mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>創造一個有30+(等級*6)傷害的砲台,可充能兩次持續30秒。</font>
</span>
<br>
<img src="picture/Gazlowe/Abilities/Deth Lazor.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Deth Lazor(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>可對直線造成60+(等級*14)到120+(等級*28)的傷害,蓄能時間越長則傷害、射程與範圍也越大。</font>
</span>
<br>
<img src="picture/Gazlowe/Abilities/Xplodium Charge.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Xplodium Charge(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>放置一個炸彈於目標位置,2.5秒後爆炸對附近造成65+(等級*20)的傷害並暈眩2秒。</font>
</span>
<br>
<img src="picture/Gazlowe/Abilities/Grav-O-Bomb 3000.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Grav-O-Bomb 3000(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">110秒</font>
<br class="fon2"><font color="fffff"><br>短暫延遲後,將附近敵軍拉往目標區域的中心並造成150+(等級*26)的傷害。</font>
</span>
<br>
<img src="picture/Gazlowe/Abilities/Robo-Goblin.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Robo-Goblin(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>變身成Robo-Goblin,普通攻擊對小兵、僱傭兵與建築造成額外250%的傷害,期間降低控場效果50%持續16秒。</font>
</span>
<br>
<img src="picture/Gazlowe/Abilities/Deth Lazor End.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Salvager(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100</font>
<br class="fon2"><font color="fffff"><br>被動效果:摧毀敵方建築或砲台解體都會掉落碎片,獲得碎片可以返還30魔力並在3秒內降低6秒全技能冷卻時間。<br>主動效果:拆解己方砲台並獲得碎片。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回复。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/1/Demolitionist.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Demolitionist</span></font><br><font color="00ffff">Y基礎攻擊建築時減少一發彈藥並額外造成10%傷害。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/1/Scrap-o-Matic Smelter.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Scrap-o-Matic Smelter(Trait)</span></font><br><font color="00ffff">增加Salvager獲得碎片的魔力返還效果至60。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/1/Break it Down!.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Break it Down!(Trait)</span></font><br><font color="00ffff">強化Salvager獲得碎片的冷卻效果至3秒內減少冷卻9秒。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/1/Extra TNT.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Extra TNT(E)</span></font><br><font color="00ffff">Grav-O-Bomb 3000爆炸時每多一個敵方單位則增加10%傷害,最高累積至100%。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/4/Superiority.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Superiority</span></font><br><font color="00ffff">Reduce damage taken from non-Heroic enemies by 50%. </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/4/Minion Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Minion Killer</span></font><br><font color="00ffff">After using any ability, pulse twice for 10 damage to nearby enemies. </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/4/Reduce, Reuse, Recycle.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reduce,Reuse,Recycle(Trait)</span></font><br><font color="00ffff">Enemy minions hit by Face Melt also dance for 5 seconds. </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/4/Clockwerk Steam Fists.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Clockwerk Steam Fists(Q)</span></font><br><font color="00ffff">Increases the range and knockback of Face Melt by 50%. </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/4/Promote.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Promote </span></font><br><font color="00ffff">使用後增加小兵200%的血量與100%的傷害,能充能2次。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/7/Rock-It! Turret XL.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rock-It!Turret XL(Q)</span></font><br><font color="00ffff">砲台能額外對2個目標造成50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/7/Mercenary LordMercenary camps your Hero captures gain the following bonuses.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mercenary Lord</span></font><br><font color="00ffff">佔領僱傭兵營地時能使雇傭兵得到額外的加乘。Siege Giants獲得額外50%傷害。Knights獲得額外50%生命。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/7/Engine Gunk.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Engine Gunk(Q)</span></font><br><font color="00ffff">砲台能夠緩速目標單位25%,持續2秒。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/7/First Aid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Aid</span></font><br><font color="00ffff">主動技,在6秒內回復35%最大生命值的生命。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/7/CalldownMULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/10/Grav-O-Bomb 3000.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Grav-O-Bomb 3000(R)</span></font><br><font color="00ffff">短暫延遲後,將附近敵軍拉往目標區域的中心並造成150+(等級*26)的傷害。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/10/Robo-Goblin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Robo-Goblin(R) </span></font><br><font color="00ffff">變身成Robo-Goblin,普通攻擊對小兵、僱傭兵與建築造成額外250%的傷害,期間降低控場效果50%持續16秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/13/Burning Rage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Burning Rage</span></font><br><font color="00ffff">砲台能額外對2個目標造成50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/13/Kwik Release Charge.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Kwik Release Charge(E)</span></font><br><font color="00ffff">Grav-O-Bomb 3000在短時間內能使用兩次。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/13/EZ-PZ Dimensional Ripper.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">EZ-PZ Dimensional Ripper(W)</span></font><br><font color="00ffff">Deth Lazor能在3秒內緩速英雄35%並凍結小兵與建築。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/13/Sprint.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sprint </span></font><br><font color="00ffff">主動技,增加75%移動速度,持續3秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/16/Long-Ranged Turrets.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Long-Range Turrets(Q)</span></font><br><font color="00ffff">砲台攻擊範圍增加25%。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/16/Turret Storage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Turret Storage(Q)</span></font><br><font color="00ffff">砲台能充能至4次。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/16/Hyperfocus Coils.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hyperfocus Coils(W)</span></font><br><font color="00ffff">Deth Lazor蓄能速度增加為2倍。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/16/Goblin Fusion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Goblin Fusion(W)</span></font><br><font color="00ffff">Deth Lazor蓄能達到最大時會額外獲得一次蓄能使傷害增加50%。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin </span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Gazlowe/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm)</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。 </font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/20/Swift StormYour Hero is no longer dismounted from taking damage..png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Swift Storm</span></font><br><font color="00ffff">承受傷害時不會解除坐騎並增加60%的騎馬移動速度。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/20/Miniature Black Hole.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Miniature Black Hole(R)</span></font><br><font color="00ffff">Grav-O-Bomb 3000作用範圍增加25%並提高50%的傷害。</font></span>
</div>
<div>
<img src="picture/Gazlowe/Talents/20/Mecha-Lord.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mecha-Lord(R)</span></font><br><font color="00ffff">Robo-Goblin對英雄造成額外130%的普通攻擊傷害,每次普通攻擊都能延長持續時間5秒。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/TYREAL.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="TYREAL"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Tyrael/300_300/TYREAL.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:TYREAL</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:1020(每等+220)<br><br>生命回復:2.125(每等+0.457)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:37(每等+7)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
天使中至高的人類保衛者,揮舞著聖劍艾德魯因的他堅毅的對抗著燃燒煉獄;若不是泰瑞爾的介入,避難所世界早在無數年前就成為惡魔之王們的囊中之物了。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
戰場上強大的輔助英雄,能在友軍身上附加護盾並增加他們的移動速度,死亡時會爆炸對附近的敵人造成嚴重的傷害。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Tyrael/Abilities/Angelic Flash.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">El'Druin's Might/Angelic Flash(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">55mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>El'Druin's Might:範圍傷害。對目標範圍內的敵人造成35+(等級*7)傷害,並造成25%的減速效果。<br>Angelic Flash:再次按下可以讓泰瑞爾傳送到El'Druin的位置,造成35+(等級*7)傷害,並造成25%的減速效果。</font>
</span>
<br>
<img src="picture/Tyrael/Abilities/Righteousness.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Rightrousness(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">65mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>自己和盟軍同時獲得護盾,自身護盾可以吸收200+(等級*25)點傷害,友方則可以吸收80+(等級*10)點傷害,持續4秒。</font>
</span>
<br>
<img src="picture/Tyrael/Abilities/Smite.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Smite(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">7秒</font>
<br class="fon2"><font color="fffff"><br>泰瑞爾指定目標區域造成50+(等級*10)傷害,穿過此區域的盟軍增加25%的移動速度,持續2秒。</font>
</span>
<br>
<img src="picture/Tyrael/Abilities/Judgment.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Judgement(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">80秒</font>
<br class="fon2"><font color="fffff"><br>撞向目標,造成125+(等級*10)傷害,並擊暈2秒。周圍的敵人會被擊飛並受到50(+等級*5)傷害。</font>
</span>
<br>
<img src="picture/Tyrael/Abilities/Sanctification.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Sanctification(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">50秒</font>
<br class="fon2"><font color="fffff"><br>使用後Tyrael身邊的友方英雄進入無敵狀態,持續3秒,對自身無效。</font>
</span>
<br>
<img src="picture/Tyrael/Abilities/Archangel's Wrath.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Arcangel's Wrath </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>泰瑞爾死亡後進入無敵狀態,其移動速度不會降低,經過3.5秒後爆炸,對附近的敵人造成200+(等級*40)點傷害。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒3點生命回复。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/1/Horadric Reforging.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Horadric reforging(Q)</span></font><br><font color="00ffff">提升25%El'Druin's Might的傷害。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/1/Purge Evil.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Purge Evil(E)</span></font><br><font color="00ffff">Smite(E)對英雄目標造成50%額外傷害。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/1/Protection in Death.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protection in Death</span></font><br><font color="00ffff">當Arcangel's Wrath爆炸之後,Tyrael給予周圍友方英雄護盾,吸收相當於各自最大生命值50%的傷害,持續5秒。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/4/Amplified Healing.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Amplified Healing</span></font><br><font color="00ffff">提升30%治療與回復效果。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/4/Angelic Absorption.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Angelic Absorption(W)</span></font><br><font color="00ffff">護盾存在時,在3秒內治癒30+(等級*6)點生命。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assaul</span></font><br><font color="00ffff">基礎攻擊15%的傷害回覆自身生命。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/4/Even In Death.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Even in Death</span></font><br><font color="00ffff">進入Arcangel's Wrath狀態時,可以使用R以外所有技能,但是不造成傷害。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/4/Retribution.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Retribution(E)</span></font><br><font color="00ffff">Smite(E)每擊中一個敵人減少技能冷卻時間0.5秒。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/7/Angel's Grace.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Angel's Grace(Q)</span></font><br><font color="00ffff">傳送至El'Druin之後,移動速度提高25%,持續3秒。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/7/Reciprocate.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reciprocate(W)</span></font><br><font color="00ffff">當護盾消失時,產生爆炸對周圍敵人造成90+(等級*12)點傷害。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/7/Zealotry.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Zealotry(W)</span></font><br><font color="00ffff">技能持續時間增加100%。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/7/Searing Attacks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Attacks</span></font><br><font color="00ffff">主動技,基礎攻擊提升50%持續5秒。每次攻擊消耗15點法力值。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/10/Judgment.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Judgement(R) </span></font><br><font color="00ffff">撞向目標,造成125+(等級*10)傷害,並擊暈2秒。周圍的敵人會被擊飛並受到50(+等級*5)傷害。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/10/Sanctification.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sanctification(R)</span></font><br><font color="00ffff">使用後Tyrael身邊的友方英雄進入無敵狀態,持續3秒,對自身無效。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/13/Burning Rage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Burning Rage</span></font><br><font color="00ffff">對周圍敵人每秒造成10+(等級*2)傷害。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/13/Imposing Will.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Will(W)</span></font><br><font color="00ffff">護盾存在時攻擊自己的敵方,其移動速度和攻擊速度都減少50%,持續2秒。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/13/Cast Aside.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Cast Aside(E)</span></font><br><font color="00ffff">受到傷害的目標會被推出目標區域。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/13/Angelic Might.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Angelic Might(E)</span></font><br><font color="00ffff">被Smite(E)擊中的目標將使泰瑞爾下一次基礎攻擊提高25%。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/16/Blade of Justice.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blade of Justice(Q)</span></font><br><font color="00ffff">在傳送之後的3次基礎攻擊造成額外100%傷害。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/16/Holy Ground.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Holy Ground(Q)</span></font><br><font color="00ffff">傳送到El'Druin旁邊之後創造一個區域阻擋敵人進入。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/16/Salvation.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Salvation(W)</span></font><br><font color="00ffff">自身和盟友的護盾效果提高25%。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/16/Blood for Blood.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blood for Blood </span></font><br><font color="00ffff">主動技,吸取目標敵人15%最大生命值,並使其移動速度降低30%,持續3秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Tyrael/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。 </font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/20/Angel of Justice.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Angel of Justice(R)</span></font><br><font color="00ffff">增加50%Judgement(R) 的施放範圍,減少技能冷卻30秒。</font></span>
</div>
<div>
<img src="picture/Tyrael/Talents/20/Holy Arena.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Holy Arena(R) </span></font><br><font color="00ffff">增加Sanctification(R)的持續時間1秒,並且增加被保護的盟友及其召喚單位額外25%傷害。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME>ung</li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/sign_in.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/admin.php';
require_once 'class/SqlProtecter.php';
ini_set("default_charset","utf-8");
$email = $_POST['email'];
$password = $_POST['password'];
if(isLogin()) {
//如果已經登入,就直接轉回首頁...
header("Location:/admin");
}
else if(isset($email)) {
//輸入完帳密,作判斷的地方...
if( hasIllegalChar($email) || hasIllegalChar($password)) {
header("Location:/admin/sign_in.php");
}
else {
$result = login($email, $password);
if($result == true) {
if(isAdmin($_COOKIE['aid'])) {
echo '
<script type="text/javascript">
alert("歡迎光臨, '.$_COOKIE['name'].'");
location.href="/admin"
</script>';
}
else {
logout();
header("Location:/admin");
}
}
else /*if($result == false)*/ {
$frame = new Frame();
$text = '
<h1>登入</h1>
<div class="text-warning lead"><br/>輸入的 帳號 或 密碼 不正確, 請再次確認<br/></div>
<div class="block-sign">
<form method="post" action="sign_in.php">
<h3>信箱帳號:</h3>
<input class="form-control" type="text" name="email" autofocus="autofocus" placeholder="Email" required value='."$email".'>
<h3>密碼:</h3>
<input class="form-control" type="<PASSWORD>" name="password" placeholder="<PASSWORD>" required>
<br/>
<ul class="list-inline">
<li><button class="btn btn-primary" type="submit">登入</button></li>
<li><a href="register.php" >註冊</a></li>
</ul>
</form>
</div>';
$frame->get_main_frame($text);
}
}
}
else {
//直接按登入所進入的地方...
$frame = new Frame();
$text = '
<h1>登入</h1>
<div class="text-warning lead" id="msg_area"></div>
<div class="block-sign">
<form method="post" action="sign_in.php">
<h3>信箱帳號:</h3>
<input class="form-control" type="text" name="email" autofocus="autofocus" placeholder="Email" required>
<h3>密碼:</h3>
<input class="form-control" type="<PASSWORD>" name="password" placeholder="<PASSWORD>" required>
<br/>
<ul class="list-inline">
<li><button class="btn btn-primary" type="submit">登入</button></li>
<li><a href="register.php" >註冊</a></li>
</ul>
</form>
</div>';
$frame->get_main_frame($text);
}
?>
<file_sep>/admin/class/HOS_DB.php
<?php
class HOS_DB {
private $connect_ = NULL;
private $queryResource_ = NULL;
private $host_;
private $user_;
private $passwd_;
private $database_;
function HOS_DB() {
$this->host_ = '127.0.0.1';
$this->user_ = 'ovecomtw_public';
$this->passwd_ = '<PASSWORD>';
$this->database_ = 'ovecomtw_HOS';
$this->connect();
}
private function connect()
{
$dbConnect = mysql_connect($this->host_, $this->user_, $this->passwd_);
if(!$dbConnect) die("MySQL connection failed.");
mysql_select_db($this->database_, $dbConnect) or die("MySQL select DB failed.");
mysql_query("SET NAMES utf8;", $dbConnect);
$this->connect_ = $dbConnect;
}
function query($sql)
{
$queryResource = mysql_query($sql, $this->connect_);
if(!$queryResource) die("MySQL Query Error");
$this->queryResource_ = $queryResource;
return mysql_num_rows($queryResource);
}
function insert($insert) {
$result = mysql_query($insert, $this->connect_);
if($result)
return true;
else
return false;
}
function delete($delete) {
$result = mysql_query($delete, $this->connect_);
if($result)
return true;
else
return false;
}
function update($update) {
$result = mysql_query($update, $this->connect_);
if($result)
return true;
else
return false;
}
function fetch_array()
{
return mysql_fetch_array($this->queryResource_, MYSQL_ASSOC);
}
}
?>
<file_sep>/ARTHAS.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="ARTHAS"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Arthas/300_300/ARTHAS.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:ARTHAS</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:1040(每等+240)<br><br>生命回復:2.168(每等+0.5)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:47(每等+9)<br><br>攻擊速度:1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
直接攻擊他的敵人,凍結並緩速他們。用霜之哀傷的力量增強自己的攻擊。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
阿爾薩斯曾是洛丹倫的王儲,光明使者烏瑟爾的得意門生,卻在尋找人民救贖之路的過程中,孤注一擲而被魔劍霜之哀傷腐化。如今他是巫妖王的死亡騎士,永遠受他可悲可怖的命運束縛。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Arthas/Abilities/Arthas.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Death Coil(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">55mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">9秒</font>
<br class="fon2"><font color="fffff"><br>向目標敵人扔出死亡纏繞,造成80+(等級*14)傷害。死亡纏繞可以向自己施放,治療82+(等級*22)生命值。</font>
</span>
<br>
<img src="picture/Arthas/Abilities/Howling Blast.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Howling Blast(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>使目標區域內敵人無法移動持續1.5秒,並造成30+(等級*6)傷害。</font>
</span>
<br>
<img src="picture/Arthas/Abilities/Frozen Tempest.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Frozen Tempest(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">10mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">X</font>
<br class="fon2"><font color="fffff"><br>每秒對附近的敵人造成20+(等級*3)傷害,減緩敵人移動速度6%,該效果最高疊加至30%。每秒消耗10點法力值,直至主動關閉或法力不足。</font>
</span>
<br>
<img src="picture/Arthas/Abilities/Army Of The Dead.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Army of the dead(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">90秒</font>
<br class="fon2"><font color="fffff"><br>召喚食屍鬼軍團,持續15秒。你可以通過獻祭食屍鬼恢復150(+等級*30)生命。</font>
</span>
<br>
<img src="picture/Arthas/Abilities/Summon Sindragosa.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Summon Sindragosa(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">90秒</font>
<br class="fon2"><font color="fffff"><br>英雄技能,造成150+(等級*15)傷害,並對英雄/小兵造成減速/凍結效果,持續10秒。對建築物也會造成凍結效果,持續20秒。</font>
</span>
<br>
<img src="picture/Arthas/Abilities/Frostmourne HungersTrait.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Frostmourne Hungers(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>使用之後下一個基礎攻擊獲得100%傷害提升並且恢復30點魔法值。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回復。</font></span>
</div>
<div>
<img src="picture/Arthas/Talents/1/Death Touch (Q).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Death Touch(Q)</span></font><br><font color="00ffff">Death Coil能立即殺死小兵。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/1/Frost Presence (W).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Frost Presence(W)</span></font><br><font color="00ffff">降低Howling Blast2秒的冷卻時間。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/1/Frost Presence (W).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Frozen Wastes(E)</span></font><br><font color="00ffff">Frozen Tempest的作用半徑增加33%。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/4/Superiority.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Superiority</span></font><br><font color="00ffff">來自非英雄的傷害減少50%。</font></span>
</div>
<div>
<img src="picture/Arthas/Talents/4/Eternal Hunger (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Eternal Hunger</span></font><br><font color="00ffff">增加Frostmourne Hungers效果帶來的魔法值,增加至60。</font></span>
</div>
<div>
<img src="picture/Arthas/Talents/4/Destruction (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Destruction</span></font><br><font color="00ffff">增加Frostmourne Hungers效果帶來的基礎攻擊加成,提升至150%。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">給敵方英雄下毒,6秒內造成180+(等級*30)點傷害。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/7/Rune Tap.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rune Top</span></font><br><font color="00ffff">每3次普通攻擊為恢復6%的生命值。</font></span>
</div>
<div>
<img src="picture/Arthas/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/7/Obliterate (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Obliterate</span></font><br><font color="00ffff">霜之哀傷會造成周圍敵軍50%的傷害。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/7/Frost Strike (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Frost Strike</span></font><br><font color="00ffff">霜之哀傷會減少目標40%移動速度,持續1.5秒。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/10/Army of the Dead (R).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Army of the dead(R)</span></font><br><font color="00ffff">召喚食屍鬼軍團,持續15秒。你可以通過獻祭食屍鬼恢復150(+等級*30)生命。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/10/Summon Sindragosa (R).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Summon Sindragosa(R)</span></font><br><font color="00ffff">英雄技能,造成150+(等級*15)傷害,並對英雄/小兵造成減速/凍結效果,持續10秒。對建築物也會造成凍結效果,持續20秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Relentless</span></font><br><font color="00ffff">減少50%被沉默、擊暈、減速、定身的持續時間。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/1/Frost Presence (W).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Trail of Frost(W) </span></font><br><font color="00ffff">Howling Blast(W)路徑上的敵人同樣被定身及受到傷害。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/13/Biting Cold (E).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bitching Cold(E) </span></font><br><font color="00ffff">增加50%冰風暴的傷害及消耗。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/16/Immortal Coil (Q).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Immortal Coil(Q) </span></font><br><font color="00ffff">Death Coil會治療,如果目標是自己,那麼原本的治療效果提升50%。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/16/Embrace Death (Q).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Embrace Death(Q)</span></font><br><font color="00ffff">每消耗10%的生命值,死亡纏繞就造成額外20%的傷害。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/16/Frostmourne Feeds (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Frostmourne Feeds</span></font><br><font color="00ffff">下兩次基礎攻擊附加霜之哀傷飢餓效果。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Arthas/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/20/Legion of Northrend (R).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Legion of Northend</span></font><br><font color="00ffff">食屍鬼軍團增加3個食屍鬼,持續時間增加50%。 </font></span>
</div>
<div>
<img src="picture/Arthas/Talents/20/Absolute Zero (R).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Absolute Zero</span></font><br><font color="00ffff">Sindragosa(R)飛行兩倍於原來的距離,敵軍英雄先被定身1.5秒,接著減少移動速度60%持續1.5秒 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/delete_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$abilityID = $_POST['id'];
$output = "";
$checked = $_POST['checked'];
if(isset($checked)) {
removeAbility($abilityID);
removeHeroAbilityByAbility($abilityID);
removeGraphByAbility($abilityID);
header("Location:/admin");
}
else if(isset($abilityID)) {
$output = '
<form method="post" action="">
<h3 class="text_red">確定要刪除技能/天賦:</h3>
<input type="hidden" name="checked" value="1">
<input type="hidden" name="id" value="'.$abilityID.'">
<button class="btn btn-primary" type="submit">確認</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>';
$frame->get_main_frame($output);
}
else {
echo "error: modify ability <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/class/admin.php
<?php
require_once 'class/DB.php';
function isAdmin($id) {
$db = new DB();
$result = $db->query("SELECT * FROM admin WHERE id='$id'");
return $result;
}
?>
<file_sep>/admin/add_ability_graph.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/HOS.php';
if(isLogin()) {
$id = $_POST['id'];
$type = $_POST['type'];
$file = $_FILES['file'];
$output = "";
if(isset($id) && $id!=0 && $file['error']==0) {
$path = "picture/".$file['name'];
move_uploaded_file($file['tmp_name'], $path);
addGraph($id, $type, $path, "");
header("Location:list_graph.php");
}
else {
$frame = new Frame();
$unused_list = getUnsetGraphAbility();
$output = $output.'
<h1>設定 技能/天賦 圖片</h1>
<div class="lead">
<form method="post" action="" enctype="multipart/form-data">
<div>
<h3>選擇招式:</h3>
<select name="id">
<option value=0>--請選擇--';
foreach ($unused_list as $unused_ability)
$output = $output.' <option value="'.$unused_ability['id'].'">'.$unused_ability['name'].' ('.$unused_ability['type'].')';
$output = $output.'
</select>
</div>
<div>
<h3>招式類型:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="type" value="技能">技能<br></div>
<div class="float"><input type="radio" name="type" value="特性">特性<br></div>
<div class="float"><input type="radio" name="type" value="天賦">天賦<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>上傳圖片:</h3>
<input name="file" type="file" />
</div>
</br>
<button class="btn btn-primary" type="submit">設定</button>
<a href="/admin/list_graph.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
}
else {
header("Location:/admin");
}
?><file_sep>/admin/graph_setting.php
<?php
require_once dirname(__FILE__).'/class/Frame.php';
require_once dirname(__FILE__).'/class/SqlProtecter.php';
require_once dirname(__FILE__).'/class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$output = '
<h1>連接 圖片 路徑</h1>
<div class="big_font">
<div class="graph_setting_form">
<form>
<div class="float"><input id="hero_graph" type="radio" name="select_type" value="hero"/>英雄</div>
<div class="float"><input id="ability_graph" type="radio" name="select_type" value="ability"/>天賦/技能</div>
<div class="spacer"/>
</form>
</div>
<div class="option_block"></div>
</div>';
$frame->get_main_frame($output);
}
?><file_sep>/admin/add_hero.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/HOS.php';
if(isLogin()) {
$name = $_POST['name'];
$come_from = $_POST['come_from'];
$major = $_POST['major'];
$story = $_POST['story'];
$suggest = $_POST['suggest'];
$health = $_POST['health'];
$health_per_level = $_POST['health_per_level'];
$health_regain = $_POST['health_regain'];
$health_regain_per_level = $_POST['health_regain_per_level'];
$mana = $_POST['mana'];
$mana_per_level = $_POST['mana_per_level'];
$mana_regain = $_POST['mana_regain'];
$mana_regain_per_level = $_POST['mana_regain_per_level'];
$attack = $_POST['attack'];
$attack_per_level = $_POST['attack_per_level'];
$attack_speed = $_POST['attack_speed'];
$attack_speed_per_level = $_POST['attack_speed_per_level'];
if(isset($name)) {
$data = new HeroData();
$data->name_ = $name;
$data->come_from_ = $come_from;
$data->major_ = $major;
$data->second_major_ = "";
$data->story_ = $story;
$data->suggest_ = $suggest;
$data->health_ = $health;
$data->health_regain_ = $health_regain;
$data->mana_ = $mana;
$data->mana_regain_ = $mana_regain;
$data->attack_ = $attack;
$data->attack_speed_ = $attack_speed;
$data->health_per_level_ = $health_per_level;
$data->health_regain_per_level_ = $health_regain_per_level;
$data->mana_per_level_ = $mana_per_level;
$data->mana_regain_per_level_ = $mana_regain_per_level;
$data->attack_per_level_ = $attack_per_level;
$data->attack_speed_per_level_ = $attack_speed_per_level;
addHero($data);
header("Location:hero.php");
}
else {
$frame = new Frame();
$output = ' <h1>新增英雄</h1>
<div class="lead">
<form method="post" action="">
<div>
<h3>英雄名稱:</h3>
<input type="text" name="name">
</div>
<div>
<h3>源自:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="come_from" value="魔獸">魔獸<br></div>
<div class="float"><input type="radio" name="come_from" value="暗黑">暗黑<br></div>
<div class="float"><input type="radio" name="come_from" value="星海">星海<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>角色:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="major" value="刺客">刺客<br></div>
<div class="float"><input type="radio" name="major" value="專家">專家<br></div>
<div class="float"><input type="radio" name="major" value="戰士">戰士<br></div>
<div class="float"><input type="radio" name="major" value="輔助">輔助<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>英雄介紹:</h3>
<textarea rows="10" cols="80%" name="story"></textarea>
</div>
<div>
<h3>英雄小知識:</h3>
<textarea rows="10" cols="80%" name="suggest"></textarea>
</div>
<div>
<table class="ability">
<tr>
<td></td>
<td><h3>等級一:</h3></td>
<td><h3>每級提昇:</h3></td>
</tr>
<tr>
<td><h3>生命:</h3></td>
<td><input type="text" name="health"></td>
<td><input type="text" name="health_per_level"></td>
</tr>
<tr>
<td><h3>生命恢復:</h3></td>
<td><input type="text" name="health_regain"></td>
<td><input type="text" name="health_regain_per_level"></td>
</tr>
<tr>
<td><h3>魔力:</h3></td>
<td><input type="text" name="mana"></td>
<td><input type="text" name="mana_per_level"></td>
</tr>
<tr>
<td><h3>魔力恢復:</h3></td>
<td><input type="text" name="mana_regain"></td>
<td><input type="text" name="mana_regain_per_level"></td>
</tr>
<tr>
<td><h3>攻擊力:</h3></td>
<td><input type="text" name="attack"></td>
<td><input type="text" name="attack_per_level"></td>
</tr>
<tr>
<td><h3>攻速:</h3></td>
<td><input type="text" name="attack_speed"></td>
<td><input type="text" name="attack_speed_per_level"></td>
</tr>
</table>
</div>
</br>
<button class="btn btn-primary" type="submit">新增</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
}
else {
header("Location:/admin");
}
?><file_sep>/MURADIN.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="MURADIN"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Muradin/300_300/MURADIN.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:MURADIN</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:1040(每等+260)<br><br>生命回復:2.168(每等+0.5)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:42(每等+8)<br><br>攻擊速度:0.9</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
曾是阿爾薩斯王子的良師益友,卻未能阻止他最終轉變為巫妖王。如今,在輕微的失憶恢復後,他接替其鑽石化兄長的王位,成為帶領銅須部族的領袖。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
在戰場上四處遊弋,時而敲暈敵方英雄,當接近死亡時能快速的回復生命。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Muradin/Abilities/Muradin.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Stormbolt(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">560ana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>對第一個擊中的敵人造成40+(等級*10)傷害,擊暈1.5秒。</font>
</span>
<br>
<img src="picture/Muradin/Abilities/Thunderclap.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Thunderclap(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>造成50+(等級*8)傷害,並減速敵人25%,持續2.5秒。</font>
</span>
<br>
<img src="picture/Muradin/Abilities/Avatar.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Avatar(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>獲得額外500+(等級*75)生命上限,同時基礎攻擊能擊暈敵人。持續20秒。</font>
</span>
<br>
<img src="picture/Muradin/Abilities/Dwarf Toss.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Dwarf Toss(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">65mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>跳躍至目標地點,對目標範圍內的敵人造成30+(等級*5)傷害。</font>
</span>
<br>
<img src="picture/Muradin/Abilities/Haymaker.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Haymaker(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">50秒</font>
<br class="fon2"><font color="fffff"><br>造成200+(等級*12)傷害,擊退目標,對於路徑上的敵人造成50+(等級*3)傷害並擊退。 </font>
</span>
<br>
<img src="picture/Muradin/Abilities/Second Wind.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Second Wind </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100</font>
<br class="fon2"><font color="fffff"><br>6秒內未受到傷害,每秒可以恢復11+(等級*2)點生命值。當生命值低於30%時,每秒生命恢復增加到30+(等級*8)。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Muradin/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/1/Perfect Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Perfect Storm(Q)</span></font><br><font color="00ffff">Stormbolt(Q)每次擊中敵人都永久提高5點該技能傷害。 </font></span>
</div>
<div>
<img src="picture/Muradin/Talents/1/Infused Hammer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Infused Hammer(Q)</span></font><br><font color="00ffff">Stormbolt(Q)每次擊中敵人獲得45點魔力回復。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/1/Reverberation.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reverberation(W)</span></font><br><font color="00ffff">Thunderclap(W)每次擊中敵人將使對方攻擊速度減少33%,持續2秒。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Muradin/Talents/4/ledgehammer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sledgehammer(Q)</span></font><br><font color="00ffff">Stormbolt(Q)對小兵和建築造成400%傷害,並摧毀4格彈藥。 </font></span>
</div>
<div>
<img src="picture/Muradin/Talents/4/Crowd Control.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Crowd Control(W)</span></font><br><font color="00ffff">每擊中一個敵人減少0.5秒冷卻時間。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/4/Thunderburn.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Thunderburn(W)</span></font><br><font color="00ffff">使用Thunderclap(W)會留下一個區域延遲1.5秒後爆炸,造成25+(等級*4)點傷害和25%的減速效果,持續2秒。 </font></span>
</div>
<div>
<img src="picture/Muradin/Talents/4/Third Wind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Third Wind</span></font><br><font color="00ffff">Second Wind在生命值低於40%時會被啟動。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/4/Skullcracker.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Skullcracker/span></font><br><font color="00ffff">對同一個目標的第4次基礎攻擊將造成0.25秒擊暈效果。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Muradin/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。 </font></span>
</div>
<div>
<img src="picture/Muradin/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒。 </font></span>
</div>
<div>
<img src="picture/Muradin/Talents/7/Piercing Bolt.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Piercing Bolt(Q)</span></font><br><font color="00ffff">風暴之鎚穿過目標,額外擊中一個目標。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/7/Landing Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Landing Momentum(E</span></font><br><font color="00ffff">落地後,增加移動速度20%,持續2秒。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/7/Searing Attacks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Attacks</span></font><br><font color="00ffff">主動技,基礎攻擊提升50%持續5秒。每次攻擊消耗15點法力值。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Muradin/Abilities/Avatar.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Avatar(R)</span></font><br><font color="00ffff">獲得額外500+(等級*75)生命上限,同時基礎攻擊能擊暈敵人。持續20秒。 </font></span>
</div>
<div>
<img src="picture//Muradin/Talents/10/Haymaker.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Haymaker(R)</span></font><br><font color="00ffff">造成200+(等級*12)傷害,擊退目標,對於路徑上的敵人造成50+(等級*3)傷害並擊退。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Muradin/Talents/13/Burning Rage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Burning Rage</span></font><br><font color="00ffff">對周圍敵人每秒造成10+(等級*2)傷害。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/13/Dwarf Launch.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dwarf Launch(E)</span></font><br><font color="00ffff">跳躍距離和傷害範圍增加50%。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/13/Healing Static.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Healing Static(W)</span></font><br><font color="00ffff">Thunderclap(W) 每擊中一個敵人,回復1%最大生命值。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/13/Thunderstrike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Thunderstrike(W)</span></font><br><font color="00ffff">Thunderclap(W) 擊中單一目標時,造成300%的傷害。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Muradin/Talents/16/Imposing Presence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Presence</span></font><br><font color="00ffff">受到攻擊時,攻擊者降低30%攻擊速度。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner </span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/16/Heavy Impact.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Heavy Impact(E)</span></font><br><font color="00ffff">被Dwarf Toss(E)擊中的敵人會被擊暈0.75秒。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/16/Stoneform.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneform </span></font><br><font color="00ffff">主動技,在8秒內治療最大生命值的40%,在此期間Second Wind不會被觸發。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Muradin/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/20/Unstoppable Force.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Unstoppable Force(R)</span></font><br><font color="00ffff">增加Avatar(R)的持續時間30%,在這段期間減少75%的群體控制效果。</font></span>
</div>
<div>
<img src="picture/Muradin/Talents/20/Grand Slam.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Grand Slam(R)</span></font><br><font color="00ffff">提升Haymaker(R) 25%傷害,最多充能2次。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/class/present.php
<?php
require_once 'class/DB.php';
function joinACT($user_id, $ACT_id) {
$db = new DB();
$result = $db->insert(" INSERT INTO present (user_id, ACT_id)
VALUES ('$user_id', '$ACT_id')");
return $result;
}
function leaveACT($user_id, $ACT_id) {
$db = new DB();
$result = $db->delete("DELETE FROM present WHERE user_id='$user_id' AND ACT_id='$ACT_id'");
return $result;
}
function showUserByACT($ACT_id) {
$db = new DB();
$result = $db->query("SELECT user_id FROM present WHERE ACT_id='$ACT_id' ORDER BY number ASC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re['user_id']);
return $list;
}
function showACTByUser($user_id) {
$db = new DB();
$result = $db->query("SELECT ACT_id FROM present WHERE user_id='$user_id'");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re['ACT_id']);
return $list;
}
function isJoinACT($user_id, $ACT_id) {
$db = new DB();
$result = $db->query("SELECT * FROM present WHERE ACT_id='$ACT_id' AND user_id='$user_id'");
return $result;
}
function removeUserByACT($id) {
$db = new DB();
$result = $db->delete("DELETE FROM present WHERE ACT_id='$id'");
return $result;
}
function removeACTByUser($id) {
$db = new DB();
$result = $db->delete("DELETE FROM present WHERE user_id='$id'");
return $result;
}
?>
<file_sep>/TYRANDE.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="TYRANDE"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Tyrande/300_300/TYRANDE.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:TYRANDE</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:635(每等+150)<br><br>生命回復:1.324(每等+0.313)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:30(每等+9)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
那些妄圖危害卡多雷的人都在對泰蘭德聞風而逃,作為哨兵部隊的指揮官和艾露恩的高階女祭司,她是最足智多謀的指揮官,更是強悍的戰士。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
泰蘭德能標記她的敵人,令該敵人受到更大的傷害。除了能治癒友軍外還能召喚貓頭鷹作為斥候,調查目標區域。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Tyrande/Abilities/Light of Elune.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Light of Elune(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">6秒</font>
<br class="fon2"><font color="fffff"><br>治癒自己45+(等級*10)的生命值,對友軍單位則治癒90+(等級*20)的生命值。</font>
</span>
<br>
<img src="picture/Tyrande/Abilities/Sentinel.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Sentinel(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">65mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">18秒</font>
<br class="fon2"><font color="fffff"><br>送出一隻貓頭鷹橫跨戰場並擁有其視野,擊中第一個碰觸到的敵方英雄並造成60+(等級*16)的傷害並顯形,持續5秒。</font>
</span>
<br>
<img src="picture/Tyrande/Abilities/Lunar Flare.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Lunar Flare(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>在短暫延遲後,對目標區域造成90+(等級*18)的傷害並暈眩1秒。</font>
</span>
<br>
<img src="picture/Tyrande/Abilities/Shadowstalk.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Shadowstalk(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">60秒</font>
<br class="fon2"><font color="fffff"><br>使自己與我方英雄進入潛行持續8秒,並增加移動速度30%於3秒內。</font>
</span>
<br>
<img src="picture/Tyrande/Abilities/Starfal.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Starfall(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>對目標區域造成敵方單位每秒20+(等級*6)的傷害並緩速20%,持續8秒。</font>
</span>
<br>
<img src="picture/Tyrande/Abilities/Hunter's Mark.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hunter's Mark(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">20秒</font>
<br class="fon2"><font color="fffff"><br>標記一個敵方單位,此單位會承受額外25%的傷害並顯形,持續4秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/1/Pierce.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Pierce(W)</span></font><br><font color="00ffff">Sentinel不再止於第一個敵方英雄,而會對整個直線上的所有敵方英雄生效。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/1/Healing Ward.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Healing Ward</span></font><br><font color="00ffff">放置一根治癒圖騰再地板上對附近友軍每秒造成2%最大生命回復持續10秒。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/4/Quickening Blessing.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Quickening Blessing(Q)</span></font><br><font color="00ffff">Light of Elune同時會提升目標25%的移動速度,持續3秒。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/4/Shroud.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shroud(Q)</span></font><br><font color="00ffff">Light of Elune同時會使目標隱形5秒。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/4/Protective Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protective Shield</span></font><br><font color="00ffff">為一個友方英雄放置一個300+(等級*30)的護盾持續5秒。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/4/Searing Arrows.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Arrows</span></font><br><font color="00ffff">啟動後增加普通攻擊40%的傷害於5秒內,每下攻擊需要消耗10的魔力。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/7/Trueshot Aura.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Trueshot Aura</span></font><br><font color="00ffff">被動增加自己與附近友軍10%的普通攻擊傷害與攻擊速度。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/7/Overflowing Light.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Overflowing Light(Q)</span></font><br><font color="00ffff">當自己血量高於90%,使用Light of Elune治療友軍會有額外40%的治療效果。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/7/CalldownMULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/10/Shadowstalk.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shadowstalk(R)</span></font><br><font color="00ffff">使自己與我方英雄進入潛行持續8秒,並增加移動速度30%於3秒內。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/10/Starfall.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Starfall(R)</span></font><br><font color="00ffff">對目標區域造成敵方單位每秒20+(等級*6)的傷害並緩速20%,持續8秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/13/Lunar Blaze.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lunar Blaze(E)</span></font><br><font color="00ffff">增加Lunar Flare的50%射程與33%技能範圍。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/13/Empower.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Empower(W)</span></font><br><font color="00ffff">使用Sentinel擊中敵人時,在2秒內會減少所有技能4秒的冷卻時間。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/13/Sprint.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sprint</span></font><br><font color="00ffff">主動技,增加75%移動速度,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/13/Shrink Ray.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shrink Ray</span></font><br><font color="00ffff">在四秒內使一個敵方英雄減少50%傷害和50%的移動速度。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/16/Shooting Star.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shooting Star(E)</span></font><br><font color="00ffff">Lunar Flarey造成額外50%的傷害,每擊中一個敵人則返還30魔力,最高返還60。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/16/Ranger.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ranger(W)</span></font><br><font color="00ffff">增加Sentinel的技能寬度,且飛行距離越遠造成越高的傷害,最高額外增加200%的傷害。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/16/BerserkActivate.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Berserk</span></font><br><font color="00ffff">使用後在4秒內增加攻擊速度40%並增加移動速度10%。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Tyrande/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/20/Storm Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm Shield</span></font><br><font color="00ffff">自身和周圍隊友產生最大生命值20%的護盾,持續時間3秒。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/20/Hunter's Prey.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hunter's Prey(R)</span></font><br><font color="00ffff">增加Shadowstalk的潛行時間8秒,移動加速時間3秒。 </font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/20/Celestial Wrath.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Celestial Wrath(R)</span></font><br><font color="00ffff">Starfall可以在有視野的條件下對全地圖使用並增加30%的傷害。</font></span>
</div>
<div>
<img src="picture/Tyrande/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/hero.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$heroID = $_GET['id'];
$output = "";
if(isset($heroID)) {
$hero = getHero($heroID);
$output = '
<div class="lead">
<div>
<h3>英雄名稱:</h3>'.$hero['name'].'
</div>
<div>
<h3>源自:</h3>'.$hero['come_from'].'
</div>
<div>
<h3>角色:</h3>'.$hero['major'].'
</div>
<div>
<h3>英雄介紹:</h3>
'.nl2br($hero['story']).'
</div>
<div>
<h3>英雄小知識:</h3>
'.nl2br($hero['suggest']).'
</div>
<div>
<table class="ability">
<tr>
<td></td>
<td><h3>等級一:</h3></td>
<td><h3>每級提昇:</h3></td>
</tr>
<tr>
<td><h3>生命:</h3></td>
<td>'.$hero['health'].'</td>
<td>'.$hero['health_per_level'].'</td>
</tr>
<tr>
<td><h3>生命恢復:</h3></td>
<td>'.$hero['health_regain'].'</td>
<td>'.$hero['health_regain_per_level'].'</td>
</tr>
<tr>
<td><h3>魔力:</h3></td>
<td>'.$hero['mana'].'</td>
<td>'.$hero['mana_per_level'].'</td>
</tr>
<tr>
<td><h3>魔力恢復:</h3></td>
<td>'.$hero['mana_regain'].'</td>
<td>'.$hero['mana_regain_per_level'].'</td>
</tr>
<tr>
<td><h3>攻擊力:</h3></td>
<td>'.$hero['attack'].'</td>
<td>'.$hero['attack_per_level'].'</td>
</tr>
<tr>
<td><h3>攻速:</h3></td>
<td>'.$hero['attack_speed'].'</td>
<td>'.$hero['attack_speed_per_level'].'</td>
</tr>
</table>
</div>
</div>';
}
else {
$list = getAllHero();
$output = '
<h1>所有英雄</h1>
<div class="lead">
<table class="table hero_table">';
foreach ($list as $hero) {
$output = $output.'
<tr>
<td class="title"><a href="hero.php?id='.$hero['id'].'">'.$hero['name'].'</a></td>
<td>
<form method="post" action="modify_hero.php">
<input type="hidden" name="id" value="'.$hero['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_hero.php">
<input type="hidden" name="id" value="'.$hero['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>';
}
$output = $output.'
</table>
</div>';
}
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/skill.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$skillID = $_GET['id'];
$output = "";
if(isset($skillID)) {
$skill = getAbility($skillID);
$output = '
<div class="lead">
<div>
<h3>種類:</h3>'.$skill['type'].'
</div>
<div>
<h3>招式名稱:</h3>'.$skill['name'].'
</div>
<div>
<h3>冷卻時間:</h3>'.$skill['cool_down'].'
</div>
<div>
<h3>招式消耗:</h3>'.$skill['cost'].'
</div>
<div>
<h3>招式消耗種類:</h3>'.$skill['cost_type'].'
</div>
<div>
<h3>持續時間:</h3>'.$skill['time'].'
</div>
<div>
<h3>招式射程:</h3>'.$skill['range'].'
</div>
<div>
<h3>招式說明:</h3>'.nl2br($skill['description']).'
</div>
</div>';
}
else {
$list = getAllAbility("技能");
$output = '
<h1>所有技能</h1>
<div class="lead">
<table class="table hero_table">';
foreach ($list as $skill) {
$output = $output.'
<tr>
<td class="title"><a href="skill.php?id='.$skill['id'].'">'.$skill['name'].'</a></td>
<td>
<form method="post" action="modify_ability.php">
<input type="hidden" name="id" value="'.$skill['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_ability.php">
<input type="hidden" name="id" value="'.$skill['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>';
}
$output = $output.'
</table>
</div>';
}
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/class/ACTPage.php
<?php
require_once 'class/DB.php';
function addACTPage($id, $pagename) {
$db = new DB();
$result = $db->insert("INSERT INTO ACTPage (id, pagename)
VALUES ('$id', '$pagename')");
return $result;
}
function removeACTPage($id) {
$db = new DB();
$result = $db->delete("DELETE FROM ACTPage WHERE id='$id'");
return $result;
}
function updateACTPage($id, $pagename) {
$db = new DB();
$result = $db->update("UPDATE ACTPage SET pagename='$pagename' WHERE id='$id'");
return $result;
}
function hasACTPage($id) {
$db = new DB();
$result = $db->query("SELECT * FROM ACTPage WHERE id='$id'");
return $result;
}
function getPageName($id) {
$db = new DB();
$result = $db->query("SELECT * FROM ACTPage WHERE id='$id'");
$re = $db->fetch_array();
if($result == true) {
return $re['pagename'];
}
else {
return "attend.php";
}
}
?>
<file_sep>/admin/modify_user.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
include_once 'class/SqlProtecter.php';
if(isLogin()) {
$frame = new Frame();
$output = "";
$id = $_COOKIE['aid'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$name = $_POST['name'];
$nickname = $_POST['nickname'];
$phone = $_POST['phone'];
$gender = $_POST['gender'];
$errormsg = "";
if( hasIllegalChar($password) ||
hasIllegalChar($password2) ||
hasIllegalChar($name) ||
hasIllegalChar($nickname) ||
hasIllegalChar($phonen) ||
hasIllegalChar($gender)) {
$errormsg = "輸入的帳號或密碼,不能含有特殊字元[ ' \" | \\]";
unset($password);
unset($name);
}
if($password!="" && $password2!="") {
if(comparePassword($password, $password2)) {
updateProfile($id, $name, $nickname, $phone, $gender);
updatePassword($id, $password);
header("Location:/admin");
}
else {
$errormsg = "兩次密碼不相同, 請再次確認";
unset($name);
}
}
if(isset($name)) {
updateProfile($id, $name, $nickname, $phone, $gender);
header("Location:/admin");
}
else if(isset($id)) {
$user = showUser($id);
$output = ' <h1>修改 帳號設定</h1>
<div class="text-warning lead errormsg">'.$errormsg.'</div>
<div class="lead block-sign">
<form method="post" action="">
<div>
<h3>新密碼:</h3>
<input class="form-control" type="<PASSWORD>" name="password" placeholder="<PASSWORD>">
<h3>請再輸入新密碼:</h3>
<input class="form-control" type="password" name="<PASSWORD>2" placeholder="<PASSWORD>">
</div>
<div>
<h3>本名:</h3>
<input class="form-control" type="text" name="name" placeholder="Name" value="'.$user['name'].'" required>
</div>
<div>
<h3>暱稱:</h3>
<input class="form-control" type="text" name="nickname" placeholder="<NAME>" value="'.$user['nickname'].'" required>
</div>
<div>
<h3>電話號碼: (Ex:0912111222)</h3>
<input class="form-control" type="text" name="phone" placeholder="Phone Number" value="'.$user['phone'].'" required>
</div>
<div>
<h3>性別:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="gender" value="男" '.getUserGenderCheck($user['gender'], "男").'>男<br></div>
<div class="float"><input type="radio" name="gender" value="女" '.getUserGenderCheck($user['gender'], "女").'>女<br></div>
<div class="spacer"></div>
</div>
</br>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
else {
echo "error: modify user <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/add_hero_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/HOS.php';
if(isLogin()) {
$uid = $_POST['uid'];
$id = $_POST['id'];
$unused_id = $_POST['unused_id'];
$type = $_POST['type'];
$button = $_POST['button'];
$level = $_POST['level'];
$output = "";
if((isset($id) && $id!=0) || (isset($unused_id) && $unused_id!=0)) {
$data = new HeroAbilityData();
$data->uid_ = $uid;
if($unused_id != 0) $data->id_ = $unused_id;
else $data->id_ = $id;
$data->type_ = $type;
$data->button_ = $button;
$data->level_ = $level;
addHeroAbility($data);
header("Location:list_hero_ability.php");
}
else {
$frame = new Frame();
$heroname = getHeroName($uid);
$skill_list = getAllAbility("技能");
$telent_list = getAllAbility("天賦");
$unused_list = getUnusedAbility();
$output = $output.'
<h1>新增 '.$heroname.' 技能/天賦</h1>
<div class="lead">
<form method="post" action="">
<input type="hidden" name="uid" value="'.$uid.'">
<div>
<h3>選擇招式:</h3>
未使用技能:
<select name="unused_id">
<option value=0>--請選擇--';
foreach ($unused_list as $unused_ability)
$output = $output.' <option value="'.$unused_ability['id'].'">'.$unused_ability['name'].' ('.$unused_ability['type'].')';
$output = $output.'
</select>
<br/><br/>
已使用技能:
<select name="id">
<option value=0>--請選擇--';
foreach ($skill_list as $skill)
$output = $output.' <option value="'.$skill['id'].'">'.$skill['name'].' ('.$skill['type'].')';
foreach ($telent_list as $telent)
$output = $output.' <option value="'.$telent['id'].'">'.$telent['name'].' ('.$telent['type'].')';
$output = $output.'
</select>
</div>
<div>
<h3>招式類型:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="type" value="技能">技能<br></div>
<div class="float"><input type="radio" name="type" value="特性">特性<br></div>
<div class="float"><input type="radio" name="type" value="天賦">天賦<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>招式按鍵:</h3>
<input type="text" name="button">
</div>
<div>
<h3>天賦等級:</h3>
<input type="text" name="level">
</div>
<br/>
<button class="btn btn-primary" type="submit">新增</button>
<a href="/admin/list_hero_ability.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
}
else {
header("Location:/admin");
}
?><file_sep>/admin/class/test.php
<?php
function testPrint()
{
echo hahahahahahah;
echo "<br/>"
echo hahahahahahah;
}
?><file_sep>/class/activity.php
<?php
require_once 'class/DB.php';
function addACT($title, $description, $content, $ACT_date) {
$db = new DB();
$result = $db->insert(" INSERT INTO activity (title, description, content, ACT_date)
VALUES ('$title', '$description', '$content', '$ACT_date')");
return $result;
}
function removeACT($id) {
$db = new DB();
$result = $db->delete("DELETE FROM activity WHERE id='$id'");
return $result;
}
function updateACT($id, $title, $description, $content, $ACT_date) {
$db = new DB();
$result = $db->update(" UPDATE activity SET title=''$title', description='$description', content='$content', ACT_date='$ACT_date'
WHERE id='$id'");
return $result;
}
function updateEXP($id, $exp) {
$db = new DB();
$result = $db->update("UPDATE activity SET exp='$exp' WHERE id='$id'");
return $result;
}
function checkAllEXP() {
$db = new DB();
$now = date('Y-m-d');
$result = $db->query("SELECT * FROM activity WHERE exp=0 AND ACT_date < '$now'");
while($re = $db->fetch_array()) updateEXP($re['id'], 1);
}
function showActiveACT() {
$db = new DB();
$result = $db->query(" SELECT *
FROM activity
WHERE exp=0
ORDER BY date DESC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function dateToString($year, $month, $day) {
return "$year-$month-$day";
}
function hasACT($id) {
$db = new DB();
$result = $db->query("SELECT * FROM activity WHERE id='$id'");
return $result;
}
function showACT($id) {
$db = new DB();
$result = $db->query("SELECT * FROM activity WHERE id='$id'");
return $db->fetch_array();
}
?>
<file_sep>/class/vip.php
<?php
require_once 'class/DB.php';
function requestVIP($id, $title, $description) {
$db = new DB();
$result = $db->insert(" INSERT INTO viprequest (id, title, description)
VALUES ('$id', '$title', '$description')");
return $result;
}
function showAllRequest() {
$db = new DB();
$result = $db->query("SELECT * FROM viprequest");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function acceptVIPRequest($id, $title) {
$resultVIPrequest = false;
$db = new DB();
$resultVIP = $db->insert(" INSERT INTO vip (id, title)
VALUES ('$id', '$title')");
if($resultVIP == true) $resultVIPrequest = $db->delete("DELETE FROM viprequest WHERE id='$id'");
return $resultVIPrequest;
}
function rejectVIPRequest($id) {
$db = new DB();
$result = $db->delete("DELETE FROM viprequest WHERE id='$id'");
return $result;
}
function removeVIP($id) {
$db = new DB();
$result = $db->delete("DELETE FROM vip WHERE id='$id'");
return $result;
}
function isRequest($id) {
$db = new DB();
$result = $db->query("SELECT * FROM viprequest WHERE id='$id'");
return $result;
}
function isVIP($id) {
$db = new DB();
$result = $db->query("SELECT * FROM vip WHERE id='$id'");
return $result;
}
?>
<file_sep>/register.php
<?php
include_once 'class/User.php';
include_once 'class/SqlProtecter.php';
ini_set("default_charset","utf-8");
$email = $_POST['email'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$name = $_POST['name'];
$nickname = $_POST['nickname'];
$phone = $_POST['phone'];
$gender = $_POST['gender'];
// show selected radio after assign
$radio_man = "checked";
$radio_woman = "";
if(isset($gender)) {
if($gender == "女") {
$radio_man = "";
$radio_woman = "checked";
}
}
$errormsg = "";
$showregister = true;
if(isset($email)) {
if( hasIllegalChar($email) ||
hasIllegalChar($password) ||
hasIllegalChar($password2) ||
hasIllegalChar($name) ||
hasIllegalChar($nickname) ||
hasIllegalChar($phonen) ||
hasIllegalChar($gender)) {
$errormsg = "輸入的帳號或密碼,不能含有特殊字元[ ' \" | \\]";
}
else if(hasEmail($email)){
$errormsg = "信箱已被註冊, 請換一個";
}
else if(comparePassword($password, $password2) == false) {
$errormsg = "兩次密碼不相同, 請再次確認";
}
else {
$showregister = false;
addUser($email, $password, $name, $nickname, $phone, $gender);
echo '
<script type="text/javascript">
alert("註冊成功, 請重新登入!");
location.href="/";
</script>
';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>傲飛娛樂</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body class="star_background">
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<div class="block"></div>
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<div class="register_block">
<?php
// next page button
if($showregister == true) {
echo '
<div class="title"><h1>註冊</h1></div>
<div class="text-warning lead errormsg">'.$errormsg.'</div>
<div class="sign_block">
<form method="post" action="register.php">
<h3>信箱帳號:</h3>
<input class="form-control" type="email" name="email" placeholder="Email" value="'.$email.'" required>
<h3>密碼:</h3>
<input class="form-control" type="password" name="password" placeholder="<PASSWORD>" value="'.$password.'" required>
<h3>請再輸入密碼:</h3>
<input class="form-control" type="password" name="password2" placeholder="<PASSWORD>" value="'.$password2.'" required>
<h3>本名:</h3>
<input class="form-control" type="text" name="name" placeholder="Name" value="'.$name.'" required>
<h3>暱稱:</h3>
<input class="form-control" type="text" name="nickname" placeholder="<NAME>" value="'.$nickname.'" required>
<h3>電話號碼: (Ex:0912111222)</h3>
<input class="form-control" type="text" name="phone" placeholder="Phone Number" value="'.$phone.'" required>
<h3>性別:</h3>
<div class="radio">
<label><input type="radio" name="gender" value="男" '.$radio_man.'>男</label>
</div>
<div class="radio">
<label><input type="radio" name="gender" value="女" '.$radio_woman.'>女</label>
</div>
<br/>
<button class="btn btn-primary" type="submit">註冊</button>
</form>
</div>
';
}
?>
</div>
</div><!-- /.container -->
<div class="block"></div>
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/TASSADAR.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="TASSADAR"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Tassadar/300_300/Tassadar.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:Tassadar</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:750(每等+125)<br><br>生命回復:1.813(每等+0.262)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:38(每等+6)<br><br>攻擊速度:1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
執行官的他,英勇不懈的對抗著蟲族。在學習了卡拉和虛空的力量後,他終於準備好面對蟲族主宰與蟲群。。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
能為友軍施放臨時的護盾或是偵測敵軍,還能運用各種能力為自己的團隊改變戰場情勢。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Tassadar/Abilities/Plasma Shield.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Plasma Shield(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>在友方單位上放置一個200+(等級*40)的護盾,持續8秒。</font>
</span>
<br>
<img src="picture/Tassadar/Abilities/Psionic Storm.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Psionic Storm(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">65mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>在目標範圍內造成每秒55+(等級*5)的傷害,持續3秒。</font>
</span>
<br>
<img src="picture/Tassadar/Abilities/Dimensional Shift.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Dimensional Shift(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">20秒</font>
<br class="fon2"><font color="fffff"><br>在1.5秒內無敵並無法被看見。</font>
</span>
<br>
<img src="picture/Tassadar/Abilities/Archon.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Archon(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">80mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>變身成Archon獲得200+(等級*40)的護盾,並擁有64+(等級*12)的一般攻擊傷害與32+(等級*6)的濺射傷害。</font>
</span>
<br>
<img src="picture/Tassadar/Abilities/Force Wal.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Force Wall(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>創造一面不可逾越的牆,持續2.5秒。</font>
</span>
<br>
<img src="picture/Tassadar/Abilities/Oracle.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Oracle(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">25mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">30秒</font>
<br class="fon2"><font color="fffff"><br>大大的增加視野並能偵測到英雄,持續7秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/1/Minion Bulwark.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Minion Bulwark(Q)</span></font><br><font color="00ffff">Plasma Shield對小兵與僱傭兵施放可以額外獲得50%的護盾值直到被打破。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/1/Overload.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Overload(W)</span></font><br><font color="00ffff">增加20%Psionic Storm所造成的傷害。</font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/1/Healing Ward.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Healing Ward</span></font><br><font color="00ffff">放置一根治癒圖騰再地板上對附近友軍每秒造成2%最大生命回復持續10秒。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/4/Leeching Plasma.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Leeching Plasma(Q)</span></font><br><font color="00ffff">擁有Plasma Shield時,會擁有20%的普通攻擊吸血效果。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/4/Reinforce Structure.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reinforce Structure(Q)</span></font><br><font color="00ffff">對建築施放Plasma Shield時可以獲得額外100%的護盾值與持續時間。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/4/Psi-Infusion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Psi-Infusion(W)</span></font><br><font color="00ffff">Psionic Storm施放時每作用到一個單位就會返還5魔力,已經返還過的單位再次接觸不會再有效果。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/4/Mental Acuity.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mental Acuity(Trait)</span></font><br><font color="00ffff">Oracle的冷卻減少10秒。</font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/4/Promote.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Promote </span></font><br><font color="00ffff">使用後增加小兵200%的血量與100%的傷害,能充能2次。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/7/Khala's Embrace.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Khala's Embrace(Q)</span></font><br><font color="00ffff">當Plasma Shield結束時50%的護盾值會被保留,此效果不能疊加。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/7/Static Charge.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Static Charge(W)</span></font><br><font color="00ffff">被Psionic Storm擊中後會留下標記,Tassadar的普通攻擊會消耗掉標記並造成額外50+(等級*5)的傷害。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/7/Deep Shift.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Deep Shift(E)</span></font><br><font color="00ffff">Dimensional Shift的持續時間增加0.75秒。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/7/CalldownMULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/10/Archon.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Archon(R)</span></font><br><font color="00ffff">變身成Archon獲得200+(等級*40)的護盾,並擁有64+(等級*12)的一般攻擊傷害與32+(等級*6)的濺射傷害。</font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/10/Force Wall.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Force Wall(R) </span></font><br><font color="00ffff">創造一面不可逾越的牆,持續2.5秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/13/Distortion Beam.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Distortion Beam</span></font><br><font color="00ffff">普通攻擊緩速敵人25%,持續1.5秒。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/13/Prescience.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Prescience(E)</span></font><br><font color="00ffff">當血量低於15%會自動使用Dimensional Shift,此效果須間隔60秒才會再次生效。</font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/13/Scryer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Scryer(Trait)</span></font><br><font color="00ffff">Oracle持續時間增加3秒同時增加移動速度15%。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/13/Shrink Ray.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shrink Ray</span></font><br><font color="00ffff">在四秒內使一個敵方英雄減少50%傷害和50%的移動速度。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/16/Evasive Shielding.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Evasive Shielding(Q)</span></font><br><font color="00ffff">擁有Plasma Shield的單位同時會增加25%的移動速度,持續4秒。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/16/Second Strike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Second Strike(W)</span></font><br><font color="00ffff">使用Psionic Storm後可以無消耗的在3秒內再次施放一次,傷害無法疊加。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/16/Resonation.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resonation(W)</span></font><br><font color="00ffff">Psionic Storm能緩速敵人25%,持續一秒。</font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/16/Dimensional Warp.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dimensional Warp(E)Healing Ward</span></font><br><font color="00ffff">Dimensional Shift啟動時獲得50%的移動速度加乘並治癒20+(等級*4)點生命。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Tassadar/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/20/Twilight Archon.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Twilight Archon(R)</span></font><br><font color="00ffff">Archon的護盾值增加50%,普通攻擊獲得額外50%的傷害並加長3的射程。</font></span>
</div>
<div>
<img src="picture/Tassadar/Talents/20/Force Barrier.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Force Barrier(R)</span></font><br><font color="00ffff">Force Wall的施放距離提高50%並延長1秒。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/FALSTAD.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="FALSTAD"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Falstad/300_300/FALTASD.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:FALSTAD</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:710(每等+120)<br><br>生命回復:1.48(每等+0.25)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:34(每等+9)<br><br>攻擊速度:0.7</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
弗斯塔德·蠻錘是蠻錘氏族的族長,同時也是鐵爐堡中三錘議會的成員。弗斯塔德從沒死過,聲稱其死亡的人都是在說謊!
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
弗斯塔德能從極遠距離攻擊他的敵人,並且能飛越地形。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Falstad/Abilities/Hammerang.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hammerang(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">70mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>對路徑上的敵人造成50+(等級*12)傷害,投擲後槌子會返回手中。</font>
</span>
<br>
<img src="picture/Falstad/Abilities/Thunderstorm.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Thunderstorm(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>被動效果:每8秒隨機對附近敵人造成40+(等級*10)的傷害。<BR>主動效果:對附近最多4個敵人造成540+(等級*10)傷害,攻擊同一敵人多次時每次攻擊傷害降低25%。</font>
</span>
<br>
<img src="picture/Falstad/Abilities/Barrel Roll.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Barrel Roll(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">16秒</font>
<br class="fon2"><font color="fffff"><br>衝向目標區域,產生75+(等級*15)點的護盾,持續2秒。</font>
</span>
<br>
<img src="picture/Falstad/Abilities/Aerial Blitzkrieg.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Aerial Blitzkrieg(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>延遲1.5秒後,對附近地人造成150+(等級*27)的傷害,並暈眩1.5秒。 </font>
</span>
<br>
<img src="picture/Falstad/Abilities/Shock and Awe.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Shockand Awe(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>短暫延遲後,對路徑上的敵人造成280+(等級*31)的傷害。</font>
</span>
<br>
<img src="picture/Falstad/Abilities/Tailwind.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Tailwind </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100</font>
<br class="fon2"><font color="fffff"><br>6秒內未受到傷害,增加20%的移動速度。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/1/Path of the Assassin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Assassin</span></font><br><font color="00ffff">每提升一級,增加額外2點傷害。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/1/Range.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Range(E)</span></font><br><font color="00ffff">Barrel Roll(E)飛行距離增加20%。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/1/Dog Fight.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dog Fight(E)</span></font><br><font color="00ffff">Barrel Roll(E)護盾時間增加3秒。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/1/Bribe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bribe</span></font><br><font color="00ffff">擊殺敵方小兵,可以獲得賄賂層數,疊加到20層時,可直接擊敗一個傭兵營地,但對骷髏無效。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回復自身生命。</font></span>
</div>
<div>
<img src="picture/Falstad/Talents/4/Stormhammer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stormhammer</span></font><br><font color="00ffff">基礎攻擊對附近一個目標造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/4/Wildhammer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Wildhammer(Q)</span></font><br><font color="00ffff">Hammerang(Q)對第一個敵人造成150%的傷害。</font></span>
</div>
<div>
<img src="picture/Falstad/Talents/4/Zap!.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Zap!(W)</span></font><br><font color="00ffff">Thunderstorm(W)的被動效果減少2秒冷卻時間。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/7/Fly Away!.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fly Away!(Z)</span></font><br><font color="00ffff">飛行的冷卻時間減少15秒。</font></span>
</div>
<div>
<img src="picture/Falstad/Talents/7/BOOMerang.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">BOOMerang(Q)</span></font><br><font color="00ffff">Hammerang(Q)可再次使用技能,在槌子周圍造成25+(等級*12)傷害。</font></span>
</div>
<div>
<img src="picture/Falstad/Talents/7/First Aid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Aid</span></font><br><font color="00ffff">主動技,在6秒內回復35%最大生命值的生命。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/10/Aerial Blitzkrieg.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Aerial Blitzkrieg(R)</span></font><br><font color="00ffff">延遲1.5秒後,對附近地人造成150+(等級*27)的傷害,並暈眩1.5秒。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/10/Shock and Awe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shockand Awe(R)</span></font><br><font color="00ffff">短暫延遲後,對路徑上的敵人造成280+(等級*31)的傷害。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/13/Crippling Hammer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Crippling Hammer(Q)</span></font><br><font color="00ffff">Hammerang(Q)緩速效果增加至50%。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/13/Overdrive.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Overdrive </span></font><br><font color="00ffff">主動技,增加技能25%傷害,但是耗魔增加40%,持續5秒。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/13/Lightning Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lightning Storm(W)</span></font><br><font color="00ffff">Thunderstorm(W)被動效果可以攻擊兩個敵人。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/16/Gust of Wind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Gust of Wind</span></font><br><font color="00ffff">被動能力Tailwind降低為3秒內未受到傷害,增加20%的移動速度。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/16/Afterburner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Afterburner(E)</span></font><br><font color="00ffff">使用Barrel Roll(E)後,增加75%移動速度,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Falstad/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/20/Preparation.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Preparation(R)</span></font><br><font color="00ffff">Aerial Blitzkrieg(R)的延遲時間減少50%,產生一個50%最大生命值的護盾。 </font></span>
</div>
<div>
<img src="picture/Falstad/Talents/20/Blast of Awe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blast of Awe(R</span></font><br><font color="00ffff">Shockand Awe(R)距離變為2倍並增加25%傷害。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/hero.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="ETC"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/ETC/300_300/ETC.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:E.T.C.</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:1040(每等+240)<br><br>生命回復:2.168(每等+0.5)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:47(每等+9)<br><br>攻擊速度:1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
艾澤拉斯精英的牛頭人酋長,在盡情搖擺中所展現的狂野樂章和吉他亂舞,彰顯著部落的力量。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
一位在前線戰場橫衝直撞且無所畏懼的英雄,不僅能擊暈他的敵人還能為友軍帶來增益。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/ETC/Abilities/Powerslide.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">powerslide </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>滑向目標位置,對路徑上的敵人造成60+(等級*7)點傷害並擊暈他們1秒。</font>
</span>
<br>
<img src="picture/ETC/Abilities/Guitar Solo.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Guitar Solo </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>每秒生命回復25+(等級*6),持續4秒。</font>
</span>
<br>
<img src="picture/ETC/Abilities/Mosh Pit.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Mosh Pit </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">120秒</font>
<br class="fon2"><font color="fffff"><br>短暫延遲之後,在技能範圍內,暈眩敵人4秒,並強迫他們跳舞。 </font>
</span>
<br>
<img src="picture/ETC/Abilities/Face Melt.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Face Melt </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>對附近的敵人造成50+(等級*5)傷害,擊退他們並造成短暫暈眩。 </font>
</span>
<br>
<img src="picture/ETC/Abilities/Rockstar.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Rockstar </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>當施放一個技能時,附近友方英雄將獲得20%攻速加成,己方小兵獲得一半效果,持續3秒。</font>
</span>
<br>
<img src="picture/ETC/Abilities/Stage Dive.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Stage_Dive </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100</font>
<br class="fon2"><font color="fffff"><br>全球流,跳向目標區域,對其中的敵人造成100+(等級*12)傷害並緩速他們3秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/1/Damage Slide.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Damage Sude</span></font><br><font color="00ffff">提升30%Powerslide(Q)傷害。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量。 </font></span>
</div>
<div>
<img src="picture/ETC/Talents/1/Groupies.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Groupies</span></font><br><font color="00ffff">Guitar Solo(E)回復附近友方12+(等級*3)點。 </font></span>
</div>
<div>
<img src="picture/ETC/Talents/1/Pwn Shop Guitar.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Pwn Shop Guitar (E)</span></font><br><font color="00ffff">Guitar Solo(E)耗魔減少50%。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/4/Superiority.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Superiority</span></font><br><font color="00ffff">來自非英雄的傷害減少50%。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/4/Echo Pedal.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Echo Pedal</span></font><br><font color="00ffff">每次施放技能後都會發出兩次聲波,造成附近敵方10+(等級*3)點傷害。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/4/Dance Your Pants Off!.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dance Your Pants Off</span></font><br><font color="00ffff">敵方小兵受到Face Melt(W) 攻擊暈眩並跳舞,持續5秒。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/4/Loud Speakers.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Loud Speakers</span></font><br><font color="00ffff">Face Melt(W)的攻擊範圍與擊退距離提升50%。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。 </font></span>
</div>
<div>
<img src="picture/ETC/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒</font></span>
</div>
<div>
<img src="picture/ETC/Talents/7/Monster Slide.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Monster Slide</span></font><br><font color="00ffff">增加Powerslide(Q)的寬度50% </font></span>
</div>
<div>
<img src="picture/ETC/Talents/7/Guitar Hero.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Guitar Hero</span></font><br><font color="00ffff">在Guitar Solo(E)施放後瞬間產生下一次雙倍傷害的普通攻擊,並回復50%所造成傷害。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/10/Mosh Pit.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mosh Pit</span></font><br><font color="00ffff">短暫延遲之後,在既能範圍內,暈眩敵人4秒,並強迫他們跳舞。 </font></span>
</div>
<div>
<img src="picture/ETC/Talents/10/Stage Dive.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stage Dive</span></font><br><font color="00ffff">全球流,跳向目標區域,對其中的敵人造成100+(等級*12)傷害並緩速他們3秒。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/13/Relentless.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Relentless</span></font><br><font color="00ffff">減少50%被沉默、擊暈、減速、定身的持續時間。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/13/Uber Rockstar.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Uber Rockstar</span></font><br><font color="00ffff">Rockstar靈氣同時增加25%移動速度。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/13/Face Smelt.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Face Smelt(W)</span></font><br><font color="00ffff">被Face Melt擊中的敵人減少移動速度80%,持續2秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/16/Imposing Presence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Presence</span></font><br><font color="00ffff">受到攻擊時,攻擊者降低30%攻擊速度。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/16/Head Crack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Head Crack(Q)</span></font><br><font color="00ffff">增加50%Powerslide(Q)的眩暈時間。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/16/Guitar Instrumental.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Guitar Instrumental(E)</span></font><br><font color="00ffff">Guitar Solo(E)的持續時間增加100%。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin </span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/ETC/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm</span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/20/Death Metal.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Death Metal(R)</span></font><br><font color="00ffff">使跳舞的敵人受到額外25%傷害。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/20/Rock God!.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rock God!(R) </span></font><br><font color="00ffff">減少Stage Dive(R)50%施法與延遲時間,並且提高50%傷害。</font></span>
</div>
<div>
<img src="picture/ETC/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/modify_graph.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$output = "";
$id = $_POST['id'];
$type = $_POST['type'];
$description = $_POST['description'];
$file = $_FILES['file'];
if(isset($file) && $file['error']==0) {
$path = "picture/".$file['name'];
move_uploaded_file($file['tmp_name'], $path);
updateGraph($id, $type, $path, $description);
header("Location:/admin/list_graph.php");
}
else if(isset($type) && $type=='英雄') {
$hero = getHeroGraph($id);
$output = '
<h1>修改 '.$hero['name'].' 圖片</h1>
<div class="lead">
<form method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="id" value="'.$id.'">
<input type="hidden" name="type" value="'.$type.'">
<div>
<h3>類型:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="description" value="英雄頭像" '.getHeroGraphDescriptionCheck($description, "英雄頭像").'>英雄頭像<br></div>
<div class="float"><input type="radio" name="description" value="英雄全身" '.getHeroGraphDescriptionCheck($description, "英雄全身").'>英雄全身<br></div>
<div class="float"><input type="radio" name="description" value="英雄背景" '.getHeroGraphDescriptionCheck($description, "英雄背景").'>英雄背景<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>上傳圖片:</h3>
<input name="file" type="file" />
</div>
</br>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin/list_graph.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
else if(isset($type) && $type!='英雄') {
$ability = getAbilityGraph($id);
$output = '
<h1>修改 '.$ability['name'].' 圖片</h1>
<div class="lead">
<form method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="id" value="'.$id.'">
<input type="hidden" name="description" value="'.$description.'">
<div>
<h3>招式類型:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="type" value="技能" '.getAbilityGraphTypeCheck($type, "技能").'>技能<br></div>
<div class="float"><input type="radio" name="type" value="特性" '.getAbilityGraphTypeCheck($type, "特性").'>特性<br></div>
<div class="float"><input type="radio" name="type" value="天賦" '.getAbilityGraphTypeCheck($type, "天賦").'>天賦<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>上傳圖片:</h3>
<input name="file" type="file" />
</div>
</br>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin/list_graph.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
else {
echo "error: modify graph <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/ZAGARA.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="ZAGARA"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Zagara/300_300/ZAGARA.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:ZAGARA</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:750(每等+150)<br><br>生命回復:1.512(每等+0.313)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:37(每等+9)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
她是蟲巢的母親,狡詐而兇殘的指揮著殘暴的部隊四處征戰,如果你碰上了她的蟲巢部隊你最好小心了,傷害了孩子,他可不會放過你的!
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
污染區域並招換蟲族士兵攻擊敵人,會派出刺蛇援助友軍且要小心它無所不在的能力。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Zagara/Abilities/Baneling Barrage.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Baneling Barrage(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>於直線上發射4隻爆蟲,每隻爆蟲碰撞敵人會產生小範圍爆炸造成35+(等級*5)的傷害。</font>
</span>
<br>
<img src="picture/Zagara/Abilities/Hunter Killer.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hunter Killer(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">14秒</font>
<br class="fon2"><font color="fffff"><br>召喚一隻刺蛇對單一敵人造成每秒40+(等級*6)的傷害,持續8秒。</font>
</span>
<br>
<img src="picture/Zagara/Abilities/Infested Drop.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Infested Drop(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>對目標區域召喚蟲囊造成60+(等級*12)的傷害。蟲囊破裂後會生出兩隻225+(等級*20)生命且擁有13+(等級*2)傷害的小蟲,持續8秒。</font>
</span>
<br>
<img src="picture/Zagara/Abilities/Devouring Maw.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Devouring Maw(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>在目標區域召換地龍造成75+(等級*24)的傷害並吞噬目標4秒;被吞噬的目標將無法攻擊,並承受每秒40+(等級*2)的傷害。</font>
</span>
<br>
<img src="picture/Zagara/Abilities/Nydus Network.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Nydus Network(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">2秒</font>
<br class="fon2"><font color="fffff"><br>在目標區域放置巢穴,最多可放置4個;每個巢穴之間可互通,使用R或滑鼠右鍵進出。</font>
</span>
<br>
<img src="picture/Zagara/Abilities/Exit Nydus Worm.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Creep Tumor(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">20mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>放置一個小型巢穴對周圍產生感染,在感染地面上你和你的召換物將獲得20%的移動加速,並額外獲得100%的生命回復,最多可充能3次持續240秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/1/Demolitionist.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Demolitionist</span></font><br><font color="00ffff">基礎攻擊建築時減少一發彈藥並額外造成10%傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/1/Centrifugal Hooks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Centrifugal Hooks(Q)</span></font><br><font color="00ffff">爆蟲的行徑距離變為2倍。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/1/Ventral Sacs.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ventral Sacs(E)</span></font><br><font color="00ffff">Infested Drop可產生3隻小蟲。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/1/Reconstitution.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reconstitution(Trait)</span></font><br><font color="00ffff">Creep Tumor的生命回復效果增加至300%。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/4/Envenomed Spines.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenomed Spines</span></font><br><font color="00ffff">普通攻擊範圍增加20%且在3秒內造成額外16+(等級*4)的傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/4/Medusa Blades.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Medusa Blades</span></font><br><font color="00ffff">普通攻擊會對周圍3個敵人造成25%的傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/4/Tumor Clutch.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tumor Clutch(Trait)</span></font><br><font color="00ffff">Creep Tumor的充能上限增至4次並減少10點魔力消耗。</font></span>
</div>
<div>
<img src="picture/Zagara/Talents/4/Envenom.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Envenom</span></font><br><font color="00ffff">主動技,使一個敵人中毒,在6秒內造成180+(等級*30)傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/4/Infest.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Infest</span></font><br><font color="00ffff">增加一個友軍小兵400%的傷害量,可充能兩次。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">B普通攻擊將減少技能冷卻0.5秒。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/7/Volatile Acid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Volatile Acid(Q)</span></font><br><font color="00ffff">爆蟲傷害對非英雄目標增加50%。</font></span>
</div>
<div>
<img src="picture/Zagara/Talents/7/Corpse Feeders.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Corpse Feeders(E)</span></font><br><font color="00ffff">Infested Drop每殺死一個敵人會增加小蟲的持續時間10秒。</font></span>
</div>
<div>
<img src="picture/Zagara/Talents/7/Endless Creep.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Endless Creep(Trait)</span></font><br><font color="00ffff">Creep Tumor的蔓延速度提升至2倍,且範圍擴大25%。</font></span>
</div>
<div>
<img src="picture/Zagara/Talents/7/Nydus Network (R)Charge Cooldown60 seconds.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rapid Incubation</span></font><br><font color="00ffff">在3秒內回復自身25%最大生命值與魔力,需引導。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/10/Devouring Maw.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Devouring Maw(R)</span></font><br><font color="00ffff">在目標區域召換地龍造成75+(等級*24)的傷害並吞噬目標4秒;被吞噬的目標將無法攻擊,並承受每秒40+(等級*2)的傷害。</font></span>
</div>
<div>
<img src="picture/Zagara/Talents/10/Nydus Network.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Nydus Network(R)</span></font><br><font color="00ffff">在目標區域放置巢穴,最多可放置4個;每個巢穴之間可互通,使用R或滑鼠右鍵進出。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield</span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/13/Mutalisk.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mutalisk(W))</span></font><br><font color="00ffff">Hunter Killer所召換的刺蛇獲得額外50%的傷害與持續時間。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/13/Grooved Spines.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Grooved Spines(W)</span></font><br><font color="00ffff">增加Hunter Killer的射程35%,並強化20%的傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/13/Bile Drop.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bile Drop(E)</span></font><br><font color="00ffff">被Infested Drop擊中的敵人在接下來的4秒內承受額外100%的傷害。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/16/Baneling Massacre.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Baneling Massacre(Q)</span></font><br><font color="00ffff">Baneling Barrage可召喚8隻爆蟲。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/16/Brood Expansion.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Brood Expansion(W)</span></font><br><font color="00ffff">Hunter Killer可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/16/Metabolic Boost.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Metabolic Boost(Trait)</span></font><br><font color="00ffff">Creep Tumor的移動加速效果提升至30%。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Zagara/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/20/Tyrant Maw.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tyrant Maw(R)</span></font><br><font color="00ffff">Devouring Maw額外獲得50%傷害;當英雄被Devouring Maw殺死時會減少50秒Devouring Maw的冷卻時間。 </font></span>
</div>
<div>
<img src="picture/Zagara/Talents/20/Broodling Nest.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Broodling Nest(R)</span></font><br><font color="00ffff">走出通道時會生出6隻寄生蟲攻擊附近的敵人,此效果每20秒只能觸發1次。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/ZERATUL.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="ZERATUL"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Zeratul/300_300/Zeratul.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:Zeratu</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:820(每等+135)<br><br>生命回復:2.168(每等+0.5)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:47(每等+13)<br><br>攻擊速度:0.9</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
神秘的黑暗聖堂武士忠誠地侍奉著薩爾納加。儘管他有著虛空力量的加持,然而贏得了區域領導者們尊敬的卻是他的智慧。除他對那些戲劇性登場的愛好。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
能在非戰斗狀態下隱形,除了憑藉著閃爍能力快速的出入戰場外,他還能不斷的騷擾敵人。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Zeratul/Abilities/Cleave.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Cleave(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">40mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">6秒</font>
<br class="fon2"><font color="fffff"><br>對附近敵人造成75+(等級*17)傷害</font>
</span>
<br>
<img src="picture/Zeratul/Abilities/Singularity Spike.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Singularity Spike(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>使用技能鎖定在第一個接觸到的敵人身上,在1秒後對其造成100+(等級*20)傷害和40%的減速,持續3秒。</font>
</span>
<br>
<img src="picture/Zeratul/Abilities/Blink.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Blink(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>傳送至目標區域並且不會取消隱形。</font>
</span>
<br>
<img src="picture/Zeratul/Abilities/Shadow Assault.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Shodow Assault(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>獲得20%攻速,攻擊自動獲得15%的生命竊取效果,能立即衝鋒至目標身邊,持續6秒。</font>
</span>
<br>
<img src="picture/Zeratul/Abilities/Void Prison.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Void Prison(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>製造持續5秒的區域束縛敵人,其中無論英雄、小兵或是建築都會變為無敵狀態並無法動作。施法者本身免疫此效果。</font>
</span>
<br>
<img src="picture/Zeratul/Abilities/Permanent Cloak.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Permanent Cloak(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>脫離戰鬥2秒後進入隱身狀態,受到傷害或攻擊時會解除隱身。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回复。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/1/Path of the Assassin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Assassin</span></font><br><font color="00ffff">每提升一級,增加額外2點傷害。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/1/Greater Cleave.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Greater Cleave(Q)</span></font><br><font color="00ffff">增加Cleave的作用範圍33%。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/1/Rapid Displacement.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rapid Displacement(E)</span></font><br><font color="00ffff">減少Blink的冷卻時間1.5秒。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack</span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回覆自身生命。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/4/Shadow Spike.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shadow Spike(W)</span></font><br><font color="00ffff">使用Singularity Spike時不再解除隱形並增加20%的射程。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/4/Sustained Anomaly.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sustained Anomaly(W)</span></font><br><font color="00ffff">使用Singularity Spike會爆炸並緩速附近敵方不管有無擊中目標。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/7/Rending Cleave.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rending Cleave(Q)</span></font><br><font color="00ffff">使用Cleave時會在5秒內造成額外50%的技能持續傷害。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/7/Assassin's Blade.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Assassin's Blade</span></font><br><font color="00ffff">當你破除隱形時在5秒內獲得額外25%的攻擊傷害,在潛行時獲得10%的移動加速。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/7/First Aid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Aid </span></font><br><font color="00ffff">主動技,在6秒內回復35%最大生命值的生命。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/7/Searing Attacks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Attacks </span></font><br><font color="00ffff">主動技,基礎攻擊提升50%持續5秒。每次攻擊消耗15點法力值。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/10/Shadow Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shodow Assault(R) </span></font><br><font color="00ffff">獲得20%攻速,攻擊自動獲得15%的生命竊取效果,能立即衝鋒至目標身邊,持續6秒。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/10/Void Prison.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Void Prison(R)</span></font><br><font color="00ffff">製造持續5秒的區域束縛敵人,其中無論英雄、小兵或是建築都會變為無敵狀態並無法動作。施法者本身免疫此效果。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/13/Burning Rage.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Burning Rage</span></font><br><font color="00ffff">對周圍敵人每秒造成10+(等級*2)傷害。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/13/Vorpal Blade.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vorpal Blade</span></font><br><font color="00ffff">變成主動技能傳送至3秒內的最後一個攻擊目標。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/13/Wormhole.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Wormhole(E)</span></font><br><font color="00ffff">使用Blink之後在3秒內可以再次使用回到原目標位置。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner</span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/16/Double Bombs.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Double Bombs(W)</span></font><br><font color="00ffff">使用Singularity Spike後在3秒內可以再無消耗的使用一次。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/16/Berserk.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Berserk </span></font><br><font color="00ffff">使用後在4秒內增加攻擊速度40%並增加移動速度10%。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Zeratul/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/20/Nerazim Fury.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Nerazim Fury(R)</span></font><br><font color="00ffff">再增加Shodow Assault的15%生命偷取持續時間延長50%。 </font></span>
</div>
<div>
<img src="picture/Zeratul/Talents/20/Protective Prison.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protective Prison(R)</span></font><br><font color="00ffff">友軍不再受到此技能影響。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/activity.php
<?php
include_once 'class/activity.php';
include_once 'class/ACTPage.php';
include_once 'class/present.php';
$ACTid = $_GET['id'];
// TODO: page and id are not number, return announcement.php
// header to announcement.php
$showPage = false;
$showACT = false;
if(isset($ACTid)) {
if(hasACT($ACTid)) $showACT = true;
else header("Location:/announcement.php");
}
else {
$showpage = true;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>傲飛娛樂</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body class="star_background">
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<div class="block"></div>
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<div class="activity_block">
<?php
if($showpage == true) {
echo '
<h1>近期活動</h1>
';
$ACTlist = showActiveACT();
foreach($ACTlist as $ACT) {
echo '
<div class="list-group">
<a href="activity.php?id='.$ACT['id'].'" class="list-group-item ">
<h4 class="list-group-item-heading">'.
$ACT['title'].'
</h4>
<p class="list-group-item-text color_red">'.date("Y-m-d",strtotime($ACT['date'])).'</p>
<p class="list-group-item-text">'.mb_substr($ACT['content'], 0, 50, "UTF-8").'...</p>
</a>
</div>
';
}
}
else if($showACT == true) {
$ACT = showACT($ACTid);
echo '
<table class="table">
<tr>
<td>
<div class="title">'.$ACT['title'].'</div>
</td>
<td><div class="date">'.date("Y-m-d",strtotime($ACT['date'])).'</div></td>
</tr>
</table>
<div class="lead content">
'.nl2br($ACT['content']).'
<table>
<tr>
<td width="100px">
<form method="post" action="'.getPageName($ACTid).'">
<input type="hidden" name="ACTid" value="'.$ACTid.'">
<button class="btn btn-primary" type="submit">我要報名</button>
</form>
</td>
<td>
<div class="text-warning lead">目前報名人數: '.sizeof(showUserByACT($ACTid)).'</div>
</td>
</tr>
</table>
</div>
';
}
?>
</div>
</div><!-- /.container -->
<div class="block"></div>
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/test/receive.php
<?php
$array = array("mike", "gliance");
echo json_encode($array);
?><file_sep>/admin/index.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/admin.php';
$frame = new Frame();
if(isLogin()) {
$output = ' <img src="picture/O101.jpg" width="300">';
}
$frame->get_main_frame($output);
?><file_sep>/admin/modify_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$output = "";
$abilityID = $_POST['id'];
$name = $_POST['name'];
$type = $_POST['type'];
$cool_down = $_POST['cool_down'];
$cost = $_POST['cost'];
$cost_type = $_POST['cost_type'];
$time = $_POST['time'];
$range = $_POST['range'];
$description = $_POST['description'];
if(isset($name)) {
$data = new AbilityData();
$data->name_ = $name;
$data->type_ = $type;
$data->cool_down_ = $cool_down;
$data->cost_ = $cost;
$data->cost_type_ = $cost_type;
$data->time_ = $time;
$data->range_ = $range;
$data->description_ = $description;
updateAbility($abilityID, $data);
if($type == "技能")
header("Location:skill.php");
else
header("Location:telent.php");
}
else if(isset($abilityID)) {
$skill = getAbility($abilityID);
$output = ' <h1>修改技能/天賦</h1>
<div class="lead">
<form method="post" action="">
<input type="hidden" name="id" value="'.$abilityID.'">
<div>
<h3>種類:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="type" value="技能" '.getTypeCheck($abilityID, "技能").'>技能<br></div>
<div class="float"><input type="radio" name="type" value="天賦" '.getTypeCheck($abilityID, "天賦").'>天賦<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>招式名稱:</h3>
<input type="text" name="name" value="'.$skill['name'].'">
</div>
<div>
<h3>冷卻時間:</h3>
<input type="text" name="cool_down" value="'.$skill['cool_down'].'">
</div>
<div>
<h3>招式消耗:</h3>
<input type="text" name="cost" value="'.$skill['cost'].'">
</div>
<div>
<h3>招式消耗種類:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="cost_type" value="魔力" '.getCostTypeCheck($skill['cost_type'], "魔力").'>魔力<br></div>
<div class="float"><input type="radio" name="cost_type" value="怒氣" '.getCostTypeCheck($skill['cost_type'], "怒氣").'>怒氣<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>持續時間:</h3>
<input type="text" name="time" value="'.$skill['time'].'">
</div>
<div>
<h3>招式射程:</h3>
<input type="text" name="range" value="'.$skill['range'].'">
</div>
<div>
<h3>招式說明:</h3>
<textarea rows="10" cols="80%" name="description">'.nl2br($skill['description']).'</textarea>
</div>
</br>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
else {
echo "error: modify ability <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/ILLIDAN.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="ILLIDAN"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Illidan/300_300/Illidan.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:ILLIDAN</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:750(每等+125)<br><br>生命回復:1.73(每等+0.262)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:xx(每等+xx)<br><br>魔力回復:xx(每等+xx)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:30(每等+7)<br><br>攻擊速度:0.6</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
世間首位惡魔獵手伊利丹·怒風,在擊退入侵的惡魔之後,因為製造了新的永恆之井而成為背叛者。如今統治著外域,肆意屠殺那些膽敢踏入其領地的英雄們。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
穿梭於戰場,能輕易的逃避攻擊也能無情的追殺敵人。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Illidan/Abilities/Dive.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Dive (Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">6秒</font>
<br class="fon2"><font color="fffff"><br>撲向目標,造成45+(等級*5)點傷害伊利丹將翻至目標的另一側.。</font>
</span>
<br>
<img src="picture/Illidan/Abilities/Sweeping Strike.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Sweeping strike (W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>沖向目標地點,對路徑上的敵人造成60+(等級*10)點傷害,如果擊中敵人,4秒內他的基礎攻擊傷害提升25%。</font>
</span>
<br>
<img src="picture/Illidan/Abilities/Evasion.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Evasion (E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">15秒</font>
<br class="fon2"><font color="fffff"><br>1.5秒內閃避所有普通攻擊。</font>
</span>
<br>
<img src="picture/Illidan/Abilities/Metamorphosis.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Metamorphosis (R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">120秒</font>
<br class="fon2"><font color="fffff"><br>在目標位置變為惡魔形態,並在變身時在範圍內造成200(等級*10)傷害。每次擊中敵方英雄都能暫時獲得100(等級*15)最大生命值,同時獲得20%的攻擊速度加成。持續18秒。</font>
</span>
<br>
<img src="picture/Illidan/Abilities/The Hunt.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">The Hunt (R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">60秒</font>
<br class="fon2"><font color="fffff"><br>向目標敵人衝鋒,造成150點(等級*20)傷害,並將其擊暈1秒。</font>
</span>
<br>
<img src="picture/Illidan/Abilities/Betrayer's Thirst.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Betrayer's Thirst (D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>基礎攻擊傷害的20%將轉化為治療,同時降低技能冷卻時間1秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回复。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/1/Battered Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battered Assault(W)</span></font><br><font color="00ffff">普通攻擊獲得額外40%傷害。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/1/Shadow Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shadow Shield(E)</span></font><br><font color="00ffff">使用Evasion時獲得75的護盾持續5秒。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/1/Thirsting Blade (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Thirsting Blade</span></font><br><font color="00ffff">基礎攻擊的治療量提升至30%。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack/span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/4/Marked for Death.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Morked for Death(Q)</span></font><br><font color="00ffff">使用Dive後下一個普通攻擊會對此目標造成額外100%傷害。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/4/Fel Reach.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fel Reach(W)</span></font><br><font color="00ffff">增加技能衝擊距離20%。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/4/Immolation.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Immolation(W)</span></font><br><font color="00ffff">使用Sweeping strike燃燒附近敵人造成每秒17+(等級*3)的傷害持續3秒。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/7/Rapid Chase.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rapid Chase(Q)</span></font><br><font color="00ffff">使用Dive後增加20%移動速度持續兩秒。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/7/Reflexive Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Reflexive Block(E)</span></font><br><font color="00ffff">Evasion結束後獲得兩層格擋效果(減少基礎攻擊傷害50%),持續5秒。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/7/Thrill of Battle (Trait).png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Thrill of BattleMonster Slide</span></font><br><font color="00ffff">啟動後基礎攻擊減少技能冷卻的效果翻倍,持續5秒。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/7/First Aid.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">First Aid</span></font><br><font color="00ffff">主動技,在6秒內回復35%最大生命值的生命。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/10/Metamorphosis.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Metamorphosis (R)</span></font><br><font color="00ffff">在目標位置變為惡魔形態,並在變身時在範圍內造成200(等級*10)傷害。每次擊中敵方英雄都能暫時獲得100(等級*15)最大生命值,同時獲得20%的攻擊速度加成。持續18秒。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/10/The Hunt.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">The Hunt (R)</span></font><br><font color="00ffff">向目標敵人衝鋒,造成150點(等級*20)傷害,並將其擊暈1秒。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/13/Lunge.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lunge(Q)</span></font><br><font color="00ffff">增加Dive的施放距離30%。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/13/Friend or Foe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Friend Foe(Q)</span></font><br><font color="00ffff">Dive可對友方單位使用但不會翻過目標。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/13/Unbound.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Unbound(W)</span></font><br><font color="00ffff">Sweeping strike可以穿透地形。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/13/Sixth Sense.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Sixth Sense(E)</span></font><br><font color="00ffff">使用Evasion時同時豁免50%的技能傷害。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner</span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/16/Second Sweep.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Second Sweep(W)</span></font><br><font color="00ffff">讓Sweeping strike可充能兩次 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/16/Hunter's Onslaught.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hunter's Onslaught</span></font><br><font color="00ffff">使全部技能獲得15%吸血效果 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/16/Blood for Blood.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blood for Blood </span></font><br><font color="00ffff">主動技,吸取目標敵人15%最大生命值,並使其移動速度降低30%,持續3秒。</font></span>
</div>
<div>
<img src="picture/Illidan/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin </span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Illidan/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/20/Demonic Form.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Demonic Form(R)</span></font><br><font color="00ffff">將保持惡魔形態直到被擊殺,惡魔形態下攻擊速度加成提升至30%。 </font></span>
</div>
<div>
<img src="picture/Illidan/Talents/20/Nowhere to Hide.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Nowhere to Hide(R)</span></font><br><font color="00ffff">使The Hunt施放距離變成全地圖並增加衝擊速度。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/list_graph.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$id = $_GET['id'];
$type = $_GET['type'];
$output = "";
if(isset($id)) {
$graph = "";
if($type=='英雄') $graph = getHeroGraph($id);
else $graph = getAbilityGraph($id);
$output = '
<div class="lead">
<div>
<h3>名稱:</h3>'.$graph['name'].'
</div>
<div>
<h3>種類:</h3>'.$graph['type'].'
</div>
<div>
<h3>圖片:</h3>
<img width="300px" src="'.$graph['path'].'">
</div>
<div>
<h3>說明:</h3>'.nl2br($graph['description']).'
</div>
</div>';
}
else {
$list = getSetGraph();
$output = '
<h1>所有圖片設定</h1>
<div class="lead">
<table class="table hero_table">';
foreach ($list as $graph) {
$output = $output.'
<tr>
<td class="share"><a href="list_graph.php?id='.$graph['id'].'&type='.$graph['type'].'">'.$graph['name'].'</a></td>
<td class="share">'.$graph['type'].'</td>
<td class="share">'.$graph['description'].'</td>
<td class="share"></td>
<td>
<form method="post" action="modify_graph.php">
<input type="hidden" name="id" value="'.$graph['id'].'">
<input type="hidden" name="type" value="'.$graph['type'].'">
<input type="hidden" name="description" value="'.$graph['description'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_graph.php">
<input type="hidden" name="id" value="'.$graph['id'].'">
<input type="hidden" name="type" value="'.$graph['type'].'">
<input type="hidden" name="description" value="'.$graph['description'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>';
}
$output = $output.'
</table>
</div>';
}
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/modify_activity.php
<?php
require_once 'class/Frame.php';
require_once 'class/activity.php';
require_once 'class/User.php';
if(isLogin()) {
$frame = new Frame();
$ACTid = $_POST['id'];
$output = "";
$title = $_POST['title'];
$description = $_POST['description'];
$content = $_POST['content'];
$ACT_date = $_POST['ACT_date'];
if(isset($title)) {
$result = updateACT($ACTid, $title, $description, $content, $ACT_date);
header("Location:/admin/activity.php");
}
else if(isset($ACTid) && hasACT($ACTid)) {
$ACT = showACT($ACTid);
$output = ' <h1>修改活動</h1>
<form method="post" action="">
<input type="hidden" name="id" value="'.$ACTid.'">
<h3>主旨:</h3>
<input type="text" size="90%" name="title" value="'.$ACT['title'].'">
<h3>活動日期:</h3>
<input type="date" name="ACT_date" value="'.date("Y-m-d",strtotime($ACT['ACT_date'])).'">
<h3>摘要:</h3>
<textarea rows="10" cols="90%" name="description">'.$ACT['description'].'</textarea>
<h3>內容:</h3>
<textarea rows="10" cols="90%" name="content">'.$ACT['content'].'</textarea>
<br/><br/>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin/activity.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>';
$frame->get_main_frame($output);
}
else {
echo "error: modify activity <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/add_activity.php
<?php
require_once 'class/Frame.php';
require_once 'class/activity.php';
require_once 'class/User.php';
if(isLogin()) {
$title = $_POST['title'];
$description = $_POST['description'];
$content = $_POST['content'];
$ACT_date = $_POST['ACT_date'];
if(isset($title)) {
addACT($title, $description, $content, $ACT_date);
header("Location:/admin");
}
else {
$frame = new Frame();
$output = ' <h1>新增活動</h1>
<form method="post" action="">
<h3>主旨:</h3>
<input type="text" size="90%" name="title">
<h3>活動日期:</h3>
<input type="date" name="ACT_date">
<h3>摘要:</h3>
<textarea rows="10" cols="90%" name="description"></textarea>
<h3>內容:</h3>
<textarea rows="10" cols="90%" name="content"></textarea>
<br/><br/>
<button class="btn btn-primary" type="submit">新增</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>';
$frame->get_main_frame($output);
}
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/class/HOS.php
<?php
require_once dirname(__FILE__)."/HOS_DB.php";
class HeroData
{
var $name_;
var $come_from_;
var $major_;
var $second_major_;
var $story_;
var $suggest_;
var $health_;
var $health_regain_;
var $mana_;
var $mana_regain_;
var $attack_;
var $attack_speed_;
var $health_per_level_;
var $health_regain_per_level_;
var $mana_per_level_;
var $mana_regain_per_level_;
var $attack_per_level_;
var $attack_speed_per_level_;
}
class AbilityData
{
var $name_;
var $type_;
var $cool_down_;
var $cost_;
var $cost_type_;
var $time_;
var $range_;
var $description_;
}
class HeroAbilityData
{
var $uid_;
var $id_;
var $type_;
var $button_;
var $level_;
}
function addHero($heroData)
{
$db = new HOS_DB();
$rc = $db->insert("
INSERT INTO hero (id,
name, come_from, major, second_major,
story, suggest, health, health_regain,
mana, mana_regain, attack, attack_speed,
health_per_level, health_regain_per_level,
mana_per_level, mana_regain_per_level, attack_per_level,
attack_speed_per_level)
VALUES (NULL, '$heroData->name_', '$heroData->come_from_',
'$heroData->major_', '$heroData->second_major_', '$heroData->story_',
'$heroData->suggest_', '$heroData->health_', '$heroData->health_regain_',
'$heroData->mana_', '$heroData->mana_regain_', '$heroData->attack_', '$heroData->attack_speed_',
'$heroData->health_per_level_', '$heroData->health_regain_per_level_',
'$heroData->mana_per_level_', '$heroData->mana_regain_per_level_', '$heroData->attack_per_level_',
'$heroData->attack_speed_per_level_')");
return $rc;
}
function removeHero($heroID)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM hero WHERE id='$heroID'");
return $rc;
}
function updateHero($id, $heroData)
{
$db = new HOS_DB();
$rc = $db->update("UPDATE `hero` SET `name`='$heroData->name_',
`come_from`='$heroData->come_from_',
`major`='$heroData->major_',
`second_major`='$heroData->second_major_',
`story`='$heroData->story_',
`suggest`='$heroData->suggest_',
`health`='$heroData->health_',
`health_regain`='$heroData->health_regain_',
`mana`='$heroData->mana_',
`mana_regain`='$heroData->mana_regain_',
`attack`='$heroData->attack_',
`attack_speed`='$heroData->attack_speed_',
`health_per_level`='$heroData->health_per_level_',
`health_regain_per_level`='$heroData->health_regain_per_level_',
`mana_per_level`='$heroData->mana_per_level_',
`mana_regain_per_level`='$heroData->mana_regain_per_level_',
`attack_per_level`='$heroData->attack_per_level_',
`attack_speed_per_level`='$heroData->attack_speed_per_level_'
WHERE id='$id'");
return $rc;
}
function addAbility($data)
{
$db = new HOS_DB();
$rc = $db->insert(" INSERT INTO `ability`(`id`, `name`, `type`, `cool_down`, `cost`, `cost_type`, `time`, `range`, `description`)
VALUES (NULL,
'$data->name_',
'$data->type_',
'$data->cool_down_',
'$data->cost_',
'$data->cost_type_',
'$data->time_',
'$data->range_',
'$data->description_')");
return $rc;
}
function removeAbility($id)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM ability WHERE id='$id'");
return $rc;
}
function updateAbility($id, $data)
{
$db = new HOS_DB();
$rc = $db->update(" UPDATE `ability` SET `name`='$data->name_',
`type`='$data->type_',
`cool_down`='$data->cool_down_',
`cost`='$data->cost_',
`cost_type`='$data->cost_type_',
`time`='$data->time_',
`range`='$data->range_',
`description`='$data->description_'
WHERE id='$id'");
return $rc;
}
function addGraph($id, $type, $path, $description)
{
$db = new HOS_DB();
$rc = $db->insert(" INSERT INTO `graph`(`number`, `id`, `type`, `path`, `description`)
VALUES (NULL,
'$id',
'$type',
'$path',
'$description')");
return $rc;
}
function removeGraph($id, $type, $description)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM graph WHERE id='$id' AND type='$type' AND description='$description'");
return $rc;
}
function removeGraphByHero($id)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM graph WHERE id='$id' AND type='英雄'");
return $rc;
}
function removeGraphByAbility($id)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM graph WHERE id='$id' AND type!='英雄'");
return $rc;
}
function updateGraph($id, $type, $path, $description)
{
$db = new HOS_DB();
$rc = $db->update(" UPDATE `graph` SET `path`='$path',
`description`='$description'
WHERE id='$id' AND type='$type'");
return $rc;
}
function addHeroAbility($data)
{
$db = new HOS_DB();
$rc = $db->insert("
INSERT INTO `heroability`(`number`, `uid`, `id`, `type`, `button`, `level`)
VALUES (NULL,
'$data->uid_',
'$data->id_',
'$data->type_',
'$data->button_',
'$data->level_')");
return $rc;
}
function removeHeroAbility($uid, $id)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM heroability WHERE uid='$uid' AND id='$id'");
return $rc;
}
function removeHeroAbilityByHero($id)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM heroability WHERE uid='$id'");
return $rc;
}
function removeHeroAbilityByAbility($id)
{
$db = new HOS_DB();
$rc = $db->delete("DELETE FROM heroability WHERE id='$id'");
return $rc;
}
function updateHeroAbility($uid, $id, $data)
{
$db = new HOS_DB();
$rc = $db->update("
UPDATE `heroability` SET `type`='$data->type_',
`button`='$data->button_',
`level`='$data->level_'
WHERE uid='$uid' AND id='$id'");
return $rc;
}
function getHero($id)
{
$db = new HOS_DB();
$rc = $db->query(" SELECT *
FROM hero
WHERE id='$id'");
return $db->fetch_array();
}
function getHeroName($id)
{
$db = new HOS_DB();
$rc = $db->query(" SELECT name
FROM hero
WHERE id='$id'");
$hero = $db->fetch_array();
return $hero['name'];
}
function getAllHero()
{
$db = new HOS_DB();
$db->query(" SELECT *
FROM hero
ORDER BY name ASC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getAllHeroName()
{
$db = new HOS_DB();
$db->query(" SELECT name
FROM hero
ORDER BY name ASC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re['name']);
return $list;
}
function getComefromCheck($id, $radio)
{
$db = new HOS_DB();
$db->query(" SELECT come_from
FROM hero
WHERE id='$id'");
$re = $db->fetch_array();
$come_from = $re['come_from'];
if($come_from == $radio) return "checked";
else return "";
}
function getMajorCheck($id, $radio)
{
$db = new HOS_DB();
$db->query(" SELECT major
FROM hero
WHERE id='$id'");
$re = $db->fetch_array();
if($re['major'] == $radio) return "checked";
else return "";
}
function getAbility($id)
{
$db = new HOS_DB();
$db->query(" SELECT *
FROM ability
WHERE id='$id'");
return $db->fetch_array();
}
function getAllAbility($type)
{
$db = new HOS_DB();
$db->query(" SELECT *
FROM ability
WHERE type='$type'
ORDER BY name ASC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getUnusedAbility()
{
$db = new HOS_DB();
$list = array();
$db->query(" SELECT *
FROM ability
WHERE id NOT IN
(
SELECT id
FROM heroability
)
ORDER BY type DESC, name ASC");
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getTypeCheck($id, $radio)
{
$db = new HOS_DB();
$db->query(" SELECT type
FROM ability
WHERE id='$id'");
$re = $db->fetch_array();
if($re['type'] == $radio)
return "checked";
else
return "";
}
function getCostTypeCheck($cost_type, $current)
{
if($cost_type == $current) return "checked";
else return "";
}
function getHeroAbility($uid, $id)
{
$db = new HOS_DB();
$re = $db->query(" SELECT *
FROM heroability
WHERE uid='$uid' AND id='$id'");
return $db->fetch_array();
}
function getHeroAbilityTypeCheck($uid, $id, $radio)
{
$db = new HOS_DB();
$db->query(" SELECT type
FROM heroability
WHERE uid='$uid' AND id='$id'");
$re = $db->fetch_array();
if($re['type'] == $radio)
return "checked";
else
return "";
}
function getHeroAllAbility($id)
{
$db = new HOS_DB();
$re = $db->query(" SELECT A.name, H.*
FROM heroability as H, ability as A
WHERE H.uid='$id' AND H.id=A.id
ORDER BY name ASC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getHeroPassiveAbility($id)
{
$db = new HOS_DB();
$re = $db->query(" SELECT A.name, H.*
FROM heroability as H, ability as A
WHERE H.uid='$id' AND H.id=A.id AND H.type='特性'
ORDER BY name ASC");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getHeroSkills($id)
{
$db = new HOS_DB();
$list = array();
$re = $db->query(" SELECT A.name, H.*
FROM heroability as H, ability as A
WHERE H.uid='$id' AND H.id=A.id AND H.type='技能'
ORDER BY ( CASE H.button
WHEN 'Q' THEN '1'
WHEN 'W' THEN '2'
WHEN 'E' THEN '3'
WHEN 'R' THEN '4'
WHEN '' THEN '5'
END)");
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getHeroTelents($id)
{
$db = new HOS_DB();
$re = $db->query(" SELECT A.name, H.*
FROM heroability as H, ability as A
WHERE H.uid='$id' AND H.id=A.id AND H.type='天賦'
ORDER BY level ASC, ( CASE button
WHEN 'Q' THEN '1'
WHEN 'W' THEN '2'
WHEN 'E' THEN '3'
WHEN 'R' THEN '4'
WHEN '' THEN '5'
END)");
$list = array();
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getUnsetGraphAbility()
{
$db = new HOS_DB();
$list = array();
$db->query(" SELECT *
FROM ability
WHERE id NOT IN
(
SELECT id
FROM graph
WHERE type!='英雄'
)
ORDER BY type DESC, name ASC");
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getUnsetGraphHero()
{
$db = new HOS_DB();
$list = array();
$db->query(" SELECT *
FROM hero
WHERE id NOT IN
(
SELECT id
FROM graph
WHERE type='英雄'
)
ORDER BY name ASC");
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getSetGraph()
{
$db = new HOS_DB();
$list = array();
$db->query(" SELECT H.id, H.name, G.type, G.description
FROM hero as H, graph as G
WHERE H.id=G.id AND G.type='英雄'
ORDER BY name ASC");
while($re = $db->fetch_array()) array_push($list, $re);
$db->query(" SELECT A.id, A.name, G.type, G.description
FROM ability as A, graph as G
WHERE A.id=G.id AND G.type!='英雄'
ORDER BY type DESC, name ASC");
while($re = $db->fetch_array()) array_push($list, $re);
return $list;
}
function getHeroGraph($id)
{
$db = new HOS_DB();
$db->query(" SELECT G.*, H.name
FROM graph as G, hero as H
WHERE G.id='$id' AND G.type='英雄' AND G.id=H.id");
return $db->fetch_array();
}
function getAbilityGraph($id)
{
$db = new HOS_DB();
$db->query(" SELECT G.*, A.name
FROM graph as G, ability as A
WHERE G.id='$id' AND G.type!='英雄' AND G.id=A.id");
return $db->fetch_array();
}
function getHeroGraphDescriptionCheck($description, $current)
{
if($description == $current) return "checked";
else return "";
}
function getAbilityGraphTypeCheck($type, $current)
{
if($type == $current) return "checked";
else return "";
}
?><file_sep>/admin/who_attend.php
<?php
require_once 'class/Frame.php';
require_once 'class/activity.php';
require_once 'class/User.php';
require_once 'class/present.php';
require_once 'class/ACTPage.php';
if(isLogin()) {
$frame = new Frame();
$ACTid = $_POST['id'];
$output = "";
if(getPageName($ACTid) != "attend.php") {
require_once 'class/'.getPageName($ACTid);
}
$list = showUserByACT($ACTid);
$output = '
<h1>參加者清單</h1>
<div class="lead">
<table class="table">
<thead>
<tr>
<th>姓名</th>
<th>暱稱</th>
<th>手機</th>';
if(getPageName($ACTid) != "attend.php") {
$titleList = getTitleArray();
foreach ($titleList as $title)
$output = $output .
'<th>'.$title.'</th>';
}
$output = $output .'</tr>
</thead>
<tbody>';
foreach ($list as $userid) {
$user = showUser($userid);
$output = $output.'
<tr>
<td>
'.$user['name'].'
</td>
<td>'.$user['nickname'].'</td>
<td>'.$user['phone'].'</td>';
if(getPageName($ACTid) != "attend.php") {
$profile = getDataArray($userid);
foreach ($profile as $data) {
$output = $output.'
<td>'.$data.'</td>';
}
}
$output = $output.'
</tr>';
}
$output = $output.'
</tbody>
</table>
</div><br/>';
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/class/User.php
<?php
require_once 'class/DB.php';
require_once 'class/admin.php';
function login($email, $password) {
$db = new DB();
$encryption = md5($password);
$result = $db->query(" SELECT *
FROM user
WHERE email='$email' AND password='$encryption'");
if($result > 0) {
$user = $db->fetch_array();
// assign directly can effect immediately
$_COOKIE['aid'] = $user['id'];
$_COOKIE['email'] = $user['email'];
$_COOKIE['name'] = $user['name'];
$_COOKIE['nickname'] = $user['nickname'];
$_COOKIE['phone'] = $user['phone'];
$_COOKIE['gender'] = $user['gender'];
setcookie("aid", $user['id']);
setcookie("email", $user['email']);
setcookie("name", $user['name']);
setcookie("nickname", $user['nickname']);
setcookie("phone", $user['phone']);
setcookie("gender", $user['gender']);
return true;
}
else
return false;
}
function isLogin() {
if(isset($_COOKIE['aid']) && isAdmin($_COOKIE['aid']))
return true;
else
return false;
}
function logout() {
$_COOKIE['aid'] = "";
$_COOKIE['email'] = "";
$_COOKIE['name'] = "";
$_COOKIE['nickname'] = "";
$_COOKIE['phone'] = "";
$_COOKIE['gender'] = "";
setcookie("aid", "");
setcookie("email", "");
setcookie("name", "");
setcookie("nickname", "");
setcookie("phone", "");
setcookie("gender", "");
}
function addUser($email, $password, $name, $nickname, $phone, $gender) {
$db = new DB();
$encryption = md5($password);
$result = $db->insert("INSERT INTO user (email, password, name, nickname, phone, gender)
VALUES ('$email', '$encryption', '$name', '$nickname', '$phone', '$gender')");
//TODO: send mail
return $result;
}
function removeUser($id) {
$db = new DB();
$result = $db->delete("DELETE FROM user WHERE id='$id'");
return $result;
}
function updatePassword($id, $password) {
$db = new DB();
$encryption = md5($password);
$result = $db->update("UPDATE user SET password='$encryption' WHERE id='$id'");
return $result;
}
function updateEmail($id, $email) {
$db = new DB();
$result = $db->update("UPDATE user SET email='$email' WHERE id='$id'");
return $result;
}
function updateProfile($id, $name, $nickname, $phone, $gender) {
$db = new DB();
$result = $db->update("UPDATE user SET name='$name', nickname='$nickname', phone='$phone', gender='$gender'
WHERE id='$id'");
return $result;
}
function hasEmail($email) {
$db = new DB();
$result = $db->query("SELECT * FROM user WHERE email='$email'");
return $result;
}
function comparePassword($passwd1, $passwd2) {
if(strcmp($passwd1, $passwd2)==0)
return true;
else
return false;
}
function showUser($id) {
$db = new DB();
$result = $db->query("SELECT * FROM user WHERE id='$id'");
return $db->fetch_array();
}
function getUserGenderCheck($gender, $current)
{
if($gender == $current) return "checked";
else return "";
}
?>
<file_sep>/MALFIRION.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="MALFIRION"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Malfurion/300_300/MALFURION.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:MALFURION</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:835(每等+150)<br><br>生命回復:1.738(每等+0.313)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:33(每等+6)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
半神塞納留斯的弟子,艾澤拉斯大陸上最強大的德魯伊。他與大自然及塞納留斯透過翡翠夢境進行了無數的溝通交流。他護佑大自然不被惡魔與部落染指。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
能夠治愈友軍並恢復他們的法力值,且還能夠從遠處發現敵?,並在範圍內進行纏繞。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Malfurion/Abilities/Regrowth.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Regrowth(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">7秒</font>
<br class="fon2"><font color="fffff"><br>治療友方目標40+(等級*14)生命值並再10秒內額外治癒100+(等級*35)的生命值。</font>
</span>
<br>
<img src="picture/Malfurion/Abilities/Moonfire.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Moonfire(W </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">20mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">3秒</font>
<br class="fon2"><font color="fffff"><br>對目標區域造成30+(等級*10)傷害並顯形2秒。</font>
</span>
<br>
<img src="picture/Malfurion/Abilities/Entangling Roots.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Entangling Roots(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>將目標區域內的所有敵人纏繞定身1.5秒,同時每秒造成15+(等級*12)傷害。區域將在3秒內持續擴大。</font>
</span>
<br>
<img src="picture/Malfurion/Abilities/Tranquility.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Tranquility(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">100秒</font>
<br class="fon2"><font color="fffff"><br>治癒範圍內友方單位每秒40+(等級*9)持續10秒。</font>
</span>
<br>
<img src="picture/Malfurion/Abilities/Twilight Dream.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Twilight Dream(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">90秒</font>
<br class="fon2"><font color="fffff"><br>短暫延遲後在大範圍內造成100+(等級*36)的傷害並沉默敵軍3秒。</font>
</span>
<br>
<img src="picture/Malfurion/Abilities/Innervate.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Innervate(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">30秒</font>
<br class="fon2"><font color="fffff"><br>使目標友方英雄在10秒內回復100魔力。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/1/Path of the Wizard.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Wizard</span></font><br><font color="00ffff">每等額外增加5魔量和0.1魔力回復。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/1/Moonburn.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Moonburn(W)</span></font><br><font color="00ffff">Moonfire對非英雄目標造成額外30%的傷害。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/1/Harmony.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hormony(Q)</span></font><br><font color="00ffff">Regrowth用在小兵與僱傭兵身上會返還100%的魔力消耗 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/1/Healing Ward.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Healing Ward</span></font><br><font color="00ffff">放置一根治癒圖騰再地板上對附近友軍每秒造成2%最大生命回復持續10秒。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/4/Vengeful Roots.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vengeful Roots(E)</span></font><br><font color="00ffff">使用Entangling Roots時召喚一個擁有生命300+(等級*30)和攻擊20+(等級*8)的樹人持續12秒。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/4/Shan'do's Clarity.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shon'do's Claritty</span></font><br><font color="00ffff">使用Innervate時的減少10秒冷的卻時間並擁有兩倍的魔力回復速度</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/4/Versatile.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Versatile </span></font><br><font color="00ffff">Innervate可以同時增加目標單位的攻擊速度10%可以放置在非魔力消耗的英雄上。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/4/Protective Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Protective Shield</span></font><br><font color="00ffff">為一個友方英雄放置一個300+(等級*30)的護盾持續5秒。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/7/Enduring Growth.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Enduring Growth(Q)</span></font><br><font color="00ffff">Regrowth的持續時間增加6秒。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/7/Elune's Grace.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Elune's Grace</span></font><br><font color="00ffff">增加所有一般技能的距離2。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/7/Strangling Vines.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Strangling Vines(E)</span></font><br><font color="00ffff">Entangling Roots傷害增加100%。</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/7/CalldownMULE.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Calldown: MULE</span></font><br><font color="00ffff">召喚1個工兵修復目標位置附近的建築持續60秒,每秒修復100的生命值並每5秒補充一個彈藥。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/10/Tranquility.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tranquility(R)</span></font><br><font color="00ffff">治癒範圍內友方單位每秒40+(等級*9)持續10秒。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/10/Twilight Dream.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Twilight Dream(R)</span></font><br><font color="00ffff">短暫延遲後在大範圍內造成100+(等級*36)的傷害並沉默敵軍3秒。</font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/13/Full Moonfire.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Full Moonfire(W)</span></font><br><font color="00ffff">Moonfire 增加作用範圍50%和減少10魔力消耗。</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/13/Life Seed.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Life Seed(Q)</span></font><br><font color="00ffff">Regrowth持續效果會擴及周圍的友方英雄。</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/13/Shrink Ray.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shrink Ray </span></font><br><font color="00ffff">在四秒內使一個敵方英雄減少50%傷害和50%的移動速度。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/13/Ice Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ice Block</span></font><br><font color="00ffff">使自身無敵無法動作持續3秒。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/16/Lunar Shower.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lunar Shower(W)</span></font><br><font color="00ffff">使用Moonfire可以得到一層增益效果減少下一個Moonfire的冷卻時間0.5秒同時可以增加Moonfire的傷害10%,最多可疊加至3層。</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/16/Hindering Moonfire.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hindering Moonfire</span></font><br><font color="00ffff">Moonfire可以緩速20%移動速度持續2秒。</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/16/Tenacious Roots.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tenacious Roots(E)</span></font><br><font color="00ffff">Entangling Roots此招術範圍增加25%持續時間增加25%,纏繞時間增加0.5秒。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/16/Rewind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rewind</span></font><br><font color="00ffff">基礎技能冷卻時間減少10秒。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Malfurion/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/20/Storm Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm Shield</span></font><br><font color="00ffff">自身和周圍隊友產生最大生命值20%的護盾,持續時間3秒。</font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/20/Serenity.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Serenity(R)</span></font><br><font color="00ffff">可以增加Tranquility的治癒量25%並恢復範圍內友軍每秒5魔力。 </font></span>
</div>
<div>
<img src="picture/Malfurion/Talents/20/Nightmare.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Nightmare(R)</span></font><br><font color="00ffff">Twilight Dream沉默時間增加至4秒並緩速敵人50%。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li>W<NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/DIABLO.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="DIABLO"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Diablo/300_300/DIABLO.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:DIABLO</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:1060(每等+280)<br><br>生命回復:2.207(每等+0.543)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:49(每等+7)<br><br>攻擊速度:1.1</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
遠古人類口中流傳的恐懼之王,惡魔領主的目的只為燃燒煉獄占領庇護世界。遭到他毒手的受害者不計其數,他的計畫和他的性別一樣詭譎,難以名狀。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
擁有快速隊敵人發起衝鋒的利,還能用烈火和電光將他們灼燒殆盡;肆意的捕捉手下敵人靈魂以追尋不朽。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Diablo/Abilities/Shadow Charge.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Shadow Charge(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>向一個敵人衝去,對其造成46+(等級*8)傷害並擊暈之0.5秒。若目標被撞向不可通過的地形,造成暈眩1秒。</font>
</span>
<br>
<img src="picture/Diablo/Abilities/Fire Stomp.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Fire Stomp(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">6秒</font>
<br class="fon2"><font color="fffff"><br>向四周投出火球,每個火球造成30+(等級*9)點傷害。</font>
</span>
<br>
<img src="picture/Diablo/Abilities/Overpower.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Overpower(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">50mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">12秒</font>
<br class="fon2"><font color="fffff"><br>將目標抓起並摔向身後,對其造成40+(等級*6)傷害並擊暈0.25秒。</font>
</span>
<br>
<img src="picture/Diablo/Abilities/Apocalypse.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Apocalypse(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">120秒</font>
<br class="fon2"><font color="fffff"><br>在全地圖的所有敵方英雄腳下召喚惡魔符印,在短暫延遲後爆炸,造成100+(等級*10)傷害和2秒擊暈效果。</font>
</span>
<br>
<img src="picture/Diablo/Abilities/Lightning Breath.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Lighting Breath(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">60秒</font>
<br class="fon2"><font color="fffff"><br>在前方噴吐雷電持續5秒,可以由滑鼠控制方向,造成共計400+(等級*80)點傷害。</font>
</span>
<br>
<img src="picture/Diablo/Abilities/Black Soulstone.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Black Soulstone(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">5</font>
<br class="fon2"><font color="fffff"><br>每擊殺1個英雄將獲得10塊靈魂石,每擊殺1個小兵將獲得1塊靈魂石,每塊靈魂石將提升5點最大生命值。當收集到100塊時,復活時間將縮短為5秒,<br>同時會消耗100塊靈魂石,靈魂石最大持有數量為100。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/1/Regeneration Master.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Regeneration Master</span></font><br><font color="00ffff">收集3個生命恢復球就能永久增加每秒4點生命回復。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/1/Devil's Due.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Devil's Due</span></font><br><font color="00ffff">復活只會消耗75塊靈魂石。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/1/Soul Feast.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Soul Feast</span></font><br><font color="00ffff">每收集1塊靈魂石會提升5點生命值並增加0.1生命回復速度。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/1/Soul Steal.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Soul Steal(E)</span></font><br><font color="00ffff">使用Overpower將獲得3塊靈魂石。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/4/Amplified Healing.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Amplified Healing</span></font><br><font color="00ffff">提升30%治療與回復效果。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/4/Firestorm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Firestorm(W)</span></font><br><font color="00ffff">Fire Stomp(W)發出的火球會返回自身位置,對擊中的敵人造成50%的傷害。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒</font></span>
</div>
<div>
<img src="picture/Diablo/Talents/7/Endless Death.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Endless Death</span></font><br><font color="00ffff">可擁有靈魂石數量上限提升至200 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/7/Siphon the Dead.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Siphon the Dead</span></font><br><font color="00ffff">消耗1塊靈魂石回復3%最大生命值</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/10/Apocalypse.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Apocalypse(R)</span></font><br><font color="00ffff">在全地圖的所有敵方英雄腳下召喚惡魔符印,在短暫延遲後爆炸,造成100+(等級*10)傷害和2秒擊暈效果。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/10/Lightning Breath.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Lighting Breath(R) </span></font><br><font color="00ffff">在前方噴吐雷電持續5秒,可以由滑鼠控制方向,造成共計400+(等級*80)點傷害。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield</span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/13/Relentless.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Relentless</span></font><br><font color="00ffff">減少50%被沉默、擊暈、減速、定身的持續時間。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/13/From the Shadows.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">From the Shadows(Q)</span></font><br><font color="00ffff">Shadow Charge(Q)技能範圍提升33%。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/13/Crippling Shadows.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Crippling Shadows(Q)</span></font><br><font color="00ffff">Shadow Charge(Q)使目標減少25%移動速度,持續3秒。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/16/Imposing Presence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Presence</span></font><br><font color="00ffff">受到攻擊時,攻擊者降低30%攻擊速度。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/16/Swallowing Flames.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Swollowing Flame(W)</span></font><br><font color="00ffff">Fire Stomp(W)攻擊範圍提升50%。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/16/Fire Devil.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fire Devil(W))</span></font><br><font color="00ffff">Fire Stomp(W)施放後會被火焰圍繞10秒,每秒內對周圍敵人造成15+(等級*3)傷害。</font></span>
</div>
<div>
<img src="picture/Diablo/Talents/16/Continuous Overpower.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Continuous Overpower(E)</span></font><br><font color="00ffff">連續使用2次Overpower(E) </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Diablo/Talents/20/Storm Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm Shield</span></font><br><font color="00ffff">自身和周圍隊友產生最大生命值30%的護盾,持續時間3秒。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm</span></font><br><font color="00ffff">傳送至附近目標位置。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/20/Dying Breath.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dying Breath(R)</span></font><br><font color="00ffff">死亡時會觸發Apocalypse(R)。 </font></span>
</div>
<div>
<img src="picture/Diablo/Talents/20/Endless Lightning.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Endless Lighting(R)</span></font><br><font color="00ffff">Lighting Breath(R)持續時間與範圍提升50%。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/telent.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$telentID = $_GET['id'];
$output = "";
if(isset($telentID)) {
$telent = getAbility($telentID);
$output = '
<div class="lead">
<div>
<h3>種類:</h3>'.$telent['type'].'
</div>
<div>
<h3>招式名稱:</h3>'.$telent['name'].'
</div>
<div>
<h3>冷卻時間:</h3>'.$telent['cool_down'].'
</div>
<div>
<h3>招式消耗:</h3>'.$telent['cost'].'
</div>
<div>
<h3>招式消耗種類:</h3>'.$telent['cost_type'].'
</div>
<div>
<h3>持續時間:</h3>'.$telent['time'].'
</div>
<div>
<h3>招式射程:</h3>'.$telent['range'].'
</div>
<div>
<h3>招式說明:</h3>'.nl2br($telent['description']).'
</div>
</div>';
}
else {
$list = getAllAbility("天賦");
$output = '
<h1>所有天賦</h1>
<div class="lead">
<table class="table hero_table">';
foreach ($list as $telent) {
$output = $output.'
<tr>
<td class="title"><a href="skill.php?id='.$telent['id'].'">'.$telent['name'].'</a></td>
<td>
<form method="post" action="modify_ability.php">
<input type="hidden" name="id" value="'.$telent['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_ability.php">
<input type="hidden" name="id" value="'.$telent['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>';
}
$output = $output.'
</table>
</div>';
}
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/admin/js/graph_setting.js
$(".graph_setting_form #hero_graph").click(function() {
$(".option_block").html("");
});
$(".graph_setting_form #ability_graph").click(function() {
$(".option_block").html("<div>選擇英雄</div>");
$(".option_block").append("<select id='hero_id' name='hero_id'></select>");
$(".option_block").append("<div class='choose_ability_block'></div>");
$(".option_block").append("<div class='graph_block'></div>");
// list all hero in select
$(".option_block #hero_id").append("<option value=0>--請選擇--");
$.ajax({
url: "/admin/ajax/graph_setting.php",
data: {'method':'LIST_HERO'},
type: "POST",
dataType: "text",
success: function(result) {
var parseJson = JSON.parse(result);
var return_obj = eval(parseJson);
for(var item in return_obj) {
$(".option_block #hero_id").append("<option value="+item+">"+return_obj[item]);
}
},
error: function(result) {}
});
// when select, find hero ability
$(".option_block #hero_id").change(function() {
var uid = $(".option_block #hero_id option:selected").val();
var name = $(".option_block #hero_id option:selected").text();
$(".graph_block").html("");
if(uid==0) {
$(".choose_ability_block").html("");
return;
}
$(".choose_ability_block").html("<div>選擇技能</div>");
$(".choose_ability_block").append("<select id='ability_id' name='ability_id'></select>");
// list all hero ability
$(".choose_ability_block #ability_id").append("<option value=0>--請選擇--");
$.ajax({
url: "/admin/ajax/graph_setting.php",
data: {'method':'LIST_HERO_ABILITY', 'uid':uid},
type: "POST",
dataType: "text",
success: function(ability_result) {
var parseJson = JSON.parse(ability_result);
var return_obj = eval(parseJson);
for(var item in return_obj) {
$(".option_block #ability_id").append("<option value="+item+">"+return_obj[item]);
}
},
error: function(result) {}
});
// when select hero ability, list all picture
$(".choose_ability_block #ability_id").change(function() {
var aid = $(".choose_ability_block #ability_id option:selected").val();
var atype = $(".choose_ability_block #ability_id option:selected").text().split('-');
// get aid type
// alert(uid+" "+aid+" "+atype[1]);
if(aid==0) {
$(".graph_block").html("");
return;
}
// get all picture
$(".graph_block").html("<form class='choose_method'></form>");
$(".graph_block .choose_method").append("<div class='float'><input type='radio' name='picture_method' value='select' />選擇圖片</div>");
$(".graph_block .choose_method").append("<div class='float'><input type='radio' name='picture_method' value='upload' />上傳圖片</div>");
$(".graph_block .choose_method").append("<div class='spacer'/>");
$(".graph_block").append("<div class='choose_graph_block'></div>");
$(".graph_block .choose_method input").change(function() {
var picture_method = $(".graph_block .choose_method input:checked").val();
if(picture_method=="select") {
$(".choose_graph_block").html("<div>選擇圖片</div>");
$(".choose_graph_block").append("<select id='graph_path' name='graph_path'></select>");
$(".choose_graph_block #graph_path").append("<option value=0>--請選擇--");
$(".choose_graph_block").append("<div class='show_graph'></div>");
$.ajax({
url: "/admin/ajax/graph_setting.php",
data: {'method':'LIST_GRAPH'},
type: "POST",
dataType: "text",
success: function(graph_result) {
//alert(graph_result);
// var parseJson = JSON.parse(graph_result);
var return_obj = eval(graph_result);
for(var item in return_obj) {
$(".choose_graph_block #graph_path").append("<option value="+item+">"+return_obj[item]);
}
},
error: function(result) {}
});
$(".choose_graph_block #graph_path").change(function() {
var token = $(".choose_graph_block #graph_path option:selected").text();
if(token==0) {
$(".show_graph").html("");
return;
}
var path = token.substring(26);
$(".show_graph").html("<img src='"+path+"' height='100px width='100px'>");
$(".show_graph").append("<br/><button id='graph_submit'>submit</button>");
$(".show_graph #graph_submit").click(function() {
$.ajax({
url: "/admin/ajax/graph_setting.php",
data: {'method':'UPDATE_ABILITY_GRAPH', 'id':aid, 'type':atype[1], 'path':path},
type: "POST",
dataType: "text",
success: function(update_ability_graph_result) {
alert(update_ability_graph_result);
},
error: function(result) {}
});
});
});
}
else {
//upload
$(".choose_graph_block").html("");
}
});
});
});
});
<file_sep>/SONYA.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="SONYA"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Sonya/300_300/SONYA.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:SONYA</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:930(每等+210)<br><br>生命回復:1.938(每等+0.5)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:38(每等+7)<br><br>攻擊速度:0.8</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
來自北方寒風凜冽恐懼之地,兇悍野蠻人戰士族群。在經歷了家破族滅的災厄之後,在庇護所世界中遊蕩,尋求戰鬥和她族人們的安身之處。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
依靠怒氣的戰士,她的攻擊和技能會吸取敵人的生命力,並在怒氣磅礡難以抵擋。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Sonya/Abilities/Ancient Spear.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Anciet Spear(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力->怒氣</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">13秒</font>
<br class="fon2"><font color="fffff"><br>投擲一根長矛並將自己拉向第一個被擊中的敵人,造成70+(等級*14)傷害並短暫地擊暈他們。如果此技能擊中,獲得20點怒氣。</font>
</span>
<br>
<img src="picture/Sonya/Abilities/Seismic Slam.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Seismic Slam(W) </font>
<font color ="fffff" class="fon"> 耗費魔力->怒氣</font>
<font color ="ffff" class="fon">15mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">1秒</font>
<br class="fon2"><font color="fffff"><br>對敵人造成90+(等級*13)傷害,對目標後面的敵人造成23+(等級*3)傷害。</font>
</span>
<br>
<img src="picture/Sonya/Abilities/Fury.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Fury </font>
<font color ="fffff" class="fon"> 耗費魔力->怒氣</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">X</font>
<br class="fon2"><font color="fffff"><br>使用怒氣而不是魔力。受到傷害和造成傷害時獲得怒氣。使用技能後增加10%的移動速度,持續4秒。</font>
</span>
<br>
<img src="picture/Sonya/Abilities/Whirlwind.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Whirlwind(E) </font>
<font color ="fffff" class="fon"> 耗費魔力->怒氣</font>
<font color ="ffff" class="fon">20mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">1秒</font>
<br class="fon2"><font color="fffff"><br>3秒內對附近敵人造成140+(等級*28)傷害,傷害的20%轉化為治療。</font>
</span>
<br>
<img src="picture/Sonya/Abilities/Wrath of the Berserker.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Wrath of the Berserker(R) </font>
<font color ="fffff" class="fon"> 耗費魔力->怒氣</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">30秒</font>
<br class="fon2"><font color="fffff"><br>基礎攻擊和技能攻擊增加額外30%的傷害,被沉默、擊暈、減速、定身的持續時間減少50%,持續10秒每增加4點怒氣可以延長1秒持續時間。</font>
</span>
<br>
<img src="picture/Sonya/Abilities/Leap.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Leap(R) </font>
<font color ="fffff" class="fon"> 耗費魔力->怒氣</font>
<font color ="ffff" class="fon">X</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">50秒</font>
<br class="fon2"><font color="fffff"><br>跳向空中,對附近敵人造成50+(等級*11)傷害,並暈眩他們1.5秒。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/1/Path of the Warrior.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Path of the Warrior</span></font><br><font color="00ffff">英雄每級額外增加35最大血量。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/1/Endless Fury.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Endless Fury</span></font><br><font color="00ffff">怒氣值上限增加至150。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/1/Shot of Fury.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Short of Fury </span></font><br><font color="00ffff">主動技,增加25點怒氣。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/1/War Paint.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">War Point</span></font><br><font color="00ffff">基礎功及傷害的25%轉為治療。 </font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/4/Superiority.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Superiority</span></font><br><font color="00ffff">來自非英雄的傷害減少50%。</font></span>
</div>
<div>
<img src="picture/Sonya/Talents/4/Focused Attack.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Focused Attack</span></font><br><font color="00ffff">每10秒,下次基礎攻擊增加額外50%傷害,每次基礎功及減少冷卻時間1秒。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/4/Boon Of The Ancients.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Boon on the Ancients(Q)</span></font><br><font color="00ffff">Anciet Spear(Q)擊中敵人時減少冷卻時間5秒。</font></span>
</div>
<div>
<img src="picture/Sonya/Talents/4/Furious Blow.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Furious Blow(W)</span></font><br><font color="00ffff">Seismic Slam(W)傷害提高50%,怒氣消耗增加至20。</font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/7/Block.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Block</span></font><br><font color="00ffff">週期性的減少50%來自英雄的基礎攻擊,最多可以疊加兩層。</font></span>
</div>
<div>
<img src="picture/Sonya/Talents/7/Poisoned Spear.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Poisoned Spear(Q)</span></font><br><font color="00ffff">Anciet Spear(Q)在4秒內增加50%傷害。</font></span>
</div>
<div>
<img src="picture/Sonya/Talents/7/Shattered Ground.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Shattered Ground(W)</span></font><br><font color="00ffff">Seismic Slam(W)對主要目標傷害增加100%。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/7/fer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Ferocious Healing</span></font><br><font color="00ffff">主動技,回復最大生命值10%。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/10/Leap.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Leap(R) </span></font><br><font color="00ffff">跳向空中,對附近敵人造成50+(等級*11)傷害,並暈眩他們1.5秒。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/10/Wrath of the Berserker.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Wrath of the Berserker(R) </span></font><br><font color="00ffff">基礎攻擊和技能攻擊增加額外30%的傷害,被沉默、擊暈、減速、定身的持續時間減少50%,持續10秒每增加4點怒氣可以延長1秒持續時間。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Composite Spear(Q) </span></font><br><font color="00ffff">Anciet Spear(Q)距離增加30%。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/13/Aftershock.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Aftershock(W)</span></font><br><font color="00ffff">Seismic Slam(W)減少50%怒氣消耗。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/13/Wind Shear.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Wind Shear(E) </span></font><br><font color="00ffff">Whirlwind(E)移除所有限制移動速度的負面效果,治癒量增加至25%。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/13/Dust Devils.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Dust Devils(E)</span></font><br><font color="00ffff">Whirlwind(E)傷害增加25%。 </font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/16/Imposing Presence.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Imposing Presence</span></font><br><font color="00ffff">受到攻擊時,攻擊者降低30%攻擊速度。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/16/Mystical Spear.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Mystical Spear(Q) </span></font><br><font color="00ffff">Anciet Spear(Q)未擊中敵人也會將自己拉至目標地點,但不會獲得怒氣。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/16/Enduring Whirlwind.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Enduring Whirlwind(E)</span></font><br><font color="00ffff">Whirlwind(E)持續時間變為2倍。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/16/No Escape.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">No Escape </span></font><br><font color="00ffff">使用技能時增加的移動速度變為20%。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin</span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。 </font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Sonya/Talents/20/Resurgence of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Resurgence of the Storm </span></font><br><font color="00ffff">死亡後於5秒後在祭壇復活,冷卻時間120秒。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm </span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/20/Arreat Crater.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Arreat Crater(R)</span></font><br><font color="00ffff">跳躍至指定地點,並在目標地點周圍建立一個無法跨越的地形。 </font></span>
</div>
<div>
<img src="picture/Sonya/Talents/20/Anger Management.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Anger Management(R) </span></font><br><font color="00ffff">得2點怒氣可以延長Wrath of the Berserker(R)持續時間1秒,被沉默、擊暈、減速、定身的持續時間減少至75%。 </font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/VALLA.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="<NAME>">
<link rel="shortcut icon" href="picture/OVE.LOGO.png">
<title>最詳細的情報就在"傲飛娛樂""</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/hero.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<!--上排按鈕-->
<div class="navbar-wrapper btn-group-justified ">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header ">
<button type="button" class="navbar-toggle " data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">傲飛</a>
</div>
<div class="navbar-collapse collapse ">
<ul class="nav navbar-nav ">
<li><a href="activity.php">活動</a></li>
<li><a href="announcement.php">公告</a></li>
<li><a href="about_us.php">關於傲飛</a></li>
<li><a href="hero.php">暴雪英霸情報</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once 'class/User.php';
if(isLogin())
echo '
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$_COOKIE['name'].'<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="modify_user.php">修改帳號設定</a></li>
<li><a href="logout.php">登出</a></li>
</ul>
</li>
';
else {
echo '
<li><a href="login.php">登入</a></li>
<li><a href="register.php">註冊</a></li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--上排按鈕結束-->
<!--英雄選擇圖片-->
<div class="topbackground " >
<div class="container-fluid">
<div class="row hero_form_firstrow">
<div class="col-xs-1 col-md-1"><a href="hero.php" class="thumbnail piccol"><img src="picture/100_100/ETC.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ABATHUR.php" class="thumbnail piccol"><img src="picture/100_100/ABATHUR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ARTHAS.php" class="thumbnail piccol"><img src="picture/100_100/ARTHAS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="BRITHTWING.php" class="thumbnail piccol"><img src="picture/100_100/BRITHTWING.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="DIABLO.php" class="thumbnail piccol"><img src="picture/100_100/DIABLO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="FALSTAD.php" class="thumbnail piccol"><img src="picture/100_100/FALSTAD.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="GAZLOWE.php" class="thumbnail piccol"><img src="picture/100_100/GAZLOWE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ILLIDAN.php" class="thumbnail piccol"><img src="picture/100_100/ILLIDAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="LILI.php" class="thumbnail piccol"><img src="picture/100_100/LILI.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MALFIRION.php" class="thumbnail piccol"><img src="picture/100_100/MALFIRION.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURADIN.php" class="thumbnail piccol"><img src="picture/100_100/MURADIN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="MURKY.php" class="thumbnail piccol"><img src="picture/100_100/MURKY.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NAZEEBO.php" class="thumbnail piccol"><img src="picture/100_100/NAZEEBO.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NERRIGAN.php" class="thumbnail piccol"><img src="picture/100_100/NERRIGAN.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="NOVA.php" class="thumbnail piccol"><img src="picture/100_100/NOVA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="RAYNOR.php" class="thumbnail piccol"><img src="picture/100_100/RAYNOR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="SONYA.php" class="thumbnail piccol"><img src="picture/100_100/SONYA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STGHAMMER.php" class="thumbnail piccol"><img src="picture/100_100/STGHAMMER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="STITCHES.php" class="thumbnail piccol"><img src="picture/100_100/STITCHES.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TASSADAR.php" class="thumbnail piccol"><img src="picture/100_100/TASSADAR.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYCHUS.php" class="thumbnail piccol"><img src="picture/100_100/TYCHUS.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYRANDE.php" class="thumbnail piccol"><img src="picture/100_100/TYRANDE.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="TYREAL.php" class="thumbnail piccol"><img src="picture/100_100/TYREAL.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="UTHER.php" class="thumbnail piccol"><img src="picture/100_100/UTHER.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="VALLA.php" class="thumbnail piccol"><img src="picture/100_100/VALLA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZAGARA.php" class="thumbnail piccol"><img src="picture/100_100/ZAGARA.png" ></a></div>
<div class="col-xs-1 col-md-1"><a href="ZERATUL.php" class="thumbnail piccol"><img src="picture/100_100/ZERATUL.png" ></a></div>
</div>
</div>
</div>
<!--英雄選擇圖片結束-->
<!-- content here-->
<div class="contentbackground" >
<div class="contenttext ">
<div class="VALLA"><!--到hero.css找.英雄名稱,左邊英雄之後改掉背景圖片即可換掉英雄背景,規格1200*900px-->
<!--圖片左方能力區-->
<div class="imf">
<img src="picture/Valla/300_300/VALLA.png"><!--路徑記得放到picture底下,圖片名稱記得要一樣,甚麼英雄就用什模圖片名稱,規格300*300-->
<span><h3><font color="fffff" class="fon">英雄名稱:E.T.C.</font></h3></span>
<br><br>
<span><font color ="00ff00" class="hp_text"><h3>生命:700(每等+110)<br><br>生命回復:1.461(每等+0.227)</h3></font></span>
<span><font color ="00ffff" class="mana_text"><h3>魔法:500(每等+10)<br><br>魔力回復:3(每等+0.098)</h3></font></span>
<span><font color ="ff3333" class="attack_text"><h3>攻擊傷害:28(每等+9)<br><br>攻擊速度:0.6</h3></font></span>
</div>
<!--圖片左方能力區結束-->
<!--文字說明-->
<div class="panel-group hero_text" id="accordion">
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
英雄介紹
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
親眼目睹了惡魔的暴虐後虐,整個村莊被屠戮一空,只剩她被留下等死。如今,她不顧一切,為了自己的宿業四處遊走,只為了將庇護世界從惡魔的腐化中拯救出來。
</div>
</div>
</div>
<div class="panel panel-default ">
<div class="panel-heading ">
<h4 class="panel-title ">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
英雄小知識
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse in">
<div class="panel-body"><!--以下文字要改成英雄介紹的翻譯-->
擅長從遠處攻擊敵人,並在不斷的攻擊中獲得可觀的攻擊速度與移動速度。當敵人逼近時,她也能迅速的躲避危險。
</div>
</div>
</div>
</div>
<!--文字說明結束-->
</div>
<!--能力說明-->
<div class="ability">
<span ><font color="#fffff"><h1>英雄能力</h1></font></span>
<img src="picture/Valla/Abilities/Hungering Arrow.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hungering Arrow(Q) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">14秒</font>
<br class="fon2"><font color="fffff"><br>對第一個接觸到的目標造成66+(等級*15)傷害,然後尋找額外最多2個目標,造成32+(等級*8)傷害。可以攻擊一個敵人多次。</font>
</span>
<br>
<img src="picture/Valla/Abilities/Multishot.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Multishot(W) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">60mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">8秒</font>
<br class="fon2"><font color="fffff"><br>對前方錐形造成60+(等級*15)的傷害</font>
</span>
<br>
<img src="picture/Valla/Abilities/Vault.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Vault(E) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">75mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">10秒</font>
<br class="fon2"><font color="fffff"><br>翻轉至目標區域</font>
</span>
<br>
<img src="picture/Valla/Abilities/Strafe.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Strafe(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">80mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">50秒</font>
<br class="fon2"><font color="fffff"><br>快速攻擊附近敵人,每擊中一次造成10+(等級*5)傷害。在掃射過程中可以移動並使用Vault,持續3秒。</font>
</span>
<br>
<img src="picture/Valla/Abilities/Rain of Vengeance.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Rain of Vengeance(R) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">100mana</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">90秒</font>
<br class="fon2"><font color="fffff"><br>發射2波箭雨,對范圍內的敵人造成100+(等級*23)傷害,每波擊暈他們0.5秒。</font>
</span>
<br>
<img src="picture/Valla/Abilities/Hatred.png" class="ability_pic">
<span class="ability_text">
<font color ="fffff" class="fon">Hatred(D) </font>
<font color ="fffff" class="fon"> 耗費魔力:</font>
<font color ="ffff" class="fon">xx</font>
<font color ="fffff" class="fon"> 冷卻時間:</font>
<font color ="ffff" class="fon">xx</font>
<br class="fon2"><font color="fffff"><br>處於攻擊狀態下每次攻擊增加2%攻擊傷害和1%移動速度,最多可疊至10層,離開戰鬥狀態後逐層下降。</font>
</span>
</div>
<!--能力說明結束-->
<!--天賦說明-->
<div class="talent">
<span ><font color="#fffff"><h1>天賦能力</h1></font></span>
<!--等級1-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級1可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/1/Cost-Effective Materials.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Cost-Effective Materials(Q)</span></font><br><font color="00ffff">減少Hungering Arrow的30耗魔量。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/1/Siphoning Arrow.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Siphoning Arrow(Q)</span></font><br><font color="00ffff">會恢復此技能Hungering Arrow所造的50%傷害。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/1/Composite Arrows.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Composite Arrow(W)</span></font><br><font color="00ffff">提升Multishot的攻擊範圍20%。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/1/Rancor.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rancor </span></font><br><font color="00ffff">Hatred同時也會增加每層2%攻擊速度。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/1/Punishment.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Punishment </span></font><br><font color="00ffff">使用技能時獲得2層Hatred。</font></span>
</div>
</div>
<!--等級1結束-->
<!--等級4-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級4可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/4/Vampiric Assault.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Vampiric Assault</span></font><br><font color="00ffff">基礎攻擊15%的傷害回覆自身生命。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/4/Manticore.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Manticore</span></font><br><font color="00ffff">每3下基礎攻擊對相同目標造成額外50%傷害。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/4/Puncturing Arrow.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Puncturing Arrow(Q)</span></font><br><font color="00ffff">Hungering Arrow射程增加25%尋找目標增加至3個。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/4/Arsenal.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Arsenal(W)</span></font><br><font color="00ffff">Multishot增加三個手榴彈造成34+(等級*8)的傷害。 </font></span>
</div>
</div>
<!--等級4結束-->
<!--等級7-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級7可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/7/Battle Momentum.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Battle Momentum</span></font><br><font color="00ffff">普通攻擊將減少技能冷卻0.5秒。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/7/Repeating Arrow.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Repeating Arrow(E)</span></font><br><font color="00ffff">使用Vault會重置Hungering Arrow的冷卻時間。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/7/Caltrops.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Caltrops(E)</span></font><br><font color="00ffff">使用Vault後路徑上會留下三個地雷造成25+(等級*2)傷害並減少敵方20%移動速度持續2秒</font></span>
</div>
<div>
<img src="picture/Valla/Talents/7/Searing Attacks.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Searing Attacks </span></font><br><font color="00ffff">主動技,基礎攻擊提升50%持續5秒。每次攻擊消耗15點法力值。</font></span>
</div>
</div>
<!--等級7結束-->
<!--等級10-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級10可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/10/Strafe.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Strafe(R)</span></font><br><font color="00ffff">快速攻擊附近敵人,每擊中一次造成10+(等級*5)傷害。在掃射過程中可以移動並使用Vault,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/10/Rain of Vengeance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Rain of Vengeance(R) </span></font><br><font color="00ffff">發射2波箭雨,對范圍內的敵人造成100+(等級*23)傷害,每波擊暈他們0.5秒。 </font></span>
</div>
</div>
<!--等級10結束-->
<!--等級13-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級13可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/13/Giant Killer.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Giant Killer</span></font><br><font color="00ffff">基礎攻擊對敵方英雄造成額外最大生命1.5%的傷害。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/13/Spell Shield.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Spell Shield </span></font><br><font color="00ffff">週期性的減少50%來自英雄技能的傷害,最多可以充能兩次。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/13/Frost Shot.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Frost Shot(W)</span></font><br><font color="00ffff">Multishot可造成20%緩速效果持續2秒。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/13/Hot Pursuit.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Hot Pursuit</span></font><br><font color="00ffff">當Hatred疊至10層時移動速度增至20%。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/13/Tempered by Discipline.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tempered by Discipline </span></font><br><font color="00ffff">Hatred層數上限可疊至20層,10層後每層可獲得3%的普攻吸血。</font></span>
</div>
</div>
<!--等級13結束-->
<!--等級16-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級16可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/16/Executioner.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Executioner</span></font><br><font color="00ffff">基礎攻擊對被減速、被定身、被擊暈的目標造成40%額外傷害。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/16/Tumble.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Tumble(E)<span></font><br><font color="00ffff">使Vault多一個充能機會,可在短時間內施放兩次。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/16/Blood for Blood.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Blood for Blood</span></font><br><font color="00ffff">主動技,吸取目標敵人15%最大生命值,並使其移動速度降低30%,持續3秒。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/16/Stoneskin.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Stoneskin </span></font><br><font color="00ffff">主動技,使用後獲得最大生命值30%的護甲值,持續5秒。</font></span>
</div>
</div>
<!--等級16結束-->
<!--等級20-->
<div class="level">
<span><font color ="fffff" class="fon"> 等級20可點天賦 </font></span>
<div>
<img src="picture/Valla/Talents/20/Fury of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Fury of the Storm</span></font><br><font color="00ffff">基礎攻擊彈跳兩次到目標附近敵人身上造成50%傷害。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/20/Bolt of the Storm.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Bolt of the Storm<span></font><br><font color="00ffff">傳送至附近目標位置。</font></span>
</div>
<div>
<img src="picture/Valla/Talents/20/Trigger Happy.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Trigger Happy(R)</span></font><br><font color="00ffff">Strafe會增加25%傷害並增加20%的攻擊範圍。 </font></span>
</div>
<div>
<img src="picture/Valla/Talents/20/Storm of Vengeance.png" class="level_pic">
<span class="level_text"><font color ="fffff" ><span class="fon">Storm of Vengeance(R) </span></font><br><font color="00ffff">Rain of Vengeance增加至4波箭雨。</font></span>
</div>
</div>
<!--等級20結束-->
</div>
<!--天賦說明結束-->
</div>
</div>
<!-- content here end-->
<!-- page tail -->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="footer small text-center">
<ul class="list-inline">
<li>Copyright ©</li>
<li>2014 傲飛娛樂有限公司 All Rights Reserved</li>
<li><NAME></li>
<li><NAME></li>
</ul>
</div>
</div>
</nav>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="js/jquery-1.11.1.js"></script> -->
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<!-- <script src="js/docs.min.js"></script> -->
</body>
</html>
<file_sep>/admin/add_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/SqlProtecter.php';
require_once 'class/HOS.php';
if(isLogin()) {
$name = $_POST['name'];
$type = $_POST['type'];
$cool_down = $_POST['cool_down'];
$cost = $_POST['cost'];
$cost_type = $_POST['cost_type'];
$time = $_POST['time'];
$range = $_POST['range'];
$description = $_POST['description'];
if(isset($name)) {
$data = new AbilityData();
$data->name_ = $name;
$data->type_ = $type;
$data->cool_down_ = $cool_down;
$data->cost_ = $cost;
$data->cost_type_ = $cost_type;
$data->time_ = $time;
$data->range_ = $range;
$data->description_ = $description;
addAbility($data);
if($type == "技能")
header("Location:skill.php");
else
header("Location:telent.php");
}
else {
$frame = new Frame();
$output = '
<h1>新增技能/天賦</h1>
<div class="lead">
<form method="post" action="">
<div>
<h3>種類:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="type" value="技能">技能<br></div>
<div class="float"><input type="radio" name="type" value="天賦">天賦<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>招式名稱:</h3>
<input type="text" name="name">
</div>
<div>
<h3>冷卻時間:</h3>
<input type="text" name="cool_down">
</div>
<div>
<h3>招式消耗:</h3>
<input type="text" name="cost">
</div>
<div>
<h3>招式消耗種類:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="cost_type" value="魔力">魔力<br></div>
<div class="float"><input type="radio" name="cost_type" value="怒氣">怒氣<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>持續時間:</h3>
<input type="text" name="time">
</div>
<div>
<h3>招式射程:</h3>
<input type="text" name="range">
</div>
<div>
<h3>招式說明:</h3>
<textarea rows="10" cols="80%" name="description"></textarea>
</div>
</br>
<button class="btn btn-primary" type="submit">新增</button>
<a href="/admin"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</dvi>';
$frame->get_main_frame($output);
}
}
else {
header("Location:/admin");
}
?><file_sep>/admin/activity.php
<?php
require_once 'class/Frame.php';
require_once 'class/activity.php';
require_once 'class/SqlProtecter.php';
require_once 'class/User.php';
require_once 'class/present.php';
require_once 'class/ACTPage.php';
if(isLogin()) {
$frame = new Frame();
$ACTid = $_GET['id'];
$output = "";
echo $_POST['present'];
if(hasIllegalChar($ACTid)) {
header("Location:/activity.php");
}
else if(isset($ACTid) && hasACT($ACTid)) {
$ACT = showACT($ACTid);
$output = $output . '
<table class="table">
<tr>
<td class="activity_title">
<h1>'.$ACT['title'].'</h1>
</td>
<td class="activity_date">'.date("Y-m-d",strtotime($ACT['ACT_date'])).' </td>
</tr>
</table>
<div class="lead activity_detail">
'.nl2br($ACT['content']).'
</div>';
}
else {
$list = showActiveACT();
$output = '
<h1>所有活動</h1>
<div class="lead">
<table class="table">';
foreach ($list as $ACT) {
$output = $output.'
<tr>
<td class="activity_title">
<form method="get" action="activity.php" class="activity_form">
<input type="hidden" name="id" value="'.$ACT['id'].'">
<input type="submit" class="activity_linkButton" value="'.$ACT['title'].'">
</form>
</td>
<td class="activity_date">'.date("Y-m-d",strtotime($ACT['ACT_date'])).'</td>
<td>
<form method="post" action="who_attend.php" class="announcement_form">
<input type="hidden" name="id" value="'.$ACT['id'].'">
<button class="btn btn-primary" type="submit">查看報名資訊</button>
</form>
</td>
<td>
<form method="post" action="modify_activity.php">
<input type="hidden" name="id" value="'.$ACT['id'].'">
<button class="btn btn-primary" type="submit">修改</button>
</form>
</td>
<td>
<form method="post" action="delete_activity.php" class="activity_form">
<input type="hidden" name="id" value="'.$ACT['id'].'">
<button class="btn btn-primary" type="submit">刪除</button>
</form>
</td>
</tr>';
}
$output = $output.' </table>
</div><br/>';
}
$frame->get_main_frame($output);
}
else {
header("Location:/admin");
}
?>
<file_sep>/logdown/index.php
<?php
header('Location: http://mikekao.logdown.com/');
?><file_sep>/admin/modify_hero_ability.php
<?php
require_once 'class/Frame.php';
require_once 'class/User.php';
require_once 'class/HOS.php';
if(isLogin()) {
$frame = new Frame();
$output = "";
$uid = $_POST['uid'];
$id = $_POST['id'];
$type = $_POST['type'];
$button = $_POST['button'];
$level = $_POST['level'];
if(isset($type)) {
$data = new HeroAbilityData();
$data->uid_ = $uid;
$data->id_ = $id;
$data->type_ = $type;
$data->button_ = $button;
$data->level_ = $level;
updateHeroAbility($uid, $id, $data);
header("Location:list_hero_ability.php");
}
else if(isset($id)) {
$heroAbility = getHeroAbility($uid, $id);
$ability = getAbility($id);
$output = ' <h1>修改 技能/天賦 設定</h1>
<div class="lead">
<form method="post" action="">
<input type="hidden" name="uid" value="'.$uid.'">
<input type="hidden" name="id" value="'.$id.'">
<div>
<h3>'.$ability['name'].'</h3>
</div>
<div>
<h3>招式類型:</h3>
<div class="spacer"></div>
<div class="float"><input type="radio" name="type" value="技能" '.getHeroAbilityTypeCheck($uid, $id, "技能").'>技能<br></div>
<div class="float"><input type="radio" name="type" value="特性" '.getHeroAbilityTypeCheck($uid, $id, "特性").'>特性<br></div>
<div class="float"><input type="radio" name="type" value="天賦" '.getHeroAbilityTypeCheck($uid, $id, "天賦").'>天賦<br></div>
<div class="spacer"></div>
</div>
<div>
<h3>招式按鍵:</h3>
<input type="text" name="button" value="'.$heroAbility['button'].'">
</div>
<div>
<h3>天賦等級:</h3>
<input type="text" name="level" value="'.$heroAbility['level'].'">
</div>
</br>
<button class="btn btn-primary" type="submit">修改</button>
<a href="/admin/list_hero_ability.php"><button class="btn btn-primary" type="button">取消</button></a>
</form>
</div>';
$frame->get_main_frame($output);
}
else {
echo "error: modify heroability <br/>";
echo "error happened, please find baozi!";
}
}
else {
header("Location:/admin");
}
?>
| 0124512465d2ab94acce63ee706f4168d0f90b94 | [
"JavaScript",
"PHP"
] | 75 | PHP | mike79212001/oveweb | 97da3ad8cc34ca21932eff776ea1b739bde88975 | b7e8a84a63a961c7515cafcecbdc642b22dcdf9e |
refs/heads/master | <file_sep># Groups - Poetry Center
The Poetry Center group currently has no 'Custom JS/CSS Code' settings.
<file_sep>$(document).ready(function(){
// Remove links from profile images
$('.s-lib-profile-image').unwrap();
// Replace profile box title with "Your librarian"
$("div[id*='profile_box'] > h2").contents().replaceWith("Your librarian");
// remove empty p tags inserted after hr
$("hr + p").filter( function() {
return $.trim($(this).html()) == ' ';
}).remove();
// Remove breadcrumb links
$('#s-lib-bc').remove();
// Hide side tabs if there is only one page and no in-page navigation
var navigation = $("ul.nav-pills.nav-stacked");
var listitems = navigation.children();
if (navigation.children("li").length <= 1 && listitems.children("ul").length == 0) {
navigation.hide();
}
});
<file_sep># Groups - Arizona Health Sciences Library - Phoenix
'Custom JS/CSS Code' settings:
```html
<link href='https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/ual-styles.css' rel='stylesheet' type='text/css' />
<script src="https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/groups/ahsl-phx/ahsl-phx.js" type="text/javascript"></script>
```
'Exclude system level JS/CSS code.' should be checked.
<file_sep># Groups - English Composition
'Custom JS/CSS Code' settings:
```html
<link href='https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/ual-styles.css' rel='stylesheet' type='text/css' />
<link href='https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/ual-guide-styles.css' rel='stylesheet' type='text/css' />
<script src="https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/groups/english-composition/english-composition.js" type="text/javascript"></script>
```
'Exclude system level JS/CSS code.' should be checked.
<file_sep># Groups - Law Library
The Law Library group currently has no 'Custom JS/CSS Code' settings.
<file_sep># University of Arizona Libraries LibGuides Customizations
## Getting started
Run `npm install`
### What's here:
```sh
.
├── .csscomb.json # CSSComb settings
├── .editorconfig # Editorconfig settings
├── .gitignore
├── .travis.yml # Travis CI settings
├── LICENSE
├── README.md
├── dist # Where build artifacts go. Don't edit these directly
├── gulpfile.js # Gulp config
├── package-lock.json
├── package.json
├── shipitfile.js # Shipit deployment settings
└── src # Source files. You should edit these
```
## Scripts
`% npm run build:prod` - Builds the project (the build goes into the `dist` directory).
`% npm run csscomb` - Runs [csscomb](http://csscomb.com/) on all css files.
`% npm run deploy:prod` - Syncs the `dist` directory to the production AWS S3 bucket `ualibr-libguides-assets` using the 'default' profile. Append `-- <args>` to add arguments to the command. For example, to add an aws profile you would run:
```
% npm run deploy:prod -- --profile <name_of_profile>
```
## LibGuides settings
### System wide
In ['Admin' -> 'Look & Feel' -> 'Custom JS/CSS'](https://arizona.libapps.com/libguides/lookfeel.php), paste the following:
```html
<link href='http://www.library.arizona.edu/vendor-support/libguides/current/dist/ual-styles.css' rel='stylesheet' type='text/css' />
<script src="//v2.libanswers.com/load_chat.php?hash=07713bc057f66ebcdccd4dd1b4a2be3e"></script>
<script src="http://www.library.arizona.edu/vendor-support/libguides/current/dist/ual-scripts.js" type="text/javascript"></script>
```
### Groups
Groups can be edited in 'Admin' -> 'Groups'. Edit a group's JS/CSS settings by choosing the 'Edit' icon for the specific group and going to 'Custom JS/CSS Code'.
<file_sep>/**
* Customize breadcrumb links
*/
$(document).ready(function(){
// Remove the link to library.arizona.edu
$('#s-lib-bc-list li:first-child').remove();
// Rewrite LibGuides link to point to group guides page
$('#s-lib-bc-list a[href="http://libguides.library.arizona.edu"]')
.attr('href','http://libguides.library.arizona.edu/phx')
.text('AHSL Phoenix Guides');
});
<file_sep># Groups - University of Arizona Libraries
'Custom JS/CSS Code' settings:
```html
<link href='https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/ual-styles.css' rel='stylesheet' type='text/css' />
<link href='https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/ual-guide-styles.css' rel='stylesheet' type='text/css' />
<script src="//v2.libanswers.com/load_chat.php?hash=07713bc057f66ebcdccd4dd1b4a2be3e"></script>
<script src="https://ualibr-libguides-assets.s3-us-west-2.amazonaws.com/groups/ual/ual.js" type="text/javascript"></script>
```
'Exclude system level JS/CSS code.' should be checked.
<file_sep>/*
* LibGuides: Customize breadcrumb links
* - Change URL in .attr() and string in .text() to match group
* - Paste this code code between script tags in group level "Custom JS/CSS Code" area
*
*/
$(document).ready(function(){
// Remove link back to UAL main page
$('#s-lib-bc-list li:first-child').remove();
// Rewrite LibGuides link to point to group guides page
$('#s-lib-bc-list a[href="http://libguides.library.arizona.edu"]')
.attr('href','http://libguides.library.arizona.edu/ahsl')
.text('AHSL Guides');
});<file_sep>const gulp = require('gulp')
const localtunnel = require('localtunnel')
const connect = require('gulp-connect')
const localPort = 8000
// Default build tas
gulp.task('default', () => {
return gulp.src('src/**/*')
.pipe(gulp.dest('dist'))
})
gulp.task('serve', () => {
let tunnel = localtunnel(localPort, function(err, tunnel) {
if (err) {
console.warning(err)
}
console.log(`Your local url is: ${tunnel.url}`);
})
tunnel.on('close', function() {
// tunnels are closed
})
connect.server({
root: 'dist',
port: localPort,
debug: true
})
})
| 47e8c0445ec29b62a4e0c2c67950b66fb8cea092 | [
"Markdown",
"JavaScript"
] | 10 | Markdown | ualibraries/ual-libguides | 53cbc3ea612208657db708d57c7a3651827e75aa | 2757edcdfb6f40d7c7b2a8c03b35610c17011377 |
refs/heads/master | <file_sep>using System.Linq;
using System.Web.Mvc;
using WebApplication1.BusinessLogic;
namespace WebApplication1.Web.Controllers
{
public class HomeController : BaseController
{
private readonly IBlog _blog;
public HomeController()
{
var bl = new InstanceBL();
_blog = bl.GetBlogBL();
}
public ActionResult Index()
{
SessionStatus();
return View(_blog.GetAllPosts());
}
public ActionResult Detail(int id)
{
SessionStatus();
return View(_blog.GetPostById(id));
}
public ActionResult Top()
{
SessionStatus();
return View();
}
public ActionResult About()
{
SessionStatus();
return View();
}
}
} | f652375265b5f77624df58d898de1684ee2588ee | [
"C#"
] | 1 | C# | adipinga/Solution1 | 5d4fef5a4cb1e293df2b5005f27a8e495feed23f | 0945e4799133797fe2ccd886f272f62d906c19bb |
refs/heads/master | <repo_name>shaliniravi/TwitterScrape<file_sep>/twitter.py
__author__ = 'Shalini'
from TwitterSearch import *
import csv
def get_tweets(query, max = 20000):
# takes a search term (query) and a max number of tweets to find
# gets content from twitter and writes it to a csv bearing the name of your query
i = 0
search = query
with open(search+'.csv', 'wb') as outf:
writer = csv.writer(outf)
writer.writerow(['user','time','tweet','latitude','longitude'])
try:
tso = TwitterSearchOrder()
tso.set_keywords([search])
tso.set_language('en') # English tweets only
ts = TwitterSearch(
consumer_key = 'qPHhCyWFMCyNuJii6fhEytxAG',
consumer_secret = '<KEY>',
access_token = '<KEY>',
access_token_secret = '<KEY>'
)
for tweet in ts.search_tweets_iterable(tso):
lat = None
long = None
time = tweet['created_at']
# UTC time when Tweet was created.
user = tweet['user']['screen_name']
tweet_text = tweet['text'].strip().encode('ascii', 'ignore')
tweet_text = ''.join(tweet_text.splitlines())
print i,time,
if tweet['geo'] != None and tweet['geo']['coordinates'][0] != 0.0: # avoiding bad values
lat = tweet['geo']['coordinates'][0]
long = tweet['geo']['coordinates'][1]
print('@%s: %s' % (user, tweet_text)), lat, long
else:
print('@%s: %s' % (user, tweet_text))
writer.writerow([user, time, tweet_text, lat, long])
i += 1
if i > max:
return()
except TwitterSearchException as e: # take care of all those ugly errors if there are some
print(e)
query = raw_input ("Search for: ")
max_tweets = 20000
get_tweets(query, max_tweets) | b24d8cf9e27f5732d6213e4a2d96c3f3fdb7b9b2 | [
"Python"
] | 1 | Python | shaliniravi/TwitterScrape | ef3100878661173ca52d7912d4c740dbfa984f7e | fb4dd3d967058a0c471f65e31d3e8d7a6240140f |
refs/heads/master | <file_sep>using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Chest : Collectible
{
public Sprite emptyChess;
public int goldAmount = 5;
protected override void onCollect()
{
if (!collected)
{
collected = true;
GetComponent<SpriteRenderer>().sprite = emptyChess;
GameManager.instance.ShowText("+" + goldAmount + " gold!", 25, Color.yellow, transform.position, Vector3.up * 100, 0.5f);
}
}
}
<file_sep>using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Weapon : Collidable
{
// Damage
public int damagePoint = 1;
public float pushForce = 2.0f;
// Upgrade
public int weaponLevel = 0;
private SpriteRenderer spriteRenderer;
// Swing
private float cooldown = 1.0f;
private float lastSwing = 0f;
protected override void Start()
{
base.Start();
spriteRenderer = GetComponent<SpriteRenderer>();
}
protected override void Update()
{
base.Update();
if (Input.GetKeyDown("space"))
{
if (Time.time - lastSwing > cooldown)
{
lastSwing = Time.time;
Swing();
}
}
}
protected override void OnCollide(Collider2D coll)
{
//base.OnCollide(coll);
}
private void Swing()
{
Debug.Log("swing");
}
}
| 60d5f3cd4351dcca83bf34611728269941b81c62 | [
"C#"
] | 2 | C# | Keyrune/topdownrpg | b095613b1d5c8d9fcfe1700afff22a931993ec97 | 8d0ddd1b898152f054e1a3eae5d31f7945436c93 |
refs/heads/master | <repo_name>romanmartushev/FlightTracker<file_sep>/README.md
<h1>Flight Tracker</h1>
<p>Uses docker for local development</p>
<p>Uses composer and npm for package managing</p>
<h2>Development</h2>
<p>First run <code>composer install</code> then <code>npm install</code></p>
<p>Then <code>php artisan key:generate</code>. IF this does not work run <code>docker-compose up</code> then <code>docker-compose exec code php artisan key:genrate</code> then you might have to restart your containers or re-build</p>
<p>Finally <code>docker-compose up</code></p>
<p>This app uses google flights api which I believe at this moment is no loger supported. Needs to be changed in order for the app to work again.</p><file_sep>/app/Console/Commands/getFlightInfo.php
<?php
namespace App\Console\Commands;
use App\Flights;
use Illuminate\Console\Command;
class getFlightInfo extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'flights:getFlights';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Gets the flights';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
*/
public function handle()
{
$MSPToDFW = '{
"request": {
"passengers": {
"adultCount": 1
},
"slice": [
{
"origin": "MSP",
"destination": "DFW",
"date": "2017-11-14",
"maxStops": 0
},
{
"origin": "DFW",
"destination": "MSP",
"date": "2017-11-19",
"maxStops": 0
}
]
}
}';
$MSPToSEA = '{
"request": {
"passengers": {
"adultCount": 1
},
"slice": [
{
"origin": "MSP",
"destination": "SEA",
"date": "2017-11-14",
"maxStops": 0
},
{
"origin": "SEA",
"destination": "MSP",
"date": "2017-11-19",
"maxStops": 0
}
]
}
}';
$PDXToANC = '{
"request": {
"passengers": {
"adultCount": 1
},
"slice": [
{
"origin": "PDX",
"destination": "ANC",
"date": "2017-11-14",
"maxStops": 0
},
{
"origin": "ANC",
"destination": "PDX",
"date": "2017-11-19",
"maxStops": 0
}
]
}
}';
$first = $this->getFlights($MSPToDFW);
$second = $this->getFlights($MSPToSEA);
}
public function getFlights($postData){
$array = [];
$array1 = [];
$url = "https://www.googleapis.com/qpxExpress/v1/trips/search?key=".env("Flights_API_KEY");
$curlConnection = curl_init();
curl_setopt($curlConnection, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($curlConnection, CURLOPT_URL, $url);
curl_setopt($curlConnection, CURLOPT_POST, TRUE);
curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $postData);
curl_setopt($curlConnection, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlConnection, CURLOPT_SSL_VERIFYPEER, FALSE);
$results = curl_exec($curlConnection);
$response = json_decode($results);
curl_close ($curlConnection);
$depAirline = $response->trips->tripOption[0]->slice[0]->segment[0]->flight->carrier;
$depFlightNumber = $response->trips->tripOption[0]->slice[0]->segment[0]->flight->number;
$retAirline = $response->trips->tripOption[0]->slice[1]->segment[0]->flight->carrier;
$retFlightNo = $response->trips->tripOption[0]->slice[1]->segment[0]->flight->number;
$fare = $response->trips->tripOption[0]->pricing[0]->saleTotal;
$date= date("Y-m-d");
$time = date("H:i:s");
array_push($array,$date);
array_push($array,$time);
array_push($array,$depAirline);
array_push($array,$depFlightNumber);
array_push($array,$retAirline);
array_push($array,$retFlightNo);
array_push($array,explode("USD",$fare)[1]);
$file = fopen('flights.csv','a');
fputcsv($file,$array);
fclose($file);
array_push($array1,$depAirline);
array_push($array1,$depFlightNumber);
array_push($array1,$retAirline);
array_push($array1,$retFlightNo);
array_push($array1,$fare);
$fare = explode("USD",$fare)[1];
$flight = new Flights();
$flight->date = $date;
$flight->time = $time;
$flight->depAirline = $depAirline;
$flight->depFlightNo = $depFlightNumber;
$flight->retAirline = $retAirline;
$flight->retFlightNo = $retFlightNo;
$flight->fare = $fare;
$flight->comment = '';
$flight->save();
}
}
<file_sep>/app/Http/Controllers/FlightController.php
<?php
/**
* Created by PhpStorm.
* User: Roman
* Date: 8/25/17
* Time: 4:06 PM
*/
namespace App\Http\Controllers;
use App\Flights;
use Carbon\Carbon;
class FlightController extends Controller
{
public function flights(){
$MSPToDFW = '{
"request": {
"passengers": {
"adultCount": 1
},
"slice": [
{
"origin": "MSP",
"destination": "DFW",
"date": "2017-11-14",
"maxStops": 0
},
{
"origin": "DFW",
"destination": "MSP",
"date": "2017-11-19",
"maxStops": 0
}
]
}
}';
$MSPToSEA = '{
"request": {
"passengers": {
"adultCount": 1
},
"slice": [
{
"origin": "MSP",
"destination": "SEA",
"date": "2017-11-14",
"maxStops": 0
},
{
"origin": "SEA",
"destination": "MSP",
"date": "2017-11-19",
"maxStops": 0
}
]
}
}';
$PDXToANC = '{
"request": {
"passengers": {
"adultCount": 1
},
"slice": [
{
"origin": "PDX",
"destination": "ANC",
"date": "2017-11-14",
"maxStops": 0
},
{
"origin": "ANC",
"destination": "PDX",
"date": "2017-11-19",
"maxStops": 0
}
]
}
}';
$first = $this->getFlights($MSPToDFW);
$second = $this->getFlights($MSPToSEA);
$third = $this->getFlights($PDXToANC);
$date= Carbon::now('CST');
return view('flightLayout')->withFirst($first)->withSecond($second)->withThird($third)->withDate($date);
}
// public function csv(){
// $file = file('flights.csv');
// foreach($file as $item){
// $array = explode(",",$item);
// $date = explode('/',$array[0]);
// $date = implode('-',$date);
// $time = $array[1][0].$array[1][1].$array[1][2].$array[1][3].$array[1][4].$array[1][5].$array[1][6].$array[1][7];
// $flight = new Flights();
// $flight->date = $date;
// $flight->time = $time;
// $flight->depAirline = $array[2];
// $flight->depFlightNo = $array[3];
// $flight->retAirline = $array[4];
// $flight->retFlightNo = $array[5];
// $flight->fare = $array[6];
// $flight->comment = '';
// $flight->save();
// }
// }
public function getFlights($postData){
$array = [];
$array1 = [];
$url = "https://www.googleapis.com/qpxExpress/v1/trips/search?key=".env("Flights_API_KEY");
$curlConnection = curl_init();
curl_setopt($curlConnection, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($curlConnection, CURLOPT_URL, $url);
curl_setopt($curlConnection, CURLOPT_POST, TRUE);
curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $postData);
curl_setopt($curlConnection, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlConnection, CURLOPT_SSL_VERIFYPEER, FALSE);
$results = curl_exec($curlConnection);
$response = json_decode($results);
curl_close ($curlConnection);
$depAirline = $response->trips->tripOption[0]->slice[0]->segment[0]->flight->carrier;
$depFlightNumber = $response->trips->tripOption[0]->slice[0]->segment[0]->flight->number;
$retAirline = $response->trips->tripOption[0]->slice[1]->segment[0]->flight->carrier;
$retFlightNo = $response->trips->tripOption[0]->slice[1]->segment[0]->flight->number;
$fare = $response->trips->tripOption[0]->pricing[0]->saleTotal;
$date= date("Y-m-d");
$time = date("H:i:s");
array_push($array,$date);
array_push($array,$time);
array_push($array,$depAirline);
array_push($array,$depFlightNumber);
array_push($array,$retAirline);
array_push($array,$retFlightNo);
array_push($array,explode("USD",$fare)[1]);
$file = fopen('flights.csv','a');
fputcsv($file,$array);
fclose($file);
array_push($array1,$depAirline);
array_push($array1,$depFlightNumber);
array_push($array1,$retAirline);
array_push($array1,$retFlightNo);
array_push($array1,$fare);
$fare = explode("USD",$fare)[1];
$flight = new Flights();
$flight->date = $date;
$flight->time = $time;
$flight->depAirline = $depAirline;
$flight->depFlightNo = $depFlightNumber;
$flight->retAirline = $retAirline;
$flight->retFlightNo = $retFlightNo;
$flight->fare = $fare;
$flight->comment = '';
$flight->save();
return $array1;
}
}<file_sep>/app/Flights.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Flights extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'date','time','depAirline','depFlightNo','retAirline','retFlightNo','fare','comment'
];
}
| 2f6613be2b4ba1f2caeca868e8f5a5e009c24ef7 | [
"Markdown",
"PHP"
] | 4 | Markdown | romanmartushev/FlightTracker | ce3481839740f9a9840e8247f253258be179221d | 5db15e14182c74df6162d49dd00db53a3fe1e1a7 |
refs/heads/master | <file_sep>package com.jb.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import com.jb.dta.Address;
import com.jb.dta.Login;
import com.jb.dta.Profile;
public class SignUpService {
public static Connection conn=null;
public void createUser(Login loginDetails, Address address, Profile profileDetails) {
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/carfactory", "root", "<PASSWORD>");
PreparedStatement stmt1 = conn.prepareStatement("INSERT INTO login VALUES (?,?)");
stmt1.setString(1, loginDetails.getUserId());
stmt1.setString(2, loginDetails.getPassword());
stmt1.executeUpdate();
stmt1.close(); // 1
PreparedStatement stmt2 = conn.prepareStatement("INSERT INTO address VALUES (?,?,?,?,?,?)");
stmt2.setString(1, loginDetails.getUserId());
stmt2.setString(2, address.getStreet());
stmt2.setString(3, address.getCity());
stmt2.setString(4, address.getState());
stmt2.setString(5, address.getCountry());
stmt2.setString(6, address.getZip());
stmt2.executeUpdate();
stmt2.close(); // 2
PreparedStatement stmt3 = conn.prepareStatement("INSERT INTO profile2 VALUES (?,?,?,?,?,?)");
stmt3.setString(1, loginDetails.getUserId());
stmt3.setString(2, profileDetails.getFirstName());
stmt3.setString(3, profileDetails.getLastName());
stmt3.setString(4, profileDetails.getDob());
stmt3.setString(5, profileDetails.getPhone());
stmt3.setString(6, profileDetails.getEmail());
stmt3.executeUpdate();
stmt3.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| 160a8107f1c2ab659974fbbdb9dca47d3362582a | [
"Java"
] | 1 | Java | jaswanthbellam/CarWebsite | 5c4eea6879145418e8b791e92cd6ac965b9bfa4a | 61c06be8bac80e42ec2d6734ba7d7c1d8e01a5a8 |
refs/heads/master | <file_sep>print("""
Running simplest example adapted from:
https://github.com/huggingface/neuralcoref/blob/4.0.0/README.md#loading-neuralcoref
""")
# Load your usual SpaCy model (one of SpaCy English models)
import spacy
nlp = spacy.load('en_core_web_sm')
# Add neural coref to SpaCy's pipe
import neuralcoref
neuralcoref.add_to_pipe(nlp)
# You're done. You can now use NeuralCoref as you usually manipulate a SpaCy document annotations.
doc = nlp('My sister has a dog. She loves him.')
print(doc._.has_coref)
print(doc._.coref_clusters)
| 918e3afef2f0ce88974d0adc18d8440b1e91508f | [
"Python"
] | 1 | Python | oblute/neuralcoref-feedstock | 2e380a844d07cb384d51a6ba84df1846ad08fdf0 | 22dbfeb2924feb50f8d9c4420ac6ded6d1dc736f |
refs/heads/main | <repo_name>jcarneiro7/SRM_article<file_sep>/classes_concept/Resilience_Indexes.py
import wntr
import networkx as nx
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import math
from collections import Counter
def resilience_index(wn,results,p_req,teste):
node_elevation = wn.query_node_attribute('elevation')
gamma = 9810
list_of_reservoirs = wn.reservoir_name_list
list_of_pumps = wn.pump_name_list
nodes_with_demand = wn.query_node_attribute('base_demand', np.greater,0)
list_of_nodes = list(nodes_with_demand.index)
ri_1 = 0
ri_res = 0
ri_pumps = 0
ri_req = 0
for r in list_of_reservoirs:
# ri_res += results.node['head'].loc[:,r] * (abs(results.node['demand'].loc[:,r]))
ri_res += results.node['head'].loc[:,r] * (-(results.node['demand'].loc[:,r]))
for p in list_of_pumps:
ri_pumps += abs(results.link['flowrate'].loc[:,p]) * abs(results.link['headloss'].loc[:,p]) / gamma
for n in list_of_nodes:
ri_1 += results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
ri_req += results.node['demand'].loc[:,n] * (p_req+node_elevation.loc[n])
# Grafico
ri_1_node_aux = results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
ri_1_node=ri_1_node_aux.iloc[0]
no = wn.get_node(n)
no.initial_quality=float(ri_1_node)
# # plot distribuicao espacial
# ax = wntr.graphics.plot_network(wn, node_attribute='initial_quality', node_colorbar_label='Node resilience importance',node_size=40,node_cmap='turbo',node_range=[0, 0.3])
# ax.set_box_aspect(4)
# l, b, w, h = ax.get_position().bounds
# ax.set_position([l-0.2, b, w, h])
# plt.savefig('Results/RI_'+teste+'.png',dpi=300)
# plt.show()
# Metrica Resiliencia
ri=ri_1 / (ri_res + ri_pumps - ri_req)
return (ri.loc[0])
def network_resilience_index(wn,results,p_req,uG,teste):
node_elevation = wn.query_node_attribute('elevation')
gamma = 9810
list_of_reservoirs = wn.reservoir_name_list
list_of_pumps = wn.pump_name_list
nodes_with_demand = wn.query_node_attribute('base_demand', np.greater,0)
list_of_nodes = list(nodes_with_demand.index)
diameters = wn.query_link_attribute('diameter')
ri_1 = 0
ri_res = 0
ri_pumps = 0
ri_req = 0
for r in list_of_reservoirs:
ri_res += results.node['head'].loc[:,r] * (abs(results.node['demand'].loc[:,r]))
for p in list_of_pumps:
ri_pumps += abs(results.link['flowrate'].loc[:,p]) * abs(results.link['headloss'].loc[:,p]) / gamma
for n in list_of_nodes:
links = list(uG.edges(keys=True))
links_pd = pd.DataFrame(links)
node_links = links_pd.iloc[:,0:2]
idx = []
idx_aux = node_links.index[node_links.iloc[:,0] == n].tolist()
idx_aux2 = node_links.index[node_links.iloc[:,1] == n].tolist()
idx.extend(idx_aux)
idx.extend(idx_aux2)
pipes=links_pd.iloc[idx,2]
diams=[]
for p in pipes:
# d = diameters[p]
# print(d)
diams.append(diameters[p])
# print(diams)
Ui = sum(diams) / (len(diams) * max(diams))
ri_1 += Ui * results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
ri_req += results.node['demand'].loc[:,n] * (p_req+node_elevation.loc[n])
# Grafico
nri_1_node_aux = Ui * results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
nri_1_node=nri_1_node_aux.iloc[0]
no = wn.get_node(n)
no.initial_quality=float(nri_1_node)
# # plot distribuicao espacial
# ax = wntr.graphics.plot_network(wn, node_attribute='initial_quality', node_colorbar_label='Node resilience importance',node_size=40,node_cmap='turbo',node_range=[0, 0.3])
# ax.set_box_aspect(4)
# l, b, w, h = ax.get_position().bounds
# ax.set_position([l-0.2, b, w, h])
# plt.savefig('Results/NRI_'+teste+'.png',dpi=300)
# plt.show()
# Métrica resiliencia
nri = ri_1 / (ri_res + ri_pumps - ri_req)
return (nri.loc[0])
def modified_resilience_index(wn,results,p_req):
node_elevation = wn.query_node_attribute('elevation')
nodes_with_demand = wn.query_node_attribute('base_demand', np.greater,0)
list_of_nodes = list(nodes_with_demand.index)
ri_1 = 0
ri_req = 0
for n in list_of_nodes:
ri_1 += results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
ri_req += results.node['demand'].loc[:,n] * (p_req+node_elevation.loc[n])
# print(results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n])))
# print(results.node['demand'].loc[:,n] * (p_req+node_elevation.loc[n]))
# # print(ri_1)
# # print(ri_req)
# print('aqui')
mri = (ri_1 / ri_req) * 100
return (mri.loc[0])
def target_hydraulic_resilience_index(wn,results,p_req,p_min): # p_req é o p_target
nodes_with_demand = wn.query_node_attribute('base_demand', np.greater,0)
list_of_nodes = list(nodes_with_demand.index)
thri_aux_1 = 0
thri_aux_2 = 0
thri_aux_3 = 0
for n in list_of_nodes:
thri_aux_1 += results.node['demand'].loc[:,n] * results.node['pressure'].loc[:,n]
thri_aux_2 += results.node['demand'].loc[:,n] * p_min
thri_aux_3 += results.node['demand'].loc[:,n] * p_req
# print('QP',thri_aux_1)
# print('QPtarget',thri_aux_3)
# print('QPmin',thri_aux_2)
thri = (thri_aux_1 - thri_aux_2) / (thri_aux_3 - thri_aux_2)
return(thri.loc[0])
def weighted_resilience_index (wn,results,p_req,teste):
node_elevation = wn.query_node_attribute('elevation')
gamma = 9810
list_of_reservoirs = wn.reservoir_name_list
list_of_pumps = wn.pump_name_list
nodes_with_demand = wn.query_node_attribute('base_demand', np.greater,0)
list_of_nodes = list(nodes_with_demand.index)
diameters = wn.query_link_attribute('diameter')
start_nodes = wn.query_link_attribute('start_node_name')
end_nodes = wn.query_link_attribute('end_node_name')
wri_1 = 0
wri_res = 0
wri_pumps = 0
wri_req = 0
k_t = 0
k_i = 0
k_u = 0
for r in list_of_reservoirs:
wri_res += results.node['head'].loc[:,r] * (abs(results.node['demand'].loc[:,r]))
for p in list_of_pumps:
wri_pumps += abs(results.link['flowrate'].loc[:,p]) * abs(results.link['headloss'].loc[:,p]) / gamma
# Auxiliar de calculo do coeficiente de importancia
flows_tot=[]
# flowrate=(results.link['flowrate'])
for n in list_of_nodes:
pipes_start=list(start_nodes[start_nodes==(n)].index.values)
pipes_end=list(end_nodes[end_nodes==(n)].index.values)
flows=[]
for p in pipes_start: # nó n é start node, só entra água no nó se o flow for negativo
# print(results.link['flowrate'].loc[0,p])
if results.link['flowrate'].loc[0,p] < 0:
flow=abs(results.link['flowrate'].loc[:,p])
flows.extend(flow)
for p in pipes_end: # nó n é end node, só entra água no nó se o flow for positivo
if results.link['flowrate'].loc[0,p] > 0:
flow=results.link['flowrate'].loc[:,p]
flows.extend(flow)
# print('aqui')
# flows_aux=sum(flows)
flows_tot.append(sum(flows))
for n in list_of_nodes:
# print(n)
pipes_start=list(start_nodes[start_nodes==(n)].index.values)
pipes_end=list(end_nodes[end_nodes==(n)].index.values)
diams=[]
flows=[]
for p in pipes_start: # nó n é start node, só entra água no nó se o flow for negativo
if results.link['flowrate'].loc[0,p] < 0:
diams.append(diameters[p])
flow=abs(results.link['flowrate'].loc[:,p])
flows.extend(flow)
for p in pipes_end: # nó n é end node, só entra água no nó se o flow for positivo
if results.link['flowrate'].loc[0,p] > 0:
diams.append(diameters[p])
flow=results.link['flowrate'].loc[:,p]
flows.extend(flow)
np_i = len(diams)
k_t = 0.5 + ((np_i-1)/np_i)
k_i = sum(flows)/(max(flows_tot))
squared_diams = [number ** 2 for number in diams]
k_u = sum(squared_diams) / (min([np_i,2]) * (max(diams)**2))
wri_1 += k_i * k_t * k_u * results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
wri_req += results.node['demand'].loc[:,n] * (p_req+node_elevation.loc[n])
# print("k_i: ", k_i)
# print(n)
# print("k_t: ", k_t)
# print("k_u: ", k_u)
# print("flow: ", results.node['demand'].loc[:,n])
# print("Current head: ",results.node['head'].loc[:,n])
# print("Required head: ",(p_req+node_elevation.loc[n]))
# print("wri_1 no: ", k_i * k_t * k_u * results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n])))
# print(wri_req)
# Para obter a distribuicao espacial da importancia de cada no para a resiliencia
wri_1_node_aux = k_i * k_t * k_u * results.node['demand'].loc[:,n] * (results.node['head'].loc[:,n]-(p_req+node_elevation.loc[n]))
wri_1_node=wri_1_node_aux.iloc[0]
no = wn.get_node(n)
no.initial_quality=float(wri_1_node)
wri = (wri_1) / (wri_res + wri_pumps - wri_req)
# plot distribuicao espacial
ax = wntr.graphics.plot_network(wn, node_attribute='initial_quality', node_colorbar_label='Node resilience importance',node_size=40,node_cmap='turbo',node_range=[0, 0.1])
ax.set_box_aspect(4)
l, b, w, h = ax.get_position().bounds
ax.set_position([l-0.2, b, w, h])
plt.savefig('Results/WRI_'+teste+'.png',dpi=300)
return (wri.loc[0])<file_sep>/classes_concept/Graph_Theory_Metrics.py
# import wntr
import networkx as nx
# import pandas as pd
import numpy as np
# import matplotlib.pyplot as plt
# import math
# from collections import Counter
def link_density(uG):
link_density=nx.density(uG)
return (link_density)
def central_point_dominance(uG):
bet_cen = nx.betweenness_centrality(nx.Graph(uG)) # not implemented for multigraph
bet_cen = list(bet_cen.values())
cpd = sum(max(bet_cen) - np.array(bet_cen))/(len(bet_cen)-1)
return (cpd)
def average_path_length(G):
apl=nx.average_shortest_path_length(G, weight=None)
return (apl)
def meshedness_coefficient(G):
mc = float(G.number_of_edges() - G.number_of_nodes() + 1)/(2*G.number_of_nodes()-5)
return(mc)
def algebraic_connectivity(uG):
eig = nx.laplacian_spectrum(uG)
eig = np.sort(eig)
ac = eig[1]
return (ac)
def spectral_gap(uG):
eig = nx.adjacency_spectrum(uG)
sg = abs(eig[0] - eig[1])
return (sg)
<file_sep>/Compute_Resilience_all.py
import wntr
import networkx as nx
import numpy as np
import pandas as pd
from classes_concept import Graph_Theory_Metrics, Entropy_metrics, Resilience_Indexes
teste='2_1'
if teste=='1_0':
filename='Networks/concept_1/Concept_1'
elif teste=='1_1':
filename='Networks/concept_1/Concept_1_1'
elif teste=='1_2':
filename='Networks/concept_1/Concept_1_2'
elif teste=='1_3':
filename='Networks/concept_1/Concept_1_3'
elif teste == '1_4':
filename='Networks/concept_1/Concept_1_4'
elif teste == '1_5':
filename='Networks/concept_1/Concept_1_5'
elif teste=='2_0':
filename='Networks/concept_2/Concept_2'
elif teste=='2_1':
filename='Networks/concept_2/Concept_2_1'
elif teste=='2_2':
filename='Networks/concept_2/Concept_2_2'
elif teste=='2_3':
filename='Networks/concept_2/Concept_2_3'
elif teste == '2_4':
filename='Networks/concept_2/Concept_2_4'
elif teste == '2_5':
filename='Networks/concept_2/Concept_2_5'
elif teste=='3_0':
filename='Networks/concept_3/Concept_3'
elif teste=='3_1':
filename='Networks/concept_3/Concept_3_1'
elif teste=='3_2':
filename='Networks/concept_3/Concept_3_2'
elif teste=='3_3':
filename='Networks/concept_3/Concept_3_3'
elif teste == '3_4':
filename='Networks/concept_3/Concept_3_4'
elif teste == '3_5':
filename='Networks/concept_3/Concept_3_5'
inp_file=filename+'.inp'
wn=wntr.network.WaterNetworkModel(inp_file)
sim = wntr.sim.EpanetSimulator(wn)
results = sim.run_sim()
G_top = wn.get_graph()
uG_top = G_top.to_undirected() # undirected multigraph
## Resilience Index Metrics
p_req = 20
p_min = 10
ri = Resilience_Indexes.resilience_index(wn,results,p_req,teste)
nri = Resilience_Indexes.network_resilience_index(wn,results,p_req,uG_top,teste)
mri = Resilience_Indexes.modified_resilience_index(wn,results,p_req)
thri = Resilience_Indexes.target_hydraulic_resilience_index(wn,results,p_req,p_min)
wri = Resilience_Indexes.weighted_resilience_index (wn,results,p_req,teste)
print('finish resilience indexes metrics')
list_of_pipes = wn.pipe_name_list
list_of_nodes = wn.junction_name_list
pressao_original = results.node['pressure'].loc[:,list_of_nodes]
# ## Entropy metrics
flowrate_orig = results.link['flowrate']
list_of_times = list(flowrate_orig.index)
entropia_awumah=[]
entropia_tanyimboh=[]
entropia_dsfe=[]
for t in list_of_times: # loop time
wn_graph = wntr.network.WaterNetworkModel(inp_file)
for p in list_of_pipes: # loop pipes
if flowrate_orig.loc[t,p]<0:
pipe_orig=wn_graph.get_link(p)
new_pipe_name=pipe_orig.name
new_pipe_no_final=pipe_orig.start_node_name
new_pipe_no_inicial=pipe_orig.end_node_name
new_pipe_diameter=pipe_orig.diameter
new_pipe_length=pipe_orig.length
new_pipe_roughness=pipe_orig.roughness
wn_graph.remove_link(pipe_orig.name)
wn_graph.add_pipe(new_pipe_name, start_node_name=new_pipe_no_inicial, end_node_name=new_pipe_no_final,
length=new_pipe_length, diameter=new_pipe_diameter, roughness=new_pipe_roughness, minor_loss=0)
wn_graph.write_inpfile('entropia_new_direction_new.inp', version=2.2)
sim = wntr.sim.EpanetSimulator(wn_graph)
results = sim.run_sim()
flowrate = results.link['flowrate'].loc[t,:]
demand = results.node['demand'].loc[t,:]
velocity = results.link['velocity'].loc[t,:]
G = wn_graph.get_graph(link_weight=flowrate)
entropy, awumah = Entropy_metrics.entropy_awumah(G)
tanyimboh = Entropy_metrics.entropy_tanyimboh(G,demand,flowrate)
dsfe = Entropy_metrics.diameter_sensitive_flow_entropy (G, demand,flowrate, velocity)
entropia_awumah.append(awumah)
entropia_tanyimboh.extend(tanyimboh)
entropia_dsfe.extend(dsfe)
entropia_awumah=np.array(entropia_awumah)
entropia_tanyimboh=np.array(entropia_tanyimboh)
entropia_dsfe=np.array(entropia_dsfe)
print('finish entropy metrics')
## Graph Theory Metrics
ld = Graph_Theory_Metrics.link_density(uG_top)
cpd = Graph_Theory_Metrics.central_point_dominance(uG_top)
apl = Graph_Theory_Metrics.average_path_length(uG_top)
mc = Graph_Theory_Metrics.meshedness_coefficient(G_top)
ac = Graph_Theory_Metrics.algebraic_connectivity(uG_top)
sg = Graph_Theory_Metrics.spectral_gap(uG_top)
print('finish graph theory')
## save results csv
results = [ri, nri, mri, thri, wri, entropia_awumah[0], entropia_tanyimboh[0], entropia_dsfe[0], ld, cpd, apl, mc, ac, sg]
resultados=pd.DataFrame(results)
resultados.to_csv('Results/res_'+teste+'.csv')
print('finished')
<file_sep>/classes_concept/Entropy_metrics.py
# import wntr
import networkx as nx
import pandas as pd
import numpy as np
# import matplotlib.pyplot as plt
import math
from collections import Counter
def entropy_awumah(G, sources=None, sinks=None):
if G.is_directed() == False:
return
if sources is None:
sources = [key for key,value in nx.get_node_attributes(G,'type').items() if value == 'Reservoir']
if sinks is None:
sinks = G.nodes()
S = {}
Q = {}
for nodej in sinks:
# print('Nó: ',nodej)
if nodej in sources:
S[nodej] = 0 # nodej is the source
continue
sp = [] # simple path
# print('type: ', G.nodes[nodej]['type'])
if G.nodes[nodej]['type'] == 'Junction':
for source in sources:
if nx.has_path(G, source, nodej):
simple_paths = nx.all_simple_paths(G,source,target=nodej)
sp = sp + ([p for p in simple_paths])
# print('Simple paths: ', sp)
if len(sp) == 0:
S[nodej] = np.nan # nodej is not connected to any sources
continue
# print('length simple paths',len(sp))
# "dtype=object" is needed to create an array from a list of lists with differnet lengths
sp = np.array(sp, dtype=object)
# Uj = set of nodes on the upstream ends of links incident on node j
Uj = G.predecessors(nodej)
# qij = flow in link from node i to node j
qij = []
# aij = number of equivalent independent paths through the link from node i to node j
aij = []
for nodei in Uj:
# print('upstream node: ',nodei)
mask = np.array([nodei in path for path in sp])
# NDij = number of paths through the link from node i to node j
NDij = sum(mask)
if NDij == 0:
continue
temp = sp[mask]
# MDij = links in the NDij path
MDij = [(t[idx],t[idx+1]) for t in temp for idx in range(len(t)-1)]
flow = 0
for link in G[nodei][nodej].keys():
flow = flow + G[nodei][nodej][link]['weight']
qij.append(flow)
# print('qij: ', qij)
# dk = degree of link k in MDij
dk = Counter()
for elem in MDij:
# divide by the numnber of links between two nodes
dk[elem] += 1/len(G[elem[0]][elem[1]].keys())
# print(dk)
V = np.array(list(dk.values()))
aij.append(NDij*(1-float(sum(V - 1))/sum(V)))
# print('aij: ', aij)
Q[nodej] = sum(qij) # Total flow into node j
# Equation 7
S[nodej] = 0
for idx in range(len(qij)):
if Q[nodej] != 0 and qij[idx]/Q[nodej] > 0:
S[nodej] = S[nodej] - \
qij[idx]/Q[nodej]*math.log(qij[idx]/Q[nodej]) + \
qij[idx]/Q[nodej]*math.log(aij[idx])
# print(S)
Q0 = sum(nx.get_edge_attributes(G, 'weight').values())
# print(Q0)
# print(Q)
# Equation 3
S_ave = 0
for nodej in sinks:
if not np.isnan(S[nodej]):
if nodej not in sources:
if Q[nodej]/Q0 > 0:
S_ave = S_ave + \
(Q[nodej]*S[nodej])/Q0 - \
Q[nodej]/Q0*math.log(Q[nodej]/Q0)
S = pd.Series(S) # convert S to a series
# print(S_ave)
return [S, S_ave]
def entropy_tanyimboh(G, demand,flowrate, sources=None, sinks=None):
if G.is_directed() == False:
return
if sources is None:
sources = [key for key,value in nx.get_node_attributes(G,'type').items() if value == 'Reservoir']
if sinks is None:
sinks = G.nodes()
# print(sinks.values())
sources_demand=abs(demand.loc[sources])
T=sum(sources_demand) # total demand
S_0=0
# Primeira parte equação: Sources => S_0
for node_s in sources:
Q_s = sources_demand.loc[node_s]
# Equation 2 and 3
S_0 = S_0 - Q_s/T*math.log(Q_s/T)
# Segunda parte da equação -> Nodes S_j
S = {}
S_j={}
S_j_1={}
S_j_2={}
Q_j={}
T_j={}
for nodej in sinks:
# print(nodej)
if nodej in sources:
S[nodej] = 0 # nodej is the source
continue
sp = [] # simple path
if G.nodes[nodej]['type'] == 'Junction':
for source in sources:
if nx.has_path(G, source, nodej):
simple_paths = nx.all_simple_paths(G,source,target=nodej)
sp = sp + ([p for p in simple_paths])
if len(sp) == 0:
S_j[nodej] = 0 # nodej is not connected to any sources
continue
# Demand of node j
Q_j[nodej] = demand.loc[nodej]
# Flow into node j (chega)
Uj = G.predecessors(nodej)
T_j_aux = []
for nodei in Uj:
mask = np.array([nodei in path for path in sp])
# NDij = number of paths through the link from node i to node j
NDij = sum(mask)
if NDij == 0:
continue
flow = 0
for link in G[nodei][nodej].keys():
flow = flow + flowrate.loc[link]
T_j_aux.append(flow)
T_j[nodej]=sum(T_j_aux)
if T_j[nodej]<0:
S_j[nodej]=0
continue
# Primeira parte da equação S_j
S_j_1[nodej]=0
if Q_j[nodej]>0 and Q_j[nodej]/T_j[nodej] > 0:
S_j_1[nodej]=Q_j[nodej]/T_j[nodej]*math.log(Q_j[nodej]/T_j[nodej])
# Flow emanated from node j
Dj=G.successors(nodej)
q_jk=[]
for nodek in Dj:
mask = np.array([nodej in path for path in sp])
# NDij = number of paths through the link from node i to node j
NDij = sum(mask)
if NDij == 0:
continue
flow=0
for link in G[nodej][nodek].keys():
flow = flowrate.loc[link] ### REVER!!!!!!!!!!!!!!!! acho que não deve ser a somar!!! -> antigo flow = flow + flowrate.loc[link]+* q_jk.append(flow)
q_jk.append(flow)
# Segunda parte da equação S_j
S_j_2[nodej] = 0
for idx in range(len(q_jk)):
if q_jk[idx] > 0 and q_jk[idx]/T_j[nodej] > 0:
S_j_2[nodej] = S_j_2[nodej] + \
q_jk[idx]/T_j[nodej]*math.log(q_jk[idx]/T_j[nodej])
S_j[nodej]=T_j[nodej] * (S_j_1[nodej] + S_j_2[nodej])
if np.isnan(S_j[nodej]):
S_j[nodej]=0
S = S_0 - 1/T * sum(S_j.values())
return [S]
def diameter_sensitive_flow_entropy (G, demand,flowrate, velocity, sources=None, sinks=None):
c=0.1 # velocity constant
if G.is_directed() == False:
return
if sources is None:
sources = [key for key,value in nx.get_node_attributes(G,'type').items() if value == 'Reservoir']
if sinks is None:
sinks = G.nodes()
# print(sinks.values())
sources_demand=abs(demand.loc[sources])
T=sum(sources_demand)
S_0=0
# Primeira parte equação -> Sources = S_0
for nodei in sources:
Q_i = sources_demand.loc[nodei]
# Equation 2 and 3
S_0 = S_0 - Q_i/T*math.log(Q_i/T)
# Segunda parte da equação -> Nodes S_j
S = {}
S_j={}
S_j_1={}
S_j_2={}
Q_j={}
T_j={}
for nodej in sinks:
# print(nodej)
if nodej in sources:
S[nodej] = 0 # nodej is the source
continue
sp = [] # simple path
if G.nodes[nodej]['type'] == 'Junction':
for source in sources:
if nx.has_path(G, source, nodej):
simple_paths = nx.all_simple_paths(G,source,target=nodej)
sp = sp + ([p for p in simple_paths])
if len(sp) == 0:
S_j[nodej] = 0 # nodej is not connected to any sources
continue
# Demand of node j
Q_j[nodej] = demand.loc[nodej]
# Flow into node j (chega)
Uj = G.predecessors(nodej)
T_j_aux = []
for nodei in Uj:
mask = np.array([nodei in path for path in sp])
# NDij = number of paths through the link from node i to node j
NDij = sum(mask)
if NDij == 0:
continue
flow = 0
for link in G[nodei][nodej].keys():
flow = flow + flowrate.loc[link]
T_j_aux.append(flow)
T_j[nodej]=sum(T_j_aux)
if T_j[nodej]<0:
S_j[nodej]=0
continue
# Primeira parte da equação S_j
S_j_1[nodej]=0
if Q_j[nodej]>0 and Q_j[nodej]/T_j[nodej] > 0:
S_j_1[nodej]=Q_j[nodej]/T_j[nodej]*math.log(Q_j[nodej]/T_j[nodej])
# Flow emanated from node j
Dj=G.successors(nodej)
q_jk=[]
v_jk=[]
for nodek in Dj:
mask = np.array([nodej in path for path in sp])
# NDij = number of paths through the link from node i to node j
NDij = sum(mask)
if NDij == 0:
continue
flow=0
for link in G[nodej][nodek].keys():
flow = flowrate.loc[link]
vel = velocity.loc[link]
q_jk.append(flow)
v_jk.append(vel)
# Segunda parte da equação S_j
S_j_2[nodej] = 0
for idx in range(len(q_jk)):
if q_jk[idx] > 0.00001 and q_jk[idx]/T_j[nodej] > 0: # q_jk[idx] > 0.00001 para remover python errors
S_j_2[nodej] = S_j_2[nodej] + \
(c/v_jk[idx]) * \
(q_jk[idx]/T_j[nodej]*math.log(q_jk[idx]/T_j[nodej]))
# print(c/v_jk[idx])
# print(q_jk[idx]/T_j[nodej]*math.log(q_jk[idx]/T_j[nodej]))
# print('S_j_1: ', S_j_1[nodej])
# print(nodej)
# print('vel',v_jk)
# print('S_j_2: ',S_j_2[nodej])
S_j[nodej]=T_j[nodej] * (S_j_1[nodej] + S_j_2[nodej])
if np.isnan(S_j[nodej]):
S_j[nodej]=0
dsfe = S_0 - 1/T * sum(S_j.values())
# print('S_0: ', S_0)
# print('S_j: ',1/T * sum(S_j.values()))
# print('DSFE: ',dsfe)
return [dsfe] | a64217669df01e8b056141e0f694820871f0d3da | [
"Python"
] | 4 | Python | jcarneiro7/SRM_article | 558f91b646bd6a648c775ba09dbe2fe7f2092c38 | defe4f9d1bff7187f816fd2bcf9fc56a8f544ce9 |
refs/heads/master | <file_sep>
//index.js
//const app = getApp()
const innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.autoplay = false
innerAudioContext.src = 'http://172.16.17.32:8888/audio/1.mp3'
innerAudioContext.onPlay(() => {
//console.log('开始播放');
})
Page({
data: {
isPlay: true,
indicatorDots: false,
vertical: true,
autoplay: false,
circular: true,
interval: 2000,
duration: 500,
previousMargin: 0,
nextMargin: 0
},
/**
* 页面的初始数据
*/
//音乐
controlMusic: function () {
if (this.data.isPlay) {
this.setData({
isPlay: false
});
innerAudioContext.pause();
//this.audioCtx.pause();
} else {
this.setData({
isPlay: true
});
innerAudioContext.play();
}
},
changeProperty: function (e) {
var propertyName = e.currentTarget.dataset.propertyName
var newData = {}
newData[propertyName] = e.detail.value
this.setData(newData)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onPageScroll: function (e) {
console.log(e);//{scrollTop:99}
}
}) | da07b62d8bdb933277694742708bdda75bfee0bb | [
"JavaScript"
] | 1 | JavaScript | zengBB96/zengBB | dedd0d0ff150ce7b0be694f888b778d018bd37a5 | 7119a49c4aaecb44bff2442d54ade4d6d642e26e |
refs/heads/master | <repo_name>namelessprofit/vagabond<file_sep>/locations.js
module.exports.locations = [
{
"City": "Tokyo",
"Country": "Japan"
},
{
"City": "Jakarta",
"Country": "Indonesia"
},
{
"City": "New York (Ny)",
"Country": "United States"
},
{
"City": "Seoul",
"Country": "South Korea"
},
{
"City": "Manila",
"Country": "Philippines"
}
]
| 415435fa2310403d76e8eb32e12dfdab3316c383 | [
"JavaScript"
] | 1 | JavaScript | namelessprofit/vagabond | 47b6ed7b2f7c3debe22bcb763b0e22190139e51c | c82ec9778070919430933e35f340ba69bafb0fd4 |
refs/heads/master | <repo_name>hfyan0/nirvana<file_sep>/NirvanaCommon/ATU/GlobalVariables.h
/*
* GlobalVariables.h
*
* Created on: May 8, 2015
* Author: sunny
*/
#ifndef GLOBALVARIABLES_H_
#define GLOBALVARIABLES_H_
#include "PCH.h"
#include "Constants.h"
extern boost::recursive_mutex g_Mutex;
#endif /* GLOBALVARIABLES_H_ */
<file_sep>/NirvanaCommon/ATU/Toolbox.h
#ifndef _TOOLBOX_H_
#define _TOOLBOX_H_
#include "PCH.h"
#include "Constants.h"
#include <boost/date_time.hpp>
using namespace std;
namespace atu {
struct delete_ptr
{
template <class T>
void operator()(T* p)
{
delete p;
}
};
enum {
e_bid, e_ask
};
enum {
e_sell = -1, e_hold = 0, e_buy = 1
};
class Toolbox {
public:
Toolbox();
~Toolbox();
static std::string itos(int);
static std::string ftos(double);
static bool isFileExist(const char*);
static int getNextDay(int,int);
static int getNextDay(int); // Format = YYYYMMDD, e.g. 20130131, same format for return
static int getPrevDay(int);
// template <class T>
// static double average(vector<T>[], int, int);
static double average(double[],int,int);
static double average(int[],int,int);
static void FindAndReplace( std::string& tInput, std::string tFind, std::string tReplace );
static string tolower(std::string &str);
static int timetosec(int);
static int sectotime(int);
static int sum_time(int a,int b);
static int diff_time(int a,int b);
static std::string timeStamp();
static std::string timeStamp_with_underscore();
static boost::posix_time::ptime timeStamp_to_ptime(string);
static void printStringVector(std::vector<std::string>&);
static double meanInList(vector<double> &mylist);
static bool isNotAlNumSpaceUnderScoreMinus(char c);
static bool isStringValid(const std::string &str);
static bool stringToKeyValuePair(map<string,string> &keyvaluepairdict, string instr);
static string timeStamp_full();
static string timeStamp_full(double curms);
static string timeStamp_gmtfull(double curms);
static double timeStamp_toMS(string m);
static void split(vector<string> & result, std::string& in ,std::string delem);
};
}
#endif // End of _TOOLBOX_H_
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyR3.cpp
#include <StrategyR3.h>
// StrategyR3::StrategyR3()
// {
// m_MarketData = MarketData::Instance();
// m_SystemState = SystemState::Instance();
// m_SysCfg = SystemConfig::Instance();
// m_Logger = Logger::Instance();
// m_TechInd = TechIndicators::Instance();
// m_PortAndOrders = PortfoliosAndOrders::Instance();
// m_MDIAck = MDI_Acknowledgement::Instance();
// }
//
// StrategyR3::~StrategyR3() {
// }
//
// void StrategyR3::Run()
// {
// //--------------------------------------------------
// // Init path
// //--------------------------------------------------
// ofstream fsSignalLog(m_SysCfg->GetSignalLogPath(STY_R3).c_str());
//
// //--------------------------------------------------
// // Init other parameters
// //--------------------------------------------------
// m_ParamVector = m_SysCfg->GetParamVector(STY_R3);
//
// //--------------------------------------------------
// for (;;)
// {
// m_MarketData->WaitForData();
//
// if (m_SystemState->ChkIfThreadShouldStop()) break;
//
// YYYYMMDDHHMMSS ymdhms_MDITime = m_MarketData->GetSystemTimeHKT();
//
// if (m_SysCfg->IsStrategyOn(STY_R3))
// {
// m_Logger->Write(Logger::INFO,"SunnyDebug: %s::%s (%d)",__FILE__,__FUNCTION__,__LINE__);
// }
//
// ReportAckIfNeeded();
// }
//
// m_Logger->Write(Logger::NOTICE,"StrategyR3 has ended.");
// sleep(2);
//
// return;
// }
//
// void StrategyR3::ReportAckIfNeeded()
// {
// if (m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::TCPWITHACK || m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::EMBEDDED)
// m_MDIAck->ReportAck(STY_R3);
// return;
// }
<file_sep>/NirvanaCommonTest/UnitTest/ut-sdt.hpp
#include "UTest.h"
#include "Util/SDateTime.h"
#include "Util/STool.h"
#include <iostream>
#include <string>
#include <vector>
#include <deque>
int TestSDT()
{
UTest ut;
{
ut.Assert(STool::Abs(SDateTime::CalcJulianDayNum(2013,1,1)-2456293.520833) < 1,__FILE__,__FUNCTION__,__LINE__);
// http://mathforum.org/library/drmath/view/62338.html
ut.Assert(STool::Abs(SDateTime::CalcJulianDayNum(1582,10,15)-2299161) < 2,__FILE__,__FUNCTION__,__LINE__);
//CalcGregorianDayNum is tested through CalendarDayDiff, because CalcGregorianDayNum is used in CalendarDayDiff
YMD ymd1;
YMD ymd2;
ymd1.Set(2013,9,12); ymd2.Set(2013,9,13); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 1,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,9, 1); ymd2.Set(2013,9,13); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 12,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,8,31); ymd2.Set(2013,9,13); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 13,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,8,21); ymd2.Set(2013,9,13); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 23,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,8,12); ymd2.Set(2013,9,13); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 32,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2000,3,20); ymd2.Set(2004,3,21); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 1462,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(1996,3,20); ymd2.Set(2004,3,21); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 2923,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,9,13); ymd2.Set(2013,9,12); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == -1,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004,3,21); ymd2.Set(2000,3,20); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == -1462,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004,3,21); ymd2.Set(1996,3,20); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == -2923,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004,3,21); ymd2.Set(2004,3,20); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == -1,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004,3,21); ymd2.Set(2004,3,21); ut.Assert(SDateTime::CalendarDayDiff(ymd1,ymd2) == 0,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsLeapYear(2000),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsLeapYear(2001),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsLeapYear(2002),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsLeapYear(2003),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsLeapYear(2004),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsLeapYear(2012),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsLeapYear(2013),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsValidYMD(2004,12,31),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsValidYMD(2004,1,1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsValidYMD(2004,2,29),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsValidYMD(2003,2,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2003,2,29),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::IsValidYMD(2003,2,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2003,2,29),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,12,32),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,1,32),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,13,1),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2113,11,1),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,11,0),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,11,-1),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,1,0),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(2013,1,-1),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(SDateTime::IsValidYMD(-2013,1,1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInMonth(2004,2) == 29,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInMonth(2012,2) == 29,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInMonth(2002,2) == 28,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInMonth(2013,2) == 28,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInYear(2004) == 366,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInYear(2012) == 366,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInYear(2002) == 365,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(SDateTime::DaysInYear(2013) == 365,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,26); ut.Assert(SDateTime::DayOfWeek(ymd1)==4,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,28); ut.Assert(SDateTime::DayOfWeek(ymd1)==6,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,29); ut.Assert(SDateTime::DayOfWeek(ymd1)==0,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,30); ut.Assert(SDateTime::DayOfWeek(ymd1)==1,__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,26); ut.Assert(SDateTime::IsWeekDay(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,28); ut.AssertF(SDateTime::IsWeekDay(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,29); ut.AssertF(SDateTime::IsWeekDay(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,30); ut.Assert(SDateTime::IsWeekDay(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004, 2,29); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2012, 2,29); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2002, 2,28); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013, 2,28); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004, 2,28); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2012, 2,28); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2002, 2,27); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013, 2,27); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004, 1,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2012, 1,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2002, 1,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013, 1,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004,12,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2012,12,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2002,12,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013,12,31); ut.Assert(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004, 3,28); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2012, 3,28); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2002, 3,27); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013, 3,27); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2004, 8,28); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2012, 8,28); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2002, 8,27); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
ymd1.Set(2013, 8,27); ut.AssertF(SDateTime::IsEndOfMonth(ymd1),__FILE__,__FUNCTION__,__LINE__);
//-----------------------------------------------------
YYYYMMDD ymd3;
ut.AssertF(ymd3.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 == YYYYMMDD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 == YMD(),__FILE__,__FUNCTION__,__LINE__);
ymd3.Set(2013,12,11);
YYYYMMDD ymd4(ymd3);
ut.Assert(ymd4 == YYYYMMDD(20131211),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd4 == YYYYMMDD("20131211"),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd4 == YYYYMMDD("2013-12-11"),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd4.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ymd3.Set(20120228);
YYYYMMDD ymd5 = ymd3;
ut.Assert(ymd5 == YYYYMMDD(20120228),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd5 == YYYYMMDD("20120228"),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd5 == YYYYMMDD("2012-02-28"),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd5 == YMD(2012,2,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd5.Value() == 20120228,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd5.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ymd3.Set("19871027");
ut.Assert(ymd3 == YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 != YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 > YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 >= YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 >= YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 < YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 <= YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 <= YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 == YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 != YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 != YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 > YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 >= YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 >= YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 < YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 <= YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 <= YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 == YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 != YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 > YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 > YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 >= YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 < YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 < YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 <= YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 == YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 == YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 != YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 > YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 > YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 >= YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 < YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 < YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3 <= YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3.Value() == 19871027,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ymd3.Invalidate();
ut.Assert(ymd3 == YYYYMMDD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 == YMD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 != YYYYMMDD(20131130),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd3 != YMD(20131130),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd3.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(YYYYMMDD(20140204).ToStrYM() == "201402",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(YYYYMMDD(20140204).ToStr() == "20140204",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(YYYYMMDD(20140204).ToStr_() == "2014-02-04",__FILE__,__FUNCTION__,__LINE__);
YMD ymd6(YYYYMMDD(20140204));
ut.Assert(ymd6 == YMD(2014,2,4),__FILE__,__FUNCTION__,__LINE__);
YMD ymd7;
ut.Assert(ymd7 == YMD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YYYYMMDD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YMD(2010,2,22),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YYYYMMDD(20100222),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(2013,1,28);
ut.Assert(ymd7 == YMD(2013,1,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YYYYMMDD(20130128),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.Year() == 2013,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.Month() == 1,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.Day() == 28,__FILE__,__FUNCTION__,__LINE__);
ymd7.SetYear(1982);
ut.Assert(ymd7 == YMD(1982,1,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YYYYMMDD(19820128),__FILE__,__FUNCTION__,__LINE__);
ymd7.SetMonth(12);
ut.Assert(ymd7 == YMD(1982,12,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YYYYMMDD(19821228),__FILE__,__FUNCTION__,__LINE__);
ymd7.SetDay(23);
ut.Assert(ymd7 == YMD(1982,12,23),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YYYYMMDD(19821223),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.Year() == 1982,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.Month() == 12,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.Day() == 23,__FILE__,__FUNCTION__,__LINE__);
ymd7.Invalidate();
ut.Assert(ymd7 == YMD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YYYYMMDD(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YMD(2010,2,22),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YYYYMMDD(20100222),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(1987,10,27);
ut.Assert(ymd7 == YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 > YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 >= YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 >= YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 < YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 <= YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 <= YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 == YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 != YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 > YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 >= YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 >= YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 < YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 <= YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7 <= YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 == YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 != YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 > YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 > YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 >= YYYYMMDD(19871028),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 < YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 < YYYYMMDD(19871027),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 <= YYYYMMDD(19871026),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 == YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 == YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 != YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 > YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 > YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 >= YMD(1987,10,28),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 < YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 < YMD(1987,10,27),__FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymd7 <= YMD(1987,10,26),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(1987,10,27);
ymd7.AddYear(1);
ut.Assert(ymd7 == YYYYMMDD(19881027),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddYear(-2);
ut.Assert(ymd7 == YYYYMMDD(19861027),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddYear(50);
ut.Assert(ymd7 == YYYYMMDD(20361027),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddYear(-50);
ut.Assert(ymd7 == YYYYMMDD(19861027),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(1987,10,27);
ymd7.SubtractYear(-1);
ut.Assert(ymd7 == YYYYMMDD(19881027),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractYear(2);
ut.Assert(ymd7 == YYYYMMDD(19861027),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractYear(-50);
ut.Assert(ymd7 == YYYYMMDD(20361027),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractYear(50);
ut.Assert(ymd7 == YYYYMMDD(19861027),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(1986,10,27);
ymd7.AddMonth(1);
ut.Assert(ymd7 == YYYYMMDD(19861127),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddMonth(-2);
ut.Assert(ymd7 == YYYYMMDD(19860927),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddMonth(50);
ut.Assert(ymd7 == YYYYMMDD(19901127),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddMonth(-50);
ut.Assert(ymd7 == YYYYMMDD(19860927),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(1986,10,27);
ymd7.SubtractMonth(-1);
ut.Assert(ymd7 == YYYYMMDD(19861127),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractMonth(2);
ut.Assert(ymd7 == YYYYMMDD(19860927),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractMonth(-50);
ut.Assert(ymd7 == YYYYMMDD(19901127),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractMonth(50);
ut.Assert(ymd7 == YYYYMMDD(19860927),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(2012,2,29);
ymd7.AddDay(1);
ut.Assert(ymd7 == YYYYMMDD(20120301),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddDay(-2);
ut.Assert(ymd7 == YYYYMMDD(20120228),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddDay(50);
ut.Assert(ymd7 == YYYYMMDD(20120418),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddDay(-350);
ut.Assert(ymd7 == YYYYMMDD(20110504),__FILE__,__FUNCTION__,__LINE__);
ymd7.AddDay(66);
ut.Assert(ymd7 == YYYYMMDD(20110709),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(2012,2,29);
ymd7.SubtractDay(-1);
ut.Assert(ymd7 == YYYYMMDD(20120301),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractDay(2);
ut.Assert(ymd7 == YYYYMMDD(20120228),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractDay(-50);
ut.Assert(ymd7 == YYYYMMDD(20120418),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractDay(350);
ut.Assert(ymd7 == YYYYMMDD(20110504),__FILE__,__FUNCTION__,__LINE__);
ymd7.SubtractDay(-66);
ut.Assert(ymd7 == YYYYMMDD(20110709),__FILE__,__FUNCTION__,__LINE__);
ymd7.Set(2012,2,29);
YYYYMMDD ymd8;
ymd7.ToYYYYMMDD(ymd8);
ut.Assert(ymd7 == ymd8,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.ToStrYM() == "201202",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.ToStrYM_() == "2012-02",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.ToStr() == "20120229",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd7.ToStr_() == "2012-02-29",__FILE__,__FUNCTION__,__LINE__);
ymd7.FromYYYYMMDD(YYYYMMDD(20110320));
ut.Assert(ymd7 == YYYYMMDD(20110320),__FILE__,__FUNCTION__,__LINE__);
//---------------------------------------------
{
YYYYMMDD ymd9(20150823);
YYYYMMDD ymd10(20150723);
ut.Assert(ymd9 - ymd10 == 31, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd10 - ymd9 == 31, __FILE__,__FUNCTION__,__LINE__);
}
//---------------------------------------------
HHMMSS hms1;
ut.AssertF(hms1.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms1 == HHMMSS(),__FILE__,__FUNCTION__,__LINE__);
hms1.Set(5,45,13);
HHMMSS hms2(hms1);
ut.Assert(hms2 == HHMMSS(54513),__FILE__,__FUNCTION__,__LINE__);
HHMMSS hms3("23:03:59");
ut.Assert(hms3 == HHMMSS(230359),__FILE__,__FUNCTION__,__LINE__);
HHMMSS hms4(53309);
ut.Assert(hms4 == HHMMSS(53309),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms4.Value() == 53309,__FILE__,__FUNCTION__,__LINE__);
hms4.Set("16:00:12");
ut.Assert(hms4 == HHMMSS(160012),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms4.Value() == 160012,__FILE__,__FUNCTION__,__LINE__);
hms4.Set(190112);
ut.Assert(hms4 == HHMMSS(190112),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms4.Value() == 190112,__FILE__,__FUNCTION__,__LINE__);
hms4.Set(2,22);
ut.Assert(hms4 == HHMMSS(22200),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms4.Value() == 22200,__FILE__,__FUNCTION__,__LINE__);
hms4.Invalidate();
ut.AssertF(hms4.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms4 == HHMMSS(),__FILE__,__FUNCTION__,__LINE__);
HHMMSS hms5(151500);
ut.Assert(hms5 == HHMMSS(151500),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 != HHMMSS(151501),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 > HHMMSS(151459),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 >= HHMMSS(151459),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 >= HHMMSS(151500),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 < HHMMSS(151501),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 <= HHMMSS(151501),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 <= HHMMSS(151500),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 == HMS(15,15, 0),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 != HMS(15,15, 1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 > HMS(15,14,59),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 >= HMS(15,14,59),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 >= HMS(15,15, 0),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 < HMS(15,15, 1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 <= HMS(15,15, 1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5 <= HMS(15,15, 0),__FILE__,__FUNCTION__,__LINE__);
hms5.Set(1,1,0);
ut.Assert(hms5.ToStrHM() == "0101",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5.ToStr() == "010100",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5.ToStrHM_() == "01:01",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5.ToStr_() == "01:01:00",__FILE__,__FUNCTION__,__LINE__);
hms5.Set(19,11,59);
ut.Assert(hms5.ToStrHM() == "1911",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5.ToStr() == "191159",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5.ToStrHM_() == "19:11",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms5.ToStr_() == "19:11:59",__FILE__,__FUNCTION__,__LINE__);
//--------------------------------------------------
//---------------------------------------------
HHMM hm1;
ut.AssertF(hm1.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm1 == HHMM(),__FILE__,__FUNCTION__,__LINE__);
hm1.Set(5,45);
HHMM hm2(hm1);
ut.Assert(hm2 == HHMM(545),__FILE__,__FUNCTION__,__LINE__);
HHMM hm3("23:03");
ut.Assert(hm3 == HHMM(2303),__FILE__,__FUNCTION__,__LINE__);
hm3.Set(hms3);
ut.Assert(hm3 == HHMM(2303),__FILE__,__FUNCTION__,__LINE__);
HHMM hm4(533);
ut.Assert(hm4 == HHMM(533),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm4.Value() == 533,__FILE__,__FUNCTION__,__LINE__);
hm4.Set("16:00");
ut.Assert(hm4 == HHMM(1600),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm4.Value() == 1600,__FILE__,__FUNCTION__,__LINE__);
hm4.Set(1901);
ut.Assert(hm4 == HHMM(1901),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm4.Value() == 1901,__FILE__,__FUNCTION__,__LINE__);
hm4.Set(2,22);
ut.Assert(hm4 == HHMM(222),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm4.Value() == 222,__FILE__,__FUNCTION__,__LINE__);
hm4.Invalidate();
ut.AssertF(hm4.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm4 == HHMM(),__FILE__,__FUNCTION__,__LINE__);
HHMM hm5(1515);
ut.Assert(hm5 == HHMM(1515),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 != HHMM(1516),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 > HHMM(1514),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 >= HHMM(1514),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 >= HHMM(1515),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 < HHMM(1517),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 <= HHMM(1515),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5 <= HHMM(1515),__FILE__,__FUNCTION__,__LINE__);
hm5.Set(1,1);
ut.Assert(hm5.ToStr() == "0101",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5.ToStr_() == "01:01",__FILE__,__FUNCTION__,__LINE__);
hm5.Set(19,11);
ut.Assert(hm5.ToStr() == "1911",__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hm5.ToStr_() == "19:11",__FILE__,__FUNCTION__,__LINE__);
//--------------------------------------------------
HMS hms6(hms5);
ut.Assert(hms6 == HMS(19,11,59),__FILE__,__FUNCTION__,__LINE__);
HMS hms7;
ut.AssertF(hms7.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms7 == HMS(),__FILE__,__FUNCTION__,__LINE__);
hms7.Set(4,6,23);
HMS hms8(hms7);
ut.Assert(hms8 == HMS(4,6,23),__FILE__,__FUNCTION__,__LINE__);
hms7.SetMinute(12);
ut.Assert(hms7 == HMS(4,12,23),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms7.Minute() == 12,__FILE__,__FUNCTION__,__LINE__);
hms7.SetHour(13);
ut.Assert(hms7 == HMS(13,12,23),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms7.Hour() == 13,__FILE__,__FUNCTION__,__LINE__);
hms7.SetSecond(7);
ut.Assert(hms7 == HMS(13,12,7),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms7.Second() == 7,__FILE__,__FUNCTION__,__LINE__);
hms7.Invalidate();
ut.AssertF(hms7.IsValid(),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms7 == HMS(),__FILE__,__FUNCTION__,__LINE__);
HMS hms9(15,15,0);
ut.Assert(hms9 == HMS(15,15, 0),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 != HMS(15,15, 1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 > HMS(15,14,59),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 >= HMS(15,14,59),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 >= HMS(15,15, 0),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 < HMS(15,15, 1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 <= HMS(15,15, 1),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 <= HMS(15,15, 0),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 == HHMMSS(151500),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 != HHMMSS(151501),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 > HHMMSS(151459),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 >= HHMMSS(151459),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 >= HHMMSS(151500),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 < HHMMSS(151501),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 <= HHMMSS(151501),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9 <= HHMMSS(151500),__FILE__,__FUNCTION__,__LINE__);
hms9.Set(3,9,1);
HHMMSS hms10;
hms9.ToHHMMSS(hms10);
ut.Assert(hms10 == HHMMSS(30901),__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStrHM() == "0309" ,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStr() == "030901" ,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStrHM_() == "03:09" ,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStr_() == "03:09:01",__FILE__,__FUNCTION__,__LINE__);
hms9.Set(19,59,31);
ut.Assert(hms9.ToStrHM() == "1959" ,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStr() == "195931" ,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStrHM_() == "19:59" ,__FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms9.ToStr_() == "19:59:31",__FILE__,__FUNCTION__,__LINE__);
HMS hms;
hms.Set( 0, 0, 0); ut.Assert(hms.AddMinute ( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 1, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.AddMinute ( 1440) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0,10, 3); ut.Assert(hms.AddMinute ( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0,11, 3),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 9,10, 3); ut.Assert(hms.AddMinute ( 2) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 9,12, 3),__FILE__,__FUNCTION__,__LINE__);
hms.Set(12,59,59); ut.Assert(hms.AddMinute ( 10) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(13, 9,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(19,59,59); ut.Assert(hms.AddMinute ( 240) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,59,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(23,59,59); ut.Assert(hms.AddMinute ( 18) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0,17,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(23,59,59); ut.Assert(hms.AddMinute ( 1) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.SubtractMinute( 1) == -1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,59, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.SubtractMinute( 1440) == -1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0,10, 3); ut.Assert(hms.SubtractMinute( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 9, 3),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 9,10, 3); ut.Assert(hms.SubtractMinute( 2) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 9, 8, 3),__FILE__,__FUNCTION__,__LINE__);
hms.Set(12, 0,59); ut.Assert(hms.SubtractMinute( 10) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(11,50,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(19,59,59); ut.Assert(hms.SubtractMinute( 240) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(15,59,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 9,59); ut.Assert(hms.SubtractMinute( 18) == -1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,51,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(23,59,59); ut.Assert(hms.SubtractMinute( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,58,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.AddSecond ( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 1),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.AddSecond ( 86400) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.AddSecond ( 86401) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 1),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0,10, 3); ut.Assert(hms.AddSecond ( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0,10, 4),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 9,10, 3); ut.Assert(hms.AddSecond ( 2) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 9,10, 5),__FILE__,__FUNCTION__,__LINE__);
hms.Set(12,59,59); ut.Assert(hms.AddSecond ( 10) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(13, 0, 9),__FILE__,__FUNCTION__,__LINE__);
hms.Set(19,59,59); ut.Assert(hms.AddSecond ( 14400) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,59,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(23,59,59); ut.Assert(hms.AddSecond ( 18) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0,17),__FILE__,__FUNCTION__,__LINE__);
hms.Set(23,59,59); ut.Assert(hms.AddSecond ( 1) == 1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.SubtractSecond( 1) == -1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,59,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 0); ut.Assert(hms.SubtractSecond( 86400) == -1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0,10, 3); ut.Assert(hms.SubtractSecond( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 0,10, 2),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 9,10, 3); ut.Assert(hms.SubtractSecond( 2) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS( 9,10, 1),__FILE__,__FUNCTION__,__LINE__);
hms.Set(12, 0, 9); ut.Assert(hms.SubtractSecond( 10) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(11,59,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set(19,59,59); ut.Assert(hms.SubtractSecond( 14400) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(15,59,59),__FILE__,__FUNCTION__,__LINE__);
hms.Set( 0, 0, 9); ut.Assert(hms.SubtractSecond( 18) == -1,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,59,51),__FILE__,__FUNCTION__,__LINE__);
hms.Set(23,59,59); ut.Assert(hms.SubtractSecond( 1) == 0,__FILE__,__FUNCTION__,__LINE__); ut.Assert(hms == HMS(23,59,58),__FILE__,__FUNCTION__,__LINE__);
//---------------------------------------------
YMDHMS yh(2014,6,8,13,30,15);
ut.Assert(yh.GetYMD() == YMD(2014,6,8), __FILE__,__FUNCTION__,__LINE__);
ut.Assert(yh.GetHMS() == HMS(13,30,15), __FILE__,__FUNCTION__,__LINE__);
YMDHMS yh2(2014,6,8,13,30,16);
YMDHMS yh3(2015,6,8,13,30,15);
ut.AssertF(yh == yh2, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(yh == yh3, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(yh == yh, __FILE__,__FUNCTION__,__LINE__);
//---------------------------------------------
yh.SetYMD(2014,6,8); yh.SetHMS( 0, 0, 0); yh.AddMinute( 1); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 1, 0),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 0, 0, 0); yh.AddMinute( 1440); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 0,10, 3); yh.AddMinute( 1); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0,11, 3),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 9,10, 3); yh.AddMinute( 2); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 9,12, 3),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(12,59,59); yh.AddMinute( 10); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS(13, 9,59),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(19,59,59); yh.AddMinute( 240); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS(23,59,59),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(23,59,59); yh.AddMinute( 18); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0,17,59),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(23,59,59); yh.AddMinute( 1); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0,59),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 0, 0, 0); yh.AddSecond( 1); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0, 1),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 0, 0, 0); yh.AddSecond( 86400); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 0, 0, 0); yh.AddSecond( 86401); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0, 1),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 0,10, 3); yh.AddSecond( 1); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0,10, 4),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS( 9,10, 3); yh.AddSecond( 2); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 9,10, 5),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(12,59,59); yh.AddSecond( 10); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS(13, 0, 9),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(19,59,59); yh.AddSecond( 14400); ut.Assert(yh.GetYMD() == YMD(2014,6,8),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS(23,59,59),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(23,59,59); yh.AddSecond( 18); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0,17),__FILE__,__FUNCTION__,__LINE__);
yh.SetYMD(2014,6,8); yh.SetHMS(23,59,59); yh.AddSecond( 1); ut.Assert(yh.GetYMD() == YMD(2014,6,9),__FILE__,__FUNCTION__,__LINE__); ut.Assert(yh.GetHMS() == HMS( 0, 0, 0),__FILE__,__FUNCTION__,__LINE__);
}
{
YYYYMMDD ymd1;
ymd1.Set(2014,6,29);
ut.Assert(ymd1.Year() == 2014, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd1.Month() == 6, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymd1.Day() == 29, __FILE__,__FUNCTION__,__LINE__);
}
{
cout << "SunnyDebug: " << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ") " << endl << flush;
YYYYMMDDHHMMSS ymdhms1(20150118,114200);
const YYYYMMDD & ymd = ymdhms1.GetYYYYMMDD();
const HHMMSS & hms = ymdhms1.GetHHMMSS();
ut.Assert(ymd.ToInt() == 20150118, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms.ToInt() == 114200, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 < ymdhms1, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 <= ymdhms1, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 > ymdhms1, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 >= ymdhms1, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 == ymdhms1, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 != ymdhms1, __FILE__,__FUNCTION__,__LINE__);
YYYYMMDDHHMMSS ymdhms2(20150118,114201);
ut.Assert(ymdhms1 < ymdhms2, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 <= ymdhms2, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 > ymdhms2, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 >= ymdhms2, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 == ymdhms2, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 != ymdhms2, __FILE__,__FUNCTION__,__LINE__);
YYYYMMDDHHMMSS ymdhms3(20150119,114200);
ut.Assert(ymdhms1 < ymdhms3, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 <= ymdhms3, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 > ymdhms3, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 >= ymdhms3, __FILE__,__FUNCTION__,__LINE__);
ut.AssertF(ymdhms1 == ymdhms3, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms1 != ymdhms3, __FILE__,__FUNCTION__,__LINE__);
}
{
YYYYMMDDHHMMSS ymdhms1(20150119,114200);
YYYYMMDDHHMMSS ymdhms2(20150119,114201);
ut.Assert(ymdhms2 - ymdhms1 == 1, __FILE__,__FUNCTION__,__LINE__);
cout << "SunnyDebug: " << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ") " << ymdhms2 - ymdhms1 << endl << flush;
}
{
YYYYMMDDHHMMSS ymdhms1(20150119,104200);
YYYYMMDDHHMMSS ymdhms2(20150120,94200);
ut.Assert(ymdhms2 - ymdhms1 == 23*60*60, __FILE__,__FUNCTION__,__LINE__);
cout << "SunnyDebug: " << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ") " << ymdhms2 - ymdhms1 << endl << flush;
}
{
YYYYMMDDHHMMSS ymdhms1(20150120,94200);
YYYYMMDDHHMMSS ymdhms2(20150119,104200);
ut.Assert(ymdhms2 - ymdhms1 == -23*60*60, __FILE__,__FUNCTION__,__LINE__);
cout << "SunnyDebug: " << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ") " << ymdhms2 - ymdhms1 << endl << flush;
}
{
HHMMSS hms1(91800);
HHMMSS hms2(101800);
ut.Assert(hms2 - hms1 == 60*60, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms1 - hms2 == -60*60, __FILE__,__FUNCTION__,__LINE__);
}
{
HMS hms1(91800);
ut.Assert(hms1.Hour() == 9, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms1.Minute() ==18, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms1.Second() == 0, __FILE__,__FUNCTION__,__LINE__);
HMS hms2(191850);
ut.Assert(hms2.Hour() ==19, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms2.Minute() ==18, __FILE__,__FUNCTION__,__LINE__);
ut.Assert(hms2.Second() ==50, __FILE__,__FUNCTION__,__LINE__);
}
{
YMDHMS ymdhms;
ymdhms.Set(YYYYMMDD(20150407));
ymdhms.Set(HHMMSS(140138));
ut.Assert(ymdhms.GetYMD() == YMD(2015, 4, 7), __FILE__,__FUNCTION__,__LINE__);
ut.Assert(ymdhms.GetHMS() == HMS(14, 1,38), __FILE__,__FUNCTION__,__LINE__);
}
{
YYYYMMDDHHMMSS ymdhms("2015-10-17","04:30:00");
YYYYMMDDHHMMSS ymdhmsOut = SDateTime::ChangeTimeZone(ymdhms, SDateTime::HKT, SDateTime::EST);
ut.Assert(ymdhmsOut == YYYYMMDDHHMMSS("2015-10-16","16:30:00"), __FILE__,__FUNCTION__,__LINE__);
}
{
YYYYMMDDHHMMSS ymdhms("2015-10-16","21:30:00");
YYYYMMDDHHMMSS ymdhmsOut = SDateTime::ChangeTimeZone(ymdhms, SDateTime::HKT, SDateTime::EST);
ut.Assert(ymdhmsOut == YYYYMMDDHHMMSS("2015-10-16","09:30:00"), __FILE__,__FUNCTION__,__LINE__);
}
{
YYYYMMDDHHMMSS ymdhms("2015-10-16","11:30:00");
YYYYMMDDHHMMSS ymdhmsOut = SDateTime::ChangeTimeZone(ymdhms, SDateTime::EST, SDateTime::HKT);
ut.Assert(ymdhmsOut == YYYYMMDDHHMMSS("2015-10-16","23:30:00"), __FILE__,__FUNCTION__,__LINE__);
}
{
YYYYMMDDHHMMSS ymdhms("2015-10-16","16:30:00");
YYYYMMDDHHMMSS ymdhmsOut = SDateTime::ChangeTimeZone(ymdhms, SDateTime::EST, SDateTime::HKT);
ut.Assert(ymdhmsOut == YYYYMMDDHHMMSS("2015-10-17","04:30:00"), __FILE__,__FUNCTION__,__LINE__);
}
// //Get Year / Month / Day
// ut.Assert(SDateTime::GetYear(20110531) == 2011,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(20110501) == 2011,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(19701201) == 1970,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(19991231) == 1999,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(201105) == 2011,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(202105) == 2021,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(197012) == 1970,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetYear(199912) == 1999,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(20110531) == 5,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(20110501) == 5,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(20111201) == 12,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(20111231) == 12,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(201112) == 12,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(200101) == 1,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetMonth(190005) == 5,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetDay(20110531) == 31,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetDay(20110501) == 1,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetDay(20111201) == 1,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::GetDay(20111231) == 31,__FILE__,__FUNCTION__,__LINE__);
//
// int iY,iM,iD;
// SDateTime::GetYMD(20130103,iY,iM,iD); ut.Assert(iY == 2013 && iM == 1 && iD == 3,__FILE__,__FUNCTION__,__LINE__);
// SDateTime::GetYMD(19801231,iY,iM,iD); ut.Assert(iY == 1980 && iM == 12 && iD == 31,__FILE__,__FUNCTION__,__LINE__);
//
//
//
// ut.Assert(SDateTime::NextMonthStrict(20130131) == 20130228,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130228) == 20130328,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130328) == 20130428,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130331) == 20130430,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130430) == 20130530,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000130) == 20000229,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000131) == 20000229,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000101) == 20000201,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000229) == 20000329,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000228) == 20000328,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130120,31) == 20130228,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130220,28) == 20130328,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130220,31) == 20130331,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130328,28) == 20130428,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130328,30) == 20130430,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20130328,31) == 20130430,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000120,31) == 20000229,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000220,28) == 20000328,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000220,31) == 20000331,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000328,28) == 20000428,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000328,30) == 20000430,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextMonthStrict(20000328,31) == 20000430,__FILE__,__FUNCTION__,__LINE__);
//
//
//
//
// ut.Assert(SDateTime::YYYY_YY(2010).compare("10") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YYYY_YY(2009).compare("09") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YYYY_YY(1980).compare("80") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YYYY_YY(2000).compare("00") == 0,__FILE__,__FUNCTION__,__LINE__);
//
//
// ut.Assert(SDateTime::YMDi("2011,3,4") == 20110304,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMDi("2013-01-23") == 20130123,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::YMDi("2013-01"); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
// ut.Assert(SDateTime::YMDi(2011,3,4) == 20110304,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMDi(2013,01,23) == 20130123,__FILE__,__FUNCTION__,__LINE__);
//
// ut.Assert(SDateTime::YMi("2011,3,4") == 201103,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMi("2013-01-23") == 201301,__FILE__,__FUNCTION__,__LINE__);
//
// ut.Assert(SDateTime::YMi("2010-2") == 201002,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMi("2007-08") == 200708,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::YMi("2013"); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
// ut.Assert(SDateTime::YMi(2011,3,4) == 201103,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMi(2013,01,23) == 201301,__FILE__,__FUNCTION__,__LINE__);
//
// ut.Assert(SDateTime::YMi(2010,2) == 201002,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMi(2007,8) == 200708,__FILE__,__FUNCTION__,__LINE__);
//
//
//
// ut.Assert(SDateTime::YMi(20061005) == 200610,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMi(200611) == 200611,__FILE__,__FUNCTION__,__LINE__);
//
//
//
//
//
// ut.Assert(SDateTime::HMSi("02:12:58") == 21258,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::HMSi("19:45") == 194500,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::HMSi("03:56") == 35600,__FILE__,__FUNCTION__,__LINE__);
//
// try { SDateTime::HMSi("ew:45:22"); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
// ut.Assert(SDateTime::HMSi(2,12,58) == 21258,__FILE__,__FUNCTION__,__LINE__);
//
//
//
// ut.Assert(SDateTime::HMSs(94234).compare("09:42:34") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::HMSs(194234).compare("19:42:34") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::HMSs(190234).compare("19:02:34") == 0,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::HMSs(1945); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
//
//
//
// ut.Assert(SDateTime::HMi("02:13:58") == 213,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::HMi("13:21:58") == 1321,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::HMi("19"); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
//
//
// ut.Assert(SDateTime::HMi(2,13,58) == 213,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::HMi(13,21,58) == 1321,__FILE__,__FUNCTION__,__LINE__);
//
//
//
// ut.Assert(SDateTime::HMs(194234).compare("19:42") == 0,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::HMs(19); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
//
//
//
// ut.Assert(SDateTime::YMDs(20130123).compare("2013-01-23") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMDs(19991003).compare("1999-10-03") == 0,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::YMDs(199709); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
// try { SDateTime::YMDs(1996); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
//
//
//
// ut.Assert(SDateTime::YMs(200211).compare("2002-11") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMs(20141123).compare("2014-11") == 0,__FILE__,__FUNCTION__,__LINE__);
// try { SDateTime::YMs(1996); ut.FailIfReached(__FILE__,__FUNCTION__,__LINE__); }
// catch (exception& e) {}
//
// ut.Assert(SDateTime::YMDs(2001,04,11).compare("2001-04-11") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMs(2009,04,11).compare("2009-04") == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YMs(2003,03).compare("2003-03") == 0,__FILE__,__FUNCTION__,__LINE__);
//
// //NextYMi
// ut.Assert(SDateTime::NextYMi(200303,-4) == 200211,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,-3) == 200212,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,-2) == 200301,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,-1) == 200302,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,0) == 200303,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,1) == 200304,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,5) == 200308,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,9) == 200312,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextYMi(200303,10) == 200401,__FILE__,__FUNCTION__,__LINE__);
//
//
// //NextHMi
// ut.Assert(SDateTime::NextHMi(0003,-80) == 2243,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(0003,-4) == 2359,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(1615,-3) == 1612,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(2301,-2) == 2259,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(1801,-1) == 1800,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(2359,0) == 2359,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(2359,1) == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(2359,5) == 4,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(2359,9) == 8,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(1345,10) == 1355,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(1345,70) == 1455,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::NextHMi(2345,70) == 55,__FILE__,__FUNCTION__,__LINE__);
//
// ut.Assert(SDateTime::YYYYMM(20230625) == 202306,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YYYYMM(20030625) == 200306,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::YYYYMM(19970625) == 199706,__FILE__,__FUNCTION__,__LINE__);
//
// //Month diff
// ut.Assert(SDateTime::MthDiff(201010,201105) == 7,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::MthDiff(201105,201010) == -7,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::MthDiff(201105,201105) == 0,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::MthAbsDiff(201010,201105) == 7,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::MthAbsDiff(201105,201010) == 7,__FILE__,__FUNCTION__,__LINE__);
// ut.Assert(SDateTime::MthAbsDiff(201105,201105) == 0,__FILE__,__FUNCTION__,__LINE__);
ut.PrintResult();
return 0;
}
<file_sep>/oti_mdi_common/include/ParsedMarketData.h
#ifndef _PARSEDMARKETDATA_H_
#define _PARSEDMARKETDATA_H_
#include <string>
#include <iostream>
using namespace std;
class ParsedMarketData {
public:
string m_id;
string m_feedcode;
int m_lastUpdateTime;
bool m_updated; // boolean to record if this data has been updated
long long m_accSize;
double m_bid[10];
long long m_bid_size[10];
double m_ask[10];
long long m_ask_size[10];
double m_lastTradedPrice;
int m_trade_date;
int m_lastUpdateTime_milliSecond;
ParsedMarketData();
//ParsedMarketData(int, int);
//ParsedMarketData(const ParsedMarketData& pmd);
virtual ~ParsedMarketData();
void printMarketData(ostream&);
void printMarketDataWithFullTimeStampAndPerTrade(ostream &os,string timestamp,double tradesize);
void printFirstLevelOnly(ostream&);
};
#endif // End of _PARSEDMARKETDATA__H_
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyS11A.h
#ifndef PORTFOLIOSTRATEGYS11A_H_
#define PORTFOLIOSTRATEGYS11A_H_
// #include "PCH.h"
// #include "Constants.h"
// #include <boost/ptr_container/ptr_deque.hpp>
// #include <deque>
// #include "SystemState.h"
// #include "SystemConfig.h"
// #include "MDI_Acknowledgement.h"
// #include "MarketData.h"
// #include "HKFE.h"
// #include "TechIndicators.h"
// #include "PortfoliosAndOrders.h"
// #include "TradeWarehouse.h"
// #include "GumbelCopula.h"
// #include "CauchyDistribution.h"
// #include "GaussianDistribution.h"
//
// #define MIN_HOLDINGPERIOD_SEC 60
// #define AVOID_TRADING_NEAR_MKTOPEN_SEC 240
// #define AVOID_TRADING_NEAR_MKTCLOSE_SEC 120
// #define EXTRABUFFER_OPENTRADE_SEC 120
//
//
// class StrategyS11A {
// public:
// enum TRADEDIR {NODIR=0,LONG=1,SHORT=2};
// enum S11A_SubSystem
// {
// S11A_T1GBM =0,
// S11A_T1GUMBELCAUCHY =1,
// S11A_T1GUMBELGAUSS =2,
// S11A_T2GBM =3,
// S11A_T2PCTL =4,
// S11A_T2COPU =5,
// S11A_LAST =6
// };
// StrategyS11A();
// virtual ~StrategyS11A();
// void Run();
//
// private:
// long m_CalcIntervalInSeconds;
// string GetSubSystemName(const S11A_SubSystem);
// void ReportAckIfNeeded();
// void InitFromSysConfig();
// bool GetLegPrices();
// void GetSDCorrel();
// void OutputStratParam(const S11A_SubSystem, const int);
// TRADEDIR OpenTrade(const S11A_SubSystem, const int);
// void CloseTrade(const S11A_SubSystem, const TRADEDIR, const int);
// void TradeSynchronizedOrders();
// void CalcNumCtrt();
// void CalcLnRtnGBMParam(const int);
//
// //--------------------------------------------------
// // System objects
// //--------------------------------------------------
// boost::shared_ptr<MarketData> m_MarketData;
// boost::shared_ptr<SystemState> m_SystemState;
// boost::shared_ptr<SystemConfig> m_SysCfg;
// boost::shared_ptr<Logger> m_Logger;
// boost::shared_ptr<TechIndicators> m_TechInd;
// boost::shared_ptr<PortfoliosAndOrders> m_PortAndOrders;
// boost::shared_ptr<HKFE> m_HKFE;
// boost::shared_ptr<MDI_Acknowledgement> m_MDIAck;
//
// //--------------------------------------------------
// // Store param file data
// //--------------------------------------------------
// map<YYYYMMDD,double> m_map_HSI_IV;
// map<YYYYMMDD,double> m_map_HHI_IV;
// map<YYYYMMDD,double> m_map_HSI_HistSD;
// map<YYYYMMDD,double> m_map_HHI_HistSD;
// map<YYYYMMDD,double> m_map_HSI_HHI_Correl;
// // map<YYYYMMDD,double> m_map_T2_05Pctl;
// // map<YYYYMMDD,double> m_map_T2_50Pctl;
// // map<YYYYMMDD,double> m_map_T2_95Pctl;
//
// map<YYYYMMDD,double> m_map_T1_GumbelCauchyTheta;
// map<YYYYMMDD,double> m_map_T1_HSI_CauchyLocation;
// map<YYYYMMDD,double> m_map_T1_HSI_CauchyScale;
// map<YYYYMMDD,double> m_map_T1_HHI_CauchyLocation;
// map<YYYYMMDD,double> m_map_T1_HHI_CauchyScale;
//
// map<YYYYMMDD,double> m_map_T1_GumbelGaussTheta;
// map<YYYYMMDD,double> m_map_T1_HSI_LnRtnGaussMean;
// map<YYYYMMDD,double> m_map_T1_HSI_LnRtnGaussSD;
// map<YYYYMMDD,double> m_map_T1_HHI_LnRtnGaussMean;
// map<YYYYMMDD,double> m_map_T1_HHI_LnRtnGaussSD;
//
// string m_ParamFileHistSDCorrel;
// string m_ParamFileHSIHHIIV;
// string m_ParamFileT1GumbelCauchy;
// string m_ParamFileT1GumbelGauss;
// string m_ParamFileT2Copula;
//
// //--------------------------------------------------
//
// bool m_On_S11A_T1GBM;
// bool m_On_S11A_T1GUMBELCAUCHY;
// bool m_On_S11A_T1GUMBELGAUSS;
// bool m_On_S11A_T2GBM;
// bool m_On_S11A_T2PCTL;
// bool m_On_S11A_T2COPU;
//
//
// double dNotionalValuePerLeg;
// double dT1GBMTriggerThreshold;
// double dT1GBMTakeProfitThreshold;
// double dT1GBMStopLossThreshold;
// double dT2GBMTriggerThreshold;
// double dT2GBMTakeProfitThreshold;
// double dT2GBMStopLossThreshold;
// double dT1GumbelCauchyTriggerThreshold;
// double dT1GumbelCauchyTakeProfitThreshold;
// double dT1GumbelCauchyStopLossThreshold;
// double dT1GumbelCauchyPeriod;
// double dT1GumbelCauchyEOLPeriod;
// double dT1GumbelCauchyThetaMean;
// double dT1GumbelCauchyThetaMeanReversion;
// double dT1GumbelCauchyMarginalSDScaling;
//
// double dT1GumbelGaussTriggerThreshold;
// double dT1GumbelGaussTakeProfitThreshold;
// double dT1GumbelGaussStopLossThreshold;
// double dT1GumbelGaussPeriod;
// double dT1GumbelGaussEOLPeriod;
// double dT1GumbelGaussThetaMean;
// double dT1GumbelGaussThetaMeanReversion;
// double dT1GumbelGaussMarginalSDScaling;
// double dT1GumbelGaussSigalLimit;
//
// double dT2CopuTriggerThreshold;
// double dT2CopuTakeProfitThreshold;
// double dT2CopuStopLossThreshold;
// vector<long> m_T2_MAPeriods;
//
// double dT2PctlPeriod;
// double dT2CopuPeriod;
//
// vector<long> m_T1GBM_DeltaTPeriods;
// vector<long> m_T2GBM_DeltaTPeriods;
//
// YYYYMMDDHHMMSS m_ymdhms_LastMonitorTime;
// map<string,double> m_SynchronizedTrades;
//
// double dHSIPrice;
// double dHHIPrice;
// double dHSIHistSD;
// double dHHIHistSD;
// double dHSIIV;
// double dHHIIV;
// double dHSIHistVar;
// double dHHIHistVar;
// double dHSIIVar;
// double dHHIIVar;
// double dHSIHHICorrel;
//
// int iLastSysYYYYMMDD;
// string sHSI_Fut;
// string sHHI_Fut;
// string sMHI_Fut;
// string sMCH_Fut;
// string sHSI_Fut_DTM_GT_1;
// string sHHI_Fut_DTM_GT_1;
// string sMHI_Fut_DTM_GT_1;
// string sMCH_Fut_DTM_GT_1;
// string sHSI_Fut_DTM_GT_10;
// string sHHI_Fut_DTM_GT_10;
// string sMHI_Fut_DTM_GT_10;
// string sMCH_Fut_DTM_GT_10;
// YYYYMMDD ymdExpDate;
// YYYYMMDD ymdExpDate_DTM_GT_1;
// YYYYMMDD ymdExpDate_DTM_GT_10;
//
// TradeWarehouse m_TradeWarehouse[(int)S11A_LAST];
// YYYYMMDDHHMMSS ymdhms_SysTime;
// YYYYMMDDHHMMSS ymdhms_TmpOpenTradeTime;
// HHMMSS m_StartTime;
// HHMMSS m_EndTime;
// bool m_bFirstTrade;
//
//
// //S11A_T1GBM
// //S11A_T1GUMBELCAUCHY / S11A_T1GUMBELGAUSS / S11A_T2COPU
// double dEDeltaGamma,dSDDeltaGamma,dHSILnRtn,dHHILnRtn,dLnRtnDiff;
// double dPrevLnHSIHHIRatio;
//
// //S11A_T2GBM / S11A_T2PCTL
// double dDeltaT,dEGamma,dSDGamma,dCurLnHSIHHIRatio,dLongerTermLnHSIHHIRatio;
//
// //--------------------------------------------------
// double dHHILegSize;
// double dHSILegSize_1;
// int iNoOfCtrtHSI_1;
// int iNoOfCtrtMHI_1;
// int iNoOfCtrtHHI_1;
// int iNoOfCtrtMCH_1;
//
// double dHSILegSize_2;
// int iNoOfCtrtHSI_2;
// int iNoOfCtrtMHI_2;
// int iNoOfCtrtHHI_2;
// int iNoOfCtrtMCH_2;
//
// int iNoOfCtrtHSI;
// int iNoOfCtrtMHI;
// int iNoOfCtrtHHI;
// int iNoOfCtrtMCH;
//
// };
#endif
<file_sep>/NirvanaCommonTest/run.sh
#!/bin/bash
rm -f core*
#./Debug/NirvanaCommonTest
gdb ./Debug/NirvanaCommonTest
<file_sep>/oti_mdi_common/backup/ATU_Logger.cpp
#include "ATU_Logger.h"
using namespace ost;
using namespace std;
namespace atu {
ATU_Logger::ATU_Logger(string datapath, string filename,int timerShareMemoryKey) :m_isShutdown(false),m_Timer(NULL),m_isReady(false)
{
m_Timer = new ATU_Timer(timerShareMemoryKey);
m_Timer->detach();
m_Timer->init();
//usleep(1000 * 1000 * _ATU_LOGGER_INITIAL_SLEEP_SECOND_);
//m_Timer->setTimeStamp(); // This will be called when getTimStamp
//m_Timer->setTimeStamp_YMDHMS(); // Still need?
m_Datapath = datapath;
m_FileName = filename;
char outFileName[1000];
char outFileName2[1000];
char outFileName3[1000];
string timestamp = m_Timer->getTimeStamp();
m_StartLogTimeStamp = timestamp;
sprintf(outFileName, "%s/%s/%s.%s.%s", m_Datapath.c_str(), "log", filename.c_str(), timestamp.c_str(), "log");
sprintf(outFileName2, "%s/%s/%s.%s", m_Datapath.c_str(), "log", filename.c_str(), "log");
sprintf(outFileName3, "%s.%s.%s", filename.c_str(), timestamp.c_str(), "log");
m_GeneralLogFile.open(outFileName);
char cmd[3000];
sprintf(cmd, "rm %s", outFileName2);
system(cmd);
sprintf(cmd, "ln -s %s %s", outFileName3, outFileName2);
system(cmd);
m_LogSecStat=true;
m_TimestampToLogMsgDelimiter=" : ";
// usleep(1000*5);
}
ATU_Logger::~ATU_Logger() {
//#ifdef _ATUDEBUG_
cout << "Destroying ATU_Logger..." << endl;
cout.flush();
//#endif // _ATUDEBUG_
}
bool ATU_Logger::isReady() {
return m_isReady;
}
void ATU_Logger::run(void) {
if (m_Timer==NULL) {
cout << "m_Timer is NULL" << endl;
}
if (m_Timer->m_isMaster) {
if (m_LogSecStat) {
addLog("Start running Logger with Timer in Master mode",2);
// TODO:
// If Timer service is not started, the whole application (and their children) should exit (CCF 20130520)
::exit(1);
}
} else {
if (m_LogSecStat) {
addLog("Start running Logger with Timer in Slave mode",2);
}
}
int count = 0;
time_t lastSec=0;
int writesize = 0;
while (!m_isShutdown && m_Timer!=NULL) {
m_isReady=true;
if (m_Timer->m_ShareMemoryTimerData->m_tS.tv_sec != lastSec) {
if (m_LogSecStat) {
LogStream cooo(5);
cooo << "Logger:Writing " << count << " log msg per sec with ";
cooo << (double) writesize / (double) 1024 << "kb "
<< " pending queue=size=" << m_LogMsgQueue.size();
addLog(cooo.str(), 0);
}
count = 0;
lastSec = m_Timer->m_ShareMemoryTimerData->m_tS.tv_sec;
writesize = 0;
}
lastSec = m_Timer->m_ShareMemoryTimerData->m_tS.tv_sec;
int size = 0;
//int ret = writeLog(size);
writeLog(size);
writesize += size;
if (size > 0) {
count++;
} else {
m_LogMsgQueueLock.wait(1, true);
}
}
while (!m_isShutdown2) {
usleep(1000);
}
}
void ATU_Logger::final(void) {
cout << "finalizing Logger" << endl;
cout.flush();
m_GeneralLogFile.close();
}
bool ATU_Logger::addLog(ATU_Logger *logger ,string msg, int writeToConsole) {
if (logger!=NULL) {
logger->addLog(msg, writeToConsole);
} else {
cout << msg << endl;
}
return true;
}
int ATU_Logger::addLog(string msg, int writeToConsole) {
// assert(msg.size()!=0);
if (msg.length()==0) return 0;
string msgout = "";
m_LogMsgQueueMutex.enterMutex();
msgout = m_Timer->getTimeStamp() + m_TimestampToLogMsgDelimiter + msg;
//adding timestamp to msg;
m_LogMsgQueue.push(msgout);
m_LogMsgQueueWriteToConsole.push(writeToConsole);
m_LogMsgQueueMutex.leaveMutex();
m_LogMsgQueueLock.signal(true);
return true;
}
int ATU_Logger::writeLog(int &size) {
size = 0;
string msg;
int writeToConsole = 0;
m_LogMsgQueueMutex.enterMutex();
if (!m_LogMsgQueue.empty()) {
msg = m_LogMsgQueue.front();
writeToConsole = m_LogMsgQueueWriteToConsole.front();
m_LogMsgQueue.pop();
m_LogMsgQueueWriteToConsole.pop();
m_LogMsgQueueMutex.leaveMutex();
size = msg.length();
m_GeneralLogFile << msg << endl;
m_GeneralLogFile.flush();
if (writeToConsole != 0) {
cout << msg << endl;
}
} else {
m_LogMsgQueueMutex.leaveMutex();
}
return true;
}
void ATU_Logger::backupFileCopy(string filename,string directory)
{
char outFileName[3000];
char srcFileName[3000];
sprintf(outFileName,"%s/%s/%s.%s",m_Datapath.c_str(),directory.c_str(),filename.c_str(),m_Timer->getTimeStamp().c_str());
sprintf(srcFileName,"%s/%s",m_Datapath.c_str(),filename.c_str());
char cmd[3000];
sprintf(cmd,"cp %s %s",srcFileName,outFileName);
system(cmd);
}
void ATU_Logger::stop() {
//======== new method ============
m_isShutdown2 = false;
m_isShutdown = true;
usleep(1000);
m_Timer->stop();
cout << "Assigning m_Timer=NULL" << endl;
cout.flush();
m_Timer=NULL;
usleep(1000);
m_isShutdown2 = true;
//================================
/*
m_Timer->stop();
while(m_Timer->isRunning()) {
usleep(1000);
}
m_isShutdown = true;
*/
}
}
<file_sep>/oti_mdi_common/backup/ATU_Logger.h
#ifndef _ATU_LOGGER_H_
#define _ATU_LOGGER_H_
//#include "config.h"
#include "ATU_Timer.h"
#include "Constants.h"
#include "LogStream.h"
#include <queue>
using namespace std;
using namespace ost;
namespace atu
{
class ATU_Logger;
class ATU_Logger : public Thread
{
private:
void run(void);
void final(void);
public:
ATU_Logger();
ATU_Logger(string datapath,string filename,int timershareMemoryKey);
virtual ~ATU_Logger();
string m_Datapath;
string m_FileName;
int writeLog(int &size);
int addLog(string msg,int writeToConsole=0);
static bool addLog(ATU_Logger*, string msg, int writeToConsole=0);
void backupFileCopy(string fielanme,string directory);
void stop();
bool isReady();
queue<string> m_LogMsgQueue;
queue<int> m_LogMsgQueueWriteToConsole;
ofstream m_GeneralLogFile;
Conditional m_LogMsgQueueLock;
Mutex m_LogMsgQueueMutex;
ATU_Timer *m_Timer;
bool m_LogSecStat;
string m_TimestampToLogMsgDelimiter;
private:
bool m_isShutdown;
bool m_isShutdown2;
bool m_isReady;
public:
time_t volatile m_lastSec;
bool m_isMaster;
string m_StartLogTimeStamp;
};
}
#endif //_ATU_LOGGER_H_
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyS13.h
/*
* StrategyS13.h
*
* Created on: Dec 9, 2015
* Author: qy
*/
#ifndef PORTFOLIOGENERATION_STRATEGYS13_H_
#define PORTFOLIOGENERATION_STRATEGYS13_H_
class StrategyS13 {
public:
StrategyS13();
virtual ~StrategyS13();
};
#endif /* PORTFOLIOGENERATION_STRATEGYS13_H_ */
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyR8.cpp
#include <StrategyR8.h>
StrategyR8::StrategyR8() :
StrategyBase()
{
SetStrategyID(STY_R8);
SetStyDomicileMkt(SDM_HK);
UnsetConvenienceVarb();
SetCloseAllPosIfOutsideTrdgHour(ACP_YES);
m_iNumOfParam = 6;
}
StrategyR8::~StrategyR8()
{
}
void StrategyR8::ReadParam()
{
m_DownTrendWindowInSec .clear();
m_DownTrendMagnitude .clear();
m_DownTrendSlopeThreshold.clear();
m_ReboundWindowInSec .clear();
m_TakeProfitMul .clear();
m_StopLossMul .clear();
m_DownTrendWindowInSec .insert(m_DownTrendWindowInSec .begin(),m_TradedSymbols.size(),0);
m_DownTrendMagnitude .insert(m_DownTrendMagnitude .begin(),m_TradedSymbols.size(),0);
m_DownTrendSlopeThreshold.insert(m_DownTrendSlopeThreshold.begin(),m_TradedSymbols.size(),0);
m_ReboundWindowInSec .insert(m_ReboundWindowInSec .begin(),m_TradedSymbols.size(),0);
m_TakeProfitMul .insert(m_TakeProfitMul .begin(),m_TradedSymbols.size(),0);
m_StopLossMul .insert(m_StopLossMul .begin(),m_TradedSymbols.size(),0);
for (unsigned int i = 0; i < m_TradedSymbols.size(); ++i)
{
m_DownTrendWindowInSec [i] = m_ParamVector[i*m_iNumOfParam+0];
m_DownTrendMagnitude [i] = m_ParamVector[i*m_iNumOfParam+1];
m_DownTrendSlopeThreshold[i] = m_ParamVector[i*m_iNumOfParam+2];
m_ReboundWindowInSec [i] = m_ParamVector[i*m_iNumOfParam+3];
m_TakeProfitMul [i] = m_ParamVector[i*m_iNumOfParam+4];
m_StopLossMul [i] = m_ParamVector[i*m_iNumOfParam+5];
m_Logger->Write(Logger::INFO,"Strategy %s: %s m_DownTrendWindowInSec %f", GetStrategyName(m_StyID).c_str(), m_TradedSymbols[i].c_str(), m_DownTrendWindowInSec [i]);
m_Logger->Write(Logger::INFO,"Strategy %s: %s m_DownTrendMagnitude %f", GetStrategyName(m_StyID).c_str(), m_TradedSymbols[i].c_str(), m_DownTrendMagnitude [i]);
m_Logger->Write(Logger::INFO,"Strategy %s: %s m_DownTrendSlopeThreshold %f", GetStrategyName(m_StyID).c_str(), m_TradedSymbols[i].c_str(), m_DownTrendSlopeThreshold[i]);
m_Logger->Write(Logger::INFO,"Strategy %s: %s m_ReboundWindowInSec %f", GetStrategyName(m_StyID).c_str(), m_TradedSymbols[i].c_str(), m_ReboundWindowInSec [i]);
m_Logger->Write(Logger::INFO,"Strategy %s: %s m_TakeProfitMul %f", GetStrategyName(m_StyID).c_str(), m_TradedSymbols[i].c_str(), m_TakeProfitMul [i]);
m_Logger->Write(Logger::INFO,"Strategy %s: %s m_StopLossMul %f", GetStrategyName(m_StyID).c_str(), m_TradedSymbols[i].c_str(), m_StopLossMul [i]);
}
}
void StrategyR8::ParamSanityCheck()
{
}
void StrategyR8::StartOfDayInit()
{
m_EntryPrice.clear();
m_StopLossPrice.clear();
m_TakeProfitPrice.clear();
m_vLinRegr.clear();
m_vHighLowPrice.clear();
m_vHighLowSlope.clear();
for (unsigned int iTradSym = 0; iTradSym < m_TradedSymbols.size(); ++iTradSym)
{
m_EntryPrice.push_back(NAN);
m_StopLossPrice.push_back(NAN);
m_TakeProfitPrice.push_back(NAN);
m_vLinRegr.push_back(LinRegr(m_DownTrendWindowInSec[iTradSym],true));
m_vHighLowPrice.push_back(HighLow<double>(m_DownTrendWindowInSec[iTradSym],true));
m_vHighLowSlope.push_back(HighLow<double>(m_DownTrendWindowInSec[iTradSym],true));
}
}
void StrategyR8::EndOfDayCleanUp()
{
}
void StrategyR8::UnsetConvenienceVarb()
{
}
void StrategyR8::SetConvenienceVarb(const int iTradSym)
{
}
bool StrategyR8::SkipSubseqProcessingForSymbol(const int iTradSym,string & sReason)
{
return false;
}
void StrategyR8::InitialWarmUp(const int iTradSym)
{
}
void StrategyR8::UpdateInternalDataTrng(const int iTradSym)
{
}
void StrategyR8::UpdateInternalData(const int iTradSym)
{
m_vHighLowPrice[iTradSym].Add(m_SymMidQuote);
m_vLinRegr[iTradSym].AddY(m_SymMidQuote);
if (m_vLinRegr[iTradSym].Ready())
{
m_vHighLowSlope[iTradSym].Add(m_vLinRegr[iTradSym].Value());
}
}
void StrategyR8::AdjustSamplingInterval(const int iTradSym)
{
// m_MonitoringIntervalInSec = 10;
return;
}
void StrategyR8::DetermineRegime(const int iTradSym)
{
}
void StrategyR8::PreTradePreparation(const int iTradSym)
{
if (
m_vHighLowSlope[iTradSym].Height() <= m_DownTrendSlopeThreshold[iTradSym] &&
m_vHighLowPrice[iTradSym].Height() >= m_DownTrendMagnitude[iTradSym]
)
{
SetTradeRelatedParam(iTradSym,TD_NODIR,0);
m_StopLossPrice[iTradSym] = 0;
m_TakeProfitPrice[iTradSym] = 0;
}
}
void StrategyR8::CalcPosSize(const int iTradSym)
{
m_TargetAbsPos[iTradSym] = 1;
}
void StrategyR8::LoadOptimalParamsFromTrainingResults()
{
return;
}
void StrategyR8::EndOfDayTrainingForEachTimeBucket(const int iTradSym,const map<HHMMSS,double> & map_HistDataInTimeBucket)
{
return;
}
void StrategyR8::EndOfDayTrainingRoutine(const int iTradSym,const map<HHMMSS,double> & map_HistDataInTimeBucket)
{
}
<file_sep>/oti_mdi_common/src/order/ParsedMarketData.cpp
#include "ParsedMarketData.h"
#include <cstdio>
#include <cstring>
ParsedMarketData::ParsedMarketData(){
#ifdef _ATUDEBUG_
// cout << "creating PMD..." << endl;
#endif // End of _ATUDEBUG_
m_id = "";
m_feedcode = "";
m_accSize = 0;
m_lastTradedPrice = 999999;
m_lastUpdateTime = 0;
m_updated = false;
m_trade_date = 0;
m_lastUpdateTime_milliSecond = 0;
for (int i = 0; i < 10; i++) {
m_bid[i] = 999999;
m_ask[i] = 999999;
m_bid_size[i] = 999999;
m_ask_size[i] = 999999;
}
}
ParsedMarketData::~ParsedMarketData(){
#ifdef _ATUDEBUG_
// cout << "destroying PMD..." << endl;
#endif // End of _ATUDEBUG_
}
/*ParsedMarketData::ParsedMarketData(const ParsedMarketData& pmd) {
#ifdef _ATUDEBUG_
cout << "copying..." << endl;
#endif // End of _ATUDEBUG_
}
*/
void ParsedMarketData::printMarketData(ostream &os){
char line[500];
if (m_trade_date != 0) {
sprintf(line, "%06d_%06d_%06d,%s,%0.3lf,%lld,B",
m_trade_date,
m_lastUpdateTime,
m_lastUpdateTime_milliSecond,
m_feedcode.c_str(),
m_lastTradedPrice,
m_accSize);
} else {
sprintf(line, "%06d,%s,%0.3lf,%lld,B",
m_lastUpdateTime,
m_feedcode.c_str(),
m_lastTradedPrice,
m_accSize);
}
for (int i = 0; i < 5; i++) {
sprintf(line + strlen(line), ",%0.3lf,%lld", m_bid[i], m_bid_size[i]);
}
sprintf(line + strlen(line), ",A");
for (int i = 0; i < 5; i++) {
sprintf(line + strlen(line), ",%0.3lf,%lld", m_ask[i], m_ask_size[i]);
}
os << line << endl;
os.flush();
}
void ParsedMarketData::printMarketDataWithFullTimeStampAndPerTrade(ostream &os,string timestamp,double tradesize){
char line[500];
sprintf(line, "%s,%s,%0.3lf,%.0lf,B",
timestamp.c_str(),
m_feedcode.c_str(),
m_lastTradedPrice,
tradesize);
for (int i = 0; i < 5; i++) {
sprintf(line + strlen(line), ",%0.3lf,%lld", m_bid[i], m_bid_size[i]);
}
sprintf(line + strlen(line), ",A");
for (int i = 0; i < 5; i++) {
sprintf(line + strlen(line), ",%0.3lf,%lld", m_ask[i], m_ask_size[i]);
}
os << line << endl;
os.flush();
}
void ParsedMarketData::printFirstLevelOnly(ostream &os) {
char line[500];
sprintf(line,"%d,%8.3lf,%lld,%8.3lf,%lld",m_lastUpdateTime,m_bid[0],m_bid_size[0],m_ask[0],m_ask_size[0]);
os << line << endl;
os.flush();
}
<file_sep>/NirvanaCommon/ATU/ATU_Abstract_AlgoI.h
/*
* ATU_Abstract_AlgoI.h
*
* Created on: May 25, 2015
* Author: dt
*/
#ifndef ATU_ABSTRACT_ALGOI_H_
#define ATU_ABSTRACT_ALGOI_H_
#include "PCH.h"
#include "Constants.h"
#include "ATU_Abstract_OTI.h"
#include "ATU_Abstract_MDI.h"
#include "ATU_AccumulatedPerformance.h"
#include "ATU_AlgoStrategyPortfolioManager.h"
#include "ATU_DailyPerformance.h"
#include "ATU_SignalBasedPerformance.h"
#include "ATU_ErrorMsgStruct.h"
using namespace atu;
class ATU_Abstract_AlgoI {
public:
ATU_Abstract_AlgoI(): m_signalfeed_call_back_func(NULL),m_portfolio_get_trade_history_call_back_func(NULL),m_portfolio_get_working_orders_call_back_func(NULL),
m_portfolio_get_PnL_call_back_func(NULL),m_portfolio_get_daily_performance_call_back_func(NULL),m_portfolio_get_accum_performance_call_back_func(NULL),
m_portfolio_get_pnl_performance_call_back_func(NULL),m_subscription_call_back_func(NULL),m_unsubscription_call_back_func(NULL),m_acknowledgement_call_back_func(NULL)
{}
virtual ~ATU_Abstract_AlgoI() {}
vector<int> m_tradeBegin;
vector<int> m_tradeEnd;
string m_connectString;
queue<void*> m_msgqueue;
queue<int> m_msgType;
boost::recursive_mutex m_msgqueueMutex;
virtual void setConnectString(string connstr) {
m_connectString=connstr;
}
virtual void register_signalfeed_call_back_func(ATU_OTI_signalfeed_CallBackFunc *callback) {
if(m_signalfeed_call_back_func!=NULL) delete m_signalfeed_call_back_func;
m_signalfeed_call_back_func=callback;
}
virtual void register_portfolio_get_trade_history_call_back_func(ATU_OTI_portfolio_get_trade_history_CallBackFunc *callback) {
if(m_portfolio_get_trade_history_call_back_func!=NULL) delete m_portfolio_get_trade_history_call_back_func;
m_portfolio_get_trade_history_call_back_func=callback;
}
virtual void register_portfolio_get_working_orders_call_back_func(ATU_OTI_portfolio_get_working_orders_CallBackFunc *callback) {
if(m_portfolio_get_working_orders_call_back_func!=NULL) delete m_portfolio_get_working_orders_call_back_func;
m_portfolio_get_working_orders_call_back_func=callback;
}
virtual void register_portfolio_get_PnL_call_back_func(ATU_OTI_portfolio_get_PnL_CallBackFunc *callback){
if(m_portfolio_get_PnL_call_back_func!=NULL) delete m_portfolio_get_PnL_call_back_func;
m_portfolio_get_PnL_call_back_func=callback;
}
virtual void register_portfolio_get_daily_performance_call_back_func(ATU_OTI_portfolio_get_daily_performance_CallBackFunc *callback){
if(m_portfolio_get_daily_performance_call_back_func!=NULL) delete m_portfolio_get_daily_performance_call_back_func;
m_portfolio_get_daily_performance_call_back_func=callback;
}
virtual void register_portfolio_get_accum_performance_call_back_func(ATU_OTI_portfolio_get_accum_performance_CallBackFunc *callback){
if(m_portfolio_get_accum_performance_call_back_func!=NULL) delete m_portfolio_get_accum_performance_call_back_func;
m_portfolio_get_accum_performance_call_back_func=callback;
}
virtual void register_portfolio_get_pnl_performance_call_back_func(ATU_OTI_portfolio_get_pnl_performance_CallBackFunc *callback){
if(m_portfolio_get_pnl_performance_call_back_func!=NULL) delete m_portfolio_get_pnl_performance_call_back_func;
m_portfolio_get_pnl_performance_call_back_func=callback;
}
virtual void register_process_subscription_call_back_func(
ATU_MDI_subscription_CallBackFunc* callback) {
if(m_subscription_call_back_func!=NULL) delete m_subscription_call_back_func;
m_subscription_call_back_func = callback;
}
virtual void register_process_unsubscription_call_back_func(
ATU_MDI_unsubscription_CallBackFunc* callback) {
if(m_unsubscription_call_back_func!=NULL) delete m_unsubscription_call_back_func;
m_unsubscription_call_back_func = callback;
}
virtual void register_process_acknowledgement_call_back_func(
ATU_MDI_acknowledgement_CallBackFunc* callback) {
if(m_acknowledgement_call_back_func!=NULL) delete m_acknowledgement_call_back_func;
m_acknowledgement_call_back_func = callback;
}
virtual bool process_signalfeed(ATU_OTI_signalfeed_struct &s) {
if (m_signalfeed_call_back_func!=NULL) {
return (*m_signalfeed_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_quoterequestfeed(ATU_OTI_quoterequestfeed_struct &s) {
if (m_quoterequestfeed_call_back_func!=NULL) {
return (*m_quoterequestfeed_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_subscription(
ATU_MDI_subscription_struct& s) {
if (m_subscription_call_back_func!=NULL) {
return (*m_subscription_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_unsubscription(
ATU_MDI_unsubscription_struct& s) {
if (m_unsubscription_call_back_func!=NULL) {
return (*m_unsubscription_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_acknowledgement(
ATU_MDI_acknowledgement_struct& s) {
if (m_acknowledgement_call_back_func!=NULL) {
return (*m_acknowledgement_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_marketfeed(ATU_MDI_marketfeed_struct &s){
/*if (m_marketfeed_call_back_func!=NULL) {
return (*m_marketfeed_call_back_func)(s);
} else {
return false;
}*/
bool tradePeriod=false;
for (int i=0;i<m_tradeBegin.size();i++) {
int hrmmss=atoi(s.m_timestamp.substr(9,6).c_str());
if (hrmmss>=m_tradeBegin[i] && hrmmss<=m_tradeEnd[i]) {
tradePeriod=true;
// cout << hrmmss << endl;
}
}
if (tradePeriod) {
for(unsigned int i = 0 ; i < m_marketfeed_call_back_func_list.size() ; i++){
if (m_marketfeed_call_back_func_list[i]!=NULL) {
(*m_marketfeed_call_back_func_list[i])(s);
} else {
return false;
}
}
}
}
virtual bool process_ohlcfeed(ATU_MDI_ohlcfeed_struct &s){
/*if (m_marketfeed_call_back_func!=NULL) {
return (*m_marketfeed_call_back_func)(s);
} else {
return false;
}*/
bool tradePeriod=false;
for (int i=0;i<m_tradeBegin.size();i++) {
int hrmmss=atoi(s.m_timestamp.substr(9,6).c_str());
if (hrmmss>=m_tradeBegin[i] && hrmmss<=m_tradeEnd[i]) {
tradePeriod=true;
// cout << hrmmss << endl;
}
}
if (tradePeriod) {
for(unsigned int i = 0 ; i < m_ohlcfeed_call_back_func_list.size() ; i++){
if (m_ohlcfeed_call_back_func_list[i]!=NULL) {
(*m_ohlcfeed_call_back_func_list[i])(s);
} else {
return false;
}
}
}
}
virtual bool process_ping(ATU_OTI_ping_struct &s) {
if (m_ping_call_back_func!=NULL) {
return (*m_ping_call_back_func)(s);
} else {
return false;
}
}
/*
virtual bool process_reset(ATU_OTI_reset_struct &s) {
if (m_reset_call_back_func!=NULL) {
clearAllCallBackFuncList();
(*m_reset_call_back_func)(s);
return true;
} else {
return false;
}
}
*/
virtual bool process_portfolio_get_trade_history(ATU_OTI_portfolio_get_trade_history_struct &s) {
if (m_portfolio_get_trade_history_call_back_func!=NULL) {
return (*m_portfolio_get_trade_history_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_portfolio_get_working_orders(ATU_OTI_portfolio_get_working_orders_struct &s) {
if (m_portfolio_get_working_orders_call_back_func!=NULL) {
return (*m_portfolio_get_working_orders_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_portfolio_get_PnL(ATU_OTI_portfolio_get_PnL_struct &s) {
if (m_portfolio_get_PnL_call_back_func!=NULL) {
return (*m_portfolio_get_PnL_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_risk_setting(ATU_OTI_risk_setting_struct &s) {
if (m_risk_setting_call_back_func!=NULL) {
return (*m_risk_setting_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_portfolio_get_daily_performance(ATU_OTI_portfolio_get_daily_performance_struct &s) {
if (m_portfolio_get_daily_performance_call_back_func!=NULL) {
return (*m_portfolio_get_daily_performance_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_portfolio_get_accum_performance(ATU_OTI_portfolio_get_accum_performance_struct &s) {
if (m_portfolio_get_accum_performance_call_back_func!=NULL) {
return (*m_portfolio_get_accum_performance_call_back_func)(s);
} else {
return false;
}
}
virtual bool process_portfolio_get_pnl_performance(ATU_OTI_portfolio_get_pnl_performance_struct &s) {
if (m_portfolio_get_pnl_performance_call_back_func!=NULL) {
return (*m_portfolio_get_pnl_performance_call_back_func)(s);
} else {
return false;
}
}
virtual bool on_tradefeed(ATU_OTI_tradefeed_struct &s) {
ATU_OTI_tradefeed_struct *d=new ATU_OTI_tradefeed_struct;
*d=s;
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
m_msgqueue.push(d);
m_msgType.push(4);
}
virtual bool on_riskfeed(ATU_OTI_riskfeed_struct &sin) {
}
virtual bool on_riskstatusfeed(ATU_OTI_riskstatusfeed_struct &sin) {
}
virtual bool on_accumperffeed(ATU_OTI_accumperffeed_struct &s){
}
virtual bool on_errorfeedp(ATU_ErrorMsgStruct *s) {
on_errorfeed(*s);
}
virtual bool on_errorfeed(ATU_ErrorMsgStruct &s) {
}
virtual bool on_dailyperffeed(ATU_OTI_dailyperffeed_struct &s){
}
virtual void detach() {}
virtual bool on_marketfeed(ATU_MDI_marketfeed_struct& s) {
int msgqueuesize=10;
while (msgqueuesize>0) {
{
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
msgqueuesize=m_msgqueue.size();
if (msgqueuesize==0) break;
}
usleep(1000);
}
on_marketfeed_process(s);
/*
ATU_MDI_marketfeed_struct *d=new ATU_MDI_marketfeed_struct;
*d=s;
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
m_msgqueue.push(d);
m_msgType.push(0);
*/
}
virtual bool on_orderfeed(ATU_OTI_orderfeed_struct &s) {
ATU_OTI_orderfeed_struct *d=new ATU_OTI_orderfeed_struct;
*d=s;
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
m_msgqueue.push(d);
m_msgType.push(1);
}
virtual bool on_pnlperffeed(ATU_OTI_pnlperffeed_struct &s){
ATU_OTI_pnlperffeed_struct *d=new ATU_OTI_pnlperffeed_struct;
*d=s;
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
m_msgqueue.push(d);
m_msgType.push(2);
}
virtual bool on_portfoliofeed(ATU_OTI_portfoliofeed_struct &s){
ATU_OTI_portfoliofeed_struct *d=new ATU_OTI_portfoliofeed_struct;
*d=s;
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
m_msgqueue.push(d);
m_msgType.push(3);
}
virtual bool on_marketfeed_process(ATU_MDI_marketfeed_struct& s) {
}
virtual bool on_ohlcfeed_process(ATU_MDI_ohlcfeed_struct& s) {
}
virtual bool on_ohlcfeed(ATU_MDI_ohlcfeed_struct& s) {
int msgqueuesize=10;
while (msgqueuesize>0) {
{
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
msgqueuesize=m_msgqueue.size();
if (msgqueuesize==0) break;
}
usleep(1000);
}
on_ohlcfeed_process(s);
/*
ATU_MDI_marketfeed_struct *d=new ATU_MDI_marketfeed_struct;
*d=s;
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
m_msgqueue.push(d);
m_msgType.push(0);
*/
}
virtual bool on_tradefeed_process(ATU_OTI_tradefeed_struct &sin) {
}
virtual bool on_riskfeed_process(ATU_OTI_riskfeed_struct &sin) {
}
virtual bool on_riskstatusfeed_process(ATU_OTI_riskstatusfeed_struct &sin) {
}
virtual bool on_orderfeed_process(ATU_OTI_orderfeed_struct &sin) {
}
virtual bool on_portfoliofeed_process(ATU_OTI_portfoliofeed_struct &s){
}
virtual bool on_accumperffeed_process(ATU_OTI_accumperffeed_struct &s){
}
virtual bool on_pnlperffeed_process(ATU_OTI_pnlperffeed_struct &pnlfeed){
}
virtual bool on_errorfeedp_process(ATU_ErrorMsgStruct *s) {
}
virtual bool on_errorfeed_process(ATU_ErrorMsgStruct &s) {
}
virtual bool on_dailyperffeed_process(ATU_OTI_dailyperffeed_struct &s){
}
virtual bool process_msgqueue() {
while (true) {
ATU_MDI_marketfeed_struct *mf;
ATU_OTI_orderfeed_struct *of;
ATU_OTI_tradefeed_struct *tf;
ATU_OTI_pnlperffeed_struct *pnlf;
ATU_OTI_portfoliofeed_struct *pf;
int msgtype=-1;
{
boost::unique_lock<boost::recursive_mutex> lock(m_msgqueueMutex);
if (m_msgqueue.size()>0) {
msgtype=m_msgType.front();
if (msgtype==0) {
mf=(ATU_MDI_marketfeed_struct*)m_msgqueue.front();
}
if (msgtype==1) {
of=(ATU_OTI_orderfeed_struct *)m_msgqueue.front();
}
if (msgtype==2) {
pnlf=(ATU_OTI_pnlperffeed_struct*)m_msgqueue.front();
}
if (msgtype==3) {
pf=(ATU_OTI_portfoliofeed_struct*)m_msgqueue.front();
}
if (msgtype==4) {
tf=(ATU_OTI_tradefeed_struct*)m_msgqueue.front();
}
m_msgqueue.pop();
m_msgType.pop();
}
}
if (msgtype>=0) {
if (msgtype==0) {
on_marketfeed_process(*mf);
ATU_MDI_acknowledgement_struct sss;
sss.m_status="0";
process_acknowledgement(sss);
delete mf;
}
if (msgtype==1) {
on_orderfeed_process(*of);
delete of;
}
if (msgtype==2) {
on_pnlperffeed_process(*pnlf);
delete pnlf;
}
if (msgtype==3) {
on_portfoliofeed_process(*pf);
delete pf;
}
if (msgtype==4) {
on_tradefeed_process(*tf);
delete tf;
}
} else {
usleep(1000);
}
}
}
ATU_OTI_portfolio_get_trade_history_CallBackFunc *m_portfolio_get_trade_history_call_back_func;
ATU_OTI_portfolio_get_working_orders_CallBackFunc *m_portfolio_get_working_orders_call_back_func;
ATU_OTI_signalfeed_CallBackFunc *m_signalfeed_call_back_func;
vector<ATU_MDI_marketfeed_CallBackFunc *> m_marketfeed_call_back_func_list;
vector<ATU_MDI_ohlcfeed_CallBackFunc *> m_ohlcfeed_call_back_func_list;
ATU_String_CallBackFunc *m_send_msg_call_back_func;
ATU_String_CallBackFunc *m_broadcast_msg_call_back_func;
ATU_OTI_portfolio_get_PnL_CallBackFunc * m_portfolio_get_PnL_call_back_func;
ATU_OTI_portfolio_get_daily_performance_CallBackFunc * m_portfolio_get_daily_performance_call_back_func;
ATU_OTI_portfolio_get_accum_performance_CallBackFunc * m_portfolio_get_accum_performance_call_back_func;
ATU_OTI_portfolio_get_pnl_performance_CallBackFunc * m_portfolio_get_pnl_performance_call_back_func;
ATU_MDI_subscription_CallBackFunc *m_subscription_call_back_func;
ATU_MDI_unsubscription_CallBackFunc *m_unsubscription_call_back_func;
ATU_MDI_acknowledgement_CallBackFunc *m_acknowledgement_call_back_func;
ATU_OTI_risk_setting_CallBackFunc * m_risk_setting_call_back_func;
ATU_OTI_quoterequestfeed_CallBackFunc * m_quoterequestfeed_call_back_func;
ATU_OTI_ping_CallBackFunc *m_ping_call_back_func;
};
#endif /* ATU_ABSTRACT_ALGOI_H_ */
<file_sep>/loglibrary/src/ATU_Feed_Logger.cpp
/*
* ATU_Feed_Logger.cpp
*
* Created on: Jun 5, 2014
* Author: alex
*/
#include "ATU_Feed_Logger.h"
namespace atu{
ATU_Feed_Logger::ATU_Feed_Logger(string datapath,int timerShareMemoryKey, string feedtype) :m_isShutdown(false),m_Timer(NULL),m_isReady(false)
{
m_Timer = new ATU_Timer(timerShareMemoryKey);
m_Timer->detach();
m_Timer->init();
//usleep(1000 * 1000 * _ATU_Feed_Logger_INITIAL_SLEEP_SECOND_);
//m_Timer->setTimeStamp(); // This will be called when getTimStamp
//m_Timer->setTimeStamp_YMDHMS(); // Still need?
string timestamp = m_Timer->getTimeStamp();
m_StartLogTimeStamp = timestamp;
m_Datapath = datapath + "/" +feedtype;
char cmd[300];
sprintf(cmd,"mkdir -p %s",m_Datapath.c_str());
system(cmd);
usleep(1000);
m_FileName="";
// usleep(1000*5);
}
ATU_Feed_Logger::~ATU_Feed_Logger() {
// << "Destroying ATU_Feed_Logger..." << endl;
// .flush();
}
bool ATU_Feed_Logger::isReady() {
return m_isReady;
}
int ATU_Feed_Logger::setFilename(string filename){
if(filename == m_FileName) return 1;
if(m_FileName!="") {
m_GeneralLogFile.close();
m_GeneralLogFile.clear();
}
m_FileName = filename;
char outFileName[1000];
sprintf(outFileName, "%s/%s.csv", m_Datapath.c_str(), m_FileName.c_str());
m_GeneralLogFile.open(outFileName);
m_LogSecStat=true;
m_TimestampToLogMsgDelimiter=" : ";
return 2;
}
void ATU_Feed_Logger::run(void) {
if (m_Timer==NULL) {
// << "m_Timer is NULL" << endl;
}
if (m_Timer->m_isMaster) {
if (m_LogSecStat) {
addLog("Start running Logger with Timer in Master mode",2);
// TODO:
// If Timer service is not started, the whole application (and their children) should exit (CCF 20130520)
::exit(1);
}
} else {
if (m_LogSecStat) {
addLog("Start running Logger with Timer in Slave mode",2);
}
}
int count = 0;
time_t lastSec=0;
int writesize = 0;
while (!m_isShutdown && m_Timer!=NULL) {
m_isReady=true;
if (m_Timer->m_ShareMemoryTimerData->m_tS.tv_sec != lastSec) {
if (m_LogSecStat) {
LogStream cooo(5);
cooo << "Logger:Writing " << count << " log msg per sec with ";
cooo << (double) writesize / (double) 1024 << "kb "
<< " pending queue=size=" << m_LogMsgQueue.size();
addLog(cooo.str(), 0);
}
count = 0;
lastSec = m_Timer->m_ShareMemoryTimerData->m_tS.tv_sec;
writesize = 0;
}
lastSec = m_Timer->m_ShareMemoryTimerData->m_tS.tv_sec;
int size = 0;
//int ret = writeLog(size);
writeLog(size);
writesize += size;
if (size > 0) {
count++;
} else {
m_LogMsgQueueLock.wait(1, true);
}
}
while (!m_isShutdown2) {
usleep(1000);
}
}
void ATU_Feed_Logger::final(void) {
// << "finalizing Logger" << endl;
// .flush();
m_GeneralLogFile.close();
}
bool ATU_Feed_Logger::addLog(ATU_Feed_Logger *logger ,string msg, int writeToConsole) {
if (logger!=NULL) {
logger->addLog(msg, writeToConsole);
} else {
cout << msg << endl;
}
return true;
}
int ATU_Feed_Logger::addLog(string msg, int writeToConsole) {
// assert(msg.size()!=0);
if (msg.length()==0) return 0;
string msgout = "";
m_LogMsgQueueMutex.enterMutex();
msgout = msg;
//adding timestamp to msg;
m_LogMsgQueue.push(msgout);
m_LogMsgQueueWriteToConsole.push(writeToConsole);
m_LogMsgQueueMutex.leaveMutex();
m_LogMsgQueueLock.signal(true);
return true;
}
int ATU_Feed_Logger::writeLog(int &size) {
size = 0;
string msg;
int writeToConsole = 0;
m_LogMsgQueueMutex.enterMutex();
if (!m_LogMsgQueue.empty()) {
msg = m_LogMsgQueue.front();
writeToConsole = m_LogMsgQueueWriteToConsole.front();
m_LogMsgQueue.pop();
m_LogMsgQueueWriteToConsole.pop();
m_LogMsgQueueMutex.leaveMutex();
size = msg.length();
m_GeneralLogFile << msg << endl;
m_GeneralLogFile.flush();
if (writeToConsole != 0) {
cout << msg << endl;
}
} else {
m_LogMsgQueueMutex.leaveMutex();
}
return true;
}
void ATU_Feed_Logger::backupFileCopy(string filename,string directory)
{
char outFileName[3000];
char srcFileName[3000];
sprintf(outFileName,"%s/%s/%s.%s",m_Datapath.c_str(),directory.c_str(),filename.c_str(),m_Timer->getTimeStamp().c_str());
sprintf(srcFileName,"%s/%s",m_Datapath.c_str(),filename.c_str());
char cmd[3000];
sprintf(cmd,"cp %s %s",srcFileName,outFileName);
system(cmd);
}
void ATU_Feed_Logger::stop() {
//======== new method ============
m_isShutdown2 = false;
m_isShutdown = true;
usleep(1000);
m_Timer->stop();
// << "Assigning m_Timer=NULL" << endl;
// .flush();
m_Timer=NULL;
usleep(1000);
m_isShutdown2 = true;
//================================
/*
m_Timer->stop();
while(m_Timer->isRunning()) {
usleep(1000);
}
m_isShutdown = true;
*/
}
}
<file_sep>/oti_mdi_common/src/common/ConfigMgr.cpp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include "Toolbox.h"
#include "ConfigMgr.h"
using namespace atu;
namespace atu {
Config::Config() {
}
Config::Config(const Config &src) {
m_keyValuePairMap.insert(src.m_keyValuePairMap.begin(), src.m_keyValuePairMap.end());
}
string Config::getValue(string key)
{
//old version
//return m_keyValuePairMap[key];
//new version, will check if key can be found, or it will return empty string
if (m_keyValuePairMap.find(key)!=m_keyValuePairMap.end()) {
return m_keyValuePairMap[key];
} else {
return "";
}
}
void Config::getValueVector(string key, vector<string> &value_vec) {
string value;
int i=0;
do {
value = getValue(key + "." + Toolbox::itos(i++));
if (value.length()>0) {
value_vec.push_back(value);
}
} while (value.length()>0);
}
void Config::setKeyValuePair(string key,string value) {
m_keyValuePairMap[key]=value;
}
void Config::addKeyValuePair(string key,string value) {
if (m_keyValuePairMap.find(key)!=m_keyValuePairMap.end()) {
//throw exception
cout << "Detected duplicate key " << key << " , program aborted";
::exit(0);
} else {
m_keyValuePairMap[key]=value;
}
}
void Config::removeKey(string key) {
if (m_keyValuePairMap.find(key)==m_keyValuePairMap.end()) {
//throw exception
cout << "Removing Non-exist key " << key << " , program aborted";
::exit(0);
} else {
m_keyValuePairMap.erase(key);
}
}
Config *Config::extractInstanceConfig(int instance) {
Config *algo_instance_config=new Config(); // Algo will have their own copy of config
// algo_instance_config = (*m_Config);
// algo_instance_config.setKeyValuePair(initial_algo_instance->m_algoStrategyName + ".nInstance","1");
// algo_instance_config.setKeyValuePair(initial_algo_instance->m_algoStrategyName + ".nInstance.0","1");
map<string,string> *algo_instance_config_map = &m_keyValuePairMap;
for (map<string,string>::iterator it = algo_instance_config_map->begin(); it != algo_instance_config_map->end(); it++) {
// if (it->first.find(initial_algo_instance->m_algoStrategyName + ".") != string::npos) {
vector<string> values_vec;
// cout << "Changing key = " << it->first << endl;
getValueVector(it->first,values_vec);
// cout << "size=" << values_vec.size() << endl;
if (values_vec.size() == 1) {
// cout << "DEBUG2 " << it->first << endl;
algo_instance_config->addKeyValuePair(it->first, values_vec.at(0));
algo_instance_config->addKeyValuePair(it->first + ".0", values_vec.at(0));
} else {
if (values_vec.size()>instance) {
algo_instance_config->addKeyValuePair(it->first,values_vec.at(instance));
algo_instance_config->addKeyValuePair(it->first+".0",values_vec.at(instance));
}
}
}
return algo_instance_config;
}
ConfigMgr::ConfigMgr()
{
}
ConfigMgr::~ConfigMgr()
{
map<string,Config*>::iterator it;
for (it=m_file2ConfigMap.begin();it!=m_file2ConfigMap.end();it++) {
Config *myconfig=(*it).second;
delete myconfig;
}
}
std::string ConfigMgr::trim(const std::string &str)
{
size_t s = str.find_first_not_of(" \n\r\t");
size_t e = str.find_last_not_of (" \n\r\t");
if(( string::npos == s) || ( string::npos == e))
return "";
else
return str.substr(s, e-s+1);
}
Config* ConfigMgr::getConfig(string filename)
{
if (m_file2ConfigMap.find(filename)==m_file2ConfigMap.end()) {
return readConfig(filename);
}
return m_file2ConfigMap[filename];
}
Config* ConfigMgr::readConfig(string filename)
{
Config *myconfig;
if (m_file2ConfigMap.find(filename)==m_file2ConfigMap.end()) {
//ifconfig file not found create it
myconfig=new Config();
m_file2ConfigMap[filename]=myconfig;
} else {
myconfig=m_file2ConfigMap[filename];
}
FILE *file=fopen(filename.c_str(),"r");
char line[5001];
char section[1000];
char dupline[5001];
strcpy(section,"");
while(!feof(file)) {
fgets(line,5000,file);
if (feof(file)) {
break;
}
//empty the newline character
if (line[strlen(line)-1]=='\n') {
line[strlen(line)-1]=0;
}
//first filter the section
if (line[0]=='[') {
//get the section name
//char *linetoprocess=strdupa(line);
char *linetoprocess;
strcpy(dupline, line);
linetoprocess = &dupline[0];
char *mysection=strsep(&linetoprocess,"[");
mysection=strsep(&linetoprocess,"]");
strcpy(section,mysection);
//printf("section %s\n",section);
}
char *comment=strstr(line,"#");
if (comment!=NULL) {
//empty the comment
strcpy(comment,"");
}
char *linetoprocess=strdupa(line);
char *key = strsep(&linetoprocess, "=");
if (key!=NULL && linetoprocess!=NULL) {
// printf("key %s value %s\n",key,linetoprocess2);
char sectionkey[5000];
sprintf(sectionkey,"%s.%s",section,key);
myconfig->addKeyValuePair(trim(sectionkey),trim(linetoprocess));
string value=trim(linetoprocess);
vector<string> valuelist;
boost::split(valuelist, value, boost::is_any_of(","));
//cout << "valuelist.size " << valuelist.size() << endl;
//if (valuelist.size()>1) {
for (unsigned int i=0;i<valuelist.size();i++) {
char sectionkeyvalue[5000];
sprintf(sectionkeyvalue,"%s.%d",trim(sectionkey).c_str(),i);
myconfig->addKeyValuePair(sectionkeyvalue,trim(valuelist[i]));
// cout << "valuelist[" << i << "] " << valuelist[i] << endl;
}
//}
} else {
//ignore if = is not found
continue;
}
//myconfig->addKeyValuePair(key,linetoprocess2);
}
return m_file2ConfigMap[filename];
}
}
<file_sep>/oti_mdi_common/src/common/Toolbox.cpp
#include "Toolbox.h"
#include <string>
#include <sstream>
#include <fstream>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <boost/algorithm/string/regex.hpp>
using namespace atu;
using namespace std;
std::string Toolbox::itos(int num) {
std::stringstream out;
out << num;
return out.str();
}
std::string Toolbox::ftos(double num) {
std::stringstream out;
out << num;
return out.str();
}
double Toolbox::meanInList(vector<double> &mylist)
{
double sum=0;
for (unsigned int i=0;i<mylist.size();i++) {
sum+=mylist[i];
}
if (mylist.size()>0) {
return sum/(double)(mylist.size());
} else {
return 0.0;
}
}
bool Toolbox::isFileExist(const char *filename) {
ifstream ifile(filename);
return ifile;
}
int Toolbox::getNextDay(int org_date, int nDayForward){
int year = org_date / 10000;
int month = (org_date % 10000) / 100;
int day = org_date % 100;
struct std::tm a = {0,0,0,day,month-1,year-1900};
time_t rawtime=mktime(&a);
struct tm * timeinfo;
rawtime+=nDayForward*60*60*24; // Add one day
timeinfo = localtime ( &rawtime );
return (timeinfo->tm_year+1900) * 10000 + (timeinfo->tm_mon+1) * 100 + timeinfo->tm_mday;
}
int Toolbox::getNextDay(int org_date){
return getNextDay(org_date,1);
}
int Toolbox::getPrevDay(int org_date){
return getNextDay(org_date,-1);
}
double Toolbox::average(double array[], int from, int size) {
double aver = 0;
for (int i = from; i < size; i++) {
aver += array[i];
}
return aver / size;
}
double Toolbox::average(int array[], int from, int size) {
double aver = 0;
int endindex = from + size;
for (int i = from; i < endindex; i++) {
aver += array[i];
}
return aver / size;
}
void Toolbox::FindAndReplace( std::string& tInput, std::string tFind, std::string tReplace )
{
size_t uPos = 0;
size_t uFindLen = tFind.length();
size_t uReplaceLen = tReplace.length();
if( uFindLen == 0 )
{
return;
}
for( ;(uPos = tInput.find( tFind, uPos )) != std::string::npos; )
{
tInput.replace( uPos, uFindLen, tReplace );
uPos += uReplaceLen;
}
}
string Toolbox::tolower(std::string &str) {
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
return str;
}
int Toolbox::timetosec(int a)
{
int hr=a/10000;
int min=(a%10000)/100;
int sec=(a%10000)%100;
return hr*3600+min*60+sec;
}
int Toolbox::sectotime(int a)
{
int hr=a/3600;
int min=(a%3600)/60;
int sec=(a%60);
return hr*10000+min*100+sec;
}
int Toolbox::sum_time(int t,int b)
{
int a=timetosec(t);
return sectotime(a+b);
}
int Toolbox::diff_time(int a,int b)
{
return timetosec(a)-timetosec(b);
}
string Toolbox::timeStamp()
{
time_t rawtime;
struct tm * timeinfo;
char buffer [200];
/*
struct timeb tp;
time ( &rawtime );
ftime(&tp);
*/
// double curmsec=m_Timer->getTimeInMS();
time(&rawtime);
//rawtime=(long long)(curmsec/1000.0);
timeinfo = localtime ( &rawtime );
strftime (buffer,200,"%Y%m%d%H%M%S",timeinfo);
char outtime[1000];
// double justms=(curmsec-floor(curmsec/1000.0)*1000.0)*100;
sprintf(outtime,"%s%05ld",buffer,(long)0);
return string(outtime);
}
string Toolbox::timeStamp_with_underscore()
{
time_t rawtime;
struct tm * timeinfo;
char buffer [200];
/*
struct timeb tp;
time ( &rawtime );
ftime(&tp);
*/
// double curmsec=m_Timer->getTimeInMS();
time(&rawtime);
//rawtime=(long long)(curmsec/1000.0);
timeinfo = localtime ( &rawtime );
strftime (buffer,200,"%Y%m%d_%H%M%S",timeinfo);
char outtime[1000];
// double justms=(curmsec-floor(curmsec/1000.0)*1000.0)*100;
sprintf(outtime,"%s_%06ld",buffer,(long)0);
return string(outtime);
}
string Toolbox::timeStamp_full()
{
timespec tS;
clock_gettime(CLOCK_REALTIME, (timespec*) (&(tS)));
long long cur = (long long) tS.tv_nsec;
double curmsec = ((double) cur / double(1000 * 1000)) + (double) tS.tv_sec * (double) 1000;
return timeStamp_full(curmsec);
}
string Toolbox::timeStamp_full(double curms) {
char TimeStampStr[200];
struct tm * timeinfo;
struct tm timeinfo2;
char buffer[200];
//struct timeb tp;
time_t tvsec=(time_t)(curms/1000);
timeinfo = localtime_r((time_t*) (&(tvsec)), &timeinfo2);
strftime(buffer, 200, "%Y%m%d_%H%M%S", &timeinfo2);
double ms=curms*1000-tvsec*1000*1000;
sprintf((char*) (TimeStampStr), "%s_%06d", buffer, (int)(ms));
return TimeStampStr;
}
string Toolbox::timeStamp_gmtfull(double curms) {
char TimeStampStr[200];
struct tm * timeinfo;
struct tm timeinfo2;
char buffer[200];
//struct timeb tp;
time_t tvsec=(time_t)(curms/1000);
timeinfo = gmtime_r((time_t*) (&(tvsec)), &timeinfo2);
strftime(buffer, 200, "%Y%m%d_%H%M%S", &timeinfo2);
double ms=curms*1000-tvsec*1000*1000;
sprintf((char*) (TimeStampStr), "%s_%06d", buffer, (int)(ms));
return TimeStampStr;
}
boost::posix_time::ptime Toolbox::timeStamp_to_ptime(string timestamp){
boost::algorithm::replace_last(timestamp,"_",".");
boost::posix_time::time_input_facet* facet = new boost::posix_time::time_input_facet("%Y%m%d_%H%M%S%f");
std::stringstream ss;
ss.imbue(std::locale(std::locale(), facet));
ss << timestamp;
boost::posix_time::ptime pt = boost::posix_time::microsec_clock::local_time();
ss >> pt;
return pt;
}
double Toolbox::timeStamp_toMS(string timestamp) {
if (timestamp.length()==22) {
int year=atoi(timestamp.substr(0,4).c_str());
int month=atoi(timestamp.substr(4,2).c_str());
int day=atoi(timestamp.substr(6,2).c_str());
int hour=atoi(timestamp.substr(9,2).c_str());
int min=atoi(timestamp.substr(11,2).c_str());
int sec=atoi(timestamp.substr(13,2).c_str());
int msec=atoi(timestamp.substr(16,6).c_str());
struct tm* timeinfo;
time_t rawtime;
time(&rawtime);
timeinfo=localtime(&rawtime);
timeinfo->tm_year=year-1900;
timeinfo->tm_mon=month-1;
timeinfo->tm_mday=day;
timeinfo->tm_hour=hour;
timeinfo->tm_min=min;
timeinfo->tm_sec=sec;
double epotime=mktime(timeinfo)*1000;
epotime=epotime+msec/1000000;
return epotime;
}
}
void Toolbox::printStringVector(vector<string> &string_vec) {
unsigned int size = string_vec.size();
for (unsigned int i = 0; i < size; i++) {
cout << __FUNCTION__ << ",size=" << size << ",i=" << i << ",value=" << string_vec[i] << endl;
}
}
bool Toolbox::isNotAlNumSpaceUnderScoreMinus(char c)
{
return !(isalpha(c) || isdigit(c) || (c == ' ') || (c == '_') || (c == '.') || (c == '-'));
}
bool Toolbox::isStringValid(const std::string &str)
{
return find_if(str.begin(), str.end(), isNotAlNumSpaceUnderScoreMinus) == str.end();
}
bool Toolbox::stringToKeyValuePair(map<string,string> &keyvaluepairdict, string instr)
{
vector<string> attribvec;
boost::split(attribvec, instr, boost::is_any_of(";"));
for (int i = 0; i < attribvec.size(); i++) {
vector<string> keyvaluepairvec;
boost::split(keyvaluepairvec, attribvec[i], boost::is_any_of("="));
if (keyvaluepairvec.size()!=2) {
return false;
} else {
if (keyvaluepairvec[0].length()==0 || keyvaluepairvec[1].length()==0) {
return false;
} else {
keyvaluepairdict[keyvaluepairvec[0]]=keyvaluepairvec[1];
}
}
}
return true;
}
void Toolbox::split(vector<string> &result,std::string& in ,std::string delem) {
boost::algorithm::split_regex( result, in, boost::regex( delem ) ) ;
}
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyR1.h
#ifndef PORTFOLIOGENERATION_STRATEGYR1_H_
#define PORTFOLIOGENERATION_STRATEGYR1_H_
// #include "PCH.h"
// #include "Constants.h"
// #include "SystemState.h"
// #include "SystemConfig.h"
// #include "MDI_Acknowledgement.h"
// #include "MarketData.h"
// #include "TechIndicators.h"
// #include "PortfoliosAndOrders.h"
//
// class StrategyR1 {
// public:
// StrategyR1();
// virtual ~StrategyR1();
// void Run();
//
// private:
// void ReportAckIfNeeded();
//
// //--------------------------------------------------
//
// //--------------------------------------------------
// // System objects
// //--------------------------------------------------
// boost::shared_ptr<MarketData> m_MarketData;
// boost::shared_ptr<SystemState> m_SystemState;
// boost::shared_ptr<SystemConfig> m_SysCfg;
// boost::shared_ptr<Logger> m_Logger;
// boost::shared_ptr<TechIndicators> m_TechInd;
// boost::shared_ptr<PortfoliosAndOrders> m_PortAndOrders;
// boost::shared_ptr<MDI_Acknowledgement> m_MDIAck;
//
// //--------------------------------------------------
// // Strategy objects
// //--------------------------------------------------
// // <SMA period><weight>
// //--------------------------------------------------
// vector<double> m_ParamVector;
// };
//
#endif /* PORTFOLIOGENERATION_STRATEGYR1_H_ */
<file_sep>/oti_mdi_common/src/marketdata/ATU_Abstract_MDI.cpp
/*
* ATU_Abstract_MDI.cpp
*
* Created on: May 26, 2014
* Author: alex
*/
#include "ATU_Abstract_MDI.h"
namespace atu{
ATU_Abstract_MDI::ATU_Abstract_MDI() : m_logfeed_call_back_func(NULL) {
sessionDestroy = true;
}
ATU_Abstract_MDI::~ATU_Abstract_MDI() {
if(m_marketfeed_call_back_func!=NULL) delete m_marketfeed_call_back_func;
if(m_ohlcfeed_call_back_func!=NULL) delete m_ohlcfeed_call_back_func;
if(m_logfeed_call_back_func!=NULL) delete m_logfeed_call_back_func;
}
bool ATU_Abstract_MDI::notify_marketfeed(ATU_MDI_marketfeed_struct& s) {
return true;
}
bool ATU_Abstract_MDI::notify_ohlcfeed(ATU_MDI_ohlcfeed_struct& s) {
return true;
}
bool ATU_Abstract_MDI::notify_logfeed(ATU_logfeed_struct* s) {
if (m_logfeed_call_back_func!=NULL) {
(*m_logfeed_call_back_func)(s);
}
return true;
}
void ATU_Abstract_MDI::register_notify_logfeed_call_back_func(
ATU_logfeed_CallBackFunc* callback) {
m_logfeed_call_back_func = callback;
}
void ATU_Abstract_MDI::register_notify_marketfeed_call_back_func(
ATU_MDI_marketfeed_CallBackFunc* callback) {
m_marketfeed_call_back_func = callback;
}
void ATU_Abstract_MDI::register_notify_ohlcfeed_call_back_func(
ATU_MDI_ohlcfeed_CallBackFunc* callback) {
m_ohlcfeed_call_back_func = callback;
}
bool ATU_Abstract_MDI::on_process_subscription(ATU_MDI_subscription_struct &s){
return true;
}
bool ATU_Abstract_MDI::on_process_unsubscription(ATU_MDI_unsubscription_struct &s){
return true;
}
bool ATU_Abstract_MDI::on_process_acknowledgement(ATU_MDI_acknowledgement_struct &s){
return true;
}
bool ATU_Abstract_MDI::process_unsubscription(ATU_MDI_unsubscription_struct &s){
return true;
}
bool ATU_Abstract_MDI::process_subscription(ATU_MDI_subscription_struct &s){
return true;
}
}
<file_sep>/NirvanaCommon/Util/SFunctional.h
#ifndef UTIL_SFUNCTIONAL_H_
#define UTIL_SFUNCTIONAL_H_
#include "PCH.h"
#include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
//--------------------------------------------------
// Functional programming?
//--------------------------------------------------
template <typename Collection, typename UnOp>
void FForEach(const Collection & col, UnOp op)
{
std::for_each(col.begin(),col.end(),op);
}
template <typename Collection>
void FReverse(Collection & col)
{
std::reverse(col.begin(),col.end());
}
// template <typename CollectionIn, typename CollectionOut, typename InType, typename UnOp>
// void FMap(CollectionIn colIn, CollectionOut colOut, UnOp op)
// {
// // //--------------------------------------------------
// // // CAUTION: UNTESTED
// // //--------------------------------------------------
// // std::transform(colIn.begin(),colIn.end(),back_inserter(colOut),op);
// colOut.clear();
// FForEach(colIn, [&](const InType i) {
// colOut.push_back(op(i));
// });
// }
template <typename Collection, typename Predicate>
Collection FFilterNot(const Collection & col,Predicate predicate)
{
Collection col2 = col;
col2.erase(std::remove_if(col2.begin(),col2.end(),predicate),col2.end());
return col2;
}
template <typename Collection, typename Predicate>
Collection FFilter(const Collection & col,Predicate predicate)
{
//capture the predicate in order to be used inside function
Collection col2 = col;
return FFilterNot(col2,[predicate](typename Collection::value_type i) {return ! predicate(i);});
return col2;
}
template <typename Collection, typename InitValType, typename BinOp>
InitValType FFold(const Collection & col,InitValType init,BinOp op)
{
// template< class InputIt, class T, class BinaryOperation >
//
// T accumulate( InputIt first, InputIt last, T init, BinaryOperation op );
//
// binary operation function object that will be applied.
//
// The signature of the function should be equivalent to the following:
// Ret fun(const Type1 &a, const Type2 &b);
//
// The signature does not need to have const &.
// The type Type1 must be such that an object of type T can be implicitly converted to Type1.
// The type Type2 must be such that an object of type InputIt can be dereferenced and then implicitly converted to Type2.
// The type Ret must be such that an object of type T can be assigned a value of type Ret.
return std::accumulate(col.begin(),col.end(),init,op);
}
template <typename Collection>
double FSum(const Collection & col)
{
// return std::accumulate(col.begin(),col.end(),0.0);
double d = 0.0;
for (typename Collection::const_iterator it = col.begin(); it != col.end(); ++it) d += (double)(*it);
return d;
}
template <typename T>
T GetOrElse(boost::optional<T> o, T val) {
if (o) return o.get();
else return val;
}
template <typename TK, typename TV>
class SMap {
private:
map<TK,TV> _map;
public:
boost::optional<TV> Get(const TK k) const
{
typename map<TK,TV>::const_iterator it = _map.find(k);
if (it == _map.end()) return boost::optional<TV>();
return boost::optional<TV>(it->second);
}
TV GetOrElse(const TK k, const TV defaultval)
{
return Get(k).GetOrElse(defaultval);
}
typename map<TK,TV>::iterator GetIterBegin()
{
return _map.begin();
}
typename map<TK,TV>::iterator GetIterEnd()
{
return _map.end();
}
void AddOrUpdate(const TK k, const TV v)
{
_map[k] = v;
}
void Remove(const TK k)
{
typename map<TK,TV>::iterator it = _map.find(k);
if (it == _map.end()) return;
_map.erase(it);
}
bool Contains(const TK k) const
{
typename map<TK,TV>::const_iterator it = _map.find(k);
if (it == _map.end()) return false;
else return true;
}
vector<std::pair<TK,TV> > ToVector() const
{
vector<std::pair<TK,TV> > vOut;
FForEach(_map,[&](const std::pair<TK,TV> p) { vOut.push_back(p); });
return vOut;
}
void FromVectorReplaceOrAdd(vector<std::pair<TK,TV> > vIn)
{
FForEach(vIn,[&](const std::pair<TK,TV> p) { _map[p.first] = p.second; });
}
void FromVectorTotalReplace(vector<std::pair<TK,TV> > vIn)
{
_map.clear();
FromVectorReplaceOrAdd(vIn);
}
};
template <typename TK, typename TV>
class SMapThreadSafe {
private:
map<TK,TV> _map;
boost::shared_mutex _mutex;
void FromVectorReplaceOrAddNoLock(vector<std::pair<TK,TV> > vIn)
{
FForEach(vIn,[&](const std::pair<TK,TV> p) { _map[p.first] = p.second; });
}
public:
boost::optional<TV> Get(const TK k)
{
boost::shared_lock<boost::shared_mutex> lock(_mutex);
typename map<TK,TV>::const_iterator it = _map.find(k);
if (it == _map.end()) return boost::optional<TV>();
return boost::optional<TV>(it->second);
}
TV GetOrElse(const TK k, const TV defaultval)
{
boost::shared_lock<boost::shared_mutex> lock(_mutex);
return Get(k).GetOrElse(defaultval);
}
void AddOrUpdate(const TK k, const TV v)
{
boost::unique_lock<boost::shared_mutex> lock(_mutex);
_map[k] = v;
}
void Remove(const TK k)
{
boost::unique_lock<boost::shared_mutex> lock(_mutex);
typename map<TK,TV>::iterator it = _map.find(k);
if (it == _map.end()) return;
_map.erase(it);
}
bool Contains(const TK k) const
{
boost::shared_lock<boost::shared_mutex> lock(_mutex);
typename map<TK,TV>::iterator it = _map.find(k);
if (it == _map.end()) return false;
else return true;
}
vector<std::pair<TK,TV> > ToVector()
{
boost::shared_lock<boost::shared_mutex> lock(_mutex);
vector<std::pair<TK,TV> > vOut;
FForEach(_map,[&](const std::pair<TK,TV> p) { vOut.push_back(p); });
return vOut;
}
void FromVectorReplaceOrAdd(vector<std::pair<TK,TV> > vIn)
{
boost::unique_lock<boost::shared_mutex> lock(_mutex);
FForEach(vIn,[&](const std::pair<TK,TV> p) { _map[p.first] = p.second; });
}
void FromVectorTotalReplace(vector<std::pair<TK,TV> > vIn)
{
boost::unique_lock<boost::shared_mutex> lock(_mutex);
_map.clear();
FromVectorReplaceOrAddNoLock(vIn);
}
};
template <typename TV>
class SSet {
private:
set<TV> _set;
public:
typename set<TV>::iterator GetIterBegin()
{
return _set.begin();
}
typename set<TV>::iterator GetIterEnd()
{
return _set.end();
}
void Add(const TV v)
{
_set.insert(v);
}
void Remove(const TV v)
{
_set.erase(v);
}
bool Contains(const TV v)
{
typename set<TV>::iterator it = _set.find(v);
if (it == _set.end()) return false;
else return true;
}
};
template <typename TK1, typename TK2, typename TV>
class SMapOfMap {
private:
map<TK1,map<TK2,TV> > _map;
public:
boost::optional<TV> Get(const TK1 k1, const TK2 k2)
{
typename map<TK1,map<TK2,TV> >::iterator it = _map.find(k1);
if (it == _map.end()) return boost::optional<TV>();
map<TK2,TV> & m2 = it->second;
typename map<TK2,TV>::iterator it2 = m2.find(k2);
if (it2 == m2.end()) return boost::optional<TV>();
return boost::optional<TV>(it2->second);
}
TV GetOrElse(const TK1 k1, const TK2 k2, TV defaultval)
{
return Get(k1,k2).GetOrElse(defaultval);
}
void AddOrUpdate(const TK1 k1, const TK2 k2, const TV v)
{
typename map<TK1,map<TK2,TV> >::iterator it = _map.find(k1);
if (it == _map.end())
{
_map[k1] = map<TK2,TV>();
it = _map.find(k1);
}
map<TK2,TV> & m2 = it->second;
m2[k2] = v;
}
bool Contains(const TK1 k1, const TK2 k2)
{
typename map<TK1,map<TK2,TV> >::iterator it = _map.find(k1);
if (it == _map.end()) return false;
map<TK2,TV> & m2 = it->second;
if (m2.find(k2) == m2.end()) return false;
return true;
}
};
template <typename TK, typename TV>
class SMapPersistVal {
private:
SMap<TK,TV> _map;
public:
boost::optional<TV> Get(const TK k)
{
return _map.Get(k);
}
TV GetOrElse(const TK k, TV defaultval)
{
return _map.GetOrElse(k,defaultval);
}
void Add(const TK k, const TV v)
{
if (!_map.Contains(k)) _map.Add(k,v);
}
bool Contains(const TK k)
{
return _map.Contains(k);
}
};
#endif /* UTIL_SFUNCTIONAL_H_ */
<file_sep>/oti_mdi_common/include/ATU_Abstract_OTI.h
#ifndef _ATU_ABSTRACT_OTI_H_
#define _ATU_ABSTRACT_OTI_H_
//#include "ParsedMarketData.h"
//#include "ATU_TCP_OTI_string_handler.h"
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <map>
#include <vector>
#include "ATU_ErrorMsgStruct.h"
#include "ATU_Abstract_MDI.h"
#include "ATU_Logger.h"
#include "ParsedMarketData.h"
//#include "ATU_AbstractOrderAlgo.h"
using namespace std;
typedef struct ATU_OTI_signalfeed_struct{
// Timestamp of messages Market(string) Product Code(string) Order ID(string) Price (double) Qty (double)
// Open or Close (string) Buy or Sell (int) Order Action (string) Order Type (string) Order Validity (string) Portfolio Name (string)
string m_timestamp;
string m_market;
string m_feedcode;
string m_order_id;
double m_price;
double m_qty;
string m_open_or_close;
int m_buy_or_sell;
string m_order_action;
string m_order_type;
string m_order_validity;
string m_portfolio_name;
string m_client_user;
string m_order_attributes;
ATU_OTI_signalfeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_order_id(""),
m_price(0),
m_qty(0),
m_open_or_close(""),
m_buy_or_sell(0),
m_order_action(""),
m_order_type(""),
m_order_validity(""),
m_portfolio_name(""),
m_client_user(""),
m_order_attributes(""){}
} ATU_OTI_signalfeed_struct;
typedef struct ATU_OTI_orderfeed_struct{
// Timestamp of messages Market(string) Product Code(string) Order ID(string) Price (double) Qty (double)
// Open or Close (string) Buy or Sell (int) Qty Filled (double) Order Type(string) Order Validity(string)
//Deleted (int) Order Status(int) Error Description(string) Source (int)
string m_timestamp;
string m_market;
string m_feedcode;
string m_order_id;
double m_price;
double m_qty;
string m_open_or_close;
int m_buy_or_sell;
double m_qty_filled;
string m_order_type;
string m_order_validity;
int m_deleted;
int m_order_status;
string m_error_description;
string m_portfolio_name;
string m_created_timestamp;
string m_changed_timestamp;
int m_source;
int m_islast;
ATU_OTI_orderfeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_order_id(""),
m_price(0),
m_qty(0),
m_open_or_close(""),
m_buy_or_sell(0),
m_qty_filled(0),
m_order_type(""),
m_order_validity(""),
m_deleted(0),
m_order_status(0),
m_error_description(""),
m_portfolio_name(""),
m_created_timestamp(""),
m_changed_timestamp(""),
m_source(0),
m_islast(0){}
} ATU_OTI_orderfeed_struct;
typedef struct ATU_OTI_riskfeed_struct{
string m_timestamp;
string m_market;
string m_feedcode;
string m_order_id;
string m_msg_description;
ATU_OTI_riskfeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_order_id(""),
m_msg_description(""){}
} ATU_OTI_riskfeed_struct;
typedef struct ATU_OTI_riskstatusfeed_struct{
string m_timestamp;
string m_identity;
string m_feedcode;
string m_key;
string m_value;
ATU_OTI_riskstatusfeed_struct():
m_timestamp(""),
m_identity(""),
m_feedcode(""),
m_key(""),
m_value(""){}
} ATU_OTI_riskstatusfeed_struct;
typedef struct ATU_OTI_ping_struct{
string m_timestamp;
ATU_OTI_ping_struct():
m_timestamp(""){}
} ATU_OTI_ping_struct;
typedef struct ATU_OTI_tradefeed_struct{
// Message Type Direction Purpose Timestamp of messages Market(string) Product Code(string) Order ID(string)
//Price (double) Qty (double) Open or Close (string) Buy or Sell (int) Trade ID (string) Source (int)
string m_timestamp;
string m_market;
string m_feedcode;
string m_order_id;
double m_price;
double m_qty;
string m_open_or_close;
int m_buy_or_sell;
string m_trade_id;
string m_portfolio_name;
string m_trade_timestamp;
int m_source;
int m_islast;
ATU_OTI_tradefeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_order_id(""),
m_price(0),
m_qty(0),
m_open_or_close(""),
m_buy_or_sell(0),
m_trade_id(""),
m_portfolio_name(""),
m_trade_timestamp(""),
m_source(0),
m_islast(0){}
} ATU_OTI_tradefeed_struct;
typedef struct ATU_OTI_portfoliofeed_struct{
string m_timestamp;
string m_market;
string m_feedcode;
double m_net_position;
double m_average_open_price;
double m_net_invested;
double m_realized_pnl;
double m_unrealized_pnl;
double m_total_pnl;
int m_islast;
ATU_OTI_portfoliofeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_net_position(0),
m_average_open_price(0),
m_net_invested(0),
m_realized_pnl(0),
m_unrealized_pnl(0),
m_total_pnl(0),
m_islast(0){}
} ATU_OTI_portfoliofeed_struct;
typedef struct ATU_OTI_portfolio_get_trade_history_struct{
// Message Type Direction Purpose Timestamp of messages Market(string) Product Code(string) Order ID(string)
//Price (double) Qty (double) Open or Close (string) Buy or Sell (int) Trade ID (string) Source (int)
string m_timestamp;
string m_portfolio_name;
string m_period;
string m_client_user;
ATU_OTI_portfolio_get_trade_history_struct():
m_timestamp(""),
m_portfolio_name(""),
m_period(""),
m_client_user(""){}
} ATU_OTI_portfolio_get_trade_history_struct;
typedef struct ATU_OTI_portfolio_get_working_orders_struct{
// Message Type Direction Purpose Timestamp of messages Market(string) Product Code(string) Order ID(string)
//Price (double) Qty (double) Open or Close (string) Buy or Sell (int) Trade ID (string) Source (int)
string m_timestamp;
string m_portfolio_name;
string m_period;
string m_client_user;
ATU_OTI_portfolio_get_working_orders_struct():
m_timestamp(""),
m_portfolio_name(""),
m_period(""),
m_client_user(""){}
} ATU_OTI_portfolio_get_working_orders_struct;
typedef struct ATU_OTI_portfolio_get_PnL_struct{
// Message Type Direction Purpose Timestamp of messages Market(string) Product Code(string) Order ID(string)
//Price (double) Qty (double) Open or Close (string) Buy or Sell (int) Trade ID (string) Source (int)
string m_timestamp;
string m_portfolio_name;
string m_period;
string m_client_user;
ATU_OTI_portfolio_get_PnL_struct():
m_timestamp(""),
m_portfolio_name(""),
m_period(""),
m_client_user(""){}
} ATU_OTI_portfolio_get_PnL_struct;
typedef struct ATU_OTI_risk_setting_struct{
// Message Type Direction Purpose Timestamp of messages Market(string) Product Code(string) Order ID(string)
//Price (double) Qty (double) Open or Close (string) Buy or Sell (int) Trade ID (string) Source (int)
string m_timestamp;
string m_function;
ATU_OTI_risk_setting_struct():
m_timestamp(""),
m_function(""){}
} ATU_OTI_risk_setting_struct;
typedef struct ATU_OTI_insert_order_struct{
string m_timestamp;
string m_market;
string m_feedcode;
string m_order_id;
double m_price;
double m_qty;
string m_open_or_close;
int m_buy_or_sell;
string m_order_action;
string m_order_type;
string m_order_validity;
ATU_OTI_insert_order_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_order_id(""),
m_price(0),
m_qty(0),
m_open_or_close(""),
m_buy_or_sell(0),
m_order_action(""),
m_order_type(""),
m_order_validity(""){}
} ATU_OTI_insert_order_struct;
typedef struct ATU_OTI_delete_order_struct{
string m_timestamp;
string m_market;
string m_feedcode;
string m_order_id;
ATU_OTI_delete_order_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_order_id(""){}
} ATU_OTI_delete_order_struct;
typedef struct ATU_OTI_quoterequestfeed_struct{
string m_timestamp;
string m_market;
string m_feedcode;
int m_buysellboth;
double m_volume;
ATU_OTI_quoterequestfeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_buysellboth(0),
m_volume(0){}
} ATU_OTI_quoterequestfeed_struct;
typedef struct ATU_OTI_reset_struct{
string m_timestamp;
ATU_OTI_reset_struct():
m_timestamp(""){}
} ATU_OTI_reset_struct;
typedef boost::function < void(string str) > ATU_String_CallBackFunc;
typedef boost::function < bool(ATU_OTI_signalfeed_struct &s) > ATU_OTI_signalfeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_portfolio_get_trade_history_struct &s) > ATU_OTI_portfolio_get_trade_history_CallBackFunc;
typedef boost::function < bool(ATU_OTI_portfolio_get_working_orders_struct &s) > ATU_OTI_portfolio_get_working_orders_CallBackFunc;
typedef boost::function < bool(ATU_OTI_ping_struct &s) > ATU_OTI_ping_CallBackFunc;
typedef boost::function < bool(ATU_OTI_portfolio_get_PnL_struct &s) > ATU_OTI_portfolio_get_PnL_CallBackFunc;
typedef boost::function < bool(ATU_OTI_tradefeed_struct &s) > ATU_OTI_tradefeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_orderfeed_struct &s) > ATU_OTI_orderfeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_riskfeed_struct &s) > ATU_OTI_riskfeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_riskstatusfeed_struct &s) > ATU_OTI_riskstatusfeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_portfoliofeed_struct &s) > ATU_OTI_portfoliofeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_quoterequestfeed_struct &s) > ATU_OTI_quoterequestfeed_CallBackFunc;
typedef boost::function < bool(ATU_OTI_risk_setting_struct &s) > ATU_OTI_risk_setting_CallBackFunc;
typedef boost::function < void(ParsedMarketData *) > ATU_OTI_Tick_CallBackFunc;
typedef boost::function < bool(ATU_OTI_reset_struct &s) > ATU_OTI_reset_CallBackFunc;
typedef boost::function < double(const string &) > ATU_OTI_get_current_position_from_portfolio_manager_CallBackFunc;
typedef boost::function < void(vector<ATU_OTI_portfoliofeed_struct> &) > ATU_OTI_get_portfoliofeeds_from_portfolio_manager_CallBackFunc;
typedef boost::function < void(const string &,ATU_OTI_portfoliofeed_struct &) > ATU_OTI_get_portfoliofeed_struct_from_portfolio_manager_CallBackFunc;
typedef boost::function < double(const string &) > ATU_OTI_get_total_pnl_from_portfolio_manager_CallBackFunc;
typedef boost::function < double() > ATU_OTI_get_allproducts_total_pnl_from_portfolio_manager_CallBackFunc;
typedef boost::function < void(vector<string> &) > ATU_OTI_get_allfeedcodes_from_portfolio_manager_CallBackFunc;
namespace atu
{
class ATU_Abstract_OTI
{
public:
ATU_Abstract_OTI();
virtual ~ATU_Abstract_OTI();
//would then call all the notify_orderfeed for all the order in the list
virtual bool on_notify_orderfeed(ATU_OTI_orderfeed_struct &s);
//would then call all the notify_tradefeed for all the order in the list
virtual bool on_notify_tradefeed(ATU_OTI_tradefeed_struct &s);
//process incoming signal feed and dispatch for all the order in the list if necessary
virtual bool on_process_signalfeed(ATU_OTI_signalfeed_struct &s);
//process incoming quote request feed
virtual bool on_process_quoterequestfeed(ATU_OTI_quoterequestfeed_struct &s);
//notify orderfeed to call back function
virtual bool notify_orderfeed(ATU_OTI_orderfeed_struct &s);
//notify tradefeed to call back function
virtual bool notify_tradefeed(ATU_OTI_tradefeed_struct &s);
//notify risk msg
virtual bool notify_riskfeed(ATU_OTI_riskfeed_struct &s);
//notify risk status msg
virtual bool notify_riskstatusfeed(ATU_OTI_riskstatusfeed_struct &s);
//notify error msg
virtual bool notify_errorfeed(ATU_ErrorMsgStruct *ems);
virtual bool on_notify_riskfeed(ATU_OTI_riskfeed_struct &s);
virtual bool on_notify_riskstatusfeed(ATU_OTI_riskstatusfeed_struct &s);
//processing of incoming errorfeed
virtual bool on_notify_errorfeed(ATU_ErrorMsgStruct *ems);
virtual bool notify_portfoliofeed(ATU_OTI_portfoliofeed_struct &s);
virtual bool on_notify_portfoliofeed(ATU_OTI_portfoliofeed_struct &s);
//register send order callback func
virtual void register_signalfeed_call_back_func(ATU_OTI_signalfeed_CallBackFunc *callback);
virtual void register_convert_signalfeed_call_back_func(ATU_OTI_signalfeed_CallBackFunc *callback);
virtual void register_portfolio_get_working_orders_call_back_func(ATU_OTI_portfolio_get_working_orders_CallBackFunc *callback);
virtual void register_portfolio_get_trade_history_call_back_func(ATU_OTI_portfolio_get_trade_history_CallBackFunc *callback);
virtual void register_portfolio_get_PnL_call_back_func(ATU_OTI_portfolio_get_PnL_CallBackFunc *callback);
virtual bool register_notify_orderfeed_call_back_func(ATU_OTI_orderfeed_CallBackFunc *callback);
virtual bool register_notify_tradefeed_call_back_func(ATU_OTI_tradefeed_CallBackFunc *callback);
virtual bool register_notify_errorfeed_call_back_func(ATU_errorfeed_CallBackFunc *callback);
virtual bool register_notify_riskfeed_call_back_func(ATU_OTI_riskfeed_CallBackFunc *callback);
virtual bool register_notify_riskstatusfeed_call_back_func(ATU_OTI_riskstatusfeed_CallBackFunc *callback);
virtual bool register_notify_portfoliofeed_call_back_func(ATU_OTI_portfoliofeed_CallBackFunc *callback);
virtual bool process_portfolio_get_working_orders(ATU_OTI_portfolio_get_working_orders_struct &s);
virtual bool on_process_portfolio_get_working_orders(ATU_OTI_portfolio_get_working_orders_struct &s);
virtual bool process_portfolio_get_trade_history(ATU_OTI_portfolio_get_trade_history_struct &s);
virtual bool on_process_portfolio_get_trade_history(ATU_OTI_portfolio_get_trade_history_struct &s);
virtual bool on_process_portfolio_get_PnL(ATU_OTI_portfolio_get_PnL_struct &s);
virtual bool process_portfolio_get_PnL(ATU_OTI_portfolio_get_PnL_struct &s);
virtual bool on_process_marketfeed(ATU_MDI_marketfeed_struct &s);
virtual bool on_process_ohlcfeed(ATU_MDI_ohlcfeed_struct &s);
virtual void register_notify_logfeed_call_back_func(ATU_logfeed_CallBackFunc *callback);
virtual bool register_process_tick_call_back_func(ATU_OTI_Tick_CallBackFunc *);
virtual bool notify_logfeed(ATU_logfeed_struct *s);
virtual void setConnectString(string str) {}
virtual void detach() {}
protected:
ATU_logfeed_CallBackFunc *m_logfeed_call_back_func;
//send order callback func
ATU_OTI_signalfeed_CallBackFunc *m_signalfeed_call_back_func;
ATU_OTI_signalfeed_CallBackFunc *m_convert_signalfeed_call_back_func;
vector<ATU_OTI_tradefeed_CallBackFunc * >m_notify_tradefeed_call_back_func_list;
vector<ATU_OTI_orderfeed_CallBackFunc * >m_notify_orderfeed_call_back_func_list;
vector<ATU_OTI_riskfeed_CallBackFunc * >m_notify_riskfeed_call_back_func_list;
vector<ATU_OTI_riskstatusfeed_CallBackFunc * >m_notify_riskstatusfeed_call_back_func_list;
vector<ATU_errorfeed_CallBackFunc * > m_notify_errorfeed_call_back_func_list;
vector<ATU_OTI_portfoliofeed_CallBackFunc * > m_notify_portfoliofeed_call_back_func_list;
ATU_OTI_portfolio_get_working_orders_CallBackFunc *m_portfolio_get_working_orders_call_back_func;
ATU_OTI_portfolio_get_trade_history_CallBackFunc *m_portfolio_get_trade_history_call_back_func;
ATU_OTI_portfolio_get_PnL_CallBackFunc * m_portfolio_get_PnL_call_back_func;
ATU_OTI_Tick_CallBackFunc * m_process_tick_call_back_func;
};
}
#endif //_ATU_ABSTRACT_OTI_H_
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyR1.cpp
#include <StrategyR1.h>
// StrategyR1::StrategyR1()
// {
// m_MarketData = MarketData::Instance();
// m_SystemState = SystemState::Instance();
// m_SysCfg = SystemConfig::Instance();
// m_Logger = Logger::Instance();
// m_TechInd = TechIndicators::Instance();
// m_PortAndOrders = PortfoliosAndOrders::Instance();
// m_MDIAck = MDI_Acknowledgement::Instance();
// }
//
// StrategyR1::~StrategyR1() {
// }
//
// void StrategyR1::Run()
// {
// //--------------------------------------------------
// // Init path
// //--------------------------------------------------
// ofstream fsSignalLog(m_SysCfg->GetSignalLogPath(STY_R1).c_str());
//
// //--------------------------------------------------
// // Init other parameters
// //--------------------------------------------------
// m_ParamVector = m_SysCfg->GetParamVector(STY_R1);
//
// //--------------------------------------------------
// for (;;)
// {
// m_MarketData->WaitForData();
//
// if (m_SystemState->ChkIfThreadShouldStop()) break;
//
// YYYYMMDDHHMMSS ymdhms_MDITime = m_MarketData->GetSystemTimeHKT();
//
// if (m_SysCfg->IsStrategyOn(STY_R1))
// {
// m_Logger->Write(Logger::INFO,"SunnyDebug: %s::%s (%d)",__FILE__,__FUNCTION__,__LINE__);
// }
//
// ReportAckIfNeeded();
// }
//
// m_Logger->Write(Logger::NOTICE,"StrategyR1 has ended.");
// sleep(2);
//
// return;
// }
//
// void StrategyR1::ReportAckIfNeeded()
// {
// if (m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::TCPWITHACK || m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::EMBEDDED)
// m_MDIAck->ReportAck(STY_R1);
// return;
// }
<file_sep>/NirvanaCommon/Util/SFunctional.cpp
#include "SFunctional.h"
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyETFR.cpp
#include <StrategyETFR.h>
// StrategyETFR::StrategyETFR()
// {
// m_MarketData = MarketData::Instance();
// m_SystemState = SystemState::Instance();
// m_SysCfg = SystemConfig::Instance();
// m_Logger = Logger::Instance();
// m_TechInd = TechIndicators::Instance();
// m_PortAndOrders = PortfoliosAndOrders::Instance();
// m_MDIAck = MDI_Acknowledgement::Instance();
// }
//
// StrategyETFR::~StrategyETFR()
// {
// }
//
// void StrategyETFR::Run()
// {
// //--------------------------------------------------
// // Init path
// //--------------------------------------------------
// ofstream fsSignalLog(m_SysCfg->GetSignalLogPath(STY_ETFR).c_str());
//
// //--------------------------------------------------
// // Init other parameters
// //--------------------------------------------------
// m_SamplingIntervalInSec = 1800;
// m_LastMonitoredTime.Set(m_MarketData->GetSystemTimeHKT());
//
// //--------------------------------------------------
// for (;;)
// {
// m_TechInd->WaitForData();
//
// if (m_SystemState->ChkIfThreadShouldStop()) break;
//
// YYYYMMDDHHMMSS ymdhms_MDITime = m_MarketData->GetSystemTimeHKT();
//
// if (m_SysCfg->IsStrategyOn(STY_ETFR))
// {
// }
//
// ReportAckIfNeeded();
// }
//
// m_Logger->Write(Logger::NOTICE,"StrategyETFR has ended.");
// sleep(2);
//
// return;
// }
//
// void StrategyETFR::ReportAckIfNeeded()
// {
// if (m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::TCPWITHACK || m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::EMBEDDED)
// m_MDIAck->ReportAck(STY_ETFR);
// return;
// }
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyB2US3.h
#ifndef PORTFOLIOGENERATION_STRATEGYB2US3_H_
#define PORTFOLIOGENERATION_STRATEGYB2US3_H_
#include "PCH.h"
#include "Constants.h"
#include "StrategyB2.h"
class StrategyB2_US3: public StrategyB2 {
public:
StrategyB2_US3();
virtual ~StrategyB2_US3();
};
#endif
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyS13.cpp
/*
* StrategyS13.cpp
*
* Created on: Dec 9, 2015
* Author: qy
*/
#include <StrategyS13.h>
StrategyS13::StrategyS13() {
// TODO Auto-generated constructor stub
}
StrategyS13::~StrategyS13() {
// TODO Auto-generated destructor stub
}
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyB2HK.h
#ifndef PORTFOLIOSTRATEGYB2_H_
#define PORTFOLIOSTRATEGYB2_H_
#include "PCH.h"
#include "Constants.h"
#include "StrategyB2.h"
class StrategyB2_HK : public StrategyB2 {
public:
StrategyB2_HK();
virtual ~StrategyB2_HK();
};
#endif
<file_sep>/oti_mdi_common/src/order/ATU_Abstract_OTI.cpp
///WARNING INCOMPLETED IMPLEMENTATION
#include "ATU_Abstract_OTI.h"
using namespace std;
namespace atu
{
ATU_Abstract_OTI::ATU_Abstract_OTI() :
m_signalfeed_call_back_func(NULL),
m_convert_signalfeed_call_back_func(NULL),
m_portfolio_get_working_orders_call_back_func(NULL),
m_logfeed_call_back_func(NULL),
m_portfolio_get_trade_history_call_back_func(NULL),
m_portfolio_get_PnL_call_back_func(NULL),
m_process_tick_call_back_func(NULL)
{
m_notify_tradefeed_call_back_func_list.clear();
m_notify_orderfeed_call_back_func_list.clear();
m_notify_errorfeed_call_back_func_list.clear();
}
ATU_Abstract_OTI::~ATU_Abstract_OTI() {
}
//would then call all the notify_tradefeed for all the order in the list
bool ATU_Abstract_OTI::on_notify_tradefeed(ATU_OTI_tradefeed_struct &s) {
return true;
}
bool ATU_Abstract_OTI::on_notify_errorfeed(ATU_ErrorMsgStruct *ems) {
return true;
}
bool ATU_Abstract_OTI::on_notify_orderfeed(ATU_OTI_orderfeed_struct &s) {
return true;
}
bool ATU_Abstract_OTI::on_notify_riskfeed(ATU_OTI_riskfeed_struct &s) {
return true;
}
bool ATU_Abstract_OTI::on_notify_riskstatusfeed(ATU_OTI_riskstatusfeed_struct &s) {
return true;
}
//process incoming signal feed and dispatch for all the order in the list if necessary
bool ATU_Abstract_OTI::on_process_signalfeed(ATU_OTI_signalfeed_struct &s) {
//here we determine what order to create
return true;
}
bool ATU_Abstract_OTI::on_process_quoterequestfeed(ATU_OTI_quoterequestfeed_struct &s) {
//here we determine what order to create
return true;
}
bool ATU_Abstract_OTI::on_notify_portfoliofeed(ATU_OTI_portfoliofeed_struct &s){
return true;
}
bool ATU_Abstract_OTI::on_process_portfolio_get_working_orders(ATU_OTI_portfolio_get_working_orders_struct &s) {
return true;
}
bool ATU_Abstract_OTI::process_portfolio_get_working_orders(ATU_OTI_portfolio_get_working_orders_struct &s) {
return true;
}
bool ATU_Abstract_OTI::process_portfolio_get_PnL(ATU_OTI_portfolio_get_PnL_struct &s) {
return true;
}
bool ATU_Abstract_OTI::process_portfolio_get_trade_history(ATU_OTI_portfolio_get_trade_history_struct &s)
{
return true;
}
bool ATU_Abstract_OTI::on_process_portfolio_get_trade_history(ATU_OTI_portfolio_get_trade_history_struct &s)
{
return true;
}
bool ATU_Abstract_OTI::on_process_portfolio_get_PnL(ATU_OTI_portfolio_get_PnL_struct &s)
{
return true;
}
//register send order callback func
void ATU_Abstract_OTI::register_signalfeed_call_back_func(ATU_OTI_signalfeed_CallBackFunc *callback) {
m_signalfeed_call_back_func=callback;
}
//register convert order callback func
void ATU_Abstract_OTI::register_convert_signalfeed_call_back_func(ATU_OTI_signalfeed_CallBackFunc *callback) {
m_convert_signalfeed_call_back_func=callback;
}
void ATU_Abstract_OTI::register_portfolio_get_working_orders_call_back_func(ATU_OTI_portfolio_get_working_orders_CallBackFunc *callback)
{
m_portfolio_get_working_orders_call_back_func=callback;
}
void ATU_Abstract_OTI::register_portfolio_get_trade_history_call_back_func(ATU_OTI_portfolio_get_trade_history_CallBackFunc *callback)
{
m_portfolio_get_trade_history_call_back_func=callback;
}
void ATU_Abstract_OTI::register_portfolio_get_PnL_call_back_func(ATU_OTI_portfolio_get_PnL_CallBackFunc *callback){
m_portfolio_get_PnL_call_back_func=callback;
}
void ATU_Abstract_OTI::register_notify_logfeed_call_back_func(ATU_logfeed_CallBackFunc *callback)
{
m_logfeed_call_back_func=callback;
}
bool ATU_Abstract_OTI::register_notify_orderfeed_call_back_func(ATU_OTI_orderfeed_CallBackFunc *callback)
{
m_notify_orderfeed_call_back_func_list.push_back(callback);
return true;
}
bool ATU_Abstract_OTI::register_notify_tradefeed_call_back_func(ATU_OTI_tradefeed_CallBackFunc *callback)
{
m_notify_tradefeed_call_back_func_list.push_back(callback);
return true;
}
bool ATU_Abstract_OTI::register_notify_errorfeed_call_back_func(ATU_errorfeed_CallBackFunc *callback)
{
m_notify_errorfeed_call_back_func_list.push_back(callback);
return true;
}
bool ATU_Abstract_OTI::register_notify_riskfeed_call_back_func(ATU_OTI_riskfeed_CallBackFunc *callback)
{
m_notify_riskfeed_call_back_func_list.push_back(callback);
return true;
}
bool ATU_Abstract_OTI::register_notify_riskstatusfeed_call_back_func(ATU_OTI_riskstatusfeed_CallBackFunc *callback)
{
m_notify_riskstatusfeed_call_back_func_list.push_back(callback);
return true;
}
bool ATU_Abstract_OTI::register_notify_portfoliofeed_call_back_func(ATU_OTI_portfoliofeed_CallBackFunc *callback){
m_notify_portfoliofeed_call_back_func_list.push_back(callback);
return true;
}
bool ATU_Abstract_OTI::notify_logfeed(ATU_logfeed_struct *s)
{
if (m_logfeed_call_back_func!=NULL) {
(*m_logfeed_call_back_func)(s);
}
return true;
}
//process orderfeed from lower layer and handle it accordingly
bool ATU_Abstract_OTI::notify_orderfeed(ATU_OTI_orderfeed_struct &s)
{
for(unsigned int i = 0 ; i < m_notify_orderfeed_call_back_func_list.size() ; i++){
if (m_notify_orderfeed_call_back_func_list[i]!=NULL) {
(*m_notify_orderfeed_call_back_func_list[i])(s);
} else {
return false;
}
}
return true;
}
//process tradefeed from lower layer and handle it accordingly
bool ATU_Abstract_OTI::notify_tradefeed(ATU_OTI_tradefeed_struct &s)
{
for(unsigned int i = 0 ; i < m_notify_tradefeed_call_back_func_list.size() ; i++){
if (m_notify_tradefeed_call_back_func_list[i]!=NULL) {
(*m_notify_tradefeed_call_back_func_list[i])(s);
} else {
return false;
}
}
return true;
}
bool ATU_Abstract_OTI::notify_errorfeed(ATU_ErrorMsgStruct *ems)
{
for(unsigned int i = 0 ; i < m_notify_errorfeed_call_back_func_list.size() ; i++){
if (m_notify_errorfeed_call_back_func_list[i]!=NULL) {
(*m_notify_errorfeed_call_back_func_list[i])(ems);
} else {
return false;
}
}
return true;
}
bool ATU_Abstract_OTI::notify_riskfeed(ATU_OTI_riskfeed_struct &s)
{
// cout << "ATU_Abstract_OTI::notify_riskfeed" << endl;
for(unsigned int i = 0 ; i < m_notify_riskfeed_call_back_func_list.size() ; i++){
if (m_notify_riskfeed_call_back_func_list[i]!=NULL) {
// cout << "ATU_Abstract_OTI::notify_riskfeed before calling callback" << endl;
(*m_notify_riskfeed_call_back_func_list[i])(s);
} else {
return false;
}
}
return true;
}
bool ATU_Abstract_OTI::notify_riskstatusfeed(ATU_OTI_riskstatusfeed_struct &s)
{
for(unsigned int i = 0 ; i < m_notify_riskstatusfeed_call_back_func_list.size() ; i++){
if (m_notify_riskstatusfeed_call_back_func_list[i]!=NULL) {
(*m_notify_riskstatusfeed_call_back_func_list[i])(s);
} else {
return false;
}
}
return true;
}
bool ATU_Abstract_OTI::notify_portfoliofeed(ATU_OTI_portfoliofeed_struct &s)
{
for(unsigned int i = 0 ; i < m_notify_portfoliofeed_call_back_func_list.size() ; i++){
if (m_notify_portfoliofeed_call_back_func_list[i]!=NULL) {
(*m_notify_portfoliofeed_call_back_func_list[i])(s);
} else {
return false;
}
}
return true;
}
bool ATU_Abstract_OTI::on_process_marketfeed(ATU_MDI_marketfeed_struct &s)
{
return true;
}
bool ATU_Abstract_OTI::on_process_ohlcfeed(ATU_MDI_ohlcfeed_struct &s)
{
return true;
}
bool ATU_Abstract_OTI::register_process_tick_call_back_func(ATU_OTI_Tick_CallBackFunc * callback){
m_process_tick_call_back_func = callback;
return true;
}
}
<file_sep>/NirvanaInfrastructure/Facilities/TradingEngineMainThread.cpp
#include <TradingEngineMainThread.h>
TradingEngineMainThread::TradingEngineMainThread
(const char * sConfPath) :
m_ConfigPath(string(sConfPath)),
m_ItrdHighLowFromIB(""),
m_FinishedInit(false)
{
}
TradingEngineMainThread::TradingEngineMainThread
(const char * sConfPath,
const char * sItrdHighLowFromIB) :
m_ConfigPath(string(sConfPath)),
m_ItrdHighLowFromIB(string(sItrdHighLowFromIB)),
m_FinishedInit(false)
{
}
TradingEngineMainThread::~TradingEngineMainThread()
{
}
bool TradingEngineMainThread::HasFinishedInit()
{
return m_FinishedInit;
}
void TradingEngineMainThread::RunMainThread()
{
string sConfigPath(m_ConfigPath);
//--------------------------------------------------
// System Objects
//--------------------------------------------------
p_SysCfg = SystemConfig::Instance();
p_SysCfg->ReadConfig(sConfigPath);
if (m_ItrdHighLowFromIB != "") p_SysCfg->SetItrdHighLowFromIB(m_ItrdHighLowFromIB);
//--------------------------------------------------
p_Logger = Logger::Instance();
p_Logger->Write(Logger::NOTICE,"Main: Nirvana has started.");
//--------------------------------------------------
// Static Data: Exchange HKFE HKSE HKMA
//--------------------------------------------------
p_Exchg = Exchange::Instance();
p_Exchg->LoadTradingHours(p_SysCfg->Get_TradingHoursPath());
p_HKFE = HKFE::Instance();
p_HKFE->LoadCalendar(p_SysCfg->Get_HKFE_CalendarPath());
p_Logger->Write(Logger::NOTICE,"Finished loading HKFE."); usleep(100000);
p_HKSE = HKSE::Instance();
p_HKSE->LoadHSIConstituents(p_SysCfg->Get_HKSE_HSIConstituentsPath());
p_Logger->Write(Logger::NOTICE,"Finished loading HKSE."); usleep(100000);
p_HKMA = HKMA::Instance();
if (p_SysCfg->IsStrategyOn(STY_NIR))
{
p_HKMA->LoadExchgFundBill(p_SysCfg->Get_HKMA_ExchgFundBillPath());
p_Logger->Write(Logger::NOTICE,"Finished loading HKMA."); usleep(100000);
}
else
{
p_Logger->Write(Logger::NOTICE,"HKMA not loaded."); usleep(100000);
}
//--------------------------------------------------
// Static Data: Correl Matrix
//--------------------------------------------------
p_CorrelMatrices = CorrelMatrices::Instance();
if (p_SysCfg->IsStrategyOn(STY_NIR))
{
p_CorrelMatrices->LoadCorrelMatrices(p_SysCfg->Get_CorrelMatricesPath());
p_Logger->Write(Logger::NOTICE,"Finished loading correlation matrices."); usleep(100000);
}
else
{
p_Logger->Write(Logger::NOTICE,"CorrelMatrices not loaded."); usleep(100000);
}
//--------------------------------------------------
// ProbDistributionGenerator
//--------------------------------------------------
ProbDistributionGenerator pdg;
if (p_SysCfg->IsStrategyOn(STY_NIR))
{
pdg.SetCalcIntervalInSec(p_SysCfg->Get_ProbDistrnCalcIntervalInSec());
pdg.LoadTrainedFSMCData(p_SysCfg->Get_ProbDistrFileFSMC1D());
p_Logger->Write(Logger::NOTICE,"Finished loading FSMC data."); usleep(100000);
}
else
{
p_Logger->Write(Logger::NOTICE,"FSMC not loaded."); usleep(100000);
}
//--------------------------------------------------
// VolSurfCalculator
//--------------------------------------------------
VolSurfCalculator vsc;
vsc.SetCalcIntervalInSec(p_SysCfg->Get_VolSurfCalcIntervalInSec());
p_Logger->Write(Logger::NOTICE,"Finished loading VolSurfCalculator."); usleep(100000);
//--------------------------------------------------
// VolSurfaces
//--------------------------------------------------
boost::shared_ptr<VolSurfaces> p_VolSurfaces;
p_VolSurfaces = VolSurfaces::Instance();
if (p_SysCfg->IsStrategyOn(STY_NIR))
{
p_VolSurfaces->LoadHSIVolSurfModelParam(p_SysCfg->Get_VolSurfParamFile1FM());
p_Logger->Write(Logger::NOTICE,"Finished loading volatility surface parameters."); usleep(100000);
}
else
{
p_Logger->Write(Logger::NOTICE,"VolatilitySurface parameters not loaded."); usleep(100000);
}
//--------------------------------------------------
// TechIndUpdater
//--------------------------------------------------
TechIndUpdater tiu;
//--------------------------------------------------
// PriceForwarderToNextTier
//--------------------------------------------------
PriceForwarderToNextTier pf;
//--------------------------------------------------
// PortfolioGenerator
//--------------------------------------------------
boost::scoped_ptr<StrategyTest> styTest;
boost::scoped_ptr<PortfolioGenerator> pg;
boost::scoped_ptr<StrategyB1_HKF> styB1_HKF;
boost::scoped_ptr<StrategyB2_US1> styB2_US1;
boost::scoped_ptr<StrategyB2_US2> styB2_US2;
boost::scoped_ptr<StrategyB2_US3> styB2_US3;
boost::scoped_ptr<StrategyB2_HK> styB2_HK;
boost::scoped_ptr<StrategyNIR1> styNIR1;
boost::scoped_ptr<StrategyR7> styR7;
boost::scoped_ptr<StrategyR9> styR9;
// boost::scoped_ptr<StrategyA1> styA1;
// boost::scoped_ptr<StrategyA6> styA6;
// boost::scoped_ptr<StrategyR1> styR1;
// boost::scoped_ptr<StrategyR3> styR3;
// boost::scoped_ptr<StrategyR8> styR8;
// boost::scoped_ptr<StrategyS11A> styS11A;
//--------------------------------------------------
// Terminal
//--------------------------------------------------
// TerminalThread tthd;
//--------------------------------------------------
// MarkToMarket
//--------------------------------------------------
MarkToMarket mtm;
//--------------------------------------------------
// ThreadHealthMonitor
//--------------------------------------------------
boost::shared_ptr<ThreadHealthMonitor> pThm = ThreadHealthMonitor::Instance();
//--------------------------------------------------
// Threads
//--------------------------------------------------
boost::thread_group m_thread_group;
m_thread_group.add_thread(new boost::thread(&ThreadHealthMonitor::Run, pThm.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: ThreadHealthMonitor"); usleep(100000);
if (p_SysCfg->IsStrategyOn(STY_NIR))
{
m_thread_group.add_thread(new boost::thread(&ProbDistributionGenerator::Run, &pdg));
p_Logger->Write(Logger::NOTICE,"Started thread: ProbDistributionGenerator"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_TEST))
{
styTest.reset(new StrategyTest());
m_thread_group.add_thread(new boost::thread(&StrategyTest::Run, styTest.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyTest"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_B1_HKF))
{
styB1_HKF.reset(new StrategyB1_HKF());
m_thread_group.add_thread(new boost::thread(&StrategyB1_HKF::Run, styB1_HKF.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyB1_HKF"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_B2_US1))
{
styB2_US1.reset(new StrategyB2_US1());
m_thread_group.add_thread(new boost::thread(&StrategyB2_US1::Run, styB2_US1.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyB2_US1"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_B2_US2))
{
styB2_US2.reset(new StrategyB2_US2());
m_thread_group.add_thread(new boost::thread(&StrategyB2_US2::Run, styB2_US2.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyB2_US2"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_B2_US3))
{
styB2_US3.reset(new StrategyB2_US3());
m_thread_group.add_thread(new boost::thread(&StrategyB2_US3::Run, styB2_US3.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyB2_US3"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_B2_HK))
{
styB2_HK.reset(new StrategyB2_HK());
m_thread_group.add_thread(new boost::thread(&StrategyB2_HK::Run, styB2_HK.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyB2_HK"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_NIR1))
{
styNIR1.reset(new StrategyNIR1());
m_thread_group.add_thread(new boost::thread(&StrategyNIR1::Run, styNIR1.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyNIR1"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_R7))
{
styR7.reset(new StrategyR7());
m_thread_group.add_thread(new boost::thread(&StrategyR7::Run, styR7.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyR7"); usleep(100000);
}
if (p_SysCfg->IsStrategyOn(STY_R9))
{
styR9.reset(new StrategyR9());
m_thread_group.add_thread(new boost::thread(&StrategyR9::Run, styR9.get()));
p_Logger->Write(Logger::NOTICE,"Started thread: StrategyR9"); usleep(100000);
}
// if (p_SysCfg->IsStrategyOn(STY_S11A))
// {
// styS11A.reset(new StrategyS11A());
// m_thread_group.add_thread(new boost::thread(&StrategyS11A::Run, styS11A.get()));
// p_Logger->Write(Logger::NOTICE,"Started thread: StrategyS11A"); usleep(100000);
// }
//
// if (p_SysCfg->IsStrategyOn(STY_R1))
// {
// styR1.reset(new StrategyR1());
// m_thread_group.add_thread(new boost::thread(&StrategyR1::Run, styR1.get()));
// p_Logger->Write(Logger::NOTICE,"Started thread: StrategyR1"); usleep(100000);
// }
//
// if (p_SysCfg->IsStrategyOn(STY_R3))
// {
// styR3.reset(new StrategyR3());
// m_thread_group.add_thread(new boost::thread(&StrategyR3::Run, styR3.get()));
// p_Logger->Write(Logger::NOTICE,"Started thread: StrategyR3"); usleep(100000);
// }
//
// if (p_SysCfg->IsStrategyOn(STY_R8))
// {
// styR8.reset(new StrategyR8());
// m_thread_group.add_thread(new boost::thread(&StrategyR8::Run, styR8.get()));
// p_Logger->Write(Logger::NOTICE,"Started thread: StrategyR8"); usleep(100000);
// }
// if (p_SysCfg->IsStrategyOn(STY_A1))
// {
// styA1.reset(new StrategyA1());
// m_thread_group.add_thread(new boost::thread(&StrategyA1::Run, styA1.get()));
// p_Logger->Write(Logger::NOTICE,"Started thread: StrategyA1"); usleep(100000);
// }
//
// if (p_SysCfg->IsStrategyOn(STY_A6))
// {
// styA6.reset(new StrategyA6());
// m_thread_group.add_thread(new boost::thread(&StrategyA6::Run, styA6.get()));
// p_Logger->Write(Logger::NOTICE,"Started thread: StrategyA6"); usleep(100000);
// }
//
{
pg.reset(new PortfolioGenerator());
m_thread_group.add_thread(new boost::thread(&VolSurfCalculator::Run ,&vsc));
m_thread_group.add_thread(new boost::thread(&TechIndUpdater::Run ,&tiu));
m_thread_group.add_thread(new boost::thread(&PriceForwarderToNextTier::Run ,&pf));
m_thread_group.add_thread(new boost::thread(&PortfolioGenerator::Run ,pg.get()));
// m_thread_group.add_thread(new boost::thread(&TerminalThread::Run ,&tthd));
m_thread_group.add_thread(new boost::thread(&MarkToMarket::Run ,&mtm));
p_Logger->Write(Logger::NOTICE,"Started thread: VolSurfCalculator"); usleep(100000);
p_Logger->Write(Logger::NOTICE,"Started thread: TechIndUpdater"); usleep(100000);
p_Logger->Write(Logger::NOTICE,"Started thread: PortfolioGenerator"); usleep(100000);
p_Logger->Write(Logger::NOTICE,"Started thread: OrderExecutor"); usleep(100000);
p_Logger->Write(Logger::NOTICE,"Started thread: TerminalThread"); usleep(100000);
p_Logger->Write(Logger::NOTICE,"Started thread: MarkToMarket"); usleep(100000);
}
//--------------------------------------------------
// Start all other threads before the MD threads, otherwise these thread will miss the initial data.
//--------------------------------------------------
{
//--------------------------------------------------
// Start OTI threads
//--------------------------------------------------
//--------------------------------------------------
// OTI (only support 1 OTI now...)
//--------------------------------------------------
p_oe.reset(new OrderExecutor());
if (p_SysCfg->Get_OTIMode() == SystemConfig::OTI_TCP)
{
int iNumOfOTI = p_SysCfg->GetNumOfOTI();
for (unsigned int i = 0; i < iNumOfOTI; ++i)
{
string sIP = p_SysCfg->Get_OTI_IP(i);
string sPort = p_SysCfg->Get_OTI_Port(i);
p_Logger->Write(Logger::NOTICE,"Read from SystemConfig: OTI %d: %s %s",i,sIP.c_str(),sPort.c_str());
p_oe->SetOTIServer(sIP,sPort);
p_Logger->Write(Logger::NOTICE,"Finished loading OTI %d.",i);
m_thread_group.add_thread(new boost::thread(&OrderExecutor::Run ,(p_oe.get())));
// m_thread_group.add_thread(new boost::thread(&OrderExecutor::RunChkOrd ,(p_oe.get())));
}
}
else
{
p_Logger->Write(Logger::NOTICE,"OTI not loaded."); usleep(100000);
}
//--------------------------------------------------
// start RunPersistPos always
//--------------------------------------------------
m_thread_group.add_thread(new boost::thread(&OrderExecutor::RunPersistPos,(p_oe.get())));
//--------------------------------------------------
// Start MDI threads
//--------------------------------------------------
sleep(1);
//--------------------------------------------------
// MDI
//--------------------------------------------------
int iNumOfMDI = p_SysCfg->GetNumOfMDI();
p_dataagg.clear();
p_dataagg.insert(p_dataagg.begin(),iNumOfMDI,boost::shared_ptr<DataAggregator>());
for (unsigned int i = 0; i < iNumOfMDI; ++i)
{
string sFile = p_SysCfg->Get_MDI_File(i);
string sIP = p_SysCfg->Get_MDI_IP(i);
string sPort = p_SysCfg->Get_MDI_Port(i);
p_Logger->Write(Logger::NOTICE,"Read from SystemConfig: MDI %d: File %s IP %s Port %s",i,sFile.c_str(),sIP.c_str(),sPort.c_str());
p_dataagg[i].reset(new DataAggregator(i));
if (sFile == "")
{
p_dataagg[i]->SetMDIServer(sIP,sPort);
m_thread_group.add_thread(new boost::thread(&DataAggregator::Run ,(p_dataagg[i].get())));
}
else
{
m_thread_group.add_thread(new boost::thread(&DataAggregator::ReadDataFile,(p_dataagg[i].get()),sFile));
}
p_Logger->Write(Logger::NOTICE,"Finished loading MDI %d: %s %s",i,sIP.c_str(),sPort.c_str());
p_Logger->Write(Logger::NOTICE,"Started thread: DataAggregator %d",i);
usleep(100000);
}
}
m_FinishedInit = true;
cout << "Nirvana: all threads are started." << endl << flush;
cout << "Location of log file: " << p_SysCfg->Get_Main_Log_Path() << endl << flush;
m_thread_group.join_all();
//--------------------------------------------------
// Bye
//--------------------------------------------------
p_Logger->Write(Logger::NOTICE,"Main: TradingEngine has stopped.");
return;
}
<file_sep>/NirvanaInfrastructure/Facilities/TradingEngineMainThread.h
#ifndef TRADINGENGINEMAINTHREAD_H_
#define TRADINGENGINEMAINTHREAD_H_
#include "PCH.h"
#include "Constants.h"
#include "boost/property_tree/ini_parser.hpp"
#include "boost/property_tree/ptree.hpp"
#include <boost/cstdint.hpp>
#include <boost/thread.hpp>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <memory>
#include <vector>
#include <boost/ptr_container/ptr_deque.hpp>
#include <string>
#include "Logger.h"
#include "SystemConfig.h"
#include "DataAggregator.h"
#include "OrderExecutor.h"
#include "VolSurfCalculator.h"
#include "VolSurfaces.h"
#include "PortfolioGenerator.h"
#include "StrategyTest.h"
#include "StrategyB1HKF.h"
#include "StrategyB2HK.h"
#include "StrategyB2US1.h"
#include "StrategyB2US2.h"
#include "StrategyB2US3.h"
#include "StrategyNIR1.h"
#include "StrategyS11A.h"
#include "StrategyA1.h"
#include "StrategyA6.h"
#include "StrategyR1.h"
#include "StrategyR3.h"
#include "StrategyR7.h"
#include "StrategyR8.h"
#include "StrategyR9.h"
#include "ProbDistributionGenerator.h"
#include "TechIndUpdater.h"
#include "PriceForwarderToNextTier.h"
#include "Exchange.h"
#include "HKFE.h"
#include "HKSE.h"
#include "HKMA.h"
#include "Terminal.h"
#include "CorrelMatrices.h"
#include "MarkToMarket.h"
#include "ThreadHealthMonitor.h"
class TradingEngineMainThread {
public:
TradingEngineMainThread(const char *);
TradingEngineMainThread(const char *, const char *);
virtual ~TradingEngineMainThread();
void RunMainThread();
bool HasFinishedInit();
string m_ConfigPath;
string m_ItrdHighLowFromIB;
boost::shared_ptr<SystemConfig> p_SysCfg;
boost::shared_ptr<Logger> p_Logger;
boost::shared_ptr<Exchange> p_Exchg;
boost::shared_ptr<HKFE> p_HKFE;
boost::shared_ptr<HKSE> p_HKSE;
boost::shared_ptr<HKMA> p_HKMA;
boost::shared_ptr<CorrelMatrices> p_CorrelMatrices;
vector<boost::shared_ptr<DataAggregator> > p_dataagg;
boost::shared_ptr<OrderExecutor> p_oe;
private:
bool m_FinishedInit;
};
#endif /* TRADINGENGINEMAINTHREAD_H_ */
<file_sep>/loglibrary/include/ATU_Feed_Logger.h
/*
* ATU_Feed_Logger.h
*
* Created on: Jun 5, 2014
* Author: alex
*/
#ifndef ATU_FEED_LOGGER_H_
#define ATU_FEED_LOGGER_H_
#include "ATU_Timer.h"
#include "Constants.h"
#include "LogStream.h"
#include <queue>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
using namespace std;
using namespace ost;
namespace atu{
class ATU_Feed_Logger : public Thread{
private:
void run(void);
void final(void);
public:
ATU_Feed_Logger(string datapath,int timershareMemoryKey, string feedtype);
virtual ~ATU_Feed_Logger();
//1: old file 2: new file
int setFilename(string filename);
string m_Datapath;
string m_FileName;
int writeLog(int &size);
int addLog(string msg,int writeToConsole=0);
static bool addLog(ATU_Feed_Logger*, string msg, int writeToConsole=0);
void backupFileCopy(string fielanme,string directory);
void stop();
bool isReady();
queue<string> m_LogMsgQueue;
queue<int> m_LogMsgQueueWriteToConsole;
ofstream m_GeneralLogFile;
Conditional m_LogMsgQueueLock;
Mutex m_LogMsgQueueMutex;
ATU_Timer *m_Timer;
bool m_LogSecStat;
string m_TimestampToLogMsgDelimiter;
private:
bool m_isShutdown;
bool m_isShutdown2;
bool m_isReady;
public:
time_t volatile m_lastSec;
bool m_isMaster;
string m_StartLogTimeStamp;
};
}
#endif /* ATU_FEED_LOGGER_H_ */
<file_sep>/NirvanaCommon/ATU/ATU_Abstract_MDI.h
/*
* ATU_Abstract_MDI.h
*
* Created on: May 26, 2014
* Author: alex
*/
#ifndef ATU_ABSTRACT_MDI_H_
#define ATU_ABSTRACT_MDI_H_
#include "PCH.h"
#include "Constants.h"
//#include "ParsedMarketData.h"
//#include "ATU_TCP_MDI_string_handler.h"
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include "ATU_ErrorMsgStruct.h"
#include "ATU_Logger.h"
using namespace std;
typedef struct ATU_MDI_subscription_struct{
string m_timestamp;
string m_market;
string m_feedcode;
string m_begindate;
string m_enddate;
string m_subscription_attribute;
ATU_MDI_subscription_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_begindate(""),
m_enddate(""),
m_subscription_attribute(""){}
}ATU_MDI_subscription_struct;
typedef struct ATU_MDI_unsubscription_struct{
string m_timestamp;
string m_market;
string m_feedcode;
ATU_MDI_unsubscription_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""){}
}ATU_MDI_unsubscription_struct;
typedef struct ATU_MDI_acknowledgement_struct{
string m_timestamp;
string m_status;
string m_errormsg;
ATU_MDI_acknowledgement_struct():
m_timestamp(""),
m_status(""),
m_errormsg(""){}
}ATU_MDI_acknowledgement_struct;
typedef struct ATU_MDI_marketfeed_struct{
string m_timestamp;
string m_feedcode;
double m_traded_price;
double m_traded_volume;
double m_bid_price_1;
double m_bid_volume_1;
double m_bid_price_2;
double m_bid_volume_2;
double m_bid_price_3;
double m_bid_volume_3;
double m_bid_price_4;
double m_bid_volume_4;
double m_bid_price_5;
double m_bid_volume_5;
double m_ask_price_1;
double m_ask_volume_1;
double m_ask_price_2;
double m_ask_volume_2;
double m_ask_price_3;
double m_ask_volume_3;
double m_ask_price_4;
double m_ask_volume_4;
double m_ask_price_5;
double m_ask_volume_5;
ATU_MDI_marketfeed_struct():
m_timestamp(""),
m_feedcode(""),
m_traded_price(0),
m_traded_volume(0),
m_bid_price_1(0),
m_bid_volume_1(0),
m_bid_price_2(0),
m_bid_volume_2(0),
m_bid_price_3(0),
m_bid_volume_3(0),
m_bid_price_4(0),
m_bid_volume_4(0),
m_bid_price_5(0),
m_bid_volume_5(0),
m_ask_price_1(0),
m_ask_volume_1(0),
m_ask_price_2(0),
m_ask_volume_2(0),
m_ask_price_3(0),
m_ask_volume_3(0),
m_ask_price_4(0),
m_ask_volume_4(0),
m_ask_price_5(0),
m_ask_volume_5(0){}
} ATU_MDI_marketfeed_struct;
typedef struct ATU_MDI_ping_struct{
string m_timestamp;
ATU_MDI_ping_struct():
m_timestamp(""){}
} ATU_MDI_ping_struct;
typedef struct ATU_MDI_reset_struct{
string m_timestamp;
ATU_MDI_reset_struct():
m_timestamp(""){}
} ATU_MDI_reset_struct;
typedef struct ATU_MDI_ohlcfeed_struct{
string m_timestamp;
string m_market;
string m_feedcode;
double m_open;
double m_high;
double m_low;
double m_close;
double m_traded_volume;
ATU_MDI_ohlcfeed_struct():
m_timestamp(""),
m_market(""),
m_feedcode(""),
m_open(0),
m_high(0),
m_low(0),
m_close(0),
m_traded_volume(0){}
} ATU_MDI_ohlcfeed_struct;
//typedef struct {
// string m_logMessage;
// int m_logSeverity;
//} ATU_OTI_MDI_logfeed_struct;
typedef boost::function < void(string str) > ATU_String_CallBackFunc;
typedef boost::function < bool(ATU_MDI_subscription_struct &s) > ATU_MDI_subscription_CallBackFunc;
typedef boost::function < bool(ATU_MDI_unsubscription_struct &s) > ATU_MDI_unsubscription_CallBackFunc;
typedef boost::function < bool(ATU_MDI_marketfeed_struct &s) > ATU_MDI_marketfeed_CallBackFunc;
typedef boost::function < bool(ATU_MDI_ohlcfeed_struct &s) > ATU_MDI_ohlcfeed_CallBackFunc;
typedef boost::function < bool(ATU_MDI_ping_struct &s) > ATU_MDI_ping_CallBackFunc;
typedef boost::function < bool(ATU_MDI_reset_struct &s) > ATU_MDI_reset_CallBackFunc;
typedef boost::function < bool(ATU_MDI_acknowledgement_struct &s) > ATU_MDI_acknowledgement_CallBackFunc;
//typedef boost::function < void(ATU_OTI_MDI_logfeed_struct &s) > ATU_OTI_MDI_logfeed_CallBackFunc;
namespace atu {
class ATU_Abstract_MDI {
public:
ATU_Abstract_MDI();
virtual ~ATU_Abstract_MDI();
virtual bool on_process_subscription(ATU_MDI_subscription_struct &s);
virtual bool on_process_unsubscription(ATU_MDI_unsubscription_struct &s);
virtual bool on_process_acknowledgement(ATU_MDI_acknowledgement_struct &s);
virtual bool process_subscription(ATU_MDI_subscription_struct &s);
virtual bool process_unsubscription(ATU_MDI_unsubscription_struct &s);
virtual bool notify_marketfeed(ATU_MDI_marketfeed_struct &s);
virtual bool notify_ohlcfeed(ATU_MDI_ohlcfeed_struct &s);
virtual void register_notify_marketfeed_call_back_func(ATU_MDI_marketfeed_CallBackFunc *callback);
virtual void register_notify_ohlcfeed_call_back_func(ATU_MDI_ohlcfeed_CallBackFunc *callback);
virtual void register_notify_logfeed_call_back_func(ATU_logfeed_CallBackFunc *callback);
virtual bool notify_logfeed(ATU_logfeed_struct *s);
virtual void setConnectString(string address) {}
virtual void detach() {}
bool sessionDestroy;
protected:
ATU_MDI_marketfeed_CallBackFunc *m_marketfeed_call_back_func;
ATU_MDI_ohlcfeed_CallBackFunc *m_ohlcfeed_call_back_func;
ATU_logfeed_CallBackFunc *m_logfeed_call_back_func;
};
}
#endif /* ATU_ABSTRACT_MDI_H_ */
<file_sep>/oti_mdi_common/src/contract_manager/JsonContractReader.cpp
/*
* JsonContractReader.cpp
*
* Created on: Feb 3, 2015
* Author: jasonlin
*/
#include <iostream>
#include "JsonContractReader.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
using std::cout;
using std::endl;
using boost::property_tree::ptree;
using boost::property_tree::json_parser::read_json;
namespace atu {
JsonContractReader::JsonContractReader(string p_filepath) : m_filepath(p_filepath) {
cout << "JsonContractReader created..." << endl;
}
bool JsonContractReader::read(unordered_map<string, AtuContract*>* p_productCode2ContractPtr, unordered_map<string, string>* p_conId2productCode) {
if ( m_filepath.compare("") == 0 ) {
return false;
}
ptree pt;
read_json(m_filepath, pt);
for (ptree::const_iterator iter = pt.begin(); iter != pt.end(); iter++) {
string productCode = iter->first;
cout << "{" << productCode << "}" << endl;
AtuContract* conPtr = new AtuContract();
conPtr->m_productCode = productCode;
for (ptree::const_iterator sub_iter = iter->second.begin(); sub_iter != iter->second.end(); sub_iter++) {
string key = sub_iter->first;
string val = sub_iter->second.get_value<string>();
cout << "\t\t{" << key << " = " << val << "}" << endl;
conPtr->set( key, val );
if ( key.compare("conId") == 0 ) {
(*p_conId2productCode)[val] = iter->first;
}
}
(*p_productCode2ContractPtr)[productCode] = conPtr;
}
return true;
}
}
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyB2US2.h
#ifndef PORTFOLIOGENERATION_STRATEGYB2US2_H_
#define PORTFOLIOGENERATION_STRATEGYB2US2_H_
#include "PCH.h"
#include "Constants.h"
#include "StrategyB2.h"
class StrategyB2_US2: public StrategyB2 {
public:
StrategyB2_US2();
virtual ~StrategyB2_US2();
};
#endif /* PORTFOLIOGENERATION_STRATEGYB2US2_H_ */
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyA1.cpp
#include <StrategyA1.h>
// StrategyA1::StrategyA1()
// {
// m_MarketData = MarketData::Instance();
// m_SystemState = SystemState::Instance();
// m_SysCfg = SystemConfig::Instance();
// m_Logger = Logger::Instance();
// m_TechInd = TechIndicators::Instance();
// m_PortAndOrders = PortfoliosAndOrders::Instance();
// m_MDIAck = MDI_Acknowledgement::Instance();
// }
//
// StrategyA1::~StrategyA1() {
// }
//
// void StrategyA1::Run()
// {
// //--------------------------------------------------
// // Init path
// //--------------------------------------------------
// ofstream fsSignalLog(m_SysCfg->GetSignalLogPath(STY_A1).c_str());
//
// //--------------------------------------------------
// // Init other parameters
// //--------------------------------------------------
// m_ParamVector = m_SysCfg->GetParamVector(STY_A1);
//
// //--------------------------------------------------
// for (;;)
// {
// m_MarketData->WaitForData();
//
// if (m_SystemState->ChkIfThreadShouldStop()) break;
//
// YYYYMMDDHHMMSS ymdhms_MDITime = m_MarketData->GetSystemTimeHKT();
//
// if (!m_SysCfg->IsStrategyOn(STY_A1))
// {
// ReportAckIfNeeded();
// m_Logger->Write(Logger::DEBUG,"StrategyA1 off");
// continue;
// }
//
//
// ReportAckIfNeeded();
// }
//
// m_Logger->Write(Logger::NOTICE,"StrategyA1 has ended.");
// sleep(2);
//
// return;
// }
//
// void StrategyA1::ReportAckIfNeeded()
// {
// if (m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::TCPWITHACK || m_SysCfg->Get_TCPOrEmbeddedMode() == SystemConfig::EMBEDDED)
// m_MDIAck->ReportAck(STY_A1);
// return;
// }
<file_sep>/NirvanaCommon/Util/Constants.h
#ifndef CONSTANTS_H_
#define CONSTANTS_H_
#include "PCH.h"
#include "Constants.h"
#define MAGIC_NUM_INT 7236467
#define MAGIC_NUM 7236467
#define UNDERLYING_VHSI "VHSI"
#define UNDERLYING_HSI "HSI"
#define UNDERLYING_HHI "HHI"
#define UNDERLYING_MHI "MHI"
#define UNDERLYING_MCH "MCH"
#define HSI_CONT_FUT_1 "HSIc1"
#define HHI_CONT_FUT_1 "HHIc1"
#define MHI_CONT_FUT_1 "MHIc1"
#define MCH_CONT_FUT_1 "MCHc1"
#define UNDERLYING_ES "ES"
#define ES_CONT_FUT_1 "ESc1"
#define UNDERLYING_NQ "NQ"
#define NQ_CONT_FUT_1 "NQc1"
#define UNDERLYING_YM "YM"
#define YM_CONT_FUT_1 "YMc1"
#define UNDERLYING_TF "TF"
#define TF_CONT_FUT_1 "TFc1"
#define ATU_INVALID_PRICE 999999
#define UNDEFINED_CORRELATION 999
#define NIR_EPSILON 0.000001
#define MAX_OTIMDI 10
#define HEALTHKEYLEN 10
#define ID_TECHINDUPDATER "TIU"
#define ID_PROBDISTGENR "PDG"
#define ID_DATAAGG "DA"
#define ID_VOLSURFCALC "VSC"
#define ID_ORDEREXEC "OE"
#define ID_ORDEREXECCHKORD "OEChkOrd"
#define ID_ORDEREXEPERSISTPOS "OEPP"
#define ID_MTM "MTM"
#define ID_PRICEFWDR "PF"
using namespace std;
using namespace boost;
enum StrategyID {
STY_NIR=1,
STY_B1_HKF,
STY_B2_US1,
STY_B2_US2,
STY_B2_HK,
STY_B2_US3,
STY_NIR1,
STY_ETFR,
STY_S11A,
STY_A1,
STY_A6,
STY_R1,
STY_R3,
STY_R7,
STY_R8,
STY_R9,
STY_TEST,
STY_LAST=99};
enum EExchange {
EX_HKFE=1,
EX_HKSE,
EX_NYSE,
EX_CME,
EX_UNSET,
};
string GetStrategyName(const StrategyID);
void GetStrategyNameCStr(const StrategyID, char [HEALTHKEYLEN+1]);
#endif
<file_sep>/oti_mdi_common/include/ATU_ErrorMsgStruct.h
#ifndef _ATU_ERRORMSGSTRUCT_H_
#define _ATU_ERRORMSGSTRUCT_H_
//using namespace atu;
#include <string>
#include <boost/function.hpp>
using namespace std;
namespace atu {
class ATU_ErrorMsgStruct {
public:
string m_timestamp;
string m_errormsg;
string m_source;
ATU_ErrorMsgStruct():
m_timestamp(""),
m_errormsg(""),
m_source(""){}
};
typedef boost::function<bool(ATU_ErrorMsgStruct*)> NotifyErrorMsgFunction;
typedef boost::function<bool(ATU_ErrorMsgStruct*)> ATU_errorfeed_CallBackFunc;
}
#endif //_ATU_ERRORMSGSTRUCT_H_
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyR8.h
#ifndef PORTFOLIOGENERATION_STRATEGYR8_H_
#define PORTFOLIOGENERATION_STRATEGYR8_H_
#include "PCH.h"
#include "Constants.h"
#include "StrategyBase.h"
#include "SystemState.h"
#include "SystemConfig.h"
#include "MDI_Acknowledgement.h"
#include "MarketData.h"
#include "TechIndicators.h"
#include "PortfoliosAndOrders.h"
#include "LinRegr.h"
#include "HighLow.hpp"
class StrategyR8 : public StrategyBase {
public:
StrategyR8();
virtual ~StrategyR8();
protected:
virtual void ReadParam();
virtual void ParamSanityCheck();
virtual void StartOfDayInit();
virtual void EndOfDayCleanUp();
virtual void UnsetConvenienceVarb();
virtual void SetConvenienceVarb(const int iTradSym);
virtual bool SkipSubseqProcessingForSymbol(const int iTradSym,string & sReason);
virtual void InitialWarmUp(const int iTradSym);
virtual void UpdateInternalData(const int iTradSym);
virtual void UpdateInternalDataTrng(const int iTradSym);
virtual void LoadOptimalParamsFromTrainingResults();
virtual void EndOfDayTrainingForEachTimeBucket(const int iTradSym,const map<HHMMSS,double> & map_HistDataInTimeBucket);
virtual void DetermineRegime(const int iTradSym);
virtual void PreTradePreparation(const int iTradSym);
virtual void CalcPosSize(const int iTradSym);
virtual void AdjustSamplingInterval(const int iTradSym);
virtual void EndOfDayTrainingRoutine(const int iTradSym,const map<HHMMSS,double> & map_HistDataInTimeBucket);
//--------------------------------------------------
// Strategy param
//--------------------------------------------------
vector<double> m_DownTrendWindowInSec;
vector<double> m_DownTrendMagnitude;
vector<double> m_DownTrendSlopeThreshold;
vector<double> m_ReboundWindowInSec;
vector<double> m_TakeProfitMul;
vector<double> m_StopLossMul;
//--------------------------------------------------
// Strategy objects
//--------------------------------------------------
vector<double> m_EntryPrice;
vector<double> m_StopLossPrice;
vector<double> m_TakeProfitPrice;
vector<LinRegr> m_vLinRegr;
vector<HighLow<double> > m_vHighLowPrice;
vector<HighLow<double> > m_vHighLowSlope;
};
#endif /* PORTFOLIOGENERATION_STRATEGYR8_H_ */
<file_sep>/NirvanaInfrastructure/PortfolioGeneration/StrategyB2US1.h
#ifndef PORTFOLIOGENERATION_STRATEGYB2US1_H_
#define PORTFOLIOGENERATION_STRATEGYB2US1_H_
#include "PCH.h"
#include "Constants.h"
#include "StrategyB2.h"
class StrategyB2_US1: public StrategyB2 {
public:
StrategyB2_US1();
virtual ~StrategyB2_US1();
};
#endif
| 2266d62b46093f90615972b1c154de897ae060b0 | [
"C",
"C++",
"Shell"
] | 38 | C | hfyan0/nirvana | 5d9ab46eb33768c4e7d89037c41b005b840c05fe | c783fd77b63f2e327234ec6140e2d7385de319c1 |
refs/heads/master | <file_sep>import React from 'react'
import Square from './Square.js'
const SquareComponents = (props) => {
const squareNodes = props.squares.map((square, index) => {
return <Square className="shape" square={square} handlePress={props.handlePress} key={index}/>
});
return (
<div className={props.className}>
{squareNodes}
</div>
) //return
}// const
export default SquareComponents;
<file_sep>import React, {Component} from 'react';
import ScoreComponents from '../components/ScoreComponents.js'
import SquareComponents from '../components/SquareComponents.js'
import ClearBoard from '../components/ClearBoard.js'
import Header from '../components/Header.js'
class GameContainer extends Component {
constructor(props){
super(props);
this.state = {
currentPlayer: 1,
player1Score: 0,
player2Score: 0,
winningPlayer: null,
winningMessage: null,
squares: [
{id: 1, playedBy: null, imgSrc: "blue_square.png"},
{id: 2, playedBy: null, imgSrc: "blue_square.png"},
{id: 3, playedBy: null, imgSrc: "blue_square.png"},
{id: 4, playedBy: null, imgSrc: "blue_square.png"},
{id: 5, playedBy: null, imgSrc: "blue_square.png"},
{id: 6, playedBy: null, imgSrc: "blue_square.png"},
{id: 7, playedBy: null, imgSrc: "blue_square.png"},
{id: 8, playedBy: null, imgSrc: "blue_square.png"},
{id: 9, playedBy: null, imgSrc: "blue_square.png"}
]
}
this.changePlayer = this.changePlayer.bind(this)
this.handleSquarePress = this.handleSquarePress.bind(this)
this.clearBoard = this.clearBoard.bind(this)
this.setWinningMessage = this.setWinningMessage.bind(this)
}
changePlayer() {
if(this.state.currentPlayer === 1){
this.setState({currentPlayer: 2})
}
else {
this.setState({currentPlayer: 1})
}
}
handleSquarePress(event) {
const tempState = this.state;
if (this.hasSquareBeenPlayed(tempState.squares[event.target.value -1])) return
// console.log("test");
if(this.state.currentPlayer === 1){
tempState.squares[event.target.value -1].playedBy = 1
tempState.squares[event.target.value -1].imgSrc = "Doge.png"
}
else {
tempState.squares[event.target.value -1].playedBy = 2
tempState.squares[event.target.value -1].imgSrc = "cat_face.jpg"
}
this.setState(tempState);
this.gameWon();
this.changePlayer();
}
updatePlayerScore(){
const tempState = this.state
if(this.state.winningPlayer === 1){
tempState.player1Score ++
} else if
(this.state.winningPlayer === 2){
tempState.player2Score ++
}
this.setState(tempState);
}
setWinningMessage() {
if(this.state.winningPlayer === null) return
const tempState = this.state
if(this.state.winningPlayer === 1) {
tempState.winningMessage = "Woohoo, Player 1 wins!"
} else {
tempState.winningMessage = "Woohoo, Player 2 wins!"
}
this.setState(tempState)
}
hasSquareBeenPlayed(square) {
if(square.imgSrc !== "blue_square.png") return true
}
clearBoard(){
const tempState = this.state
tempState.currentPlayer = 1
tempState.winningPlayer = null
tempState.winningMessage = null
tempState.squares = [
{id: 1, playedBy: null, imgSrc: "blue_square.png"},
{id: 2, playedBy: null, imgSrc: "blue_square.png"},
{id: 3, playedBy: null, imgSrc: "blue_square.png"},
{id: 4, playedBy: null, imgSrc: "blue_square.png"},
{id: 5, playedBy: null, imgSrc: "blue_square.png"},
{id: 6, playedBy: null, imgSrc: "blue_square.png"},
{id: 7, playedBy: null, imgSrc: "blue_square.png"},
{id: 8, playedBy: null, imgSrc: "blue_square.png"},
{id: 9, playedBy: null, imgSrc: "blue_square.png"}
]
this.setState(tempState)
}
gameWon(){
const tempState = this.state;
const winningSolutions = [
[1,2,3],
[4,5,6],
[7,8,9],
[1,4,7],
[2,5,8],
[3,6,9],
[3,5,7],
[1,5,9]
]
winningSolutions.forEach((solution) => {
let counter = 0;
solution.forEach((square) => {
if(this.state.squares[square - 1].playedBy === this.state.currentPlayer){
counter ++
}
if (counter === 3) {
tempState.winningPlayer = this.state.currentPlayer
this.updatePlayerScore()
this.setWinningMessage();
setTimeout(this.clearBoard, 1000)
}
})
})
}
render(){
return (
<div className="game-container">
<img src="Doge.png"/>
<div className="mid-section">
<Header message= {this.state.winningMessage}/>
<ScoreComponents
player1 = {this.state.player1Score}
player2 = {this.state.player2Score}/>
<SquareComponents className="square-box"
squares = {this.state.squares}
handlePress= {this.handleSquarePress}/>
<ClearBoard handleClick={this.clearBoard}/>
</div>
<img src="cat_face.jpg"/>
</div>
)
}
} // class
export default GameContainer;
<file_sep>import React from 'react';
const Square = (props) => {
return (
<input className={props.className} type="image" src={props.square.imgSrc} onClick={props.handlePress} value={props.square.id} />
)
}
export default Square;
| 18a7ce4f9696f8590efc987d4317d7f832d89156 | [
"JavaScript"
] | 3 | JavaScript | VerityA/React_JS_Noughts_and_Crosses | e7001e52d81f40e3e175e9c19b20ecec6272eeff | 15b90df2a00a629a67fcd42087e84a3c30f922fe |
refs/heads/master | <repo_name>uto-usui/nan-neco<file_sep>/wp-content/themes/nanneco/_home.php
<?php get_header(); ?>
<main class="l-main" id="main">
<article class="c-article">
<section class="p-hero">
<ul class="p-hero_inner f-flex f-top">
<li class="p-hero_item">
<div class="p-hero_list-wrap">
<ul class="p-hero_list f-flex f-top">
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/2.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/3.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/4.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
</ul>
</div>
<svg class="p-hero_mask" viewBox="0 0 800 450">
<path class="a" id="js-mask01" d="M0,0V450H800V0ZM685.09,413.49H114.91a50,50,0,0,1-50-50v-277a50,50,0,0,1,50-50H685.09a50,50,0,0,1,50,50v277A50,50,0,0,1,685.09,413.49Z"/>
</svg>
</li>
<li class="p-hero_item">
<div class="p-hero_list-wrap">
<ul class="p-hero_list f-flex f-top">
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/2.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/3.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/4.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
</ul>
</div>
<svg class="p-hero_mask" viewBox="0 0 800 450">
<path class="a" id="js-mask02" d="M0,0V450H800V0ZM685.09,413.49H114.91a50,50,0,0,1-50-50v-277a50,50,0,0,1,50-50H685.09a50,50,0,0,1,50,50v277A50,50,0,0,1,685.09,413.49Z"/>
</svg>
</li>
<li class="p-hero_item">
<div class="p-hero_list-wrap">
<ul class="p-hero_list f-flex f-top">
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/2.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/3.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/4.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
</ul>
</div>
<svg class="p-hero_mask" viewBox="0 0 800 450">
<path class="a" id="js-mask03" d="M0,0V450H800V0ZM685.09,413.49H114.91a50,50,0,0,1-50-50v-277a50,50,0,0,1,50-50H685.09a50,50,0,0,1,50,50v277A50,50,0,0,1,685.09,413.49Z"/>
</svg>
</li>
</ul>
</section>
<section class="p-message">
<div class="p-message_inner">
<p class="p-message_text js-message" data-delay="2">
すきなこと<br> すきなじかん
<br> すきなじぶんを
<br> みつけるきっかけ
</p>
<!--
<p class="p-message_text js-message">
ワクワクドキドキで<br>
こころにスイッチを仕掛ける<br>
みんなでつくるお祭り
</p>
-->
</div>
</section>
</article>
<article class="c-article">
<h2 class="c-h1 u-mb--md">
<div class="c-section_inner">Pick up Contents<i>ナン猫の注目コンテンツ*︎</i></div>
</h2>
<div class="c-section_inner">
<div class="p-home_card-section">
<!--
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/event/soma.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">4月28日 土曜日 LOVEの「今日ここライブ」が相馬に行くということ。ナントカと猫企画参加決定! </h3>
<p class="c-card_text">
毎年SUNSUNフェスに出演してくれていた、ラブちゃんが開催しているイベント、今日ここにいることIn相馬にミニミニSUNSUNフェスで出張‼︎<br>
</p>
<p class="c-card_text">
詳細は<a href="http://kyokokolive.com/program/workshop/index.html" target="_blank">公式サイト</a>よりアクセス下さい!
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/event/koukentetsu.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">7月29日 日曜日 コウケンテツ講演会&初✩サイン会 開催決定!</h3>
<p class="c-card_text">
普段はされないサイン会(書籍購入者のみ)を、スペシャルに開催してくださいます!
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/29601723/" target="_blank">ブログ</a>をお読みください!<br>
<a href="https://passmarket.yahoo.co.jp/event/show/detail/013iqazfe9qx.html" target="_blank">《オンラインチケット購入》</a><br>
<a href="https://otonohapro.exblog.jp/29913504/" target="_blank">《メール・電話からのチケット受付》</a>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/event/nobumi.png)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">7月28日 土曜日 絵本作家のぶみ 講演会 @京都 開催決定‼︎ </h3>
<p class="c-card_text">
親子で楽しめる読み聞かせ講演会!講演会終了後には、絵本購入者に似顔絵付きのサイン会も! <br>
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/29179226/" target="_blank">ブログ</a>をお読みください!<br>
<a href="https://passmarket.yahoo.co.jp/event/show/detail/0162dwzg55c1.html" target="_blank">《オンラインチケット購入》</a><br>
<a href="https://otonohapro.exblog.jp/29911629/" target="_blank">《メール・電話からのチケット受付》</a>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/event/yamakami.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">5月28日 月曜日より連続講座スタート!【ナン猫企画、野口整体 山上亮のお手当部】</h3>
<p class="c-card_text">
『春、夏、秋、冬の会』@吹田モモの家!!
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/29895312/" target="_blank">ブログ</a>をお読みください!<br>
</p>
</div>
</div>
-->
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/event/noguchiseitai_201901.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">野口整体集中講座〜基本編〜 全2回 開催決定!</h3>
<p class="c-card_text">
セラピストさんなど、ご自身の施術に活かしたい、また野口整体を知り、深めたい方へのプロ講座です。
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/30044465/" target="_blank">ブログ</a>をお読みください!<br>
<a href="https://www.kokuchpro.com/event/5bea935c0cee03864bbd49e6a52e9837/" target="_blank">《オンラインチケット購入》</a>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/event/tozantoyoga_201812.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">もみじの森の登山とヨガに出かけませんか。</h3>
<p class="c-card_text">
◎秋の紅葉を楽しみたい方<br>
◎野外のヨガを楽しみたい方<br>
◎運動不足を解消したい方
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/30140689/" target="_blank">ブログ</a>をお読みください!
</p>
</div>
</div>
</div>
</div>
</article>
<!-- <div class="c-section_inner">-->
<!-- <p class="c-h2 u-mb--lg"><span class="c-h2_inner">ナン猫の企業研修</span></p>-->
<!---->
<!-- <article class="c-media">-->
<!-- <p class="c-article_text">企業で働く人材のヘルスサポートいたします。<br>詳細は準備中です。</p>-->
<!-- </article>-->
<!---->
<!-- </div>-->
<?php
$args = array(
'post_type' => array('post'),
'posts_per_page' => '8'
);
$my_query = new WP_Query( $args );
if($my_query->have_posts()) {
?>
<div class="c-section_inner">
<p class="c-h2 u-mb--lg"><span class="c-h2_inner">nan-neco news</span></p>
<ul class="c-tab_list">
<?php
while ($my_query->have_posts()) {
$my_query->the_post(); ?>
<li class="c-tab_item">
<time class="c-tab_time"
datetime="<?php the_time('Y-m-d'); ?>"><?php echo get_post_time('Y.m.d (D)'); ?></time>
<h3 class="c-tab_title c-h3">
<div class="c-h3_inner"><?php the_title(); ?></div>
</h3>
<button class="c-btn c-btn--toggle js-dropdown-trigger"></button>
<div class="c-tab_textarea js-dropdown-item">
<?php
$img = get_the_post_thumbnail_url();
if ($img) {
?>
<div class="f-container f-middle">
<div class="f-item-md-4 f-item-sm-3 f-item-xs-12">
<figure class="c-tab_figure">
<img src="<?php echo esc_attr($img); ?>" alt="">
</figure>
</div>
<div class="f-item-md-8 f-item-sm-9 f-item-xs-12">
<div class="c-article_text">
<?php the_content(); ?>
</div>
</div>
<?php } else { ?>
<div class="c-article_text">
<?php the_content(); ?>
</div>
<?php } ?>
</div>
</li>
<?php
}
?>
</ul>
<p class="u-mt--lg">
<a class="c-btn c-btn--primary f-middle f-in-flex" href="https://www.facebook.com/otonohapro/" target="_blank">ナン猫 facebook ページ</a>
</p>
</div>
<?php } ?>
</article>
</main>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/single-event.php
<?php get_header(); ?>
<?php
while (have_posts()): the_post();
?>
<main class="l-main" id="main">
<article class="c-article">
<?php
$date = get_field('event-date-time');
//
$lead = get_field('event-lead');
//
$latitude = get_field('event-access-latitude');
$longitude = get_field('event-access-longitude');
$url = get_field('event-access-url');
$name = get_field('event-access-name');
?>
<h1 class="c-h1">
<div class="c-section_inner"><?php the_title(); ?><i><?php echo $date; ?></i></div>
</h1>
<?php if ($lead) { ?>
<h2 class="c-h2"><span class="c-h2_inner">message</span></h2>
<div class="c-hero-sub">
<div class="c-hero-sub_inner f-middle-center">
<figure class="c-hero-sub_figure" data-parallax=".9"
style="background-image: url(<?php the_post_thumbnail_url(); ?>);"></figure>
<div class="c-hero-sub_caption">
<?php echo $lead; ?>
</div>
</div>
</div>
<?php } ?>
<?php
if (have_rows('event-venue-list')) {
?>
<section class="c-section_inner">
<h2 class="c-h2"><span class="c-h2_inner">time table</span></h2>
<p class="c-article_lead">会場ごとのタイムテーブルを閲覧できます。「+」で詳細を確認します。</p>
<div class="c-tab js-tab">
<ul class="c-tab_nav f-flex f-wrap f-around">
<?php
$i = 1;
while (have_rows('event-venue-list')) {
the_row();
$id_name = '#panel0' . $i;
?>
<li class="c-tab_nav-item">
<a href="<?php echo $id_name ?>"
class="c-tab_nav-target js-tab-trigger<?php if ($i == 1) { ?> is-active<?php } ?>"><?php the_sub_field('event-venue'); ?></a>
</li>
<?php
$i = $i + 1;
}
?>
</ul>
<?php
if (have_rows('event-timetable')) {
$i = 1;
while (have_rows('event-timetable')) {
the_row();
$id_name = 'panel0' . $i;
?>
<ul class="c-tab_panel">
<li class="c-tab_panel-inner js-tab-item <?php if ($i == 1) { ?> is-open<?php } ?>"
id="<?php echo $id_name ?>">
<ul class="c-tab_list">
<?php
if (have_rows('event-timetable-list')) {
while (have_rows('event-timetable-list')) {
the_row();
?>
<li class="c-tab_item">
<time class="c-tab_time"><?php the_sub_field('event-time'); ?></time>
<h3 class="c-tab_title c-h3">
<div class="c-h3_inner"><?php the_sub_field('event-title'); ?></div>
</h3>
<button class="c-btn c-btn--toggle js-dropdown-trigger"></button>
<div class="c-tab_textarea js-dropdown-item">
<?php
$img = get_sub_field('event-artist-img');
$imgurl = wp_get_attachment_image_src($img, 'full');
if ($imgurl) {
?>
<div class="f-container f-middle">
<div class="f-item-md-4 f-item-sm-3 f-item-xs-12">
<figure class="c-tab_figure">
<img src="<?php echo esc_attr($imgurl[0]); ?>" alt="">
</figure>
</div>
<div class="f-item-md-8 f-item-sm-9 f-item-xs-12">
<p class="c-article_text">
<?php the_sub_field('event-detail'); ?>
</p>
</div>
<?php } else { ?>
<p class="c-article_text">
<?php the_sub_field('event-detail'); ?>
</p>
<?php if (get_sub_field('event-ticket-link')) { ?>
<p class="c-article_text">
<a class="c-article_link js-scroll" href="#ticket">チケットの購入はこちら</a>
</p>
<?php
}
}
?>
</div>
</li>
<?php
}
}
?>
</ul>
</li>
</ul>
<?php
$i = $i + 1;
}
}
?>
</div>
</section>
<?php
}
?>
<?php
if (have_rows('event-shop-group')) {
?>
<section class="c-section_inner">
<h2 class="c-h2"><span class="c-h2_inner">shop</span></h2>
<div class="c-tab js-tab">
<ul class="c-tab_nav f-flex f-wrap f-around">
<?php
$i = 1;
while (have_rows('event-shop-group')) {
the_row();
$id_name = '#panel1' . $i;
?>
<li class="c-tab_nav-item">
<a href="<?php echo $id_name; ?>"
class="c-tab_nav-target js-tab-trigger<?php if ($i == 1) { ?> is-active<?php } ?>"><?php the_sub_field('event-shop-label'); ?></a>
</li>
<?php
$i = $i + 1;
}
?>
</ul>
<ul class="c-tab_panel">
<?php
$j = 1;
while (have_rows('event-shop-group')) {
the_row();
$id_name = 'panel1' . $j;
?>
<li class="c-tab_panel-inner js-tab-item<?php if ($j == 1) { ?> is-open<?php } ?>"
id="<?php echo $id_name; ?>">
<ul class="c-memo-list f-container u-text-left">
<?php
if (have_rows('event-shop-list')) {
while (have_rows('event-shop-list')) {
the_row();
?>
<li class="c-memo-list_item f-item-sm-12 f-item-md-6">
<div class="c-memo-list_item-inner">
<h3 class="c-memo-list_title"><?php the_sub_field('event-shop-title'); ?></h3>
<b class="c-memo-list_lead"><?php the_sub_field('event-shop-detail'); ?></b>
</div>
</li>
<?php
}
}
?>
</ul>
</li>
<?php
$j = $j + 1;
}
?>
</ul>
</div>
</section>
<?php
}
?>
<?php
if (have_rows('event-ticket-list')) {
?>
<section class="c-section_inner" id="ticket">
<h2 class="c-h2"><span class="c-h2_inner">ticket</span></h2>
<p class="c-article_lead">チケット購入ページへジャンプします。</p>
<ul class="f-container">
<?php
$i = 1;
while (have_rows('event-ticket-list')) {
the_row();
?>
<li class="f-item-sm-12 f-item-md-6 u-mb--md">
<div class="">
<a class="c-btn c-btn--primary f-middle f-in-flex"
href="<?php the_sub_field('event-ticket-link'); ?>"
target="_blank"><?php the_sub_field('event-ticket-title'); ?>
<i class="fa fa-ticket" aria-hidden="true"></i></a>
<p class="c-article_text u-mt--sm"><?php the_sub_field('event-ticket-fee'); ?></p>
</div>
</li>
<?php
}
?>
</ul>
</section>
<?php
}
?>
<?php
if (have_rows('event-access-list')) {
?>
<section class="c-section_inner">
<h2 class="c-h2"><span class="c-h2_inner">access</span></h2>
<div class="c-article_lead u-text-left">
<?php
$i = 1;
while (have_rows('event-access-list')) {
the_row();
?>
<h3 class="c-h4">
<div class="c-h4_inner"><?php the_sub_field('event-access-traffic'); ?></div>
</h3>
<?php the_sub_field('event-access-way'); ?>
<?php
}
?>
</div>
<div class="c-article_map" id="js-map"></div>
<script>
var googleMapValue = {
latitude: <?php the_field('event-access-latitude') ?>,
longitude: <?php the_field('event-access-longitude') ?>,
url: '<?php the_field('event-access-url') ?>',
name: '<?php the_field('event-access-name') ?>'
}
</script>
</section>
<?php
}
?>
<?php
if (have_rows('event-sponsors-list')) {
?>
<section class="c-section_inner">
<h2 class="c-h2"><span class="c-h2_inner">Sponsors</span></h2>
<ul class="c-article_list">
<?php
while (have_rows('event-sponsors-list')) {
the_row();
?>
<li class="c-article_item">
<h3 class="c-h3">
<div class="c-h3_inner">
<?php the_sub_field('event-sponsors-title'); ?>
</div>
</h3>
<a class="c-btn c-btn--primary f-middle-center"
href="<?php the_sub_field('event-sponsors-link'); ?>" target="_blank"><i
class="fa fa-2x fa-home u-ml--sm"></i></a>
<br>
<?php the_sub_field('event-sponsors-text'); ?>
</li>
<?php
}
?>
</ul>
</section>
<?php
}
?>
<section class="c-section_inner">
<?php
$postType = get_post_type_object(get_post_type())->label;
$prev_post = get_previous_post();
$next_post = get_next_post();
?>
<style>
<?php if (!$prev_post) { ?>
.c-pager_item--prev {
visibility: hidden;
}
<?php } ?>
<?php if (!$next_post) { ?>
.c-pager_item--next {
visibility: hidden;
}
<?php } ?>
</style>
<div class="c-pager">
<ul class="c-pager_list f-flex">
<li class="c-pager_item c-pager_item--prev">
<a href="<?php echo get_permalink($prev_post->ID); ?>"
class="c-btn c-btn--primary c-pager_target f-middle-center">prev</a>
</li>
<li class="c-pager_item">
<a href="<?php echo get_post_type_archive_link($postType); ?>"
class="c-btn c-btn--primary c-pager_target f-middle-center"><i class="fa fa-th"></i></a>
</li>
<li class="c-pager_item c-pager_item--next">
<a href="<?php echo get_permalink($prev_post->ID); ?>"
class="c-btn c-btn--primary c-pager_target f-middle-center">next</a>
</li>
</ul>
</div>
</section>
</article>
</main>
<?php endwhile; ?>
<?php get_footer(); ?>
<file_sep>/README.md
# naneco.net
## setup
### files
* ./wp-config.php
* ./wp-content/.env
* ./wp-content/db-data/***.sql
### command
docker
```bash
cd ./wp-content
docker-compose up
```
packages
```bash
cd ./wp-content/themes/nanneco/gulp
yarn
```
<file_sep>/wp-content/themes/nanneco/page-music.php
<?php get_header(); ?>
<article class="hero_wrap">
<a class="hero hero--sub f-flex f-middle f-center js-page-scroll" href="#content" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/home/11.jpg)">
<div class="hero_inner" id="js-scroll">
<h1 class="hero_text">music</h1>
</div>
</a>
</article>
<!-- songs -->
<article class="article" id="content">
<div class="article_inner js-fadein-wrap" id="music">
<h2 class="h1 js-fadein-item"><span>songs</span></h2>
<ul class="home_songs">
<li class="home_songs-item js-song-item">
<div class="home_audio-bar-wrap js-audio-bar-wrap">
<div class="home_audio-bar js-audio-bar"></div>
</div>
<h3 class="h2 f-flex f-between f-middle">かぞえうた
<button class="btn btn--song js-song-trigger">play</button>
<audio class="js-song" src="<?php echo get_stylesheet_directory_uri();?>/assets/music/kazoeuta.mp3"></audio>
</h3>
</li>
<li class="home_songs-item js-song-item">
<div class="home_audio-bar-wrap js-audio-bar-wrap">
<div class="home_audio-bar js-audio-bar"></div>
</div>
<h3 class="h2 f-flex f-between f-middle">すききらい
<button class="btn btn--song js-song-trigger">play</button>
<audio class="js-song" src="<?php echo get_stylesheet_directory_uri();?>/assets/music/sukikirai.mp3"></audio>
</h3>
</li>
<li class="home_songs-item js-song-item">
<div class="home_audio-bar-wrap js-audio-bar-wrap">
<div class="home_audio-bar js-audio-bar"></div>
</div>
<h3 class="h2 f-flex f-between f-middle">スプーンで掬った月
<button class="btn btn--song js-song-trigger">play</button>
<audio class="js-song" src="<?php echo get_stylesheet_directory_uri();?>/assets/music/tuki.mp3"></audio>
</h3>
</li>
</ul>
</div>
</article>
<!-- movie -->
<article class="article">
<div class="article_inner js-fadein-wrap">
<h2 class="h1 js-fadein-item"><span>movie</span></h2>
<div class="home_movie" id="js-movie-section">
<section class="home_movie-inner js-movie-wrap">
<h3 class="h2 u-text-left">music video : 「かぞえうた」</h3>
<div class="home_movie-item">
<video class="js-movie" muted loop poster="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/movie/kazoeuta.jpg">
<source src="<?php echo get_stylesheet_directory_uri();?>/assets/movie/kazoeuta.mp4">
<p>動画を再生するには、videoタグをサポートしたブラウザーが必要です。</p>
</video>
</div>
<p class="home_movie-link-wrap f-flex f-between f-middle">
<button class="btn btn--song js-movie-mute">sound</button>
<a class="home_movie-link btn--arrow_wrap" href="https://www.youtube.com/watch?v=Mgl-EP-9RLg" target="_blank"> youtube page <span class="btn btn--arrow btn--arrow-next"></span></a>
</p>
</section>
<section class="home_movie-inner js-movie-wrap">
<h3 class="h2 u-text-left">oneman live : 「蒼眼鏡、バースデー」</h3>
<div class="home_movie-item">
<video class="js-movie" muted loop poster="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/movie/oneman.jpg">
<source src="<?php echo get_stylesheet_directory_uri();?>/assets/movie/orikou.mp4">
<p>動画を再生するには、videoタグをサポートしたブラウザーが必要です。</p>
</video>
</div>
<p class="home_movie-link-wrap f-flex f-between f-middle">
<button class="btn btn--song js-movie-mute">sound</button>
<a class="home_movie-link btn--arrow_wrap" href="https://www.youtube.com/watch?v=vOQmhmh-w5U&list=PLYO908eHx1ffjBbJEoXwrpMiYefpR4nDe" target="_blank"> youtube page <span class="btn btn--arrow btn--arrow-next"></span></a>
</p>
</section>
</div>
</div>
</article>
</div>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/ogp.php
<?php if (is_single()): ?>
<meta property="og:type" content="article">
<?php if(have_posts()): while(have_posts()): the_post(); ?>
<meta name="description" content="<?php the_excerpt(); ?>">
<meta property="og:description" content="<?php the_excerpt(); ?>">
<meta name="twitter:description" content="<?php the_excerpt(); ?>">
<?php endwhile; endif; ?>
<meta property="og:title" content="<?php the_title(); ?>">
<meta name="twitter:title" content="<?php the_title(); ?>">
<meta property="og:url" content=" <?php the_permalink(); ?>">
<?php if(has_post_thumbnail()):
$image_id = get_post_thumbnail_id();
$image = wp_get_attachment_image_src( $image_id, 'large');
?>
<meta property="og:image" content="<?php echo $image[0] ?>">
<meta name="twitter:image" content="<?php echo $image[0] ?>">
<?php else:
$ogp_image = get_stylesheet_directory_uri(). '/screenshot.png';
?>
<meta property="og:image" content="<?php echo $ogp_image ?>">
<meta name="twitter:image" content="<?php echo $ogp_image ?>">
<?php endif; ?>
<?php else: ?>
<meta property="og:type" content="website">
<meta name="description" content="<?php bloginfo('description'); ?>">
<meta property="og:description" content="<?php bloginfo('description'); ?>">
<meta name="twitter:description" content="<?php bloginfo('description'); ?>">
<meta property="og:title" content="<?php bloginfo('name'); ?>">
<meta name="twitter:title" content="<?php bloginfo('name'); ?>">
<meta property="og:url" content="<?php bloginfo('url'); ?>">
<?php
$ogp_image = get_stylesheet_directory_uri(). '/screenshot.png';
?>
<meta property="og:image" content="<?php echo $ogp_image ?>">
<meta name="twitter:image" content="<?php echo $ogp_image ?>">
<?php endif; ?>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>">
<meta property="og:locale" content="ja_JP">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@otonoha2013oton">
<file_sep>/wp-content/themes/nanneco/single-contacts.php
<?php get_header(); ?>
<?php
while (have_posts() ): the_post();
?>
<main class="l-main" id="main">
<section class="" id="js-contact">
<article class="c-article">
<h1 class="c-h1">
<div class="c-section_inner"><?php the_title(); ?><i>Contact</i></div>
</h1>
<div class="c-section_inner">
<div class="p-contact_inner">
<?php the_content(); ?>
</div>
</div>
</article>
</section>
</main>
<?php endwhile; ?>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/single-blog.php
<?php get_header(); ?>
<?php
while (have_posts() ): the_post();
?>
<article class="hero_wrap">
<a class="hero hero--sub f-flex f-middle f-center js-page-scroll" href="#content" style="background-image: url(<?php the_post_thumbnail_url(); ?>)">
<div class="hero_inner" id="js-scroll">
<h1 class="hero_text"><?php the_title(); ?></h1>
</div>
</a>
</article>
<!-- blog -->
<div id="content">
<article class="article">
<div class="article_inner js-fadein-wrap">
<div class="blog_content">
<h2 class="h2"><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php
$prev_post = get_previous_post();
$next_post = get_next_post();
?>
<ul class="pager f-flex f-center f-middle">
<li class="pager_item" <?php if (!$prev_post) : ?> style="visibility:hidden;" <?php endif; ?>>
<a href="<?php echo get_permalink($prev_post->ID); ?>" class="pager_target btn--arrow_wrap f-flex f-middle f-center"><span class="btn btn--arrow btn--arrow-prev"></span></a>
</li>
<li class="pager_item pager_item--text">
<a href="<?php echo home_url('/blog/'); ?>" class="pager_target pager_target-text f-flex f-middle f-center">back to list</a>
</li>
<li class="pager_item" <?php if (!$next_post) : ?> style="visibility:hidden;" <?php endif; ?>>
<a href="<?php echo get_permalink($next_post->ID); ?>" class="pager_target btn--arrow_wrap f-flex f-middle f-center"><span class="btn btn--arrow btn--arrow-next"></span></a>
</li>
</ul>
</div>
</div>
</article>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/archive.php
<?php get_header(); ?>
<main class="l-main" id="main">
<article class="c-article">
<h1 class="c-h1 u-mb--md">
<div class="c-section_inner">ナントカと猫企画のイベント<i>nan-neco presents</i></div>
</h1>
<?php
if(have_posts()) :
$postType = get_post_type_object( get_post_type() )->label;
?>
<div class="c-section_inner">
<article class="c-media">
<ul class="c-media_list">
<?php
while(have_posts()): the_post();
?>
<li class="c-media_item">
<a class="c-media_target f-flex" href="<?php the_permalink(); ?>">
<figure class="c-media_figure"
style="background-image: url(<?php the_post_thumbnail_url(); ?>);"></figure>
<div class="c-article_text u-text-left">
<time class="c-media_time"><?php the_field('event-date'); ?></time>
<div class="c-media_textarea">
<h3 class="c-media_title"><?php the_title(); ?></h3>
</div>
</div>
</a>
</li>
<?php
endwhile;
?>
</ul>
</article>
</div>
<?php
endif;
?>
</article>
</main>
<?php
if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
}
?>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/functions.php
<?php
if ( ! function_exists( 'setup' ) ) :
function setup() {
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 2000, 9999 );
}
endif; //setup
add_action( 'after_setup_theme', 'setup' );
/**
* script and stylesheet
*
*
**/
function my_scripts() {
wp_enqueue_style( 'main-stylesheet', get_template_directory_uri() . '/assets/css/main.min.css', array(), '20181231' );
wp_enqueue_script( 'mainscript', get_template_directory_uri() . '/assets/js/index.min.js', array(), '20181231', true );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
/**
* pagination
*
*
**/
function pagination($pages = '', $range = 2) {
$showitems = ($range * 2)+1;
global $paged;
if( empty($paged) ) $paged = 1;
if( $pages == '' ) {
global $wp_query;
$pages = $wp_query->max_num_pages;
if( !$pages ) {
$pages = 1;
}
}
if( 1 != $pages ) {
echo '<nav class="pagination"><h3>Page '.$paged.' of '.$pages.'</h3>';
if( $paged > 2 && $paged > $range+1 && $showitems < $pages ) {
echo '<a class="pjax" href="'.get_pagenum_link(1).'"><i class="fa fa-angle-double-left" aria-hidden="true"></i></a>';
}
if( $paged > 1 && $showitems < $pages ) {
echo '<a class="pjax" href="'.get_pagenum_link($paged - 1).'"><i class="fa fa-angle-left" aria-hidden="true"></i></a>';
}
for( $i=1; $i <= $pages; $i++ ) {
if( 1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ) ) {
echo ($paged == $i)? '<span class="current">'.$i.'</span>':'<a class="pjax" href="'.get_pagenum_link($i).'">'.$i.'</a>';
}
}
if ($paged < $pages && $showitems < $pages) {
echo '<a class="pjax" href="'.get_pagenum_link($paged + 1).'"><i class="fa fa-angle-right" aria-hidden="true"></i></a>';
}
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) {
echo '<a class="pjax" href="'.get_pagenum_link($pages).'"><i class="fa fa-angle-double-right" aria-hidden="true"></i></a>';
}
echo "</nav>\n" ;
}
}
/**
* indicate future post
*
*
**/
add_action('save_post', 'futuretopublish', 99);
add_action('edit_post', 'futuretopublish', 99);
function futuretopublish() {
global $wpdb;
$sql = 'UPDATE `'.$wpdb->prefix.'posts` ';
$sql .= 'SET post_status = "publish" ';
$sql .= 'WHERE post_status = "future"';
$wpdb->get_results($sql);
}
/**
* if mobile
*
*
**/
function is_mobile() {
$useragents = array(
'iPhone', // iPhone
'iPod', // iPod touch
'Android', // 1.5+ Android
'dream', // Pre 1.5 Android
'CUPCAKE', // 1.5+ Android
'blackberry9500', // Storm
'blackberry9530', // Storm
'blackberry9520', // Storm v2
'blackberry9550', // Storm v2
'blackberry9800', // Torch
'webOS', // Palm Pre Experimental
'incognito', // Other iPhone browser
'webmate' // Other iPhone browser
);
$pattern = '/'.implode('|', $useragents).'/i';
return preg_match($pattern, $_SERVER['HTTP_USER_AGENT']);
}
function new_excerpt_more($more) {
return '';
}
add_filter('excerpt_more', 'new_excerpt_more');
remove_filter('the_excerpt', 'wpautop');
/**
* short cord image pass
*
*
**/
function short_url_images() {
$imgUrl = get_template_directory_uri();
return $imgUrl . '/assets/images';
}
add_shortcode('img_url', 'short_url_images');
/**
* add post list thumbnail
*
*
**/
function add_posts_columns_thumbnail($columns) {
$columns['thumbnail'] = 'eyecatch';
return $columns;
}
function add_posts_columns_thumbnail_row($column_name, $post_id) {
if ( 'thumbnail' == $column_name ) {
$thumb = get_the_post_thumbnail($post_id, array(50,50), 'thumbnail');
echo ( $thumb ) ? $thumb : 'none';
}
}
add_filter( 'manage_posts_columns', 'add_posts_columns_thumbnail' );
add_action( 'manage_posts_custom_column', 'add_posts_columns_thumbnail_row', 10, 2 );
/**
* hide notification
*
*
**/
add_filter( 'pre_site_transient_update_core', '__return_zero' );
remove_action( 'wp_version_check', 'wp_version_check' );
remove_action( 'admin_init', '_maybe_update_core' );
add_action('admin_menu', 'remove_counts');
function remove_counts(){
global $menu,$submenu;
$menu[65][0] = 'プラグイン';
$submenu['index.php'][10][0] = '更新';
}
add_action( 'wp_before_admin_bar_render', 'hide_before_admin_bar_render' );
function hide_before_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'updates' );
}
/**
* hide visual editor
*
*
**/
function disable_visual_editor_in_page(){
add_filter('user_can_richedit', 'disable_visual_editor_filter');
}
function disable_visual_editor_filter(){
return false;
}
add_action( 'load-post.php', 'disable_visual_editor_in_page' );
add_action( 'load-post-new.php', 'disable_visual_editor_in_page' );
/**
* footer text
*
*
**/
function custom_footer_admin () {
return 'thanks to...';
}
add_filter('admin_footer_text', 'custom_footer_admin');
function custom_footer_update () {
return 'thanks to...';
}
add_filter('update_footer', 'custom_footer_update', 11);
/**
* eyecatch text
*
*
**/
add_filter( 'admin_post_thumbnail_html', 'add_post_thumbnail_description' );
function add_post_thumbnail_description( $content ) {
return $content .= '<p>ここに設定した画像が一覧に表示されます。</p>';
}
/**
* dns prefetch
*/
function dns_prefetch() {
// DNS prefetch を on にするタグを出力用変数に入れる
$output = '<meta http-equiv="x-dns-prefetch-control" content="on">' . "\n";
// prefetch するドメインのタグひな形
$html = '<link rel="dns-prefetch" href="//%s">' . "\n";
$domains = array(
// facebook
//'connect.facebook.net',
//'s-static.ak.facebook.com', 'static.ak.fbcdn.net', 'static.ak.facebook.com', 'www.facebook.com',
//
'maxcdn.bootstrapcdn.com',
// twitter
//'platform.twitter.com',
//'cdn.api.twitter.com', 'p.twitter.com', 'twitter.com',
//
// Google+
//'apis.google.com', 'oauth.googleusercontent.com', 'ssl.gstatic.com',
'fonts.googleapis.com', 'ajax.googleapis.com',
// pinterest
//'assets.pinterest.com',
// WordPress
//'stats.wordpress.com', 'i0.wp.com', 'i1.wp.com', 'i2.wp.com', 's0.wp.com',
// analytics
'www.google-analytics.com'
// 追加する場合 ↓ 先頭の // を消して書き込む
//'', '', '', '', '', '', ''
);
// 上記 $domains 配列に入れたドメインをひな形 $html に入れ込み、ループで出力用変数に入れる
foreach ( $domains as $domain ) {
$output .= sprintf( $html, $domain );
}
// 書き出し
echo $output;
}
// add_action( 'フック名', 'フックする関数名', 優先順位:今回は真っ先に実行したいので 1 を指定 )
add_action( 'wp_head', 'dns_prefetch', 1 );
function disable_scheduled_posting_func( $data, $postArray ) {
if ( ( $data['post_type'] == 'event' && $data['post_status'] == 'future') && $postArray['post_status'] == 'publish' ) {
$data['post_status'] = 'publish';
}
return $data;
};
add_filter( 'wp_insert_post_data', 'disable_scheduled_posting_func', 10, 2 );
/**
* login
*
*
**/
function custom_login() { ?>
<style>
/*
* background
*/
.login {
background: url(<?php echo get_stylesheet_directory_uri();
?>/screenshot.jpg) no-repeat center center;
background-size: cover;
}
/*
* logo
*/
.login #login h1 a {
display: block;
width: 180px;
height: 80px;
margin-right: auto;
margin-left: auto;
background: url(<?php echo get_stylesheet_directory_uri();
?>/assets/images/logo.svg) no-repeat center center;
background-size: contain;
}
/*
* back to text
*/
.login #nav,
.login #backtoblog {
display: none;
}
/*
* background alpha
*/
.login form,
.login #login_error,
.login .message {
background-color: hsla(0, 0%, 100%, 0.8);
}
/*
* layout
*/
#login {
position: absolute;
top: 50%;
left: 50%;
padding: 0;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'custom_login' );
/**
* login logo url
*
*
**/
function custom_login_logo_url() {
return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'custom_login_logo_url' );
/**
* login remenber password
*
*
**/
function login_checked_rememberme() { ?>
<script>
jQuery(document).ready(function () {
jQuery('#rememberme').prop('checked', true);
});
</script>
<?php }
add_action( 'login_head', 'login_checked_rememberme' );
/**
* btn hidden
* excepting administrator
*
**/
function my_admin_head(){
if (!current_user_can('level_10')) { ?>
<style>
#contextual-help-link-wrap,
#screen-options-link-wrap,
#menu-posts {
display: none;
}
</style>
<?php
}
}
add_action('admin_head', 'my_admin_head');
/**
* header exit
*
*
**/
function deregister_plugin_files() {
wp_dequeue_style( 'duplicate-post' );
}
add_action( 'wp_enqueue_scripts', 'deregister_plugin_files' );
remove_action('wp_head','rest_output_link_wp_head');
remove_action('wp_head','wp_oembed_add_discovery_links');
remove_action('wp_head','wp_oembed_add_host_js');
remove_action('template_redirect', 'rest_output_link_header', 11 );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head','index_rel_link');
remove_action('wp_head','parent_post_rel_link',10);
remove_action('wp_head','start_post_rel_link',10);
remove_action('wp_head','adjacent_posts_rel_link_wp_head',10);
<file_sep>/wp-content/themes/nanneco/gulp/gulpfile.babel.js
/**
* Create paths and import packages
*
* いろんなところにパスを通す。
* パッケージを読み込む。
*
*/
const gulp = require('gulp'),
//
// path
// - - - - - - - - - -
docs = '.',
//
distDir = docs + '.',
srcDir = docs + '/src',
//
srcAssetsDir = srcDir + '/assets',
distAssetsDir = distDir + '/assets',
//
srcPath = {
'imgPath': srcAssetsDir + '/images',
'sassPath': srcAssetsDir + '/sass',
'cssPath': srcAssetsDir + '/css',
'jsPath': srcAssetsDir + '/js'
},
distPath = {
'imgPath': distAssetsDir + '/images',
'sassPath': distAssetsDir + '/sass',
'cssPath': distAssetsDir + '/css',
'jsPath': distAssetsDir + '/js'
},
//
// common
// - - - - - - - - -
plumber = require('gulp-plumber'), // error escape
rename = require('gulp-rename'), // rename
sourcemaps = require('gulp-sourcemaps'), // sourcemap
gulpSequence = require('gulp-sequence'), // sequence
notify = require('gulp-notify'), // alert
watch = require('gulp-watch'), // watch
del = require('del'), // delete
fs = require('graceful-fs'), // JSON load
//
// CSS
// - - - - - - - - -
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
postcssGapProperties = require('postcss-gap-properties'),
sass = require('gulp-sass'), // sass
csscomb = require('gulp-csscomb'), // css
cssmin = require('gulp-cssmin'), // css min
frontnote = require('gulp-frontnote'), // style guide
//
// JavaScript
// - - - - - - - - -
uglify = require('gulp-uglify'), // js min
babel = require('gulp-babel'), // es6
concat = require('gulp-concat'), // concat ... order.JSON
eslint = require('gulp-eslint'), // eslint
//
// HTML
// - - - - - - - - -
ejs = require('gulp-ejs'), // ejs template
minifyHtml = require('gulp-minify-html'), // html min
browser = require('browser-sync'), // browser start
//
// image
// - - - - - - - - -
imagemin = require('gulp-imagemin'), // image min
pngquant = require('imagemin-pngquant');
/**
* server
* docker と同じところを参照する
*/
gulp.task('browser', () => {
browser.init({
proxy: 'localhost',
});
});
/**
* CSS task
*
* Convert Sass (SCSS) to CSS. (Compass)
* Generate a style guide.(frontnote)
* Execute autoprefixer.
* Format the order of CSS properties.
* Save it temporarily, compress it, rename it, resave it.
* Reload the browser.
*
* Sass(SCSS)をCSSに変換する。(compass)
* スタイルガイドを生成する。(frontnote)
* autoprefixerを実行する。
* CSSプロパティの並び順を整形する。
* 一時保存して、圧縮して名前を変更して、再保存。
* ブラウザを再起動する。
*
*/
gulp.task('sass', () => {
gulp.src(srcPath.sassPath + '/**/*.scss')
.pipe(plumber({errorHandler: notify.onError('<%= error.message %>')}))
.pipe(sass())
.pipe(postcss([
postcssGapProperties(),
autoprefixer({
browsers: [
'last 2 version',
'Android >= 4.4.4',
'Explorer 11',
],
cascade: false,
grid: true,
}),
]))
.pipe(csscomb())
.pipe(gulp.dest(distPath.cssPath + '/'))
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(distPath.cssPath + '/'))
.pipe(browser.reload({stream: true}))
.pipe(notify('css task finished'));
});
/**
* JavaScript task
*
*
* Check the script with ESLint.
* Compile the ES 2015 notation to ES 5 with babel, save it after renaming.
* Join scripts in the order specified by JSON and save them.
* Compress the combined script, output the source map and save.
* Reload the browser.
*
* ESLintでスクリプトをチェックする。
* babelでES2015記法をES5にコンパイルしてリネーム後、保存する。
* JSONで指定した順番にスクリプトを結合して保存する。
* 結合したスクリプトを圧縮し、ソースマップを出力して保存。
* ブラウザを再起動する。
*
*/
let jsJson = JSON.parse(fs.readFileSync(srcPath.jsPath + '/order.json')),
jsList = [],
cutLength;
for (let i = 0; i < jsJson.order.length; i++) {
jsList[i] = srcPath.jsPath + jsJson.order[i];
}
//
gulp.task('js.babel', () => {
return gulp.src(srcPath.jsPath + '/**/*babel.js')
.pipe(plumber({errorHandler: notify.onError('<%= error.message %>')}))
.pipe(eslint({useEslintrc: true}))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(babel())
.pipe(rename(function(Path) {
cutLength = Path.basename.length - 6;
Path.basename = Path.basename.slice(0, cutLength);
}))
.pipe(gulp.dest(srcPath.jsPath + '/babel/'))
});
gulp.task('js.concat', () => {
return gulp.src(jsList.join(',').split(','))
.pipe(plumber({errorHandler: notify.onError('<%= error.message %>')}))
.pipe(concat('index.js'))
.pipe(gulp.dest(distPath.jsPath + '/'))
});
gulp.task('js.uglify', () => {
return gulp.src(distPath.jsPath + '/index.js')
.pipe(plumber({errorHandler: notify.onError('<%= error.message %>')}))
//.pipe(sourcemaps.init())
.pipe(uglify({preserveComments: 'some'}))
//.pipe(sourcemaps.write())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(distPath.jsPath + '/'))
.pipe(browser.reload({stream: true}))
.pipe(notify('js task finished'));
});
//
gulp.task('js', function(callback) {
gulpSequence('js.babel', 'js.concat', 'js.uglify')(callback)
});
/**
* php
*/
gulp.task('php', () => {
return gulp.src('..' + '/**/*.php')
.pipe(browser.reload({stream: true}))
});
/**
*
* Compress and save the image.
* Reload the browser.
*
* 画像を圧縮して保存。
* ブラウザを再起動する。
*
*/
gulp.task('images.min', () => {
return gulp.src(srcPath.imgPath + '/**/*.{png,jpg,gif,svg}')
.pipe(plumber({errorHandler: notify.onError('<%= error.message %>')}))
.pipe(changed(distPath.imgPath))
.pipe(imagemin([
pngquant({
quality: '65-80',
speed: 1,
floyd: 0,
}),
mozjpeg({
quality: 85,
progressive: true,
}),
imagemin.svgo(),
imagemin.optipng(),
imagemin.gifsicle(),
]))
.pipe(gulp.dest(distPath.imgPath))
.pipe(notify('🍣 images task finished 🍣'));
});
//
gulp.task('images.reload', ['images.min'], () => {
return browser.reload();
});
//
gulp.task('images', ['images.min', 'images.reload']);
/**
* dafault task
*
*/
gulp.task('default', ['browser'], () => {
watch([srcPath.jsPath + '/**/*.js', '!' + srcPath.jsPath + '/babel/**/*.js'], () => {
gulp.start(['js'])
});
watch([srcPath.sassPath + '/**/*.scss'], () => {
gulp.start(['sass'])
});
watch(['..' + '/**/*.php'], () => {
gulp.start(['php'])
});
watch([srcPath.imgPath + '/**/*.{png,jpg,gif,svg}'], () => {
gulp.start(['images'])
});
});
<file_sep>/wp-content/themes/nanneco/index.php
<?php get_header(); ?>
<main class="l-main" id="main">
<section class="p-hero">
<ul class="p-hero_inner f-flex f-top">
<li class="p-hero_item">
<ul class="p-hero_list f-flex f-top">
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/2.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/3.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/4.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
</ul>
<svg class="p-hero_mask" viewBox="0 0 800 450">
<path class="a" id="js-mask01" d="M0,0V450H800V0ZM685.09,413.49H114.91a50,50,0,0,1-50-50v-277a50,50,0,0,1,50-50H685.09a50,50,0,0,1,50,50v277A50,50,0,0,1,685.09,413.49Z"/>
</svg>
</li>
<li class="p-hero_item">
<ul class="p-hero_list f-flex f-top">
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/2.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/3.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/4.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
</ul>
<svg class="p-hero_mask" viewBox="0 0 800 450">
<path class="a" id="js-mask02" d="M0,0V450H800V0ZM685.09,413.49H114.91a50,50,0,0,1-50-50v-277a50,50,0,0,1,50-50H685.09a50,50,0,0,1,50,50v277A50,50,0,0,1,685.09,413.49Z"/>
</svg>
</li>
<li class="p-hero_item">
<ul class="p-hero_list f-flex f-top">
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/2.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/3.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/4.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/5.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/6.jpg)"></figure>
</li>
<li class="p-hero_img-wrap">
<figure class="p-hero_img" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/hero/1.jpg)"></figure>
</li>
</ul>
<svg class="p-hero_mask" viewBox="0 0 800 450">
<path class="a" id="js-mask03" d="M0,0V450H800V0ZM685.09,413.49H114.91a50,50,0,0,1-50-50v-277a50,50,0,0,1,50-50H685.09a50,50,0,0,1,50,50v277A50,50,0,0,1,685.09,413.49Z"/>
</svg>
</li>
</ul>
</section>
<section class="p-message">
<div class="p-message_inner">
<p class="p-message_text js-message" data-delay="2">
すきなこと<br>
すきなじかん<br>
すきなじぶんを<br>
みつけるきっかけ
</p>
<!--
<p class="p-message_text js-message">
ワクワクドキドキで<br>
こころにスイッチを仕掛ける<br>
みんなでつくるお祭り
</p>
-->
</div>
</section>
<article class="c-article">
<div class="c-article_inner f-flex f-center">
<div class="">
<h1 class="h1">2017年は、お母さんのためのおまつり<br>
母の日に開催決定◯</h1>
<p class="h2 u-mt--md u-mb--md">// スタッフさん大大大募集中です!! \\</p>
<p class="c-article_text u-text-justify">2017年5月14日(日)<br>
第4回SUNSUNフェス2017@奈良<br>
=奈良公園内 奈良文化会館=<br>
<a class="c-article_link" target="_blank" href="http://ameblo.jp/nanneko-kikaku/">太陽のおまつり~SUNSUNフェス@なら~</a>
</p>
<p class="c-article_text u-text-justify">2017年5月21日(日)<br>
第5回SUNSUNフェス2017@あいおい<br>
=扶桑電通なぎさホール= <br>
<a class="c-article_link" target="_blank" href="http://ameblo.jp/nanneko-hyougo/">太陽のおまつり~SUNSUNフェス@あいおい~</a>
</p>
</div>
</div>
</article>
</main>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/gulp/src/assets/js/babel/main.js
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/* eslint-disable no-unused-vars */
var googleMapValue = googleMapValue || {};
(function ($) {
// common
///////////////////
var DATA = {
domain: '',
spW: 320,
tabW: 768,
pcW: 980,
wideScreenW: 1024,
fullHdW: 1440,
scrollTop: 0,
scrollLeft: 0,
init: function init() {
var self = this;self.domain = window.location.protocol + '//' + window.location.host || '', self.winW = window.innerWidth;
self.winH = window.innerHeight;
self.isMini = self.winW < self.spW;
self.isSp = self.spW <= self.winW && self.winW <= self.tabW;
self.isTab = self.tabW <= self.winW && self.winW <= self.pcW;
self.isPc = self.winW >= self.pcW && self.winW <= self.wideScreenW;
self.isWidescreen = self.winW >= self.wideScreenW && self.winW <= self.fullHdW;
self.isFullHd = self.winW >= self.fullHdW;
self.isDesktop = self.winW >= self.tabW;
self.isMobile = self.winW <= self.tabW;
var resize = function resize() {
self.winW = window.innerWidth;
self.winH = window.innerHeight;
self.isMini = self.winW <= self.spW;
self.isSp = self.spW <= self.winW && self.winW <= self.tabW;
self.isTab = self.tabW <= self.winW && self.winW <= self.pcW;
self.isPc = self.winW >= self.pcW && self.winW <= self.wideScreenW;
self.isWidescreen = self.winW >= self.wideScreenW && self.winW <= self.fullHdW;
self.isFullHd = self.winW >= self.fullHdW;
self.isDesktop = self.winW >= self.tabW;
self.isMobile = self.winW <= self.tabW;
};
resize();
window.addEventListener('resize', resize);
var scroll = function scroll() {
self.scrollTop = window.pageYOffset;
};
window.addEventListener('scroll', scroll);
},
transitionEnd: 'oTransitionEnd mozTransitionEnd webkitTransitionEnd transitionend',
animationEnd: 'webkitAnimationEnd oanimationend msAnimationEnd animationend'
};
DATA.init();
var util = {
/**
* obj merge
* オプションのキーが存在するときだけ新しいオブジェクトにマージする
*/
extend: function extend(a, b) {
for (var key in b) {
if (b.hasOwnProperty(key)) {
a[key] = b[key];
}
}
return a;
}
};
// main
/////////////////////
var main = function main() {
/**
*
* @type {*}
*/
var $wrap = $('#wrap');
// Process when the window resize is over
//////////////////////////////
var finishResizeEvent = function finishResizeEvent(func) {
var timer = false;
$(window).on('resize', function () {
if (timer !== false) {
clearTimeout(timer);
}
timer = setTimeout(func, 300);
});
};
var loaded = function loaded() {
$wrap.addClass('is-active').find('.js-late').addClass('is-active');
var tl = new TimelineMax();
tl.to($('#js-loader'), .5, {
scale: 1.4,
onComplete: function onComplete(obj) {
$(obj.target).fadeOut();
},
onCompleteParams: ['{self}']
}).fromTo($('#main'), 1, {
y: 50
}, {
y: 0,
autoAlpha: 1,
ease: Power2.easeOut
}, '+=.2');
};
/**
*
* span element
*
*/
var spanText = function spanText($text) {
$text.children().addBack().contents().each(function () {
if (this.nodeType == 3) {
$(this).replaceWith($(this).text().replace(/(\S)/g, '<span>$1</span>'));
}
});
};
spanText($('.js-message'));
var fadeText = function fadeText(target) {
var $animItem = $('span', target),
delayTime = $(target).attr('data-delay') * 1;
TweenMax.set($animItem, {
transformPerspective: 500,
autoAlpha: 1,
z: 0
});
TweenMax.staggerFrom($animItem, 1.5, {
xPercent: 50,
yPercent: 100,
rotationY: -90,
autoAlpha: 0,
z: 0,
ease: Power3.easeOut,
delay: delayTime
}, .1);
};
fadeText('.js-message');
/*
*
* TweenMax slide animation
*
*/
var heroSlide = function heroSlide() {
var slideId = 0,
$slide = $('.p-hero_list'),
itemSum = $slide.eq(0).find('li').length,
itemCount = itemSum - 2,
slideW = $slide.find('li').width(),
timer = false;
var slideTop = function slideTop() {
slideId += 1;
var anim = TweenMax.to($slide, 1.2, {
x: -slideW * slideId,
ease: Sine.easeOut,
onComplete: function onComplete() {
if (slideId > itemCount) {
TweenMax.set($slide, {
x: 0
});
slideId = 0;
}
}
});
anim.play();
};
timer = setInterval(slideTop, 4000);
};
var maskMove = function maskMove(target) {
if ($(target).length) {
var mask = Snap(target),
path = ['M0,0V450H800V0ZM435.12,413.49H380.43c-352.78,6-321.2-74.92-315.52-207.16V182.2C47.68,38,211.88,35,368.88,36.49l68.55-.32c241.86,0,294.24,16.63,297.66,166v12.13c-5.72,229.77-98.93,192-265.3,199.17Z', 'M0,0V450H800V0ZM634.5,413.28l-398,.21c-56,4.79-186,4.79-172-181.21v-28c15-191,53-171,169-167.77l282-2.23c208-3,227,52,218,188v33C736.5,342.28,737.5,402.28,634.5,413.28Z'],
index = 0,
time = 3000;
var play = function play() {
if (index === 0) {
mask.animate({
d: path[1]
}, time, play);
index = 1;
} else {
mask.animate({
d: path[0]
}, time, play);
index = 0;
}
};
play();
}
};
maskMove('#js-mask01');
maskMove('#js-mask02');
maskMove('#js-mask03');
var loaderAnim = function loaderAnim() {
var $animItem = $('span', '#js-loader');
TweenMax.set($animItem, {
transformPerspective: 500
});
TweenMax.staggerFrom($animItem, 1, {
y: -20,
rotationX: 90,
ease: Power3.easeOut,
yoyo: true,
repeat: -1,
repeatDelay: .5
}, .2);
};
loaderAnim();
// show mobile navigation
/////////////////////////////
/**
*
* @param target {object}
* @param navi {object}
*
*/
var actionSpHeader = function actionSpHeader(target, navi) {
if (target.length) {
/**
*
* @type {Object}
*/
var $spGnav = navi,
$spGnavBtn = target;
/**
*
* @type {boolean}
*/
var isSpGnavOpen = false;
$spGnavBtn.on('click', function (e) {
e.preventDefault();
if (!isSpGnavOpen) {
$('body').on('touchmove.noScroll', function (e) {
e.preventDefault();
});
$spGnav.addClass('is-open');
isSpGnavOpen = true;
} else {
$('body').off('.noScroll');
$spGnav.removeClass('is-open');
isSpGnavOpen = false;
}
});
}
};
// drop down action
/////////////////////////////
/**
*
* @param target
*/
var dropDownMenu = function dropDownMenu(target) {
/**
*
* @type {*}
*/
var $target = $(target);
$target.on('click', function (e) {
e.preventDefault();
$(this).toggleClass('is-active').next().stop().slideToggle(550, 'easeInOutCubic');
});
};
dropDownMenu('.js-dropdown-trigger');
/**
*
* rect animation
*
*/
/**
*
* @type {RectAnimation}
*/
var RectAnimation = function () {
/**
* Constructor
*
* @param element DOM
* @param {string} アニメーションの方向を決定します
*/
function RectAnimation(target, direction) {
_classCallCheck(this, RectAnimation);
this.target = $(target);
this.direction = direction;
this.layout();
}
_createClass(RectAnimation, [{
key: 'setOption',
value: function setOption(options) {
this.options = {
isContentHidden: true,
direction: 'lr',
bgcolor: '#333333',
duration: .5,
easing: Power2.easeInOut,
onCover: function onCover() {
return false;
},
onStart: function onStart() {
return false;
},
onComplete: function onComplete() {
return false;
}
};
util.extend(this.options, options);
}
}, {
key: 'getHeight',
value: function getHeight() {
var height = this.target.height();
return height;
}
}, {
key: 'getWidth',
value: function getWidth() {
var width = this.target.width();
return width;
}
/**
*
* @returns {string}
*/
}, {
key: 'initRect',
value: function initRect() {
var height = this.getHeight(),
width = this.getWidth();
if (this.direction === 'lr') {
return 'rect(0px 0px ' + height + ' 0px)';
} else if (this.direction === 'rl') {
return 'rect(0px ' + width + ' ' + height + ' ' + width + ')';
} else if (this.direction === 'tb') {
return 'rect(0px ' + width + ' 0px 0px)';
} else if (this.direction === 'bt') {
return 'rect(' + height + ' ' + width + ' ' + height + ' 0px)';
}
}
}, {
key: 'layout',
value: function layout() {
var position = this.target.css('position');
if (position !== 'fixed' && position !== 'absolute' && position !== 'relative') {
this.target.css('position', 'relative');
}
this.mask = $('<div>').addClass('c-block_mask').css({
position: 'absolute',
zIndex: 99,
top: 0,
left: 0,
right: 0,
bottom: 0
});
TweenMax.set(this.mask, {
clip: this.initRect(this.direction)
});
this.target.wrapInner('<div>').children().css('opacity', 0).addClass('c-block_inner').parent().prepend(this.mask);
}
}, {
key: 'getRect',
value: function getRect(width, height, end) {
var rect = {
top: 0,
right: 0,
bottom: 0,
left: 0
};
if (this.direction === 'lr') {
rect.bottom = height;
rect.right = width;
if (end) {
rect.left = width;
}
} else if (this.direction === 'rl') {
rect.bottom = height;
rect.right = width;
if (end) {
rect.right = 0;
}
} else if (this.direction === 'tb') {
rect.right = width;
rect.bottom = height;
if (end) {
rect.top = height;
}
} else if (this.direction === 'bt') {
rect.right = width;
rect.bottom = height;
if (end) {
rect.bottom = 0;
}
}
return 'rect(' + rect.top + 'px ' + rect.right + 'px ' + rect.bottom + 'px ' + rect.left + 'px)';
}
// public
// - - - -- - - - - - - - - -
}, {
key: 'anim',
value: function anim() {
var tl = new TimelineMax({}),
height = this.getHeight(),
width = this.getWidth(),
fromRect = this.getRect(width, height, false),
toRect = this.getRect(width, height, true),
self = this,
mask = this.options;
tl.to(this.mask, .5, {
clip: fromRect,
ease: Power3.easeInOut
}).add(function () {
self.mask.next('.c-block_inner').css('opacity', 1);
}).to(this.mask, .5, {
clip: toRect,
ease: Power2.easeInOut
});
}
}]);
return RectAnimation;
}();
// const leftToRightMask = new RectAnimation('.js-block-anime', 'lr');
// leftToRightMask.anim();
/**
* element viewport in addClass
* @param target
*/
var showElement = function showElement(target) {
$(target).each(function () {
var $this = $(this),
offset = $this.offset().top,
count = 0,
mask = void 0;
var direction = $this.attr('data-direction');
if (direction) {
mask = new RectAnimation(this, direction);
}
$(window).on('scroll', function () {
if (DATA.scrollTop + DATA.winH > offset + 210) {
$this.addClass('is-show');
if (count === 0) {
mask.anim();
count = 1;
}
} else {
$this.removeClass('is-show');
}
});
});
};
showElement('.js-fadein', $wrap);
// carousel
/////////////////////////////
var carouselInit = function carouselInit() {
var fadeSingle = function fadeSingle() {
$('.js-slider-fade').owlCarousel({
animateOut: 'fadeOut',
items: 1,
margin: 0,
stagePadding: 0,
smartSpeed: 450,
loop: true,
autoplay: true,
autoplayTimeout: 3000,
autoplayHoverPause: true
});
};
fadeSingle();
var slideBasic = function slideBasic() {
$('.js-slider-basic').owlCarousel({
loop: true,
margin: 10,
nav: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
});
};
slideBasic();
var slideCenter = function slideCenter() {
$('.js-slider-center').owlCarousel({
center: true,
items: 2,
loop: true,
margin: 10,
smartSpeed: 1000,
autoplay: true,
autoplayTimeout: 1500,
autoplayHoverPause: true
});
};
slideCenter();
var customNavi = function customNavi() {
var owl = $('.js-slider-my-nav');
owl.owlCarousel({
loop: true,
margin: 10,
smartSpeed: 600,
autoplay: true,
autoplayTimeout: 1500,
autoplayHoverPause: true
});
owl.next().find('.js-slider-nav-prev').on('click', function (e) {
e.preventDefault();
owl.trigger('prev.owl.carousel');
});
owl.next().find('.js-slider-nav-next').on('click', function (e) {
e.preventDefault();
owl.trigger('next.owl.carousel');
});
};
customNavi();
var thumbnail = function thumbnail() {
$('.js-slider-thumb').owlCarousel({
animateOut: 'fadeOut',
smartSpeed: 600,
loop: true,
autoplay: true,
autoplayTimeout: 1500,
autoplayHoverPause: true,
items: 1,
dots: false,
thumbs: true,
thumbImage: true,
thumbContainerClass: 'owl-thumbs',
thumbItemClass: 'owl-thumb-item'
});
};
thumbnail();
};
var zipCordComplete = function zipCordComplete() {
$('#zip').keyup(function () {
AjaxZip3.zip2addr(this, '', 'address', 'address');
});
};
zipCordComplete();
// home tab
/////////////////////////
var actionTab = function actionTab() {
/**
* @type {*}
*/
var tabWrap = $('.js-tab'),
trigger = tabWrap.find('.js-tab-trigger'),
// tabItem = tabWrap.find('.js-tab-item'),
anchor = void 0;
trigger.on('click', function (e) {
e.preventDefault();
var $self = $(this);
// trigger
$self.closest(tabWrap).find('.js-tab-trigger').removeClass('is-active');
anchor = $self.addClass('is-active').attr('href');
// panel item
$self.closest(tabWrap).find('.js-tab-item').removeClass('is-open').filter(anchor).addClass('is-open');
});
};
actionTab();
/*
*
* anchor scroll
*
*/
var anchorScroll = function anchorScroll(target) {
$(target).on('click', function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var hash = $(this.hash),
targetOffset = 0;
hash = hash.length && hash;
var updatePos = function updatePos() {
TweenMax.to($wrap, 0, {
scrollTo: {
y: targetOffset + 1
}
});
TweenMax.to($wrap, 0, {
scrollTo: {
y: targetOffset - 1
}
});
};
if (hash.length) {
//wrap内をスクロールするから wrapのスクロール量を足しておく
targetOffset = hash.offset().top - 80 + $wrap.scrollTop();
TweenMax.to($wrap, 2, {
scrollTo: {
y: targetOffset,
x: 0
},
ease: Power3.easeOut,
onComplete: function onComplete() {
updatePos();
}
});
}
return false;
}
});
};
anchorScroll('.js-scroll');
var gMap = function gMap() {
/**
* マップのid
*
* @type {string}
*/
var MY_MAPTYPE_ID = 'test';
/**
* 要素を取得する
* @type {Element}
*/
var canvas = document.getElementById('js-map');
/**
* マップのスタイル
* @type {array}
*/
var stylez = [{
'featureType': 'road',
'elementType': 'geometry',
'stylers': [{
'visibility': 'off'
}]
}, {
'featureType': 'poi',
'elementType': 'geometry',
'stylers': [{
'visibility': 'off'
}]
}, {
'featureType': 'landscape',
'elementType': 'geometry',
'stylers': [{
'color': '#FFFAF0'
}]
}, {
'featureType': 'water',
'stylers': [{
'color': '#d9edf7'
}]
}, {
'featureType': 'road',
'elementType': 'labels',
'stylers': [{
'visibility': 'off'
}]
}, {
'featureType': 'transit',
'stylers': [{
'visibility': 'off'
}]
}, {
'featureType': 'administrative',
'elementType': 'geometry',
'stylers': [{
'lightness': 40
}]
}, {
'featureType': 'poi.park',
'elementType': 'geometry',
'stylers': [{
'visibility': 'on',
'color': '#c5dac6'
}]
}, {
'featureType': 'landscape.natural.terrain',
'elementType': 'geometry.fill',
'stylers': [{
'visibility': 'on'
}, {
'color': '#CCAA88'
}, {
'lightness': 40
}]
}, {
'featureType': 'landscape.man_made',
'elementType': 'geometry.fill',
'stylers': [{
'visibility': 'on'
}, {
'color': '#EEEEEE'
}]
}, {
'featureType': 'road',
'stylers': [{
'visibility': 'simplified'
}, {
'color': '#FF0000'
}, {
'gamma': 9
}]
}, {
'featureType': 'road.highway',
'stylers': [{
'visibility': 'on'
}, {
'color': '#FF0000'
}, {
'gamma': 8
}]
}, {
'featureType': 'road.highway.controlled_access',
'stylers': [{
'visibility': 'on'
}, {
'color': '#FF0000'
}, {
'gamma': 4
}]
}, {
'featureType': 'road',
'elementType': 'labels',
'stylers': [{
'visibility': 'off'
}]
}, {
'featureType': 'poi.government',
'elementType': 'geometry',
'stylers': [{
'visibility': 'on'
}, {
'color': '#DDDDDD'
}]
}, {
'featureType': 'transit.station',
'elementType': 'geometry',
'stylers': [{
'visibility': 'on'
}, {
'color': '#CCCCCC'
}]
}, {
'featureType': 'transit.line',
'elementType': 'geometry',
'stylers': [{
'visibility': 'on'
}, {
'color': '#AAAAAA'
}, {
'gamma': 4
}]
}];
/**
* 地図の中心
* @type {google.maps.LatLng}
*/
var latlng = new google.maps.LatLng(googleMapValue.latitude, googleMapValue.longitude);
/**
* オプションのセット
* @type {{zoom: number, center: google.maps.LatLng}}
*/
var mapOptions = {
zoom: 15,
center: latlng,
mapTypeId: MY_MAPTYPE_ID,
scrollwheel: false
};
var map = new google.maps.Map(canvas, mapOptions);
/**
* マーカーのセット
* @type {google.maps.Marker}
*/
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
title: 'marker',
icon: {
url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAACNCAYAAACqnmQdAAAN9UlEQVR4Xu1dX48cRxGvXt8dUTCxZxekYCm5RDIPMRJ3liJQJMCOnBe/YAfEEw+2+QDEfILYnyDOFyAOUp4QYOfFL1jkAlJEFMl3SNgPWEoukUwkszt2Aii5O2+j6u2e1<KEY>',
scaledSize: new google.maps.Size(51, 70)
}
});
// let styledMapOptions = {
//
// name: 'mymap'
//
// };
/**
* マップスタイルのセット
* @type {google.maps.StyledMapType}
*/
var jayzMapType = new google.maps.StyledMapType(stylez);
map.mapTypes.set(MY_MAPTYPE_ID, jayzMapType);
};
/**
* parallax scroll effect
*/
var parallaxScroll = function parallaxScroll() {
/**
*
* @type {number}
*/
var delta = 3,
speed = .8,
target = $('[data-parallax]', $wrap),
el = void 0,
coefficent = void 0,
offsetTop = void 0,
transY = void 0;
/**
*
* @param scroll
*/
var scrollMove = function scrollMove(scroll) {
target.each(function () {
el = $(this);
coefficent = el.attr('data-parallax');
offsetTop = el.offset().top - scroll;
transY = offsetTop * -coefficent / delta;
TweenMax.to(el, speed, {
y: transY,
ease: Power3.easeOut
});
});
};
$wrap.on('scroll', function () {
scrollMove(DATA.scrollTop);
});
};
parallaxScroll();
/**
* navigation interaction
*/
var navAction = function navAction() {
var $openTrigger = $('#js-nav-trigger');
var activeClassName = 'is-open';
var $targets = $('.js-nav-target', '#wrap');
var $closeTrigger = $('.js-nav-close');
$openTrigger.on('click', function (e) {
e.preventDefault();
$(e.currentTarget).addClass(activeClassName);
$targets.addClass(activeClassName);
});
$closeTrigger.on('click', function (e) {
e.preventDefault();
$openTrigger.removeClass(activeClassName);
$targets.removeClass(activeClassName);
});
};
/**
*
* @param target {String} 対象の要素
*/
var heroImages = function () {
function heroImages(target) {
_classCallCheck(this, heroImages);
this.$hero = $(target);
this.addClassName = 'hero__img--sm';
this.currentNumber = 0;
this.totalNum = 86;
this.init();
}
_createClass(heroImages, [{
key: 'init',
value: function init() {
var _this = this;
this.getAllElement();
this.loadEvent();
setInterval(function () {
_this.selectElement();
}, 2000);
}
/**
* デバイスによって取得する要素を変更する
*/
}, {
key: 'getAllElement',
value: function getAllElement() {
if (DATA.isSp) {
this.$images = this.$hero.find('.js-sp');
} else {
this.$images = this.$hero.find('img');
}
}
}, {
key: 'selectElement',
value: function selectElement() {
var $el = this.$images.eq(this.getNum(this.$images.length));
this.outAnim($el);
}
}, {
key: 'outAnim',
value: function outAnim($el) {
var _this2 = this;
TweenMax.to($el.parent(), .35, {
scale: 0,
ease: Back.easeIn.config(1.3),
onComplete: function onComplete() {
_this2.setSrc($el);
}
});
}
}, {
key: 'inAnim',
value: function inAnim($target) {
TweenMax.to($($target).parent(), .5, {
scale: 1,
ease: Power2.easeOut
});
}
/**
* 画像の src を変更する
* @param target {Element}
*/
}, {
key: 'setSrc',
value: function setSrc(target) {
var src = target.attr('src');
var number = 0;
do {
number = this.getNum(this.totalNum + 1);
} while (this.currentNumber === number && number === 0);
this.currentNumber = number;
var path = src.replace(/item\d*/g, 'item' + this.currentNumber);
target.attr('src', path);
}
/**
* 画像を load した時のイベント
*/
}, {
key: 'loadEvent',
value: function loadEvent() {
var _this3 = this;
this.$images.on('load', function (e) {
_this3.checkSize(e.currentTarget);
_this3.inAnim(e.currentTarget);
});
}
/**
* 画像のサイズをチェックして class を付与する
* @param target
*/
}, {
key: 'checkSize',
value: function checkSize(target) {
var $el = $(target);
var height = $el.height();
var width = $el.width();
if (width < height) {
$el.addClass(this.addClassName);
} else {
$el.removeClass(this.addClassName);
}
}
/**
* ランダムな数字を返す
* @param max {number}
* @returns {number}
*/
}, {
key: 'getNum',
value: function getNum(max) {
return Math.trunc(Math.random() * max);
}
// 87
}]);
return heroImages;
}();
/////////////////////////////////
//
// load event
//
/////////////////////////////////
$(window).on('load', function () {
if ($('#js-map').length) {
gMap();
}
heroSlide();
navAction();
//
carouselInit();
actionSpHeader($('.js-navi-trigger'), $('.js-navi'));
new heroImages('#hero');
setTimeout(loaded, 1000);
console.log('ok');
});
};
main();
})(jQuery);<file_sep>/wp-content/themes/nanneco/archive-blog.php
<?php get_header(); ?>
<?php if(have_posts()) : ?>
<?php $postType = get_post_type_object( get_post_type() )->label; ?>
<article class="hero_wrap">
<a class="hero hero--sub f-flex f-middle f-center js-page-scroll" href="#content" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/home/12.jpg)">
<div class="hero_inner" id="js-scroll">
<h1 class="hero_text"><?php echo $postType; ?></h1>
</div>
</a>
</article>
<!-- blog -->
<div id="content">
<?php while(have_posts()): the_post(); ?>
<article class="article">
<div class="article_inner js-fadein-wrap">
<a class="blog_figure f-flex f-bottom f-right" href="<?php the_permalink(); ?>" style="background-image: url(<?php the_post_thumbnail_url(); ?>)">
<time class="blog_time" datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('Y.m.d'); ?></time>
</a>
<div class="blog_content">
<h2 class="h2"><?php the_title(); ?></h2>
<?php the_content(); ?>
</div>
</div>
</article>
<?php endwhile; ?>
<?php
if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
}
?>
</div>
<?php endif; ?>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/footer.php
<footer class="l-footer" id="footer">
<small class="l-footer_copy">© nantokatonecokikaku all rights reserved :)</small>
<p class="l-footer_scroll">
scroll
</p>
<ul class="l-footer_social">
<li class="l-footer_social-item">
<a target="_blank" href="https://www.instagram.com/nannecokikaku/" class="l-footer_social-target">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<title>instagram</title>
<path d="M12,2.16c3.2,0,3.58,0,4.85.07,3.25.15,4.77,1.69,4.92,4.92.06,1.27.07,1.65.07,4.85s0,3.59-.07,4.85c-.15,3.23-1.66,4.77-4.92,4.92-1.27.06-1.64.07-4.85.07s-3.58,0-4.85-.07c-3.26-.15-4.77-1.7-4.92-4.92-.06-1.27-.07-1.64-.07-4.85s0-3.58.07-4.85C2.38,3.92,3.9,2.38,7.15,2.23,8.42,2.18,8.8,2.16,12,2.16ZM12,0C8.74,0,8.33,0,7.05.07c-4.35.2-6.78,2.62-7,7C0,8.33,0,8.74,0,12S0,15.67.07,17c.2,4.36,2.62,6.78,7,7C8.33,24,8.74,24,12,24s3.67,0,4.95-.07c4.35-.2,6.78-2.62,7-7C24,15.67,24,15.26,24,12s0-3.67-.07-4.95c-.2-4.35-2.62-6.78-7-7C15.67,0,15.26,0,12,0Zm0,5.84A6.16,6.16,0,1,0,18.16,12,6.16,6.16,0,0,0,12,5.84ZM12,16a4,4,0,1,1,4-4A4,4,0,0,1,12,16ZM18.41,4.15a1.44,1.44,0,1,0,1.43,1.44A1.44,1.44,0,0,0,18.41,4.15Z"/>
</svg>
</a>
</li>
<li class="l-footer_social-item">
<a target="_blank" href="https://www.facebook.com/otonohapro/" class="l-footer_social-target">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<title>facebook</title>
<path d="M22.68,0H1.33A1.32,1.32,0,0,0,0,1.33V22.68A1.32,1.32,0,0,0,1.33,24H12.82V14.71H9.69V11.08h3.13V8.41c0-3.1,1.89-4.79,4.66-4.79a23.5,23.5,0,0,1,2.79.15V7H18.36c-1.51,0-1.8.71-1.8,1.76v2.32h3.59l-.47,3.62H16.56V24h6.12A1.32,1.32,0,0,0,24,22.67V1.32A1.32,1.32,0,0,0,22.68,0Z"/>
</svg>
</a>
</li>
</ul>
</footer>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCaMtMZbEWlsS-p8i8BwyaIUrnHHSefR-4" async defer></script>
<script src="https://ajaxzip3.github.io/ajaxzip3.js" async defer></script>
<?php wp_footer(); ?>
</body>
</html>
<file_sep>/wp-content/themes/nanneco/archive-contacts.php
<?php get_header(); ?>
<main class="l-main" id="main">
<article class="c-article">
<h1 class="c-h1 u-mb--md">
<div class="c-section_inner">ナントカと猫企画への問い合わせ<i>get in touch</i></div>
</h1>
<?php
if(have_posts()) :
$postType = get_post_type_object( get_post_type() )->label;
?>
<div class="c-section_inner u-mt--ex">
<article class="c-media">
<ul class="f-container">
<?php
while(have_posts()): the_post();
?>
<li class="f-item-sm-12 f-item-md-6 u-mb--md">
<div class="">
<a class="c-btn c-btn--primary f-middle-center" href="<?php the_permalink(); ?>"><?php the_title(); ?><i class="fa fa-paper-plane-o" aria-hidden="true"></i></a>
</div>
</li>
<?php
endwhile;
?>
</ul>
</article>
</div>
<?php
endif;
?>
</article>
</main>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/single.php
<?php get_header(); ?>
<?php
while (have_posts() ): the_post();
?>
<article class="hero_wrap">
<a class="hero hero--sub f-flex f-middle f-center js-page-scroll" href="#content" style="background-image: url(<?php the_post_thumbnail_url(); ?>)">
<div class="hero_inner" id="js-scroll">
<h1 class="hero_text"><?php the_title(); ?></h1>
</div>
</a>
</article>
<!-- blog -->
<div id="content">
<!-- shop -->
<article class="article">
<div class="post f-top f-wrap">
<div class="post_left f-flex f-middle">
<time class="post_time" datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('Y-m-d'); ?></time>
<a target="_blank" class="post_social" href="https://twitter.com/share?url=<?php rawurlencode(the_permalink()); ?>&text=<?php rawurlencode( the_title()); ?> ">T</a><a target="_blank" class="post_social" href="https://www.facebook.com/sharer/sharer.php?u=<?php rawurlencode(the_permalink()); ?>">F</a>
</div>
<div class="post_right btn--arrow_wrap" href="<?php the_permalink(); ?>">
<h3 class="h2 u-text-left"><?php the_title(); ?></h3>
<div class="post_lead">
</div>
<div class="post_body">
<?php the_content(); ?>
</div>
</div>
</div>
<?php
$prev_post = get_previous_post();
$next_post = get_next_post();
?>
<ul class="pager f-flex f-center f-middle">
<li class="pager_item" <?php if (!$prev_post) : ?> style="visibility:hidden;" <?php endif; ?>>
<a href="<?php echo get_permalink($prev_post->ID); ?>" class="pager_target btn--arrow_wrap f-flex f-middle f-center"><span class="btn btn--arrow btn--arrow-prev"></span></a>
</li>
<li class="pager_item pager_item--text">
<a href="<?php echo get_post_type_archive_link( get_post_type() ); ?>" class="pager_target pager_target-text f-flex f-middle f-center">back to list</a>
</li>
<li class="pager_item" <?php if (!$next_post) : ?> style="visibility:hidden;" <?php endif; ?>>
<a href="<?php echo get_permalink($next_post->ID); ?>" class="pager_target btn--arrow_wrap f-flex f-middle f-center"><span class="btn btn--arrow btn--arrow-next"></span></a>
</li>
</ul>
</article>
<?php endwhile; ?>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/home.php
<?php get_header(); ?>
<main class="l-main" id="main">
<div class="hero" id="hero">
<div class="hero__inner">
<ul class="hero__list">
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img js-sp" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item2.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img js-sp hero__img--sm" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item5.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img hero__img--sm" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item4.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item21.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item12.jpg" alt="">
</div>
</li>
</ul>
<div class="hero__center">
<div class="hero__title-area">
<h2 class="hero__title">nantoka to neko project</h2>
<ul class="hero__lead">
<li class="hero__lead-item">すきなことすきなじかんすきなじぶんをみつけるきっかけ</li>
</ul>
</div>
<ul class="hero__buttons">
<li class="hero__button-item">
<a href="#news" class="hero__button hero__button--news js-scroll">news</a>
</li>
<li class="hero__button-item">
<a href="#pickup" class="hero__button hero__button--pickup js-scroll">pickup</a>
</li>
</ul>
</div>
<ul class="hero__list">
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img js-sp hero__img--sm" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item3.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img js-sp" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item1.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item18.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img hero__img--sm" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item7.jpg" alt="">
</div>
</li>
<li class="hero__item">
<div class="hero__item-inner">
<img class="hero__img hero__img--sm" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/hero/item13.jpg" alt="">
</div>
</li>
</ul>
</div>
</div>
<article class="" id="pickup">
<h2 class="c-h2"><span class="c-h2_inner">Pick up Contents <br>ナン猫の注目コンテンツ*︎</span></h2>
<div class="c-section_inner">
<div class="p-home__card-section">
<!--
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/soma.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">4月28日 土曜日 LOVEの「今日ここライブ」が相馬に行くということ。ナントカと猫企画参加決定! </h3>
<p class="c-card_text">
毎年SUNSUNフェスに出演してくれていた、ラブちゃんが開催しているイベント、今日ここにいることIn相馬にミニミニSUNSUNフェスで出張‼︎<br>
</p>
<p class="c-card_text">
詳細は<a href="http://kyokokolive.com/program/workshop/index.html" target="_blank">公式サイト</a>よりアクセス下さい!
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/koukentetsu.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">7月29日 日曜日 コウケンテツ講演会&初✩サイン会 開催決定!</h3>
<p class="c-card_text">
普段はされないサイン会(書籍購入者のみ)を、スペシャルに開催してくださいます!
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/29601723/" target="_blank">ブログ</a>をお読みください!<br>
<a href="https://passmarket.yahoo.co.jp/event/show/detail/013iqazfe9qx.html" target="_blank">《オンラインチケット購入》</a><br>
<a href="https://otonohapro.exblog.jp/29913504/" target="_blank">《メール・電話からのチケット受付》</a>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/nobumi.png)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">7月28日 土曜日 絵本作家のぶみ 講演会 @京都 開催決定‼︎ </h3>
<p class="c-card_text">
親子で楽しめる読み聞かせ講演会!講演会終了後には、絵本購入者に似顔絵付きのサイン会も! <br>
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/29179226/" target="_blank">ブログ</a>をお読みください!<br>
<a href="https://passmarket.yahoo.co.jp/event/show/detail/0162dwzg55c1.html" target="_blank">《オンラインチケット購入》</a><br>
<a href="https://otonohapro.exblog.jp/29911629/" target="_blank">《メール・電話からのチケット受付》</a>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/yamakami.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">5月28日 月曜日より連続講座スタート!【ナン猫企画、野口整体 山上亮のお手当部】</h3>
<p class="c-card_text">
『春、夏、秋、冬の会』@吹田モモの家!!
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/29895312/" target="_blank">ブログ</a>をお読みください!<br>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/tozantoyoga_201812.jpg)"></figure>
<div class="c-card">
<div class="c-card_textarea">
<h3 class="c-card_title">もみじの森の登山とヨガに出かけませんか。</h3>
<p class="c-card_text">
◎秋の紅葉を楽しみたい方<br>
◎野外のヨガを楽しみたい方<br>
◎運動不足を解消したい方
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/30140689/" target="_blank">ブログ</a>をお読みください!
</p>
</div>
</div>
-->
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/summer3.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">ナン猫夏休み企画第1弾 【絵本作家のぶみさんとあそぼう!】@イオンモール京都桂川</h3>
<p class="c-card_text">
「ママがおばけになっちゃった!」NHK Eテレで放送中の「うちのウッチョパス」「しんかんくんシリーズ」など、これまで200作以上の絵本を生み出された大人気作家のぶみさんが今年も京都で、読み聞かせや体を使ったワークショップ、絵本作家さんならではの似顔絵サイン会&写真撮影を開催します!
</p>
<p class="c-card_text">
チケットのご購入は<a href="https://passmarket.yahoo.co.jp/event/show/detail/01bx6r108yai6.html" target="_blank">パスマーケットのサイト</a>よりお願いいたします。
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/summer2.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">ナン猫夏休み企画第2弾 武田双雲講演会『自分を表現するとは〜書道を教えない書道教室〜』@イオンモール京都桂川</h3>
<p class="c-card_text">
書道を通して双雲氏の見てこられた日本の文化や言葉の力を通して自由に自分を表現することの楽しみや、素晴らしさをお話いただき、自信を身につける事へのきっかけや、生きづらさを感じる人が、自分でいる事を表現出来る勇気や機会がどんどん広がるきっかけとなりますように。
</p>
<p class="c-card_text">
チケット販売は <a href="https://passmarket.yahoo.co.jp/event/show/detail/01e9fx1032f44.html" target="_blank">パスマーケットのサイト</a>よりお願いいたします。
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/noguchiseitai_20190119_2.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">ナントカと猫企画 x ️山上亮の野口整体お手当部【魔女修行の第一歩】@吹田モモの家</h3>
<p class="c-card_text">
みんな誰もが当たり前に持っている'感覚で生きる能力'を思い出す事が出来るような、みんなが魔法を使える手を、からだを取り戻せるきっかけになりますように!
毎回違った内容で学ぶ連続講座ですが、単発の受講もOKです。
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/30301653/" target="_blank">ブログ</a>をお読みください!<br>
</p>
</div>
</div>
<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/noguchiseitai_20190119_1.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">ナントカと猫企画 x 山上亮の野口整体季節のからだのお手当部 @交野市きさいち邸産巣日</h3>
<p class="c-card_text">
昨年、吹田モモの家で、家庭やご自身の施術にも生かしやすいと大好評だった季節のお手当編が大阪交野市での講座に再登場!
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/30301670/" target="_blank">ブログ</a>をお読みください!<br>
</p>
</div>
</div>
<!--<div class="c-card">
<figure class="c-card_figure" style="background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/images/event/noguchiseitai_201901.jpg)"></figure>
<div class="c-card_textarea">
<h3 class="c-card_title">野口整体集中講座〜基本編〜 全2回 開催決定!</h3>
<p class="c-card_text">
セラピストさんなど、ご自身の施術に活かしたい、また野口整体を知り、深めたい方へのプロ講座です。
</p>
<p class="c-card_text">
詳細は<a href="https://otonohapro.exblog.jp/30044465/" target="_blank">ブログ</a>をお読みください!<br>
<a href="https://www.kokuchpro.com/event/5bea935c0cee03864bbd49e6a52e9837/" target="_blank">《オンラインチケット購入》</a>
</p>
</div>
</div>-->
</div>
</div>
</article>
<!-- <div class="c-section_inner">-->
<!-- <p class="c-h2 u-mb--lg"><span class="c-h2_inner">ナン猫の企業研修</span></p>-->
<!---->
<!-- <article class="c-media">-->
<!-- <p class="c-article_text">企業で働く人材のヘルスサポートいたします。<br>詳細は準備中です。</p>-->
<!-- </article>-->
<!---->
<!-- </div>-->
<?php
$args = array(
'post_type' => array( 'post' ),
'posts_per_page' => '8'
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
?>
<div class="p-home__news" id="news">
<article class="c-section_inner">
<h2 class="c-h2 u-mb--lg"><span class="c-h2_inner">nan-neco news</span></h2>
<ul class="c-tab_list">
<?php
while ( $my_query->have_posts() ) {
$my_query->the_post(); ?>
<li class="c-tab_item">
<time class="c-tab_time"
datetime="<?php the_time( 'Y-m-d' ); ?>"><?php echo get_post_time( 'Y.m.d (D)' ); ?></time>
<h3 class="c-tab_title c-h3">
<div class="c-h3_inner"><?php the_title(); ?></div>
</h3>
<button class="c-btn c-btn--toggle js-dropdown-trigger"></button>
<div class="c-tab_textarea js-dropdown-item">
<?php
$img = get_the_post_thumbnail_url();
if ( $img ) {
?>
<div class="f-container f-middle">
<div class="f-item-md-4 f-item-sm-3 f-item-xs-12">
<figure class="c-tab_figure">
<img src="<?php echo esc_attr( $img ); ?>" alt="">
</figure>
</div>
<div class="f-item-md-8 f-item-sm-9 f-item-xs-12">
<div class="c-article_text">
<div class="c-article_bg">
<?php the_content(); ?>
</div>
</div>
</div>
<?php } else { ?>
<div class="c-article_text">
<div class="c-article_bg">
<?php the_content(); ?>
</div>
</div>
<?php } ?>
</div>
</li>
<?php
}
?>
</ul>
<!-- <p class="u-mt--lg">-->
<!-- <a class="c-btn c-btn--primary f-middle f-in-flex" href="https://www.facebook.com/otonohapro/" target="_blank">ナン猫-->
<!-- facebook ページ</a>-->
<!-- </p>-->
</article>
</div>
<?php } ?>
</article>
</main>
<?php get_footer(); ?>
<file_sep>/wp-content/themes/nanneco/page-profile.php
<?php get_header(); ?>
<article class="hero_wrap">
<a class="hero hero--sub f-flex f-middle f-center js-page-scroll" href="#content" style="background-image: url(<?php echo get_stylesheet_directory_uri();?>/assets/images/home/06.jpg)">
<div class="hero_inner" id="js-scroll">
<h1 class="hero_text">profile</h1>
</div>
</a>
</article>
<article class="article" id="content">
<div class="article_inner js-fadein-wrap">
<h2 class="h2">お気に入りの碧<br>ー<br>《 okiniirinoao 》</h2>
<div class="profile">
<p class="profile_text">高校時代に出会った臼井優斗、ヒラシマユウの2人を発端とするユニット。<br>
「(a) platonic chou-chou atelier」名義での活動に2013年末に区切りを付け、屋号を「お気に入りの碧」と改めました。<br>
音楽活動と木工家具製作を行っています。</p>
<figure class="profile_icon js-fadein-wrap">
<svg class="js-fadein-item" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
<title>okiniirinoao icon</title>
<g>
<rect class="a" width="1000" height="1000"/>
<polygon class="b" points="300.5 370.6 150.5 630.4 450.5 630.4 300.5 370.6"/>
<circle class="b" cx="688" cy="492.9" r="137.5"/>
</g>
</svg>
</figure>
<section class="profile_section">
<h3 class="profile_title">臼井 優斗 《 usui uto 》</h3>
<p class="profile_text">guitar / voice<br>
1989.3.28 広島生まれ奈良育ち<br>
できる: ウェブデザイン 音響エンジニア 写真撮影<br>
できない: 習字 お絵描き<br>
すき: 宇多田ヒカル 伊集院光 指輪物語<br>
にがて: ねばりのある食べ物</p>
</section>
<section class="profile_section">
<h3 class="profile_title">ヒラシマユウ《 hirashima yu 》</h3>
<p class="profile_text">sound produce<br>
1988.2.25 奈良生まれ奈良育ち<br>
できる: 音響エンジニアをはじめとするライブやイベントに関わる様々な事<br>
できない: ボールが飛んでくるスポーツ<br>
すき: 可愛いもの、美しいもの<br>
にがて: ブロッコリーと千枚漬け</p>
</section>
</div>
</div>
</article>
</div>
<?php get_footer(); ?>
| 5631ac99d8798ffa4d67a056d66c1ccea117fbe9 | [
"Markdown",
"JavaScript",
"PHP"
] | 18 | PHP | uto-usui/nan-neco | a279f9591866d04fcfa16a8b3889f206f29832b8 | f9593a0ea39dd3f03679874b819b34eca1bd212f |
refs/heads/master | <file_sep># тяαν ιт
A social network only for travelers
Hello! This a social network for people that love travel...like me!
In this app you can share all your experience, tips, etc.
This is the demo, i am still developing some cool staff for this, this projects begin as a twitter demo but now it will finish as a social network
## Getting Started
In this project, we can see:
* POO
* Firebase
## You can see the app!!

This is the database which contains all the information

<file_sep>package com.example.diego.mytwitter
/**
* Created by diego on 7/01/18.
*/
class PostInfo
{
var userUID:String?=null
var textPost:String?=null
var image:String?=null
constructor(userUID:String, textPost:String, image:String)
{
this.userUID = userUID
this.textPost = textPost
this.image = image
}
} | 7cf3820310e9c73d4b0ef10f8705f42b94791c97 | [
"Markdown",
"Kotlin"
] | 2 | Markdown | Diegitsen/TravIt | e18a3b4662c2cc3a3920194e08c9b8bda48ddc54 | 7e80ab056251d531011718aea8eb5e9d126174e3 |
refs/heads/master | <file_sep>const BASE_URL = window.location.hostname.includes('localhost')
? 'http://localhost:3300'
: 'https://nihonflix.herokuapp.com';
export default { BASE_URL };
<file_sep>import React, { useState } from 'react';
import { Link, useHistory } from 'react-router-dom';
import PageDefault from '../../../components/PageDefault';
import FormField from '../../../components/FormField';
import Button from '../../../components/Button';
import useForm from '../../../hooks/useForm';
import categoriesRepository from '../../../repositories/categories';
function RegisterCategory(){
const initialValues = {
title: '',
description:'',
color: ''
}
const { handleChange, values, clearForm } = useForm(initialValues)
const history = useHistory();
function handleSubmit(e){
e.preventDefault();
categoriesRepository.create({
title: values.title,
description: values.description,
color: values.color
}).then(() => {
history.push('/')
})
clearForm(initialValues)
}
return(
<PageDefault>
<h1>Cadastro de Categoria: {values.title}</h1>
<form onSubmit={handleSubmit}>
<FormField label="Título: " type="text" name="title" value={values.title} onChange={handleChange}/>
<FormField label="Descrição: " type="textarea" name="description" value={values.description} onChange={handleChange}/>
<FormField label="Cor: " type="color" name="color" value={values.color} onChange={handleChange} />
<Button>
Cadastrar
</Button>
</form>
<Link to="/">
Ir para home
</Link>
</PageDefault>
);
}
export default RegisterCategory;<file_sep># Imers-o-React-Aluraflix<file_sep>import config from '../config'
const URL_VIDEOS = `${config.BASE_URL}/videos`
function create(videoObject){
return fetch(`${URL_VIDEOS}`, {
method: 'POST',
headers:{
'Content-type': 'application/json'
},
body: JSON.stringify(videoObject)
})
.then(async (serverResponse) => {
if(serverResponse.ok){
const res = await serverResponse.json();
return res;
}
throw new Error('Error to get datas.');
});
}
export default {
create
}<file_sep>import React from 'react';
import logo from '../../assets/img/logo.png'
import { FooterBase } from './styles';
function Footer() {
return (
<FooterBase>
<img src={logo} alt="Logo" />
<p>
Criado por <a href="https://www.linkedin.com/in/bruno-barbosa-35294718a/" target="_blank" rel="noopener noreferrer"><NAME></a>
{' '} durante a Imersão React da Alura
</p>
</FooterBase>
);
}
export default Footer;
| cd07e0128184550a96598da5032767b93ecdcfb5 | [
"JavaScript",
"Markdown"
] | 5 | JavaScript | brunocbarbosa/nihonflix | 80bf2aabba90401fbcdbe6247c95e1781cc23a55 | eb6e42efa356cf6c2882f11adbd6de869d6f25fd |
refs/heads/master | <file_sep>#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <dos.h>
#include <fstream.h>
struct cand
{
char cname[40];
int votes;
char cls[5];
};
struct post
{
char pname[30];
post *link;
cand *clist[20];
int cno;
};
post *top = NULL;
void newpost()
{
post *temp = new post;
post *save;
cout << "Enter name of post:" << endl;
gets(temp->pname);
(temp->link) = NULL;
(temp->cno) = 0;
for (int i = 0; i < 20; i++)
(temp->clist[i]) = NULL;
if (top == NULL)
top = temp;
else
{
save = top;
top = temp;
(temp->link) = save;
}
cout << "Post added\n\n";
}
void newcand()
{
cand *newc = new cand;
char p[30];
post *temp;
temp = top;
cout << "Enter the name of the candidate:" << endl;
gets(newc->cname);
cout << "Enter the class of the candidate (eg:10c):" << endl;
gets(newc->cls);
(newc->votes) = 0;
cout << "Enter the post that the candidate is competing for:" << endl;
gets(p);
while ((temp != NULL) && (strcmpi(p, (temp->pname)) != 0))
{
temp = (temp->link);
}
if (temp == NULL)
cout << "Post not found\n";
else
{
(temp->clist[(temp->cno)]) = newc;
(temp->cno)++;
cout << "Candidate added\n";
}
cout << endl;
}
void pdisp()
{
post *temp;
temp = top;
int i = 1, flag = 0;
while (temp != NULL)
{
cout << "Post " << i << ':' << (temp->pname) << endl;
temp = (temp->link);
i++;
flag = 1;
}
if (flag == 0)
cout << "No posts found\n";
cout << endl;
}
void cdisp()
{
char p[30];
post *temp;
temp = top;
cout << "Please enter the post of the candidate\n";
gets(p);
while ((temp != NULL) && (strcmpi(p, (temp->pname)) != 0))
{
temp = (temp->link);
}
if (temp == NULL)
cout << "Post not found\n";
else
{
for (int i = 0; i < (temp->cno); i++)
{
cout << "Candidate " << (i + 1) << ":\nName:" << (temp->clist[i] - > cname) << "\nClass:" << (temp->clist[i] - > cls) << "\nVotes:" << (temp->clist[i] - > votes) << "\n\n";
}
}
cout << endl;
}
void vote()
{
post *temp;
temp = top;
int ch, flag = 0;
while (temp != NULL)
{
flag = 1;
cout << "Post:\n"
<< (temp->pname) << endl;
for (int i = 0; i < (temp->cno); i++)
{
cout << "Candidate " << (i + 1) << ":\nName:" << (temp->clist[i] - > cname) << "\tClass:" << (temp->clist[i]->cls) << endl;
}
cout << "Enter your choice:\n";
cin >> ch;
for (i = 0; i < (temp->cno); i++)
{
if ((i + 1) == ch)
(temp->clist[i]->votes)++;
}
temp = (temp->link);
cout << "Vote casted\n\n";
}
if (flag == 0)
cout << "No posts found\n\n";
}
void winner()
{
post *temp;
temp = top;
int highest = 0, flag = 0;
while (temp != NULL)
{
flag = 1;
cout << "Post:\n"
<< (temp->pname) << endl;
for (int i = 0; i < (temp->cno); i++)
{
if (highest < (temp->clist[i]->votes))
highest = (temp->clist[i]->votes);
}
for (i = 0; i < (temp->cno); i++)
{
if (highest == (temp->clist[i]->votes))
cout << "Winner is:" << (temp->clist[i]->cname) << "\tFrom class:" << (temp - > clist[i]->cls) << endl;
}
temp = (temp->link);
cout << endl;
}
if (flag == 0)
cout << "No posts found\n\n";
}
void pdel()
{
char p[30];
int flag = 0;
cout << "Enter name of post to be deleted\n";
gets(p);
post *temp, *save;
temp = top;
while (temp != NULL)
{
flag = 1;
if (strcmpi(p, (temp->link->pname)) == 0)
{
save = (temp->link);
(temp->link) = (temp->link->link);
for (int i = 0; i < (save->cno); i++)
delete (save->clist[i]);
delete save;
cout << "The post and all its candidates were deleted\n\n";
goto lab3;
}
}
if (flag == 0)
cout << "No posts found\n\n";
lab3:
}
void cdel()
{
post *temp;
temp = top;
int i, flag = 0, flag1 = 0;
char p[40];
cout << "Enter candidate to be removed\n";
gets(p);
while (temp != NULL)
{
flag = 1;
for (i = 0; i < (temp->cno); i++)
{
if (strcmpi(p, (temp->clist[i]->cname)) == 0)
{
delete (temp->clist[i]);
(temp->cno)--;
cout << "Candidate deleted\n\n";
flag1 = 1;
goto lab1;
}
}
}
if (flag == 0)
cout << "No posts found\n";
if (flag1 == 0)
cout << "No candidates found\n\n";
lab1:
}
void store()
{
fstream fout;
post *temp = top;
fout.open("Votes.DAT", ios::out | ios::binary);
while (temp != NULL)
{
fout.write((char *)temp, sizeof(post));
for (int i = 0; i < (temp->cno); i++)
{
fout.write((char *)temp->clist[i], sizeof(cand));
}
temp = temp->link;
}
fout.close();
}
void main()
{
clrscr();
int ch1, ch2, ch6;
char ch3 = 'y', ch4 = 'y', ch5 = 'y', ch7 = 'y', ch8 = 'y';
char pw[20], pc[20];
cout<<"WELCOME TO THE PSBS VOTING PROGRAM\nBy Raunak, Sharon and
Parth\n(Loading";
delay(1000); cout<<'.'; delay(1000); cout<<'.'; delay(1000); cout<<".)"; delay(1000);
cout<<"\nSet new admin password:\n";
gets(pw);
while(ch7=='y'||ch7=='Y')
{
clrscr();
set:
cout << "Are you an Administrator(1) or a Voter(2)? (1/2)\nPress 3 to exit\n";
cin >> ch1;
switch (ch1)
{
case 1:
cout << "Enter password (case sensitive):\n";
gets(pc);
if (strcmp(pc, pw) != 0)
{
cout << "Wrong password\n";
goto lab2;
}
else
{
ch4 = 'y';
while (ch4 == 'y' || ch4 == 'Y')
{
clrscr();
cout<< "Would you like to:\n"
<< "1:Enter new posts\n";
cout<<" 2:Enter new candidate (Warning: Need to enter post of candidate
beforehand, Max 20 per post)\n";
cout<<" 3:List all posts\n"
<<" 4:List all candidates for a particular post\n";
cout<< "5:Show the winner of every post\n"
<< "6:Delete a
post\n "
<<" 7 : Delete a candidate\n ";
cout<< "8:Return to welcome screen\n";
cout<< "9:Save and exit\n";
cin >> ch2;
switch (ch2)
{
case 1:
clrscr();
newpost();
break;
case 2:
clrscr();
newcand();
break;
case 3:
clrscr();
pdisp();
break;
case 4:
clrscr();
ch3 = 'y';
while (ch3 == 'y' || ch3 == 'Y')
{
clrscr();
cdisp();
cout << "Would you like to check candidate list for a different
post
? (y / n)\n ";
cin >>
ch3;
}
cout << endl;
break;
case 5:
clrscr();
winner();
break;
case 6:
clrscr();
pdel();
break;
case 7:
clrscr();
cdel();
break;
case 8:
clrscr();
goto set;
break;
case 9:
goto lab;
break;
default:
cout << "Invalid choice\n\n";
break;
}
cout << "Would you like to return to Administrator Main Menu? (y/n)\n";
cin >> ch4;
}
cout << endl;
}
break;
case 2:
ch5 = 'y';
while (ch5 == 'y' || ch5 == 'Y')
{
clrscr();
cout << "Would you like to:\n"
<< "1:List all posts\n";
cout << "2:List all candidates for a post\n";
cout << "3:Vote for a candidate for each post\n";
cout << "4:Return to welcome screen\n"
<< "5:Save and exit\n";
cin >> ch6;
switch (ch6)
{
case 1:
clrscr();
pdisp();
break;
case 2:
clrscr();
ch8 = 'y';
while (ch8 == 'y' || ch8 == 'Y')
{
clrscr();
cdisp();
cout << "Would you like to check candidate list for a different post?
(y / n)\n ";
cin >>
ch8;
}
cout << endl;
break;
case 3:
clrscr();
vote();
break;
case 4:
clrscr();
goto set;
break;
case 5:
goto lab;
break;
default:
cout << "Invalid choice\n\n";
break;
}
cout << "Would you like to return to Voter main menu? (y/n)\n";
cin >> ch5;
}
cout << endl;
break;
case 3:
goto lab;
break;
default:
cout << "Invalid choice\n\n";
}
lab2:
cout << "Would you like to return to the main menu? (y/n)\n";
cin >> ch7;
cout << endl;
}
lab:
clrscr();
store();
getch();
}<file_sep># Presidency Vote
A Terminal UI for a Completely Flexible and Dynamic Online Voting System for Student Representative Elections at Presidency School Bangalore South. <br/>
Implementation includes a Custom 2D Linked List Stack-like implementation. <br/>
Report includes detailed description of project. <br/>
Last Modified: Dec 2016 <br/> <br/>
Contributors: <NAME>, <NAME>, <NAME>
| b0d75695d769c8462514a9c8503e72ecacddba93 | [
"Markdown",
"C++"
] | 2 | C++ | Parth8/PresidencyVote | 73ee049c841114d1a8419c571fb2235b13fd5c2b | fce145d84ad550f6b44e912adf2cf7168dbcebdd |
refs/heads/master | <repo_name>PedroHLC/Bukkit_WinClassPriority<file_sep>/src/com/pedrohlc/winclasspriority/Kernel32.java
package com.pedrohlc.winclasspriority;
import com.sun.jna.Native;
import com.sun.jna.win32.StdCallLibrary;
public interface Kernel32 extends StdCallLibrary {
Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
public static final int ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000,
BELOW_NORMAL_PRIORITY_CLASS = 0x00004000,
HIGH_PRIORITY_CLASS = 0x00000080,
IDLE_PRIORITY_CLASS = 0x00000040,
NORMAL_PRIORITY_CLASS = 0x00000020,
PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000,
PROCESS_MODE_BACKGROUND_END = 0x00200000,
REALTIME_PRIORITY_CLASS = 0x00000100;
boolean SetPriorityClass(int hProcess, int dwPriorityClass);
int GetCurrentProcess();
int GetLastError();
}
| 9f7f483077fa2e038bdc186d5676ec150ae6f039 | [
"Java"
] | 1 | Java | PedroHLC/Bukkit_WinClassPriority | 8062523670135f90f9e7643a80414fd296408cf5 | 09d9123584df45a7dc6d13a80f8d18ffbcc06412 |
refs/heads/master | <repo_name>radoAngelov/Python-Training<file_sep>/week01/diveinpython.py
from firstday import palindrome
def is_number_balanced(n):
array_numbers = [int(x) for x in str(n)]
if len(str(n)) == 1:
return True
else:
if len(str(n)) % 2 == 1:
if sum(array_numbers[0:int(len(array_numbers) / 2)]) == sum(array_numbers[int(len(array_numbers) / 2 + 1):len(array_numbers)]):
return True
else:
return False
else:
if sum(array_numbers[0:int(len(array_numbers) / 2)]) == sum(array_numbers[int(len(array_numbers) / 2):len(array_numbers)]):
return True
else:
return False
def is_increasing(seq):
i = 0
for _ in range(len(seq) - 1):
if seq[i] >= seq[i + 1]:
return False
i += 1
return True
def is_decreasing(seq):
i = 0
for _ in range(len(seq) - 1):
if seq[i] <= seq[i + 1]:
return False
i += 1
return True
def prime_numbers(n):
result = [x for x in range(2, n + 1) if x % 2 != 0 and
x % 3 != 0 and x % 5 != 0 and x % 7 != 0 or x in [2, 3, 5, 7]]
return result
def is_anagram(a, b):
if len(a) != len(b):
return False
for x in a:
if x not in b:
return False
else:
b = b.replace('x', "")
return True
def birthday_ranges(birthdays, ranges):
result = []
for i in ranges:
counter = 0
for x in birthdays:
if x >= i[0] and x <= i[1]:
counter += 1
result.append(counter)
return result
def sum_matrix(m):
sums = [sum(x) for x in m]
return sum(sums)
def get_largest_palindrome(n):
n = n - 1
while not palindrome(n):
n -= 1
return n
def is_transversal(transversal, family):
dictionary = {}
for i in transversal:
for j in family:
if i in j:
dictionary[i] = j
for i in transversal:
if i not in dictionary.keys():
return False
return True
def matrix_bombing_plan(m):
matrix_dict, rows, cols = {}, 0, 0
for i in m:
rows += 1
cols = 0
for j in i:
cols += 1
matrix_dict[(m.index(i), i.index(j))] = j
result = {}
for x in matrix_dict:
result[x] = sum(matrix_dict.values())
for k1, k2 in result:
if k1 - 1 >= 0:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1 - 1, k2)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k2 - 1 >= 0:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1, k2 - 1)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k1 - 1 >= 0 and k2 - 1 >= 0:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1 - 1, k2 - 1)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k1 + 1 < rows:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1 + 1, k2)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k2 + 1 < cols:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1, k2 + 1)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k1 + 1 < rows and k2 + 1 < cols:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1 + 1, k2 + 1)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k1 + 1 < rows and k2 - 1 >= 0:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1 + 1, k2 - 1)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
if k1 - 1 >= 0 and k2 + 1 < cols:
result[(k1, k2)] = result[(k1, k2)] - matrix_dict[(k1 - 1, k2 + 1)]
if result[(k1, k2)] < 0:
result[(k1, k2)] = 0
return(result)<file_sep>/week01/final_round.py
def count_words(arr):
words_counter = {}
for word in arr:
if word not in words_counter.keys():
words_counter[word] = arr.count(word)
return words_counter
def nan_expand(times):
sentence = ""
for _ in range(times):
sentence = sentence + "Not a "
if sentence is not "":
return sentence + "NaN"
return sentence
def iterations_of_nan_expand(expanded):
reps = expanded.count('Not a ')
expanded = expanded.replace("Not a ", "", reps)
if expanded == 'NaN':
return reps
else:
return False
def group(arr):
single_group, all_groups = [], []
for number in range(len(arr) - 1):
single_group.append(arr[number])
if arr[number + 1] != single_group[0]:
all_groups.append(single_group)
single_group = []
if arr[-1] == all_groups[-1][0]:
all_groups[-1].append(arr[-1])
else:
all_groups.append([arr[-1]])
return all_groups<file_sep>/README.md
# Python-Training
I'm interested in python and its frameworks so I will try to solve the problems that HackBulgaria course gave to its students.
<file_sep>/week01/firstday.py
def sum_of_digits(n):
result = 0
for i in str(n):
if i == '-':
pass
else:
result += int(i)
return result
def sum_of_digits_better(n):
digits = [int(i) for i in str(n) if not i == '-']
return sum(digits)
def to_digits(n):
a = []
for x in str(n):
a.append(int(x))
return a
def to_digits_better(n):
array = [int(x) for x in str(n)]
return array
def to_number(digits):
string = ""
for x in digits:
string += str(x)
number = int(string)
return number
def to_number_better(digits):
numbers = [str(x) for x in digits]
return "".join(numbers)
def fact_digit(n):
result = 0
for x in str(n):
fact = 1
for i in range(1, int(x) + 1):
fact *= i
result += fact
return result
def fibonacci(n):
result = []
temp = 0
if n > 0:
if n == 1:
result.append(1)
else:
result.append(1)
result.append(1)
for _ in range(n-2):
temp = result[-2] + result[-1]
result.append(temp)
return result
else:
print("Enter positive number.")
def fib_number(n):
result = ""
first, second, temp = 1, 1, 0
if n > 0:
if n == 1:
result = result + "1"
else:
result = result + "11"
for _ in range(n - 2):
temp = first + second
first = second
second = temp
result = result + str(temp)
return result
else:
print("Enter positive number.")
def palindrome(obj):
array_of_digits = [x for x in str(obj)]
for _ in range(int(len(str(obj)) / 2)):
if array_of_digits[0] != array_of_digits[-1]:
return False
else:
array_of_digits.remove(array_of_digits[0])
array_of_digits.pop()
return True
def count_vowels(str):
counter = 0
for i in str:
if i in 'aeiouy':
counter += 1
return counter
def count_vowels_better(str):
matches = ['match' for x in str if x in 'aeiouy']
return matches.count('match')
def count_consonants(str):
counter = 0
for i in str:
if i not in ' aeiouy1234567890!@#$%^&*().,:"'';|\/?':
counter += 1
return counter
def count_consonants_better(str):
matches = ['match' for x in str if x not in ' aeiouy1234567890!@#$%^&*().,:;|?\/']
return matches.count('match')
def char_histogram(string):
dictionary = {}
for i in string:
dictionary[i] = string.count(i)
for _ in range(string.count(i)):
string.replace(i, "")
return dictionary | e61677b13cc16502fd7db197f2f899ff09a026d8 | [
"Markdown",
"Python"
] | 4 | Python | radoAngelov/Python-Training | c2862fd03f20a90b28533f17f1a171418720d322 | 2f950f4a1d171ae044c0fb8b61862ab0df45b4d4 |
refs/heads/master | <file_sep>package com.bridgelabz.greetingapp.controller;
import com.bridgelabz.greetingapp.dto.UserDTO;
import com.bridgelabz.greetingapp.exception.GreetingAppException;
import com.bridgelabz.greetingapp.service.GreetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/greeting")
public class GreetingController {
@Autowired
GreetingService greetingService;
@RequestMapping(value = {"/", "", "/home"})
public String sayHello() {
return greetingService.sayHello();
}
@GetMapping("/getGreeting")
public String greeting(@RequestParam(value = "name", defaultValue = "world") String name) {
return greetingService.getMessage(name);
}
@PutMapping("/putParam")
public String putGreeting(@RequestParam(value = "firstName") String firstName, @RequestParam(value = "lastName") String lastName) {
return greetingService.getGreetingByParameter(firstName, lastName);
}
@PostMapping("/create")
public UserDTO saveGreeting(@RequestBody UserDTO greetingDTO) {
return greetingService.saveGreeting(greetingDTO);
}
@GetMapping("/greetings/{id}")
public UserDTO getGreetingById(@PathVariable Long id) throws GreetingAppException {
return greetingService.getGreetingByID(id);
}
@GetMapping("/greetings")
public List getAllGreetings() {
return greetingService.getAllGreetings();
}
@DeleteMapping("/deleteGreeting/{id}")
public String deleteGreeting(@PathVariable Long id) {
return greetingService.deleteGreeting(id);
}
}
<file_sep>server.port=8080
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/greeting
spring.datasource.username=root
spring.datasource.password=<PASSWORD>
spring.jpa.database-platform=org.hibernate.dialect.HSQLDialect
spring.jpa.show-sql=true<file_sep>package com.bridgelabz.greetingapp.service;
import com.bridgelabz.greetingapp.dto.UserDTO;
import com.bridgelabz.greetingapp.exception.GreetingAppException;
import com.bridgelabz.greetingapp.model.Greeting;
import com.bridgelabz.greetingapp.repository.GreetingRepository;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GreetingService {
@Autowired
GreetingRepository greetingRepository;
@Autowired
ModelMapper modelMapper;
public String getMessage(String name) {
return "Hello" + name;
}
public String getGreetingByParameter(String firstName, String lastName) {
return "Hello" + firstName + " " + lastName;
}
public String sayHello() {
return "Hello World";
}
public UserDTO saveGreeting(UserDTO greetingDTO) {
greetingDTO.setGreetingMessage("Hello " + greetingDTO.getFirstName() + " " + greetingDTO.getLastName());
Greeting greeting = modelMapper.map(greetingDTO, Greeting.class);
greetingRepository.save(greeting);
greetingDTO.setId(greeting.getId());
return greetingDTO;
}
public UserDTO getGreetingByID(Long id) throws GreetingAppException {
Greeting greeting = greetingRepository.getOne(id);
if (greeting == null)
throw new GreetingAppException(GreetingAppException.ExceptionType.DATA_NOT_FOUND,"DATA NOT FOUND");
UserDTO userDTO = modelMapper.map(greeting, UserDTO.class);
return userDTO;
}
public List getAllGreetings() {
return greetingRepository.findAll();
}
public String deleteGreeting(Long id) {
greetingRepository.deleteById(id);
return "Greeting id: " + id + " get deleted..";
}
}
| 673dede2e483d9b785a46d5f6a3c463e7697dd89 | [
"Java",
"INI"
] | 3 | Java | revatitekale/SpringGreetingAppDevelopment | dcb1a223a90194143df1a50b960eacc56b7fc5ec | f59123f9ce860c2c68fe18668899e6ad7b065626 |
refs/heads/master | <file_sep>using System;
using System.Threading.Tasks;
using System.IO;
using System.Net.Http;
using System.Net;
using System.Diagnostics;
using Newtonsoft.Json.Linq;
namespace GLR_Updater {
class Updater {
private string dataPath = Environment.ExpandEnvironmentVariables("%localappdata%/GLR_Manager/");
private string downloadURL = "https://github.com/ImaniiTy/GreenLuma-Reborn-Manager/releases/download/v{0}/GreenLuma.Reborn.Manager.zip";
private string latestVersionString;
private string currentVersionString;
private StreamWriter logger = Utils.CreateLogger();
public async Task IsUpdated() {
try {
this.latestVersionString = await Utils.GetLatest();
} catch (Exception e) {
PrintError(e.StackTrace, "Error while trying to get the last version.");
return;
}
try {
var configJSON = File.ReadAllText(dataPath + "config.json");
this.currentVersionString = (string)JObject.Parse(configJSON)["version"];
} catch (Exception e) {
return;
}
var currentVersion = new Version(this.currentVersionString);
var latestVersion = new Version(this.latestVersionString);
if (currentVersion.CompareTo(latestVersion) < 0) {
Console.WriteLine("Outdated");
foreach (var process in Process.GetProcessesByName("GreenLuma Reborn Manager")) {
if(!process.HasExited) {
process.Kill();
}
}
while (Process.GetProcessesByName("GreenLuma Reborn Manager").Length > 0) {
System.Threading.Thread.Sleep(500);
}
try {
Console.WriteLine("Downloading Latest Version...");
await Utils.DownloadAndExtractFile(String.Format(this.downloadURL, this.latestVersionString));
} catch (WebException e) {
PrintError(e.StackTrace, "Error while downloading.");
} catch (Exception e) {
PrintError(e.StackTrace, "Error while extracting.");
}
} else {
Console.WriteLine("The Program is Up to date");
}
}
private void PrintError(string stack, string mesage) {
Console.WriteLine(mesage);
this.logger.WriteLine(stack);
Console.WriteLine("Press any key to close...");
Console.ReadLine();
}
}
}
<file_sep>using System;
namespace GLR_Updater {
class Program {
static void Main(string[] args) {
var updater = new Updater();
updater.IsUpdated().Wait();
}
}
}
<file_sep>from Qt.gui import Ui_MainWindow
from PyQt5.QtWidgets import QMainWindow, QHeaderView, QTableWidgetItem, QShortcut, QListWidget, QTableView
from PyQt5.QtCore import QAbstractItemModel, Qt, QModelIndex, QVariant, QThread, QEvent, pyqtSignal, QAbstractTableModel, QSortFilterProxyModel
from PyQt5.QtGui import QKeySequence, QIcon
from shutil import copyfile
import core
import subprocess
import psutil
import fileinput
profile_manager = core.ProfileManager()
games = []
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow,self).__init__()
self.main_window = Ui_MainWindow()
self.main_window.setupUi(self)
self.setup()
self.connect_components()
self.search_thread = SearchThread("")
def setup(self):
self.setWindowIcon(QIcon("icon.ico"))
# Hidde Other Windows
self.main_window.profile_create_window.setHidden(True)
self.main_window.searching_frame.setHidden(True)
self.main_window.set_steam_path_window.setHidden(True)
self.main_window.closing_steam.setHidden(True)
self.main_window.generic_popup.setHidden(True)
self.main_window.settings_window.setHidden(True)
#-------
self.main_window.version_label.setText("v{0}".format(core.CURRENT_VERSION))
self.main_window.no_hook_checkbox.setChecked(core.config.no_hook)
self.main_window.compatibility_mode_checkbox.setChecked(core.config.compatibility_mode)
self.populate_list(self.main_window.games_list, games)
self.main_window.games_list.dropEvent = self.drop_event_handler
self.populate_table(self.main_window.search_result)
self.show_profile_names()
self.show_profile_games(profile_manager.profiles[self.main_window.profile_selector.currentText()])
self.setup_steam_path()
self.setup_search_table()
# self.main_window.main_panel.raise_()
# Settings Window Setup
self.main_window.update_checkbox.setChecked(core.config.check_update)
# Shortcuts
del_game = QShortcut(QKeySequence(Qt.Key_Delete), self.main_window.games_list)
del_game.activated.connect(self.remove_selected)
def connect_components(self):
# Profile
self.main_window.create_profile.clicked.connect(lambda : self.toggle_widget(self.main_window.profile_create_window))
self.main_window.create_profile_btn.clicked.connect(self.create_profile)
self.main_window.cancel_profile_btn.clicked.connect(lambda : self.toggle_widget(self.main_window.profile_create_window))
self.main_window.profile_selector.currentTextChanged.connect(self.select_profile)
self.main_window.remove_game.clicked.connect(self.remove_selected)
self.main_window.delete_profile.clicked.connect(self.delete_profile)
# Steam Path
self.main_window.save_steam_path.clicked.connect(self.set_steam_path)
self.main_window.cancel_steam_path_btn.clicked.connect(lambda : self.toggle_widget(self.main_window.set_steam_path_window))
# Search Area
self.main_window.search_btn.clicked.connect(self.search_games)
self.main_window.game_search_text.returnPressed.connect(self.search_games)
self.main_window.add_to_profile.clicked.connect(self.add_selected)
# Main Buttons
self.main_window.generate_btn.clicked.connect(self.generate_app_list)
self.main_window.run_GLR_btn.clicked.connect(lambda : self.show_popup("This will restart Steam if it's open do you want to continue?", self.run_GLR))
# Settings Window
self.main_window.settings_btn.clicked.connect(lambda : self.toggle_widget(self.main_window.settings_window))
self.main_window.settings_save_btn.clicked.connect(self.save_settings)
self.main_window.settings_cancel_btn.clicked.connect(lambda : self.toggle_widget(self.main_window.settings_window))
# Popup Window
self.main_window.popup_btn2.clicked.connect(lambda : self.toggle_widget(self.main_window.generic_popup, True))
# Profile Functions
def create_profile(self):
name = self.main_window.profile_name.text()
if name != "":
profile_manager.create_profile(name)
self.main_window.profile_selector.addItem(name)
self.main_window.profile_name.clear()
self.main_window.profile_selector.setCurrentIndex(self.main_window.profile_selector.count() - 1)
self.toggle_widget(self.main_window.profile_create_window)
def delete_profile(self):
name = self.main_window.profile_selector.currentText()
if name == "default":
return
profile_manager.remove_profile(name)
index = self.main_window.profile_selector.currentIndex()
self.main_window.profile_selector.removeItem(index)
def select_profile(self, name):
with core.get_config() as config:
config.last_profile = name
self.show_profile_games(profile_manager.profiles[name])
def show_profile_games(self, profile):
list_ = self.main_window.games_list
self.populate_list(list_, profile.games)
def show_profile_names(self):
data = profile_manager.profiles.values()
if core.config.last_profile in profile_manager.profiles.keys():
self.main_window.profile_selector.addItem(core.config.last_profile)
for item in data:
if item.name != core.config.last_profile:
self.main_window.profile_selector.addItem(item.name)
# Search Functions
def search_games(self):
query = self.main_window.game_search_text.text()
if query == "":
return
self.toggle_hidden(self.main_window.searching_frame)
self.search_thread = SearchThread(query)
self.search_thread.signal.connect(self.search_games_done)
self.search_thread.start()
def search_games_done(self, result):
if type(result) is list:
self.toggle_hidden(self.main_window.searching_frame)
self.populate_table(self.main_window.search_result,result)
else:
self.toggle_hidden(self.main_window.searching_frame)
self.show_popup("Can't connect to Steam. Check if you have internet connection.", lambda : self.toggle_widget(self.main_window.generic_popup, True))
def setup_search_table(self):
h_header = self.main_window.search_result.horizontalHeader()
h_header.setSectionResizeMode(1,QHeaderView.Stretch)
h_header.setSectionResizeMode(0,QHeaderView.ResizeToContents)
h_header.setMaximumSectionSize(620)
def populate_table(self, table: QTableView, data=[]):
model = TableModel(data)
sortable_model = QSortFilterProxyModel(model)
sortable_model.setSourceModel(model)
table.setModel(sortable_model)
def populate_list(self, list_, data):
list_.clear()
for item in data:
list_.addItem(item.name)
# Search Table and Profile Interaction Functions
def add_selected(self):
items = [selected.data() for selected in self.main_window.search_result.selectedIndexes()]
if len(items) == 0:
return
profile = profile_manager.profiles[self.main_window.profile_selector.currentText()]
for game in core.Game.from_table_list(items):
if game not in profile.games:
profile.add_game(game)
self.show_profile_games(profile)
profile.export_profile()
def remove_selected(self):
items = self.main_window.games_list.selectedItems()
if len(items) == 0:
return
profile = profile_manager.profiles[self.main_window.profile_selector.currentText()]
for item in items:
profile.remove_game(item.text())
self.show_profile_games(profile)
profile.export_profile()
# Settings Functions
def save_settings(self):
with core.get_config() as config:
config.steam_path = self.main_window.settings_steam_path.text()
config.check_update = self.main_window.update_checkbox.isChecked()
self.toggle_widget(self.main_window.settings_window)
# Generation Functions
def run_GLR(self):
self.toggle_widget(self.main_window.generic_popup,True)
if not self.generate_app_list(False):
return
args = ["DLLInjector.exe"]
self.replaceConfig("CreateFiles", " 1")
self.replaceConfig("FileToCreate_1", " NoQuestion.bin")
with core.get_config() as config:
config.no_hook = self.main_window.no_hook_checkbox.isChecked()
config.compatibility_mode = self.main_window.compatibility_mode_checkbox.isChecked()
# if : else used instead of ternary operator for better readability
if core.config.compatibility_mode:
self.replaceConfig("EnableMitigationsOnChildProcess"," 0")
else:
self.replaceConfig("EnableMitigationsOnChildProcess"," 1")
if core.config.no_hook:
self.replaceConfig("CommandLine","")
self.replaceConfig("WaitForProcessTermination"," 0")
self.replaceConfig("EnableFakeParentProcess"," 1")
self.replaceConfig("CreateFiles", " 2")
self.replaceConfig("FileToCreate_2", " StealthMode.bin", True)
else:
self.replaceConfig("CommandLine"," -inhibitbootstrap")
self.replaceConfig("WaitForProcessTermination"," 1")
self.replaceConfig("EnableFakeParentProcess"," 0")
self.replaceConfig("CreateFiles", " 1")
self.replaceConfig("FileToCreate_2", "", True)
core.os.chdir(core.config.steam_path)
if self.is_steam_running():
self.toggle_widget(self.main_window.closing_steam)
subprocess.run(["Steam.exe", "-shutdown"]) #Shutdown Steam
while self.is_steam_running():
core.time.sleep(1)
core.time.sleep(2)
subprocess.Popen(args)
self.close()
def generate_app_list(self, popup = True):
selected_profile = profile_manager.profiles[self.main_window.profile_selector.currentText()]
if len(selected_profile.games) == 0:
self.show_popup("No games to generate.", lambda : self.toggle_widget(self.main_window.generic_popup,True))
return False
core.createFiles(selected_profile.games)
if(popup):
self.show_popup("AppList Folder Generated", lambda : self.toggle_widget(self.main_window.generic_popup, True))
return True
# Util Functions
def toggle_hidden(self, widget):
widget.setHidden(not widget.isHidden())
self.repaint()
def toggle_enable(self, widget):
widget.setEnabled(not widget.isEnabled())
def toggle_widget(self, widget, force_close = False):
if force_close:
widget.lower()
widget.setHidden(True)
widget.setEnabled(False)
return
if widget.isHidden():
widget.raise_()
else:
widget.lower()
self.toggle_hidden(widget)
self.toggle_enable(widget)
def set_steam_path(self):
path = self.main_window.steam_path.text()
if not path == "":
with core.get_config() as config:
config.steam_path = path
self.toggle_widget(self.main_window.set_steam_path_window)
def setup_steam_path(self):
if core.config.steam_path != "":
self.main_window.settings_steam_path.setText(core.config.steam_path)
return
self.toggle_widget(self.main_window.set_steam_path_window)
def drop_event_handler(self, event):
self.add_selected()
def show_popup(self, message, callback):
self.main_window.popup_text.setText(message)
self.main_window.popup_btn1.clicked.connect(callback)
self.toggle_widget(self.main_window.generic_popup)
def is_steam_running(self):
for process in psutil.process_iter():
if process.name() == "Steam.exe" or process.name() == "SteamService.exe" or process.name() == "steamwebhelper.exe" or process.name() == "DLLInjector.exe":
return True
return False
def replaceConfig(self, name, new_value, append = False):
found = False
with fileinput.input(core.config.steam_path + "/DllInjector.ini", inplace=True) as fp:
for line in fp:
if not line.startswith("#"):
tokens = line.split("=")
if tokens[0].strip() == name:
found = True
tokens[1] = new_value
line = "=".join(tokens) + "\n"
print(line, end = "")
if append and not found:
with open(core.config.steam_path + "/DllInjector.ini", "at") as f:
f.write("\n{0} = {1}".format(name, new_value))
class SearchThread(QThread):
signal = pyqtSignal('PyQt_PyObject')
def __init__(self, query):
super(SearchThread, self).__init__()
self.query = query
def run(self):
result = core.queryGames(self.query)
self.signal.emit(result)
class TableModel(QAbstractTableModel):
def __init__(self, datain=[], parent=None):
super().__init__(parent=parent)
self.datain = datain
def rowCount(self, parent=QModelIndex()):
return len(self.datain)
def columnCount(self, parent=QModelIndex()):
return 3
def data(self, index: QModelIndex, role=Qt.DisplayRole):
if index.isValid() and role == Qt.DisplayRole:
return f"{self.datain[index.row()][index.column()]}"
if index.column() == 2 and role == Qt.TextAlignmentRole:
return Qt.AlignCenter
else:
return QVariant()
def headerData(self, index, QtOrientation, role=Qt.DisplayRole):
names = ["Id", "Name", "Type"]
if role == Qt.DisplayRole:
return names[index]
else:
return QVariant()
def flags(self, index):
if index.column() == 1:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled
else:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable<file_sep># Known Issue
if you use the option to install GreenLuma Reborn in any folder on you pc the Manager will not work, for now use the default installation method of the GreenLuma Reborn, A.K.A installing direct in the steam folder
# GreenLuma Reborn Manager
An app to manage the Steam unlocker "GreenLuma Reborn" AppList folder
## What is [GreenLuma Reborn](https://cs.rin.ru/forum/viewtopic.php?f=29&t=80797) ?
GreenLuma Reborn (GLR) is a Steam unlocker made by Steam006 that is used to obtain games from family shared libraries and DLC for games. There's much more to it, though.
The full list of features provided by Steam006.

## Can I get banned for using GreenLuma Reborn ?
There will always be a risk when using GLR. If you're willing to take that risk, go right on ahead. If not, then don't bother. Especially when that risk means the status of your Steam account.
As expected, there are some games that blacklist GLR and using it will result in receiving a game ban. Refer to [this page](https://github.com/linkthehylian/GreenLuma-Reborn-App/wiki/Blacklist) if you want to check what games NOT to play.
Please keep in mind. Like CreamAPI, GreenLuma Reborn **does not** work for every game.
Also, keep in mind that not **every game** is available to play through Steam family sharing.
#### Credits to [@linkthehylian](https://github.com/linkthehylian) for this brief explanation
I **highly advise** you to use the "Legit stealth mode" checking the box "NoHook" on my program:

## Latest release: **[GreenLuma Reborn Manager v1.3.6](https://github.com/ImaniiTy/GreenLuma-Reborn-Manager/releases)**
## Features
* Easily manage profiles for various games(good to circumvent the 160 id limit)
* Add/Remove 1 or more games at once
* Add/Remove profiles
* Search for any game you want to add direct from the app
* Search results are directly from SteamDB
* Sort the results from Type(DLC, Game, etc..) or Name
* Generate the Applist, close steam and run the GLR in one click
* You can choose any GLR parameters before launch
* It will detect whether the steam is open or not and close it if necessary
* All the profiles info are in JSON files so you can easily share with anyone
* The profiles are saved on: C:\Users\YOUR_USER\AppData\Local\GLR_Manager\Profiles

## What's the difference between your app and [GreenLuma Reborn App](https://github.com/linkthehylian/GreenLuma-Reborn-App)?
Well the main difference, like i said on the topic above, is that on my app you can search the game you want to add directly from the program and my version is more focused on the management of the folder (and if you're like me who don't like having all the games unlocked at the same time the profile system can help you alot)
## Future Plans
* **Work on the UI(I still suck at UI design)**
* **Add varius QoL stuff(Would love some ideas for this)**
* Add a way to load previous games on your AppList folder
* ~~Add a way to launch GLR direct from the app~~
* Add some user input validation
## Built With
* [PyQt5](https://www.riverbankcomputing.com/software/pyqt/intro) - The GUI framework
* [pyinstaller](https://pyinstaller.readthedocs.io/en/stable/index.html) - Used to make the standalone executable
## Authors
[**ImaniiTy**](https://github.com/ImaniiTy):

<file_sep>import os
import subprocess
import shutil
import json
import time
import sys
import logging
from contextlib import contextmanager
from bs4 import BeautifulSoup as parser
# import cfscrape
import requests
from requests.exceptions import ConnectionError, ConnectTimeout
BASE_PATH = "{}/GLR_Manager".format(os.getenv("LOCALAPPDATA"))
PROFILES_PATH = "{}/Profiles".format(BASE_PATH)
CURRENT_VERSION = "1.4.0"
class Game:
def __init__(self, id, name, type):
self.id = id
self.name = name
self.type = type
def to_JSON(self):
return {"id": self.id, "name": self.name, "type": self.type}
def to_string(self):
return "ID: {0}\nName: {1}\nType: {2}\n".format(self.id,self.name,self.type)
def to_list(self):
return [self.id, self.name, self.type]
def __eq__(self, value):
return self.id == value.id and self.name == value.name and self.type == value.type
def __getitem__(self, index):
values_list = list(vars(self).values())
return values_list[index]
@staticmethod
def from_JSON(data):
return Game(data["id"],data["name"],data["type"])
@staticmethod
def from_table_list(list):
games = []
for i in range(int(len(list)/3)):
games.append(Game(list[i * 3], list[i * 3 + 1], list[i * 3 + 2]))
return games
class Profile:
def __init__(self,name = 'default',games = []):
self.name = name
self.games = games
def add_game(self,game):
self.games.append(game)
def remove_game(self,game):
if type(game) is Game:
self.games.remove(game)
else:
for game_ in self.games:
if game_.name == game:
self.games.remove(game_)
def export_profile(self,path = PROFILES_PATH):
data = {"name": self.name, "games": [game.to_JSON() for game in self.games]}
with open("{}/{}.json".format(path, self.name), "w") as outfile:
json.dump(data,outfile,indent=4)
def __eq__(self, value):
return self.name == value.name
@staticmethod
def from_JSON(data):
return Profile(data["name"], [Game.from_JSON(game) for game in data["games"]])
class ProfileManager:
def __init__(self):
self.profiles = {}
self.load_profiles()
def load_profiles(self):
if not os.path.exists(PROFILES_PATH):
os.makedirs(PROFILES_PATH)
self.create_profile("default")
elif len(os.listdir(PROFILES_PATH)) == 0:
self.create_profile("default")
for filename in os.listdir(PROFILES_PATH):
with open("{}/{}".format(PROFILES_PATH,filename), "r") as file:
try:
data = json.load(file)
self.register_profile(Profile.from_JSON(data))
except json.JSONDecodeError as e:
logging.exception(e)
file.close()
os.remove("{}/{}".format(PROFILES_PATH,filename))
def register_profile(self, profile):
self.profiles[profile.name] = profile
def create_profile(self, name, games = []):
if name is "":
return
self.register_profile(Profile(name,games))
self.profiles[name].export_profile(PROFILES_PATH)
def remove_profile(self, profile_name):
self.profiles.pop(profile_name)
os.remove("{}/{}.json".format(PROFILES_PATH,profile_name))
class Config:
def __init__(self, steam_path = "", no_hook = True, compatibility_mode = True, version = CURRENT_VERSION, last_profile = "default", check_update = True):
self.steam_path = steam_path
self.no_hook = no_hook
self.compatibility_mode = compatibility_mode
self.version = version
self.last_profile = last_profile
self.check_update = check_update
def export_config(self):
with open("{}/config.json".format(BASE_PATH), "w") as outfile:
json.dump(vars(self),outfile,indent=4)
@staticmethod
def from_JSON(data):
config = Config()
for key, value in data.items():
if key in vars(config).keys():
setattr(config, key, value)
return config
@staticmethod
def load_config():
if not os.path.isfile("{}/config.json".format(BASE_PATH)):
if not os.path.exists(BASE_PATH):
os.makedirs(BASE_PATH)
config = Config()
config.export_config()
return config
else:
with open("{}/config.json".format(BASE_PATH), "r") as file_:
try:
data = json.load(file_)
config = Config.from_JSON(data)
except Exception as e:
logging.exception(e)
config = Config()
config.version = CURRENT_VERSION
config.export_config()
return config
class ConfigNotLoadedException(Exception):
pass
#-------------
logging.basicConfig(filename='errors.log', filemode="w", level=logging.DEBUG)
config = Config.load_config()
@contextmanager
def get_config():
global config
try:
if config:
yield config
else:
config = Config.load_config()
finally:
config.export_config()
def createFiles(games):
if not os.path.exists("{}/AppList".format(config.steam_path)):
os.makedirs("{}/AppList".format(config.steam_path))
else:
shutil.rmtree("{}/AppList".format(config.steam_path))
time.sleep(0.5)
os.makedirs("{}/AppList".format(config.steam_path))
for i in range(len(games)):
with open("{}/AppList/{}.txt".format(config.steam_path,i),"w") as file:
file.write(games[i].id)
# def parseGames(html):
# p = parser(html, 'html.parser')
# rows = p.find_all("tr", class_= "app")
# games = []
# for row in rows:
# data = row("td")
# if(data[1].get_text() != "Unknown"):
# game = Game(data[0].get_text(),data[2].get_text(),data[1].get_text())
# #print(game.to_string())
# games.append(game)
# return games
def parseDlcs(html):
p = parser(html, 'html.parser')
dlcs = p.find_all("div", class_= "recommendation")
games = []
for dlc in dlcs:
appid = dlc.find("a")["data-ds-appid"]
name = dlc.find("span", class_= "color_created").get_text()
games.append(Game(appid, name, "DLC"))
return games
def getDlcs(appQuery):
appinfo = appQuery.split("/")
appid = appinfo[0]
sanitazedName = appinfo[1]
params = {"sort": "newreleases", "count": 50, "start": 0}
baseUrl = "https://store.steampowered.com/dlc/{0}/{1}/ajaxgetfilteredrecommendations"
response = requests.get(baseUrl.format(appid, sanitazedName), params=params).json()
return parseDlcs(response["results_html"])
def parseGames(html):
p = parser(html, 'html.parser')
results = p.find_all("a", class_= "search_result_row")
games = []
for result in results[:3]:
appid = result["data-ds-appid"]
name = result.find("span", class_= "title").get_text()
games.append(Game(appid, name, "Game"))
appQuery = result["href"].split("app/")
print(appQuery)
if len(appQuery) > 1: games.extend(getDlcs(appQuery[1]))
return games
def queryfy(input_):
arr = input_.split()
result = arr.pop(0)
for word in arr:
result = result + "+" + word
print(result)
return result
def queryGames(query):
try:
params = {"term": query, "count": 25, "start": 0, "category1": 998}
response = requests.get("https://store.steampowered.com/search/results", params=params)
return parseGames(response.content)
except (ConnectionError, ConnectTimeout) as err:
logging.exception(err)
return err
def runUpdater():
if "-NoUpdate" not in sys.argv and config.check_update:
subprocess.run("GLR Updater.exe")
# Post update measure
if "-PostUpdate" in sys.argv:
for fl in os.listdir("./"):
if fl.startswith("new_"):
real_name = fl.replace("new_","")
os.remove(real_name)
os.rename(fl, real_name)<file_sep>using System;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
using System.IO;
using System.IO.Compression;
using System.Diagnostics;
namespace GLR_Updater {
class Utils {
public static async Task<string> GetLatest() {
using (var httpClient = new HttpClient()) {
HttpResponseMessage response = await httpClient.GetAsync("https://github.com/ImaniiTy/GreenLuma-Reborn-Manager/releases/latest");
var header = response.RequestMessage.RequestUri.Segments;
return header.Last().Substring(1);
}
}
public static Task DownloadAndExtractFile(string URL) {
using (var client = new WebClient()) {
client.Proxy = null;
client.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(CompletedHandler);
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressHandler);
return client.DownloadFileTaskAsync(new Uri(URL), "Release.zip");
}
}
private static void ProgressHandler(object sender, DownloadProgressChangedEventArgs e) {
Console.Write(String.Format("{0}%\r", e.ProgressPercentage.ToString()));
}
private static void CompletedHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e) {
ExtractFile("./Release.zip");
Process.Start("GreenLuma Reborn Manager.exe","-NoUpdate -PostUpdate");
}
public static void ExtractFile(string path) {
Console.WriteLine("Extracting File...");
using (ZipArchive archive = ZipFile.OpenRead(path)) {
foreach (ZipArchiveEntry entry in archive.Entries) {
var fileName = entry.FullName.Split('/')[1];
if (fileName != "") {
Console.WriteLine(Path.Combine("./", fileName));
try {
entry.ExtractToFile(Path.Combine("./", fileName), true);
} catch (Exception e) {
entry.ExtractToFile(Path.Combine("./", "new_" + fileName), true);
}
}
}
}
Console.WriteLine("Deleting Temporary Files...");
File.Delete(path);
}
public static StreamWriter CreateLogger() {
FileStream logOutput = new FileStream("UpdaterLog.txt", FileMode.Create);
StreamWriter logWriter = new StreamWriter(logOutput);
logWriter.AutoFlush = true;
return logWriter;
}
}
}
<file_sep># -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt5 UI code generator 5.12
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1120, 747)
MainWindow.setStyleSheet("background-color: rgb(18, 18, 18);")
MainWindow.setAnimated(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setStyleSheet("QWidget {\n"
" color: rgb(255, 255, 255);\n"
"}\n"
"\n"
"QComboBox{\n"
" font: 11pt \"MS Shell Dlg 2\";\n"
" color: rgb(179, 179, 179);\n"
" border: 1px solid rgb(130, 135, 144);\n"
" background-color: rgb(28, 28, 28); \n"
"}\n"
"\n"
"QComboBox::drop-down{\n"
" color: rgb(179, 179, 179);\n"
" border-color: transparent\n"
"}\n"
"\n"
"QComboBox::down-arrow{\n"
" image: url(:images/down-arrow.png);\n"
" width: 15px;\n"
" height: 15px;\n"
" padding-right: 18px;\n"
"}\n"
"\n"
"QComboBox QAbstractItemView {\n"
" margin: 2px 1px 2px 1px;\n"
" color: rgb(255, 255, 255);\n"
" background-color: rgb(28, 28, 28);\n"
" selection-background-color: rgb(40, 40, 40);\n"
" border: 1px solid rgb(28, 28, 28);\n"
"}\n"
"\n"
"QPushButton {\n"
" color:rgba(232, 232, 232);\n"
" border-radius: 4px;\n"
" border: 1px solid rgb(179, 179, 179);\n"
" font: 75 11pt \"Consolas\";\n"
"}\n"
"\n"
"QPushButton:hover#settings_btn {\n"
" background-color: transparent;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" color: rgb(24, 24, 24);\n"
" background-color: rgb(245, 245, 245);\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" border-style: inset;\n"
" border: 2px solid rgb(85, 85, 85);\n"
"}\n"
"\n"
"QHeaderView::section {\n"
" background-color: rgb(29, 29, 29);\n"
" border: 1px solid rgb(245, 245, 245)\n"
"}\n"
"\n"
"QAbstractItemView {\n"
" padding: 2px\n"
"}\n"
"\n"
"QAbstractItemView::item:selected{ \n"
" background-color: white;\n"
" color: black\n"
"}\n"
"")
self.centralwidget.setObjectName("centralwidget")
self.profile_create_window = QtWidgets.QWidget(self.centralwidget)
self.profile_create_window.setEnabled(False)
self.profile_create_window.setGeometry(QtCore.QRect(290, 270, 471, 161))
self.profile_create_window.setStyleSheet("border: 1px solid white")
self.profile_create_window.setObjectName("profile_create_window")
self.profile_name = QtWidgets.QLineEdit(self.profile_create_window)
self.profile_name.setGeometry(QtCore.QRect(30, 50, 411, 31))
self.profile_name.setStyleSheet("width: 100%;\n"
"font: 10pt \"Consolas\";\n"
"border-radius: 15px;\n"
"border: 1px solid #ffffff;\n"
"padding: 2px 2px 3px 10px;\n"
"background-color: rgb(255, 255, 255);\n"
"color: rgb(6, 11, 8);")
self.profile_name.setObjectName("profile_name")
self.create_profile_btn = QtWidgets.QPushButton(self.profile_create_window)
self.create_profile_btn.setGeometry(QtCore.QRect(30, 110, 151, 31))
self.create_profile_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.create_profile_btn.setObjectName("create_profile_btn")
self.cancel_profile_btn = QtWidgets.QPushButton(self.profile_create_window)
self.cancel_profile_btn.setGeometry(QtCore.QRect(290, 110, 151, 31))
self.cancel_profile_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.cancel_profile_btn.setObjectName("cancel_profile_btn")
self.label_3 = QtWidgets.QLabel(self.profile_create_window)
self.label_3.setGeometry(QtCore.QRect(32, 19, 130, 21))
font = QtGui.QFont()
font.setPointSize(10)
self.label_3.setFont(font)
self.label_3.setStyleSheet("border: 0px")
self.label_3.setObjectName("label_3")
self.set_steam_path_window = QtWidgets.QWidget(self.centralwidget)
self.set_steam_path_window.setEnabled(False)
self.set_steam_path_window.setGeometry(QtCore.QRect(290, 270, 471, 161))
self.set_steam_path_window.setStyleSheet("border: 1px solid white")
self.set_steam_path_window.setObjectName("set_steam_path_window")
self.save_steam_path = QtWidgets.QPushButton(self.set_steam_path_window)
self.save_steam_path.setGeometry(QtCore.QRect(50, 110, 151, 31))
self.save_steam_path.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.save_steam_path.setObjectName("save_steam_path")
self.label_6 = QtWidgets.QLabel(self.set_steam_path_window)
self.label_6.setGeometry(QtCore.QRect(32, 19, 130, 21))
font = QtGui.QFont()
font.setPointSize(10)
self.label_6.setFont(font)
self.label_6.setStyleSheet("border: 0px")
self.label_6.setObjectName("label_6")
self.cancel_steam_path_btn = QtWidgets.QPushButton(self.set_steam_path_window)
self.cancel_steam_path_btn.setGeometry(QtCore.QRect(270, 110, 151, 31))
self.cancel_steam_path_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.cancel_steam_path_btn.setObjectName("cancel_steam_path_btn")
self.steam_path = QtWidgets.QLineEdit(self.set_steam_path_window)
self.steam_path.setGeometry(QtCore.QRect(30, 47, 421, 31))
self.steam_path.setStyleSheet("width: 100%;\n"
"font: 10pt \"Consolas\";\n"
"border-radius: 15px;\n"
"border: 1px solid #ffffff;\n"
"padding: 2px 2px 3px 10px;\n"
"background-color: rgb(255, 255, 255);\n"
"color: rgb(6, 11, 8);")
self.steam_path.setObjectName("steam_path")
self.generic_popup = QtWidgets.QWidget(self.centralwidget)
self.generic_popup.setEnabled(False)
self.generic_popup.setGeometry(QtCore.QRect(290, 270, 531, 161))
self.generic_popup.setStyleSheet("border: 1px solid white")
self.generic_popup.setObjectName("generic_popup")
self.popup_btn1 = QtWidgets.QPushButton(self.generic_popup)
self.popup_btn1.setGeometry(QtCore.QRect(30, 110, 151, 31))
self.popup_btn1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.popup_btn1.setObjectName("popup_btn1")
self.popup_btn2 = QtWidgets.QPushButton(self.generic_popup)
self.popup_btn2.setGeometry(QtCore.QRect(350, 110, 151, 31))
self.popup_btn2.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.popup_btn2.setObjectName("popup_btn2")
self.popup_text = QtWidgets.QLabel(self.generic_popup)
self.popup_text.setGeometry(QtCore.QRect(20, 20, 491, 71))
font = QtGui.QFont()
font.setPointSize(12)
self.popup_text.setFont(font)
self.popup_text.setStyleSheet("border: 0px")
self.popup_text.setAlignment(QtCore.Qt.AlignCenter)
self.popup_text.setWordWrap(True)
self.popup_text.setObjectName("popup_text")
self.closing_steam = QtWidgets.QWidget(self.centralwidget)
self.closing_steam.setEnabled(False)
self.closing_steam.setGeometry(QtCore.QRect(240, 240, 621, 181))
self.closing_steam.setStyleSheet("border: 1px solid white")
self.closing_steam.setObjectName("closing_steam")
self.label_8 = QtWidgets.QLabel(self.closing_steam)
self.label_8.setGeometry(QtCore.QRect(50, 30, 521, 121))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.label_8.setFont(font)
self.label_8.setStyleSheet("border: 0px")
self.label_8.setAlignment(QtCore.Qt.AlignCenter)
self.label_8.setObjectName("label_8")
self.main_panel = QtWidgets.QWidget(self.centralwidget)
self.main_panel.setEnabled(True)
self.main_panel.setGeometry(QtCore.QRect(0, 0, 1121, 751))
self.main_panel.setObjectName("main_panel")
self.profile_selector = QtWidgets.QComboBox(self.main_panel)
self.profile_selector.setGeometry(QtCore.QRect(825, 45, 280, 31))
self.profile_selector.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.profile_selector.setFocusPolicy(QtCore.Qt.NoFocus)
self.profile_selector.setAcceptDrops(False)
self.profile_selector.setStyleSheet("QWidget:item{\n"
" background: rgb(255, 0, 0)\n"
"}\n"
"QWidget:item:checked {\n"
" font-weight: bold;\n"
"}")
self.profile_selector.setIconSize(QtCore.QSize(18, 18))
self.profile_selector.setFrame(False)
self.profile_selector.setObjectName("profile_selector")
self.label = QtWidgets.QLabel(self.main_panel)
self.label.setGeometry(QtCore.QRect(825, 15, 120, 21))
self.label.setStyleSheet("background: transparent;\n"
"font: 75 11pt \"Consolas\";")
self.label.setObjectName("label")
self.remove_game = QtWidgets.QPushButton(self.main_panel)
self.remove_game.setGeometry(QtCore.QRect(825, 605, 120, 31))
self.remove_game.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.remove_game.setStyleSheet("")
self.remove_game.setFlat(False)
self.remove_game.setObjectName("remove_game")
self.compatibility_mode_checkbox = QtWidgets.QCheckBox(self.main_panel)
self.compatibility_mode_checkbox.setEnabled(True)
self.compatibility_mode_checkbox.setGeometry(QtCore.QRect(755, 695, 150, 21))
font = QtGui.QFont()
font.setPointSize(10)
self.compatibility_mode_checkbox.setFont(font)
self.compatibility_mode_checkbox.setChecked(False)
self.compatibility_mode_checkbox.setObjectName("compatibility_mode_checkbox")
self.search_result = QtWidgets.QTableView(self.main_panel)
self.search_result.setGeometry(QtCore.QRect(15, 105, 790, 491))
self.search_result.setStyleSheet("background-color: rgb(28, 28, 28);")
self.search_result.setDragEnabled(True)
self.search_result.setDragDropMode(QtWidgets.QAbstractItemView.DragOnly)
self.search_result.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.search_result.setSortingEnabled(True)
self.search_result.setWordWrap(False)
self.search_result.setCornerButtonEnabled(False)
self.search_result.setObjectName("search_result")
self.search_result.horizontalHeader().setCascadingSectionResizes(False)
self.search_result.horizontalHeader().setDefaultSectionSize(55)
self.search_result.horizontalHeader().setMinimumSectionSize(55)
self.search_result.horizontalHeader().setStretchLastSection(False)
self.search_result.verticalHeader().setVisible(False)
self.search_result.verticalHeader().setCascadingSectionResizes(True)
self.search_result.verticalHeader().setDefaultSectionSize(35)
self.search_result.verticalHeader().setMinimumSectionSize(35)
self.searching_frame = QtWidgets.QFrame(self.main_panel)
self.searching_frame.setEnabled(False)
self.searching_frame.setGeometry(QtCore.QRect(235, 295, 330, 111))
self.searching_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.searching_frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.searching_frame.setObjectName("searching_frame")
self.label_5 = QtWidgets.QLabel(self.searching_frame)
self.label_5.setGeometry(QtCore.QRect(30, 20, 271, 71))
font = QtGui.QFont()
font.setPointSize(14)
font.setBold(True)
font.setWeight(75)
self.label_5.setFont(font)
self.label_5.setAlignment(QtCore.Qt.AlignCenter)
self.label_5.setObjectName("label_5")
self.create_profile = QtWidgets.QPushButton(self.main_panel)
self.create_profile.setGeometry(QtCore.QRect(825, 85, 120, 31))
self.create_profile.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.create_profile.setStyleSheet("")
self.create_profile.setObjectName("create_profile")
self.label_4 = QtWidgets.QLabel(self.main_panel)
self.label_4.setGeometry(QtCore.QRect(225, 0, 360, 41))
font = QtGui.QFont()
font.setPointSize(13)
font.setBold(True)
font.setWeight(75)
self.label_4.setFont(font)
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
self.label_4.setObjectName("label_4")
self.run_GLR_btn = QtWidgets.QPushButton(self.main_panel)
self.run_GLR_btn.setGeometry(QtCore.QRect(525, 665, 220, 51))
self.run_GLR_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.run_GLR_btn.setStyleSheet("#run_GLR_btn {\n"
" background-color: rgb(0, 116, 217);\n"
" color: rgb(6, 11, 8);\n"
"}\n"
"\n"
"#run_GLR_btn:hover {\n"
" color: rgb(24, 24, 24);\n"
" background-color: rgb(245, 245, 245);\n"
"}")
self.run_GLR_btn.setObjectName("run_GLR_btn")
self.search_btn = QtWidgets.QPushButton(self.main_panel)
self.search_btn.setGeometry(QtCore.QRect(745, 47, 50, 26))
self.search_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.search_btn.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-radius: 4px;\n"
"border: 0px")
self.search_btn.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/images/search-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.search_btn.setIcon(icon)
self.search_btn.setIconSize(QtCore.QSize(25, 25))
self.search_btn.setObjectName("search_btn")
self.add_to_profile = QtWidgets.QPushButton(self.main_panel)
self.add_to_profile.setGeometry(QtCore.QRect(15, 605, 140, 31))
self.add_to_profile.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.add_to_profile.setStyleSheet("")
self.add_to_profile.setObjectName("add_to_profile")
self.games_list = QtWidgets.QListWidget(self.main_panel)
self.games_list.setGeometry(QtCore.QRect(825, 155, 280, 441))
self.games_list.setStyleSheet("background-color: rgb(28, 28, 28);")
self.games_list.setDragDropMode(QtWidgets.QAbstractItemView.DropOnly)
self.games_list.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.games_list.setObjectName("games_list")
self.generate_btn = QtWidgets.QPushButton(self.main_panel)
self.generate_btn.setGeometry(QtCore.QRect(285, 665, 220, 51))
self.generate_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.generate_btn.setStyleSheet("#generate_btn {\n"
" background-color: rgb(29, 185, 84);\n"
" color: rgb(6, 11, 8);\n"
"}\n"
"\n"
"#generate_btn:hover {\n"
" color: rgb(24, 24, 24);\n"
" background-color: rgb(245, 245, 245);\n"
"}")
self.generate_btn.setObjectName("generate_btn")
self.label_2 = QtWidgets.QLabel(self.main_panel)
self.label_2.setGeometry(QtCore.QRect(825, 125, 120, 21))
self.label_2.setStyleSheet("background: transparent;\n"
"font: 75 11pt \"Consolas\";")
self.label_2.setObjectName("label_2")
self.delete_profile = QtWidgets.QPushButton(self.main_panel)
self.delete_profile.setGeometry(QtCore.QRect(965, 85, 140, 31))
self.delete_profile.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.delete_profile.setStyleSheet("")
self.delete_profile.setObjectName("delete_profile")
self.game_search_text = QtWidgets.QLineEdit(self.main_panel)
self.game_search_text.setGeometry(QtCore.QRect(15, 45, 790, 31))
self.game_search_text.setStyleSheet("width: 100%;\n"
"font: 10pt \"Consolas\";\n"
"border-radius: 15px;\n"
"border: 1px solid #ffffff;\n"
"padding: 2px 2px 3px 10px;\n"
"background-color: rgb(255, 255, 255);\n"
"color: rgb(6, 11, 8);")
self.game_search_text.setText("")
self.game_search_text.setObjectName("game_search_text")
self.no_hook_checkbox = QtWidgets.QCheckBox(self.main_panel)
self.no_hook_checkbox.setGeometry(QtCore.QRect(755, 665, 120, 21))
font = QtGui.QFont()
font.setPointSize(10)
self.no_hook_checkbox.setFont(font)
self.no_hook_checkbox.setChecked(True)
self.no_hook_checkbox.setObjectName("no_hook_checkbox")
self.version_label = QtWidgets.QLabel(self.main_panel)
self.version_label.setGeometry(QtCore.QRect(1077, 728, 41, 16))
self.version_label.setObjectName("version_label")
self.settings_btn = QtWidgets.QPushButton(self.main_panel)
self.settings_btn.setGeometry(QtCore.QRect(4, 700, 51, 41))
self.settings_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.settings_btn.setStyleSheet("border: solid 0px;")
self.settings_btn.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/images/settings-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.settings_btn.setIcon(icon1)
self.settings_btn.setIconSize(QtCore.QSize(28, 28))
self.settings_btn.setObjectName("settings_btn")
self.profile_selector.raise_()
self.label.raise_()
self.remove_game.raise_()
self.compatibility_mode_checkbox.raise_()
self.search_result.raise_()
self.create_profile.raise_()
self.label_4.raise_()
self.run_GLR_btn.raise_()
self.add_to_profile.raise_()
self.games_list.raise_()
self.generate_btn.raise_()
self.label_2.raise_()
self.delete_profile.raise_()
self.game_search_text.raise_()
self.no_hook_checkbox.raise_()
self.version_label.raise_()
self.search_btn.raise_()
self.settings_btn.raise_()
self.searching_frame.raise_()
self.settings_window = QtWidgets.QWidget(self.centralwidget)
self.settings_window.setEnabled(False)
self.settings_window.setGeometry(QtCore.QRect(220, 190, 660, 280))
self.settings_window.setStyleSheet("border: 1px solid white")
self.settings_window.setObjectName("settings_window")
self.settings_save_btn = QtWidgets.QPushButton(self.settings_window)
self.settings_save_btn.setGeometry(QtCore.QRect(110, 230, 150, 30))
self.settings_save_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.settings_save_btn.setObjectName("settings_save_btn")
self.settings_cancel_btn = QtWidgets.QPushButton(self.settings_window)
self.settings_cancel_btn.setGeometry(QtCore.QRect(400, 230, 150, 30))
self.settings_cancel_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.settings_cancel_btn.setObjectName("settings_cancel_btn")
self.settings_label_1 = QtWidgets.QLabel(self.settings_window)
self.settings_label_1.setEnabled(False)
self.settings_label_1.setGeometry(QtCore.QRect(20, 10, 621, 31))
font = QtGui.QFont()
font.setPointSize(12)
self.settings_label_1.setFont(font)
self.settings_label_1.setStyleSheet("border: 0px")
self.settings_label_1.setAlignment(QtCore.Qt.AlignCenter)
self.settings_label_1.setWordWrap(True)
self.settings_label_1.setObjectName("settings_label_1")
self.settings_label_2 = QtWidgets.QLabel(self.settings_window)
self.settings_label_2.setGeometry(QtCore.QRect(10, 70, 131, 31))
font = QtGui.QFont()
font.setFamily("Consolas")
font.setPointSize(12)
font.setBold(False)
font.setWeight(50)
font.setKerning(True)
self.settings_label_2.setFont(font)
self.settings_label_2.setStyleSheet("border: 0px")
self.settings_label_2.setAlignment(QtCore.Qt.AlignCenter)
self.settings_label_2.setWordWrap(True)
self.settings_label_2.setObjectName("settings_label_2")
self.update_checkbox = QtWidgets.QCheckBox(self.settings_window)
self.update_checkbox.setGeometry(QtCore.QRect(22, 170, 231, 21))
font = QtGui.QFont()
font.setPointSize(10)
self.update_checkbox.setFont(font)
self.update_checkbox.setStyleSheet("border: solid 0px")
self.update_checkbox.setCheckable(True)
self.update_checkbox.setChecked(True)
self.update_checkbox.setObjectName("update_checkbox")
self.settings_steam_path = QtWidgets.QLineEdit(self.settings_window)
self.settings_steam_path.setGeometry(QtCore.QRect(20, 104, 621, 31))
self.settings_steam_path.setStyleSheet("width: 100%;\n"
"font: 10pt \"Consolas\";\n"
"border-radius: 15px;\n"
"border: 1px solid #ffffff;\n"
"padding: 2px 2px 3px 10px;\n"
"background-color: rgb(255, 255, 255);\n"
"color: rgb(6, 11, 8);")
self.settings_steam_path.setObjectName("settings_steam_path")
self.settings_window.raise_()
self.profile_create_window.raise_()
self.set_steam_path_window.raise_()
self.generic_popup.raise_()
self.closing_steam.raise_()
self.main_panel.raise_()
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "GreenLuma Reborn Manager"))
self.profile_name.setPlaceholderText(_translate("MainWindow", "Profile Name"))
self.create_profile_btn.setText(_translate("MainWindow", "Create"))
self.cancel_profile_btn.setText(_translate("MainWindow", "Cancel"))
self.label_3.setText(_translate("MainWindow", "Profile Name:"))
self.save_steam_path.setText(_translate("MainWindow", "Save"))
self.label_6.setText(_translate("MainWindow", "Steam Path"))
self.cancel_steam_path_btn.setText(_translate("MainWindow", "Cancel"))
self.steam_path.setPlaceholderText(_translate("MainWindow", "Path"))
self.popup_btn1.setText(_translate("MainWindow", "Ok"))
self.popup_btn2.setText(_translate("MainWindow", "Cancel"))
self.popup_text.setText(_translate("MainWindow", "TextLabel"))
self.label_8.setText(_translate("MainWindow", "Closing Steam..."))
self.label.setText(_translate("MainWindow", "Profile"))
self.remove_game.setText(_translate("MainWindow", "Remove Games"))
self.compatibility_mode_checkbox.setToolTip(_translate("MainWindow", "Enable this if you\'re having problem with AV detection"))
self.compatibility_mode_checkbox.setText(_translate("MainWindow", "Compatibility Mode"))
self.label_5.setText(_translate("MainWindow", "Searching..."))
self.create_profile.setText(_translate("MainWindow", "New Profile"))
self.label_4.setText(_translate("MainWindow", "GreenLuma Reborn Manager"))
self.run_GLR_btn.setText(_translate("MainWindow", "Run GLR"))
self.add_to_profile.setText(_translate("MainWindow", "Add Games"))
self.games_list.setSortingEnabled(True)
self.generate_btn.setText(_translate("MainWindow", "Generate"))
self.label_2.setText(_translate("MainWindow", "Games List"))
self.delete_profile.setText(_translate("MainWindow", "Delete Profile"))
self.game_search_text.setPlaceholderText(_translate("MainWindow", "Search Game"))
self.no_hook_checkbox.setText(_translate("MainWindow", "NoHook"))
self.version_label.setText(_translate("MainWindow", "v0.0.0"))
self.settings_save_btn.setText(_translate("MainWindow", "Save"))
self.settings_cancel_btn.setText(_translate("MainWindow", "Cancel"))
self.settings_label_1.setText(_translate("MainWindow", "Settings"))
self.settings_label_2.setText(_translate("MainWindow", "Steam Path:"))
self.update_checkbox.setToolTip(_translate("MainWindow", "Enable Automatic Updates"))
self.update_checkbox.setText(_translate("MainWindow", "Check For Updates On Startup"))
self.settings_steam_path.setPlaceholderText(_translate("MainWindow", "Path"))
from Qt import resources_rc
<file_sep>import sys, logging, traceback
from core import runUpdater
from PyQt5.QtWidgets import QApplication
from Qt.logic import MainWindow
# Logs errors on crash
def except_hook(type_, value, trace_back):
logging.basicConfig(filename='crash.log',filemode="w",level=logging.DEBUG)
logging.exception("".join(traceback.format_exception(type_, value, trace_back)))
QApplication.quit()
sys.excepthook = except_hook
#-------------------
# Starts main loop
runUpdater()
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
#-------------------<file_sep>altgraph==0.17
astroid==2.5.1
beautifulsoup4==4.9.3
bs4==0.0.1
certifi==2020.12.5
chardet==4.0.0
colorama==0.4.4
future==0.18.2
idna==2.10
isort==5.7.0
lazy-object-proxy==1.5.2
mccabe==0.6.1
pefile==2019.4.18
psutil==5.8.0
pyinstaller==4.2
pyinstaller-hooks-contrib==2021.1
pylint==2.7.2
PyQt5==5.12.3
PyQt5-sip==12.8.1
pywin32-ctypes==0.2.0
requests==2.25.1
soupsieve==2.2
toml==0.10.2
urllib3==1.26.3
wrapt==1.12.1
| c56ac9f285a14c6427fa991d7dba85f09ed118b9 | [
"Markdown",
"C#",
"Python",
"Text"
] | 9 | C# | ImaniiTy/GreenLuma-Reborn-Manager | 3d205d41276d30ca69154df9e4452f4b181add92 | ab2e3be84244492e78915c24a4a47610a6e39b1a |
refs/heads/master | <file_sep>from django.db import models
class GetInTouch(models.Model):
name = models.CharField(max_length=250)
info = models.CharField(max_length=250)
def __unicode__(self):
return self.name
<file_sep>from snippets.models import Snippet
from snippets.serializers import SnippetSerializer, UserSerializer
from rest_framework import generics, permissions
from django.contrib.auth.models import User
from snippets.permissions import IsOwnerOrReadOnly
class SnippetList(generics.ListCreateAPIView):
model = Snippet
serializer_class = SnippetSerializer
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
def pre_save(self, obj):
obj.owner = self.request.user
print self.request.user
print '###########'
class SnippetDetail(generics.RetrieveUpdateDestroyAPIView):
model = Snippet
serializer_class = SnippetSerializer
permission_classes = (permissions.IsAuthenticatedOrReadOnly,
IsOwnerOrReadOnly,)
def pre_save(self, obj):
print self.request.user
print '###########'
obj.owner = self.request.user
class UserList(generics.ListAPIView):
model = User
serializer_class = UserSerializer
class UserInstance(generics.RetrieveAPIView):
model = User
serializer_class = UserSerializer
<file_sep>django==1.4
djangorestframework==2.1.9
pygments==1.5
ipython==0.13.1
readline==6.2.4.1<file_sep>from rest_framework import serializers
from get_in_touch.models import GetInTouch
class GetInTouchSerializer(serializers.ModelSerializer):
class Meta:
model = GetInTouch
fields = ('id', 'name', 'info')
<file_sep>from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
from education import views
urlpatterns = patterns('',
url(r'^education/$', views.EducationList.as_view()),
# url(r'^education/(?P<pk>[0-9]+)/$', views.EducationView.as_view())
)
urlpatterns = format_suffix_patterns(urlpatterns)
<file_sep>from rest_framework import serializers
from snippets import models
from django.contrib.auth.models import User
class SnippetSerializer(serializers.ModelSerializer):
owner = serializers.Field(source='owner.username')
class Meta:
model = models.Snippet
fields = ('id', 'title', 'code', 'linenos', 'language', 'style')
class UserSerializer(serializers.ModelSerializer):
snippets = serializers.ManyPrimaryKeyRelatedField()
class Meta:
model = User
fields = ('id', 'username', 'snippets')
<file_sep>from get_in_touch.models import GetInTouch
from get_in_touch.serializers import GetInTouchSerializer
from rest_framework import generics
class GetInTouchList(generics.ListCreateAPIView):
model = GetInTouch
serializer_class = GetInTouchSerializer
<file_sep>from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
from get_in_touch import views
urlpatterns = patterns('',
url(r'^getintouch/$', views.GetInTouchList.as_view()),
)
urlpatterns = format_suffix_patterns(urlpatterns)
| bb7715deccab1dec9ae2adf00b37add526335d54 | [
"Python",
"Text"
] | 8 | Python | kimpettersen/kimpettersencv | 78cfe3786fbb186b1b94f540ee5dacfe007c2b63 | a7a93baa07a0df785649b012c677da22076f7dbb |
refs/heads/master | <file_sep>package com.sample.threetentest
import android.app.Application
import com.jakewharton.threetenabp.AndroidThreeTen
import java.util.*
class ThreeTenApp : Application() {
override fun onCreate() {
super.onCreate()
val resources = this.getResources()
val displayMetrics = resources.getDisplayMetrics()
val configuration = resources.getConfiguration()
configuration.setLocale(Locale("pt","BR"))
resources.updateConfiguration(configuration, displayMetrics)
AndroidThreeTen.init(this)
}
}<file_sep># ThreeTenTest
Sample app to test ThreeTen Android Backport
<file_sep>package com.sample.threetentest
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import org.threeten.bp.YearMonth
import org.threeten.bp.format.DateTimeFormatter
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val textView = findViewById<TextView>(R.id.textview)
val format = DateTimeFormatter.ofPattern("MMMM yyyy")
val text = YearMonth.of(2019, 11).format(format)
textView.setText(text)
}
}
| f10a355524faed70ce9744e5074b486656f55050 | [
"Markdown",
"Kotlin"
] | 3 | Kotlin | prasannahajare/ThreeTenTest | 63ffce8ff10272a554cb3346ae73d4e600d679f8 | 80ce63579fbc225ba53d6e2e674331eccd9beb20 |
refs/heads/master | <file_sep>mma8653_brkout
=====
Breakout for freescale MMA8653FC
pcb renders
=====


sch
=====
https://github.com/noahp/mma8653_brkout/raw/master/mma8652_brkout.pdf
<file_sep>
'''
Basic mma8653 breakout interface.
'''
import serial
import time
import sys
import re
def sendCmd(cmdstr):
pirate.write(bytes(cmdstr))
time.sleep(0.05)
def sendCmdWithEcho(cmdstr):
# purge
while pirate.inWaiting() != 0:
ch = pirate.read()
# write the command
pirate.write(bytes(cmdstr))
time.sleep(0.05)
outstr = ''
while pirate.inWaiting() != 0:
ch = pirate.read()
if ch:
outstr += ch
else:
break
return outstr
def initializeBusPirate():
# reset
result = sendCmdWithEcho("#\n")
if result.find("Bus Pirate v3.5") == -1:
print "Error no Bus Pirate found!"
exit(-1)
# mode
sendCmd("m\n")
# 4=i2c
sendCmd("4\n")
# 4=400kHz
sendCmd("4\n")
# turn on 3.3v supply
sendCmd("W\n")
def mma8653_readReg(reg):
readcmd = "[0x3a 0x%02X [0x3b r]\n"%reg
# try to read the reg
rawresult = sendCmdWithEcho(readcmd)
result = ""
for line in rawresult.split("\n"):
if line.find("READ") != -1:
result = line[line.find("READ: ")+len("READ: "):].strip()
return result
def mma8653_writeReg(reg, val):
readcmd = "[0x3a 0x%02X 0x%02X]\n"%(reg, val)
# try to write the reg
rawresult = sendCmdWithEcho(readcmd)
return rawresult
def mma8653_find():
# try to read the who am i reg
devid = mma8653_readReg(0x0d)
if devid != "0x5A" and devid != "0x4A":
print "Error MMA8652/3 not found"
exit(-1)
print "MMA8652/3 Device ID: %s"%(devid)
def mma8653_active(activate):
if activate:
active = 0x01
else:
active = 0x00
mma8653_writeReg(0x2A, active)
def mma8653_getxyz():
readxyz = "[0x3a 0x00 [0x3b rrrrrrr]\n"
# try to read
rawresult = sendCmdWithEcho(readxyz)
result = []
for line in rawresult.split("\n"):
if line.find("READ") != -1:
readval = re.search("0x([0-9A-F]{2})", line)
if readval:
readval = readval.group(1)
result.append(int(readval, 16))
# use status?
# status = "0x%02X"%(result[0])
xyz = result [1:]
if len(xyz) != 6:
return (0,0,0)
x = xyz[0:2]
x = (x[0] << 4) | ((x[1] >> 4) & 0x0F)
y = xyz[2:4]
y = (y[0] << 4) | ((y[1] >> 4) & 0x0F)
z = xyz[4:]
z = (z[0] << 4) | ((z[1] >> 4) & 0x0F)
return x,y,z
# open the com port
portname = "COM25"
if len(sys.argv) > 1:
portname = sys.argv[1]
pirate = serial.Serial(portname, 115200, interCharTimeout=0.05)
# setup for spi mode, turn on pwr supply
initializeBusPirate()
# check mma8653
mma8653_find()
# set to active mode
mma8653_active(True)
# get raw x/y/z
xyz = mma8653_getxyz()
print "XYZ = ",xyz
pirate.close()
| f227c4875223ac31675dacf099ca0e1a45ebef95 | [
"Markdown",
"Python"
] | 2 | Markdown | noahp/mma8653_brkout | 1b5423956889fbcd5601649f5bae618d687a7606 | 27b9b37b19fc443764ab6e20e318ac2dc714cd5b |
refs/heads/master | <repo_name>joaovictor3g/nlw-heat-react<file_sep>/src/types/index.ts
export type User = {
avatar_url: string;
github_id: number
id: string;
login: string;
name: string;
}
export type Message = {
created_at: string;
id: string;
text: string;
user: User;
user_id: string;
}
export type AuthResponse = {
token: string;
user: User;
}<file_sep>/src/components/LoginBox/styles.ts
import styled from 'styled-components';
import bannerGirl from '../../assets/banner-girl.png';
export const Container = styled.div`
height: 100vh;
width: 100%;
background: #17171a url(${bannerGirl}) no-repeat center top;
padding: 440px 80px 0;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
strong {
font-size: 32px;
line-height: 36px;
}
`;
export const GithubSign = styled.a`
background: #ffcd1e;
margin-top: 32px;
padding: 0 40px;
height: 56px;
color: #09090a;
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
&:hover {
filter: brightness(0.9);
}
`;<file_sep>/src/components/MessageList/styles.ts
import styled from 'styled-components';
export const Container = styled.div`
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
> img {
height: 28px;
margin: 32px 0;
}
`;
export const MessageListBox = styled.ul`
list-style: none;
display: flex;
flex-direction: column;
gap: 40px;
flex: 1;
justify-content: center;
`;
export const MessageListItem = styled.li`
max-width: 440px;
&:nth-child(2) {
margin-left: 80px;
}
.message-user {
margin-top: 16px;
display: flex;
align-items: center;
.user-image {
padding: 2px;
background: linear-gradient(100deg, #ff008e 0%, #ffcd1e 100%);
border-radius: 50%;
line-height: 0;
img {
width: 30px;
height: 30px;
border-radius: 50%;
border: 4px solid #121214;
}
}
span {
font-size: 16px;
margin-left: 12px;
}
}
`;
export const MessageText = styled.p`
font-size: 20px;
line-height: 28px;
`;
<file_sep>/src/components/SendMessageForm/styles.ts
import styled from "styled-components";
export const Container = styled.div`
background: #1b1b1f;
padding: 24px;
align-self: center;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
position: relative;
.sign-out {
background: transparent;
border: 0;
color: #c4c4cc;
position: absolute;
left: 24px;
top: 24px;
cursor: pointer;
&:hover {
filter: brightness(0.9);
}
}
`;
export const Header = styled.header`
display: flex;
flex-direction: column;
align-items: center;
.user-image {
padding: 3px;
background: linear-gradient(100deg, #ff008e 0%, #ffcd1e 100%);
border-radius: 50%;
line-height: 0;
img {
width: 94px;
height: 94px;
border-radius: 50%;
border: 6px solid #121214;
}
}
.username {
font-size: 24px;
line-height: 30px;
margin-top: 16px;
}
.user-github {
display: flex;
align-items: center;
margin-top: 8px;
color: #c4c4cc;
svg {
margin-right: 8px;
}
}
`;
export const Form = styled.form`
display: flex;
flex-direction: column;
align-self: stretch;
margin-top: 48px;
background: #202024;
label {
padding: 18px 24px;
font-size: 20px;
background: #29292e;
font-weight: bold;
text-align: left;
}
textarea {
background: transparent;
border: 0;
padding: 24px;
resize: none;
height: 160px;
color: #e1e1e6;
font-size: 16px;
line-height: 24px;
&:focus {
outline: 0;
}
&::placeholder {
color: #8d8d99;
}
}
button[type='submit'] {
align-self: flex-end;
background: #ff008e;
margin: 24px;
padding: 0 32px;
height: 40px;
color: #fff;
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;
border: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
cursor: pointer;
&:hover {
filter: brightness(0.9);
}
}
`;<file_sep>/src/pages/Home/styles.ts
import styled, { css } from 'styled-components';
import backgroundImg from '../../assets/background.svg';
type MainProps = {
hasSignedUser?: boolean;
}
export const Main = styled.main<MainProps>`
height: 100vh;
position: relative;
${props => props.hasSignedUser && css`
&::before {
content: '';
height: 100vh;
width: 420px;
background: url(${backgroundImg}) no-repeat;
background-size: cover;
position: absolute;
right: 0;
top: 0;
}
`}
`;
export const Wrapper = styled.div`
max-width: 1200px;
margin: 0 auto;
height: 100%;
width: 100%;
display: grid;
grid-template-columns: 1fr 453px;
column-gap: 120px;
`; | c517c513e6302eaf485e76111469159ca01f7d37 | [
"TypeScript"
] | 5 | TypeScript | joaovictor3g/nlw-heat-react | 45889c861a7c26a8be3e63a1e2f2fd06826b8884 | 58f6617ae84572ca9b745020af5d4bcc1efc550c |
refs/heads/master | <repo_name>Nkeoualionel/React-Hook-Firestore-App<file_sep>/src/components/time-list.jsx
import React from 'react'
import {useEffect, useState} from 'react'
import firebase from '../firebase';
const SORT_OPTION = {
'TIME_ASC': {column: 'secondes', direction: 'asc'},
'TIME_DESC': {column: 'secondes', direction: 'desc'},
'TITLE_ASC': {column: 'title', direction: 'asc'},
'TITLE_DESC': {column: 'title', direction: 'desc'}
}
function useGetDataTime (orderBy = 'TIME_ASC') {
const [time, setTime] = useState([])
useEffect(() => {
const unsuscribe = firebase
.firestore()
.collection('reminders')
.orderBy(SORT_OPTION[orderBy].column, SORT_OPTION[orderBy].direction)
.onSnapshot((snapshot) => {
const newTime = snapshot.docs.map((doc) => ({
id: doc.id,
...doc.data()
}))
setTime(newTime)
})
return () => unsuscribe()
}, [orderBy])
return time
}
const Timelist = () => {
const [orderBy, setOrderBy] = useState('TIME_ASC')
const times = useGetDataTime(orderBy)
return (
<div>
<div>
<h2>Time Liste</h2>
<div>
<label>Sort By</label>{''}
</div>
<select value={orderBy} onChange={e => setOrderBy(e.target.value)}>
<option value="TIME_ASC">Timer (asc) </option>
<option value="TIME_DESC">Timer (desc) </option>
<option disabled>-------</option>
<option value="TITLE_ASC">Order by (a-z) </option>
<option value="TITLE_DESC">Order by (z-a) </option>
</select>
</div>
<ol>
{times.map((time) =>
<li key={time.id}>
<div className="time-entry">
{time.title}
<code className="time">{time.secondes} secondes</code>
</div>
</li>
)}
</ol>
</div>
)
}
export default Timelist<file_sep>/src/App.js
import React from 'react';
import './App.css';
import firebase from './firebase';
import Timelist from './components/time-list'
import TimeEntryForm from './components/time-entry-form'
function App() {
return (
<div className="App">
<h1>
Your Time reminder
</h1>
<Timelist/>
<TimeEntryForm/>
</div>
);
}
export default App;
| 543c22a68f53ad6cba1cf18d0a9ead49225db707 | [
"JavaScript"
] | 2 | JavaScript | Nkeoualionel/React-Hook-Firestore-App | 3e1c40d60b2b12ea5507bae08ff368dd49973d7e | f136725b4d34a97f4b9f37096bca3203998af422 |
refs/heads/master | <file_sep><?php defined('ABSPATH') or die ('Not allowed!');
template('header'); ?>
<header id="content-header" class="clearfix">
<h3 id="page-title">
<?php echo 'Halaman '.(!empty($do) ? ucfirst($do) : 'Beranda: Selamat datang '.User::current('nama')) ?>
</h3>
</header>
<div id="content-main" class="clearfix">
<?php foreach (App::$mods as $modName => $modConf) {
$modHome = $modConf['path'].DS.'home'.EXT;
if ($modConf['enabled'] === true && file_exists($modHome)) include $modHome;
} ?>
</div>
<?php template('footer') ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
/**
* Array Helper
* -------------------------------------------------------------------------- */
/**
* Memastikan bahwa $array adalah asosiatif atau tidak
*
* @param array $array Array parameter
* @return bool
*/
function isArrayAssoc(array $array) {
$array = array_keys($array);
$array = array_filter($array, 'is_string');
return (bool) count($array);
}
/**
* Menerapkan nilai default pada array
*
* @param array $array Array Parameter
* @param array $default Nilai Default
* @return array
*/
function arraySetDefaults(array $array, array $default) {
foreach ($default as $key => $val) {
if (!isset($array[$key])) {
$array[$key] = $val;
}
}
return $array;
}
/**
* Menerapkan nilai default pada array
*
* @param array $array Array Parameter
* @param array $default Nilai Default
* @return array
*/
function arraySetValues(array $array, array $default) {
foreach ($array as $key => $value) {
$array[$key] = isset($default[$key]) ? $default[$key] : $value;
}
return $array;
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!') ?>
<div class="product-single">
<img src="<?php echo $row->gambar ?>" alt="<?php echo $row->nama ?>">
<div class="detail">
<h3 class="title"><?php echo $row->nama ?></h3>
<div class="meta">
<?php echo anchor('shop/cart/'.$row->id.'?do=add', 'Beli', array('class' => 'btn')) ?>
<span>Rp. <?php echo formatAngka($row->harga) ?></span>
</div>
<p><?php echo $row->keterangan ?></p>
</div>
</div>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
/**
* Menu
* -------------------------------------------------------------------------- */
function siteMenu($attrs = '') {
return App::$menu->show($attrs);
}
/**
* Templates
* -------------------------------------------------------------------------- */
$path = App::conf('template') ?: 'base';
define('TMPLPATH', 'templates'.DS.$path.DS);
function template($layout) {
$app =& App::instance();
$layout_path = templateDir($layout, true);
$app->render($layout_path);
}
function templateDir($path = '', $absolute = false) {
$abspath = $absolute == true ? ABSPATH : '';
return $abspath.TMPLPATH.$path;
}
function templateUri($path = '') {
return siteUrl(TMPLPATH.$path);
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
$isAdmin = User::is('admin'); ?>
<div class="product-cart">
<table class="data">
<thead>
<tr>
<th style="width:30%;"><?php echo $isAdmin ? 'Nama Pelanggan' : 'Order' ?></th>
<th style="width:15%;">Tanggal</th>
<th style="width:20%;">Total (Rp.)</th>
<th style="width:20%;">Status</th>
<th class="action">Pilihan</th>
</tr>
</thead>
<tbody>
<?php if (($query = Shop::order()) && ($total = $query->count()) > 0) : foreach ($query->result(true) as $row) : ?>
<tr id="order-<?php echo $row->id ?>">
<td><?php echo $isAdmin ? anchor($row->id_pengguna, $row->fullname) : formatTanggal($row->tgl_belanja, 'dmy').'-'.$row->id ?></td>
<td class="acenter"><?php echo formatTanggal($row->tgl_belanja) ?></td>
<td class="aright"><?php echo formatAngka($row->total_harga) ?></td>
<td class="acenter"><?php echo $row->lunas == 1 ? 'Lunas' : 'Belum dibayar' ?></td>
<td class="action"><div class="btn-group">
<?php if ($isAdmin): ?>
<?php echo anchor('?p=form&id='.$row->id, 'Ubah', array('class' => 'btn btn-edit')) ?>
<?php echo anchor('?p=hapus&id='.$row->id, 'Hapus', array('class' => 'btn btn-hapus')) ?>
<?php else: ?>
<?php echo $row->lunas == 0 ? anchor('?p=form&id='.$row->id, 'Bayar', array('class' => 'btn btn-edit')) : '' ?>
<?php endif ?>
</div></td>
</tr>
<?php endforeach; else: ?>
<tr><td colspan="4" style="text-align:center;">Belum ada data.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class Menu
{
public static $list = array();
protected static $order = 0;
public function add($name, array $configs = array()) {
$configs = arraySetDefaults($configs, array(
'caps' => array(),
'title' => '',
'order' => 1,
'subs' => null,
));
if ($configs['order'] > 0 && !isset(self::$list[$name])) {
$configs['order'] += self::$order;
self::$order += 1;
}
self::$list[$name] = $configs;
}
protected function getEnabled() {
$list = array();
foreach (self::$list as $name => $configs) {
if (App::enabledMod($name) || $name == 'home') {
$list[$name] = $configs;
}
}
return $list;
}
public function show($attr = '', $menus = array(), $parent = '', $trail = '') {
$attr || $attr = 'class="hmenu"';
$output = '<ul '.$attr.'>';
if (empty($menus)) {
$menus = $this->getEnabled();
$totalMenu = count($menus);
$order = array();
foreach ($menus as $mkey => $mattr) {
$order[$mkey] = $mattr['order'] > 0 ? $mattr['order'] : $totalMenu;
}
array_multisort($order, SORT_ASC, $menus);
}
if ($parent !== '') {
$trail || $trail = '/';
$parent = $parent.$trail;
}
foreach ($menus as $link => $menuattr) {
if (is_string($menuattr)) {
$menuattr = array('title' => $menuattr);
}
if (empty($menuattr['caps']) || in_array(Module::user()->current('level'), $menuattr['caps'])) {
$link = $parent.strtolower($link);
$output .= '<li '.$this->current($link).'>'
. anchor($link, $menuattr['title']);
if (!empty($menuattr['subs'])) {
$output .= $this->show('class="submenu"', $menuattr['subs'], $link, $trail);
}
$output .= '</li>';
}
}
$output .= '</ul>';
return $output;
}
private function current($link) {
$baseurl = App::conf('baseurl');
$link || $link = $baseurl;
if (!($current = App::getUri())) {
$current = $baseurl;
}
return strpos($current, $link) !== false ? 'class="active"' : '';
}
public static function toolbar($toolbars, $class = '') {
$class || $class = 'page-toolbar';
$out = '<nav class="'.$class.'">';
foreach ($toolbars as $link => $label) {
if (is_array($label)) {
$out .= static::toolbar($label, 'btn-group toolbar-btn');
} else {
$id = strtolower($label);
$id = str_replace(' ', '-', $id);
$attrs = array(
'label' => $label,
'class' => 'btn toolbar-btn',
'id' => $id.'-btn',
);
if (substr($link, -7, 7) == ':dialog') {
$link = str_replace(':dialog', '', $link);
$attrs['data-dialog'] = '';
}
$attrs['href'] = strpos($link, '?') === 1 ? currentUrl($link) : siteUrl($link) ;
$out .= anchor($attrs);
}
}
$out .= '</nav>';
return $out;
}
}
// EOF menu.php
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
$qside = Shop::fetchCat(); ?>
<div id="product-sidebar" class="sidebar">
<div class="widget">
<h4 class="widget-title">Pencarian</h4>
<form action="<?php echo currentUrl() ?>" id="product-search">
<input type="search" name="search" id="search">
<input type="submit" name="s" id="s-btn" class="btn" value="Cari">
</form>
</div>
<div class="widget">
<h4 class="widget-title">Kategori <?php if (User::is('admin')) echo anchor('shop/kat?p=form', 'Buat kategori', array('class' => 'btn fright')) ?></h4>
<ul class="widget-content">
<?php if ($qside && $qside->count() > 0) : foreach ($qside->result() as $row) : ?>
<li><?php echo anchor('shop/kat/'.$row->id, $row->nama) ?></li>
<?php endforeach; else: ?>
<li>Kategori kosong.</li>
<?php endif; ?>
</ul>
</div>
</div>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class Shop extends Module
{
private static
$tAlias = array(
'belanja' => 'tbl_belanja',
'produk' => 'tbl_produk',
'slide' => 'tbl_banner',
'kat' => 'tbl_produk_kat',
);
public function __construct() {
$module = get_class($this);
$this->initialize(strtolower($module), array(
'title' => 'Toko',
'order' => 2,
));
}
public static function cartItems() {
if ($items = App::session('cart_items')) {
$items = unserialize($items);
return $items;
}
return array();
}
public static function cart($id, $action) {
if (!($items = self::cartItems())) {
App::session('cart_items', '');
$items = array();
}
switch ($action) {
case 'add':
$items[$id] = isset($items[$id]) ? $items[$id] + 1 : 1;
break;
case 'reduce':
if (isset($items[$id])) {
if ($items[$id] > 1) {
$items[$id] = $items[$id] - 1;
} else {
unset($items[$id]);
}
}
break;
case 'remove':
if (isset($items[$id])) {
unset($items[$id]);
}
break;
}
App::session('cart_items', serialize($items));
redirect('shop/cart');
}
public static function checkout() {
if (!User::loggedin()) {
redirect('user?p=form&do=login&redir=shop/cart');
}
if ($items = self::cartItems()) {
$belanja = array(
'id_pengguna' => User::current('id'),
'tgl_belanja' => date('Y-m-d'),
'produk' => serialize($items),
'total_harga' => post('total-harga'),
);
if ($return = static::$db->save(self::$tAlias['belanja'], $belanja)) {
App::session('cart_items', '');
return $return;
}
}
return false;
}
public static function order() {
$lunas = (int) get('lunas') ?: 0;
$sql = 'SELECT b.*, u.fullname FROM %s b INNER JOIN %s u ON u.id=b.id_pengguna WHERE b.lunas='.$lunas;
if (!User::is('admin')) {
$sql .= ' AND b.id_pengguna='.User::current('id');
}
return static::$db->query($sql, array(self::$tAlias['belanja'], 'tbl_pengguna'));
}
public static function fetch($table, $val = false, $key = '') {
$where = array();
if ($val !== false) {
$key || $key = 'id';
$where = array($key => $val);
}
return static::$db->select(self::$tAlias[$table], '', $where);
}
public static function fetchOne($table, $val = false, $key = '') {
if ($query = self::fetch($table, $val, $key)) {
return $query->fetchOne();
}
return false;
}
public static function save() {
if ($katId = post('kategori')) {
$kat = static::fetchOneCat($katId, 'id');
}
$formData = array(
'nama' => post('nama'),
'harga' => (int) post('harga'),
'ket' => (int) post('ket'),
'stok' => (int) post('stok'),
'img' => '350',
);
}
public static function delete() {}
public static function fetchCat($val = false, $key = '') {
return self::fetch('kat', $val, $key);
}
public static function fetchOneCat($val = false, $key = '') {
return self::fetchOne('kat', $val, $key);
}
public static function saveCat() {}
public static function deleteCat() {}
public static function fetchSlide($val = false, $key = '') {
$sql = "SELECT s.id, s.gambar, s.judul FROM %s s WHERE s.aktif=1 AND s.tipe='slide'";
return static::$db->query($sql, array(self::$tAlias['slide']));
}
public static function fetchOneSlide($val = false, $key = '') {
return self::fetchOne('slide', $val, $key);
}
public static function saveSlide() {}
public static function deleteSlide() {}
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class Pdf extends Fpdf\Fpdf
{
protected
$docTitle, $docCop, $docDate,
$conf = array(
'fontFamily' => 'Times',
'fontStyle' => '',
'fontSize' => 10,
'tableBorder' => 1,
);
public function __construct($orientation = '', $unit = '', $size = '') {
$orientation || $orientation = 'P';
$unit || $unit = 'mm';
$size || $size = 'A4';
parent::__construct($orientation, $unit, $size);
$this->setMargins(10, 10);
$this->setCreator(App::conf('app.title'));
$this->setAuthor(User::current('nama'));
}
public function docTitle($docTitle) {
$this->docTitle = $docTitle;
$this->docDate = date('d M Y, H');
$this->setTitle($docTitle.' - '.$this->docDate);
}
public function docCop($docTitle) {
$this->docCop = array(
App::conf('dinas.kab'),
App::conf('dinas.kec'),
App::conf('dinas.desa'),
'Alamat: '.App::conf('dinas.alamat'),
);
return $this->docTitle($docTitle);
}
public function header() {
if ($this->docCop) {
$ln = 1;
$tln = count($this->docCop);
$this->image('storage/logo.png', 10, 8, 18);
$this->setFont($this->conf['fontFamily'], 'B', 10);
foreach ($this->docCop as $cop) {
$border = $ln == $tln ? 'B' : 0;
$height = $ln == $tln ? 6 : 5;
$this->cell(0, $height, $cop, $border, 0, 'C');
$this->ln();
$ln++;
}
$this->docCop = array();
$this->ln();
}
$this->setFont($this->conf['fontFamily'], 'B', 14);
$this->cell(0, 15, trim($this->docTitle), 0, 0, 'C');
$this->ln();
}
public function setData(Db $resource, array $column) {
$i = 0;
$widths = $data = array();
foreach ($column as $field => $header) {
$widths[$field] = $this->getStringWidth($header);
}
if ($resource->count() > $i) {
foreach ($resource->result() as $row) {
foreach ($fields as $field) {
$_val = isset($row->$field) ? $row->$field : '-';
$_fWidth = $this->getStringWidth($_val);
$widths[$field] = ($widths[$field] > $_fWidth ? $widths[$field] : $_fWidth);
$data[$i][$field] = $_val;
}
$i++;
}
}
return $this->setTable($column, $data, $widths);
}
public function setTable(array $header, array $data, array $widths) {
$column = count($header);
list($pWidth, $pHeight) = $this->_getPageSize($this->curPageSize);
$contentWidth = $pWidth - $this->rightMargin - $this->leftMargin;
$cellWidth = floor($contentWidth / $column);
$_cWhidth = 0;
$this->setFont($this->conf['fontFamily'], 'B');
foreach ($header as $hKey => $hVal) {
$this->cell($widths[$hKey], 6, $hVal, $this->conf['tableBorder'], 0, 'C');
$_cWhidth += $widths[$hKey];
}
$this->ln();
$this->setFont($this->conf['fontFamily']);
if (!empty($data)) {
foreach ($data as $row) {
foreach ($row as $cKey => $col) {
$this->cell($widths[$cKey], 6, $col, $this->conf['tableBorder']);
}
$this->ln();
}
} else {
$mpt = ($_cWhidth > $contentWidth ? $contentWidth : $_cWhidth) - ($column - 2);
$this->cell($mpt, 6, 'Kosong', $this->conf['tableBorder'], 0, 'C');
}
}
public function toFile() {
$file = $this->docTitle.' - '.$this->docDate.'.pdf';
$this->output($file, 'F');
if (file_exists($file)) {
$dest = ABSPATH.'storage'.DS.$file;
@rename($file, $dest);
if ($handle = fopen($dest, 'r')) {
$dest = str_replace(ABSPATH, '', $dest);
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
echo fread($handle, filesize($dest));
fclose($handle);
}
}
}
}
<file_sep><!DOCTYPE html>
<html lang="id">
<head>
<meta charset="utf-8">
<title><?php echo App::conf('app.title') ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<!-- FAVICON -->
<link href="<?php echo templateUri('asset/img/favicon.ico') ?>" rel="shortcut icon">
<!-- END FAVICON -->
<!-- CSS -->
<link href="<?php echo templateUri('lib/css/jquery-ui.css') ?>" rel="stylesheet">
<link href="<?php echo templateUri('asset/css/style.css') ?>" rel="stylesheet">
<!-- END CSS -->
<!-- JS -->
<script src="<?php echo templateUri('lib/js/jquery.min.js') ?>"></script>
<script src="<?php echo templateUri('lib/js/jquery-ui.min.js') ?>"></script>
<!-- <script src="<?php // echo templateUri('lib/js/jquery-validate.min.js') ?>"></script> -->
<script src="<?php echo templateUri('asset/js/script.js') ?>"></script>
<!-- END JS -->
</head>
<body <?php bodyAttrs()?> data-siteurl="<?php echo siteUrl() ?>">
<div class="wrapper sticky-wrap">
<div class="sticky-head">
<header id="site-header">
<div id="brand">
<h3><?php echo App::conf('app.title') ?></h3>
<span><?php echo App::conf('app.desc') ?></span>
</div>
<?php echo siteMenu('id="site-nav" class="nav-menu vmenu clearfix"') ?>
<div class="user-menu">
<?php echo User::menu() ?>
</div>
</header>
<div id="site-contents" class="clearfix">
<file_sep>--
-- MySQL 5.5.40
-- Tue, 18 Nov 2014 06:56:29 +0000
--
DROP TABLE IF EXISTS `tbl_pengguna`;
CREATE TABLE `tbl_pengguna` (
`id` int(11) not null auto_increment,
`username` varchar(50) not null,
`email` varchar(100) not null,
`password` varchar(32) not null,
`level` tinyint(1) not null,
PRIMARY KEY (`id`),
UNIQUE KEY (`username`),
UNIQUE KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tbl_pengguna` (`username`, `email`, `password`, `level`) VALUES
('admin', '<EMAIL>', '<PASSWORD>', 1);
<file_sep># Toko Onlen
DEMO: http://tokonlen.herokuapp.com/
## Requirements
+ Make sure you have activated `mod_rewrite`
+ You have [Composer](http://getcomposer.org) installed on your machine
+ Setup your `php` executable in `$PATH` environment (optional)
## Installation
+ Clone or [Download](get/master.zip) this repo and put it in your `docroot` folder,
+ Rename `configs_sample.php` to `configs.php`, and do as you wish :grin:,
+ Configure the `.htaccess` file,
+ Install composer dependencies,
+ Enjoy :grin:
**NB:**
This package also available in [packagist](https://packagist.org/). So, if you're as lazy as me, simply run:
```bash
$ cd /path/to/your/docroot/
$ composer create-project feryardiant/php-startapp myapp
```
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
/**
* Request Helper
* -------------------------------------------------------------------------- */
/**
* Mendapatkan nilai dari $_REQUEST request
*
* @param string Nama field
* @return string
*/
function req($key) {
if (isset($_REQUEST[$key]))
return escape($_REQUEST[$key]);
return;
}
/**
* Mendapatkan nilai dari $_GET request
*
* @param string Nama field
* @return string
*/
function get($key) {
if (isset($_GET[$key]))
return escape($_GET[$key]);
return;
}
/**
* Mendapatkan nilai dari $_POST request
*
* @param string Nama field
* @return string
*/
function post($key) {
if (isset($_POST[$key]))
return escape($_POST[$key]);
return;
}
/**
* String Helper
* -------------------------------------------------------------------------- */
/**
* Menyaring karakter dari $string
*
* @param string $string String yang akan disarung
* @return string
*/
function escapeString($string) {
if (!is_string($string)) {
return;
}
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
/**
* Menyaring karakter dari $char
*
* @param string $char String yang akan disarung
* @return string
*/
function escape($char) {
if (is_numeric($char) || is_int($char)) {
return (int) $char;
} elseif (is_string($char)) {
return htmlspecialchars($char, ENT_QUOTES, 'UTF-8');
}
}
/**
* Formating Helper
* -------------------------------------------------------------------------- */
/**
* Get formated number
*
* @param double $number Decimal number
* @param string $desimal Decimal count
* @param string $bts_des Decimal number separator
* @param string $bts_rbn Tausans number separator
* @return string
*/
function formatAngka($number, $desimal = '', $bts_des = '', $bts_rbn = '') {
$bts_des || $bts_des = ',';
$bts_rbn || $bts_rbn = '.';
$desimal || $desimal = 2;
if (is_numeric($number) || is_double($number)) {
return number_format($number, $desimal, $bts_des, $bts_rbn);
}
return $number;
}
/**
* Get formated date from $fmt_date config
*
* @param string $string String that will formated
* @param string $format Date Format (leave it empty to use default config)
* @return string
*/
function formatTanggal($string, $format = '') {
$format || $format = App::conf('fmtdate');
return date($format, strtotime($string));
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class page extends Module
{
public function __construct() {
$module = get_class($this);
$this->initialize(strtolower($module), array(
'title' => 'Halaman',
));
}
public static function fetch($val = false, $key = '') {
$where = array();
if ($val !== false) {
$key || $key = 'id';
$where = array($key => $val);
}
return static::$db->select('tbl_halaman', '', $where);
}
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
template('header'); ?>
<header id="content-header" class="clearfix">
<h3 id="page-title"><?php echo $heading ?></h3>
</header>
<div id="content-main" class="clearfix">
<p><?php echo is_array($message) ? implode('</p><p>', $message) : $message ?></p>
</div>
<?php template('footer') ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!') ?>
<div class="product-cart">
<?php if (Shop::checkout()): ?>
<span class="alert success">Terima kasih telah berbelanja di <?php echo App::conf('app.title') ?>. Segeralah melakukan pembayaran agar pesanan anda dapat secepatnya kami proses.</span>
<?php else: ?>
<span class="alert error">Oops! Kesalahan.</span>
<?php endif ?>
</div>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
$do = get('do'); ?>
<form action="<?php echo currentUrl() ?>" id="user-form" method="post" class="form">
<input type="hidden" name="action" value="<?php echo $do ?>">
<div class="control-group">
<label class="label" for="username">Username</label>
<div class="control-input">
<input type="text" required name="username" id="username">
</div>
</div>
<?php if ($do == 'register'): ?>
<input type="hidden" name="level" value="0">
<div class="control-group">
<label class="label" for="nama">Nama Lengkap</label>
<div class="control-input">
<input type="text" required name="nama" id="nama">
</div>
</div>
<div class="control-group">
<label class="label" for="email">Email</label>
<div class="control-input">
<input type="email" required name="email" id="email">
</div>
</div>
<?php endif ?>
<div class="control-group">
<label class="label" for="password">Password</label>
<div class="control-input">
<input type="password" required name="password" id="password">
</div>
</div>
<?php if ($do == 'register'): ?>
<div class="control-group">
<label class="label" for="passconf">Ulangi Password</label>
<div class="control-input">
<input type="password" required name="pass_conf" id="pass_conf">
</div>
</div>
<?php endif ?>
<?php if (User::is('admin')): ?>
<div class="control-group">
<label class="label" for="level">Level</label>
<div class="control-input">
<select required name="level" id="level">
<option>---</option>
<?php foreach (User::$levels as $val => $level) : ?>
<option <?php echo ($id and $data->level == $val) ? 'selected' : '' ?> value="<?php echo $val ?>"><?php echo $level ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<?php endif ?>
<div class="form control-action">
<?php if (!User::loggedin()): ?>
<?php if ($do == 'register'): ?>
<input type="submit" name="register" id="submit-btn" class="btn" value="Kirim" autofocus>
<?php echo anchor('?user=login', 'Login', array('class' => 'btn fright')) ?>
<?php else: ?>
<input type="submit" name="login" id="submit-btn" class="btn" value="Login">
<?php echo anchor('?user=register', 'Registrasi', array('class' => 'btn fright')) ?>
<?php endif ?>
<?php else: ?>
<input type="submit" name="submit" id="submit-btn" class="btn" value="Simpan">
<input type="reset" id="cancel-btn" class="btn" value="Batal">
<?php endif ?>
</div>
</form>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class Error
{
public static function errHandler($errno, $message, $file, $line, $context) {
$die = false;
switch ($errno) {
case E_USER_ERROR:
$type = 'error';
$die = true;
break;
case E_USER_WARNING:
case E_WARNING:
case @E_RECOVERABLE_ERROR:
$type = 'warning';
break;
case E_USER_NOTICE:
case E_NOTICE:
case @E_STRICT:
$type = 'notice';
break;
default:
$type = '';
$die = true;
break;
}
$text = $message;
$file = str_replace(array(ABSPATH, '/'), array('', DS), $file);
$message = '<strong>'.$text.'</strong>';
if (App::conf('debug')) {
$message .= ' in <code>'.$file.' ('.$line.')</code>';
}
App::alert($message, $type, $die);
}
public static function excHandler($exc) {
App::alert($exc);
}
}
// EOF error.php
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
$query = Page::fetch(); ?>
<?php if ($query && ($total = $query->count()) > 0) : foreach ($query->result(true) as $row) : ?>
<div class="product">
<?php echo anchor('page/'.$row->alias, $row->nama) ?>
<p><?php echo $row->konten ?></p>
</div>
<?php endforeach; else: ?>
<span class="alert warning no-product">Tidak ada produk.</span>
<?php endif; ?>
</div>
<?php if ($query && $total): ?>
<div class="data-info clearfix">
<p class="data-total">Total data: <?php echo $total ?></p>
<div class="data-page"><?php echo pagination($total) ?></div>
</div>
<?php endif ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
/**
* Date Helper
* -------------------------------------------------------------------------- */
/**
* Mendapatkan daftar bulan
*
* @return array
*/
function getBulan() {
$output = array();
for ( $i = 1; $i <= 12; $i++) {
$month = date('F', mktime(0, 0, 0, $i, 1));
$output[$i] = $month;
}
return $output;
}
/**
* Mendapatkan daftar tahun
*
* @param int $interfal Selisih tahun
* @return array
*/
function getTahun($interfal = 10) {
$output = array();
for ( $i = 0; $i <= $interfal; $i++) {
$year = $i === 0 ? date('Y') : date('Y', mktime(0, 0, 0, $i, 1, date('Y')-$i));
$output[$year] = $year;
}
return $output;
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
if ($query && ($total = $query->count()) > 0): $c = 1; foreach ($query->result(true) as $row): ?>
<div class="product">
<img src="<?php echo $row->gambar ?>" width="150" height="150" alt="<?php echo $row->nama ?>">
<?php echo anchor('shop/product/'.$row->id, $row->nama) ?>
<span>Rp. <?php echo formatAngka($row->harga) ?></span>
</div>
<?php
if ($c % 4 == 0) echo '<hr>';
if ($isHome && $c == 8) break;
$c++; endforeach; else: ?>
<span class="alert warning no-product">Tidak ada produk.</span>
<?php endif;
if ($isHome && $total) echo anchor('shop', 'Lihat selengkapnya', array('class' => 'btn')); ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
define('DS', DIRECTORY_SEPARATOR);
define('EXT', '.php');
define('SYSPATH', dirname(__FILE__).DS);
define('VENDORPATH', ABSPATH.'vendor'.DS);
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
/**
* Memuat Composer autoloader (jika ada)
*/
if (file_exists($composer = VENDORPATH.'autoload'.EXT)) {
require_once $composer;
}
/**
* Class Loader
*
* Memuat semua file yang ada dalam direktory 'classes'.
* @link http://php.net/manual/en/function.spl-autoload-register.php
*/
spl_autoload_register('autoload_register');
function autoload_register($class) {
$name = strtolower($class);
$path = SYSPATH.'classes'.DS.$name.EXT;
if (file_exists($path)) {
require_once $path;
}
}
/**
* Memuat File konfigurasi
*/
$configs = file_exists($confPath = ABSPATH.'configs'.EXT) ? require $confPath : array();
/**
* Inisialisasi Aplikasi dan menerapkan konfigurasi
*/
$app = new App($configs);
/**
* Function Loader
*
* Memuat semua file yang ada dalam direktory 'functions'.
*/
foreach (glob(SYSPATH.'functions/*'.EXT) as $function) {
require_once $function;
}
/**
* Mengaktifkan Mode Debug, ganti 'true' ke 'false' untuk mematikan mode ini.
* Atau cukup dengan menghapus baris tersebut.
*/
$app->debug(true);
/**
* Inisialisasi Class Database jika terdapat pengaturan Database dalam file Konfigurasi.
*/
$dbConfigs = isset($configs['db']) ? $configs['db'] : array();
$db = new Database($dbConfigs);
/**
* Custom error handler
*/
set_error_handler('Error::errHandler');
set_exception_handler('Error::excHandler');
return $app;
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
/**
* URL
* -------------------------------------------------------------------------- */
/**
* Basis URL aplikasi
*
* @param string Permalink
* @return string
*/
function siteUrl($permalink = '') {
if (in_array(substr($permalink, 0, 1), array('#', '?'))) {
$permalink = App::getUri().$permalink;
}
return App::conf('baseurl').$permalink ;
}
/**
* Digunakan untuk pengalihan halaman (URL)
*
* @param string $url URL Tujuan
* @return void
*/
function redirect($url = '', $delay = false) {
if (PHP_SAPI != 'cli') {
$url = strpos('?', $url) === 1 ? currentUrl($url) : siteUrl($url);
if ($delay !== false) {
header("refresh: {$delay}; url={$url}");
} else {
header("Location: ".$url);
}
unset($_POST, $_GET, $_REQUEST);
exit();
}
}
/**
* Digunakan untuk mendapatkan URL saat ini
*
* @param string $permalink URL tambahan bila perlu
* @return string
*/
function currentUrl($permalink = '', $trim = false) {
$req = !empty($_GET) ? '?'.http_build_query($_GET) : '';
$url = siteUrl(App::getUri().$req);
if ($permalink) {
$permalink = '/'.$permalink;
}
if ($trim === true) {
$url = rtrim($url, '/');
}
return $url.$permalink;
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class Module
{
protected static $db;
public static function __callStatic($module, $param) {
$modClass = ucfirst($module);
if (isset(App::$mods[$module]) && is_subclass_of($modClass, 'Module')) {
if (!App::enabledMod($module)) {
App::error('Module "'.$module.'" not found or it\'s disabled.');
} else {
$instance =& App::$mods[$module]['instance'];
return $instance;
}
}
}
final protected function initialize($name, array $configs = array()) {
static::$db =& Db::instance();
App::$menu->add($name, $configs);
}
// protected static function api()
// {}
}
// EOF module.php
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
function module($modName) {
if (!App::enabledMod($modName)) {
App::error('Module "'.$modName.'" not found or it\'s disabled.');
}
$modClass = ucfirst($modName);
if (is_subclass_of($modClass, 'Module')) {
static $mod;
if ($mod === null) {
$mod = new $modClass();
}
return $mod;
} else {
App::error('Module "'.$modName.'" is invalid.');
}
}
<file_sep>$(function () {
// Jquery UI Tab Trigger
$('.jqui-tabs').hide()
$(document).ready(function () {
$('.jqui-tabs').show().tabs()
})
// Jquery UI Datepicker Trigger
$('.jqui-datepicker').datepicker({dateFormat: 'dd-mm-yy'})
// Form Cancel button function
$('#cancel-btn').click(function () {
window.location.href = $('#kembali-btn').attr('href')
})
// Data Table Delete button function
$('.btn-hapus').click(function (e) {
if (!confirm($(this).data('confirm-text'))) {
e.preventDefault()
}
})
// Disable click on blank link
$('a[href="#"]').click(function (e) {
e.preventDefault();
})
})
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
if (post('submit')) {
App::alert('Terjadi kesalahan dalam penyimpanan produk, silahkan periksa kembali.', 'error');
} ?>
<form action="<?php echo currentUrl() ?>" id="user-form" method="post" class="form">
<div class="control-group">
<label class="label" for="nama">Nama</label>
<div class="control-input">
<input type="text" required name="nama" id="nama">
</div>
</div>
<div class="control-group">
<label class="label" for="harga">Harga & Stock</label>
<div class="control-input">
<input type="text" required name="harga" class="small" id="harga" placeholder="Harga (Rp.)">
<input type="number" required name="stock" class="small" id="stock" placeholder="Stock">
</div>
</div>
<div class="control-group">
<label class="label" for="keterangan">Keterangan</label>
<div class="control-input">
<textarea required name="keterangan" id="keterangan"></textarea>
</div>
</div>
<div class="control-group">
<label class="label" for="foto">Foto</label>
<div class="control-input">
<input type="file" name="foto">
</div>
</div>
<div class="form control-action">
<input type="submit" name="submit" id="submit-btn" class="btn" value="Simpan">
<input type="reset" id="cancel-btn" class="btn" value="Batal">
</div>
</form>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
template('header');
$toolbars = array();
if (User::is('admin')) {
$toolbars['data']['shop?p=form'] = 'Baru';
}
$toolbars['data']['shop/order'] = 'Data Pembelian';
$toolbars['form']['?p=data'] = 'Kembali';
$judul = ucfirst($page);
$file = $page;
?>
<header id="content-header" class="clearfix">
<h3 id="page-title"><?php echo $judul ?> Produk</h3>
<?php if (User::loggedin()) echo Menu::toolbar($toolbars[$page]) ?>
</header>
<div id="content-main" class="clearfix">
<?php include $page.EXT ?>
</div>
<?php template('footer') ?>
<file_sep><?php
/**
* Konstanta Aplikasi
*/
define('ROOT', pathinfo(__FILE__, PATHINFO_BASENAME));
define('ABSPATH', str_replace(ROOT, '', __FILE__));
/**
* Memuat Sistem
*/
$app = require 'system/loader.php';
/**
* Memulai Sistem
*/
$app->start();
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
$sub = App::uriSegment(2);
$term = App::uriSegment(3);
$query = $sub == 'kat' ? Shop::fetch('produk', $term, 'cat_id') : Shop::fetch('produk');
$isHome = App::uriSegment(1) == 'home';
?>
<div id="products" class="fleft">
<?php
if ($sub == 'product' && $term) {
$row = Shop::fetchOne('produk', $term);
include 'incl/product-single'.EXT;
} elseif (in_array($sub, array('cart', 'checkout', 'order'))) {
include 'incl/product-'.$sub.EXT;
} else {
include 'incl/products'.EXT;
} ?>
</div>
<?php include 'incl/sidebar'.EXT; ?>
<file_sep>--
-- MySQL 5.5.40
-- Tue, 18 Nov 2014 06:56:29 +0000
--
DROP TABLE IF EXISTS `tbl_pengguna`;
CREATE TABLE `tbl_pengguna` (
`id` int(11) not null auto_increment,
`username` varchar(50) not null,
`email` varchar(100) not null,
`password` varchar(32) not null,
`level` tinyint(1) not null,
PRIMARY KEY (`id`),
UNIQUE KEY (`username`),
UNIQUE KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tbl_pengguna` (`username`, `email`, `password`, `level`) VALUES
('admin', '<EMAIL>', '<PASSWORD>', 1);
-- Update tbl_user structure
ALTER TABLE `tbl_pengguna`
ADD `fullname` varchar(50) not null AFTER `id`,
ADD `alamat` VARCHAR(250) NOT NULL AFTER `fullname`;
-- Add fullname to Administrator
UPDATE `tbl_pengguna` SET
`fullname` = '<NAME>',
`alamat` = 'Jl. Mana Ajah No 02'
WHERE `tbl_pengguna`.`id` = 1;
-- Add Another pengguna
INSERT INTO `tbl_pengguna` (`fullname`, `alamat`, `username`, `email`, `password`, `level`) VALUES
('Pelanggan', 'Jl. Mana Aja No 01', 'pelanggan', '<EMAIL>', '<PASSWORD>', 2);
--
DROP TABLE IF EXISTS `tbl_produk`;
CREATE TABLE `tbl_produk` (
`id` int(11) not null auto_increment,
`cat_id` int(11) not null,
`tgl_post` date NOT NULL,
`nama` varchar(50) not null,
`harga` int(11) not null,
`ket` text not null,
`stok` int(11) not null,
`img` varchar(100) not null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
INSERT INTO `tbl_produk` (`cat_id`, `tgl_post`, `nama`, `harga`, `ket`, `stok`, `img`) VALUES
(1, '2014-12-23', 'Contoh Produk 1', 10000, 'Deserunt reprehenderit eos, eius assumenda recusandae temporibus aliquid veritatis quo consequatur vitae quod nesciunt, nobis reiciendis, odio? Temporibus delectus error, atque ipsum!', 10, '//placehold.it/200/ddd&text=Produk+1'),
(2, '2014-12-23', 'Contoh Produk 2', 20000, 'Veritatis, expedita neque quae dolor sed rem debitis illum, optio consequatur repellendus mollitia dolores blanditiis velit deleniti similique! Nisi voluptates, blanditiis obcaecati.', 10, '//placehold.it/200/ddd&text=Produk+2'),
(4, '2014-12-23', 'Contoh Produk 3', 30000, 'Commodi ipsa eaque dolorum nisi in quas itaque distinctio, explicabo incidunt eos voluptatibus nostrum, modi quia beatae nam odit, magnam numquam corporis.', 10, '//placehold.it/200/ddd&text=Produk+3'),
(2, '2014-12-23', 'Contoh Produk 4', 20000, 'Voluptas, hic adipisci est dolores praesentium natus! Reiciendis atque, doloribus ab! Ipsa quos voluptatum soluta quibusdam id incidunt velit itaque, laudantium esse!', 10, '//placehold.it/200/ddd&text=Produk+4'),
(3, '2014-12-23', 'Contoh Produk 5', 50000, 'Repellendus natus sequi accusamus accusantium quisquam explicabo autem libero iusto, deserunt quam laborum, quod, alias ipsa. Illum tempora in, autem laborum deleniti!', 10, '//placehold.it/200/ddd&text=Produk+5'),
(1, '2014-12-23', 'Contoh Produk 6', 60000, 'Aliquid enim nesciunt laudantium architecto ut minima quas laborum, ratione at, iusto praesentium id magni doloremque, harum quibusdam nisi eos, distinctio optio.', 10, '//placehold.it/200/ddd&text=Produk+6'),
(2, '2014-12-23', 'Contoh Produk 7', 20000, 'Ipsum odit eaque minima. Esse illum, velit dolorem cumque id totam eaque commodi. Totam laborum numquam et voluptates labore. Id, provident, quae?', 10, '//placehold.it/200/ddd&text=Produk+7'),
(4, '2014-12-23', 'Contoh Produk 8', 80000, 'Magnam voluptate facilis quo quibusdam, temporibus ducimus officiis perspiciatis nihil voluptatem, delectus sequi praesentium harum eaque sed, aliquid labore! Ut, animi, consequuntur!', 10, '//placehold.it/200/ddd&text=Produk+8'),
(3, '2014-12-23', 'Contoh Produk 9', 20000, 'Maxime voluptatum repellendus consectetur amet nihil quibusdam fuga impedit alias, voluptate, corrupti est repellat neque a veniam! Non a, nam accusantium dolorem?', 10, '//placehold.it/200/ddd&text=Produk+9'),
(1, '2014-12-23', 'Contoh Produk 10', 50000, 'Quia qui, amet distinctio officia dignissimos, quaerat cupiditate enim corporis perspiciatis cumque ad. Repudiandae rerum ipsum magni minus esse eos ea alias.', 10, '//placehold.it/200/ddd&text=Produk+10'),
(1, '2014-12-23', 'Contoh Produk 11', 60000, 'Molestias, sit, consequuntur fuga perspiciatis cupiditate labore maiores tempora eius, distinctio voluptas, vero beatae non! Esse pariatur, illo voluptas non vitae, consectetur?', 10, '//placehold.it/200/ddd&text=Produk+11'),
(5, '2014-12-23', 'Contoh Produk 12', 30000, 'Similique dolorem, praesentium ea tempore saepe, expedita tempora laudantium hic quos necessitatibus sint, dignissimos non sed culpa molestiae dolore minima cupiditate impedit.', 10, '//placehold.it/200/ddd&text=Produk+12');
--
DROP TABLE IF EXISTS `tbl_produk_kat`;
CREATE TABLE `tbl_produk_kat` (
`id` int(11) not null auto_increment,
`alias` varchar(50) not null,
`nama` varchar(100) not null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
INSERT INTO `tbl_produk_kat` (`alias`, `nama`) VALUES
('kat-1', 'Kategori 1'),
('kat-2', 'Kategori 2'),
('kat-3', 'Kategori 3'),
('kat-4', 'Kategori 4'),
('kat-5', 'Kategori 5');
--
DROP TABLE IF EXISTS `tbl_produk_slide`;
CREATE TABLE IF NOT EXISTS `tbl_produk_slide` (
`id` int(11) NOT NULL auto_increment,
`id_produk` int(11) NOT NULL,
`tgl_post` date NOT NULL,
`cover` varchar(100) NOT NULL,
`aktif` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
INSERT INTO `tbl_produk_slide` (`id_produk`, `tgl_post`, `cover`, `aktif`) VALUES
(1, '2014-12-21', '//placehold.it/930x300/ddd&text=Produk+Unggulan+1', 1),
(2, '2014-12-22', '//placehold.it/930x300/ddd&text=Produk+Unggulan+2', 1),
(3, '2014-12-23', '//placehold.it/930x300/ddd&text=Produk+Unggulan+3', 1),
(4, '2014-12-24', '//placehold.it/930x300/ddd&text=Produk+Unggulan+4', 0),
(5, '2014-12-25', '//placehold.it/930x300/ddd&text=Produk+Unggulan+5', 0);
--
DROP TABLE IF EXISTS `tbl_belanja`;
CREATE TABLE IF NOT EXISTS `tbl_belanja` (
`id` int(11) NOT NULL auto_increment,
`id_pengguna` int(11) NOT NULL,
`tgl_belanja` date NOT NULL,
`produk` text NOT NULL,
`total_harga` int(11) NOT NULL,
`lunas` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `tbl_halaman`;
CREATE TABLE `tbl_halaman` (
`id` int(11) not null auto_increment,
`alias` varchar(50) not null,
`judul` varchar(100) not null,
`tgl_post` date not null,
`id_penguuna` int(11) not null,
`isi` text not null,
PRIMARY KEY (`id`),
UNIQUE KEY (`alias`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class Config
{
protected $conf;
private $base = array(
// URL Aplikasi. (http://localhost/aplikasi)
'baseurl' => '',
// Aktifasi Debugin
'debug' => false,
// Tentang Aplikasi
'app' => array(
// Judul Aplikasi
'title' => 'Toko Online',
// Keterangan Aplikasi
'desc' => 'Sekedar Toko Online',
),
'db' => array(
// Database Host
'host' => 'localhost',
// Database Username
'user' => 'root',
// Database Password
'pass' => '<PASSWORD>',
// Database Name
'name' => 'app_base',
// Database Output limit
'limit' => 10,
),
);
/**
* Class Constructor
*
* @param array $configs Konfigurasi
*/
public function __construct(array $conf = array())
{
$this->conf = array_merge($this->base, $conf);
self::$instance =& $this;
}
/**
* Method untuk mendapatkan semua nilai konfigurasi
*
* @return array
*/
public function __invoke()
{
return $this->conf;
}
/**
* Method untuk mendapatkan nilai dari konfigurasi $key
*
* @param string $key Nama Konfigurasi
* @return mixed
*/
public function get($key)
{
if (isset($this->conf[$key])) {
return $this->conf[$key];
}
return null;
}
/**
* Method untuk menerapkan $value ke konfigurasi $key
*
* @param string $key Nama Konfigurasi
* @param mixed $value Nilai Konfigurasi
*/
public function set($key, $value)
{
$this->conf[$key] = $value;
}
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
if ($level = get('level')) {
$query = User::fetch($level, 'level');
} else {
$query = User::fetch();
} ?>
<table class="data">
<thead>
<tr>
<th style="width:35%;">Username</th>
<th style="width:35%;">Email</th>
<th style="width:20%;">Level</th>
<th class="action">Pilihan</th>
</tr>
</thead>
<tbody>
<?php if ($query && ($total = $query->count()) > 0) : foreach ($query->result(true) as $row) : ?>
<tr>
<td><?php echo $row->username ?></td>
<td><?php echo $row->email ?></td>
<td><?php echo User::$levels[$row->level] ?></td>
<td class="action">
<div class="btn-group">
<?php echo anchor('?p=form&id='.$row->id, 'Ubah', array('class' => 'btn btn-edit')) ?>
<?php echo anchor('?p=hapus&id='.$row->id, 'Hapus', array('class' => 'btn btn-hapus')) ?>
</div>
</td>
</tr>
<?php endforeach; else: ?>
<tr><td colspan="4" style="text-align:center;">Belum ada data.</td></tr>
<?php endif; ?>
</tbody>
</table>
<?php if ($query): ?>
<div class="data-info clearfix">
<p class="data-total">Total data: <?php echo $total ?></p>
<div class="data-page"><?php echo pagination($total) ?></div>
</div>
<?php endif ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
template('header');
if ($action = post('action')) {
$return = false;
$message = '';
if ($action == 'login') {
$return = User::login();
} elseif ($action == 'register') {
try {
$return = User::simpan();
} catch (Exception $e) {
$message = $e->getMessage();
}
}
if ($return) {
App::alert(ucfirst($action).' berhasil', 'success');
$redir = get('redir') ?: '';
if ($action == 'register') redirect($redir, 4);
redirect($redir);
} else {
App::alert(ucfirst($action).' gagal. '.$message, 'error');
}
}
if ($id = get('id')) {
$data = User::data($id, 'id');
}
$toolbars = array();
if (User::is('admin')) {
$toolbars['data']['?p=form'] = 'Baru';
}
$toolbars['data'][1]['?p=data'] = 'Semua';
$toolbars['form']['?p=data'] = 'Semua';
foreach (User::$levels as $key => $val) {
$toolbars['data'][1]['?p=data&level='.$key] = $val;
}
$judul = ucfirst($page);
$file = $page;
?>
<header id="content-header" class="clearfix">
<h3 id="page-title"><?php echo $judul ?> Pengguna</h3>
<?php if (User::loggedin() && isset($toolbars[$page])) echo Menu::toolbar($toolbars[$page]) ?>
</header>
<div id="content-main" class="clearfix">
<?php include $file.'.php' ?>
</div>
<?php template('footer') ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
template('header');
$toolbars = array();
if (User::is('admin')) {
$toolbars['data']['shop?p=form'] = 'Baru';
} ?>
<header id="content-header" class="clearfix">
<h3 id="page-title">Halaman</h3>
<?php if (User::is('admin')) echo Menu::toolbar($toolbars[$page]) ?>
</header>
<div id="content-main" class="clearfix">
<div id="products" class="fleft"><?php include $page.EXT ?></div>
</div>
<?php template('footer') ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
if (($qslide = Shop::fetchSlide()) && $qslide->count() > 0): ?>
<div id="slider-home"><div class="slider">
<?php foreach ($qslide->result(2) as $row): ?>
<div class="slide">
<img src="<?php echo $row->gambar ?>" alt="<?php echo $row->judul ?>">
<?php echo anchor('shop/product/'.$row->id, $row->judul, array('class' => 'slide-text')) ?>
</div>
<?php endforeach ?>
</div></div>
<?php endif ?>
<script>
$(function () {
var left = 0,
width = 930,
total = width * $('.slide').size()
$('.slider')
.css('width', total)
.css('height', 300)
setInterval(function () {
if (left >= -(total - (width * 2))) {
left = left - width;
} else {
left = 0
}
$('.slider').css('margin-left', left)
}, 5000);
})
</script>
<?php include 'data'.EXT; ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class App
{
private static $instance = null;
protected $conf;
/**
* Class Constructor
*
* @param Config $configs Konfigurasi
*/
public function __construct(Config $conf = null)
{
$this->conf = $conf;
$this->debug($this->conf('debug'));
self::$instance =& $this;
}
/**
* Method untuk mendapatkan instansi dari class
*
* @return resource
*/
public static function &instance()
{
return self::$instance;
}
/**
* Method untuk mendapatkan atau menerapkan $value dari $key konfigurasi
*
* @param string $key Nama Konfigurasi
* @param mixed $value Nilai Konfigurasi
* @return mixed
*/
public function conf($key, $value = null)
{
if (is_null($value)) {
return $this->conf->get($key);
} else {
$this->conf->set($key, $value);
}
}
/**
* Method untuk menampilkan atau menyembunyikan Error System
*
* @param bool $enabled True untuk menampilkan dan False untuk menyembunyikan
* @return void
*/
public function debug($enable = false)
{
if ($enable) {
error_reporting(E_ALL);
ini_set("display_errors", 1);
ini_set("html_errors", 1);
} else {
error_reporting(0);
ini_set("display_errors", 0);
}
}
/**
* Method untuk melempar error sistem sebagai RuntimeException
*
* @param string $string Error text
* @throws RuntimeException
*/
public static function error($string)
{
throw new RuntimeException($string);
}
}
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
if ($id = App::uriSegment(3)):
Shop::cart($id, get('do'));
else: ?>
<div class="product-cart">
<?php if ($cartItems = Shop::cartItems()): $total = 0; ?>
<h4 class="cart-title">Yay! Anda telah memilih <?php echo count($cartItems) ?> produk. <?php echo anchor('shop/', 'Mau nambah?', array('class' => 'btn')) ?></h4>
<?php if ($query && $query->count() > 0): foreach ($query->result() as $row): if (in_array($row->id, array_keys($cartItems))): ?>
<div class="item clearfix">
<img src="<?php echo $row->img ?>" alt="<?php echo $row->nama ?>">
<div class="detail">
<h4><?php echo anchor('shop/product/'.$row->id, $row->nama) ?></h4>
<span><?php echo $cartItems[$row->id].' × @ Rp. '.formatAngka($row->harga) ?></span>
<?php $subtotal = $cartItems[$row->id] * $row->harga; $total += $subtotal; ?>
<span class="fright bold"><?php echo 'Subtotal: Rp. '.formatAngka($subtotal) ?></span>
<nav class="page-toolbar cart-action">
<?php echo anchor('shop/cart/'.$row->id.'?do=remove', 'Hapus', array('class' => 'btn toolbar-btn')) ?>
<nav class="btn-group toolbar-btn">
<?php echo anchor('shop/cart/'.$row->id.'?do=reduce', 'Kurangi', array('class' => 'btn toolbar-btn')) ?>
<?php echo anchor('shop/cart/'.$row->id.'?do=add', 'Tambah', array('class' => 'btn toolbar-btn')) ?>
</nav>
</nav>
</div>
</div>
<?php endif; endforeach; endif; ?>
<form action="<?php echo siteUrl('shop/checkout/') ?>" method="post">
<input type="hidden" name="total-harga" value="<?php echo $total ?>">
<input type="submit" name="checkout" value="Proses Sekarang" class="btn">
<h4 class="total-text"><?php echo 'Total: Rp. '.formatAngka($total) ?></h4>
</form>
<?php else: ?>
<div class="item clearfix">
<span class="alert warning">Oops! Troli anda kosong,<br>silahkan pilih produk yang anda suka dilanjutkan dengan menekan tombol "beli"</span>
<?php echo anchor('shop/product/', 'Lanjutkan belanja', array('class' => 'btn')) ?>
</div>
<?php endif ?>
</div>
<?php endif ?>
<file_sep><?php defined('ABSPATH') or die ('Not allowed!');
class User extends Module
{
public static
$levels = array(1 => 'Administrator', 2 => 'Pelanggan'),
$aliases = array('admin' => 1, 'pelanggan' => 2);
/**
* Class Constructor
*
* @param array $configs Konfigurasi
*/
public function __construct() {
$module = get_class($this);
$this->initialize(strtolower($module), array(
'caps' => array(1),
'title' => 'Pengguna',
'order' => 0,
));
$do = get('user');
if ($do == 'logout') {
App::dropSession();
redirect();
} elseif (in_array($do, array('login', 'register'))) {
if (static::loggedin()) redirect();
redirect('user?p=form&do='.$do);
}
}
public static function loginPage() {
return dirname(__FILE__).DS.'loginform'.EXT;
}
public static function fetch($val = false, $key = '') {
$where = array();
if ($val !== false) {
$key || $key = 'id';
$where = array($key => $val);
}
return static::$db->select('tbl_pengguna', '', $where);
}
public static function data($val = false, $key = '') {
if ($query = self::fetch($val, $key)) {
return $query->fetchOne();
}
return false;
}
public static function loggedin() {
return App::session('auth') !== false;
}
public static function is($alias) {
if (!isset(self::$aliases[$alias])) return false;
return (int) self::$aliases[$alias] == (int) App::session('level');
}
public static function current($key) {
return App::session($key);
}
public static function menu() {
$menu = '';
$loggedin = User::loggedin();
if (!$loggedin || !self::is('admin')) {
$menu = anchor('shop/cart', 'Troli <span class="product-count">'.count(Shop::cartItems()).'</span>', array('class' => 'cart-btn'));
}
if ($loggedin) {
$menu .= '<strong>Hallo, '.User::current('username').'</strong> '
. anchor('?user=logout', 'Logout');
} else {
$menu .= anchor('?user=login', 'Akun Saya');
}
return $menu;
}
public static function login() {
$query = static::$db->select('tbl_pengguna', '', array(
'username' => post('username')
));
if ($query && ($logindata = $query->fetchOne()) && $logindata->password == md5(post('password'))) {
App::session(array(
'auth' => 1,
'id' => $logindata->id,
'username' => $logindata->username,
'level' => $logindata->level,
));
return true;
}
return false;
}
public static function getAlias($level) {
return array_search($level, self::$aliases);
}
public static function simpan() {
if (($user = self::fetch($warga->nik, 'nik')->fetchOne()) || $user->username == post('username')) {
App::error('Pengguna dengan data tersebut sudah ada.');
}
$data = array(
'username' => post('username'),
'email' => post('email'),
'level' => (int) post('level'),
);
if ($pass = post('password')) {
$data['password'] = md5($pass);
}
$term = ($id = get('id')) ? array('id' => $id) : array();
return static::$db->save('tbl_pengguna', $data, $term);
}
}
| 2889671d61d01c234e34ba8e964ab53f827d6797 | [
"Markdown",
"SQL",
"JavaScript",
"PHP"
] | 39 | PHP | feryardiant/coba-php | 07f44fad58631cdb47a17bcfbc77132e3e74f253 | 93e09e693a2c6074eaabf06a6bc0b01ba1b812f2 |
refs/heads/master | <repo_name>VladDubrovskis/roman-numerals<file_sep>/test/browser/index.js
import render from 'preact-render-to-string';
import { h } from 'preact';
import { route } from 'preact-router';
import App from 'components/app';
import Converter from 'components/converter';
import 'style';
/*global sinon,expect*/
describe('App', () => {
it('should render the homepage', () => {
const output = render(<App />);
expect(output).to.contain('Home');
});
describe('converter', () => {
it('should render without problems ', () => {
const output = render(<Converter />);
expect(output).to.contain('Number converter');
expect(output).to.contain('<h3>No result</h3>');
});
it('should convert the arabic numerals to roman', () => {
const output = render(<Converter number="123" />);
expect(output).to.contain('<h3>CXXIII</h3>');
});
it('should convert the roman numerals to arabic', () => {
const output = render(<Converter number="CXXIII" />);
expect(output).to.contain('<h3>123</h3>');
});
});
});
<file_sep>/README.md
# Roman numerals
Roman numerals package - converts number from 1 to 3999 to roman numerals and back
## Installation
Run `npm install` - this will install all the necessary dependencies
## Testing
Run `npm test` - this will run unit tests for the converter as well as the shallow render integration tests for the component
## Run
Run `npm start` - this will build the files and serve them on your local machine. The address to view it will be in console, but likely to be http://localhost:3000/
## Approach
The way I approached the task was following: thought will use the TDD principles to guide me through the task.
One of the first tests was to convert just one number, moving to 10 numbers, only in one direction: arabic to roman.
Then had the conversion of the 10 done at very basic level thought it was good time to refactor to handle the subtractive notation cases.
Once was happy with that decided to write the tests followed by the code to convert from roman to arabic, which proved to be trickier to handle.
Afterwards for the UI decided to go with preact boilerplate - comes with a lot of goodies. Had to move module and use mocha to run the tests, plus needed to add the Component for converter and wanted to have integration/shallow render tests, which proved a little trickier than expected until came across preact-render-to-string.
The commit history might help with the idea of the approach I took better: https://github.com/VladDubrovskis/roman-numerals/commits/master
## Imrovements to be done
- integration test coverage is lacking - mostly cause run into issues triggering the events within preact and run out of time
- though the unit test might seem like a little but of an overkill but wanted to make sure it handles all the necessary numbers
- When rendering could use other lifecycle methods to make sure if the state has changed and if a re-render is necessary or not
- could pre-populate all digits and use a reducer to get the outcome
- Could add validation on the input, e.g. not less than 1 and not more than 3999, for roman could use a regex
- validate the roman digits, e.g. should not allow XXMII - currently it will convert to 2002
- the algorithm to convert the roman back to arabic could be better, not sure how but sure it could be easier - spent a bit of time writing the algorithm for converter
- in theory had an idea to write a game - go to a page, get 10 roman digits - have to answer correctly - possibly timed.
- could display a lot more
- could make the UI look better
- make sure of redux for maintaining the state
- make Sass code DRY - could use variables for colors, etc
- Cross browser styling - e.g. mobile webkit is taking over and making the button rounded
- In order to support the numbers above 3999 - in theory once could just add the characters and numbers to collection. Could not find those characters myself as most places seem to use either images or css to create overline effect. This of course would work only in order to convert the number from arabic to roman.
<file_sep>/src/lib/converter.js
// in theory, the following two collections can be extended to support number above 3999
// add the collection of the roman digits according to the rules from wikipedia
const romanDigits = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'];
// add the corresponding collection of the arabic numbers
const arabicDigits = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
export function toRoman(remaining) {
const output = arabicDigits.reduce((romanValue, arabicValue, collectionIndex) => {
// loop until the remaining value is larger or equal to the current arabic number
while (remaining >= arabicValue) {
remaining = remaining - arabicValue;
romanValue = `${romanValue}${romanDigits[collectionIndex]}`;
}
return romanValue;
}, '');
return output;
}
export function toArabic(remainingRomanDigits) {
const output = romanDigits.reduceRight((arabicValue, romanValue, collectionIndex) => {
// create a new regex to match the roman numeral
const romanDigitsExpression = new RegExp(`(${romanValue})+$`, 'g');
// check if we can find any occurences using the regex created
const checkOccurences = remainingRomanDigits.match(romanDigitsExpression);
if (checkOccurences) {
// remove the occurences
remainingRomanDigits = remainingRomanDigits.replace(romanDigitsExpression, '');
// as we are matching a group of characters, e.g. III will be match as such, we need to work out how many occurences are matched
// so we take the matches length, and divide it by the length of the roman value
// e.g. III(3) divided by I(1) will mean 3 occurences
const occurences = checkOccurences.pop().length / romanDigits[collectionIndex].length;
arabicValue = arabicValue + (occurences * arabicDigits[collectionIndex]);
}
return arabicValue;
}, 0);
return output;
}
export function convert(input) {
return toRoman(input) || toArabic(input);
}
| b7ebb9f3cd7b7307ef3c150f6619df5898bd3168 | [
"JavaScript",
"Markdown"
] | 3 | JavaScript | VladDubrovskis/roman-numerals | 91b6ad53ad843566f86fcbd85adb4fd6fac72a7f | ff4f9cfdafc41b644092f9d48a174d20f8baa48a |
refs/heads/master | <repo_name>yireo/plg_system_fancybox<file_sep>/README.md
# Fancybox for Joomla
## UNMAINTAINED PROJECT
This project is no longer maintained. Any issues will not be actively picked up. Pull Requests will be merged unchecked. The sources here are up-for-grabs.
## Introduction
Font Awesome offers a great way to add HTML icons to your Joomla site. With this plugin, you can easily add the Font Awesome source to your site. But there's more: Instead of typing in the required fa code - which can cost you a lot of time, and which is not visible in the WYSIWYG environment of your backend - you can use Font Awesome tags to get your icons in there even quicker.
## Usage
First of all, the plugin simply loads the FontAwesome library remotely. Second, any FontAwesome tag in your content will be translated into an icon:
{fa fa-camera-retro fa-2x}
{fa fa-spinner fa-spin}
{fa fa-circle-o-notch fa-spin}
The arguments after `{fa ...}` can include the `fa-` prefix, or the prefix can be skipped.
{(fa fa-book}
{(fa book}
{fa fa-book}
Stacking is done by adding brackets:
{fa fa-stack fa-lg [fa-square-o fa-stack-2x][fa-twitter fa-stack-1x]}
To make it easier to use the same sequence multiple times, you can add the following to the plugins alias box:
stuff="fa-stack fa-lg [fa-square-o fa-stack-2x][fa-twitter fa-stack-1x]"
Or shorter:
stuff="stack lg [square-o stack-2x][twitter stack-1x]"
And now the following will do as well:
{fa stuff}
<file_sep>/source/plugins/system/fancybox/tmpl/script.php
<?php
/**
* Joomla! System plugin - jQuery Fancybox
*
* @author Yireo (<EMAIL>)
* @copyright Copyright 2015 Yireo.com. All rights reserved
* @license GNU Public License
* @link http://www.yireo.com
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
?>
jQuery.noConflict();
jQuery(document).ready(function() {
<?php foreach($elements as $element) : ?>
jQuery("<?php echo $element; ?>").fancybox({<?php echo implode(', ', $options); ?>});
<?php endforeach; ?>
});
<file_sep>/source/administrator/language/en-GB/en-GB.plg_system_fancybox.ini
PLG_SYSTEM_FANCYBOX="System - Fancybox"
PLG_SYSTEM_FANCYBOX_DESC="Joomla! implementation of Fancybox library"
; Options
PLG_SYSTEM_FANCYBOX_FIELD_ELEMENTS="HTML elements"
PLG_SYSTEM_FANCYBOX_FIELD_ELEMENTS_DESC=""
PLG_SYSTEM_FANCYBOX_FIELD_HIDE_ON_CLICK="Hide overlay on click"
PLG_SYSTEM_FANCYBOX_FIELD_ENABLE_MOUSEWHEEL="Enable mousewheel"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION="Transition"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_NONE="None"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_ELASTIC="Elastic"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_FADE="Fade"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_SWING="Swing"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_LINEAR="Linear"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_QUAD="Quad"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_CUBIC="Cubic"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_QUART="Quart"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_QUINT="Quint"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_SINE="Sine"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_EXPO="Expo"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_CIRC="Circ"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_BOUNCE="Bounce"
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_OPTION_BACK="Back"
PLG_SYSTEM_FANCYBOX_FIELD_SPEED="Speed"
PLG_SYSTEM_FANCYBOX_FIELD_OPTIONS="Fancybox options"
PLG_SYSTEM_FANCYBOX_FIELD_USE_FLAG="Load only when flagged"
PLG_SYSTEM_FANCYBOX_FIELD_USE_GOOGLE_API="Use Google API"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_CSS="Load CSS"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_JQUERY="Load jQuery"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_FANCYBOX="Load Fancybox"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_MOUSEWHEEL="Load Mousewheel"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_EASING="Load Easing"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_BUTTONS="Load Buttons"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_MEDIA="Load Media"
PLG_SYSTEM_FANCYBOX_FIELD_LOAD_THUMBS="Load Thumbs"
PLG_SYSTEM_FANCYBOX_FIELD_EXCLUDE_COMPONENTS="Exclude components"
PLG_SYSTEM_FANCYBOX_FIELD_NAMESPACE="jQuery Namespace"
PLG_SYSTEM_FANCYBOX_FIELD_CONTENT_TYPE="Content-type"
PLG_SYSTEM_FANCYBOX_DESC=""
PLG_SYSTEM_FANCYBOX_FIELD_ENABLE_MOUSEWHEEL_DESC=""
PLG_SYSTEM_FANCYBOX_FIELD_TRANSITION_DESC=""
<file_sep>/source/plugins/system/fancybox/fancybox.php
<?php
/**
* Joomla! System plugin - jQuery Fancybox
*
* @author Yireo (<EMAIL>)
* @copyright Copyright 2015 Yireo.com. All rights reserved
* @license GNU Public License
* @link http://www.yireo.com
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
// Import the parent class
jimport('joomla.plugin.plugin');
/**
* Fancybox System Plugin
*/
class PlgSystemFancybox extends JPlugin
{
/**
* @var JApplication
*/
protected $app;
/**
* Event onAfterRender
*/
public function onAfterDispatch()
{
// Dot not load if this is not the right document-class
$document = JFactory::getDocument();
if ($document->getType() != 'html')
{
return false;
}
// Perform actions on the frontend
if ($this->app->isSite())
{
$elements = $this->getElements();
if (empty($elements))
{
return false;
}
// Get and parse the components from the plugin parameters
$components = $this->params->get('exclude_components');
if (empty($components))
{
$components = array();
}
elseif (!is_array($components))
{
$components = array($components);
}
// Don't do anything if the current component is excluded
if (in_array($this->app->input->getCmd('option'), $components))
{
return false;
}
$js_folder = 'media/plg_fancybox/js/';
$transition = $this->params->get('transition', '');
$this->loadStylesheet('jquery.fancybox.css', $this->params->get('load_css', 1));
$this->jquery();
// Load CSS and JavaScript
$this->loadStylesheet('jquery.fancybox-buttons.css', $this->params->get('load_buttons', 0));
$this->loadStylesheet('jquery.fancybox-thumbs.css', $this->params->get('load_thumbs', 0));
$this->loadScript('jquery.fancybox.pack.js', $this->params->get('load_fancybox', 1));
$this->loadScript('jquery.mousewheel-3.0.6.pack.js', $this->params->get('load_mousewheel', 0));
$this->loadScript('jquery.fancybox-buttons.js', $this->params->get('load_buttons', 0));
$this->loadScript('jquery.fancybox-media.js', $this->params->get('load_media', 0));
$this->loadScript('jquery.fancybox-thumbs.js', $this->params->get('load_thumbs', 0));
// Construct basic options
$options = array();
// Enable mouse-wheel
$options['mouseWheel'] = true;
if ($this->params->get('enable_mousewheel', 0) == 0)
{
$options['mouseWheel'] = false;
}
// Determine the content-type
$content_type = $this->params->get('content_type');
if (!empty($content_type))
{
$options['type'] = $content_type;
}
if (!in_array($transition, array('', 'fade', 'elastic', 'none')))
{
$this->loadScript('jquery.easing-1.3.pack.js', $this->params->get('load_easing', 1));
if (in_array($transition, array('swing', 'linear')))
{
$options['openEasing'] = $transition;
$options['closeEasing'] = $transition;
}
else
{
$options['openEasing'] = 'easeInOut' . ucfirst($transition);
$options['closeEasing'] = 'easeInOut' . ucfirst($transition);
}
$options['openSpeed'] = $this->params->get('speed', 200);
$options['closeSpeed'] = $this->params->get('speed', 200);
$options['nextSpeed'] = $this->params->get('speed', 200);
$options['prevSpeed'] = $this->params->get('speed', 200);
}
else
{
$options['openEffect'] = $transition;
$options['closeEffect'] = $transition;
$options['nextEffect'] = $transition;
$options['prevEffect'] = $transition;
$options['openSpeed'] = $this->params->get('speed', 200);
$options['closeSpeed'] = $this->params->get('speed', 200);
$options['nextSpeed'] = $this->params->get('speed', 200);
$options['prevSpeed'] = $this->params->get('speed', 200);
}
// Load the extra options
$extraOptions = trim($this->params->get('options'));
if (!empty($extraOptions))
{
$extraOptions = explode("\n", $extraOptions);
foreach ($extraOptions as $extraOption)
{
$extraOption = explode('=', $extraOption);
if (!empty($extraOption[0]) && !empty($extraOption[1]))
{
$options[$extraOption[0]] = trim($extraOption[1]);
}
}
}
// Sanitize the options
foreach ($options as $name => $value)
{
if (is_bool($value))
{
$bool = ($value) ? "true" : "false";
$options[$name] = "'$name':$bool";
}
elseif (is_numeric($value))
{
$options[$name] = "'$name':$value";
}
elseif (empty($value))
{
unset($options[$name]);
}
else
{
if ($value != 'true' && $value != 'false')
{
$value = "'$value'";
}
elseif ($value == "'true'")
{
$value = 'true';
}
elseif ($value == "'false'")
{
$value = 'false';
}
$options[$name] = "'$name':$value";
}
}
// Helper options
$helpers = array();
// Overlay helper
$closeClick = (bool) $this->params->get('hide_on_click', true);
$closeClick = ($closeClick) ? 'true' : 'false';
$helpers[] = 'overlay: {closeClick:' . $closeClick . '}';
// Buttons helper
if ($this->params->get('load_buttons', 0) == 1)
{
$options[] = 'closeBtn: false';
$helpers[] = 'buttons: {}';
}
// Media helper
if ($this->params->get('load_media', 0))
{
$helpers[] = 'media: {}';
}
// Thumbs helper
if ($this->params->get('load_thumbs', 0))
{
$helpers[] = 'thumbs: {width:50, height:50}';
}
$options[] = 'helpers: {' . implode(', ', $helpers) . '}';
// Get the script-output
$variables = array('elements' => $elements, 'options' => $options,);
$script = $this->loadTemplate('script.php', $variables);
// Add the script-declaration
$document->addScriptDeclaration($script);
}
}
/**
* Load a template
*
* @param string $file
* @param array $variables
*/
private function loadTemplate($file = null, $variables = array())
{
// Base file
$templateFile = JPATH_SITE . '/plugins/system/fancybox/tmpl/' . $file;
// Check for overrides
$template = JFactory::getApplication()->getTemplate();
if (file_exists(JPATH_SITE . '/templates/' . $template . '/html/plg_fancybox/' . $file))
{
$templateFile = JPATH_SITE . '/templates/' . $template . '/html/plg_fancybox/' . $file;
}
$output = null;
// Include the variables here
if (!empty($variables))
{
foreach ($variables as $name => $value)
{
$$name = $value;
}
}
// Unset so as not to introduce into template scope
unset($file);
// Never allow a 'this' property
if (isset($this->this))
{
unset($this->this);
}
// Unset variables
unset($variables);
unset($name);
unset($value);
// Start capturing output into a buffer
ob_start();
include $templateFile;
// Done with the requested template; get the buffer and clear it.
$output = ob_get_contents();
ob_end_clean();
$output = str_replace("\n", "", $output);
return $output;
}
/**
* Load a script
*
* @param string $file
* @param bool $condition
*/
private function loadScript($file = null, $condition = true)
{
$condition = (bool) $condition;
if ($condition == true)
{
if (preg_match('/^jquery-([0-9\.]+).min.js$/', $file, $match) && $this->params->get('use_google_api', 0) == 1)
{
if (JURI::getInstance()->isSSL() == true)
{
$script = 'https://ajax.googleapis.com/ajax/libs/jquery/' . $match[1] . '/jquery.min.js';
}
else
{
$script = 'http://ajax.googleapis.com/ajax/libs/jquery/' . $match[1] . '/jquery.min.js';
}
JFactory::getDocument()->addScript($script);
return;
}
$folder = 'media/plg_fancybox/js/';
// Check for overrides
$template = JFactory::getApplication()->getTemplate();
if (file_exists(JPATH_SITE . '/templates/' . $template . '/html/plg_fancybox/js/' . $file))
{
$folder = 'templates/' . $template . '/html/plg_fancybox/js/';
}
JFactory::getDocument()->addScript($folder . $file);
}
}
/**
* Load a stylesheet
*
* @param string $file
* @param bool $condition
*/
private function loadStylesheet($file = null, $condition = true)
{
$condition = (bool) $condition;
if ($condition == true)
{
$folder = 'media/plg_fancybox/css/';
// Check for overrides
$template = JFactory::getApplication()->getTemplate();
if (file_exists(JPATH_SITE . '/templates/' . $template . '/html/plg_fancybox/css/' . $file))
{
$folder = 'templates/' . $template . '/html/plg_fancybox/css/';
}
JFactory::getDocument()->addStylesheet($folder . $file);
}
}
/**
* Get the HTML elements
*
* @return array
*/
private function getElements()
{
$elements = $this->params->get('elements');
$elements = trim($elements);
$elements = explode(",", $elements);
if (!empty($elements))
{
foreach ($elements as $index => $element)
{
$element = trim($element);
$element = preg_replace('/([^a-zA-Z0-9\[\]\=\-\_\.\#\ ]+)/', '', $element);
if (empty($element))
{
unset($elements[$index]);
}
else
{
$elements[$index] = $element;
}
}
}
return $elements;
}
/**
* Simple method to load jQuery
*/
private function jquery()
{
JLoader::import('joomla.version');
$version = new JVersion();
if (version_compare($version->RELEASE, '2.5', '<='))
{
if (JFactory::getApplication()->get('jquery') == false)
{
$this->loadScript('jquery-1.9.0.min.js', $this->params->get('load_jquery', 1));
JFactory::getApplication()->set('jquery', true);
}
}
else
{
JHtml::_('jquery.framework');
}
}
}
<file_sep>/source/administrator/language/en-GB/en-GB.plg_system_fancybox.sys.ini
PLG_SYSTEM_FANCYBOX="System - Fancybox"
PLG_SYSTEM_FANCYBOX_DESC="Joomla! implementation of Fancybox library"
PLG_SYSTEM_FANCYBOX_DESC=""
| cbe7235f4a18427643a6e6d6eb46561fbb3c4d88 | [
"Markdown",
"PHP",
"INI"
] | 5 | Markdown | yireo/plg_system_fancybox | d6063e9a35ffc43e3d9fa3f75bfc638fb0c0d37a | 4881f93e89fc180dc6ea1fe7ce9151abd0c7011c |
refs/heads/main | <file_sep>using System;
using System.Collections.Generic;
using System.Text;
namespace API.Entities
{
public class APIResponse
{
public bool success { get; set; }
public string terms { get; set; }
public string privacy { get; set; }
public long timestamp { get; set; }
public string source { get; set; }
public Dictionary<string, decimal> quotes { get; set; }
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace API.Models
{
public class NetTransferOrderForCreationDto
{
public string sourceCurrency { get; set; }
public string destinationCurrency { get; set; }
public decimal netAmmount { get; set; }
public decimal grossAmmount { get; set; }
public bool isNetTransferType { get; set; }
}
}
<file_sep>using API.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace API.Contexts
{
public class FeeEntityTypeConfiguration : IEntityTypeConfiguration<Fee>
{
public void Configure(EntityTypeBuilder<Fee> builder)
{
builder.HasKey((Fee f) => (object)f.Id);
builder.Property(f => f.Id).IsRequired();
builder.Property<Guid>((Fee f) => f.Id).IsRequired(true);
builder.Property<string>((Fee f) => f.source).IsRequired(true).HasMaxLength(3);
builder.Property<string>((Fee f) => f.destination).IsRequired(true).HasMaxLength(3);
builder.Property<decimal>((Fee f) => f.rate).IsRequired(true);
builder.Property<int>((Fee f) => f.timestamp).IsRequired(true);
builder.HasData(new Fee[] { new Fee()
{
Id = new Guid("d28868e9-2ba9-473a-a40f-e38cb54f9b35"),
source = "USD",
destination = "ARS",
rate = 10.0M,
timestamp = 12345678
}});
}
}
}<file_sep>using API.Entities;
using API.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace API.ExternalServices
{
public class QuotationsRetrievalService : IHostedService
{
private readonly ILogger<QuotationsRetrievalService> _logger;
private readonly string _quotationApiKey = null;
private Timer _timer;
private int _timeInterval;
public QuotationsRetrievalService(IServiceProvider services,
ILogger<QuotationsRetrievalService> logger)
{
Services = services;
_logger = logger;
//TODO Consumir desde secrets.
_quotationApiKey = "1124f8b1c4eee98fee0c86571cfd487c";
_timeInterval = 1000;// timeInterval;
}
public IServiceProvider Services { get; }
private async Task DoWork(CancellationToken stoppingToken)
{
_logger.LogInformation("Busco cotizacion.");
HttpClient http = new HttpClient();
//http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("ACCESS_KEY", "1124f8b1c4eee98fee0c86571cfd487c");
string url = "http://api.currencylayer.com/live?access_key=" + _quotationApiKey;
var apiResponse = http.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
if (apiResponse != "")
{
var datos = JsonConvert.DeserializeObject<APIResponse>(apiResponse);
using (var scope = Services.CreateScope())
{
var scopedProcessingService =
scope.ServiceProvider
.GetRequiredService<IScopedProcessingService>();
await scopedProcessingService.DoWork(stoppingToken, datos.quotes);
}
}
}
public Task StartAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("El servicio esta corriendo.");
_timer = new Timer(async (algo) => await DoWork(cancellationToken), cancellationToken, TimeSpan.Zero, TimeSpan.FromSeconds(_timeInterval));
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("El servicio se esta deteniendo.");
_timer?.Change(Timeout.Infinite, 0);
return Task.CompletedTask;
}
public void Dispose()
{
_timer?.Dispose();
}
}
}
<file_sep>using API.ExternalServices;
using API.Interfaces;
using API.Services;
using API.Contexts;
using API.Repositories;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TransferOrderAPI
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddTransient<ICurrencyQuotationService, CurrencyQuotationService>();
services.AddTransient<ICurrencyQuotationRepository, CurrencyQuotationRepository>();
services.AddScoped<IScopedProcessingService, CurrencyQuotationService>();
services.AddHostedService<QuotationsRetrievalService>();
services.AddScoped<ITransferOrderRepository, TransferOrderRepository>();
services.AddScoped<IFeeRepository, FeeRepository>();
services.AddDbContext<CurrencyQuotationContext>(options => options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=CurrencyQuotationDB;Trusted_Connection=True;"));
services.AddDbContext<TransferOrderContext>(options => options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=TransferOrderDB;Trusted_Connection=True;"));
services.AddDbContext<FeeContext>(options => options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=FeeDB;Trusted_Connection=True;"));
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, CurrencyQuotationContext context)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
context.Database.EnsureCreated();
}
else
{
app.UseExceptionHandler("/error");
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace API.Entities
{
public class Fee
{
[Key]
public Guid Id { get; set; }
public string source { get; set; }
public string destination { get; set; }
[Column(TypeName = "decimal(24,6)")]
public decimal rate { get; set; }
public int timestamp { get; set; }
}
}
<file_sep>using API.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
namespace API.Contexts
{
public class CurrencyQuotationEntityTypeConfiguration : IEntityTypeConfiguration<CurrencyQuotation>
{
public void Configure(EntityTypeBuilder<CurrencyQuotation> builder)
{
builder.HasKey((CurrencyQuotation q) => (object)q.Id);
builder.Property(b => b.Id).IsRequired();
builder.Property<int>((CurrencyQuotation q) => q.Id).IsRequired(true);
builder.Property<string>((CurrencyQuotation q) => q.source).IsRequired(true).HasMaxLength(3);
builder.Property<string>((CurrencyQuotation q) => q.destination).IsRequired(true).HasMaxLength(3);
builder.Property<int>((CurrencyQuotation q) => q.timestamp).IsRequired(true);
builder.HasData(new CurrencyQuotation[] { new CurrencyQuotation()
{
Id = 1,
source = "USD",
destination = "ARS",
rate = new decimal(99148817, 0, 0, false, 6),
timestamp = 1634371754
}, new CurrencyQuotation()
{
Id = 2,
source = "USD",
destination = "AED",
rate = new decimal(3673104, 0, 0, false, 6),
timestamp = 1634371754
}, new CurrencyQuotation()
{
Id = 3,
source = "USD",
destination = "AFN",
rate = new decimal(89350404, 0, 0, false, 6),
timestamp = 1634371754
}, new CurrencyQuotation()
{
Id = 4,
source = "USD",
destination = "ALL",
rate = new decimal(104803989, 0, 0, false, 6),
timestamp = 1634371754
}, new CurrencyQuotation()
{
Id = 5,
source = "USD",
destination = "AMD",
rate = new decimal(478420403, 0, 0, false, 6),
timestamp = 1634371754
} });
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Text;
namespace API.Interfaces
{
public interface ICurrencyQuotationService
{
void guardarCotizaciones(IEnumerable<dynamic> quotes);
decimal calcularCotizacionNeta(string sourceCurrency, string destinationCurrency, decimal netAmmount);
decimal calcularCotizacionBruta(string sourceCurrency, string destinationCurrency, decimal grossAmmount);
}
}
<file_sep>using API.Interfaces;
using API.Contexts;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace API.Repositories
{
public class FeeRepository : IFeeRepository, IDisposable
{
private readonly FeeContext _context;
public FeeRepository(FeeContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
public decimal getFeeForOperation(string sourceCurrency, string destinationCurrency)
{
//TODO Completar, añadir timestamps y definiri bien la clasee Fee vs CurrencyQuotation
decimal rate = 0.0M;
//TODO Reparar base.
//var fee = _context.Fees
// .Where(f => f.source == sourceCurrency && f.destination == destinationCurrency)
// .FirstOrDefault().rate;
rate = 10.0M;// fee;
return rate;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// dispose resources when needed
}
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace API.Entities
{
public class CurrencyQuotation
{
public int Id { get; set; }
public string source { get; set; }
public string destination { get; set; }
public decimal rate { get; set; }
public int timestamp { get; set; }
}
}
<file_sep>using Microsoft.EntityFrameworkCore;
using System;
using API.Entities;
using System.Collections.Generic;
using System.Text;
namespace API.Contexts
{
public class CurrencyQuotationContext : DbContext
{
public DbSet<CurrencyQuotation> CurrencyQuotations { get; set; }
public CurrencyQuotationContext(DbContextOptions<CurrencyQuotationContext> options): base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
RelationalEntityTypeBuilderExtensions.ToTable<CurrencyQuotation>(modelBuilder.Entity<CurrencyQuotation>(), "CurrencyQuotations");
new CurrencyQuotationEntityTypeConfiguration().Configure(modelBuilder.Entity<CurrencyQuotation>());
}
}
}
<file_sep>using API.Entities;
using API.Interfaces;
using API.Contexts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace API.Repositories
{
public class TransferOrderRepository : ITransferOrderRepository, IDisposable
{
private readonly TransferOrderContext _context;
public TransferOrderRepository(TransferOrderContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
public void AddTransferOrder(TransferOrder transferOrder)
{
if (transferOrder == null)
{
throw new ArgumentNullException(nameof(transferOrder));
}
_context.TransferOrders.Add(transferOrder);
}
public bool Save()
{
return (_context.SaveChanges() >= 0);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// dispose resources when needed
}
}
public IEnumerable<TransferOrder> GetTransferOrders()
{
return _context.TransferOrders.ToList<TransferOrder>();
}
public TransferOrder GetTransferOrder(Guid transferOrderId)
{
if (transferOrderId == Guid.Empty)
{
throw new ArgumentNullException(nameof(transferOrderId));
}
return _context.TransferOrders.FirstOrDefault(a => a.Id == transferOrderId);
}
}
}
<file_sep>using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace API.Migrations.Fee
{
public partial class InitialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Fees",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
source = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false),
destination = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false),
rate = table.Column<decimal>(type: "decimal(24,6)", nullable: false),
timestamp = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Fees", x => x.Id);
});
migrationBuilder.InsertData(
table: "Fees",
columns: new[] { "Id", "destination", "rate", "source", "timestamp" },
values: new object[] { new Guid("d28868e9-2ba9-473a-a40f-e38cb54f9b35"), "ARS", 10.0m, "USD", 12345678 });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Fees");
}
}
}
<file_sep>using Microsoft.EntityFrameworkCore.Migrations;
namespace API.Migrations.CurrencyQuotation
{
public partial class InitialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CurrencyQuotations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
source = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false),
destination = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false),
rate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
timestamp = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CurrencyQuotations", x => x.Id);
});
migrationBuilder.InsertData(
table: "CurrencyQuotations",
columns: new[] { "Id", "destination", "rate", "source", "timestamp" },
values: new object[,]
{
{ 1, "ARS", 99.148817m, "USD", 1634371754 },
{ 2, "AED", 3.673104m, "USD", 1634371754 },
{ 3, "AFN", 89.350404m, "USD", 1634371754 },
{ 4, "ALL", 104.803989m, "USD", 1634371754 },
{ 5, "AMD", 478.420403m, "USD", 1634371754 }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CurrencyQuotations");
}
}
}
<file_sep>using API.Entities;
using System;
using System.Collections.Generic;
using System.Text;
namespace API.Interfaces
{
public interface ITransferOrderRepository
{
void AddTransferOrder(TransferOrder transferOrder);
bool Save();
IEnumerable<TransferOrder> GetTransferOrders();
TransferOrder GetTransferOrder(Guid transferOrderId);
}
}
<file_sep>using API.Entities;
using API.Interfaces;
using API.Contexts;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace API.Repositories
{
public class CurrencyQuotationRepository : ICurrencyQuotationRepository, IDisposable
{
private readonly CurrencyQuotationContext _context;
public CurrencyQuotationRepository(CurrencyQuotationContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
public bool SaveQuotations(dynamic quotations)
{
//TODO Quitar Hardcodeos ya se comprobo funcionamiento background service.
//TODO pasar el parametro correcto
//TODO Utilizar automapper
using (var context = _context)
{
foreach (var algo in quotations)
{
var quotation = new CurrencyQuotation
{
//Id = new Guid(""),
source = algo.Key.Substring(0, 3),
destination = algo.Key.Substring(3, 3),
rate = algo.Value,
timestamp = 123456789
};
context.CurrencyQuotations.Add(quotation);
}
context.SaveChanges();
}
return true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// dispose resources when needed
}
}
public decimal getQuotation(string sourceCurrency, string destinationCurrency)
{
var quote = _context.CurrencyQuotations.Where(q => q.source == sourceCurrency && q.destination == destinationCurrency).FirstOrDefault();
if (quote == null)
{
throw new ArgumentNullException(nameof(quote));
}
return quote.rate;
}
}
}
<file_sep>using API.Models;
using AutoMapper;
using API.Entities;
using API.Interfaces;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TransferOrdersController : ControllerBase
{
private readonly ICurrencyQuotationService _currencyQuotationService;
private readonly ITransferOrderRepository _transferOrderRepository;
private readonly IMapper _mapper;
public TransferOrdersController(ICurrencyQuotationService currencyQuotationService,
ITransferOrderRepository transferOrderRepository,
IMapper mapper)
{
_currencyQuotationService = currencyQuotationService;
_transferOrderRepository = transferOrderRepository ??
throw new ArgumentNullException(nameof(transferOrderRepository));
_mapper = mapper ??
throw new ArgumentNullException(nameof(mapper));
}
[HttpGet("{transferOrderId}", Name = "GetTransferOrder")]
public IActionResult GetTransferOrder(Guid transferOrderId)
{
var transferOrderFromRepo = _transferOrderRepository.GetTransferOrder(transferOrderId);
if (transferOrderFromRepo == null)
{
return NotFound();
}
return Ok(_mapper.Map<NetTransferOrderDto>(transferOrderFromRepo));
}
[HttpGet]
[HttpHead]
public ActionResult<IEnumerable<NetTransferOrderDto>> GetTransferOrders()
{
var transferOrdersFromRepo = _transferOrderRepository.GetTransferOrders();
return Ok(_mapper.Map<IEnumerable<NetTransferOrderDto>>(transferOrdersFromRepo));
}
[HttpPost]
public ActionResult<NetTransferOrderDto> CreateTransferOrder(NetTransferOrderForCreationDto transferOrder)
{
//TODO REFACTOR OJO NO VA EN CONTROLLER
if (transferOrder.isNetTransferType)
{
transferOrder.grossAmmount = _currencyQuotationService.calcularCotizacionNeta(transferOrder.sourceCurrency, transferOrder.destinationCurrency, transferOrder.netAmmount);
}
else
{
transferOrder.netAmmount = _currencyQuotationService.calcularCotizacionBruta(transferOrder.sourceCurrency, transferOrder.destinationCurrency, transferOrder.grossAmmount);
}
var transferOrderEntity = _mapper.Map<Entities.TransferOrder>(transferOrder);
_transferOrderRepository.AddTransferOrder(transferOrderEntity);
_transferOrderRepository.Save();
var transferOrderToReturn = _mapper.Map<NetTransferOrderDto>(transferOrderEntity);
return CreatedAtRoute("GetTransferOrder",
new { transferOrderId = transferOrderToReturn.Id },
transferOrderToReturn);
}
[HttpOptions]
public IActionResult GetTransferOrdersOptions()
{
Response.Headers.Add("Allow", "GET,OPTIONS,POST");
return Ok();
}
}
}
<file_sep># TransferOrderAPI
Web API de prueba
<file_sep>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace API.Entities
{
public class TransferOrder
{
[Key]
public Guid Id { get; set; }
public string sourceCurrency { get; set; }
public string destinationCurrency { get; set; }
[Column(TypeName = "decimal(24,6)")]
public decimal netAmmount { get; set; }
[Column(TypeName = "decimal(24,6)")]
public decimal grossAmmount { get; set; }
}
}
<file_sep>using AutoMapper;
using API.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace API.Profiles
{
public class TransferOrdersProfile: Profile
{
public TransferOrdersProfile()
{
CreateMap<TransferOrder, Models.NetTransferOrderDto>();
CreateMap<Models.NetTransferOrderForCreationDto, TransferOrder>();
}
}
}
<file_sep>using API.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace API.Contexts
{
public class FeeContext: DbContext
{
public DbSet<Fee> Fees { get; set; }
public FeeContext(DbContextOptions<FeeContext> options) : base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
RelationalEntityTypeBuilderExtensions.ToTable<Fee>(modelBuilder.Entity<Fee>(), "Fees");
new FeeEntityTypeConfiguration().Configure(modelBuilder.Entity<Fee>());
}
}
}
<file_sep>using API.Interfaces;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace API.Services
{
public class CurrencyQuotationService : ICurrencyQuotationService, IScopedProcessingService
{
private readonly ILogger<CurrencyQuotationService> _logger;
private readonly ICurrencyQuotationRepository _currencyQuotationRepository;
private readonly IFeeRepository _feeRepository;
public CurrencyQuotationService(
ILogger<CurrencyQuotationService> logger,
ICurrencyQuotationRepository currencyQuotationRepository,
IFeeRepository feeRepository
)
{
_logger = logger;
_currencyQuotationRepository = currencyQuotationRepository;
_feeRepository = feeRepository;
}
public Task DoWork(CancellationToken stoppingToken, dynamic quotes)
{
if (!stoppingToken.IsCancellationRequested)
{
_logger.LogInformation("Scoped Processing Service is working");
_currencyQuotationRepository.SaveQuotations(quotes);
}
return Task.CompletedTask;
}
public void guardarCotizaciones(IEnumerable<dynamic> quotations)
{
_currencyQuotationRepository.SaveQuotations(quotations);
}
private decimal obtenerCotizacion(string sourceCurrency, string destinationCurrency)
{
return _currencyQuotationRepository.getQuotation(sourceCurrency, destinationCurrency);
}
public decimal calcularCotizacionNeta(string sourceCurrency, string destinationCurrency, decimal netAmmount)
{
decimal cotizacion = obtenerCotizacion(sourceCurrency, destinationCurrency);
decimal feePercent = _feeRepository.getFeeForOperation(sourceCurrency, destinationCurrency);
decimal fee = netAmmount * (feePercent / 100.0M);
return (netAmmount + fee) * cotizacion;
}
public decimal calcularCotizacionBruta(string sourceCurrency, string destinationCurrency, decimal grossAmmount)
{
decimal cotizacion = obtenerCotizacion(sourceCurrency, destinationCurrency);
decimal feePercent = _feeRepository.getFeeForOperation(sourceCurrency, destinationCurrency); //_feeRepository.getFeeForOperation(sourceCurrency, destinationCurrency);
decimal fee = grossAmmount * (feePercent / 100.0M);
return (grossAmmount - fee) * cotizacion;
}
}
}
<file_sep>using API.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
namespace API.Contexts
{
public class TransferOrderEntityTypeConfiguration : IEntityTypeConfiguration<TransferOrder>
{
public void Configure(EntityTypeBuilder<TransferOrder> builder)
{
builder.HasKey((TransferOrder t) => (object)t.Id);
builder.Property(t => t.Id).IsRequired();
builder.Property<Guid>((TransferOrder t) => t.Id).IsRequired(true);
builder.Property<string>((TransferOrder t) => t.sourceCurrency).IsRequired(true).HasMaxLength(3);
builder.Property<string>((TransferOrder t) => t.destinationCurrency).IsRequired(true).HasMaxLength(3);
builder.HasData(new TransferOrder[] { new TransferOrder()
{
Id = new Guid("d28868e9-2ba9-473a-a40f-e38cb54f9b35"),
sourceCurrency = "USD",
destinationCurrency = "ARS",
netAmmount = 10000.00M,
grossAmmount = 0M
}});
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace API.Interfaces
{
public interface IScopedProcessingService
{
Task DoWork(CancellationToken stoppingToken, dynamic quotes);
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace API.Models
{
public class NetTransferOrderDto
{
public Guid Id { get; set; }
public string sourceCurrency { get; set; }
public string destinationCurrency { get; set; }
public decimal netAmmount { get; set; }
public decimal grossAmmount { get; set; }
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Text;
namespace API.Interfaces
{
public interface IFeeRepository
{
decimal getFeeForOperation(string sourceCurrency, string destinationCurrency);
}
}
<file_sep>using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace API.Migrations
{
public partial class InitialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TransferOrders",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
sourceCurrency = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false),
destinationCurrency = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false),
netAmmount = table.Column<decimal>(type: "decimal(24,6)", nullable: false),
grossAmmount = table.Column<decimal>(type: "decimal(24,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TransferOrders", x => x.Id);
});
migrationBuilder.InsertData(
table: "TransferOrders",
columns: new[] { "Id", "destinationCurrency", "grossAmmount", "netAmmount", "sourceCurrency" },
values: new object[] { new Guid("d28868e9-2ba9-473a-a40f-e38cb54f9b35"), "ARS", 0m, 10000.00m, "USD" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TransferOrders");
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Text;
namespace API.Interfaces
{
public interface ICurrencyQuotationRepository
{
bool SaveQuotations(dynamic quotes);
decimal getQuotation(string sourceCurrency, string destinationCurrency);
}
}
<file_sep>using API.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace API.Contexts
{
public class TransferOrderContext : DbContext
{
public DbSet<TransferOrder> TransferOrders { get; set; }
public TransferOrderContext(DbContextOptions<TransferOrderContext> options) : base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
RelationalEntityTypeBuilderExtensions.ToTable<TransferOrder>(modelBuilder.Entity<TransferOrder>(), "TransferOrders");
new TransferOrderEntityTypeConfiguration().Configure(modelBuilder.Entity<TransferOrder>());
}
}
}
| 021fe6f30957c52e82f63e327f1e112fbc576c8c | [
"Markdown",
"C#"
] | 29 | C# | msfs-junin/TransferOrderAPI | d597840ab37e982b7ef313f12e4fac651040f63c | c422e6e68e26e0f09a338a6a4b3f187efa0300b7 |
refs/heads/master | <file_sep>using System;
using System.Configuration;
using OnlineStoreWorker.Messaging;
namespace OnlineStoreWorker
{
class Program
{
static Configuration Configuration;
static void Main(string[] args)
{
var onlineStoreMq = new OnlineStoreMq();
Console.WriteLine("Starting to read from the queue");
while (true)
{
onlineStoreMq.ConsumeMessage();
}
}
}
}
<file_sep>using System;
using Dapper;
using MySql.Data.MySqlClient;
using OnlineStoreWorker.Models;
namespace OnlineStoreWorker.Repositories
{
public class CustomerRepository
{
public CustomerRepository()
{
}
public void Insert(Customer customer)
{
var onlineStoreDbUserName = "store"; // Environment.GetEnvironmentVariable("ONLINE_STORE_DB_USERNAME");
var onlineStoreDbPassword = "<PASSWORD>"; // Environment.GetEnvironmentVariable("ONLINE_STORE_DB_PASSWORD");
var onlineStoreDbServer = "192.168.0.105"; // Environment.GetEnvironmentVariable("ONLINE_STORE_DB_SERVER");
var onLineStoreDbName = "OnlineStore";
var connectionString = $"Server={onlineStoreDbServer};Database={onLineStoreDbName};Uid={onlineStoreDbUserName};Pwd={<PASSWORD>};SSL Mode = None;charset=utf8";
try
{
MySqlConnection connection = new MySqlConnection(connectionString);
var count = connection.Execute(@"insert into Customers (FirstName, LastName,EmailAddress,NotifyMe) values (@FirstName, @LastName,@EmailAddress,@NotifyMe)",
customer);
Console.WriteLine("Se insertó registro para: " + customer.FirstName);
}
catch(Exception ex)
{
Console.WriteLine("Error en insert: " + ex.Message);
Console.WriteLine("Datos: " + connectionString);
throw ex;
}
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using OnlineStoreWebApi.Messaging;
using OnlineStoreWebApi.Models;
using OnlineStoreWebApi.Repositories;
namespace OnlineStoreWebApi.Services
{
public class CustomerService
{
private CustomerRepository _customerRepository;
private OnlineStoreMq _onlineStoreMq;
public CustomerService()
{
_onlineStoreMq = new OnlineStoreMq();
}
public IList<Customer> GetRegisteredCustomers()
{
_customerRepository = new CustomerRepository();
var datos = _customerRepository.GetAll();
return datos;
}
public void RegisterCustomer(Customer customer)
{
_onlineStoreMq.SendMessage(customer);
}
}
}
<file_sep>en proceso...
https://www.irfanm.com/2017/10/11/create-distributed-containerized-application-using-asp-net-core-web-api-core-rabbitmq-and-mysql-running-in-docker-containers-on-linux-machine/
<file_sep>Ejemplos de RabbitMQ con Netcore y contenedores
1. BasicSample (carpeta Basic).
2. Ejemplo de mediana dificultad (carpeta OnlineStore)
3. Ejemplo de microservicios 1 (carpeta ApplicantsAndJobs)
<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using OnlineStore.Models;
using OnlineStore.Services;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace OnlineStore.Controllers
{
public class RegisterController : Controller
{
private OnlineStoreService _onlineStoreService;
public IActionResult Index()
{
var registerViewModel = new RegisterViewModel();
return View(registerViewModel);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Index(RegisterViewModel registerViewModel)
{
if (ModelState.IsValid)
{
_onlineStoreService.RegisterCustomer(registerViewModel);
return View("RegistrationConfirmation");
}
return View(registerViewModel);
}
}
}
<file_sep>using System;
using System.Text;
using Newtonsoft.Json;
using OnlineStoreWebApi.Models;
using RabbitMQ.Client;
namespace OnlineStoreWebApi.Messaging
{
public class OnlineStoreMq
{
public OnlineStoreMq()
{
}
public void SendMessage(Customer customer)
{
var onlineStoreMqUserName = "rcotest"; // Environment.GetEnvironmentVariable("ONLINE_STORE_MQ_USERNAME");
var onlineStoreMqPassword = "<PASSWORD>"; // Environment.GetEnvironmentVariable("ONLINE_STORE_MQ_PASSWORD");
var onlineStoreMqServer = "192.168.0.102"; // Environment.GetEnvironmentVariable("ONLINE_STORE_MQ_SERVER");
var factory = new ConnectionFactory()
{ HostName = onlineStoreMqServer, UserName = onlineStoreMqUserName, Password = <PASSWORD>, Port = 5672 };
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare("StoreExch", "direct");
channel.QueueDeclare(queue: "store_queue",
durable: true,
exclusive: false,
autoDelete: false,
arguments: null);
channel.QueueBind(queue: "store_queue", exchange: "StoreExch", routingKey: "store_route");
string customerData = JsonConvert.SerializeObject(customer);
var body = Encoding.UTF8.GetBytes(customerData);
var properties = channel.CreateBasicProperties();
properties.Persistent = true;
channel.BasicPublish(exchange: "StoreExch",
routingKey: "store_route",
basicProperties: properties,
body: body);
}
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using OnlineStore.Models;
using OnlineStore.Services;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace OnlineStore.Controllers
{
public class AdminController : Controller
{
private OnlineStoreService _onlineStoreService;
public AdminController()
{
_onlineStoreService = new OnlineStoreService();
}
public IActionResult Index()
{
AdminViewModel adminViewModel = new AdminViewModel();
adminViewModel.RegisteredCustomers = _onlineStoreService.GetRegisteredCustomers();
return View(adminViewModel);
}
}
}
<file_sep>## Introducción
Este ejemplo me pareció muy completo, lo elegí como segunda opción porque contiene los siguientes elementos:
* Contenedores debuggeables con VSTudio Code
* Utiliza ms-sql server en linux
* Incluye docker compose y multicontainer
* Utiliza Redis para caching y MassTransit como message bus que trabaja con rabbitmq
* Usa kitematic para poder administrar los contenedores desde la PC
## Autor
El ejemplo se basa en el siguiente blog:
https://fullstackmark.com/post/12/get-started-building-microservices-with-asp.net-core-and-docker-in-visual-studio-code
## Uso
El blog original trae las instrucciones precisas, el código en mi repo se puede usar tal cual, pero hay que tener el contenedor de RabbitMQ ejecutándose, o descomentar la parte respectiva en el archivo docker-compose.yml.
Tuve que realizar unos ajustes:
* Utilicé Netcore 2.2
* Ya tenía el rabbitmq del ejemplo basic, no lo incluí en el yml y tuve que cambiar las conexiones a rabbit (usuario y password, y el host)
* La referencia a redis viene mal, no la incluye en el repo del autor, así que la incluí donde fuera necesario
* Para conectar con la ip del contenedor de RabbitMQ usé el comando:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' rcotest-rabbitmq
la segunda IP es la que se utiliza: 172.19.0.5 172.17.0.2
Ejecutando docker compose se pueden observar los contenedores ejecutándose desde Kitematic:

Desde VisualStudio Code se puede iniciar la aplicación y debuggear en los contenedores, hay que copiar los archivos launch.json y tasks.json (yo los adecue de acuerdo a mi proyecto) en el fólder .vscode de la solución, en el repo ya se encuentran.
Una vez iniciando todas las aplicaciones en modo debug con VStudio Code, en la Consola de RabbitMQ se pueden observar las conexiones:

Con MS-SQLServer Management Studio es posible conectarse al contenedor de la BD y ejecutar queries, aquí la tabla Jobs:

La aplicación Web se ve así:


Después de aplicar a un puesto la tabla correspondiente se actualiza:

Así se ven los mensajes cuando llegan a RabbitMQ:

Desafortunadamente no termina la ejecución correctamente, no se realiza la verificación de la aplicación y la página web presenta un error.
## Estatus
Sigo revisando el error al aplicar a un puesto, otro problema que me he encontrado es que no siempre las API´s se conectan al contenedor de RabbitMQ, debo insistir varias veces.
Actualizaré este archivo cuando resuelva los errores.
Ya que llegue a este punto creo que debi buscar uno un poco más sencillo, el cual será el ejemplo 3
<file_sep>## Introducción
Basado en elBasado en el tutorial de RabbitMQ y NetCore:
https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html
## Uso
Para no instalar RabbitMQ utilicé mejor un contenedor, y las aplicaciones de consola, Send y Receive, del tutorial.
Para bajar y ejecutar el contenedor de RabbitMQ, así como inicializarlo, indicando usuario y password, usar la siguiente instrucción:
docker run -d --hostname rabbit-local --name rcotest-rabbitmq -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=rcotest -e RABBITMQ_DEFAULT_PASS=<PASSWORD> rabbitmq:3-management
Usando la URL http://localhost:15672 se accede a la consola de administración de RabbitMQ del contenedor, usa el usuario y password indicados
* Crear aplicaciones net core:
dotnet new console --name Send
mv Send/Program.cs Send/Send.cs
dotnet new console --name Receive
mv Receive/Program.cs Receive/Receive.cs
* Agregar las librerías para RabbitMQ
cd Send
dotnet add package RabbitMQ.Client
dotnet restore
cd ../Receive
dotnet add package RabbitMQ.Client
dotnet restore
Las instrucciones completas y explicación del tutorial vienen en la liga anterior.
Se ejecuta cada aplicación de consola por separado, usando dotnet run o desde Visual Studio, desde la consola web se pueden monitorear los mensajes.
<file_sep>using System;
using System.Text;
using Newtonsoft.Json;
using OnlineStoreWorker.Models;
using OnlineStoreWorker.Repositories;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace OnlineStoreWorker.Messaging
{
public class OnlineStoreMq
{
CustomerRepository _customerRepository;
public OnlineStoreMq()
{
_customerRepository = new CustomerRepository();
}
public void ConsumeMessage()
{
try
{
var onlineStoreMqUserName = "rcotest"; // Environment.GetEnvironmentVariable("ONLINE_STORE_MQ_USERNAME");
var onlineStoreMqPassword = "<PASSWORD>"; // Environment.GetEnvironmentVariable("ONLINE_STORE_MQ_PASSWORD");
var onlineStoreMqServer = "192.168.0.102"; // Environment.GetEnvironmentVariable("ONLINE_STORE_MQ_SERVER");
var factory = new ConnectionFactory()
{ HostName = onlineStoreMqServer, UserName = onlineStoreMqUserName, Password = <PASSWORD>, Port = 5672 };
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare("StoreExch", "direct");
channel.QueueDeclare(queue: "store_queue",
durable: true,
exclusive: false,
autoDelete: false,
arguments: null);
channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);
channel.QueueBind(queue: "store_queue", exchange: "StoreExch", routingKey: "store_route");
var consumer = new EventingBasicConsumer(channel);
BasicGetResult result = channel.BasicGet("store_queue", true);
if (result != null)
{
string message = Encoding.UTF8.GetString(result.Body);
var customer = JsonConvert.DeserializeObject<Customer>(message);
Console.WriteLine("Lee mensaje del queue: " + message);
_customerRepository.Insert(customer);
}
channel.BasicConsume(queue: "store_queue", autoAck: false, consumer: consumer);
}
}
catch (Exception ex)
{
Console.WriteLine("Error en ConsumeMessage: " + ex.Message);
}
}
}
}
<file_sep>using System;
using System.Collections.Generic;
using Dapper;
using MySql.Data.MySqlClient;
using OnlineStoreWebApi.Models;
namespace OnlineStoreWebApi.Repositories
{
public class CustomerRepository
{
public CustomerRepository()
{
}
public IList<Customer> GetAll()
{
var onlineStoreDbUserName = "store"; // Environment.GetEnvironmentVariable("ONLINE_STORE_DB_USERNAME");
var onlineStoreDbPassword = "<PASSWORD>"; // Environment.GetEnvironmentVariable("ONLINE_STORE_DB_PASSWORD");
var onlineStoreDbServer = "192.168.0.105"; // Environment.GetEnvironmentVariable("ONLINE_STORE_DB_SERVER");
var onLineStoreDbName = "OnlineStore";
var connectionString = $"Server={onlineStoreDbServer};Database={onLineStoreDbName};Uid={onlineStoreDbUserName};Pwd={<PASSWORD>};SSL Mode = None;charset=utf8";
MySqlConnection connection = new MySqlConnection(connectionString);
var registeredCustomers = connection.Query<Customer>("Select * from Customers");
return registeredCustomers.AsList();
}
}
}
| 7f88abc00a514a443447345daa5b57682dc67293 | [
"Markdown",
"C#"
] | 12 | C# | rafelcnet/RabbitMQNetCore | 69f0384f57b8e36ccf44d5f7837447d306f0bdbf | b1287f83824f05ce01ceb24aebb8b5eec6f87d3d |
refs/heads/master | <file_sep>/* Wav File Player For E.C.
Plays Wav files at random triggered by two
HC-SR04 ultra-sonic distance sensors.
Audio files should be 44.1 khz, 16 bit format, wav.
Audio files on the SD card should be in the root directory
(not in a folder).
The file names should have a 1 or 2 digit prefix, between 0 and 99 inclusive.
followed by ".wav". "01.wav", "0.wav", and "99.wav" are all valid file names.
File names need not be contiguous and may start anywhere you want.
Files do not need to be in any particular order as long as
digits are between 0-99.
No other files on the card should start with numbers.
The sketch will not continue to play if either sensor is blocked continuously,
although there is not error checking for this condition.
*/
#include <Audio.h>
#include <Wire.h>
#include <SerialFlash.h>
#include <Bounce.h>
#include <SPI.h>
#include <SD.h>
//define ACCELEROMETER // uncomment this to use the accelerometer
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav1; //xy=89,39.00000762939453
AudioPlaySdWav playSdWav2; //xy=90,82.00000762939453
AudioPlaySdWav playSdWav3; //xy=86,146
AudioPlaySdWav playSdWav4; //xy=86,146
AudioMixer4 mixer2; //xy=275,143
AudioPlaySdRaw playSdRaw1; //xy=261.1666717529297,4109.16667175293
AudioMixer4 mixer1; //xy=281,64
AudioPlayMemory playMem1; //xy=305.1666717529297,4228.16667175293
AudioMixer4 mixer3; //xy=424,91.00000762939453
AudioOutputI2S i2s1; //xy=590,75AudioConnection patchCord1(playSdWav3, 0, reverb1, 0);
AudioConnection patchCord2(playSdWav3, 0, mixer2, 0);
AudioConnection patchCord4(playSdWav3, 1, mixer2, 1);
AudioConnection patchCord15(playSdWav4, 0, mixer2, 2);
AudioConnection patchCord16(playSdWav4, 1, mixer2, 3);
AudioConnection patchCord5(playSdWav1, 0, mixer1, 0);
AudioConnection patchCord6(playSdWav1, 1, mixer1, 1);
AudioConnection patchCord7(playSdWav2, 0, mixer1, 2);
AudioConnection patchCord8(playSdWav2, 1, mixer1, 3);
AudioConnection patchCord11(mixer2, 0, mixer3, 1);
AudioConnection patchCord12(mixer1, 0, mixer3, 0);
AudioConnection patchCord13(mixer3, 0, i2s1, 0);
AudioConnection patchCord14(mixer3, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=427,172
// GUItool: end automatically generated code
// Use these with the audio adaptor board
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
const int speed_of_sound_uS_CM = 29; // speed of sound microseconds per centimeter
unsigned int SonarCloseness;
unsigned int duration, lastDuration;
unsigned int distance_CM;
const int trigPin1 = 0;
const int echoPin1 = 1;
const int trigPin2 = 3;
const int echoPin2 = 4;
const unsigned long maxDuration = 2000; // around 10 feet
// // the sensor gets flaky at greater distances.
const int sensThresh = 1600; // sensing distance for ultra-sonics
int lastVolumePotVal;
int fileIndex;
unsigned int lastPlayMillis; //use a long for Arduino Uno, Mega etc
int rangeStart = 0, rangeSCStart = 0, startStopEnable = 0, playArrayStart = 0;
int fileNos;
int distReset1, distReset2, lastDistReset1, lastDistReset2; // to track whether sensors are blocked
int randomHat(int numberInHat); // stupid prototype - why?
char fileNameArray[100][3]; // 100 two-digit text numbers
char playFileName[8];
int randArray[50];
void setup() {
Serial.begin(9600);
delay(1000);
Serial.println("start");
#ifdef ACCELEROMETER
if (! lis.begin(0x18)) { // change this to 0x19 for alternative i2c address
Serial.println("Couldnt start");
while (1);
}
#endif
#ifdef ACCELEROMETER
Serial.println("LIS3DH found!");
lis.setRange(LIS3DH_RANGE_4_G); // 2, 4, 8 or 16 G!
#endif
pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
pinMode(trigPin2, OUTPUT);
pinMode(echoPin2, INPUT);
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(40);
sgtl5000_1.enable();
sgtl5000_1.volume(0.9);
// set up mixer volumes -- see the button tutorial image file for the layout
mixer1.gain(0, 0.9);
mixer1.gain(1, 0.9);
mixer1.gain(2, 0.9);
mixer1.gain(3, 0.9);
mixer2.gain(0, 0.5);
mixer2.gain(1, 0.5);
mixer2.gain(2, 0.5);
mixer2.gain(3, 0.5);
mixer3.gain(0, 0.5);
mixer3.gain(1, 0.5);
mixer3.gain(2, 0.5);
mixer3.gain(3, 0.5);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// no SD card found, stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
Serial.println("Check to see that you are not using pins 6,7,9,11,12,13,14,18,19,22,23");
Serial.println("Check the soldering on all Teensy and Audio Shield pins");
delay(2000);
}
}
else {
// Read the contents of the SD card
File root = SD.open("/");
root.rewindDirectory();
listFiles(root);
root.close();
}
Serial.print("Number of files on SD card = ");
Serial.println(fileNos);
delay(2000); // to read information above
}
/**************** loop start ***************/
void loop() {
int distance1 = HC_SRO4read(1);
delayMicroseconds(900);
int distance2 = HC_SRO4read(2);
delayMicroseconds(900);
Serial.print(distance1);
Serial.print("\t");
Serial.println(distance2);
if (distance1 < sensThresh) {
if (distReset1 == 1) {
Serial.print("distance1 ");
Serial.println(distance1);
}
distReset1 = 0;
}
else {
distReset1 = 1;
}
if (distance2 < sensThresh) {
if (distReset2 == 1) {
Serial.print("distance2 ");
Serial.println(distance2);
distReset2 = 0;
}
}
else {
distReset2 = 1;
}
// Serial.println();
if ((distance1 < sensThresh) || (distance2 < sensThresh)) {
if (!playSdWav1.isPlaying()) { // comment this back in if you don't want to interupt the file (retrigger)
int rh = randomHat(fileNos);
parseFileName(rh);
playSdWav1.play(playFileName);
delay(5); // short delay seems to be necessary or it skips files
Serial.print("playing file ");
Serial.println(rh);
delay(4000);
}
}
}
/****************** loop end ******************/
int smoothed(int input) {
const int numReadings = 20;
// Define the number of samples to keep track of. The higher the number, the
// more the readings will be smoothed, but the slower the output will respond to
// the input. Using a constant rather than a normal variable lets us use this
// value to determine the size of the readings array.
static int readings[20]; // the readings from the analog input
static int readIndex = 0; // the index of the current reading
static int total = 0; // the running total
int average = 0; // the average
static int initialized = 0;
if (!initialized) { // make sure array is zeroed out
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
readings[thisReading] = 0;
initialized = 1;
}
}
if (initialized) {
total = (total - readings[readIndex]); // subtract the last reading:
readings[readIndex] = input; // input new data into the array
total = total + readings[readIndex]; // add the reading to the total:
readIndex = readIndex + 1; // advance to the next position in the array:
// if we're at the end of the array...
if (readIndex >= numReadings) {
// ...wrap around to the beginning:
readIndex = 0;
}
average = total / numReadings;
return average;
}
}
int HC_SRO4read(int sensNo) {
// the sensor gets flaky at greater distances.
if (sensNo == 1) {
digitalWrite(trigPin1, HIGH);
delayMicroseconds(4);
digitalWrite(trigPin1, LOW);
delayMicroseconds(250); // wait as long as possible for transmit transducer to stop ringing
// before looking for a return pulse
// if you get zeros in your output reduce 300 by a little, say 250
duration = pulseIn(echoPin1, HIGH, maxDuration);
// third parameter is the timeout - the sensor
// has a really long timeout that can slow down your
// loop significantly if sensor doesn't find an echo
if (duration == 0) duration = maxDuration; // eliminate zero if sensor times out
}
if (sensNo == 2) {
digitalWrite(trigPin2, HIGH);
delayMicroseconds(4);
digitalWrite(trigPin2, LOW);
delayMicroseconds(300); // wait as long as possible for transmit transducer to stop ringing
// before looking for a return pulse
// if you get zeros in your output reduce 300 by a little, say 250
duration = pulseIn(echoPin2, HIGH, maxDuration);
// third parameter is the timeout - the sensor
// has a really long timeout that can slow down your
// loop significantly if sensor doesn't find an echo
if (duration == 0) duration = maxDuration; // eliminate zero if sensor times out
}
return duration;
// Serial.print(duration);
// Serial.print("\t"); // print tab
// Serial.print(distance_CM);
// Serial.print("\t"); // print tab
// Serial.println(noiseFilter(duration)); // noise filter uses raw duration val, return CM
// delay(50); // use at least 50 ms delay
}
/* RandomHat
<NAME> 2007 - updated for Teensy compile 2017
choose one from a hat of n consecutive choices each time through loop
Choose each number exactly once before reseting and choosing again
*/
#define randomHatStartNum 0 // starting number in hat
#define randomHatEndNum 25 // ending number in hat - end has to be larger than start
int randomHat(int numberInHat) {
int thePick; //this is the return variable with the random number from the pool
int theIndex;
static int currentNumInHat = 0;
if (currentNumInHat == 0) { // hat is emply - all have been choosen - fill up array again
for (int i = 0 ; i < numberInHat; i++) { // Put 1 TO numberInHat in array - starting at address 0.
if (randomHatStartNum < numberInHat) {
randArray[i] = i;
}
}
currentNumInHat = abs(numberInHat); // reset current Number in Hat
// Serial.print(" hat is empty ");
// if something should happen when the hat is empty do it here
}
theIndex = random(currentNumInHat); //choose a random index from number in hat
thePick = randArray[theIndex];
randArray[theIndex] = randArray[currentNumInHat - 1]; // copy the last element in the array into the the empty slot
// // as the the draw is random this works fine, and is faster
// // the previous version. - from a reader suggestion on this page
currentNumInHat--; // decrement number in hat
return thePick;
}
void listFiles(File dir) {
fileNos = 0;
while (true) {
File entry = dir.openNextFile();
if (!entry) {
Serial.println("NO MORE FILES!");
// no more files
Serial.print("fileNos " );
Serial.println(fileNos);
for (int i = 0; i < fileNos; i++) {
Serial.print(fileNameArray[i]);
Serial.println(", ");
}
Serial.println();
break;
}
else {
// convert to string to make it easier to work with...
String entryName = (String)entry.name();
Serial.println(entryName);
if ((entryName.charAt(0) >= '0') && (entryName.charAt(0) <= '9')) {
fileNameArray[fileNos][0] = (char)entryName.charAt(0);
if ((entryName.charAt(1) >= '0') && (entryName.charAt(1) <= '9')) {
fileNameArray[fileNos][1] = (char)entryName.charAt(1);
}
fileNos++;
}
entry.close();
}
}
}
void parseFileName(int arrNo) {
//file names are 8.3 format - eight characters only, '.' , "wav" extension
for (int i = 0; i < 8; i++) {
playFileName[i] = 0;
}
int charNo = 0;
for (int i = 0; i < 2; i++) {
if ((fileNameArray[arrNo][i] >= '0') && (fileNameArray[arrNo][i] <= '9')) {
playFileName[i] = fileNameArray[arrNo][i];
charNo++;
}
}
playFileName[charNo] = '.';
playFileName[charNo + 1] = 'w';
playFileName[charNo + 2] = 'a';
playFileName[charNo + 3] = 'v';
Serial.println(playFileName);
}
| c4f9dc571d557d962a0b7151bb1e9e31863716e9 | [
"C++"
] | 1 | C++ | moderndevice/EC_projects | d7bfb787a41f67a7b5d74e9dfdbd2ad7ab627550 | 0314a001cdbe0434dbb767052ec4f491c0cb0926 |
refs/heads/master | <file_sep>[tool.poetry]
name = "servo-control"
version = "0.1.0"
description = ""
authors = ["<NAME> <<EMAIL>>"]
license = "Apache-2.0"
[tool.poetry.dependencies]
python = "^3.8"
paho-mqtt = "^1.5.1"
configargparse = "^1.2.3"
pigpio = "^1.78"
pydantic = "^1.6.1"
python-dotenv = "^0.14.0"
[tool.poetry.dev-dependencies]
flake8 = "^3.8.4"
flake8-bugbear = "^20.1.4"
black = "^20.8b1"
mypy = "^0.782"
taskipy = "^1.3.0"
yamllint = "^1.25.0"
[tool.poetry.scripts]
main = "servo_control.main:run"
[tool.taskipy.tasks]
lint = "flake8"
yamllint = "yamllint ."
check_types = "mypy"
check_fmt = "black --check ."
fmt = "black ."
check = "task lint && task yamllint && task check_types && task check_fmt"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
<file_sep>from typing import Iterator, Callable, Protocol, Tuple, List, Optional
import asyncio
import logging
from dotenv import load_dotenv
import pigpio
from pydantic import BaseModel
from paho.mqtt.client import Client as PahoClient
class FileHandle(Protocol):
...
class PiGpio(Protocol):
def file_list(self, path: str) -> Tuple[int, bytes]:
...
def file_open(self, path: str, mode: int) -> FileHandle:
...
def file_read(self, handle: FileHandle, count: int) -> Tuple[int, bytes]:
...
def file_close(self, handle: FileHandle) -> None:
...
def write(self, pin: int, value: int) -> None:
...
def set_servo_pulsewidth(self, pin: int, pulse: int) -> None:
...
connected: bool
class Topic:
servo = "home/servo"
middle_temp = "home/4way_valve/middle_temp"
bottom_temp = "home/4way_valve/bottom_temp"
valve = "dash/open_valve"
@staticmethod
def temp(idx: int) -> str:
return f"dash/temperature/{idx}"
class Options(BaseModel):
pigpio_hostname: str
mqtt_username: str
mqtt_password: str
mqtt_hostname: str
mqtt_port: int
servo_bcm_pin: int
green_led_bcm_pin: int
red_led_bcm_pin: int
temp_sensor_path: str
temp_measure_period_seconds: int
initial_middle_temp: int
initial_bottom_temp: int
valve_full_close_at: int
valve_full_open_at: int
verbose: bool
class State(BaseModel):
middle_temp: Optional[float]
bottom_temp: Optional[float]
def get_options() -> Options:
import configargparse
p = configargparse.ArgParser()
p.add(
"--pigpio-hostname",
env_var="PIGPIO_HOSTNAME",
help="pigpio hostname",
default="pigpiod",
)
p.add(
"--mqtt-username",
required=True,
env_var="MQTT_USERNAME",
help="MQTT broker username",
)
p.add(
"--mqtt-password",
required=True,
env_var="MQTT_PASSWORD",
help="MQTT broker password",
)
p.add(
"--mqtt-hostname",
required=True,
env_var="MQTT_HOSTNAME",
help="MQTT broker hostname",
)
p.add(
"--mqtt-port",
required=True,
env_var="MQTT_PORT",
type=int,
help="MQTT broker port",
)
p.add(
"--servo-bcm-pin",
env_var="SERVO_BCM_PIN",
type=int,
default=18,
help="BCM port number where the servo is connected to",
)
p.add(
"--green-led-bcm-pin",
env_var="GREEN_LED_BCM_PIN",
type=int,
default=17,
help="BCM port number where the green led is connected to",
)
p.add(
"--red-led-bcm-pin",
env_var="RED_LED_BCM_PIN",
type=int,
default=27,
help="BCM port number where the red led is connected to",
)
p.add(
"--temp-sensor-path",
env_var="TEMP_SENSOR_PATH",
default="/sys/bus/w1/devices",
help="Path to the temperature sensor files",
)
p.add(
"--temp-measure-period-seconds",
env_var="TEMP_MEASURE_PERIOD_SECONDS",
type=int,
default=5,
help="A delay between temperature measurements",
)
p.add(
"--initial-middle-temp",
env_var="INITIAL_MIDDLE_TEMP",
type=float,
default=60,
help="Initial middle temperature",
)
p.add(
"--initial-bottom-temp",
env_var="INITIAL_BOTTOM_TEMP",
type=float,
default=40,
help="Initial bottom temperature",
)
p.add(
"--valve-full-close-at",
env_var="VALVE_FULL_CLOSE_AT",
type=int,
default=2010,
help="Duty cycle at which 4way valve is fully closed",
)
p.add(
"--valve-full-open-at",
env_var="VALVE_FULL_OPEN_AT",
type=int,
default=850,
help="Duty cycle at which 4way valve is fully open",
)
p.add(
"-v",
"--verbose",
env_var="VERBOSE",
help="Enable verbose logging",
action="store_const",
const=True,
default=False,
)
args = p.parse_args()
return Options(
pigpio_hostname=args.pigpio_hostname,
mqtt_username=args.mqtt_username,
mqtt_password=args.mqtt_password,
mqtt_hostname=args.mqtt_hostname,
mqtt_port=args.mqtt_port,
servo_bcm_pin=args.servo_bcm_pin,
green_led_bcm_pin=args.green_led_bcm_pin,
red_led_bcm_pin=args.red_led_bcm_pin,
temp_sensor_path=args.temp_sensor_path,
temp_measure_period_seconds=args.temp_measure_period_seconds,
initial_middle_temp=args.initial_middle_temp,
initial_bottom_temp=args.initial_bottom_temp,
valve_full_close_at=args.valve_full_close_at,
valve_full_open_at=args.valve_full_open_at,
verbose=args.verbose,
)
def report_temperature(mqtt: PahoClient, temps: List[float]) -> None:
for idx, temp in enumerate(temps):
mqtt.publish(Topic.temp(idx), f"{temp:4.1f}°")
def control_valve(
options: Options, mqtt: PahoClient, state: State, temps: List[float]
) -> None:
control_temp = temps[0]
if state.bottom_temp is None:
logging.info("Bottom temp not set. Refusing control.")
return
if state.middle_temp is None:
logging.info("Middle temp not set. Refusing control.")
return
control = (control_temp - state.bottom_temp) / (
(state.middle_temp - state.bottom_temp) * 2
)
control = max(0, min(1, control))
mqtt.publish(Topic.valve, "{:4.1f}%".format(control * 100))
duty = options.valve_full_close_at - (
control * (options.valve_full_close_at - options.valve_full_open_at)
)
mqtt.publish(Topic.servo, prepare_duty_cycle(duty))
def prepare_duty_cycle(duty_cycle: float) -> int:
return int(duty_cycle / 10) * 10 # duty needs to be divisible by 10
def get_temperature(options: Options, pi: PiGpio) -> Iterator[float]:
"""
Reads tempreture from sensors on a possible remote RPi.
Heavily inspired by examples in http://abyz.me.uk/rpi/pigpio/examples.html
"""
c, files_bytes = pi.file_list(f"{options.temp_sensor_path}/*/w1_slave")
if c >= 0:
files = files_bytes.decode("utf8")
for sensor in files[:-1].split("\n"):
h = pi.file_open(sensor, pigpio.FILE_READ)
c, data_bytes = pi.file_read(h, 1000) # 1000 is plenty to read full file.
pi.file_close(h)
data = data_bytes.decode("utf8")
"""
Typical file contents
73 01 4b 46 7f ff 0d 10 41 : crc=41 YES
73 01 4b 46 7f ff 0d 10 41 t=23187
"""
if "YES" in data:
(discard, sep, reading) = data.partition(" t=")
t = float(reading) / 1000.0
yield t
else:
raise AssertionError(
f"Unable to get file list. count=[{c}], bytes=[{files_bytes!r}]"
)
def turn_on_green(pi: PiGpio, options: Options) -> None:
pi.write(options.green_led_bcm_pin, 1)
def red_led(pi: PiGpio, options: Options, on: bool) -> None:
pi.write(options.red_led_bcm_pin, 1 if on else 0)
def get_mqtt_client(options: Options, on_connect, on_message) -> PahoClient:
mqtt = PahoClient()
mqtt.on_connect = on_connect
mqtt.on_message = on_message
mqtt.username_pw_set(options.mqtt_username, options.mqtt_password)
mqtt.connect(options.mqtt_hostname, options.mqtt_port, keepalive=60)
mqtt.loop_start()
return mqtt
def on_connect_callback(options: Options, pi: PiGpio) -> Callable:
def on_connect(client, userdata, flags, rc):
try:
logging.info("Connected to the MQTT broker.")
client.subscribe(Topic.servo)
client.subscribe(Topic.middle_temp)
client.subscribe(Topic.bottom_temp)
turn_on_green(pi, options)
except Exception:
logging.exception("Error in the on_connect")
return on_connect
def on_message_callback(options: Options, pi: PiGpio, state: State) -> Callable:
def on_message(client, userdata, msg):
try:
if msg.topic == Topic.servo:
on_servo_control(pi, options, msg)
elif msg.topic == Topic.middle_temp:
on_4way_middle_temp(state, msg)
elif msg.topic == Topic.bottom_temp:
on_4way_bottom_temp(state, msg)
else:
logging.info(
"Received an unhandled message from a topic [%s].", msg.topic
)
except Exception:
logging.exception(f"Error in the on_message, payload=[{msg.payload}]")
return on_message
def on_servo_control(pi: PiGpio, options: Options, msg) -> None:
duty = int(msg.payload)
pi.set_servo_pulsewidth(options.servo_bcm_pin, prepare_duty_cycle(duty))
def on_4way_middle_temp(state: State, msg) -> None:
logging.info(f"Received new middle temp {msg.payload}")
state.middle_temp = float(msg.payload)
def on_4way_bottom_temp(state: State, msg) -> None:
logging.info(f"Received new bottom temp {msg.payload}")
state.bottom_temp = float(msg.payload)
async def main() -> None:
load_dotenv()
options = get_options()
logging.basicConfig(level=logging.DEBUG if options.verbose else logging.INFO)
state = State(middle_temp=None, bottom_temp=None)
pi: PiGpio = pigpio.pi(options.pigpio_hostname)
if not pi.connected:
raise AssertionError("Unable to connect to pigpio deamon")
mqtt = get_mqtt_client(
options,
on_connect_callback(options, pi),
on_message_callback(options, pi, state),
)
keep_going = True
while keep_going:
try:
red_led(pi, options, True)
temps = list(get_temperature(options, pi))
report_temperature(mqtt, temps)
control_valve(options, mqtt, state, temps)
red_led(pi, options, False)
except Exception:
logging.exception("Error in the main loop")
keep_going = False
await asyncio.sleep(options.temp_measure_period_seconds)
def run() -> None:
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
<file_sep>[mypy]
files = servo_control
[mypy-dotenv]
ignore_missing_imports = True
[mypy-configargparse]
ignore_missing_imports = True
[mypy-pigpio]
ignore_missing_imports = True
[mypy-paho]
ignore_missing_imports = True
[mypy-paho.mqtt]
ignore_missing_imports = True
[mypy-paho.mqtt.client]
ignore_missing_imports = True
<file_sep>PIGPIO_HOSTNAME=
MQTT_USERNAME=
MQTT_PASSWORD=
MQTT_HOSTNAME=
MQTT_PORT=
<file_sep># Servo Control over MQTT
Originally based from [https://github.com/resin-io-projects/simple-server-python](https://github.com/resin-io-projects/simple-server-python)
# Running
When running the app make sure that the following environment and configuration variables are set with the appropriate values:
| Env var | Value |
|-----------------|-----------------------------------------|
| MQTT_HOSTNAME | MQTT endpoint hostname |
| MQTT_PORT | MQTT endpoint port |
| MQTT_USERNAME | MQTT broker username |
| MQTT_PASSWORD | MQTT broker password |
| Resin Config var | Value |
|-----------------------------|-----------------------------------------|
| RESIN_HOST_CONFIG_dtoverlay | w1-gpio,gpiopin=22 |
# Pinout
| Connection | Colour | Physical Pin | RPi Pin Name | Function |
|------------|--------|--------------|--------------|-----------|
| 1. | Brown | 13 | GPIO 27 | Red Led |
| 2. | Brown | 11 | GPIO 17 | Green Led |
| 3. | Purple | 9 | Ground | |
| 4. | Gray | 15 | GPIO 22 | W1 Temp |
| 5. | Gray | 17 | 3v3 Power | |
| 6. | Brown | 12 | GPIO 18 | Servo |
# Save MQTT Dash settings
```bash
moquitto_sub --url mqtt://user:pass@hostname:port/metrics/exchange -C 1 | jq --indent 4 > dash.json
```
| 8a6cd754c13dfa1efe2676ef485dfc0df6010d76 | [
"TOML",
"Markdown",
"INI",
"Python",
"Shell"
] | 5 | TOML | samanos/servo-control-rpi-mqtt | b2ef0ece4edd06d78cb98104ff86e87c456219e6 | ead2e4fd41a01720415c48103c164c04a84a3565 |
refs/heads/master | <file_sep>import logo from './tradinglogo.gif';
import stock from './topgainer_24.png'
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<p>
Welcome to my trading app
</p>
<img src='https://source.unsplash.com/1600x900/?header'/>
<img src='https://source.unsplash.com/1600x900/?welcome'/>
<section class="text-gray-600 body-font">
<div class="container px-5 py-24 mx-auto">
<div class="flex flex-wrap -mx-4 -mb-10 text-center">
<div class="sm:w-1/2 mb-10 px-4">
<div class="rounded-lg h-64 overflow-hidden">
<img alt="content" class="object-cover object-center h-full w-full" src="https://source.unsplash.com/1201x501/?budget"/>
</div>
<h2 class="title-font text-2xl font-medium text-red-900 mt-6 mb-3">Stock market analysis</h2>
<p class="leading-relaxed text-base">Explore stock market today.</p>
<button class="flex mx-auto mt-6 text-white bg-indigo-500 border-0 py-2 px-5 focus:outline-none hover:bg-indigo-600 rounded">Click here</button>
</div>
<div class="sm:w-1/2 mb-10 px-4">
<div class="rounded-lg h-64 overflow-hidden">
<img alt="content" class="object-cover object-center h-full w-full" src="https://source.unsplash.com/1202x502/?cryptocurrency"/>
</div>
<h2 class="title-font text-2xl font-medium text-red-900 mt-6 mb-3">Block chain</h2>
<p class="leading-relaxed text-base">Click here to know more about crypto.</p>
<button class="flex mx-auto mt-6 text-white bg-indigo-500 border-0 py-2 px-5 focus:outline-none hover:bg-indigo-600 rounded">Click here</button>
</div>
</div>
</div>
</section>
<br/>
<br/>
<p>Meanwhile you can watch this while the webpage gets updated.</p>
<iframe width="500" height="500" src="https://www.youtube.com/embed/7thDk6RSsQ0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </header>
<section className="Section">
<h1>Tog gainers for today:</h1>
<img src={stock} className="App-logo" alt="logo" />
</section>
<section className="text-gray-600 body-font">
<div className="container px-5 py-24 mx-auto">
<div className="xl:w-1/2 lg:w-3/4 w-full mx-auto text-center">
<p className="leading-relaxed text-lg">Stay tuned for further updates</p>
<span className="inline-block h-1 w-10 rounded bg-indigo-500 mt-8 mb-6"></span>
<h2 className="text-gray-900 font-medium title-font tracking-wider text-sm">Author:Harsh</h2>
<p className="text-gray-500">Webdeveloper</p>
</div>
</div>
</section>
<section class="text-gray-600 body-font">
<div class="container px-5 py-24 mx-auto flex flex-wrap">
<div class="flex w-full mb-20 flex-wrap">
<h1 class="sm:text-3xl text-2xl font-medium title-font text-gray-900 lg:w-1/3 lg:mb-0 mb-4">Gallery</h1>
<p class="lg:pl-6 lg:w-2/3 mx-auto leading-relaxed text-base">.</p>
</div>
<div class="flex flex-wrap md:-m-2 -m-1">
<div class="flex flex-wrap w-1/2">
<div class="md:p-2 p-1 w-1/2">
<img alt="gallery" class="w-full object-cover h-full object-center block" src="https://source.unsplash.com/500x300/?fun"/>
</div>
<div class="md:p-2 p-1 w-1/2">
<img alt="gallery" class="w-full object-cover h-full object-center block" src="https://source.unsplash.com/501x301/?cricket"/>
</div>
<div class="md:p-2 p-1 w-full">
<img alt="gallery" class="w-full h-full object-cover object-center block" src="https://source.unsplash.com/600x360/?game"/>
</div>
</div>
<div class="flex flex-wrap w-1/2">
<div class="md:p-2 p-1 w-full">
<img alt="gallery" class="w-full h-full object-cover object-center block" src="https://source.unsplash.com/601x361/?weather"/>
</div>
<div class="md:p-2 p-1 w-1/2">
<img alt="gallery" class="w-full object-cover h-full object-center block" src="https://source.unsplash.com/502x302/?science"/>
</div>
<div class="md:p-2 p-1 w-1/2">
<img alt="gallery" class="w-full object-cover h-full object-center block" src="https://source.unsplash.com/503x303/?maths"/>
</div>
</div>
</div>
</div>
</section>
<p>Want to know more about me checkout below link:</p>
<br/>
<a
className="App-link"
href="https://www.linkedin.com/in/harsh-raj-73a78113b"
target="_blank"
rel="noopener noreferrer"
>
click here->Follow me on linkedin for more
</a>
<br/>
<br/>
<br/>
<a
className="App-link"
href="https://github.com/HARSH-07"
target="_blank"
rel="noopener noreferrer"
>
click here->You can also connect with me on github for collaboration
</a>
<br/>
<br/>
</div>
);
}
export default App;
| 48e9d1950916eafb70f42c2b26e930278c3b3c3b | [
"JavaScript"
] | 1 | JavaScript | HARSH-07/trading-webapp | e40853e137acd6efddf0e85c3f9375292943c6dc | 8c1f441b24bac7ba639589bce5e2c7c06457524a |
refs/heads/development | <file_sep>var db = connect('127.0.0.1:27017/melbourneCarpark');
db.parking_bays.createIndex( { 'the_geom' : '2dsphere' } );
db.parking_status.createIndex( { 'location' : '2dsphere' } );
<file_sep>from flask import Flask, url_for
from service.parkingBayService import ParkingBayService
from flask.json import jsonify
import json
app = Flask(__name__)
def __init__(self):
self.parking_bay_service = ParkingBayService()
@app.route('/available/<longitude>/<lattitude>')
def getAvailableParkingSlots(longitude, lattitude):
parking_bay_service = ParkingBayService()
parkingBays = parking_bay_service.getAvailableParkingBays(float(longitude), float(lattitude))
return jsonify({'parkingBays': [parkingBay.serialize() for parkingBay in parkingBays]})
<file_sep>from datetime import datetime
from domain.availableParkingBay import AvailableParkingBay
from repository.parkingBayRepository import ParkingBayRepository
from repository.parkingStatusRepository import ParkingStatusRepository
from repository.parkingBayRestrictionRepository import ParkingBayRestrictionRepository
from repository.parkingStatusModifiedTimeRepositiory import ParkingStatusModifiedTimeRepository
class ParkingBayService:
def __init__(self):
self.parking_bay_repository = ParkingBayRepository()
self.parking_status_repository = ParkingStatusRepository()
self.parking_bay_restriction_repository = ParkingBayRestrictionRepository()
self.parking_status_modified_time_repository = ParkingStatusModifiedTimeRepository()
def getAvailableParkingBays(self, longitude, lattitude):
current_time = datetime.now().time()
current_day = datetime.now().date().weekday()
parkingStatusLastModifiedTime = self.parking_status_modified_time_repository.getLatestModifiedTime()
parkingBayStatusList = self.__getAvailableParkingBays(longitude,lattitude, parkingStatusLastModifiedTime['lastModifiedTimeId'])
bayIds = self.__extractBayIds(parkingBayStatusList)
parkingRestrictions = self.__getParkingRestrictions(bayIds, current_day, current_time)
markerIds = self.__extractStreetMarkerIds(parkingBayStatusList)
parkingBays = self.__getParkingBays(markerIds)
availableParkingBays = []
for parkingBayStatus in parkingBayStatusList:
availableParkingBay = AvailableParkingBay(
parkingBayStatus['bay_id'],
parkingBayStatus['location']['coordinates'][0],
parkingBayStatus['location']['coordinates'][1],
self.__getParkingRestrictionDescription(parkingBayStatus['bay_id'], parkingRestrictions),
self.__getParkingBayDescription(parkingBayStatus['streetMarkerId'], parkingBays)
)
availableParkingBays.append(availableParkingBay)
return availableParkingBays
def __getParkingRestrictionDescription(self, bayId, parkingRestrictions):
for parkingRestriction in parkingRestrictions:
if parkingRestriction['bay_id'] == bayId:
print(parkingRestriction)
return parkingRestriction['description']
return None
def __getParkingBayDescription(self, markerId, parkingBays):
for parkingBay in parkingBays:
if parkingBay['marker_id'] == markerId:
print(parkingBay)
return parkingBay['description']
return None
def __getAvailableParkingBays(self, longitude, lattitude, lastModifiedTimeId):
return self.parking_status_repository.getAvailableParkingSlots(longitude, lattitude, lastModifiedTimeId)
def __getParkingBays(self, markerIds):
return self.parking_bay_repository.getAvailableParkingBays(markerIds)
def __getParkingRestrictions(self, bayIds, day, currentTime):
date = datetime(1900, 1, 1)
currentTime = datetime.combine(date, currentTime)
return self.parking_bay_restriction_repository.getAvailableParkingBayRestrictions(bayIds, day, currentTime)
def __extractBayIds(self, parkingBayStatusList):
parkingBayIds = []
for parkingBayStatus in parkingBayStatusList:
parkingBayIds.append(parkingBayStatus['bay_id'])
return parkingBayIds
def __extractStreetMarkerIds(self, parkingBayStatusList):
markerIds = []
for parkingBayStatus in parkingBayStatusList:
markerIds.append(parkingBayStatus['streetMarkerId'])
return markerIds
<file_sep>import unittest
from rest.repository.parkingStatusRepository import ParkingStatusRepository
from rest.repository.parkingBayRepository import ParkingBayRepository
from rest.repository.parkingBayRestrictionRepository import ParkingBayRestrictionRepository
from rest.repository.parkingStatusModifiedTimeRepositiory import ParkingStatusModifiedTimeRepository
from datetime import time,datetime
class TestParkingStatusRepository(unittest.TestCase):
def test_get_available_parking_slots(self):
lastModifiedTimeRepository = ParkingStatusModifiedTimeRepository()
parkingStatusRepository = ParkingStatusRepository()
last_modified_time = lastModifiedTimeRepository.getLatestModifiedTime()
slots = parkingStatusRepository.getAvailableParkingSlots( 144.96488490609,-37.7945695473976,last_modified_time['lastModifiedTimeId'])
print('finding the slots')
for doc in slots:
print(doc)
def test_get_parking_bays(self):
repository = ParkingBayRepository()
bays = repository.getAvailableParkingBays(["2118N"])
print('finding the bays')
for doc in bays:
print(doc)
def test_get_parking_restrictions(self):
repository = ParkingBayRestrictionRepository()
restrictions = repository.getAvailableParkingBayRestrictions(["1741"],1,datetime(1900, 1, 1, 5, 00, 00))
print('finding the restrictions')
for doc in restrictions:
print(doc)
def test_get_latest_modified_time(self):
repository = ParkingStatusModifiedTimeRepository()
last_modified_time = repository.getLatestModifiedTime()
print('finding the last modified time')
print(last_modified_time)
if __name__ == '__main__':
unittest.main()
<file_sep>import React from 'react';
import {GoogleLocationSearchBar} from './GoogleLocationSearchBar'
export default class CarPortSelectionApp extends React.Component {
render() {
return (
<GoogleLocationSearchBar />
);
}
}<file_sep>from pymongo import MongoClient
from bson.son import SON
class ParkingBayRepository:
def __init__(self):
client = MongoClient('localhost:27017')
self.db = client.melbourneCarpark
def getAvailableParkingBays(self, markerIds):
return list(self.db.parking_bay.find({"marker_id":{"$in":markerIds}}))
<file_sep>import requests
import json
from mongoengine import *
class ParkingBay(Document):
bay_id = StringField()
description = StringField()
seg_id = StringField()
marker_id = StringField()
the_geom = MultiPolygonField()
meta = {
'indexes': [
'bay_id',
'seg_id'
]
}
url = 'https://data.melbourne.vic.gov.au/resource/wuf8-susg.json?$limit=50000'
headers = {'X-App-Token': '<KEY>'}
resp = requests.get(url, headers=headers)
connect('melbourneCarpark', host='localhost', port=27017)
for feature in resp.json():
parkingBay = ParkingBay()
parkingBay.bay_id = feature['bay_id']
if 'rd_seg_dsc' in feature:
parkingBay.description = feature['rd_seg_dsc']
if 'rd_seg_id' in feature:
parkingBay.seg_id = feature['rd_seg_id']
if 'marker_id' in feature:
parkingBay.marker_id = feature['marker_id']
parkingBay.the_geom = feature['the_geom']
parkingBay.save()
<file_sep>import requests
import json
from datetime import time,datetime
import itertools
from mongoengine import *
from functools import reduce
class ParkingRestriction(Document):
bay_id = StringField()
description = StringField()
typedesc = StringField()
day = IntField()
startTime = DateTimeField()
endTime = DateTimeField()
duration = IntField()
effectiveOnPH = BooleanField()
disableOnly = BooleanField()
ticket = BooleanField()
metered = BooleanField()
free = BooleanField()
meta = {
'indexes': [
'bay_id',
'day'
]
}
def get_restricted_slots(parking_bay_restriction):
restricted_slots = []
for parking_restriction_number in range(1,6):
if 'description' + str(parking_restriction_number) in parking_bay_restriction:
restricted_slots.append((parking_bay_restriction['description' + str(parking_restriction_number)],
parking_bay_restriction['fromday' + str(parking_restriction_number)],
parking_bay_restriction['today' + str(parking_restriction_number)],
parking_bay_restriction['starttime' + str(parking_restriction_number)],
parking_bay_restriction['endtime' + str(parking_restriction_number)],
parking_bay_restriction['duration' + str(parking_restriction_number)],
parking_bay_restriction['typedesc' + str(parking_restriction_number)],
parking_bay_restriction['effectiveonph' + str(parking_restriction_number)]))
return restricted_slots
def parkingRestrictions_per_day(parking_bay_restriction, restricted_slot):
fromDay = int(restricted_slot[1])
toDay = int(restricted_slot[2])
if toDay == 0:
toDay = 7
parkingRestrictions = []
for day in range(fromDay, toDay + 1):
parking_restrcition = ParkingRestriction()
parking_restrcition.bay_id = parking_bay_restriction["bayid"]
parking_restrcition.description = restricted_slot[0]
parking_restrcition.day = day if day != 7 else 0
parking_restrcition.startTime = datetime.strptime(restricted_slot[3], '%H:%M:%S')
parking_restrcition.endTime = datetime.strptime(restricted_slot[4], '%H:%M:%S')
parking_restrcition.duration = int(restricted_slot[5])
parking_restrcition.typedesc = restricted_slot[6]
parking_restrcition.effectiveOnPH = bool(restricted_slot[7])
parking_restrcition.disableOnly = restricted_slot[6] == "Disabled Only"
parking_restrcition.ticket = "Ticket" in restricted_slot[6]
parking_restrcition.metered = "Meter" in restricted_slot[6]
parkingRestrictions.append(parking_restrcition)
return parkingRestrictions
def free_slots(parkingRestrictios):
free_slots = []
for key, group in itertools.groupby(parkingRestrictios, key=lambda parkingRestiction:(parkingRestiction.bay_id,parkingRestiction.day)):
free_slots.append(create_free_slots(key[0],key[1],list(group)))
return reduce(list.__add__,free_slots)
def create_free_slots(bayId, day, parkdingRestrictionsList):
hours_in_day = (datetime(1900,1,1,0, 00,00), datetime(1900,1,1,23,59,00))
reserved_slots = []
free_slots = []
for parkingRestiction in parkdingRestrictionsList:
reserved_slots.append((parkingRestiction.startTime, parkingRestiction.endTime))
slots = sorted([(hours_in_day[0], hours_in_day[0])] + reserved_slots + [(hours_in_day[1], hours_in_day[1])])
for start, end in ((slots[i][1], slots[i+1][0]) for i in range(len(slots)-1)):
parking_restrcition = ParkingRestriction()
parking_restrcition.bay_id = bayId
parking_restrcition.day = day
parking_restrcition.startTime = start
parking_restrcition.endTime = end
parking_restrcition.description = parkingRestiction.description
parking_restrcition.typedesc = parkingRestiction.typedesc
parking_restrcition.disableOnly = parkingRestiction.disableOnly
parking_restrcition.effectiveOnPH = parkingRestiction.effectiveOnPH
parking_restrcition.disableOnly = parkingRestiction.disableOnly
parking_restrcition.ticket = parkingRestiction.ticket
parking_restrcition.metered = parkingRestiction.metered
parking_restrcition.free = True
free_slots.append(parking_restrcition)
return free_slots
def convert_to_parkingRestrictions(parking_bay_restriction, restrcted_slots):
parking_restrcitions = []
for restricted_slot in restrcted_slots:
parking_restrcitions.append(parkingRestrictions_per_day(parking_bay_restriction, restricted_slot))
return reduce(list.__add__, parking_restrcitions)
url = 'https://data.melbourne.vic.gov.au/resource/ntht-5rk7.json?$limit=50000'
headers = {'X-App-Token': '<KEY>'}
resp = requests.get(url, headers=headers)
for parking_bay_restriction in resp.json():
restricted_slots = get_restricted_slots(parking_bay_restriction)
parkingRestrictions = convert_to_parkingRestrictions(parking_bay_restriction, restricted_slots)
free_slots_list = free_slots(parkingRestrictions)
parkingRestrictions.extend(free_slots_list)
connect('melbourneCarpark', host='localhost', port=27017)
for parking_restiction in parkingRestrictions:
parking_restiction.save()
<file_sep>class AvailableParkingBay:
def __init__(self, bayId, longitude, lattitude, parkingBayRestrictionDescription, parkingBayDescription):
self.bayId = bayId
self.longitude = longitude
self.lattitude = lattitude
self.parkingRestrictionDescription = parkingBayRestrictionDescription
self.parkingBayDescription = parkingBayDescription
def serialize(self):
return {
'bayId': self.bayId,
'longitude': self.longitude,
'lattitude': self.lattitude,
'parkingRestrictionDescription': self.parkingRestrictionDescription,
'parkingBayDescription': self.parkingBayDescription,
}
<file_sep>import unittest
from rest.service.parkingBayService import ParkingBayService
from pprint import pprint
class TestParkingBayService(unittest.TestCase):
def test_get_available_parking_bays(self):
parkingBayService = ParkingBayService()
slots = parkingBayService.getAvailableParkingBays(144.96488490609,-37.7945695473976)
print('>>>>>>>>>>>>>>>>>>>>>>')
for doc in slots:
pprint(vars(doc))
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>')
if __name__ == '__main__':
unittest.main()
<file_sep>alabaster==0.7.12
Babel==2.6.0
certifi==2019.3.9
chardet==3.0.4
Click==7.0
docutils==0.14
filelock==3.0.10
Flask==1.0.2
idna==2.8
imagesize==1.1.0
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.1
mongoengine==0.17.0
packaging==19.0
pluggy==0.9.0
py==1.8.0
Pygments==2.3.1
pymongo==3.7.2
pyparsing==2.3.1
pytz==2018.9
requests==2.21.0
six==1.12.0
snowballstemmer==1.2.1
Sphinx==1.8.5
sphinxcontrib-websupport==1.1.0
toml==0.10.0
tox==3.7.0
urllib3==1.24.1
virtualenv==16.4.3
Werkzeug==0.15.2
<file_sep>import React, { Component } from 'react';
import {
AppRegistry
} from 'react-native';
import CarPortSelectionApp from './CarPortSelectionApp';
AppRegistry.registerComponent('CarPortSelectionApp', () => CarPortSelectionApp);<file_sep>from hashlib import sha1
import hmac
import binascii
def getUrl(request):
devId = 3000964
key = '<KEY>'
request = request + ('&' if ('?' in request) else '?')
raw = request+'devid={0}'.format(devId)
hashed = hmac.new(key, raw, sha1)
signature = hashed.hexdigest()
return 'http://timetableapi.ptv.vic.gov.au'+raw+'&signature={1}'.format(devId, signature)
print('Enter request:')
request = raw_input()
print getUrl(request)
<file_sep>from pymongo import MongoClient, ASCENDING
from bson.son import SON
class ParkingStatusModifiedTimeRepository:
def __init__(self):
client = MongoClient('localhost:27017')
self.db = client.melbourneCarpark
def getLatestModifiedTime(self):
return list(self.db.parking_bay_status_modified_time.find({}).limit(1).sort([("lastModifiedTimeId", ASCENDING)]))[0]<file_sep>from pymongo import MongoClient
from bson.son import SON
class ParkingStatusRepository:
def __init__(self):
client = MongoClient('localhost:27017')
self.db = client.melbourneCarpark
def getAvailableParkingSlots(self, longitude, lattitude, lastModifiedTimeId):
#query = {"location": SON([("$near", [longitude, lattitude]), ("$maxDistance", 1/111.12)])}
#return self.db.parking_bay_status.find(query).limit(100)
return list(self.db.parking_bay_status.find({ "location" :
{ "$near" :
{
"$geometry" : {
"type" : "Point" ,
"coordinates" : [longitude, lattitude] },
"$maxDistance" : 1/111.12
}
},
"lastModifiedTimeId" : lastModifiedTimeId
}).limit(100))
<file_sep>from pymongo import MongoClient
class ParkingBayRestrictionRepository:
def __init__(self):
client = MongoClient('localhost:27017')
self.db = client.melbourneCarpark
def getAvailableParkingBayRestrictions(self, bayIds, day, currentTime):
return list(self.db.parking_restriction.find({
"bay_id":{"$in":bayIds},
"day":day,
"startTime":{"$lte":currentTime},
"endTime":{"$gte":currentTime}
}))
<file_sep>import requests
import json
from datetime import time,datetime
from mongoengine import *
import uuid
class ParkingBayStatus(Document):
bay_id = StringField()
status = StringField()
location = PointField()
streetMarkerId = StringField()
lastModifiedTimeId = StringField()
meta = {
'indexes': [
'bay_id',
'streetMarkerId'
]
}
class ParkingBayStatusModifiedTime(Document):
modifiedTime = DateTimeField()
lastModifiedTimeId = StringField()
url = 'https://data.melbourne.vic.gov.au/resource/vh2v-4nfs.json?$limit=50000'
headers = {'X-App-Token': '<PASSWORD>'}
resp = requests.get(url, headers=headers)
last_modified_time = datetime.strptime(resp.headers['Last-Modified'], '%a, %d %b %Y %H:%M:%S GMT')
modifiedTimeId = uuid.uuid4()
connect('melbourneCarpark', host='localhost', port=27017)
for feature in resp.json():
parkingBayStatus = ParkingBayStatus()
parkingBayStatus.bay_id = feature['bay_id']
parkingBayStatus.location = [float(feature['location']['longitude']),float(feature['location']['latitude'])]
parkingBayStatus.status = feature['status']
parkingBayStatus.streetMarkerId = feature['st_marker_id']
parkingBayStatus.lastModifiedTimeId = modifiedTimeId.hex
parkingBayStatus.save()
parkingBayStatusModifiedTime = ParkingBayStatusModifiedTime()
parkingBayStatusModifiedTime.modifiedTime = last_modified_time
parkingBayStatusModifiedTime.lastModifiedTimeId = modifiedTimeId.hex
parkingBayStatusModifiedTime.save()
| 01dbbfeeace5033aecfa3bab4d458759d2cae277 | [
"JavaScript",
"Python",
"Text"
] | 17 | JavaScript | dekanayake/melbournce_cbd_car_parks | d11b04432e5d04050e20e9240ebcf84c70ed9aba | f91648d41006a7cb1406dbd76df592f950b9881c |
refs/heads/main | <repo_name>EwertonProg/BooksOntheTable<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/view_book/ViewBookFragment.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.view_book
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.android.ewerton.booksonthetable.R
import com.android.ewerton.booksonthetable.databinding.FragmentViewBookBinding
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.model.BookStatus
import com.android.ewerton.booksonthetable.ui.BaseFragment
import org.koin.androidx.viewmodel.ext.android.viewModel
class ViewBookFragment : BaseFragment<FragmentViewBookBinding>(R.layout.fragment_view_book) {
private val viewModel: ViewBookViewModel by viewModel()
private val args: ViewBookFragmentArgs by navArgs()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
super.onCreateView(inflater, container, savedInstanceState)
binding.viewModel = viewModel
viewModel.getBook(args.book.id)
setBookLiveDataObserver()
setOnEditBookClickListener()
setOnDeleteBookObserver()
return binding.root
}
private fun setBookLiveDataObserver() {
viewModel.book.observe(viewLifecycleOwner, {
it?.let {
setupChangeStatusButtonVisibility(it)
setTitle(it.name)
}
})
}
private fun setOnEditBookClickListener() {
binding.editBookButton.setOnClickListener {
findNavController().navigate(
ViewBookFragmentDirections.actionViewBookFragmentToMaintainBookFragment(
viewModel.book.value
)
)
}
}
private fun setOnDeleteBookObserver() {
viewModel.deleteReturn.observe(viewLifecycleOwner, {
findNavController().popBackStack()
})
}
private fun setupChangeStatusButtonVisibility(book: Book) {
binding.changeStatusButton.visibility =
if (book.status == BookStatus.READ) View.GONE else View.VISIBLE
}
private fun setTitle(title: String?) {
binding.title.titleTextView.text = title
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/model/BookStatus.kt
package com.android.ewerton.booksonthetable.model
enum class BookStatus(val statusName: String) {
TO_READ("Para Ler"), READING("Lendo"), READ("Lido");
companion object{
fun getByStatusName(statusName: String):BookStatus?{
return values().find { bookStatus -> bookStatus.statusName == statusName }
}
}
}
<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/access/sign_up/SignUpViewModel.kt
package com.android.ewerton.booksonthetable.ui.activity.access.sign_up
import android.database.sqlite.SQLiteException
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.ewerton.booksonthetable.model.User
import com.android.ewerton.booksonthetable.repository.UserRepository
import com.android.ewerton.booksonthetable.ui.util.Event
import kotlinx.coroutines.launch
class SignUpViewModel(private val userRepository: UserRepository) : ViewModel() {
val user = MutableLiveData(User())
private val _signUpResult = MutableLiveData<Event<Boolean>>()
val signUpResult: LiveData<Event<Boolean>>
get() = _signUpResult
fun signUpUser() {
viewModelScope.launch {
user.value?.let {
try {
_signUpResult.value = Event(userRepository.saveUser(it))
} catch (e: SQLiteException) {
_signUpResult.value = Event(false)
}
}
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/sharedPreferences/AppSharedPreferences.kt
package com.android.ewerton.booksonthetable.repository.sharedPreferences
interface AppSharedPreferences {
suspend fun saveSignedUserUid(uid: String)
suspend fun getSignedUserUid(): String
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/util/UiUtils.kt
package com.android.ewerton.booksonthetable.ui.util
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
import android.widget.TextView
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
fun TextView.setColorizedText(text: String, color: Int,
vararg faixa: Pair<Int, Int> = arrayOf(Pair(0, text.length))) {
val spannable = SpannableString(text)
faixa.forEach { pair ->
spannable.setSpan(
ForegroundColorSpan(color),
pair.first,
pair.second,
Spannable.SPAN_COMPOSING
)
}
this.text = spannable
}
fun TextInputEditText.validate(textInputLayout: TextInputLayout, rules: List<(String?) -> String?>){
for (rule in rules) {
textInputLayout.error = rule.invoke(this.text.toString())
if(!textInputLayout.error.isNullOrBlank()){
return
}
}
textInputLayout.isErrorEnabled = false
}
fun TextInputEditText.validateOnLostFocus(textInputLayout: TextInputLayout, vararg rules: (String?) -> String?){
this.setOnFocusChangeListener { _, hasFocus ->
if (!hasFocus) {
this.validate(textInputLayout, rules.asList())
}
}
}
<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/BookRepository.kt
package com.android.ewerton.booksonthetable.repository
import com.android.ewerton.booksonthetable.model.Book
import kotlinx.coroutines.flow.Flow
interface BookRepository {
suspend fun persist(book: Book): Book
suspend fun delete(book: Book)
fun findById(id: Long): Flow<Book?>
fun getAllBooksReading(): Flow<MutableList<Book?>>
fun getAllBooksRead(): Flow<MutableList<Book?>>
fun getAllBooksToRead(): Flow<MutableList<Book?>>
suspend fun clear()
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/db/converters/BookStatusConverter.kt
package com.android.ewerton.booksonthetable.repository.db.converters
import androidx.room.TypeConverter
import com.android.ewerton.booksonthetable.model.BookStatus
class BookStatusConverter {
@TypeConverter
fun toBookStatus(value: String) = enumValueOf<BookStatus>(value)
@TypeConverter
fun fromBookStatus(value: BookStatus) = value.name
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/util/Validations.kt
package com.android.ewerton.booksonthetable.ui.util
import java.util.regex.Pattern
fun String.isValidAsEmail() = this.matches(Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE).toRegex())
fun String.isValidAsPassword() = this.isNotBlank() && this.length >= 8
fun String.isValidAsName() = this.isNotBlank()<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/access/sign_in/SignInFragment.kt
package com.android.ewerton.booksonthetable.ui.activity.access.sign_in
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.navigation.fragment.findNavController
import com.android.ewerton.booksonthetable.R
import com.android.ewerton.booksonthetable.databinding.FragmentSignInBinding
import com.android.ewerton.booksonthetable.ui.BaseFragment
import com.android.ewerton.booksonthetable.ui.activity.internal.InternalNavHostActivity
import com.android.ewerton.booksonthetable.ui.util.setColorizedText
import org.koin.androidx.viewmodel.ext.android.viewModel
class SignInFragment : BaseFragment<FragmentSignInBinding>(R.layout.fragment_sign_in) {
private val viewModel: SignInViewModel by viewModel()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
super.onCreateView(inflater, container, savedInstanceState)
binding.viewModel = viewModel
configureOnClickOnSingUpRequestTextView()
setSignUpRequestTextViewColorized()
setOnSignInResultCallback()
return binding.root
}
private fun setOnSignInResultCallback() {
viewModel.signInResult.observe(viewLifecycleOwner, { event ->
event.getContentIfNotHandled()?.let {
if (it) {
Toast.makeText(this.context, "Login realizado com sucesso!", Toast.LENGTH_LONG)
.show()
startActivity(Intent(requireContext(),InternalNavHostActivity::class.java))
} else {
Toast.makeText(this.context, "Login falhou!", Toast.LENGTH_LONG).show()
}
}
})
}
private fun configureOnClickOnSingUpRequestTextView() {
binding.signUpRequestTextView.setOnClickListener {
findNavController().navigate(R.id.action_signInFragment_to_signUpFragment)
}
}
private fun setSignUpRequestTextViewColorized() {
val text = getString(R.string.sing_up_request)
binding.signUpRequestTextView.setColorizedText(
text,
resources.getColor(R.color.main, null),
Pair(15,text.length)
)
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/dao/BookDao.kt
package com.android.ewerton.booksonthetable.repository.dao
import androidx.room.*
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.model.BookStatus
import kotlinx.coroutines.flow.Flow
@Dao
interface BookDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(book: Book): Long
@Delete
suspend fun delete(book: Book)
@Update
suspend fun update(book: Book)
@Query("SELECT * FROM book WHERE book.id =:id")
fun findById(id: Long): Flow<Book?>
@Query("SELECT * FROM book WHERE book.status like :status")
fun getAllBooksByStatus(status: BookStatus): Flow<MutableList<Book?>>
@Query("DELETE FROM book")
suspend fun clear()
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/webservice/interceptor/AuthInterceptor.kt
package com.android.ewerton.booksonthetable.repository.webservice.interceptor
import okhttp3.Interceptor
import okhttp3.Response
class AuthInterceptor: Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
TODO("Not yet implemented")
}
}
<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/UserRepository.kt
package com.android.ewerton.booksonthetable.repository
import com.android.ewerton.booksonthetable.model.User
interface UserRepository {
suspend fun saveUser(user: User) :Boolean
suspend fun login(user: User): Boolean
suspend fun persist(user: User): User
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/sharedPreferences/AppSharedPreferencesImp.kt
package com.android.ewerton.booksonthetable.repository.sharedPreferences
import android.content.SharedPreferences
import com.android.ewerton.booksonthetable.repository.util.USER_UID
class AppSharedPreferencesImp(private val sharedPreferences: SharedPreferences) :
AppSharedPreferences {
override suspend fun saveSignedUserUid(uid: String) {
with(sharedPreferences.edit()) {
putString(USER_UID, uid)
apply()
}
}
override suspend fun getSignedUserUid(): String {
return sharedPreferences.getString(USER_UID, "") ?: ""
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/user_home/UserHomeViewModel.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.user_home
import androidx.lifecycle.*
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.model.BookStatus
import com.android.ewerton.booksonthetable.repository.BookRepository
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class UserHomeViewModel(private val bookRepository: BookRepository) : ViewModel() {
val readingBooks: LiveData<MutableList<Book?>> = bookRepository.getAllBooksReading().asLiveData()
val readBooks: LiveData<MutableList<Book?>> = bookRepository.getAllBooksRead().asLiveData()
val booksToRead: LiveData<MutableList<Book?>> = bookRepository.getAllBooksToRead().asLiveData()
fun populateDatabase(){
viewModelScope.launch {
bookRepository.persist(Book("Teste Para ler","da silva","Romance",BookStatus.TO_READ))
delay(1000)
bookRepository.persist(Book("Teste Lendo","de santana","Criminal",BookStatus.READING))
delay(1000)
bookRepository.persist(Book("Teste Lido","de souza","Policial",BookStatus.READ))
delay(1000)
bookRepository.persist(Book("Teste Para ler 1","da silva","Romance",BookStatus.TO_READ))
delay(1000)
bookRepository.persist(Book("Teste Lendo 1","de santana","Criminal",BookStatus.READING))
delay(1000)
bookRepository.persist(Book("Teste Lido 1","de souza","Policial",BookStatus.READ))
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/maintain_book/MaintainBookViewModel.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.maintain_book
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.repository.BookRepository
import com.android.ewerton.booksonthetable.ui.util.Event
import kotlinx.coroutines.launch
class MaintainBookViewModel(private val bookRepository: BookRepository) : ViewModel() {
val book = MutableLiveData(Book())
private val _persistReturn = MutableLiveData<Event<Boolean>>()
val persistReturn: LiveData<Event<Boolean>>
get() = _persistReturn
fun persistBook(){
viewModelScope.launch {
book.value?.let { bookRepository.persist(it) }
_persistReturn.value = Event(true)
}
}
fun getBookGenders() = listOf(
"Romance",
"Drama",
"Conto",
"Poesia",
"Biografia",
"Aventura",
"Terror",
"Literatura fantástica",
"Ficção",
"HQ"
)
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/BaseFragment.kt
package com.android.ewerton.booksonthetable.ui
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.CallSuper
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
abstract class BaseFragment<DB: ViewDataBinding>(private val layoutId: Int) : Fragment(){
lateinit var binding: DB
@CallSuper
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = inflateViewAndReturnDataBinding(inflater,container)
binding.lifecycleOwner = viewLifecycleOwner
return binding.root
}
private fun inflateViewAndReturnDataBinding(
inflater: LayoutInflater,
container: ViewGroup?,
): DB = DataBindingUtil.inflate(
inflater,
layoutId,
container,
false
)
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/webservice/AuthServiceImp.kt
package com.android.ewerton.booksonthetable.repository.webservice
import com.android.ewerton.booksonthetable.model.User
import com.google.firebase.auth.FirebaseAuth
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
class AuthServiceImp(private val auth: FirebaseAuth):AuthService{
override suspend fun signUpOnFirebase(user: User) : Boolean{
return suspendCoroutine {
auth.createUserWithEmailAndPassword(user.email, user.password)
.addOnCompleteListener { loginReturn ->
it.resume(loginReturn.isSuccessful)
}
}
}
override suspend fun signInOnFirebase(user: User) :String? {
return suspendCoroutine {
auth.signInWithEmailAndPassword(user.email, user.password)
.addOnCompleteListener { loginReturn ->
if (loginReturn.isSuccessful) {
it.resume(auth.currentUser!!.uid)
}else{
it.resume(null)
}
}
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/UserRepositoryImp.kt
package com.android.ewerton.booksonthetable.repository
import com.android.ewerton.booksonthetable.model.User
import com.android.ewerton.booksonthetable.repository.dao.UserDao
import com.android.ewerton.booksonthetable.repository.sharedPreferences.AppSharedPreferences
import com.android.ewerton.booksonthetable.repository.webservice.AuthService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
class UserRepositoryImp(
private val userDao: UserDao,
private val authService: AuthService,
private val sharedPreferences: AppSharedPreferences
) : UserRepository {
override suspend fun saveUser(user: User): Boolean {
return withContext(Dispatchers.IO) {
val hasSaved = authService.signUpOnFirebase(user)
if (hasSaved) {
userDao.insert(user)
}
hasSaved
}
}
override suspend fun persist(user: User): User {
return if (user.id == 0L) {
user.apply {
id = userDao.insert(user)
}
} else {
userDao.update(user)
user
}
}
override suspend fun login(user: User): Boolean {
return withContext(Dispatchers.IO) {
authService.signInOnFirebase(user)?.let { uid ->
sharedPreferences.saveSignedUserUid(uid)
persistUserWithUid(user, uid)
return@withContext true
}
userDao.getUserByNameAndPassword(user.email, user.password)?.let {
sharedPreferences.saveSignedUserUid(it.uid)
return@withContext true
}
return@withContext false
}
}
private suspend fun persistUserWithUid(
user: User,
uid: String
) {
userDao.getUserByNameAndPassword(user.email, user.password)?.let {
it.uid = uid
this@UserRepositoryImp.persist(it)
return
}
user.let {
it.uid = uid
this@UserRepositoryImp.persist(it)
return
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/app/BooksOnTheTableApp.kt
package com.android.ewerton.booksonthetable.app
import android.app.Application
import com.android.ewerton.booksonthetable.di.module.*
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
import org.koin.core.logger.Level
class BooksOnTheTableApp :Application(){
override fun onCreate() {
super.onCreate()
startKoin {
androidContext(this@BooksOnTheTableApp)
modules(
databaseModule,
repositoryModule,
viewModelModule,
networkModule,
apiModule,
sharedPreferenceModule,
)
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/access/sign_in/SignInViewModel.kt
package com.android.ewerton.booksonthetable.ui.activity.access.sign_in
import android.database.sqlite.SQLiteException
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.ewerton.booksonthetable.model.User
import com.android.ewerton.booksonthetable.repository.UserRepository
import com.android.ewerton.booksonthetable.ui.util.Event
import kotlinx.coroutines.launch
class SignInViewModel(val userRepository: UserRepository): ViewModel(){
val user = MutableLiveData(User())
private val _signInResult = MutableLiveData<Event<Boolean>>()
val signInResult: LiveData<Event<Boolean>>
get() = _signInResult
fun signIn(){
viewModelScope.launch {
user.value?.let {
try {
_signInResult.value = Event(userRepository.login(it))
}catch (e: SQLiteException){
_signInResult.value = Event(false)
}
}
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/webservice/AuthService.kt
package com.android.ewerton.booksonthetable.repository.webservice
import com.android.ewerton.booksonthetable.model.User
interface AuthService{
suspend fun signUpOnFirebase(user: User) : Boolean
suspend fun signInOnFirebase(user: User) : String?
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/db/BooksOnTheTableDatabase.kt
package com.android.ewerton.booksonthetable.repository.db
import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.model.User
import com.android.ewerton.booksonthetable.repository.dao.BookDao
import com.android.ewerton.booksonthetable.repository.dao.UserDao
import com.android.ewerton.booksonthetable.repository.db.converters.BookStatusConverter
@Database(entities = [User::class, Book::class], version = 4, exportSchema = false)
@TypeConverters(BookStatusConverter::class)
abstract class BooksOnTheTableDatabase : RoomDatabase() {
abstract val userDao: UserDao
abstract val bookDao: BookDao
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/dao/UserDao.kt
package com.android.ewerton.booksonthetable.repository.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.android.ewerton.booksonthetable.model.User
@Dao
interface UserDao {
@Insert
suspend fun insert(user: User): Long
@Update
suspend fun update(user: User)
@Query("SELECT * FROM user WHERE user.email = :email AND user.password = :password")
suspend fun getUserByNameAndPassword(email:String, password:String):User?
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/model/User.kt
package com.android.ewerton.booksonthetable.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(tableName = "user", indices = [Index(value = ["email"],unique = true), Index(value = ["uid"],unique = true)])
data class User(
@ColumnInfo(name = "email")
var email: String = "",
@ColumnInfo(name = "password")
var password: String = "",
@ColumnInfo(name = "name")
var name: String = "",
@ColumnInfo(name = "uid")
var uid: String = "",
@PrimaryKey(autoGenerate = true)
var id: Long = 0L,
)<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/user_home/UserHomeFragment.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.user_home
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import com.android.ewerton.booksonthetable.R
import com.android.ewerton.booksonthetable.databinding.FragmentUserHomeBinding
import com.android.ewerton.booksonthetable.ui.BaseFragment
import com.android.ewerton.booksonthetable.ui.activity.internal.user_home.adapter.BookItemAdapter
import org.koin.androidx.viewmodel.ext.android.viewModel
class UserHomeFragment : BaseFragment<FragmentUserHomeBinding>(R.layout.fragment_user_home) {
private val viewModel: UserHomeViewModel by viewModel()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
super.onCreateView(inflater, container, savedInstanceState)
setupReadingBooksSection()
setupToReadBooksSection()
setupReadBooksSection()
setNavigationOnClickOnAddBook()
return binding.root
}
private fun setNavigationOnClickOnAddBook() {
binding.addBookButton.setOnClickListener {
findNavController().navigate(
UserHomeFragmentDirections.actionUserHomeFragmentToMaintainBookFragment(
null
)
)
}
}
private fun setupReadingBooksSection() {
val adapter = BookItemAdapter()
binding.readingSection.apply {
this.statusBookTitleLabel.text = getString(R.string.reading)
this.bookStatusRecyclerView.adapter = adapter
}
viewModel.readingBooks.observe(viewLifecycleOwner, {
adapter.submitList(it)
})
}
private fun setupToReadBooksSection() {
val adapter = BookItemAdapter()
binding.toReadSection.apply {
this.statusBookTitleLabel.text = getString(R.string.to_read)
this.bookStatusRecyclerView.adapter = adapter
}
viewModel.booksToRead.observe(viewLifecycleOwner, {
adapter.submitList(it)
})
}
private fun setupReadBooksSection() {
val adapter = BookItemAdapter()
binding.readSection.apply {
this.statusBookTitleLabel.text = getString(R.string.read)
this.bookStatusRecyclerView.adapter = adapter
}
viewModel.readBooks.observe(viewLifecycleOwner, {
adapter.submitList(it)
})
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/access/AccessNavHostActivity.kt
package com.android.ewerton.booksonthetable.ui.activity.access
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.android.ewerton.booksonthetable.R
class AccessNavHostActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_access_nav_host)
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/BookRepositoryImp.kt
package com.android.ewerton.booksonthetable.repository
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.model.BookStatus
import com.android.ewerton.booksonthetable.repository.dao.BookDao
import kotlinx.coroutines.flow.Flow
class BookRepositoryImp(private val dao: BookDao) : BookRepository {
override suspend fun persist(book: Book): Book {
return if (book.id == 0L) {
book.apply {
id = dao.insert(book)
}
} else {
dao.update(book)
book
}
}
override suspend fun delete(book: Book) {
dao.delete(book)
}
override fun findById(id: Long): Flow<Book?> {
return dao.findById(id)
}
override fun getAllBooksReading(): Flow<MutableList<Book?>> {
return dao.getAllBooksByStatus(BookStatus.READING)
}
override fun getAllBooksRead(): Flow<MutableList<Book?>> {
return dao.getAllBooksByStatus(BookStatus.READ)
}
override fun getAllBooksToRead(): Flow<MutableList<Book?>> {
return dao.getAllBooksByStatus(BookStatus.TO_READ)
}
override suspend fun clear() {
dao.clear()
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/webservice/BookService.kt
package com.android.ewerton.booksonthetable.repository.webservice
import com.android.ewerton.booksonthetable.model.Book
import retrofit2.Call
import retrofit2.http.GET
interface BookService {
@GET("users/{user}/books/reading")
suspend fun getAllReadingBooksForUser(): Call<List<Book>>
@GET("users/{user}/books/toRead")
suspend fun getAllToReadBooksForUser(): Call<List<Book>>
@GET("users/{user}/books/read")
suspend fun getAllReadBooksForUser(): Call<List<Book>>
@GET("users/{user}/books/{id}")
suspend fun getUserBook(): Call<Book>
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/view_book/ViewBookViewModel.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.view_book
import androidx.lifecycle.*
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.model.BookStatus
import com.android.ewerton.booksonthetable.repository.BookRepository
import com.android.ewerton.booksonthetable.ui.util.Event
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class ViewBookViewModel(private val bookRepository: BookRepository) : ViewModel() {
private val _book = MutableLiveData(Book())
val book: LiveData<Book?>
get() = _book
private val _deleteReturn = MutableLiveData<Event<Boolean>>()
val deleteReturn: LiveData<Event<Boolean>>
get() = _deleteReturn
fun deleteBook() {
viewModelScope.launch {
book.value?.let { bookRepository.delete(it) }
_deleteReturn.value = Event(true)
}
}
fun getBook(id: Long){
viewModelScope.launch {
bookRepository.findById(id).collect {
_book.value = it
}
}
}
fun changeBookStatus() {
viewModelScope.launch {
book.value?.run {
status = status?.let { BookStatus.values()[it.ordinal + 1] }
bookRepository.persist(this)
}
}
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/access/sign_up/SignUpFragment.kt
package com.android.ewerton.booksonthetable.ui.activity.access.sign_up
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.navigation.fragment.findNavController
import com.android.ewerton.booksonthetable.R
import com.android.ewerton.booksonthetable.databinding.FragmentSignUpBinding
import com.android.ewerton.booksonthetable.ui.BaseFragment
import com.android.ewerton.booksonthetable.ui.util.isValidAsEmail
import com.android.ewerton.booksonthetable.ui.util.isValidAsName
import com.android.ewerton.booksonthetable.ui.util.isValidAsPassword
import com.android.ewerton.booksonthetable.ui.util.validateOnLostFocus
import org.koin.androidx.viewmodel.ext.android.viewModel
class SignUpFragment : BaseFragment<FragmentSignUpBinding>(R.layout.fragment_sign_up) {
private val viewModel: SignUpViewModel by viewModel()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
super.onCreateView(inflater, container, savedInstanceState)
binding.viewModel = viewModel
setupValidations()
setOnSignUpResultCallback()
return binding.root
}
private fun setupValidations() {
setFullNameEditTextValidation()
setEmailEditTextValidation()
setPasswordEditTextValidation()
setPasswordConfirmationEditTextValidation()
}
private fun setOnSignUpResultCallback() {
viewModel.signUpResult.observe(viewLifecycleOwner, { event ->
event.getContentIfNotHandled()?.let {
if (it) {
Toast.makeText(this.context, "Usuario criado!", Toast.LENGTH_SHORT).show()
findNavController().popBackStack()
} else {
Toast.makeText(this.context, "Erro ao criar o usuario!", Toast.LENGTH_SHORT)
.show()
}
}
})
}
private fun setFullNameEditTextValidation() {
binding.fullNameEditText.validateOnLostFocus(binding.fullNameInputText,
{ if (it?.isValidAsName() == true) null else "Nome Invalido" })
}
private fun setEmailEditTextValidation() {
binding.emailEditText.validateOnLostFocus(binding.emailTextInput,
{ if (it?.isValidAsEmail() == true) null else "Email Invalido" })
}
private fun setPasswordEditTextValidation() {
binding.passwordEditText.validateOnLostFocus(binding.passwordInputText,
{ if (it?.isValidAsPassword() == true) null else "A senha deve conter ao menos 8 caracteres" })
}
private fun setPasswordConfirmationEditTextValidation() {
binding.confirmPasswordEditText.validateOnLostFocus(binding.confirmPasswordInputText,
{ if (it == viewModel.user.value?.password) null else "As senhas devem ser iguais" })
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/di/module/AppModules.kt
package com.android.ewerton.booksonthetable.di.module
import com.android.ewerton.booksonthetable.repository.webservice.AuthServiceImp
import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import androidx.room.Room
import com.android.ewerton.booksonthetable.BuildConfig
import com.android.ewerton.booksonthetable.repository.BookRepository
import com.android.ewerton.booksonthetable.repository.BookRepositoryImp
import com.android.ewerton.booksonthetable.repository.UserRepository
import com.android.ewerton.booksonthetable.repository.UserRepositoryImp
import com.android.ewerton.booksonthetable.repository.dao.BookDao
import com.android.ewerton.booksonthetable.repository.dao.UserDao
import com.android.ewerton.booksonthetable.repository.db.BooksOnTheTableDatabase
import com.android.ewerton.booksonthetable.repository.sharedPreferences.AppSharedPreferences
import com.android.ewerton.booksonthetable.repository.sharedPreferences.AppSharedPreferencesImp
import com.android.ewerton.booksonthetable.repository.webservice.AuthService
import com.android.ewerton.booksonthetable.repository.webservice.BookService
import com.android.ewerton.booksonthetable.repository.webservice.interceptor.AuthInterceptor
import com.android.ewerton.booksonthetable.ui.activity.access.sign_in.SignInViewModel
import com.android.ewerton.booksonthetable.ui.activity.access.sign_up.SignUpViewModel
import com.android.ewerton.booksonthetable.ui.activity.internal.maintain_book.MaintainBookViewModel
import com.android.ewerton.booksonthetable.ui.activity.internal.user_home.UserHomeViewModel
import com.android.ewerton.booksonthetable.ui.activity.internal.view_book.ViewBookViewModel
import com.google.firebase.auth.FirebaseAuth
import okhttp3.OkHttpClient
import org.koin.android.viewmodel.dsl.viewModel
import org.koin.dsl.module
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
val databaseModule = module {
fun provideDatabase(application: Application): BooksOnTheTableDatabase {
return Room.databaseBuilder(
application,
BooksOnTheTableDatabase::class.java,
BuildConfig.MAIN_DATABASE_NAME
).fallbackToDestructiveMigration()
.build()
}
fun provideUserDao(database: BooksOnTheTableDatabase): UserDao {
return database.userDao
}
fun provideBookDao(database: BooksOnTheTableDatabase): BookDao {
return database.bookDao
}
single {
provideDatabase(get())
}
single {
provideUserDao(get())
}
single {
provideBookDao(get())
}
}
val networkModule = module {
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit {
return Retrofit.Builder()
.baseUrl(BuildConfig.API_URL)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create()).build()
}
fun provideOkHttpClient(authInterceptor: AuthInterceptor): OkHttpClient {
return OkHttpClient().newBuilder()
.addInterceptor(authInterceptor)
.build()
}
factory { AuthInterceptor() }
single { provideOkHttpClient(get()) }
single { provideRetrofit(get()) }
single<AuthService>{ AuthServiceImp(FirebaseAuth.getInstance()) }
}
val apiModule = module {
fun provideBookService(retrofit: Retrofit): BookService {
return retrofit.create(BookService::class.java)
}
single { provideBookService(get()) }
}
val repositoryModule = module {
single<UserRepository> { UserRepositoryImp(get(),get(),get()) }
single<BookRepository> { BookRepositoryImp(get()) }
}
val viewModelModule = module {
viewModel { SignInViewModel(userRepository = get()) }
viewModel { SignUpViewModel(userRepository = get()) }
viewModel { UserHomeViewModel(bookRepository = get()) }
viewModel { ViewBookViewModel(bookRepository = get()) }
viewModel { MaintainBookViewModel(bookRepository = get()) }
}
val sharedPreferenceModule = module {
fun provideSharedPreferences(application: Application) =
application.getSharedPreferences(
BuildConfig.MAIN_SHARED_PREFERENCES_NAME,
Context.MODE_PRIVATE
)
single<SharedPreferences> { provideSharedPreferences(get()) }
single<AppSharedPreferences> { AppSharedPreferencesImp(get()) }
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/model/Book.kt
package com.android.ewerton.booksonthetable.model
import android.os.Parcel
import android.os.Parcelable
import androidx.room.*
@Entity(tableName = "book", indices = [Index(value = ["name"], unique = true)])
data class Book(
@ColumnInfo(name = "name")
var name: String? = "",
@ColumnInfo(name = "author")
var author: String? = "",
@ColumnInfo(name = "gender")
var gender: String? = "",
@ColumnInfo(name = "status")
var status: BookStatus? = null,
@PrimaryKey(autoGenerate = true)
var id: Long = 0L
):Parcelable{
var statusByName: String?
get() = status?.statusName
set(value) {
status = value?.let { BookStatus.getByStatusName(it) }
}
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString()?.let { BookStatus.valueOf(it) },
parcel.readLong()
) {
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Book
if (name != other.name) return false
if (author != other.author) return false
if (gender != other.gender) return false
if (status != other.status) return false
if (id != other.id) return false
return true
}
override fun hashCode(): Int {
var result = name.hashCode()
result = 31 * result + author.hashCode()
result = 31 * result + gender.hashCode()
result = 31 * result + status.hashCode()
result = 31 * result + id.hashCode()
return result
}
fun getNextStatusName():String{
if(status == BookStatus.READ || status == null){
return ""
}
return BookStatus.values()[status!!.ordinal.plus(1)].statusName
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(name)
parcel.writeString(author)
parcel.writeString(gender)
parcel.writeString(this.status?.name)
parcel.writeLong(id)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<Book> {
override fun createFromParcel(parcel: Parcel): Book {
return Book(parcel)
}
override fun newArray(size: Int): Array<Book?> {
return arrayOfNulls(size)
}
}
}
<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/maintain_book/MaintainBookFragment.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.maintain_book
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.android.ewerton.booksonthetable.R
import com.android.ewerton.booksonthetable.databinding.FragmentMaintainBookBinding
import com.android.ewerton.booksonthetable.model.BookStatus
import com.android.ewerton.booksonthetable.ui.BaseFragment
import org.koin.androidx.viewmodel.ext.android.viewModel
class MaintainBookFragment :
BaseFragment<FragmentMaintainBookBinding>(R.layout.fragment_maintain_book) {
private val viewModel: MaintainBookViewModel by viewModel()
private val args: MaintainBookFragmentArgs by navArgs()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
super.onCreateView(inflater, container, savedInstanceState)
binding.viewModel = viewModel
updateScreenToSave()
getBookIfExistsAndUpdateScreen()
setOnPersistReturnNavigate()
return binding.root
}
override fun onResume() {
super.onResume()
setupGenderAdapter()
setupStatusAdapter()
}
private fun setupGenderAdapter() {
binding.genderEditText.setAdapter(
ArrayAdapter(
requireContext(),
R.layout.dropdown_list_item,
viewModel.getBookGenders()
)
)
}
private fun setupStatusAdapter() {
binding.statusEditText.apply {
setAdapter(
ArrayAdapter(
requireContext(),
R.layout.dropdown_list_item,
BookStatus.values().map { bookStatus -> bookStatus.statusName }
)
)
}
}
private fun getBookIfExistsAndUpdateScreen() {
args.book?.let {
viewModel.book.value = it
updateScreenToUpdate()
}
}
private fun setOnPersistReturnNavigate() {
viewModel.persistReturn.observe(viewLifecycleOwner, {
findNavController().navigate(MaintainBookFragmentDirections.actionMaintainBookFragmentToUserHomeFragment())
})
}
private fun updateScreenToUpdate() {
setButtonText(getString(R.string.edit))
setPageTitle(getString(R.string.edit_book))
}
private fun updateScreenToSave() {
setPageTitle(getString(R.string.register_book))
setButtonText(getString(R.string.save))
}
private fun setButtonText(text: String) {
binding.persistButton.text = text
}
private fun setPageTitle(title: String) {
binding.title.titleTextView.text = title
}
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/repository/util/Constants.kt
package com.android.ewerton.booksonthetable.repository.util
const val USER_UID = "USER_UID"<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/user_home/adapter/BookItemAdapter.kt
package com.android.ewerton.booksonthetable.ui.activity.internal.user_home.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.navigation.findNavController
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.android.ewerton.booksonthetable.databinding.BookItemBinding
import com.android.ewerton.booksonthetable.model.Book
import com.android.ewerton.booksonthetable.ui.activity.internal.user_home.UserHomeFragmentDirections
class BookItemAdapter :
ListAdapter<Book, BookItemAdapter.BookItemViewHolder>(BookItemDiffCallback()) {
inner class BookItemViewHolder(val binding: BookItemBinding) :
RecyclerView.ViewHolder(binding.root)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = BookItemViewHolder(
BookItemBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
override fun onBindViewHolder(holder: BookItemViewHolder, position: Int) {
val book = getItem(position)
holder.binding.book = book
holder.binding.bookCard.setOnClickListener {
holder.binding.root.findNavController()
.navigate(UserHomeFragmentDirections.actionUserHomeFragmentToViewBookFragment(book))
}
}
}
class BookItemDiffCallback : DiffUtil.ItemCallback<Book>() {
override fun areItemsTheSame(oldItem: Book, newItem: Book) = newItem.id == oldItem.id
override fun areContentsTheSame(oldItem: Book, newItem: Book) = newItem == oldItem
}<file_sep>/app/src/main/java/com/android/ewerton/booksonthetable/ui/activity/internal/InternalNavHostActivity.kt
package com.android.ewerton.booksonthetable.ui.activity.internal
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.android.ewerton.booksonthetable.R
class InternalNavHostActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_internal_nav_host)
}
} | 0cba78b29af5a388e7ed0eb55814c87297f46959 | [
"Kotlin"
] | 36 | Kotlin | EwertonProg/BooksOntheTable | 7339099346e682bae3410a8bfdafd87b91b37743 | 683dc6d13c9539541820063a68062c11480553e8 |
refs/heads/master | <file_sep>import React, { Component } from 'react';
import "../testResults/testResults.css"
class TestResults extends Component {
calculateGrade = () => {
let correctAnswerCounter = 0
for ( let i = 0 ; i < this.props.questions.length ; i ++ ){
const userAnswer = this.getUserAnswer(i)
if (this.props.questions[i].correct == userAnswer.userSelectedOption_id )
correctAnswerCounter ++
}
return correctAnswerCounter
}
getUserAnswer = q_id => {
for ( let i = 0 ; i < this.props.userAnswers.length ; i ++ )
if ( this.props.userAnswers[i].q_id === q_id)
return this.props.userAnswers[i]
}
renderResults = correctAnswers => {
return (
<div>
You answered {correctAnswers} out of {this.props.userAnswers.length}!
</div>
)
}
render() {
const correctAnswers = this.calculateGrade()
return (
<div className="results">
{this.renderResults(correctAnswers)}
</div>
)
}
}
export default TestResults;<file_sep>import React, { Component } from 'react';
import "./question.css"
class Question extends Component {
renderQuestion = () => {
return (
<div className="title">
{this.props.question.question}
</div>
)
}
setAnswer(event) {
let chosenAnswer_id = event.target.value
this.props.assignChosenAnswer(this.props.question.questionID, chosenAnswer_id)
}
renderAnswers = () => {
let userAnswerId = this.props.userAnswer === undefined ? -1 : this.props.userAnswer.userSelectedOption_id
return (
<div className="options">
{this.renderInputById(0, userAnswerId)}
{this.renderInputById(1, userAnswerId)}
{this.renderInputById(2, userAnswerId)}
{this.renderInputById(3, userAnswerId)}
</div>
)
}
// id - question_option_id | a_id - userAnswer_id
renderInputById = (id, a_id) => {
const answers = this.props.question.answers
return (
<div>
<input type="radio" key={id} value={id} name="answer" onChange={event => this.setAnswer(event)} checked={id == a_id} /> {answers[id].text} <br />
</div>
)
}
render() {
return (
<div className="question">
{this.renderQuestion()}
{this.renderAnswers()}
</div>
)
}
}
export default Question;<file_sep>import React, { Component } from 'react';
import Question from '../question/Question';
import TestResults from '../testResults/TestResults';
import "./test.css"
const questions = require('../../utils/questions.json')
const LIMIT = questions.length
class Test extends Component {
constructor() {
super()
this.state = {
curQuestionID: 0,
curQuestion: questions[0],
userAnswers: [],
// ^ for example:
// [{q_id: 0, userSelectedOption_id: 3} ,
// {q_id: 1, userSelectedOption_id: 2} ]
isFinished: false
}
}
nextQuestion = () => {
this.setState({
curQuestionID: this.state.curQuestionID + 1
})
}
prevQuestion = () => {
this.setState({
curQuestionID: this.state.curQuestionID - 1
})
}
renderTestResultComponent = () => {
this.setState({
isFinished: true
})
}
getCurrentQuestionByID = () => questions.filter(q => q.questionID === this.state.curQuestionID)[0]
assignChosenAnswer = async (q_id, userSelectedOption_id) => {
const userAnswer = { q_id, userSelectedOption_id }
const userAnswers = this.state.userAnswers
if (this.answerExist(userAnswer))
this.updateExistingAnswer(userAnswer)
else {
userAnswers.push(userAnswer)
await this.setState({ userAnswers })
}
}
updateExistingAnswer = async userAnswer => {
let userAnswers = this.state.userAnswers
for (let i = 0; i < userAnswers.length; i++)
if (userAnswers[i].q_id === userAnswer.q_id)
userAnswers[i].userSelectedOption_id = userAnswer.userSelectedOption_id
this.setState({ userAnswers })
}
answerExist = (userAnswer) => this.state.userAnswers.some(ua => ua.q_id === userAnswer.q_id)
getUserAnswer = (q_id) => {
let userAnswer = undefined
for (let i = 0; i < this.state.userAnswers.length; i++) {
if (this.state.userAnswers[i].q_id == q_id)
userAnswer = this.state.userAnswers[i]
}
return userAnswer
}
renderQuestions = () => <Question
question={this.getCurrentQuestionByID()}
userAnswer={this.getUserAnswer(this.state.curQuestionID)}
prevQuestion={this.prevQuestion}
nextQuestion={this.nextQuestion}
assignChosenAnswer={this.assignChosenAnswer}
/>
renderTestResults = () => <TestResults userAnswers={this.state.userAnswers} questions={questions} />
checkIfUserChose = () => this.getUserAnswer(this.state.curQuestionID) === undefined ? true : false
renderControls = () => {
return (
<div className="controls">
{/* render prev or not */}
{this.state.curQuestionID !== 0 ?
<button onClick={this.prevQuestion} className="prev-btn">PREV</button>
:
null}
{/* render finish or next */}
{this.state.curQuestionID === LIMIT -1 ?
// <button onClick={this.renderTestResultComponent} hidden={this.checkIfUserChose()} className="finish-btn">FINISH</button>
<button hidden={this.checkIfUserChose()} onClick={(e) => { if (window.confirm('Are u sure ?')) this.renderTestResultComponent() }} className="finish-btn">FINISH</button>
:
<button onClick={this.nextQuestion} hidden={this.checkIfUserChose()} className="next-btn">NEXT</button>}
</div>
)
}
// <button onClick={(e) => { if (window.confirm('Are item?')) this.deleteItem(e) }}>Delete</button>
renderQuestionsAndControls = () => {
return (
<div className="test">
{this.renderQuestions()}
{this.renderControls()}
</div>
)
}
render() {
return (
<div>
{
this.state.isFinished
?
this.renderTestResults()
:
this.renderQuestionsAndControls()
}
</div>
)
}
}
export default Test; | 567489096ed8af73ab1671cde5a2751c441d9f54 | [
"JavaScript"
] | 3 | JavaScript | vy1406/AwesomeQuiz | bb4f3ab94934cbc013d3b29bda6111068833b2c3 | 2d8f575dfa5ad0290e1087c2076f8faa3e85abdd |
refs/heads/master | <file_sep>#Assessing prior knowledge for the SNPs that were replicated
#---The idea is to make a comparison between prior knowledge of the SNPs detected
#---The standard analysis and the baysian method
#---02Nov2017
library(BhGLM)
library(data.table)
library(ggplot2)
#Working directory
setwd('/Users/miguelmspereira/Box Sync/Congenica/scripts/')
#Top 50,000 SNPs from the standard SNP analysis
#FVC
fvc.threshold<-read.table('fvctop500000withLDblocks.tsv',header=T,sep='\t')
head(fvc.threshold)
dim(fvc.threshold)
length(unique(fvc.threshold$snp))
length(unique(fvc.threshold$chr))
length(unique(fvc.threshold$LD.block))
#Top 50,000 SNPs from the standard SNP analysis
#Ratio
ratio.threshold<-read.table('ratiotop500000withLDblocks.tsv',header=T,sep='\t')
head(ratio.threshold)
dim(ratio.threshold)
length(unique(ratio.threshold$snp))
length(unique(ratio.threshold$chr))
length(unique(ratio.threshold$LD.block))
###################################################################################
#Subsetting to the top 20.000 SNPs
#FVC
fvc.threshold25<-fvc.threshold[which(fvc.threshold$snp %in% unique(fvc.threshold$snp)[1:20000]),]
length(unique(fvc.threshold25$snp))
dim(fvc.threshold25)
#Ratio
ratio.threshold25<-ratio.threshold[which(ratio.threshold$snp %in% unique(ratio.threshold$snp)[1:20000]),]
length(unique(ratio.threshold25$snp))
dim(ratio.threshold25)
###################################################################################
#Prior knowledge matrix
q.fvc<-read.csv('priorknowledge_fvc.csv')
q.final.fvc<-q.fvc[which(q.fvc$snp %in% fvc.threshold25$snp),]
head(q.final.fvc)
table(q.final.fvc$qSum) #Prior knowledge distribution
q.ratio<-read.csv('/Users/miguelmspereira/Desktop/lungdevprior/ratio_dosages/priorknowledge/priorknowledge_ratio.csv')
q.final.ratio<-q.ratio[which(q.ratio$snp %in% ratio.threshold25$snp),]
head(q.final.ratio)
table(q.final.ratio$qSum) #Prior knowledge distribution
length(intersect(q.final.fvc$snp,q.final.ratio$snp)) #3700 SNPs intersection (18.5% intersection)
###################################################################################
#Results - to get the replicated SNPs
fvc.standard<-read.csv('fvc standard results with eaf.csv',header=T, stringsAsFactors = F)
fvc.bayes<-read.csv('fvc bayes results with eaf.csv',header=T, stringsAsFactors = F)
ratio.standard<-read.csv('ratio standard results with eaf.csv',header=T, stringsAsFactors = F)
ratio.bayes<-read.csv('ratio bayes results with eaf.csv',header=T, stringsAsFactors = F)
#List of known signals - to remove the LD blocks in common
fvc.known<-read.csv('fvc known signals.txt',header=T,stringsAsFactors = F,sep='\t')
head(fvc.known)
ratio.known<-read.table('ratio known signals.txt',header=T,stringsAsFactors = F,sep='\t')
head(ratio.known)
#Remove known LD blocks - Ratio
intersect(fvc.standard$LD.block,fvc.known$LD.Block) #just a little check
intersect(fvc.bayes$LD.block,fvc.known$LD.Block) #just a little check
intersect(ratio.standard$LD.block,ratio.known$LD.Block)
intersect(ratio.bayes$LD.block,ratio.known$LD.Block)
ratio.standard2<-ratio.standard[-which(ratio.standard$LD.block %in% intersect(ratio.standard$LD.block,ratio.known$LD.Block)),]
ratio.bayes2<-ratio.bayes[-which(ratio.bayes$LD.block %in% intersect(ratio.bayes$LD.block,ratio.known$LD.Block)),]
#Top 100 signlas for FVC and top 400 signals for FEV1/FVC - number of signals taken to replication according to the power calculations
fvc.standard100<-fvc.standard[1:100,]
fvc.bayes100<-fvc.bayes[1:100,]
ratio.standard400<-ratio.standard2[1:393,]
ratio.bayes400<-ratio.bayes2[1:400,]
#Replicated signals matrices
fvc.standard.replicated<-fvc.standard100[which(fvc.standard100$meta.pval<(0.05/100)),]
fvc.bayes.replicated<-fvc.bayes100[which(fvc.bayes100$meta.pval<(0.05/100)),]
ratio.standard.replicated<-ratio.standard400[which(ratio.standard400$meta.pval<(0.05/393)),]
ratio.bayes.replicated<-ratio.bayes400[which(ratio.bayes400$meta.pval<(0.05/400)),]
#Combined matrices
fvc.comb.gene.0<-rbind(fvc.standard[1:100,],fvc.bayes[1:100,-c(10,11,32,33)])
fvc.comb.gene.1<-fvc.comb.gene.0[-which(duplicated(fvc.comb.gene.0$snp)),]
fvc.comb.gene.2<-fvc.comb.gene.1[order(fvc.comb.gene.1$p.val),][1:100,]
fvc.comb.gene.3<-fvc.comb.gene.2[which(fvc.comb.gene.2$meta.pval[1:100]<(0.05/(100))),]
dim(fvc.comb.gene.3) #32 SNPs
length(unique(fvc.comb.gene.3$gene1)) #19 genes
ratio.comb.gene.0<-rbind(ratio.standard2[1:393,],ratio.bayes2[1:400,-c(10,11,32,33)])
ratio.comb.gene.1<-ratio.comb.gene.0[-which(duplicated(ratio.comb.gene.0$snp)),]
ratio.comb.gene.2<-ratio.comb.gene.1[order(ratio.comb.gene.1$p.val),][1:400,]
ratio.comb.gene.3<-ratio.comb.gene.2[which(ratio.comb.gene.2$meta.pval[1:400]<(0.05/(400))),]
dim(ratio.comb.gene.3) #36 SNPs
length(unique(ratio.comb.gene.3$gene1)) #20 genes
#All genes
unique(fvc.standard$gene1[which(fvc.standard$meta.pval[1:100]<(0.05/(100)))])
gene.list<-list()
gene.list$fvc.standard<-unique(fvc.standard.replicated$gene1)
gene.list$fvc.bayes<-unique(fvc.bayes.replicated$gene1)
gene.list$fvc.combined<-unique(fvc.comb.gene.3$gene1)
gene.list$ratio.standard<-unique(ratio.standard.replicated$gene1)
gene.list$ratio.bayes<-unique(ratio.bayes.replicated$gene1)
gene.list$ratio.combined<-unique(ratio.comb.gene.3$gene1)
str(gene.list)
#Prior knowledge of the replicated SNPs
q.fvc.standard<-q.final.fvc[which(q.final.fvc$snp %in% fvc.standard.replicated$snp),]
q.fvc.bayes<-q.final.fvc[which(q.final.fvc$snp %in% fvc.bayes.replicated$snp),]
q.fvc.comb<-q.final.fvc[which(q.final.fvc$snp %in% fvc.comb.gene.3$snp),]
q.ratio.standard<-q.final.ratio[which(q.final.ratio$snp %in% ratio.standard.replicated$snp),]
q.ratio.bayes<-q.final.ratio[which(q.final.ratio$snp %in% ratio.bayes.replicated$snp),]
q.ratio.comb<-q.final.ratio[which(q.final.ratio$snp %in% ratio.comb.gene.3$snp),]
#p-values of replicated SNPs and scores
q.pval.fvc.standard<-merge(fvc.standard.replicated[,c(1,4,12)],q.final.fvc,by='snp')
q.pval.fvc.bayes<-merge(fvc.bayes.replicated[,c(1,4,14)],q.final.fvc,by='snp')
q.pval.fvc.comb<-merge(fvc.comb.gene.3[,c(1,4,12)],q.final.fvc,by='snp')
q.pval.ratio.standard<-merge(ratio.standard.replicated[,c(1,4,12)],q.final.ratio,by='snp')
q.pval.ratio.bayes<-merge(ratio.bayes.replicated[,c(1,4,14)],q.final.ratio,by='snp')
q.pval.ratio.comb<-merge(ratio.comb.gene.3[,c(1,4,12)],q.final.ratio,by='snp')
q.pval.fvc.all<-merge(fvc.threshold25[-which(duplicated(fvc.threshold25$snp)),c(1,16,11)],q.final.fvc,by='snp')
q.pval.ratio.all<-merge(ratio.threshold25[-which(duplicated(ratio.threshold25$snp)),c(1,16,11)],q.final.ratio,by='snp',all.x = F)
#Box plot p-values by score
#FVC
q.pval.data.fvc<-as.data.frame(cbind(
c(rep('Standard Analysis',times=nrow(q.pval.fvc.standard)),rep('Bayesian Analysis',times=nrow(q.pval.fvc.bayes)),rep('Combined Analysis',times=nrow(q.pval.fvc.comb)),rep('All SNPs',times=20000)),
c(q.pval.fvc.standard$p.val,q.pval.fvc.bayes$p.val,q.pval.fvc.comb$p.val,q.pval.fvc.all$p.val),
c(q.pval.fvc.standard$qSum,q.pval.fvc.bayes$qSum,q.pval.fvc.comb$qSum,q.pval.fvc.all$qSum)
))
colnames(q.pval.data.fvc)<-c('analysis','p.value','score')
q.pval.data.fvc$analysis<-factor(q.pval.data.fvc$analysis,levels=c('Standard Analysis','Bayesian Analysis','Combined Analysis','All SNPs'))
q.pval.data.fvc$p.value<--log10(as.numeric(as.character(q.pval.data.fvc$p.value)))
q.pval.data.fvc$score<-as.factor(q.pval.data.fvc$score)
ggplot(q.pval.data.fvc,aes(x=score,y=p.value))+
geom_boxplot()+
labs(x='Score', y='-log P',title='FVC - Only replicated SNPs')+
facet_grid(. ~ analysis)+
theme_bw()+
theme(legend.position='none',panel.grid.minor = element_blank())+
scale_y_continuous(limits=c(0,12),breaks=seq(2,12,2))
#FEV1/FVC
q.pval.data.ratio<-as.data.frame(cbind(
c(rep('Standard Analysis',times=nrow(q.pval.ratio.standard)),rep('Bayesian Analysis',times=nrow(q.pval.ratio.bayes)),rep('Combined Analysis',times=nrow(q.pval.ratio.comb)),rep('All SNPs',times=20000)),
c(q.pval.ratio.standard$p.val,q.pval.ratio.bayes$p.val,q.pval.ratio.comb$p.val,q.pval.ratio.all$p.val),
c(q.pval.ratio.standard$qSum,q.pval.ratio.bayes$qSum,q.pval.ratio.comb$qSum,q.pval.ratio.all$qSum)
))
colnames(q.pval.data.ratio)<-c('analysis','p.value','score')
q.pval.data.ratio$analysis<-factor(q.pval.data.ratio$analysis,levels=c('Standard Analysis','Bayesian Analysis','Combined Analysis','All SNPs'))
q.pval.data.ratio$p.value<--log10(as.numeric(as.character(q.pval.data.ratio$p.value)))
q.pval.data.ratio$score<-as.factor(q.pval.data.ratio$score)
ggplot(q.pval.data.ratio,aes(x=score,y=p.value))+
geom_boxplot()+
labs(x='Score', y='-log P',title='FEV1/FVC - Only replicated SNPs')+
facet_grid(. ~ analysis)+
theme_bw()+
theme(legend.position='none',panel.grid.minor = element_blank())+
scale_y_continuous(limits=c(0,12),breaks=seq(2,12,2))
#Box plot p-values by question
#FVC
colnames(q.pval.fvc.standard)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
colnames(q.pval.fvc.bayes)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
colnames(q.pval.fvc.comb)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
colnames(q.pval.fvc.all)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
boxplot.fvc.standard<-melt(q.pval.fvc.standard[,c(3:13)],id.vars='p.val')
boxplot.fvc.bayes<-melt(q.pval.fvc.bayes[,c(3:13)],id.vars='p.val')
boxplot.fvc.comb<-melt(q.pval.fvc.comb[,c(3:13)],id.vars='p.val')
boxplot.fvc.all<-melt(q.pval.fvc.all[,c(3:13)],id.vars='p.val')
######################################
qSum.pval.data.fvc<-as.data.frame(
cbind(c(rep('Standard Analysis',times=nrow(boxplot.fvc.standard)),rep('Bayesian Analysis',times=nrow(boxplot.fvc.bayes)),rep('Combined Analysis',times=nrow(boxplot.fvc.comb)),rep('All SNPs',times=nrow(boxplot.fvc.all))),
rbind(
boxplot.fvc.standard,
boxplot.fvc.bayes,
boxplot.fvc.comb,
boxplot.fvc.all
)))
colnames(qSum.pval.data.fvc)[1]<-'analysis'
qSum.pval.data.fvc$analysis<-factor(qSum.pval.data.fvc$analysis,levels=c('Standard Analysis','Bayesian Analysis','Combined Analysis','All SNPs'))
qSum.pval.data.fvc$p.val.log<--log10(qSum.pval.data.fvc$p.val)
qSum.pval.data.fvc$value2<-factor(qSum.pval.data.fvc$value,levels=c('0','1'))
######################################
#Without the 20.000 SNPs
qSum.pval.data.fvc<-as.data.frame(
cbind(c(rep('Standard Analysis',times=nrow(boxplot.fvc.standard)),rep('Bayesian Analysis',times=nrow(boxplot.fvc.bayes)),rep('Combined Analysis',times=nrow(boxplot.fvc.comb))),
rbind(
boxplot.fvc.standard,
boxplot.fvc.bayes,
boxplot.fvc.comb
)))
colnames(qSum.pval.data.fvc)[1]<-'analysis'
qSum.pval.data.fvc$analysis<-factor(qSum.pval.data.fvc$analysis,levels=c('Standard Analysis','Bayesian Analysis','Combined Analysis'))
qSum.pval.data.fvc$p.val.log<--log10(qSum.pval.data.fvc$p.val)
qSum.pval.data.fvc$value2<-factor(qSum.pval.data.fvc$value,levels=c('0','1'))
class(qSum.pval.data.fvc$variable)
######################################
ggplot(qSum.pval.data.fvc,aes(x=value2,y=p.val.log,fill=analysis))+
geom_boxplot()+
facet_wrap(~variable,ncol=5,nrow=2)+
labs(x='Score', y='-log P',title='FVC - Only replicated SNPs')+
theme_bw()+
theme(panel.grid.minor = element_blank(),legend.title = element_blank())+
scale_y_continuous(limits=c(0,12),breaks=seq(2,12,2))
#ggplot(qSum.pval.data.fvc,aes(x=0,y=p.val.log,fill=analysis))+
# geom_boxplot()+
# facet_grid(variable~value2)
#ggplot(qSum.pval.data.fvc,aes(x=0,y=p.val.log,fill=analysis))+
# geom_boxplot()+
# facet_wrap(value2~variable)
#FEV1/FVC
colnames(q.pval.ratio.standard)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
colnames(q.pval.ratio.bayes)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
colnames(q.pval.ratio.comb)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
colnames(q.pval.ratio.all)[4:13]<-c('Q1','Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10')
boxplot.ratio.standard<-melt(q.pval.ratio.standard[,c(3:13)],id.vars='p.val')
boxplot.ratio.bayes<-melt(q.pval.ratio.bayes[,c(3:13)],id.vars='p.val')
boxplot.ratio.comb<-melt(q.pval.ratio.comb[,c(3:13)],id.vars='p.val')
boxplot.ratio.all<-melt(q.pval.ratio.all[,c(3:13)],id.vars='p.val')
######################################
qSum.pval.data.ratio<-as.data.frame(
cbind(c(rep('Standard Analysis',times=nrow(boxplot.ratio.standard)),rep('Bayesian Analysis',times=nrow(boxplot.ratio.bayes)),rep('Combined Analysis',times=nrow(boxplot.ratio.comb)),rep('All SNPs',times=nrow(boxplot.ratio.all))),
rbind(
boxplot.ratio.standard,
boxplot.ratio.bayes,
boxplot.ratio.comb,
boxplot.ratio.all
)))
colnames(qSum.pval.data.ratio)[1]<-'analysis'
qSum.pval.data.ratio$analysis<-factor(qSum.pval.data.ratio$analysis,levels=c('Standard Analysis','Bayesian Analysis','Combined Analysis','All SNPs'))
qSum.pval.data.ratio$p.val.log<--log10(qSum.pval.data.ratio$p.val)
qSum.pval.data.ratio$value2<-factor(qSum.pval.data.ratio$value,levels=c('0','1'))
######################################
#Without the 20.000 SNPs
qSum.pval.data.ratio<-as.data.frame(
cbind(c(rep('Standard Analysis',times=nrow(boxplot.ratio.standard)),rep('Bayesian Analysis',times=nrow(boxplot.ratio.bayes)),rep('Combined Analysis',times=nrow(boxplot.ratio.comb))),
rbind(
boxplot.ratio.standard,
boxplot.ratio.bayes,
boxplot.ratio.comb
)))
colnames(qSum.pval.data.ratio)[1]<-'analysis'
qSum.pval.data.ratio$analysis<-factor(qSum.pval.data.ratio$analysis,levels=c('Standard Analysis','Bayesian Analysis','Combined Analysis'))
qSum.pval.data.ratio$p.val.log<--log10(qSum.pval.data.ratio$p.val)
qSum.pval.data.ratio$value2<-factor(qSum.pval.data.ratio$value,levels=c('0','1'))
######################################
ggplot(qSum.pval.data.ratio,aes(x=value2,y=p.val.log,fill=analysis))+
geom_boxplot()+
facet_wrap(~variable,ncol=5,nrow=2)+
labs(x='Score', y='-log P',title='FEV1/FVC - Only replicated SNPs')+
theme_bw()+
theme(panel.grid.minor = element_blank(),legend.title = element_blank())+
scale_y_continuous(limits=c(0,12),breaks=seq(2,12,2))
#ggplot(qSum.pval.data.ratio,aes(x=0,y=p.val.log,fill=analysis))+
# geom_boxplot()+
# facet_grid(variable~value2)
#ggplot(qSum.pval.data.ratio,aes(x=0,y=p.val.log,fill=analysis))+
# geom_boxplot()+
# facet_wrap(value2~variable)
<file_sep># code-examples
This repositories contains 3 scripts with three different examples of code.
1) ukb_dosages_newrelease.R is uses a .gen file generated using QCTOOL from a UK Biobank .bgen file. The file contains genotype data from a subset of SNPs from the UK Biobank dataset. The data matrix has SNPs in the rows and subjects in the columns and there are 3 columns per subject. This script efficiently converts the three columns to one column of dosage data and transposes the data matrix in order to obtain a final matrix with subject IDs in the row and SNP RSID's in the columns. This is saved to a .RData file (there is also an option to save to a .csv file).
Data files used by this script:
- ukb1913_imp_chr1_v2_s487398.sample - template sample file with the subject IDs. These are in the same order as the subjects in the columns of the subset.gen file (which does not contain meaningful column names). The subject IDs will be used as the ID column in the final output matrix
- subset.gen
--------------------------------------------------------------------------------------------------------------------------------------
2) rank and var ratios - empirical.R - this script processes and prepares genotype data from the ECRHS dataset to be analysed and performs the standard statistical analysis (with and without adjusting for other covariates) and a bayesian joint model with and without the inclusion of prior bioligical knowledge. Prior biological knowledge corresponds a set of 10 binary questions (0=No, 1=Yes) about biological characteristics of the SNPs.
The Bayesian approach corresponds to a Bayesian joint shrinkage model similar to Bayesian ridge regression and biological information informs the shrinkage applied to each of the SNPs. The model itself was implemented in the BhGLM package developed by Yi and Ma 2011 (available to donwload in the BhGLM repository in my github account). Details on how prior knowledge was incorporated in the Bayesian model thought modulation of shrinkage and the concept of the variance ratio can be found in the following paper: Pereira et al. Genetic Epidemioloy 2017.
The output of the analyses is the rank of the LD block of the best SNPs ranked according to their frequentist or Bayesian p-values, respectively. At the beggining of the script there are some processing steps assigning the SNPs to groups according to their LD blocks. This is important and the rationale of the approach is to identify small genomic regions that contain the causal SNP.
Data files used by this script:
- fulldata.csv - phenotype and genotype data. Contains height and weight (used to calculate bmi in the script) and other variables which were adjusted for in the analyses. Also contains the dosage data for the SNPs used in this analyses.
- priorAnswers.csv - matrix of prior knowledge. Contains the binary answers to each prior knowledge question. It is used to calculate a prior knowledge score. There are three alternatives in the script corresponding to a simple sum of the score in each question (object qSum in the code) and two others where each question has a different weight (weighted Sum). These are commented out in the current script.
- snp6_24_ldblock.csv - Informaiton about the SNP (e.g. Chr and position) and allocation to LD blocks
--------------------------------------------------------------------------------------------------------------------------------------
3) ggplot example (data vizualization) - analysis of prior knowledge.R processes data of SNP prior knowledge data from the top hits of 2 different analyses of the UK Biobank data in the context of a genetic association study on lung function (outcome measures: FVC and the ratio FEV1/FVC). For each outcome, there is the standard statistical analysis (called "standard" in the script), where each SNP was analysed separately, and a bayesian joint model where prior biological knowledge about the SNPs was included in the analysis (called "bayes" in the script). Prior biological knowledge consisted of a set of 10 binary questions (0=No, 1=Yes) about biological characteristics of the SNPs. The purpose of this script was to build several plots to:
- compare the distribution of prior biological knowledge across the two types of analyses
- study the distribution of prior biological knowledge per question
- check which prior knowledge questions have more replicated hits
- compare the different performance of the model between the two outcomes: FVC and ratio FEV1/FVC
Data files used by this script:
- fvctop500000withLDblocks.tsv - top 50,000 hits from the standard analysis, outcome: FVC
- ratiotop500000withLDblocks.tsv - top 50,000 hits from the standard analysis, outcome: ratio FEV1/FVC
- priorknowledge_fvc.csv - matrix of prior knowledge for FVC
- priorknowledge_ratio.csv - matrix of prior knowledge for the ratio FEV1/FVC
- fvc standard results with eaf.csv - top hits for the standard analysis, outcome: FVC
- fvc bayes results with eaf.csv - top hits for the bayesian analysis, outcome: FVC
- ratio standard results with eaf.csv - top hits for the standard analysis, outcome: ratio FEV1/FVC
- ratio bayes results with eaf.csv - top hits for the bayesian analysis, outcome: ratio FEV1/FVC
<file_sep>#Data from 6 true SNPs associated with BMI and 24 random SNPs from the ECRHS imputed dataset + all the SNPs in the same LD blocks with them (2,839 unique SNPs from 30 LD blocks)
#This Script joins the data with the phenotype data from ECRHS and does the analysis of the data
#Revised for thesis on 15Dec2017
#Working directory
setwd('/Users/miguelmspereira/Box Sync/Congenica/scripts/')
#Phenotype data
fulldata0<-read.table('fulldata.csv',header=T,stringsAsFactors=T,sep=',')
fulldata<-fulldata0[,-1]
fulldata[1:10,1:10]
dim(fulldata)
#__________________________________________________________________________________________________________________
#Prior SNP knowledge
prior0<-read.table('priorAnswers.csv', header=T, stringsAsFactors=F, sep=',')
prior<-prior0[,-1]
dim(prior) #2,614 SNPs
head(prior)
#__________________________________________________________________________________________________________________
#LD block data
ldblock0<-read.table('snp6_24_ldblock.csv',header=T,stringsAsFactors=F,sep=',')
ldblock<-ldblock0[,-1]
head(ldblock)
dim(ldblock) #2,866 - includes duplicated SNPs
#LD block matrix without duplicate SNPs (it is important to do this because some SNPs will have more than one Alt.Allele)
length(which(duplicated(ldblock$snp)==F)) #number of SNPs that are not duplicated
ldblockDup<-ldblock[-which(duplicated(ldblock$snp)),]
dim(ldblockDup)
head(ldblockDup$coords)
#__________________________________________________________________________________________________________________
#Split genomic coordinates to sort data
coord.list<-strsplit(ldblockDup$coords,split=':')
head(coord.list)
#Splitting SNP coordinates for ordering
posSplit<-unlist(strsplit(ldblockDup[,2],split=':'))
chr<-seq(from=2,to=length(posSplit),by=3) #Gets the chr
snpPos<-seq(from=3,to=length(posSplit),by=3) #Gets the SNP position
#Final LD block matrix with sorted SNPs (by Chromossome and Genomic coordinate)
ldblock.final0<-cbind(ldblockDup$snp,ldblockDup$coords,ldblockDup$ldblock,posSplit[chr],posSplit[snpPos],ldblockDup$refAll,ldblockDup$altAll)
colnames(ldblock.final0)<-c('snp','coords','ldblock','chr','position','Ref','Alt')
head(ldblock.final0)
#ORDERING the SNPs by chr and position
ldblock.final<-ldblock.final0[order(as.numeric(ldblock.final0[,4]),as.numeric(ldblock.final0[,5])),]
head(ldblock.final)
unique(ldblock.final[,4]) #checks that the chromossomes are in the correct order
#Assigning a number to each LDblock - index facilitate operations
ind<-seq(from=1,to=length(unique(ldblock.final[,3])))
ind.ldblock<-cbind(ind,unique(ldblock.final[,3]))
ind.ldblock
#Matching LD block vector with the assigned numbers
index.ldblock<-rep(99,times=nrow(ldblock.final))
for(i in 1:nrow(ldblock.final)){
index.ldblock[i]<-as.numeric(ind.ldblock[which(ind.ldblock[,2]==ldblock.final[i,3]),1])
}
index.ldblock
#Joining the index to the matrix
ldblock.final1<-cbind(ldblock.final,index.ldblock)
head(ldblock.final1)
#Subseting the matrix to only the SNPs with prior knowledge n=2,614
ldblock.final2<-ldblock.final1[which(ldblock.final1[,1] %in% prior$X.1),]
dim(ldblock.final2)
head(ldblock.final2)
#__________________________________________________________________________________________________________________
#Reordering columns in the data
orderedSnp<-ldblock.final2[,1]
head(orderedSnp)
which(match(colnames(fulldata),orderedSnp)!='NA')
sortedData<-cbind(fulldata[,1:15],fulldata[orderedSnp])
colnames(fulldata[,1:15])
head(colnames(fulldata[orderedSnp]))
#__________________________________________________________________________________________________________________
#Calculating BMI - outcome measure
bmi<-sortedData$weight/(sortedData$height^2)
hist(bmi)
summary(bmi)
bmidata0<-cbind(bmi,sortedData)
bmidata0[1:10,1:20]
#__________________________________________________________________________________________________________________
#Standardizing the data
bmidata<-as.data.frame(scale(bmidata0))
attach(bmidata)
colnames(bmidata)[16:30] #check to see if RSID's are OK and start where they are supposed to
bmidata[1:10,1:10] #quick look at the data
summary(bmidata$PC4) #To check if it is standardized
#__________________________________________________________________________________________________________________
#Linear regression results (output matrix does not include information regarding centre)
#Standard analysis - Performs linear regression to estimate single SNP effects and adjusts the for the covariates of interest
#Output matrix
output<-data.frame(matrix(nrow=nrow(ldblock.final2),ncol=23))
colnames(output)<-c('snp','group','MAF','ref.allele','alt.allele','snp.beta','snp.ste','snp.pval','age','age.ste','age.pval','sex','sex.ste','sex.pval','pc1','pc1.ste','pc1.pval','pc2','pc2.ste','pc2.pval','pc3','pc3.ste','pc3.pval')
head(output)
output$snp<-orderedSnp
output$group<-ldblock.final2[,8]
output$MAF<-snpinfo$MAF
output$ref.allele<-ldblock.final2[,6]
output$alt.allele<-ldblock.final2[,7]
for(i in 1:nrow(output)){
#SNP
output[i,6]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[2,1]
output[i,7]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[2,2]
output[i,8]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[2,4]
#age
output[i,9]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[3,1]
output[i,10]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[3,2]
output[i,11]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[3,4]
#Sex
output[i,12]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[4,1]
output[i,13]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[4,2]
output[i,14]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[4,4]
#PC1
output[i,15]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[5,1]
output[i,16]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[5,2]
output[i,17]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[5,4]
#PC2
output[i,18]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[6,1]
output[i,19]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[6,2]
output[i,20]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[6,4]
#PC3
output[i,21]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[7,1]
output[i,22]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[7,2]
output[i,23]<-coef(summary(lm(bmi~bmidata[,16+i]+age+sex.x+PC1+PC2+PC3+as.character(centre))))[7,4]
}
head(output)
#Writes the output to file
write.csv(output,'classical analysis ecrhs (standardized).csv')
#__________________________________________________________________________________________________________________
#Standard analysis without covariates
output.noCovar<-data.frame(matrix(nrow=nrow(ldblock.final2),ncol=8))
colnames(output.noCovar)<-c('snp','group','MAF','ref.allele','alt.allele','snp.beta','snp.ste','snp.pval')
head(output.noCovar)
output.noCovar$snp<-orderedSnp
output.noCovar$group<-ldblock.final2[,8]
output.noCovar$MAF<-snpinfo$MAF
output.noCovar$ref.allele<-ldblock.final2[,6]
output.noCovar$alt.allele<-ldblock.final2[,7]
for(i in 1:nrow(output.noCovar)){
#SNP
output.noCovar[i,6]<-coef(summary(lm(bmi~bmidata[,16+i])))[2,1]
output.noCovar[i,7]<-coef(summary(lm(bmi~bmidata[,16+i])))[2,2]
output.noCovar[i,8]<-coef(summary(lm(bmi~bmidata[,16+i])))[2,4]
}
head(output)
head(output.noCovar)
#Writes the output to file
write.csv(output.noCovar,'classical analysis ecrhs no covariates (only SNPs and standardized).csv')
#---------------------------------------------------
#Average ranking of the true LD blocks
#__________________
#Support function to get the standard error
std <- function(x) sd(x)/sqrt(length(x))
#__________________
order.output.noCovar<-output.noCovar[order(output.noCovar$snp.pval),]
head(order.output.noCovar)
order.ldblock.classical<-as.numeric(unique(order.output.noCovar$group))
order.ldblock.classical
#Average ranking of the true LD blocks (no covariates)
rank.classical<-mean(which(order.ldblock.classical %in% c(17,19,24,25,28,29)))
rank.classical.sd<-std(which(order.ldblock.classical %in% c(17,19,24,25,28,29)))
#Average ranking of the true LD blocks (WITH covariates)
order.ldblock.classical.withCovar<-as.numeric(unique(output[order(output$snp.pval),2]))
rank.classical.withCovar<-mean(which(order.ldblock.classical.withCovar %in% c(17,19,24,25,28,29)))
rank.classical.withCovar.sd<-std(which(order.ldblock.classical.withCovar %in% c(17,19,24,25,28,29)))
#----------------------------------------------------------------------------------
#Calculating the prior knowledge score - qSum
head(prior)
dim(prior)
qSum<-rowSums(prior[,2:11])
for(i in 1:length(qSum)){
if(qSum[i]>4) qSum[i]=4
}
table(qSum)
#With weights - optional
#prior2<-data.frame(cbind(1.4*prior$q1,4*prior$q2,7.7*prior$q3,9.6*prior$q4,1.2*prior$q5,2.4*prior$q6,5.7*prior$q7,9.5*prior$q12,3.4*prior$q13,2.5*prior$q15))
#head(prior2)
#prior3<-data.frame(cbind(log(1.4)*prior$q1,log(4)*prior$q2,log(7.7)*prior$q3,log(9.6)*prior$q4,log(1.2)*prior$q5,log(2.4)*prior$q6,log(5.7)*prior$q7,log(9.5)*prior$q12,log(3.4)*prior$q13,log(2.5)*prior$q15))
#qSum<-rowSums(prior3)
#table(qSum)
#----------------------------------------------------------------------------------
#Bayesian modelling using bglm() - Yi et al. 2011
library(BhGLM) #This can be download from my github account
bmidata.bglm<-bmidata[,-(2:16)]
#Genotype data (uses function round() because other functions in the BhGLM package do not accept 'dosage' data)
geno<-round(bmidata0[,17:ncol(bmidata0)])
geno[1:10,1:10]
head(colnames(geno))
#Allele frequencies - check the genotypes frequencies
freq<-geno.freq(geno,verbose=F)
#Design matrix for the SNPs (the function make.main() transforms the matrix appropriatelly for bglm())
x.m<-make.main(geno=geno,model='additive')
x.m[1:10,1:10]
#-----------------
identical(colnames(bmidata.bglm)[-1],prior[,1]) #little check
#-----------------
#Groups
groups<-list()
for (i in 1:max(index.ldblock)){
groups[[i]]<-ldblock.final2[which(as.numeric(ldblock.final2[,8])==i),1]
}
str(groups)
ldblock.groupCorrespondence<-cbind(ldblock.final1[-which(duplicated(ldblock.final1[,8])),3],paste('G',unique(ldblock.final1[,8]),sep=''))
ldblock.groupCorrespondence
#---------------------------------------------------------------------------------------
#No inclusion of prior knowledge
#Shrinkage values to be tested
sca<-c(100000,10000,5,2.5,1,0.5,0.1,0.01,0.001,0.0001,0.00001,0.000001) #shrinkage parameters to be tested
rank.all<-cbind(sca,rep(99,times=length(sca)))
empirical.effects<-c(99,99)
empirical.effects0<-c(99,99)
ptm <- proc.time() #to get a time estimate
for(i in 1:length(sca)){
mod1<-bglm(bmi ~ ., data=bmidata.bglm, family = gaussian, prior = "t", prior.mean=0, mean.update=F,prior.scale = sca[i], scale.update=F, group=groups,verbose=T)
prov.output<-matrix(, nrow = nrow(ldblock.final2), ncol = 0)
prov.output<-cbind(coef(summary.bglm(mod1))[-1,4],as.numeric(ldblock.final2[,8]))
#head(prov.output)
prov.orderedOutput<-prov.output[order(prov.output[,1]),]
prov.singleOutput<-unique(prov.orderedOutput[,2])
rank<-mean(which(prov.singleOutput %in% c(17,19,24,25,28,29)))
rank.all[i,2]<-rank
#Output with effect size and block (top 6 blocks)
new.output<-cbind(coef(summary.bglm(mod1))[-1,c(1,4)],as.numeric(ldblock.final2[,8]),qSum)
new.orderedOutput<-new.output[order(new.output[,2]),]
new.singleOutput<-new.orderedOutput[-which(duplicated(new.orderedOutput[,3])==T),]
final.matrix<-cbind(new.singleOutput[1:6,1],ldblock.groupCorrespondence[new.singleOutput[1:6,3],1],new.singleOutput[1:6,4],new.singleOutput[1:6,3])
assign((paste("final.matrix.noprior",i,sep='')),final.matrix)
print(sca[i])
##Variance Ratio
#Real blocks
prov.output3<-coef(summary.bglm(mod1))[-1,1] #Estimated effects
sd.true.fg<-sd(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))])
sd.false.fg<-sd(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))])
#Top 6 blocks
top.prov<-cbind(coef(summary.bglm(mod1))[-1,4],as.numeric(ldblock.final2[,8]))
top.prov.orderedOutput<-top.prov[order(top.prov[,1]),]
top<-unique(top.prov.orderedOutput[,2])
sd.true.fg.top<-sd(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% top[1:6])])
sd.false.fg.top<-sd(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% top[1:6])])
empirical.effects<-rbind(empirical.effects,c((sd.true.fg^2)/((sd.false.fg^2)),(sd.true.fg.top^2)/(sd.false.fg.top^2)))
rownames(empirical.effects)[nrow(empirical.effects)]<-sca[i]
#------------------------------------
#Calculating the variance ratios centered at zero
#Real blocks
sd.true.fg0<-mean(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))]^2)
sd.false.fg0<-mean(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))]^2)
#Top blocks
sd.true.fg.top0<-mean(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% top[1:6])]^2)
sd.false.fg.top0<-mean(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% top[1:6])]^2)
empirical.effects0<-rbind(empirical.effects0,c(sd.true.fg0/sd.false.fg0,sd.true.fg.top0/sd.false.fg.top0))
rownames(empirical.effects0)[nrow(empirical.effects0)]<-sca[i]
}
proc.time() - ptm
empirical.effects
empirical.effects0
var.ratios<-cbind(empirical.effects[,2],empirical.effects[,1],empirical.effects0[,2],empirical.effects0[,1])[-1,]
colnames(var.ratios)<-c("top.blocks","true.blocks","top.blocks at 0","true.blocks at 0")
#Little table with the results
print.xtable(xtable(var.ratios,digits=3), type="html", file="var ratios.html")
#---------------------------------------------------------------------------------
#Adding prior knowledge as differential shrinkage
#shrinkage value to be tested
#S.min corresponds to the absence of prior knowledge
#s.max corresponds to maximum prior knowledge
#Other shrinkage values are interpolated linearly of exponentially in between
s.min<-c(0.01,0.001,0.0001,0.0001,0.0001,0.0001,0.00001,0.00001,0.00001,0.00001,0.00001,0.000001,0.000001,0.000001,0.000001)
s.max<-c(1,1,1,0.1,0.01,0.001,1,0.1,0.01,0.001,0.0001,0.1,0.01,0.001,0.0001)
rank.all.prior<-cbind(s.min,s.max,rep(99,times=length(s.min)))
empirical.effects.prior<-c(99,99)
empirical.effects.prior0<-c(99,99)
ptm <- proc.time()
for(i in 1:length(s.min)){
#Linear interpolation
shrinkValues<-seq(from=s.min[i],to=s.max[i],by=(s.max[i]-s.min[i])/(length(unique(qSum))-1))
#Exponential interpolation
#shrinkValues<-s.min[i]*(exp(log(s.max[i]/s.min[i])/max(qSum)))^(unique(qSum)[order(unique(qSum))])
shrinkValues.index<-unique(qSum)[order(unique(qSum))]
shrinkContinuous.Exp<-rep(99,times=length(qSum))
for(j in 1:length(qSum)){
shrinkContinuous.Exp[j]<-shrinkValues[which(shrinkValues.index==qSum[j])]
}
mod<-bglm(bmi ~ ., data=bmidata.bglm, family = gaussian, prior = "t", prior.mean=0, mean.update=F,prior.scale = shrinkContinuous.Exp, scale.update=F, group=groups,verbose=T)
prov.output<-matrix(, nrow = nrow(ldblock.final2), ncol = 0)
prov.output<-cbind(coef(summary.bglm(mod))[-1,4],as.numeric(ldblock.final2[,8]))
prov.orderedOutput<-prov.output[order(prov.output[,1]),]
prov.singleOutput<-unique(prov.orderedOutput[,2])
rank<-mean(which(prov.singleOutput %in% c(17,19,24,25,28,29)))
rank.all.prior[i,3]<-rank
#Output with effect size and block (top 6 blocks)
new.output<-cbind(coef(summary.bglm(mod))[-1,c(1,4)],as.numeric(ldblock.final2[,8]),qSum)
new.orderedOutput<-new.output[order(new.output[,2]),]
new.singleOutput<-new.orderedOutput[-which(duplicated(new.orderedOutput[,3])==T),]
final.matrix<-cbind(new.singleOutput[1:6,1],ldblock.groupCorrespondence[new.singleOutput[1:6,3],1],new.singleOutput[1:6,4],new.singleOutput[1:6,3])
assign((paste("final.matrix.noprior",i,sep='')),final.matrix)
##Variance Ratio
#Real blocks
prov.output3<-coef(summary.bglm(mod))[-1,1] #Estimated effects
sd.true.fg<-sd(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))])
sd.false.fg<-sd(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))])
#Top 6 blocks
top.prov<-cbind(coef(summary.bglm(mod))[-1,4],as.numeric(ldblock.final2[,8]))
top.prov.orderedOutput<-top.prov[order(top.prov[,1]),]
top<-unique(top.prov.orderedOutput[,2])
sd.true.fg.top<-sd(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% top[1:6])])
sd.false.fg.top<-sd(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% top[1:6])])
empirical.effects.prior<-rbind(empirical.effects.prior,c((sd.true.fg^2)/((sd.false.fg^2)),(sd.true.fg.top^2)/(sd.false.fg.top^2)))
rownames(empirical.effects.prior)[nrow(empirical.effects.prior)]<-paste(s.min[i],s.max[i],sep='-')
#------------------------------------
#Calculating the variance ratios centered at zero
#Real blocks
sd.true.fg0<-mean(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))]^2)
sd.false.fg0<-mean(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% c(17,19,24,25,28,29))]^2)
#Top blocks
sd.true.fg.top0<-mean(prov.output3[which(as.numeric(ldblock.final2[,8]) %in% top[1:6])]^2)
sd.false.fg.top0<-mean(prov.output3[-which(as.numeric(ldblock.final2[,8]) %in% top[1:6])]^2)
empirical.effects.prior0<-rbind(empirical.effects.prior0,c(sd.true.fg0/sd.false.fg0,sd.true.fg.top0/sd.false.fg.top0))
rownames(empirical.effects.prior0)[nrow(empirical.effects.prior0)]<-paste(s.min[i],s.max[i],sep='-')
print(c(i,s.min[i],s.max[i]))
}
proc.time() - ptm
rank.all.prior
empirical.effects.prior
empirical.effects.prior0
#Little table with the resutls
var.ratios.prior<-cbind(empirical.effects.prior[,2],empirical.effects.prior[,1],empirical.effects.prior0[,2],empirical.effects.prior0[,1])[-1,]
colnames(var.ratios.prior)<-c("top.blocks","true.blocks","top.blocks at 0","true.blocks at 0")
print.xtable(xtable(var.ratios.prior,digits=3), type="html", file="var ratios prior knowledge.html")
<file_sep>#Get dosage data from a subset of SNPs retrieved from the the UK Biobank imputed data files
#01Aug2017
require(data.table)
#Working directory
setwd('/Users/miguelmspereira/Box Sync/Congenica/scripts/')
#Subject ID's
id<-fread('ukb1913_imp_chr1_v2_s487398.sample')
eid<-id$ID_1[-1] #vector with the IDs
rm(id)
#GEN file with the subset of SNPs in 3-column format (this file is for 42 SNPs)
sub<-fread('subset.gen')
#42 rows and 152,249 subjects - corresponds to (456753-6)/3 colums
dim(sub)
#Check data
sub[1:10,1:10]
#----------------------------------------------------------
#File with SNP general info
info<-subset(sub,select=1:6)
write.csv(info,'snpinfo.csv',quote=F,row.names=F)
#----------------------------------------------------------
#Converting to dosage data
b<-subset(sub,select=seq(8,ncol(sub),by=3)) #Takes the 2nd column of each subject
c<-subset(sub,select=seq(9,ncol(sub),by=3)) #Takes the 3rd column of each subject
#dim(b)==dim(c) #Checks if b and c are the same size
#----------------------------------------------------------
#Column names for the final file
#SNP RSID's
cols<-sub$V3
rm(sub) #removed to save memory
#----------------------------------------------------------
#Splits the b and c data matrices in 3 parts - for matrix transposition
b1<-subset(b,select=1:50000)
b2<-subset(b,select=50001:100000)
b3<-subset(b,select=100001:ncol(b))
c1<-subset(c,select=1:50000)
c2<-subset(c,select=50001:100000)
c3<-subset(c,select=100001:ncol(c))
#(ncol(b1)+ncol(b2)+ncol(b3))==ncol(b) #checks if the columns add up to the total
#(ncol(c1)+ncol(c2)+ncol(c3))==ncol(c) #checks if
rm(b) #for memory
rm(c) #for memory
#Calculating dosage data - done 3 times for each of the 3 matrices
dosages1<-b1+2*c1
rm(b1)
rm(c1)
dosages2<-b2+2*c2
rm(b2)
rm(c2)
dosages3<-b3+2*c3
rm(b3)
rm(c3)
#Matrix transposition
tdosages1<-dosages1[, data.table(t(.SD), keep.rownames=F)]
rm(dosages1)
tdosages2<-dosages2[, data.table(t(.SD), keep.rownames=F)]
rm(dosages2)
tdosages3<-dosages3[, data.table(t(.SD), keep.rownames=F)]
rm(dosages3)
#Joining the 3 transposed matrices to get the final matrix
tdosages<-rbind(tdosages1,tdosages2,tdosages3)
rm(tdosages1)
rm(tdosages2)
rm(tdosages3)
#Adds column names to the final matrix with dosage data
colnames(tdosages)<-cols
head(colnames(tdosages)) #to see if colnames are OK
dim(tdosages) #checks size
nrow(tdosages)==(ncol(sub)-6)/3 #compares with original size
#Final data matrix
dos<-as.data.table(cbind(eid,tdosages)) #adds the subject IDs from the sample file
rm(tdosages)
#To save the files
save(dos,file='dosages_newrelease.RData')
#Optional - save as CSV - generates big files if for a big subset of SNPs
write.csv(dos,file='dosages_newlrelease.csv',row.names=F,quote=F)
| 75906efadff68e7525934657be6ec303948738c8 | [
"Markdown",
"R"
] | 4 | R | miguelmspereira/code-examples | bbfaefddb57fbc9f2fb39c30d1c9a35455757abc | 8eed317620df5dc3a667c5096ce39db92f3e6bf8 |
refs/heads/master | <file_sep>import { Component, OnInit } from '@angular/core';
import { Peer } from '../peer';
import { GameService } from '../services/game.service';
import { RefreshService } from '../services/refresh.service';
@Component({
selector: 'app-peers',
templateUrl: './peers.component.html',
styleUrls: ['./peers.component.scss']
})
export class PeersComponent implements OnInit {
peers: Peer[];
selectedPeer: string;
constructor(private gameService: GameService, private refreshService: RefreshService) { }
ngOnInit() {
this.peers = new Array<Peer>();
this.gameService.getPeers().then(response => this.peers = response);
}
setOpponent(peer: Peer) {
this.gameService.createGame(peer.original).then(response => this.setGame(response));
}
setGame(id: string) {
this.gameService.id = id;
this.refreshService.confirmMission();
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { GameService } from '../services/game.service';
@Component({
selector: 'header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.css']
})
export class HeaderComponent implements OnInit {
me: string;
port: number;
constructor(private gameService: GameService, private titleService: Title) {}
getMe(): void {
this.gameService.getMe().then(me => this.setup(me.name));
}
setup(me: string) {
this.me = me;
this.titleService.setTitle(me);
}
ngOnInit() {
this.getMe();
}
}
<file_sep>import { Injectable } from "@angular/core";
@Injectable()
export class PortProviderService {
public current: string;
constructor() {
if (location.port !== "4200") {
//this.current = location.host;
this.current = "http://" + location.host;
} else {
if (location.pathname.includes("other")) {
this.current = "http://localhost:10010";
} else {
this.current = "http://localhost:10007";
}
}
}
}
<file_sep>import { Injectable, OnInit } from "@angular/core";
import { Headers, Http } from "@angular/http";
import { Cash } from "../cash";
import { Party } from "../party";
import { Tx } from "../tx";
import "rxjs/add/operator/toPromise";
import { PortProviderService } from "./port-provider.service";
import { RefreshService } from "./refresh.service";
import { Play } from "../play";
import { Game } from "../game";
import { Peer } from "../peer";
@Injectable()
export class GameService implements OnInit {
public me: string;
public id: string;
ngOnInit(): void {
this.getMe().then(response => (this.me = response.name));
}
constructor(
private http: Http,
private portService: PortProviderService,
private refreshService: RefreshService
) {}
getUrl(path: string) {
let url = this.portService.current + path;
return url;
}
getGame(id: string): Promise<Game> {
const _url = this.getUrl("/api/tictactoe/game");
const url = `${_url}?id=${id}`;
return this.http
.get(url)
.toPromise()
.then(
res => new Game().deserialize(res.json()),
err => this.handleError(err)
);
}
getGames(): Promise<Game[]> {
const url = this.getUrl("/api/tictactoe/all-games");
return this.http
.get(url)
.toPromise()
.then(
res => this.createGameArray(res.json()) as Game[],
err => this.handleError(err)
);
}
createGame(opponent: string): Promise<string> {
const _url = this.getUrl("/api/tictactoe/create-game");
const url = `${_url}?opponent=${opponent}`;
return this.http
.get(url)
.toPromise()
.then(
res => new Tx().deserialize(res).txResponse,
err => this.handleError(err, true)
);
}
play(play: Play): Promise<string> {
const _url = this.getUrl("/api/tictactoe/play-game");
const url = `${_url}?id=${play.id}&row=${play.row}&column=${play.column}`;
return this.http
.get(url)
.toPromise()
.then(
() => this.refreshService.confirmMission(),
err => this.handleError(err, true)
);
}
getCashBalances(): Promise<Cash> {
const url = this.getUrl("/api/tictactoe/cash-balances");
return this.http
.get(url)
.toPromise()
.then(
res => new Cash().deserialize(res.json()) as Cash,
err => this.handleError(err)
);
}
getMe(): Promise<Party> {
let url = this.getUrl("/api/tictactoe/me");
return this.http
.get(url)
.toPromise()
.then(
res => new Party().deserialize(res.json()) as Party,
err => this.handleError(err)
);
}
getPeers(): Promise<Peer[]> {
let url = this.getUrl("/api/tictactoe/peers");
return this.http
.get(url)
.toPromise()
.then(
res => new Peer().deserialize(res.json()).peers as Peer[],
err => this.handleError(err)
);
}
private createGameArray(input: any): Game[] {
const games = new Array<Game>();
if (input.games.length > 0) {
input.games.forEach((element: string) => {
const game = new Game().deserialize(element);
games.push(game);
});
}
return games;
}
private handleError(response: Response, refresh: boolean = false): Promise<any> {
/*this.dialog.open(ErrorFeedbackComponent,
{ data: { error: response.text() } });*/
if(refresh) { this.refreshService.confirmMission(); }
return Promise.reject(response);
}
}
<file_sep>import * as $ from 'jquery';
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {MatToolbarModule} from '@angular/material/toolbar';
import { AppRoutingModule } from './app-routing.module';
import { RefreshService } from './services/refresh.service';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { CashBalanceComponent } from './cash-balance/cash-balance.component';
import { SpinnerComponent } from './spinner/spinner.component';
import { CommaSeperatedNumberPipe } from './comma-seperated-number.pipe';
import { Ng2OdometerModule } from 'ng2-odometer';
import { FooterComponent } from './footer/footer.component';
import { PortProviderService } from './services/port-provider.service';
import { LogoComponent } from './logo/logo.component';
import { ErrorFeedbackComponent } from './error-feedback/error-feedback.component';
import { LoadingComponent } from './loading/loading.component';
import { PeersComponent } from './peers/peers.component';
import { SafePipe } from './safe.pipe';
import { TestComponent } from './test/test.component';
import { BoardComponent } from './board/board.component';
import { ExistingGamesComponent } from './existing-games/existing-games.component';
import { GameService } from './services/game.service';
import { AwaitingTurnComponent } from './awaiting-turn/awaiting-turn.component';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpModule,
AppRoutingModule,
MatToolbarModule,
Ng2OdometerModule.forRoot()
],
declarations: [
AppComponent,
HeaderComponent,
CashBalanceComponent,
ExistingGamesComponent,
SpinnerComponent,
CommaSeperatedNumberPipe,
FooterComponent,
ErrorFeedbackComponent,
LoadingComponent,
LogoComponent,
PeersComponent,
SafePipe,
TestComponent,
BoardComponent,
AwaitingTurnComponent
],
providers: [
RefreshService,
PortProviderService,
GameService
],
entryComponents: [
ErrorFeedbackComponent,
PeersComponent
],
bootstrap: [
AppComponent
],
schemas: [
NO_ERRORS_SCHEMA
]
})
export class AppModule { }
<file_sep>import { Serializable } from './serializable';
export class Game implements Serializable<Game> {
public id: string;
public player1: string;
public player2: string;
public activePlayer: string = '';
public board: number[][];
public complete: boolean;
public winner: string;
deserialize(input: any) {
this.id = input.linearId.id;
this.player1 = input.player1;
this.player2 = input.player2;
this.activePlayer = input.activePlayer;
this.board = input.board;
this.complete = input.complete;
this.winner = input.winner;
return this;
}
}
<file_sep>import { Component, OnInit } from "@angular/core";
import { GameService } from "../services/game.service";
import { Game } from "../game";
import { Play } from "../play";
import { RefreshService } from "../services/refresh.service";
@Component({
selector: "app-board",
templateUrl: "./board.component.html",
styleUrls: ["./board.component.scss"]
})
export class BoardComponent implements OnInit {
game: Game = new Game();
board: string[][] = [["", "", ""], ["", "", ""], ["", "", ""]];
X: boolean = false;
constructor(
public gameService: GameService,
private refreshService: RefreshService
) {
refreshService.missionConfirmed$.subscribe(() => {
this.initialiseExistingGame(this.gameService.id);
});
}
ngOnInit() {
setInterval(() => {
this.refreshService.confirmMission();
}, 2000);
this.gameService
.getMe()
.then(response => (this.gameService.me = response.name));
$(document).ready(function () {
//display only the CHOOSE GAME STYLE box
$("#chooseGame")
.show()
.addClass("animated fadeInDown");
$("#chooseGame").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#chooseGame").removeClass("animated fadeInDown");
}
); //close the animationEnd function
$("#choosePlayer").hide();
$("#peers").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
//if we click on the title, go back to main menu
$("#main").click(function () {
$(".tic").text("");
$(".tic").removeClass("ex");
$(".tic").removeClass("oh");
$("#chooseGame")
.show()
.addClass("animated fadeInDown");
$("#chooseGame").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#chooseGame").removeClass("animated fadeInDown");
}
); //close the animationEnd function
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
}); //end of click the title
//EXISTING GAME
$(".existingGame").click(function () {
$("#chooseGame").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
$("#peers").hide();
$("#choosePlayer")
.show()
.addClass("animated flipInX");
$("#choosePlayer").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#choosePlayer").removeClass("animated flipInX");
}
); //close the animationEnd function
var player; //set players turn to be either X or 0
//click to choose player X
$("#playerX").click(function () {
player = "X";
//display only GAME BOX and RESTART BTN
$("#chooseGame").hide();
$("#choosePlayer").hide();
$("#gameBox")
.show()
.addClass("animated flipInX");
$("#gameBox").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#gameBox").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").show();
}); //end of player X turn
//click to choose player 0
$("#player0").click(function () {
player = "0";
//display only GAME BOX and RESTART BTN
$("#chooseGame").hide();
$("#choosePlayer").hide();
$("#gameBox")
.show()
.addClass("animated flipInX");
$("#gameBox").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#gameBox").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").show();
}); //end of player 0 turn
//check if someone of possible two players has won
function checkIfSomeoneWon(symbol) {
if (
$("#box0").hasClass(symbol) &&
$("#box1").hasClass(symbol) &&
$("#box2").hasClass(symbol)
) {
return true;
} else if (
$("#box3").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box5").hasClass(symbol)
) {
return true;
} else if (
$("#box6").hasClass(symbol) &&
$("#box7").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box0").hasClass(symbol) &&
$("#box3").hasClass(symbol) &&
$("#box6").hasClass(symbol)
) {
return true;
} else if (
$("#box0").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box1").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box7").hasClass(symbol)
) {
return true;
} else if (
$("#box2").hasClass(symbol) &&
$("#box5").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box2").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box6").hasClass(symbol)
) {
return true;
} else {
return false;
}
} //end of winner function
//click a field to play
$(".tic").click(function () {
let fieldClicked = $(this);
//if the field is already clicked animate the symbol
if (fieldClicked.hasClass("ex") || fieldClicked.hasClass("oh")) {
fieldClicked.addClass("animated jello");
fieldClicked.one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
fieldClicked.removeClass("animated jello");
}
); //close the animationEnd function
//if the field was not clicked beforehand, add the symbol and check if the player won
} else {
if (player === "X") {
fieldClicked.addClass("ex").text(player);
if (checkIfSomeoneWon("ex")) {
$(".tic").text("");
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} else {
player = "X";
}
} else {
fieldClicked.addClass("oh").text(player);
if (checkIfSomeoneWon("oh")) {
$(".tic").text("");
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} else {
player = "0";
}
}
}
}); //end of click a field to play function
//set the reset function
function reset() {
$(".tic").text("");
$(".tic").removeClass("ex");
$(".tic").removeClass("oh");
$("#chooseGame")
.show()
.addClass("animated fadeInDown");
$("#chooseGame").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#chooseGame").removeClass("animated fadeInDown");
}
); //close the animationEnd function
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} //end of reset function
//click the RESET and PLAY AGAIN button
$(".btn").click(function () {
reset();
});
});
}); //document load end
//SET THE LOGIC FOR VS.COMPUTER GAME MODE *******************************
$("#vsComp").click(function () {
//show the CHOOSE YOUR PLAYER box
$("#chooseGame").hide();
$("#choosePlayer")
.show()
.addClass("animated flipInX");
$("#choosePlayer").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#choosePlayer").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
//declare some variables
var turn;
var computersTurn;
var turns = ["", "", "", "", "", "", "", "", ""];
var count = 0;
var gameOn = false;
var slot;
var computersMove;
//create a winning combination function to check for winner
function checkForWinner(symbol) {
if (
$("#box0").hasClass(symbol) &&
$("#box1").hasClass(symbol) &&
$("#box2").hasClass(symbol)
) {
return true;
} else if (
$("#box3").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box5").hasClass(symbol)
) {
return true;
} else if (
$("#box6").hasClass(symbol) &&
$("#box7").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box0").hasClass(symbol) &&
$("#box3").hasClass(symbol) &&
$("#box6").hasClass(symbol)
) {
return true;
} else if (
$("#box0").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box1").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box7").hasClass(symbol)
) {
return true;
} else if (
$("#box2").hasClass(symbol) &&
$("#box5").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box2").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box6").hasClass(symbol)
) {
return true;
} else {
return false;
}
} //end of winner function
//create a function for computers turn to choose random field
function computerTurn() {
var taken = false;
while (taken === false && count !== 5) {
computersMove = (Math.random() * 10).toFixed();
var move = $("#box" + computersMove).text();
if (move === "") {
$("#box" + computersMove)
.text(computersTurn)
.addClass("oh");
taken = true;
turns[computersMove] = computersTurn;
}
}
} //end of computer turn function
//declare function for Players turn
function playerTurn(turn, id) {
var spotTaken = $("#" + id).text();
if (spotTaken === "") {
turns[id] = turn;
$("#" + id)
.text(turn)
.addClass("ex");
count++;
if (checkForWinner("ex")) {
$(".tic").text("");
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox")
.show()
.addClass("animated fadeInUp");
$("#winBox").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#winBox").removeClass("animated fadeInUp");
}
); //close the animationEnd function
$("#loseBox").hide();
$("#restartBtn").hide();
}
if (gameOn === false) {
computerTurn();
if (checkForWinner("oh")) {
$(".tic").text("");
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox")
.show()
.addClass("animated fadeInUp");
$("#loseBox").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#loseBox").removeClass("animated fadeInUp");
}
); //close the animationEnd function
$("#restartBtn").hide();
}
}
}
} //end of player turn function
//click a field to play
$(".tic").click(function () {
slot = $(this).attr("id");
playerTurn(turn, slot);
}); //end of click a field function
//click to choose player X
$("#playerX").click(function () {
turn = "X";
computersTurn = "0";
$("#chooseGame").hide();
$("#choosePlayer").hide(); //display only GAME BOX and RESTART BTN
$("#gameBox")
.show()
.addClass("animated flipInX");
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").show();
}); //end of player X turn
//click to choose player 0
$("#player0").click(function () {
turn = "0";
computersTurn = "X";
$("#chooseGame").hide();
$("#choosePlayer").hide(); //display only GAME BOX and RESTART BTN
$("#gameBox")
.show()
.addClass("animated flipInX");
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").show();
}); //end of player 0 turn
function resetVScomp() {
turns = ["", "", "", "", "", "", "", "", ""];
count = 0;
gameOn = false;
$(".tic").text("");
$(".tic").removeClass("ex");
$(".tic").removeClass("oh");
$("#chooseGame").hide();
$("#choosePlayer")
.show()
.addClass("animated flipInX");
$("#choosePlayer").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#choosePlayer").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} //end of restart function
//click the RESET and PLAY AGAIN button
$(".btn").click(function () {
resetVScomp();
});
}); //end of VS.COMPUTER PLAYER MODE *************************************
//************************************************************************
//SET THE GAME LOGIC FOR TWO PLAYERS MODE ********************************
$("#2players").click(function () {
$("#chooseGame").hide();
$("#peers")
.show()
.addClass("animated flipInX");
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
// select peer
$(".peer").click(function () {
$("#peers").hide();
$("#choosePlayer")
.show()
.addClass("animated flipInX");
$("#choosePlayer").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#choosePlayer").removeClass("animated flipInX");
}
); //close the animationEnd function
});
var player; //set players turn to be either X or 0
//click to choose player X
$("#playerX").click(function () {
player = "X";
//display only GAME BOX and RESTART BTN
$("#chooseGame").hide();
$("#choosePlayer").hide();
$("#gameBox")
.show()
.addClass("animated flipInX");
$("#gameBox").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#gameBox").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").show();
}); //end of player X turn
//click to choose player 0
$("#player0").click(function () {
player = "0";
//display only GAME BOX and RESTART BTN
$("#chooseGame").hide();
$("#choosePlayer").hide();
$("#gameBox")
.show()
.addClass("animated flipInX");
$("#gameBox").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#gameBox").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").show();
}); //end of player 0 turn
//check if someone of possible two players has won
function checkIfSomeoneWon(symbol) {
if (
$("#box0").hasClass(symbol) &&
$("#box1").hasClass(symbol) &&
$("#box2").hasClass(symbol)
) {
return true;
} else if (
$("#box3").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box5").hasClass(symbol)
) {
return true;
} else if (
$("#box6").hasClass(symbol) &&
$("#box7").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box0").hasClass(symbol) &&
$("#box3").hasClass(symbol) &&
$("#box6").hasClass(symbol)
) {
return true;
} else if (
$("#box0").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box1").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box7").hasClass(symbol)
) {
return true;
} else if (
$("#box2").hasClass(symbol) &&
$("#box5").hasClass(symbol) &&
$("#box8").hasClass(symbol)
) {
return true;
} else if (
$("#box2").hasClass(symbol) &&
$("#box4").hasClass(symbol) &&
$("#box6").hasClass(symbol)
) {
return true;
} else {
return false;
}
} //end of winner function
//click a field to play
$(".tic").click(function () {
var fieldClicked = $(this);
//if the field is already clicked animate the symbol
if (fieldClicked.hasClass("ex") || fieldClicked.hasClass("oh")) {
fieldClicked.addClass("animated jello");
fieldClicked.one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
fieldClicked.removeClass("animated jello");
}
); //close the animationEnd function
//if the field was not clicked beforehand, add the symbol and check if the player won
} else {
if (player === "X") {
fieldClicked.addClass("ex").text(player);
if (checkIfSomeoneWon("ex")) {
$(".tic").text("");
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} else {
player = "X";
}
} else {
fieldClicked.addClass("oh").text(player);
if (checkIfSomeoneWon("oh")) {
$(".tic").text("");
$("#choosePlayer").hide();
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} else {
player = "0";
}
}
}
}); //end of click a field to play function
//set the reset function
function reset() {
$(".tic").text("");
$(".tic").removeClass("ex");
$(".tic").removeClass("oh");
$("#chooseGame").hide();
$("#choosePlayer")
.show()
.addClass("animated flipInX");
$("#choosePlayer").one(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function () {
$("#choosePlayer").removeClass("animated flipInX");
}
); //close the animationEnd function
$("#gameBox").hide();
$("#winBox").hide();
$("#loseBox").hide();
$("#restartBtn").hide();
} //end of reset function
//click the RESET and PLAY AGAIN button
$(".btn").click(function () {
reset();
});
}); //end of TWO PLAYERS MODE function*************************
}
initialiseExistingGame(id: string) {
if (id) {
this.gameService.getGame(id).then(response => this.processGame(response));
}
}
play(row: number, column: number) {
let play = new Play();
play.id = this.game.id;
play.row = row;
play.column = column;
this.gameService.play(play);
}
setX(value: boolean) {
this.X = value;
this.processGame(this.game);
}
processGame(game: Game) {
let weArePlayer1 = game.player1.includes(this.gameService.me);
let board: string[][] = [["", "", ""], ["", "", ""], ["", "", ""]];
let count: number = 0;
for (let x of game.board[0]) {
board[0][count] = this.getMarker(x, weArePlayer1);
count++;
}
count = 0;
for (let x of game.board[1]) {
board[1][count] = this.getMarker(x, weArePlayer1);
count++;
}
count = 0;
for (let x of game.board[2]) {
board[2][count] = this.getMarker(x, weArePlayer1);
count++;
}
document.getElementById("box0").innerHTML = this.getMarker(
game.board[0][0],
weArePlayer1
);
document.getElementById("box1").innerHTML = this.getMarker(
game.board[0][1],
weArePlayer1
);
document.getElementById("box2").innerHTML = this.getMarker(
game.board[0][2],
weArePlayer1
);
document.getElementById("box3").innerHTML = this.getMarker(
game.board[1][0],
weArePlayer1
);
document.getElementById("box4").innerHTML = this.getMarker(
game.board[1][1],
weArePlayer1
);
document.getElementById("box5").innerHTML = this.getMarker(
game.board[1][2],
weArePlayer1
);
document.getElementById("box6").innerHTML = this.getMarker(
game.board[2][0],
weArePlayer1
);
document.getElementById("box7").innerHTML = this.getMarker(
game.board[2][1],
weArePlayer1
);
document.getElementById("box8").innerHTML = this.getMarker(
game.board[2][2],
weArePlayer1
);
this.board = board;
this.game = game;
}
getMarker(marker: number, weArePlayer1: boolean) {
switch (marker) {
case -1:
return "";
case 0:
// player1 is always 0, if I'm player1, then I'm 0
if (weArePlayer1) {
if (this.X) {
return "X";
} else {
return "0";
}
}
if (this.X) {
return "0";
}
return "X";
case 1:
if (weArePlayer1) {
if (this.X) {
return "0";
} else {
return "X";
}
}
if (this.X) {
return "X";
}
return "0";
default:
return;
}
}
reset() {
this.game = new Game();
this.board = [["", "", ""], ["", "", ""], ["", "", ""]];
}
}
<file_sep>import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { Subscription } from 'rxjs';
@Injectable()
export class RefreshService {
public loading: boolean;
// Observable sources
private confirmedSource = new Subject<boolean>();
// Observable string streams
missionConfirmed$ = this.confirmedSource.asObservable();
confirmMission() {
this.confirmedSource.next(true);
}
constructor() {
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { Game } from '../game';
import { GameService } from '../services/game.service';
import { RefreshService } from '../services/refresh.service';
@Component({
selector: 'app-existing-games',
templateUrl: './existing-games.component.html',
styleUrls: ['./existing-games.component.scss']
})
export class ExistingGamesComponent implements OnInit {
games: Game[];
constructor(private gameService: GameService,
private refreshService: RefreshService) {
}
ngOnInit() {
this.initialise();
}
initialise() {
this.games = new Array<Game>();
this.gameService.getGames().then(response => (this.games = response));
}
loadExisting(id: string) {
this.gameService.id = id;
this.refreshService.confirmMission();
}
}
<file_sep>import { Component, OnInit, Input } from '@angular/core';
import { Cash } from '../cash';
import { ActivatedRoute } from '@angular/router';
import { RefreshService } from '../services/refresh.service';
import { GameService } from '../services/game.service';
declare var $: any;
@Component({
selector: 'cash-balance',
templateUrl: './cash-balance.component.html',
styleUrls: ['./cash-balance.component.css']
})
export class CashBalanceComponent implements OnInit {
@Input() node: string;
cashBalances: Cash;
constructor(private gameService: GameService,
private route: ActivatedRoute,
private refreshService: RefreshService) {
refreshService.missionConfirmed$.subscribe(
result => {
this.getCashBalances();
});
}
getCashBalances() {
this.gameService.getCashBalances().then(cashBalances => this.cashBalances = cashBalances);
}
ngOnInit() {
this.getCashBalances();
}
}
<file_sep>import { Serializable } from './serializable';
export class Play implements Serializable<Play> {
id: string;
row: number;
column: number;
deserialize(input: any) {
return this;
}
}
| 7d479bb195d9c82e082e141cc1f5a944f9d490e3 | [
"TypeScript"
] | 11 | TypeScript | CaisR3/tic-tac-toe-web | 2bd452c3610a0223e9c5e3b77c56094104bb8aeb | 738b83dec036dfa855ca5f2ee1d61155136faa92 |
refs/heads/master | <repo_name>MattMan569/WpfBasics<file_sep>/WpfBasics/MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfBasics
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ApplyButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show($"The description is: {this.DescriptionText.Text}");
}
private void ResetButton_Click(object sender, RoutedEventArgs e)
{
this.WeldCheckbox.IsChecked = this.AssemblyCheckbox.IsChecked = this.PlasmaCheckbox.IsChecked = this.LaserCheckbox.IsChecked = this.PurchaseCheckbox.IsChecked =
this.LatheCheckbox.IsChecked = this.DrillCheckbox.IsChecked = this.FoldCheckbox.IsChecked = this.RollCheckbox.IsChecked = this.SawCheckbox.IsChecked = false;
}
private void Checkbox_Checked(object sender, RoutedEventArgs e)
{
// Add a space if it is not the first item in the field
/*
if (!string.IsNullOrWhiteSpace(this.LengthText.Text))
{
this.LengthText.Text += " ";
}
*/
// Cast the sender to a checkbox, then the content attribute to a string
this.LengthText.Text += (string)((CheckBox)sender).Content;
}
private void FinishDropdown_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// This event is fired upon the dropdown being created in the form.
// The note textbox is not created yet and will result in an exception
// when trying to write to it.
// Return from this function if it does not yet exist.
if (this.NoteText == null)
return;
var combo = (ComboBox)sender;
var value = (ComboBoxItem)combo.SelectedValue;
this.NoteText.Text = (string)value.Content;
}
// Fires upon the entire window being loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// Fill in the note field with the default value of the dropdown
FinishDropdown_SelectionChanged(this.FinishDropdown, null);
}
private void SupplierNameText_TextChanged(object sender, TextChangedEventArgs e)
{
this.MassText.Text = this.SupplierNameText.Text;
}
}
}
| 130bea2c0174f310a034e47f8dec93e2e26577b7 | [
"C#"
] | 1 | C# | MattMan569/WpfBasics | bbaa96245ca6b9bb6e3e9fa77fb14794f48fd24b | c529e5fc124d39c20a3b8bbcdbaf29a6b4e5529f |
refs/heads/master | <repo_name>parkjunhong/open-commons-spring-web<file_sep>/src/main/java/open/commons/spring/web/handler/DefaultGlobalInterceptor.java
/*
* Copyright 2020 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2020. 1. 17. 오후 1:19:18
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.handler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.ThreadContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import open.commons.core.utils.ThreadUtils;
import open.commons.spring.web.annotation.CustomInterceptor;
/**
*
* @since 2020. 1. 17.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
@CustomInterceptor
public class DefaultGlobalInterceptor implements AsyncHandlerInterceptor {
public static final String BEAN_QUALIFIER = "open.commons.spring.web.handler.DefaultGlobalInterceptor";
protected final Logger logger = LoggerFactory.getLogger(getClass());
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 1. 17. 박준홍 최초 작성
* </pre>
*
* @since 2020. 1. 17.
* @version
*/
public DefaultGlobalInterceptor() {
}
/**
* @see org.springframework.web.servlet.HandlerInterceptor#postHandle(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.web.servlet.ModelAndView)
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
String otn = ThreadContext.get(BEAN_QUALIFIER);
if (otn != null) {
String reqInfo = Thread.currentThread().getName();
logger.trace("[Restore thread-name] {} -> {}", reqInfo, otn);
ThreadUtils.setThreadName(otn);
ThreadContext.clearAll();
}
}
/**
* @see org.springframework.web.servlet.HandlerInterceptor#preHandle(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse, java.lang.Object)
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String reqUri = request.getRequestURI();
reqUri = new StringBuffer(request.getMethod()) //
.append(' ') //
.append(request.getRequestURI()) //
.append(' ') //
.append(request.getRemoteAddr()) //
.append(':') //
.append(String.valueOf(request.getRemotePort())) //
.toString();
String threadName = ThreadContext.get(BEAN_QUALIFIER);
if (threadName == null) {
threadName = ThreadUtils.setThreadName(reqUri);
ThreadContext.put(BEAN_QUALIFIER, threadName);
logger.trace("[Change thread-name] {} -> {}.", threadName, reqUri);
}
return true;
}
}
<file_sep>/src/main/java/open/commons/spring/web/annotation/CustomInterceptor.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2019. 6. 11. 오후 2:43:31
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.web.servlet.HandlerInterceptor;
/**
* 사용자 정의 {@link HandlerInterceptor}를 정의.
*
* @since 2019. 6. 11.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CustomInterceptor {
String value() default "";
}
<file_sep>/src/main/java/open/commons/spring/web/servlet/NotFoundException.java
/*
* Copyright 2022 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2022. 12. 1. 오후 5:47:09
*
* Author: <EMAIL>
*
*/
package open.commons.spring.web.servlet;
import org.springframework.http.HttpStatus;
/**
* REST API URL에 패턴에는 만족하지만, 데이터가 존재하지 않는 경우 발생시키는 예외 클래스.
*
* @since 2022. 12. 1.
* @version 0.5.0
* @author <EMAIL>
*
* @see HttpStatus#NOT_FOUND
*/
public class NotFoundException extends RuntimeException {
/**
*
* @since 2022. 12. 1.
*/
private static final long serialVersionUID = 1L;
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 12. 1. 박준홍 최초 작성
* </pre>
*
*
* @since 2022. 12. 1.
* @version 0.5.0
* @author par<EMAIL>h<EMAIL>
*/
public NotFoundException() {
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 12. 1. 박준홍 최초 작성
* </pre>
*
* @param message
*
* @since 2022. 12. 1.
* @version 0.5.0
* @author <EMAIL>
*/
public NotFoundException(String message) {
super(message);
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 12. 1. 박준홍 최초 작성
* </pre>
*
* @param message
* @param cause
*
* @since 2022. 12. 1.
* @version 0.5.0
* @author <EMAIL>
*/
public NotFoundException(String message, Throwable cause) {
super(message, cause);
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 12. 1. 박준홍 최초 작성
* </pre>
*
* @param message
* @param cause
* @param enableSuppression
* @param writableStackTrace
*
* @since 2022. 12. 1.
* @version 0.5.0
* @author <EMAIL>
*/
public NotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 12. 1. 박준홍 최초 작성
* </pre>
*
* @param cause
*
* @since 2022. 12. 1.
* @version 0.5.0
* @author <EMAIL>
*/
public NotFoundException(Throwable cause) {
super(cause);
}
}
<file_sep>/src/main/java/open/commons/spring/web/validation/Validational.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2019. 10. 10. 오후 2:21:43
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.validation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import open.commons.spring.web.utils.ValidationUtils;
/**
* 데이터 검증을 지원하는 클래스.
*
* @since 2019. 10. 10.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*
* @see Validation
* @see Validator
* @see ValidatorFactory
* @see ValidationUtils
*/
public abstract class Validational<C extends List<E>, E extends Validational<List<E>, E>> {
/**
* 여러 개의 데이터 검증 오류 결과를 합친다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 10. 10. 박준홍 최초 작성
* </pre>
*
* @param buf
* @param errors
* @param index
* @param builder
*
* @since 2019. 10. 10.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
private void aggregate(Collection<String> buf, Collection<String> errors, int index, StringBuffer builder) {
for (String error : errors) {
builder.append('[');
builder.append(index);
builder.append("] ");
builder.append(error);
buf.add(builder.toString());
builder.setLength(0);
}
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 10. 10. 박준홍 최초 작성
* </pre>
*
* @return
*
* @since 2019. 10. 10.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
public abstract C getSubObjects();
/**
* 데이터 검증한 결과를 제공한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 10. 10. 박준홍 최초 작성
* </pre>
*
* @param validator
* 데이터 검증기
* @return 오류가 없는 경우 null을 제공한다.
*
* @since 2019. 10. 10.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
public Collection<String> validate(Function<Object, Collection<String>> validator) {
Collection<String> errors = validator.apply(this);
C subObjects = getSubObjects();
if (subObjects == null || subObjects.isEmpty()) {
return errors;
}
if (errors != null) {
errors = new ArrayList<>(errors);
}
Collection<String> subErrors = null;
int i = 0;
StringBuffer builder = new StringBuffer();
for (E target : subObjects) {
try {
subErrors = target.validate(validator);
if (subErrors == null) {
continue;
}
if (errors == null) {
errors = new ArrayList<>();
}
builder.setLength(0);
aggregate(errors, subErrors, i, builder);
} finally {
i++;
}
}
return errors;
}
}
<file_sep>/src/main/java/open/commons/spring/web/servlet/method/annotation/DefaultGlobalExceptionHandler.java
/*
* Copyright 2020 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2020. 1. 17. 오후 2:55:32
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.servlet.method.annotation;
import javax.validation.ConstraintViolationException;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import open.commons.core.collection.FIFOMap;
import open.commons.spring.web.servlet.BadRequestException;
import open.commons.spring.web.servlet.InternalServerException;
import open.commons.spring.web.servlet.NotFoundException;
import open.commons.spring.web.utils.WebUtils;
/**
*
* @since 2020. 1. 17.
* @version 0.2.3
* @author Park_Jun_Hong_(<EMAIL>)
*/
@ControllerAdvice
@Order(Ordered.LOWEST_PRECEDENCE)
public class DefaultGlobalExceptionHandler extends ResponseEntityExceptionHandler {
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 1. 17. 박준홍 최초 작성
* </pre>
*
* @since 2020. 1. 17.
* @version 0.2.3
*/
public DefaultGlobalExceptionHandler() {
}
/**
* 상태에 맞는 메시지를 생성한 후 예외처리를 진행한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 1. 17. 박준홍 최초 작성
* </pre>
*
* @param status
* @param ex
* @param request
* @return
*
* @since 2020. 1. 17.
* @version 0.2.3
* @author Park_Jun_Hong_(<EMAIL>)
*/
protected ResponseEntity<Object> createEntity(HttpStatus status, Exception ex, WebRequest request) {
FIFOMap<String, Object> entity = WebUtils.createEntity(request, ex, status);
return handleExceptionInternal(ex, entity, new HttpHeaders(), status, request);
}
/**
* 4xx 로 처리되는 클래스를 정의 및 처리. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 1. 17. 박준홍 최초 작성
* 2020. 7. 30. 박준홍 {@link BadRequestException} 추가
* 2022. 12. 01. 박준홍 {@link NotFoundException} 추가.
* </pre>
*
* @param ex
* @param request
* @return
*
* @since 2020. 1. 17.
* @version 0.2.3
* @author Park_Jun_Hong_(<EMAIL>)
*/
@ExceptionHandler(value = { //
BadRequestException.class, //
ConstraintViolationException.class, //
NotFoundException.class, //
})
public ResponseEntity<Object> handle4xxException(Exception ex, WebRequest request) {
HttpStatus status = null;
Class<?> exClass = ex.getClass();
if (BadRequestException.class.equals(exClass) //
|| ConstraintViolationException.class.equals(exClass) //
) {
status = HttpStatus.BAD_REQUEST;
} else if (NotFoundException.class.equals(exClass)) {
status = HttpStatus.NOT_FOUND;
}
FIFOMap<String, Object> entity = WebUtils.createEntity(request, ex, status);
return handleExceptionInternal(ex, entity, new HttpHeaders(), status, request);
}
/**
* 5xx 로 처리되는 클래스 정의 및 처리 <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 1. 17. 박준홍 최초 작성
* 2020. 7. 30. 박준홍 {@link InternalServerException} 추가
* </pre>
*
* @param ex
* @param request
* @return
*
* @since 2020. 1. 17.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
@ExceptionHandler(value = { //
NullPointerException.class, //
IllegalArgumentException.class, //
IllegalStateException.class, //
InternalServerException.class, //
UnsupportedOperationException.class, //
RuntimeException.class, //
Exception.class, // eclipse-javadoc:%E2%98%82=open-commons-spring-web/src%5C/main%5C/java%3Copen
})
public ResponseEntity<Object> handle5xxException(Exception ex, WebRequest request) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
FIFOMap<String, Object> entity = WebUtils.createEntity(request, ex, status);
return handleExceptionInternal(ex, entity, new HttpHeaders(), status, request);
}
@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body, HttpHeaders headers, HttpStatus status, WebRequest request) {
if (body == null) {
body = WebUtils.createEntity(request, ex, status);
}
return super.handleExceptionInternal(ex, body, headers, status, request);
}
}
<file_sep>/src/main/java/open/commons/spring/web/config/CustomWebMvcConfigurer.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring5".
*
* Date : 2019. 6. 3. 오후 5:44:34
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.config;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
//import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import open.commons.core.utils.ArrayUtils;
import open.commons.spring.web.annotation.RequestValueSupported;
import open.commons.spring.web.enums.EnumConverter;
import open.commons.spring.web.enums.EnumConverterFactory;
import open.commons.spring.web.enums.EnumPackages;
import open.commons.spring.web.springfox.swagger.SpringfoxSwagger;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* 사용자 정의 설정을 자동으로 등록해주는 클래스.
*
* <h1>사용자 정의 Enum 클래스 등 import open.commons.spring.web.enums.EnumConverterFactory;록</h1>
* <h2>1. {@link Enum} 클래스 정보가 있는 패키지 정의</h2>
*
* import open.commons.spring.web.enums.EnumPackages;
*
* Sprig Boot Application 설정 파일에 아래 예시처럼 항목에 대한 값으로 패키지 정보 설정.<br>
*
* 예) application.yml 인 경우
*
* <pre>
* ...
* open-commons:
* spring:
* web:
* factory:
* enum:
* packages:
* - packages1
* - packages2
*
* ...
*
* </pre>
*
* <h2>2. 사용자 정의 {@link Enum} 작성법</h2>
*
* <pre>
* import java.util.ArrayList;
* import java.util.List;
*
* import open.commons.spring5.annotation.RequestValueConverter;
* import open.commons.spring5.annotation.RequestValueSupported;
*
* @RequestValueSupported
* public enum Service {
* NORMAL("normal"), PREMIUM("premium"), PLATINUM("Platinum");
*
* private String service;
*
* private Service(String service) {
* this.service = service;
* }
*
* public String get() {
* return this.service;
* }
*
* public static Service get(String service) {
* return get(service, false);
* }
*
* @RequestValueConverter(hasIgnoreCase = true)
* public static Service get(String service, boolean ignoreCase) {
*
* if (service == null) {
* throw new IllegalArgumentException("'service' MUST NOT be null. input: " + service);
* }
*
* if (ignoreCase) {
* for (Service value : values()) {
* if (value.service.equalsIgnoreCase(service)) {
* return value;
* }
* }
* } else {
* for (Service value : values()) {
* if (value.service.equals(service)) {
* return value;
* }
* }
* }
*
* throw new IllegalArgumentException(
* "Unexpected 'service' value of 'Service'. expected: " + values0() + " & Ignore case-sensitive: " + ignoreCase + ", input: " + service);
* }
*
* private static List<String> values0() {
*
* List<String> valuesStr = new ArrayList<>();
*
* for (Service value : values()) {
* valuesStr.add(value.get());
* }
*
* return valuesStr;
* }
* }
* </pre>
*
*
* <h2>3. 자동으로 등록하기</h2>
*
* <pre>
* import org.springframework.boot.SpringApplication;
* import org.springframework.boot.autoconfigure.SpringBootApplication;
* import org.springframework.boot.web.servlet.ServletComponentScan;
* import org.springframework.context.annotation.Bean;
*
* import open.commons.spring.web.config.CustomWebMvcConfigurer;
*
* @ServletComponentScan
* @SpringBootApplication
* public class SpringExampleApplication {
*
* @Bean
* public CustomWebMvcConfigurer registerCustomWebMvcConfigurer() {
* return new CustomEnumRegister();
* }
*
* public static void main(String[] args) {
* SpringApplication app = new SpringApplication(SpringExampleApplication.class);
* app.run(args);
* }
* }
* </pre>
*
* @since 2019. 6. 3.
* @version 0.0.3
* @author Park_Jun_Hong_(<EMAIL>)
*/
@Configuration
@EnableWebMvc
@EnableSwagger2
@SpringBootApplication(exclude = {
// Spring Security 자동 실행 방지
SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class
//
})
public class CustomWebMvcConfigurer implements WebMvcConfigurer {
/** Prefix of configurations in appliation.yml(or .properteis, or ...) */
public static final String APPLICATION_PROPERTIES_PREFIX = "open-commons.spring.web.factory.enum";
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ApplicationContext context;
@Autowired
private EnumPackages enumPkgs;
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 9. 3. 박준홍 최초 작성
* </pre>
*
* @param registry
* @param patterns
* URL 처리 예외 패턴
*
* @since 2020. 9. 3.
* @author Park_Jun_Hong_(<EMAIL>)
*/
private void addExcludePatternsToInterceptor(InterceptorRegistration registry, String... patterns) {
registry.excludePathPatterns(patterns);
logger.info("[ADD] exclude.path={}", Arrays.toString(patterns));
}
/**
* @see org.springframework.web.servlet.config.annotation.WebMvcConfigurer#addFormatters(org.springframework.format.FormatterRegistry)
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addFormatters(FormatterRegistry registry) {
List<String> pkgs = new ArrayList<>();
// default package.
pkgs.add("open.commons");
// 사용자 정의 package
pkgs.addAll(enumPkgs.getPackages());
EnumConverterFactory factory = new EnumConverterFactory();
pkgs.stream() //
.forEach(pkg -> {
Reflections r = new Reflections(pkg);
r.getSubTypesOf(Enum.class)//
.stream() //
.filter(type -> type.getAnnotation(RequestValueSupported.class) != null) //
.forEach(type -> {
EnumConverter c = new EnumConverter<>(type);
factory.register(type, c);
logger.info("Register a Converter {}.", c);
});
});
registry.addConverterFactory(factory);
}
/**
* @see org.springframework.web.servlet.config.annotation.WebMvcConfigurer#addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry)
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// Bean 중에서 HandlerIntereceptor 를 구현한 객체를 찾아서.
Collection<HandlerInterceptor> intcptrs = context.getBeansOfType(HandlerInterceptor.class).values();
if (intcptrs == null || intcptrs.size() < 1) {
InterceptorRegistration reg = registry.addInterceptor(new AsyncHandlerInterceptor() {
});
addSwagger2ExcludePatternsToInterceptor(reg);
return;
}
intcptrs.stream() //
.forEach(intcptr -> {
InterceptorRegistration reg = registry.addInterceptor(intcptr);
// start - support 'sprignfox-swagger-ui-2.9.2' : 2020. 9. 3. 오후 5:16:01
addSwagger2ExcludePatternsToInterceptor(reg);
// end - support 'sprignfox-swagger-ui-2.9.2' : 2020. 9. 3. 오후 5:16:01
logger.info("Register a Interceptor. {}.", intcptr);
});
WebMvcConfigurer.super.addInterceptors(registry);
}
/**
* @since 2020. 9. 3.
* @author Park_Jun_Hong_(<EMAIL>)
*
* @see org.springframework.web.servlet.config.annotation.WebMvcConfigurer#addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry)
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
addSwagger2ResourceHandlers(registry);
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 9. 3. 박준홍 최초 작성
* </pre>
*
* @param registry
* @param handlers
* Resource Handler, {@link AntPathMatcher}
* @param locations
* Resource Locations, {@link AntPathMatcher}
*
* @since 2020. 9. 3.
* @author Park_Jun_Hong_(<EMAIL>)
*/
private void addResourceHandlers(ResourceHandlerRegistry registry, String[] handlers, String[] locations) {
registry.addResourceHandler(handlers).addResourceLocations(locations);
logger.info("[ADD] resource.handler={}, resource.locations={}", Arrays.toString(handlers), Arrays.toString(locations));
}
/**
* Springfox-swagger-ui 지원을 위한 패턴 예외사항을 적용한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 9. 3. 박준홍 최초 작성
* </pre>
*
* @param registry
*
* @since 2020. 9. 3.
* @author Park_Jun_Hong_(<EMAIL>)
*/
private void addSwagger2ExcludePatternsToInterceptor(InterceptorRegistration registry) {
addExcludePatternsToInterceptor(registry, SpringfoxSwagger.getUrlList());
}
private void addSwagger2ResourceHandlers(ResourceHandlerRegistry registry) {
// start - support 'sprignfox-swagger-ui-2.9.2' : 2020. 9. 3. 오후 5:15:51
addResourceHandlers(registry, ArrayUtils.add(null, SpringfoxSwagger.URL_HTML), ArrayUtils.add(null, SpringfoxSwagger.RESOURCE_HTML));
addResourceHandlers(registry, ArrayUtils.add(null, SpringfoxSwagger.URL_WEBJARS), ArrayUtils.add(null, SpringfoxSwagger.RESOURCE_WEBJARS));
// end - support 'sprignfox-swagger-ui-2.9.2' : 2020. 9. 3. 오후 5:15:51
}
/**
* @since 2020. 9. 3.
* @author Park_Jun_Hong_(<EMAIL>)
*
* @see org.springframework.web.servlet.config.annotation.WebMvcConfigurer#addViewControllers(org.springframework.web.servlet.config.annotation.ViewControllerRegistry)
*/
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController(SpringfoxSwagger.URL_UI, SpringfoxSwagger.URL_HTML);
WebMvcConfigurer.super.addViewControllers(registry);
}
/**
* @see org.springframework.web.servlet.config.annotation.WebMvcConfigurer#extendMessageConverters(java.util.List)
*/
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
context.getBeansOfType(HttpMessageConverter.class) // Bean 중에서 HttpMessageConverter 를 구현한 객체를찾아서.
.values() //
.stream() //
// .filter(p -> p.getClass().getAnnotation(CustomHttpMessageConverter.class) != null) // 사용자 정의
// CustomHttpMessageConverter
.forEach(converter -> {
converters.add(converter);
logger.info("Register a HttpMessageConverter. {}.", converter);
});
WebMvcConfigurer.super.extendMessageConverters(converters);
}
}
<file_sep>/src/main/java/open/commons/spring/web/utils/PaginationUtils.java
/*
* Copyright 2022 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2022. 2. 10. 오후 5:26:38
*
* Author: <EMAIL>
*
*/
package open.commons.spring.web.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.validation.constraints.NotNull;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort.Order;
import open.commons.core.utils.ExceptionUtils;
import open.commons.spring.web.mvc.service.AbstractMvcService;
/**
* 검색결과 Pagination 기능 제공 클래스.
*
* @since 2022. 2. 10.
* @version 0.4.0
* @author <EMAIL>
*/
public class PaginationUtils {
private PaginationUtils() {
}
/**
* {@link Pageable}에서 읽을 데이터 개수를 제공합니다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 12. 9. 박준홍 최초 작성
* 2022. 2. 10. 박준홍 {@link AbstractMvcService}.limit(Pageable)에서 이관시킴.
* </pre>
*
* @param pageable
* @return
*
* @since 2021. 12. 9.
* @version 0.4.0
* @author Park_Jun_Hong (<EMAIL>)
*/
public static int limit(@NotNull Pageable pageable) {
return pageable.getPageSize();
}
/**
* {@link Pageable}에서 데이터 시작위치를 제공합니다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 12. 9. 박준홍 최초 작성
* 2022. 2. 10. 박준홍 {@link AbstractMvcService}.offset(Pageable)에서 이관시킴.
* </pre>
*
* @param pageable
* @return
*
* @since 2021. 12. 9.
* @version 0.4.0
* @author Park_Jun_Hong (<EMAIL>)
*/
public static int offset(@NotNull Pageable pageable) {
return pageable.getPageNumber() * pageable.getPageSize();
}
/**
* {@link Pageable}에서 쿼리 조회 결과 정렬 기준을 제공합니다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 12. 9. 박준홍 최초 작성
* 2022. 2. 10. 박준홍 {@link AbstractMvcService}.orderBy(Pageable)에서 이관시킴.
* </pre>
*
* @param pageable
* @return
*
* @since 2021. 12. 9.
* @version 0.4.0
* @author Park_Jun_Hong (<EMAIL>)
*
* @see #orderBy(String...)
*/
public static String[] orderBy(@NotNull Pageable pageable) {
return pageable.getSort().stream() //
.map(sort -> String.join(" ", sort.getProperty(), sort.getDirection().toString())) //
.collect(Collectors.toList())//
.toArray(new String[0]);
}
/**
* DBMS 정렬쿼리를 Pagination 정렬 조건으로 변환하여 제공합니다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 12. 28. 박준홍 최초 작성
* 2022. 2. 10. 박준홍 {@link AbstractMvcService}.orderBy(String...)에서 이관시킴.
* </pre>
*
* @param orderByArgs
* @return
*
* @since 2021. 12. 28.
* @version 0.4.0
* @author <EMAIL>
*
* @see #orderBy(Pageable)
*/
public static List<Order> orderBy(String... orderByArgs) {
return orderByArgs != null //
? Stream.of(orderByArgs).map(orderBy -> {
String[] strs = orderBy.split(" ");
if (strs.length == 1) {
return Order.asc(strs[0]);
} else {
switch (strs[1].toLowerCase()) {
case "asc":
return Order.asc(strs[0]);
case "desc":
return Order.desc(strs[0]);
default:
throw ExceptionUtils.newException(UnsupportedOperationException.class, "지원하지 않는 정보입니다. 허용=(asc,desc), 입력=%s", strs[1]);
}
}
}).collect(Collectors.toList()) //
: new ArrayList<>() //
;
}
}
<file_sep>/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>open.commons</groupId>
<artifactId>open-commons-spring-web</artifactId>
<version>0.5.0</version>
<name>Open Commons for Spring Web</name>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<!-- >>> begin: plugin dependencies -->
<build.finalName>open-commons-spring-web-${project.version}</build.finalName>
<encoding>UTF-8</encoding>
<java.version>1.8</java.version>
<compile.encoding>UTF-8</compile.encoding>
<compile.source.version>1.8</compile.source.version>
<compile.target.version>1.8</compile.target.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
<!-- >>> end: plugin dependencies -->
<!-- >>> begin: dependencies -->
<spring-core.version>[5.3.23]</spring-core.version>
<spring-boot.version>2.5.3</spring-boot.version>
<slf4j-api.version>1.7.32</slf4j-api.version>
<reflections.version>0.9.11</reflections.version>
<servlet-api.version>2.5</servlet-api.version>
<httpclient.version>[4.5.13,)</httpclient.version>
<open-commons-core.version>2.0.0-SNAPSHOT</open-commons-core.version>
<open-commons-ssh.version>0.3.0-SNAPSHOT</open-commons-ssh.version>
<!-- <<< end: dependencies -->
</properties>
<distributionManagement>
<repository>
<id>releases</id>
<name>Release Repository</name>
<url>http://nexus3.ymtech.co.kr/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot Repository</name>
<url>http://nexus3.ymtech.co.kr/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<!-- ===== -->
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>ymtech-maven-repo</id>
<name>YMTECH Maven Repository</name>
<url>http://nexus3.ymtech.co.kr/repository/maven-public/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<!-- >>> Maven Central -->
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<!-- ********************** -->
<!-- begin: spring-framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring-core.version}</version>
</dependency>
<!-- end: spring-framework -->
<!-- ********************** -->
<!-- ********************** -->
<!-- begin: spring boot -->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<!-- end: spring boot -->
<!-- ********************** -->
<!-- ********************** -->
<!-- begin: Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<!-- end: Spring Security -->
<!-- ********************** -->
<!-- ************** -->
<!-- begin: Pagination -->
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<!-- end: Pagination -->
<!-- ************** -->
<!-- ************** -->
<!-- begin: validation -->
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!-- end: validation -->
<!-- ************** -->
<!-- ********************** -->
<!-- begin: slf4j -->
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<!-- end: slf4j -->
<!-- ********************** -->
<!-- ********************** -->
<!-- begin: refletions -->
<!-- https://mvnrepository.com/artifact/org.reflections/reflections -->
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>${reflections.version}</version>
</dependency>
<!-- end: reflections -->
<!-- ********************** -->
<!-- ************** -->
<!-- begin: httpclient -->
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<!-- end: httpclient -->
<!-- ************** -->
<!-- ************** -->
<!-- begin: servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<!-- end: servlet -->
<!-- ************** -->
<!-- ************** -->
<!-- begin: open.commons -->
<dependency>
<groupId>open.commons</groupId>
<artifactId>open-commons-core</artifactId>
<version>${open-commons-core.version}</version>
</dependency>
<dependency>
<groupId>open.commons</groupId>
<artifactId>open-commons-ssh</artifactId>
<version>${open-commons-ssh.version}</version>
</dependency>
<!-- end: open.commons -->
<!-- ************** -->
<!-- ************** -->
<!-- begin: swagger - API Automation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!-- end: swagger - API Automation -->
<!-- ************** -->
</dependencies>
<build>
<finalName>${build.finalName}</finalName>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>LICENSE</include>
</includes>
<targetPath>META-INF</targetPath>
</resource>
</resources>
<plugins>
<!-- >>> begin: compile -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<encoding>${compile.encoding}</encoding>
<source>${compile.source.version}</source>
<target>${compile.target.version}</target>
</configuration>
</plugin>
<!-- <<< end: compile -->
<!-- >>> begin: source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <<< end: source -->
<!-- >>> begin: javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<goal>deploy</goal>
<show>private</show>
<nohelp>true</nohelp>
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
<charset>${encoding}</charset>
<docencoding>${encoding}</docencoding>
<encoding>${encoding}</encoding>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <<< end: javadoc -->
</plugins>
</build>
<scm>
<url>https://github.com/parkjunhong/open-commons-spring-web</url>
<developerConnection><EMAIL></developerConnection>
</scm>
</project><file_sep>/src/main/java/open/commons/spring/web/mvc/service/AbstractSshService.java
/*
* Copyright 2020 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2020. 11. 26. 오후 5:33:33
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.mvc.service;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;
import org.springframework.beans.factory.annotation.Value;
import open.commons.core.function.TripleFunction;
import open.commons.core.utils.MapUtils;
import open.commons.spring.web.servlet.InternalServerException;
import open.commons.ssh.SshConnection;
import com.jcraft.jsch.Session;
/**
* SSH기반의 통신 기능을 제공한다.
*
* @since 2020. 11. 26.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*/
public class AbstractSshService extends AbstractGenericService {
/**
* {@link SshConnection} 식별정보 제공 함수.
* <ul>
* <li>user: username
* <li>host: Host IP or Domain Name
* <li>port: Port
* </ul>
*/
protected static final TripleFunction<String, String, Integer, String> SSH_CONNECTION_KEY_GEN = (user, host, port) -> {
return String.join(":", user, host, String.valueOf(port));
};
/** {@link Session} 생성을 위한 Mutex 객체 */
protected final ReentrantLock mutexSession = new ReentrantLock();
/**
* 접속 서버별로 관리되는 {@link Session} 정보.
* <ul>
* <li>key: sessin key
* <li>value: {@link Session} instance
* </ul>
*/
protected ConcurrentSkipListMap<String, SshConnection> sessions = new ConcurrentSkipListMap<>();
/**
* SSH 접속대기 제한시간. 단위: ms
*/
@Value("${application.ssh.connect-timeout}")
protected int connectTimeout;
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2020. 11. 26. 박준홍 최초 작성
* </pre>
*
* @since 2020. 11. 26.
*/
public AbstractSshService() {
}
protected SshConnection getConnection(String username, String password, String host, int port) {
ReentrantLock lock = this.mutexSession;
try {
lock.lock();
Supplier<SshConnection> supplier = () -> new SshConnection(username, password, host, port);
return MapUtils.getOrDefault(this.sessions, SSH_CONNECTION_KEY_GEN.apply(username, host, port), supplier, true);
} catch (Exception e) {
logger.error("SSH 세션 생성 도중 에러가 발생하였습니다. username={}, host={}, port={}, 원인={}", username, host, port, e.getMessage(), e);
throw new InternalServerException(e);
} finally {
lock.unlock();
}
}
}
<file_sep>/history.md
[2023/05/18]
- Release: 0.5.0
[2023/05/12]
- Update
+ open.commons.spring.web.rest.RestUtils2
+ exchange(Supplier<ResponseEntity<RES>>, HttpMethod, URI, int, HttpEntity<REQ>, Object, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>): 에러 로그 추가
[2023/03/06]
- Add
+ open.commons.spring.web.rest.RestUtils2
+ exchange(RestTemplate, HttpMethod, String, String, int, String, int, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
+ exchange(RestTemplate, HttpMethod, String, String, int, String, int, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
+ exchange(RestTemplate, HttpMethod, String, String, int, String, String, int, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
+ exchange(RestTemplate, HttpMethod, String, String, int, String, String, int, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
+ exchange(RestTemplate, HttpMethod, URI, int, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
+ exchange(RestTemplate, HttpMethod, URI, int, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
+ exchange(Supplier<ResponseEntity<RES>>, HttpMethod, URI, int, HttpEntity<REQ>, Object, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
[2022/12/01]
- Add
+ open.commons.spring.web.servlet.NotFoundException
[2022/11/29]
- Add
+ open.commons.spring.web.mvc.service.IConvertingService.transformAll(S, Class<T>):
- Delete
+ open.commons.spring.web.mvc.service.IConvertingService.transferAll(S, Class<T>):
[2022/11/25]
- Add
+ open.commons.spring.web.mvc.service.IConvertingService
+ convertMultiResult(Result<List<S>>, Class<T>)
+ convertSingleResult(Result<S>, Class<T>)
+ transferAll(S, Class<T>)
[2022/11/17]
- Dependencies
+ spring-core.version: 5.3.23 고정
[2022/05/04]
- New
+ open.commons.spring.web.utils.ArgumentsUtils: Application Argument에 대한 지원 기능을 제공.
[2022/05/04]
- Add
+ open.commons.spring.web.mvc.service.AbstractComponent
+ getMultiValuesArgument(ApplicationArguments, String, Class<T>)
+ getMultiValuesArguments(ApplicationArguments, Map<String, Class<?>>)
+ getSingleValueArgument(ApplicationArguments, String, Class<T>)
+ getSingleValueArguments(ApplicationArguments, Map<String, Class<?>>)
[2022/04/07]
- Release: 0.5.0-SNAPSHOT
- Tag: 0.4.0
- Dependencies:
+ open.commons.core: 2.0.0-SNAPSHOT
[2022/04/07]
- Release: 0.4.0
[2022/02/11]
- Modify
+ open.commons.spring.web.mvc.service.AbstractMvcService: SearchResultType에 따라서 Pageable 값 자동 조정
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable)
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(SearchResultType, P, Function<P, Result<Integer>>, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
[2022/02/10]
- Add
+ open.commons.spring.web.utils.PaginationUtils
[2022/01/26]
- Add
+ open.commons.spring.web.mvn.service.AbstractMvcService
+ transform(S, boolean, T, boolean)
+ transform(S, T)
[2022/01/10]
- Add
+ open.commons.spring.web.mvc.service.AbstractMvcService
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable)
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(P, Function<P, Result<Integer>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable)
+ selectMultiPagination(P, Function<P, Result<Integer>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(P, Function<P, Result<Integer>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMultiPagination(P, Function<P, Result<Integer>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Function<E, D>)
+ selectMultiPagination(P, Supplier<Result<Integer>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int)
+ selectMultiPagination(P, Supplier<Result<Integer>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Function<E, D>)
+ selectMultiPagination(SearchResultType, P, Function<P, Result<Integer>>, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(Supplier<Result<Integer>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int)
+ selectMultiPagination(Supplier<Result<Integer>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int, Function<E, D>)
+ selectMultiPagination(Supplier<Result<Integer>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, Pageable, Function<E, D>)
+ selectMultiPagination(Supplier<Result<Integer>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMultiPagination(Supplier<Result<Integer>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String[], Function<E, D>)
[2021/12/29]
- Modify
+ open.commons.spring.web.mvc.service.AbstractMvcService: DTO Class<?> 파라미터 제거
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String[], Function<E, D>)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Function<E, D>)
+ selectMulti(SearchResultType, P, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Function<E, D>)
+ selectMulti(SearchResultType, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int, Function<E, D>)
+ selectMultiPagination(SearchResultType, P, Function<P, Result<Integer>>, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Function<E, D>)
+ selectMultiPagination(SearchResultType, P, Supplier<Result<Integer>>, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Function<E, D>)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String[], Function<E, D>)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int, Function<E, D>)
+ open.commons.spring.web.mvc.service.IConvertingService: 변환 이후 Class<?> 파라미터 제거
+ convertMultiPaginationResult(Result<Page<S>>, Function<S, T>)
+ convertMultiResult(List<S>, Function<S, T>)
+ convertMultiResult(Result<List<S>>, Function<S, T>)
+ convertMultiResultAsStream(List<S>, Function<S, T>)
+ convertSingleResult(Result<S>, Function<S, T>)
[2021/12/29]
- Add
+ open.commons.spring.web.mvc.service.AbstractMvcService
+ executePagination(Supplier<Result<List<E>>>, Supplier<Result<Integer>>, int, int, String[])
+ orderBy(String...)
+ selectMultiPagination(SearchResultType, P, Function<P, Result<Integer>>, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMultiPagination(SearchResultType, P, Function<P, Result<Integer>>, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
+ selectMultiPagination(SearchResultType, P, Supplier<Result<Integer>>, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int)
+ selectMultiPagination(SearchResultType, P, Supplier<Result<Integer>>, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int)
+ selectMultiPagination(SearchResultType, Supplier<Result<Integer>>, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
+ open.commons.spring.web.mvc.service.IConvertingService
+ convertMultiPaginationResult(Result<Page<S>>, Class<T>, Function<S, T>)
[2021/12/24]
- Add
+ open.commons.spring.web.mvc.service.AbstractMvcService
+ save(List<D>, Class<E>, Function<D, E>, Function<List<E>, Result<Integer>>): DTO -> Entity로 저장하는 함수.
[2021/12/22]
- Add
+ open.commons.spring.web.mvc.service.AbstractMvcService
+ transform(S, boolean, Class<T>, boolean)
+ transform(S, Class<T>)
[2021/12/20]
- Bugfix
+ open.commons.spring.web.rest.RestApiDecl
+ getBody()
+ getHeaders()
[2021/12/16]
- Add
+ open.commons.spring.web.validation.EnumConstraintValidator<C extends Annotation, T extends Enum<T>>: Enum<T> 데이터를 검증하는 상위 클래스 정의
[2021/12/15]
- Add
+ open.commons.spring.web.mvc.service.AbstractComponent
+ streamOf(boolean, T...)
+ streamOf(String, String, T...)
- <strike>Add
+ open.commons.spring.web.mvc.service.AbstractMvcService
+ streamOf(boolean, T...)
+ streamOf(String, String, T...)</strike>
[2021/12/10]
- Add
+ open.commons.spring.web.mvc.service.AbstractMvcService
- Delete
+ open.commons.spring.web.mvc.service.AbstractGenericService: 아래 메소드를 'open.commons.spring.web.mvc.service.AbstractMvcService'로 이관.
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
+ selectMulti(SearchResultType, P, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int)
+ selectMulti(SearchResultType, P, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
+ selectMulti(SearchResultType, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int)
+ selectMulti(SearchResultType, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
[2021/12/09]
- Modify
+ open.commons.spring.web.mvc.service.AbstractGenericService: 파라미터 순서 변경
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMulti(SearchResultType, P, BiFunction<P, String[], Result<List<E>>>, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
+ selectMulti(SearchResultType, P, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int)
+ selectMulti(SearchResultType, P, Function<P, Result<List<E>>>, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
- Add
+ open.commons.spring.web.mvc.service.AbstractGenericService
+ selectMulti(SearchResultType, BiFunction<P, String[], Result<List<E>>>, P, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMulti(SearchResultType, BiFunction<P, String[], Result<List<E>>>, P, QuadFunction<P, Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String...)
+ selectMulti(SearchResultType, Function<String[], Result<List<E>>>, TripleFunction<Integer, Integer, String[], Result<List<E>>>, int, int, String[], Class<D>, Function<E, D>)
[2021/12/08]
- Add
+ open.commons.spring.web.mvc.service.AbstractGenericService
+ selectMulti(SearchResultType, Function<P, Result<List<E>>>, P, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int)
+ selectMulti(SearchResultType, Supplier<Result<List<E>>>, BiFunction<Integer, Integer, Result<List<E>>>, int, int)
- Update
+ open.commons.spring.web.config.CustomWebMvcConfigurer
+ addFormatters(FormatterRegistry): Enum 검색 패키지 확장.
- 'open.commons' 기본값으로 설정.
[2021/12/06]
- Update
+ open.commons.spring.web.mv.service.AbstractGenericService
+ implements open.commons.spring.web.mv.service.IConvertingService
+ selectMulti(SearchResultType, Function<P, Result<List<E>>>, P, TripleFunction<P, Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
+ selectMulti(SearchResultType, Function<Result<List<E>>>, P, BiFunction<Integer, Integer, Result<List<E>>>, int, int, Class<D>, Function<E, D>)
- New
+ open.commons.spring.web.mv.service.IConvertingService
+ convertMultiResultAsStream(List<S>, Class<T>, Function<S, T>)
[2021/12/03]
- New
+ open.commons.spring.web.mv.service.IConvertingService
[2021/11/16]
- Add
+ open.commons.spring.web.mv.service.CliExecutionComponent
[2021/11/09]
- Add
+ open.commons.spring.web.mvn.service.AbstractComponent
+ execute(Consumer<T>, T, String)
+ execute(Function<T, R>, T, String)
+ execute(Runner, String)
[2021/10/04]
- Updated
+ open.common.spring.web.rest.RestApiDecl: 설정 데이터 변경을 막기 위한 조치.
+ getHeaders()
+ getMethod()
+ setBody(MultiValueMap<String, Object>)
+ setHeaders(MultiValueMap<String, String>)
[2021/10/04]
- Add
+ open.commonad.spring.web.mvc.service.AbstractComponent
- execute(Supplier<T>, String)
[2021/09/16]
- Bugfix
+ open.commons.spring.web.event.AbstractEventDrivenMonitor.UnsubscriedParametersClosure
+ contains(String, Object): 포함 여부 변수의 혼용사용에 따른 버그 수정
[2021/09/09]
- Add
+ open.common.spring.web.event
+ AbstractEventDrivenMonitor
+ IEventDrivenService
[2021/09/09]
- Modify
+ open.commons.spring.web.config.ResourceConfiguration.createThreadPoolTaskExecutor(ThreadPoolTaskExecutorConfig, String)
- 내부 구현 변경.
- Changed
+ open.commons.spring.web.event.IEventStatus <- open.commons.spring.web.event.IEventType
+ getStatus() <- getType()
- Add
+ open.commons.spring.web.event
+ AbstractEventObject<T, E extends IEventType>
+ IEventObject<T, E extends IEventType>
+ IEventType
- Release: 0.4.0-SNAPSHOT
- Release: 0.3.0
[2021/08/24]
- Add
+ open.commons.spring.web.mvc.service.AbstractComponent
+ error(String)
+ error(String, Object...)
+ error(T, String)
+ error(T, String, Object...)
+ success(T, String)
+ success(T, String, Object...)
[2021/08/20]
- bugfix
+ Bean Name 설정
+ open.commons.spring.web.config.getRestTemplateRequestFactoryResource()
+ open.commons.spring.web.config.getThreadPoolTaskExecutorConfig()
+ Qualifier 설정
+ open.commons.spring.web.config.RestTemplateRequestFactoryResource
+ open.commons.spring.web.config.ThreadPoolTaskExecutorConfig
[2021/08/19]
- Add
+ open.commons.spring.web.config.createThreadPoolTaskExecutor(ThreadPoolTaskExecutorConfig, String)
[2021/07/05]
- New
+ open.commons.spring.web.validation.CustomConstraintValidator<A extends Annotation, T>
- Modify
+ open.commons.spring.web.rest.RestUtils2
- exchange(Supplier<ResponseEntity<RES>>, HttpMethod, URI, HttpEntity<REQ>, Object, Function<ResponseEntity<RES>, Result<RET>>, Function<Exception, Result<RET>>)
- __CVE-2020-13956__
Vulnerable versions: < 4.5.13
Patched version: 4.5.13
Apache HttpClient versions prior to version 4.5.13 and 5.0.3 can misinterpret malformed authority component in request URIs passed to the library as java.net.URI object and pick the wrong target host for request execution.
```
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>[4.5.13,)</version>
</dependency>
```
[2021/06/11]
- New
+ open.commons.spring.web.validation.CustomConstraintValidator<A extends Annotation, T>
[2021/06/11]
- Add
+ open.commons.spring.web.rest.RestUtils2 추가
- 기존 RestUtils의 메소드 정의 확장: REQ, RES -> REQ, RES, RET
- REQ: Http Reqeust Entity T ype
- RES: Http Response Type
- RET: REST API를 연동한 메소드에거 제공할 데이타 타입.
- deprecated
+ open.commons.spring.web.rest.RestUtils
- exchange(RestTemplate, HttpMethod, String, String, int, String, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, String, String, int, String, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, String, String, int, String, String, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, String, String, int, String, String, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, URI, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, URI, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
[2021/04/23]
- Add
+ open.commons.spring.web.mvn.IAsyncJobHandler
- getAsyncManagerHolder()
- register(K, Future<?>)
- unregister(K)
[2021/01/13]
- New
+ open.commons.spring.web.mvc.IAsyncJobHanlder
- Deprecated
+ open.commons.spring.web.mvc.service.IAsyncHandlerService
[2020/12/09]
- Update
+ open.commons.spring.web.config.ResourceConfiguration
- getRequestFactory(HttpClient, RestTemplateRequestFactoryResource): access modifier 변경 (private -> public static)
- getRestTemplate(): @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS) 적용
- getRestTemplateAllowPrivateCA(): @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS) 적용
+ open.commons.spring.web.rest.RestUtils
- createHttpsClient(boolean): HttpClientConnection을 Thread-Safe 하게 생성하기 위한 HttpClientConnectionManager 변경
* BasicHttpClientConnectionManager -> PoolingHttpClientConnectionManager
[2020/11/26]
- New
+ open.commons.spring.web.mvc.service.IAsyncHandlerService
+ open.commons.spring.web.mvc.service.AbstractSshService
- Add
+ open.commons.spring.web.rest.RestUtils
- exchange(Supplier<ResponseEntity<RES>>, HttpMethod, URI, HttpEntity<REQ>, Object, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- Update
+ open.commons.spring.web.rest.RestUtils
- exchange(RestTemplate, HttpMethod, URI, HttpEntity<REQ>, Class<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, URI, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- Delete
+ open.commons.spring.web.rest.RestUtils
- createArrayResponseType(Class<T>)
- createResponseType(Class<T>)
- Deprecated
+ open.commons.spring.web.mvc.service.AsyncHandlerService
[2020/11/23]
- Add
+ open.commons.spring.web.rest.RestUtils
- createArrayResponseType(Class<T>)
- createClient()
- createHttpsClient(boolean)
- createRegistryBuilder(boolean)
- createResponseType(Class<T>)
- Update
+ open.commons.spring.web.config.ResourceConfiguration
- getRestTemplateAllowPrivateCA() <- getRestTemplateIgnoreHostNameVerification(): 메소드 이름변경
[2020/11/21]
- Add
+ open.commons.spring.web.config.ResourceConfiguration
- getRequestFactory(HttpClient): ClientHttpRequestFactory 제공함수 별도 분리
- getRestTemplateIgnoreHostNameVerification(): 호스트명 확인 무시 RestTemplate 제공
[2020/11/19]
- Add
+ open.commons.spring.web.rest.RestUtils
- exchange(RestTemplate, HttpMethod, String, String, int, String, HttpEntity<REQ>, ParameterizedTypeReference<RES>)
- exchange(RestTemplate, HttpMethod, String, String, int, String, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, String, String, int, String, String, HttpEntity<REQ>, ParameterizedTypeReference<RES>)
- exchange(RestTemplate, HttpMethod, String, String, int, String, String, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
- exchange(RestTemplate, HttpMethod, URI, HttpEntity<REQ>, ParameterizedTypeReference<RES>, Function<ResponseEntity<RES>, Result<RES>>, Function<Exception, Result<RES>>)
[2020/11/11]
- Add
+ open.commons.spring.web.mvc.service.AsyncHandlerService: 비동기(Future<V> 반환)로 수행하는 메소드를 제어하는 기능 제공
- Modify
+ open.commons.spring.web.handler.DefaultGlobalInterceptor: 상위 클래스 변경
- HandlerInterceptorAdapter(Deprecated) -> AsyncHandlerInterceptor
- Update
+ open.commons.spring.web.swagger.SpringfoxSwaggerConfig:
- getSwaggerApiInfo(): 직접 구현
[2020/11/10]
- Dependencies
+ open.commons.core: 1.8.0-SNAPSHOT
[2020/10/21]
- Add
+ open.commons.spring.web.swagger
- SpringfoxSwaggerConfig: API 설정 클래스.
- SwaggerApiInfo: API 정의 클래스.
[2020/10/21]
- Add
+ open.commons.spring.web.rest.RestUtils
- queryParameters(MultiValueMap<String, Object>)
- queryParameters(String...)
[2020/09/05]
- Add
+ open.commons.spring.web.springfox.swagger.SpringfoxSwagger
- springfox-swagger, springfox-swagger-ui 를 위한 설정
- Update
+ open.commons.spring.web.config.CustomWebMvcConfigurer
- Spring Security 자동 설정 방지 추가: @SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
[2020/09/04]
- Add
+ open.commons.spring.web.config.SpringfoxSwaggerWebSecurityConfigurer
[2020/09/03]
- Add
+ pom.xml: swagger2 적용
- Update
+ open.commons.spring.web.config
- swagger2 적용
[2020/08/27]
- Add
+ open.commons.spring.web.rest
- RestApiDecl.java
- RestApiServer.java
- Update
+ open.commons.spring.web.rest
- RestUtils.java
[2020/07/30]
- Tag: 0.3.0-SNAPSHOT
- Add
+ open.commons.spring.web.servlet.BadRequestException
+ open.commons.spring.web.servlet.InternalServerException
- Update
+ open.commons.spring.web.servlet.method.annotation.DefaultGlobalExceptionHandler
+ handle4xxException(Exception, WebRequest): 대상 추가
+ open.commons.spring.web.servlet.BadRequestException
+ handle5xxException(Exception, WebRequest): 대상 추가
+ open.commons.spring.web.servlet.InternalServerException
[2020/02/13]
- Tag: 0.2.4-SNAPSHOT
[2020/02/13]
- Release: 0.2.3
- Add
+ open.commons.spring.web.BasePackageMarker
+ open.commons.spring.web.handler.DefaultGlobalInterceptor
+ open.commons.spring.web.mvc.service.AbstractComponent
+ open.commons.spring.web.mvc.service.AbstractGenericService
+ open.commons.spring.web.servlet.method.annotation.DefaultGlobalExceptionHandler
- Update
+ open.commons.spring.web.OpenCommonsSpringWeb
+ open.commons.spring.web.annotation.CustomHttpMessageconverter
+ open.commons.spring.web.config.ResourceConfiguration
+ open.commons.spring.web.mvc.support.UrlInfo
+ open.commons.spring.web.resources.ThreadPoolTaskExecutorConfig
[2019/10/23]
- Add
+ open.commons.spring.web.rest.RestUtils
[2019/10/15]
- Add
+ open.commons.spring.web.validation.ValidationTarget
[2019/10/10]
- Add
+ open.commons.spring.web.validation.Validational<C extends List<E>, E extends Validational<List<E>, E>>
[2019/10/08]
- Release: 0.2.2-RELEASE
- Tag: 0.2.3-SNAPSHOT
- Add
+ open.commons.spring.web.utils.ValidationUtils
[2019/9/20]
- Update
+ open.commons.spring.web.resources.ThreadPoolTaskExecutorConfig.maxPoolSize 기본값 변경
- 30 -> Integer.MAX_VALUE
[2019/9/18]
- Release: 0.2.1
- Tag: 0.2.2-SNAPSHOT
[2019/9/9]
- Add
+ open.commons.spring.web.OpenCommonsSpringWeb
[2019/9/8]
- Tag: 0.2.1-SNAPSHOT
- Add
+ open.commons.spring.web.config.CustomWebMvcConfigurer.extendMessageConverters(List<HttpMessageConverter<?>>)
[2019/8/7]
- Dependency
+ open.commons.core: 1.6.12
[2019/7/17]
- Release: 0.2.0
- Add
+ open.commons.spring.web.resources.ThreadPoolTaskExecutorConfig
- Dependency
+ open.commons.core: 1.6.11
[2019/7/4]
- Dependency
+ open.commons.core: 1.6.10
[2019/7/1]
- Bugfix
+ open.commons.spring.web.config.CustomWebMvcConfigurer.addFormatters(FormatterRegistry)
[2019/6/28]
- Release: 0.1.1
- Add
+ open.commons.spring.web.servlet.mvn.support
+ open.commons.spring.web.utils.WebUtils
- Dependency
+ javax.servlet.servlet-api
+ open.commons.core
[2019/6/27]
- Release: 0.1.0
- Add
+ open.commons.spring.web.config.ResourceConfiguration
+ open.commons.spring.web.resources.RestTempalteReqeust
[2019/06/11]
- Release: 0.0.3
+ 사용자 정의 HandlerInterceptor 자동 등록 추가
[2019/06/07]
- Release: 0.0.2
+ 다중 패키지 지원
+ application.yml (.properties or ...) 항목명 수정.
+ Bean 등록방법 추가
[2019/06/03]
- Release: 0.0.1
<file_sep>/src/main/java/open/commons/spring/web/utils/ArgumentsUtils.java
/*
* Copyright 2022 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2022. 8. 10. 오전 11:43:49
*
* Author: <EMAIL>
*
*/
package open.commons.spring.web.utils;
import java.util.List;
import org.apache.logging.log4j.ThreadContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.DefaultApplicationArguments;
import open.commons.core.log4j.appender.ProcessRollingFileAppender;
/**
* Application Argument에 대한 지원 기능을 제공.
*
* @since 2022. 8. 10.
* @version 0.5.0
* @author <EMAIL>
*/
public class ArgumentsUtils {
public static final ArgumentsUtils INSTANCE = new ArgumentsUtils();
private ArgumentsUtils() {
}
/**
* 이름에 해당하는 옵션 값을 제공합니다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 8. 10. 박준홍 최초 작성
* </pre>
*
* @param args
* @param name
* @return
*
* @since 2022. 8. 10.
* @author Park_Jun_Hong (<EMAIL>)
*/
public String getOptionValue(DefaultApplicationArguments args, String name) {
List<String> values = args.getOptionValues(name);
return values != null && values.size() > 0 //
? values.get(0) //
: null;
}
/**
* {@link Logger} 생성시 외부 설정정보를 적용합니다.<br>
* 예를 들어, 로그 파일명에 프로그램 실행시 전달받는 파라미터를 적용하고자 할 때. <br>
*
* 사용 예시는 {@link ProcessRollingFileAppender} 를 참조하기 바랍니다.
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2022. 8. 10. 박준홍 최초 작성
* </pre>
*
* @param loggerName
* {@link Logger} 이름.
* @param argName
* 파라미터 이름
* @param args
* 외부 파라미터
*
* @return
*
* @since 2022. 8. 10.
* @version 0.5.0
* @author <NAME> <EMAIL>
*/
public Logger setLoggerContextUsingApplicationExternalConfiguration(Class<?> loggerName, String argName, String[] args) {
DefaultApplicationArguments argObj = new DefaultApplicationArguments(args);
String context = getOptionValue(argObj, argName);
ThreadContext.put(ProcessRollingFileAppender.PROCESS_CONTEXT, context);
Logger logger = LoggerFactory.getLogger(loggerName);
logger.info("log4j2.{}={}", ProcessRollingFileAppender.PROCESS_CONTEXT, context);
return logger;
}
}
<file_sep>/README.md
# open-commons-spring-web
Open Commons for Spring Web on Spring 5 & Spring Boot
# History
See [history.md](./history.md).
# Wiki
See [wiki](https://github.com/parkjunhong/open-commons-spring-web/wiki).<file_sep>/src/main/java/open/commons/spring/web/event/IEventStatus.java
/*
* Copyright 2021 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2021. 9. 9. 오전 11:08:07
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.event;
/**
* 이벤트 상태 관련 기능 정의.
*
* @since 2021. 9. 9.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*/
public interface IEventStatus {
/**
* 이벤트 상태 정보를 제공한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 9. 9. 박준홍 최초 작성
* </pre>
*
* @return
*
* @since 2021. 9. 9.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*/
public String getStatus();
}
<file_sep>/src/main/java/open/commons/spring/web/event/IEventObject.java
/*
* Copyright 2021 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2021. 9. 9. 오전 11:09:38
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.event;
/**
* 이벤트 객체 기능 정의.
*
* @param <T>
* 이벤트 정보.
* @param <E>
* 이벤트 상태 정보.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*/
public interface IEventObject<T, E extends IEventStatus> extends Cloneable {
/**
* 해당 객체와 동일한 정보를 가진 객체를 제공한다.
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 9. 9. 박준홍 최초 작성
* </pre>
*
* @return
* @throws CloneNotSupportedException
*
* @since 2021. 9. 9.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*
* @see java.lang.Object#clone()
*/
public Object clone() throws CloneNotSupportedException;
/**
* 이벤트를 발생시킨 데이터를 제공한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 9. 9. 박준홍 최초 작성
* </pre>
*
* @return
*
* @since 2021. 9. 9.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*/
public T getSource();
/**
* 이벤트 상세타입 정보를 제공한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2021. 9. 9. 박준홍 최초 작성
* </pre>
*
* @return
*
* @since 2021. 9. 9.
* @version 0.4.0
* @author Park_Jun_Hong_(<EMAIL>)
*/
public E getType();
}
<file_sep>/src/main/java/open/commons/spring/web/servlet/mvc/support/UrlInfo.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2019. 6. 28. 오전 10:50:20
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.servlet.mvc.support;
import java.util.Map;
/**
* Generatl URL Information.
*
* @since 2019. 6. 28.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
public class UrlInfo {
private final String method;
private final String url;
private final String urlPattern;
private final Object variables;
private final Map<String, Object> parameters;
/**
*
* @since 2019. 6. 28.
*/
public UrlInfo(String method, String url, String urlPattern, Object variables, Map<String, Object> parameters) {
this.method = method;
this.url = url;
this.urlPattern = urlPattern;
this.variables = variables;
this.parameters = parameters;
}
/**
*
* @return the method
*
* @since 2019. 6. 28.
*
* @see #method
*/
public String getMethod() {
return method;
}
/**
*
* @return the parameters
*
* @since 2019. 6. 28.
*
* @see #parameters
*/
public Map<String, Object> getParameters() {
return parameters;
}
/**
*
* @return the url
*
* @since 2019. 6. 28.
*
* @see #url
*/
public String getUrl() {
return url;
}
/**
*
* @return the urlPattern
*
* @since 2019. 6. 28.
*
* @see #urlPattern
*/
public String getUrlPattern() {
return urlPattern;
}
/**
*
* @return the variables
*
* @since 2019. 6. 28.
*
* @see #variables
*/
public Object getVariables() {
return variables;
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UrlInfo [method=");
builder.append(method);
builder.append(", url=");
builder.append(url);
builder.append(", urlPattern=");
builder.append(urlPattern);
builder.append(", variables=");
builder.append(variables);
builder.append(", parameters=");
builder.append(parameters);
builder.append("]");
return builder.toString();
}
}
<file_sep>/src/main/java/open/commons/spring/web/resources/ThreadPoolTaskExecutorConfig.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring-web".
*
* Date : 2019. 7. 17. 오후 4:50:36
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.resources;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
/**
* {@link ThreadPoolTaskExecutor} 설정 정보 클래스.
*
* @since 2019. 7. 17.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
public class ThreadPoolTaskExecutorConfig {
// --- org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor --- //
private int corePoolSize = 1;
private int keepAliveSeconds = 60;
private int maxPoolSize = Integer.MAX_VALUE;
private int queueCapacity = Integer.MAX_VALUE;
private boolean allowCoreThreadTimeOut = false;
// --------------------------------------------- //
// --- org.springframework.scheduling.concurrent.ExecutorConfigurationSupport --- //
private int awaitTerminationSeconds = 0;
private String beanName;
private boolean waitForTasksToCompleteOnShutdown = false;
// ---------------------------------------------------------- //
// --- org.springframework.util.CustomizableThreadCreator --- //
private boolean daemon = false;
private String threadGroupName;
private String threadNamePrefix;
private int threadPriority = Thread.NORM_PRIORITY;
// -------------------------------------------------- //
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @since 2019. 7. 17.
* @version
*/
public ThreadPoolTaskExecutorConfig() {
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the awaitTerminationSeconds
*
* @since 2019. 7. 17.
* @version
*
* @see #awaitTerminationSeconds
*/
public int getAwaitTerminationSeconds() {
return awaitTerminationSeconds;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the beanName
*
* @since 2019. 7. 17.
* @version
*
* @see #beanName
*/
public String getBeanName() {
return beanName;
}
/**
* Return the ThreadPoolExecutor's core pool size. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the corePoolSize
*
* @since 2019. 7. 17.
* @version
*
* @see #corePoolSize
*/
public int getCorePoolSize() {
return corePoolSize;
}
/**
* Return the ThreadPoolExecutor's keep-alive seconds. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the keepAliveSeconds
*
* @since 2019. 7. 17.
* @version
*
* @see #keepAliveSeconds
*/
public int getKeepAliveSeconds() {
return keepAliveSeconds;
}
/**
* Return the ThreadPoolExecutor's maximum pool size. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the maxPoolSize
*
* @since 2019. 7. 17.
* @version
*
* @see #maxPoolSize
* @see java.util.concurrent.ThreadPoolExecutor#getPoolSize()
*/
public int getMaxPoolSize() {
return maxPoolSize;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the queueCapacity
*
* @since 2019. 7. 17.
* @version
*
* @see #queueCapacity
*/
public int getQueueCapacity() {
return queueCapacity;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the threadGroupName
*
* @since 2019. 7. 17.
* @version
*
* @see #threadGroupName
*/
public String getThreadGroupName() {
return threadGroupName;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the threadNamePrefix
*
* @since 2019. 7. 17.
* @version
*
* @see #threadNamePrefix
*/
public String getThreadNamePrefix() {
return threadNamePrefix;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the threadPriority
*
* @since 2019. 7. 17.
* @version
*
* @see #threadPriority
*/
public int getThreadPriority() {
return threadPriority;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the allowCoreThreadTimeOut
*
* @since 2019. 7. 17.
* @version
*
* @see #allowCoreThreadTimeOut
*/
public boolean isAllowCoreThreadTimeOut() {
return allowCoreThreadTimeOut;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the daemon
*
* @since 2019. 7. 17.
* @version
*
* @see #daemon
*/
public boolean isDaemon() {
return daemon;
}
/**
*
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @return the waitForTasksToCompleteOnShutdown
*
* @since 2019. 7. 17.
* @version
*
* @see #waitForTasksToCompleteOnShutdown
*/
public boolean isWaitForTasksToCompleteOnShutdown() {
return waitForTasksToCompleteOnShutdown;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param allowCoreThreadTimeOut
* the allowCoreThreadTimeOut to set
*
* @since 2019. 7. 17.
* @version
*
* @see #allowCoreThreadTimeOut
*/
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param awaitTerminationSeconds
* the awaitTerminationSeconds to set
*
* @since 2019. 7. 17.
* @version
*
* @see #awaitTerminationSeconds
*/
public void setAwaitTerminationSeconds(int awaitTerminationSeconds) {
this.awaitTerminationSeconds = awaitTerminationSeconds;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param beanName
* the beanName to set
*
* @since 2019. 7. 17.
* @version
*
* @see #beanName
*/
public void setBeanName(String beanName) {
this.beanName = beanName;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param corePoolSize
* the corePoolSize to set
*
* @since 2019. 7. 17.
* @version
*
* @see #corePoolSize
*/
public void setCorePoolSize(int corePoolSize) {
this.corePoolSize = corePoolSize;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param daemon
* the daemon to set
*
* @since 2019. 7. 17.
* @version
*
* @see #daemon
*/
public void setDaemon(boolean daemon) {
this.daemon = daemon;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param keepAliveSeconds
* the keepAliveSeconds to set
*
* @since 2019. 7. 17.
* @version
*
* @see #keepAliveSeconds
*/
public void setKeepAliveSeconds(int keepAliveSeconds) {
this.keepAliveSeconds = keepAliveSeconds;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param maxPoolSize
* the maxPoolSize to set
*
* @since 2019. 7. 17.
* @version
*
* @see #maxPoolSize
*/
public void setMaxPoolSize(int maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param queueCapacity
* the queueCapacity to set
*
* @since 2019. 7. 17.
* @version
*
* @see #queueCapacity
*/
public void setQueueCapacity(int queueCapacity) {
this.queueCapacity = queueCapacity;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param threadGroupName
* the threadGroupName to set
*
* @since 2019. 7. 17.
* @version
*
* @see #threadGroupName
*/
public void setThreadGroupName(String threadGroupName) {
this.threadGroupName = threadGroupName;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param threadNamePrefix
* the threadNamePrefix to set
*
* @since 2019. 7. 17.
* @version
*
* @see #threadNamePrefix
*/
public void setThreadNamePrefix(String threadNamePrefix) {
this.threadNamePrefix = threadNamePrefix;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param threadPriority
* the threadPriority to set
*
* @since 2019. 7. 17.
* @version
*
* @see #threadPriority
*/
public void setThreadPriority(int threadPriority) {
this.threadPriority = threadPriority;
}
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 7. 17. 박준홍 최초 작성
* </pre>
*
* @param waitForTasksToCompleteOnShutdown
* the waitForTasksToCompleteOnShutdown to set
*
* @since 2019. 7. 17.
* @version
*
* @see #waitForTasksToCompleteOnShutdown
*/
public void setWaitForTasksToCompleteOnShutdown(boolean waitForTasksToCompleteOnShutdown) {
this.waitForTasksToCompleteOnShutdown = waitForTasksToCompleteOnShutdown;
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ThreadPoolTaskExecutorConfig [corePoolSize=");
builder.append(corePoolSize);
builder.append(", maxPoolSize=");
builder.append(maxPoolSize);
builder.append(", keepAliveSeconds=");
builder.append(keepAliveSeconds);
builder.append(", queueCapacity=");
builder.append(queueCapacity);
builder.append(", allowCoreThreadTimeOut=");
builder.append(allowCoreThreadTimeOut);
builder.append(", awaitTerminationSeconds=");
builder.append(awaitTerminationSeconds);
builder.append(", beanName=");
builder.append(beanName);
builder.append(", waitForTasksToCompleteOnShutdown=");
builder.append(waitForTasksToCompleteOnShutdown);
builder.append(", daemon=");
builder.append(daemon);
builder.append(", threadGroupName=");
builder.append(threadGroupName);
builder.append(", threadNamePrefix=");
builder.append(threadNamePrefix);
builder.append(", threadPriority=");
builder.append(threadPriority);
builder.append("]");
return builder.toString();
}
}
<file_sep>/src/main/java/open/commons/spring/web/annotation/RequestValueConverter.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring5".
*
* Date : 2019. 6. 3. 오후 5:23:26
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.annotation;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* {@link Enum} 타입 중에 URL 처리 메소드에 파라미터로 사용되는 클래스를 생성하는 메소드를 선언.
*
* @since 2019. 6. 3.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
@Documented
@Retention(RUNTIME)
@Target(METHOD)
public @interface RequestValueConverter {
/**
* 대/소문자 파라미터가 있는지 여부를 제공한다. <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 5. 29. 박준홍 최초 작성
* </pre>
*
* @return
*
* @since 2019. 5. 29.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
boolean hasIgnoreCase() default false;
}
<file_sep>/src/main/java/open/commons/spring/web/enums/EnumConverterFactory.java
/*
* Copyright 2019 <NAME>_(<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is generated under this project, "open-commons-spring5".
*
* Date : 2019. 6. 3. 오후 5:27:38
*
* Author: Park_Jun_Hong_(<EMAIL>)
*
*/
package open.commons.spring.web.enums;
import java.util.HashMap;
import java.util.Map;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterFactory;
/**
* {@link Enum} 변환기를 등록/제공하는 클래스.
*
* @since 2019. 6. 3.
* @version
* @author Park_Jun_Hong_(<EMAIL>)
*/
@SuppressWarnings("rawtypes")
public class EnumConverterFactory implements ConverterFactory<String, Enum> {
private Map<Class<?>, Converter<String, Enum>> converters = new HashMap<>();
/**
* <br>
*
* <pre>
* [개정이력]
* 날짜 | 작성자 | 내용
* ------------------------------------------
* 2019. 6. 3. 박준홍 최초 작성
* </pre>
*
* @since 2019. 6. 3.
* @version
*/
public EnumConverterFactory() {
}
/**
* @see org.springframework.core.convert.converter.ConverterFactory#getConverter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@Override
public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) {
return (Converter<String, T>) this.converters.get(targetType);
}
public void register(Class<?> enumType, Converter<String, Enum> converter) {
this.converters.put(enumType, converter);
}
}
| 66d3ff3982497ba3ce4ade3ff01f428de680a92d | [
"Markdown",
"Java",
"Maven POM"
] | 18 | Java | parkjunhong/open-commons-spring-web | 04c71840e762cab0f333057ef61eb12fbe207ca9 | a3d739cd3c2f1eb0fed619d32e2c18c18f3fe81a |
refs/heads/master | <repo_name>Lobo83/ChupiRecetas<file_sep>/persistence/src/test/resources/schema_h2.sql
create table CLIENTE(
ID IDENTITY NOT NULL PRIMARY KEY,
NOMBRE VARCHAR(50),
APELLIDO1 VARCHAR(50),
APELLIDO2 VARCHAR(50)
);
create table DIRECCION(
ID IDENTITY NOT NULL PRIMARY KEY,
CALLE VARCHAR(100),
BLOQUE VARCHAR(10),
PUERTA VARCHAR(10),
ID_CLIENTE INTEGER
);
ALTER TABLE DIRECCION ADD FOREIGN KEY ( ID_CLIENTE ) REFERENCES CLIENTE( ID ) ;<file_sep>/persistence/src/main/java/org/lobo/chupirecetas/persistence/entity/Cliente.java
package org.lobo.chupirecetas.persistence.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.lobo.chupirecetas.persistence.mapper.annotation.MappingId;
@Entity
@Table(name="CLIENTE")
public class Cliente {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ID", unique=true, nullable=false, precision=9)
@MappingId(id="id")
private Long id;
@Column(name="NOMBRE")
@MappingId(id="nombre")
private String nombre;
@Column(name="APELLIDO1")
@MappingId(id="apellido1")
private String apellido1;
@Column(name="APELLIDO2")
@MappingId(id="apellido2")
private String apellido2;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido1() {
return apellido1;
}
public void setApellido1(String apellido1) {
this.apellido1 = apellido1;
}
public String getApellido2() {
return apellido2;
}
public void setApellido2(String apellido2) {
this.apellido2 = apellido2;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((apellido1 == null) ? 0 : apellido1.hashCode());
result = prime * result + ((apellido2 == null) ? 0 : apellido2.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((nombre == null) ? 0 : nombre.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;
Cliente other = (Cliente) obj;
if (apellido1 == null) {
if (other.apellido1 != null)
return false;
} else if (!apellido1.equals(other.apellido1))
return false;
if (apellido2 == null) {
if (other.apellido2 != null)
return false;
} else if (!apellido2.equals(other.apellido2))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (nombre == null) {
if (other.nombre != null)
return false;
} else if (!nombre.equals(other.nombre))
return false;
return true;
}
@Override
public String toString() {
return "Cliente [id=" + id + ", nombre=" + nombre + ", apellido1=" + apellido1 + ", apellido2=" + apellido2
+ "]";
}
}
<file_sep>/persistence/src/main/java/org/lobo/chupirecetas/persistence/dao/JPAClienteDAO.java
package org.lobo.chupirecetas.persistence.dao;
import java.util.List;
import org.lobo.chupirecetas.persistence.entity.Cliente;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @author Lobo
*
*/
//Anotacion Transactional no es requerida ya que por defecto, JpaRepository la tiene pero asi se asegura que traducciones de excepciones jpa en Spring exception, que corre todo dentro de una sola transaccion...
@Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
public interface JPAClienteDAO extends JpaRepository<Cliente,Long> {
//los metodos findByX generan una JPQL Sustituyendo la X por el nombre del parametro y campo dentro de la entidad. Por eso no hace falta definir la query
@Transactional(readOnly=true)
public List<Cliente> findByApellido1(String apellido1);
}
<file_sep>/persistence/src/test/resources/data_h2.sql
insert into cliente (id, nombre, apellido1, apellido2)values(1,'pollo','loco','chungo');
insert into direccion(id, calle, bloque, puerta, id_cliente)values(1,'<NAME>','3','a',1);<file_sep>/persistence/src/main/java/org/lobo/chupirecetas/persistence/mapper/Mapper.java
package org.lobo.chupirecetas.persistence.mapper;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.lobo.chupirecetas.persistence.mapper.annotation.MappingId;
public class Mapper<T, O> {
Class<T> vo;
Class<O> entidad;
public Mapper(Class<T> vo, Class<O> entidad){
this.vo=vo;
this.entidad=entidad;
}
public O mapVO2Entidad(T vo) throws InstantiationException, IllegalAccessException, IntrospectionException, IllegalArgumentException, InvocationTargetException{
O resultado=(O) this.entidad.newInstance();
Map<String,Method> getters = findGetterAndSetters(this.vo,Boolean.TRUE);
Map<String,Method> setters =findGetterAndSetters(this.entidad,Boolean.FALSE);
Set<String> mappingIds = getters.keySet();//getter y setter generan el mismo keyset
for(String id:mappingIds){
Method getter = getters.get(id);
Method setter = setters.get(id);
setter.invoke(resultado, getter.invoke(vo));
}
return resultado;
}
public T mapEntidad2VO( O entidad) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException{
T resultado=(T) this.vo.newInstance();
Map<String,Method> getters = findGetterAndSetters(this.entidad,Boolean.TRUE);
Map<String,Method> setters =findGetterAndSetters(this.vo,Boolean.FALSE);
Set<String> mappingIds = getters.keySet();//getter y setter generan el mismo keyset
for(String id:mappingIds){
Method getter = getters.get(id);
Method setter = setters.get(id);
setter.invoke(resultado, getter.invoke(entidad));
}
return resultado;
}
private Map<String,Method> findGetterAndSetters(Class<?> clase, Boolean getGetter) throws IntrospectionException{
Map<String,Method> result = new HashMap<>();
for (Field f: clase.getDeclaredFields()) {
if(f.isAnnotationPresent(MappingId.class)){
PropertyDescriptor pd = new PropertyDescriptor(f.getName(), clase);
if(getGetter){
result.put(f.getAnnotation(MappingId.class).id(), pd.getReadMethod());
}else{
result.put(f.getAnnotation(MappingId.class).id(), pd.getWriteMethod());
}
}
}
return result;
}
}
| 0294a64eba14c9207790b47bb0d876a9ece03d2e | [
"Java",
"SQL"
] | 5 | SQL | Lobo83/ChupiRecetas | da1f3ec1a7ab29e2a7b0fab1e469b1bfbd2121ee | 31b6071a1c870d97e7a9c863a1b6bf1cead7f0e2 |
refs/heads/master | <file_sep>This folder contains files related to database.
<file_sep>import { Exchange } from "./exchange";
import { Period } from "./period";
export class Company {
id: number;
name: string;
symbol: string;
exchange: Exchange;
price: number;
buyBelowPrice : number;
sellAbovePrice: number;
stockUrl: string;
description: string;
periods: Period[];
pe: number; // price to earnings
pToEbit: number; // price to EBIT
pb: number; // price to book value
evtoEBIT: number; // EBIT to Enterprice value
equity: number;
ev: number; // enterprise value
marketCap: number;
}<file_sep>import { Injectable } from '@angular/core';
import { Company } from '../model/company';
import { Observable, of } from 'rxjs';
import { MessageService } from './message.service';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class CompanyService {
private companiesUrl = '/portfoliomng/companies/detailed/'; // URL to web api
constructor(private messageService: MessageService, private http: HttpClient) { }
getCompanies(exchange: string): Observable<Company[]> {
this.messageService.add('CompanyService: fetched companies' + exchange);
return this.http.get<Company[]>(this.companiesUrl + exchange);
}
updateCompanyPrices(exchange: string) : Observable<string> {
console.log("in com sev.");
this.messageService.add("Updating prices.");
return this.http.get<string>('/portfoliomng/companies/update/prices/' + exchange);
}
}
<file_sep># Portfolio Manager
Portfolio Management Application
<file_sep>This is the backend part of the application, it is an Spring Boot application
<file_sep>This folder contains UI part of the application, it is an Angular application | 1612e93675aba96f18df43e7499c6e4f536d4115 | [
"Markdown",
"TypeScript"
] | 6 | Markdown | nurhanrecep/portfolio.manager | a426a8b0b64d8dec0b9d8061732d21a8a8101276 | 05cac878e4a1984c8ca8112059704d2b85891c96 |
refs/heads/master | <file_sep>import './index.pug'
import 'semantic-ui-css/semantic.min.css'
import Vue from 'vue'
import Vuex from 'vuex'
import SuiVue from 'semantic-ui-vue'
import App from './app.vue'
Vue.use(Vuex)
Vue.use(SuiVue)
const store = new Vuex.Store({
state: {
editTarget: '',
editTargetProps: {},
},
mutations: {
focus(state, payload) {
state.editTarget = payload.hash
state.editTargetProps = payload.props
},
unfocus(state) {
state.editTarget = ''
state.editTargetProps = {}
},
editProps(state, payload) {
state.editTargetProps[payload.key].value = payload.value
},
pushTupleValue(state, payload) {
state.editTargetProps[payload.key].value.push(payload.value)
},
popTupleValue(state, payload) {
state.editTargetProps[payload].value.pop()
},
},
getters: {
isFocus: state => (name, focus) => name == state.editTarget && focus,
},
})
const app = new Vue({
el: '#app',
render: h => h(App),
store: store,
})
<file_sep># Tensorflow Online Builder
A website to visualize the computational graph of tensorflow. Users can edit the graph themselves.
## Demo
[Demo](https://st9007a.github.io/tensorflow-online-builder)
## Future Work
- Beautify UI
- Support more tensorflow api
- Shape validation
- Export and import
- Python code generation
| 2d8b551c2fcdd5e01d49410d7b075e43f179969f | [
"JavaScript",
"Markdown"
] | 2 | JavaScript | st9007a/tensorflow-online-builder | f33a4c683720ba4dfab6d2c8c6a592ef22fc398a | c41d48959f7b3832a768d3bfac1116f78de674f0 |
refs/heads/master | <file_sep>import React from 'react';
import Hero from '../components/Hero';
import singleProductBcg from '../images/singleProductBcg.jpeg';
import styled from 'styled-components';
import { ProductConsumer } from '../context';
import { Link } from 'react-router-dom';
const SingleProduct = () => {
return (
<React.Fragment>
<Hero image={singleProductBcg} />
<ProductConsumer>
{({ singleProduct, addToCart, loading }) => {
if (loading) {
console.log('hello from loading');
return <h1>product is loading...</h1>;
}
const { company, id, description, price, title, image } = singleProduct;
return (
<SingleProductWrapper>
<section className="py-5">
<div className="container">
<div className="row">
<div className="col-10 mx-auto col-sm-8 col-md-6 my-3">
{/* it counts from index.js */}
<img
src={`../${image}`}
alt="product"
className="image-fluid image-effect"
/>
</div>
<div className="col-10 mx-auto col-sm-8 col-md-6 my-3">
<h5 className="text-title mb-4">model : {title}</h5>
<h5 className="text-capitalize text-muted mb-4">company : {company}</h5>
<h5 className="text-capitalize text-main mb-4 price">price : ${price}</h5>
<p className="text-capitalize text-title mt-3">some info about product :</p>
<p>{description}</p>
<button
type="button"
className="main-link"
style={{ margin: '0.75rem' }}
onClick={() => addToCart(id)}
>
Add to cart
</button>
<Link to="/products" className="main-link" style={{ margin: '0.75rem' }}>
back to products
</Link>
</div>
</div>
</div>
</section>
</SingleProductWrapper>
);
}}
</ProductConsumer>
</React.Fragment>
);
};
const SingleProductWrapper = styled.div`
.price {
font-size: 1.3rem;
cursor: pointer;
}
.image-effect {
transition: var(--mainTransition);
}
.image-effect:hover {
transform: scale(1.2);
cursor: pointer;
}
`;
export default SingleProduct;
<file_sep>import React from 'react';
import styled from 'styled-components';
import mainBcg2 from '../images/mainBcg2.jpg';
const Hero = ({ children, image, title, max }) => {
return (
<HeroWrapper max={max} img={image}>
<div className="banner">
<h1 className="title">{title}</h1>
{children}
</div>
</HeroWrapper>
);
};
const HeroWrapper = styled.div`
text-align: center;
display: flex;
align-items: center;
justify-content: center;
min-height: ${(props) => (props.max ? '100vh' : '60vh')};
color: var(--mainWhite);
background: linear-gradient(var(--primaryRGBA), var(--primaryRGBA)),
url(${(props) => props.img})center/cover no-repeat;
.title {
padding-top: 2rem;
font-size: 3.5rem;
text-shadow: 4px 4px 2px rgba(0, 0, 0, 0.3);
text-transform: uppercase;
letter-spacing: var(--mainSpacing);
}
`;
Hero.defaultProps = {
image : mainBcg2
};
export default Hero;
<file_sep>import React from 'react';
import Hero from '../components/Hero';
import storeBcg from '../images/storeBcg.jpeg';
import Store from '../components/Store/cartPage';
const CartPage = () => {
return (
<div>
<Hero image={storeBcg} />
<Store />
</div>
);
};
export default CartPage;
<file_sep>import React from 'react';
import Hero from '../components/Hero';
import { Link } from 'react-router-dom';
import Features from '../components/HomePage/Featured';
import Sevices from '../components/HomePage/Services';
const HomePage = () => {
return (
<React.Fragment>
<Hero title="awesome gadgets" max>
<Link className="main-link" style={{ margin: '2rem' }} to="/products">
our Products
</Link>
</Hero>
<Sevices />
<Features />
</React.Fragment>
);
};
export default HomePage;
<file_sep>import React from 'react';
import Product from '../Product';
import Title from '../Title';
import { Link } from 'react-router-dom';
import { ProductConsumer } from '../../context';
export default function Featured () {
return (
<div className="py-5">
<div className="container">
<Title center title="Featured Products" />
<div className="row my-5">
<ProductConsumer>
{({ featuredProducts }) => {
return featuredProducts.map((item) => {
return <Product key={item.id} item={item} />;
});
}}
</ProductConsumer>
</div>
<div className="row mt-5">
<div className="col text-center">
<Link to="products" className="main-link">
our products
</Link>
</div>
</div>
</div>
</div>
);
}
<file_sep>import React from 'react';
import { ProductConsumer } from '../../../context';
export default function CartTotals () {
return (
<div className="container">
<div className="row">
<ProductConsumer>
{({ clearCart, carTotal, cartSuTotal, cartTax }) => {
return (
<div className="col text-center text-title my-4">
<button className="btn btn-outline-danger text-capitalize mb-4" onClick={clearCart}>
clear-cart
</button>
<h3>subtotal : ${cartSuTotal}</h3>
<h3>tax : ${cartTax}</h3>
<h3>cartTotal : ${carTotal}</h3>
</div>
);
}}
</ProductConsumer>
</div>
</div>
);
}
<file_sep>export const linkData = [
{
id : 1,
text : 'home',
path : '/'
},
{
id : 2,
text : 'about',
path : '/about'
},
{
id : 3,
text : 'products',
path : '/products'
},
{
id : 4,
text : 'contact',
path : '/contact'
},
{
id : 5,
text : 'cart',
path : '/cart'
}
];
<file_sep>import React from 'react';
import Titile from '../Title';
import aboutBcg from '../../images/aboutBcg.jpeg';
const Info = () => {
return (
<section className="py-5">
<div className="container">
<div className="row">
<div className="col-10 mx-auto col-md-6 my-3">
<img
src={aboutBcg}
className="img-fluid img-thumbnail"
alt="about"
style={{ background: 'var(--darkGrey' }}
/>
</div>
<div className="col-10 mx-auto col-md-6 my-3">
<Titile title="About us" />
<p className="text-lead text-muted my-3">
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa porro nemo temporibus qui,
dolores blanditiis asperiores quidem perspiciatis dicta? Aspernatur!
</p>
<p className="text-lead text-muted my-3">
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa porro nemo temporibus qui,
dolores blanditiis asperiores quidem perspiciatis dicta? Aspernatur!Lorem ipsum dolor sit
amet consectetur adipisicing elit. Dolorum hic totam non ipsum, consequatur sunt.
</p>
<button className="main-link" type="button" style={{ marginTop: '2rem' }}>
More info
</button>
</div>
</div>
</div>
</section>
);
};
export default Info;
| be9e7205f01a302a1b62dead505d8f872d3b27f5 | [
"JavaScript"
] | 8 | JavaScript | jonjj2016/tech-shop | 8ff258331309052839cc14845c2e2ec0b7937e36 | c364437d73fc32121d14989ec109fed7002ac32b |
refs/heads/master | <file_sep>var i = 0;
const name1 = 'Aqua';
const name2 = 'FPS';
const speed = 200;
typeWriter(() => {
if (i < name2.length) {
document.getElementById("name2").innerHTML += name2.charAt(i);
i++;
setTimeout(typeWriter2, speed);
}
});
function typeWriter(cb) {
if (i < name1.length) {
document.getElementById("name1").innerHTML += name1.charAt(i);
i++;
setTimeout(typeWriter, speed);
}
else {
document.getElementById("name1").innerHTML += '<span class="text-primary" id="name2"></span>'
i= 0;
cb();
}
}
new Twitch.Embed("twitch-embed", {
width: "100%",
height: 675,
channel: "aquafps"
});
| 0d96a3d34f5a1fb5db9e00158a6032309e8462e2 | [
"JavaScript"
] | 1 | JavaScript | CreatorsClub/cc-aquafps.com | 0879198a18f2d0e3b3aa2ef7f55229374080c2ec | d9264633e556ad542c0f0db61a63472357dc1e06 |
refs/heads/master | <file_sep>var express = require('express');
var http = require('http');
var app = express();
var server = app.listen(3000);
var io = require('socket.io').listen(server);
var _ = require('underscore');
app.use(express.static(__dirname + "/public"));
app.get("/", function(request, response) {
response.sendfile(__dirname + "/index.html");
});
var cardValues = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10];
var deck;
var marker;
var shuffleDeck = function() {
deck = _(_.range(1, 261)).shuffle().map(function(card) {
return {
rank: card % 13,
suit: Math.floor(card / 13) % 4
};
});
marker = Math.floor(Math.random() * 60) + 156;
};
shuffleDeck();
var bestScore = function(scores) {
if (scores.length > 1 && scores[1] <= 21) {
return scores[1];
}
else {
return scores[0];
}
};
io.sockets.on('connection', function(socket) {
socket.on('hit', function(data) {
socket.emit('receiveCard', deck.pop());
});
socket.on('startGame', function() {
if(deck.length < marker) {
shuffleDeck();
}
socket.emit('dealCards', [deck.pop(), deck.pop(), deck.pop(), deck.pop()]);
});
socket.on('stand', function(scores) {
var cards = [];
while(bestScore(scores) < 17) {
var card = deck.pop();
cards.push(card);
for(var i = 0; i < scores.length; i++) {
scores[i] += cardValues[card["rank"]];
}
}
socket.emit('endGame', cards);
});
}); | de5833a0e8dfbe14739231b3da65bfe2953e9c96 | [
"JavaScript"
] | 1 | JavaScript | blakewest/2013-08-blackjack | 2505a2d38faeac59a50982937458b5fce21fd2c1 | f64473109c31f52d20983b8185bae3913890203c |
refs/heads/master | <repo_name>joseph1506/angular7SpringRest<file_sep>/src/main/java/com/rest/angtestrest/controller/AuthenticationController.java
package com.rest.angtestrest.controller;
import com.rest.angtestrest.dto.AuthResponse;
import com.rest.angtestrest.dto.UserDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@CrossOrigin
@RestController
public class AuthenticationController {
@Autowired
private AuthenticationManager authenticationManager;
@PostMapping("/login")
public AuthResponse autheticate(@RequestBody UserDetails userDetails){
System.out.println(userDetails.getPassword());
System.out.println(userDetails.getUsername());
AuthResponse authResponse = new AuthResponse();
if("admin".equals(userDetails.getUsername())
&& "admin".equals(userDetails.getPassword())){
authResponse.setSuccess(true);
authResponse.setSecret("Secret of the admin");
} else if("joe1506".equals(userDetails.getUsername())
&& "<PASSWORD>".equals(userDetails.getPassword())){
authResponse.setSuccess(true);
authResponse.setSecret("Secret of the user");
} else {
authResponse.setSuccess(false);
authResponse.setMessage("Invalid Credentials");
}
String role = "USER";
if(userDetails.getUsername().equalsIgnoreCase("admin")){
role="ADMIN";
}
List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();
GrantedAuthority ga = new SimpleGrantedAuthority(role);
grantedAuthorities.add(ga);
UsernamePasswordAuthenticationToken loginToken = new UsernamePasswordAuthenticationToken(userDetails.getUsername(), userDetails.getPassword(), grantedAuthorities);
Authentication auth = authenticationManager.authenticate(loginToken);
SecurityContextHolder.getContext().setAuthentication(auth);
return authResponse;
}
}
<file_sep>/src/main/java/com/rest/angtestrest/controller/EmployeeDataController.java
package com.rest.angtestrest.controller;
import com.rest.angtestrest.dto.Employee;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@CrossOrigin
@RestController
public class EmployeeDataController {
@GetMapping("/employees")
@PreAuthorize("hasRole(ADMIN)")
public List<Employee> getEmployees(){
List<Employee> employees = new ArrayList<>();
employees.add(getEmployee("Joseph", "1"));
employees.add(getEmployee("James", "2"));
employees.add(getEmployee("Jeane", "3"));
employees.add(getEmployee("Jack", "4"));
return employees;
}
private Employee getEmployee(String name, String id) {
return new Employee(name,id);
}
}
<file_sep>/src/main/resources/application.properties
server.servlet.session.cookie.http-only=true
server.servlet.session.cookie.secure=true | 38b1dd9129af4aae3031163b5e7420f264256745 | [
"Java",
"INI"
] | 3 | Java | joseph1506/angular7SpringRest | 5b7e4e9733c119dbc54fc0abd8d30203eadcbbc1 | 7911cccb215d94a7e7f266824db190ace32b7816 |
refs/heads/master | <file_sep>#include "cModelLoader.h"
//***********************************************//
//***********************************************//
int cModelLoader::init()
{
iNumUniqueVertexes = 0;
iNumFinalVertexes = 0;
iNumUniqueTextureCoords = 0;
iNumUniqueNormals = 0;
return 0;
}
//***********************************************//
//***********************************************//
int cModelLoader::exit()
{
iNumUniqueVertexes = 0;
iNumFinalVertexes = 0;
iNumUniqueTextureCoords = 0;
iNumUniqueNormals = 0;
return 0;
}
//***********************************************//
//***********************************************//
int cModelLoader::load_obj_model(char* filename, double scale)
{
double COORD_SCALE = scale;
iNumUniqueVertexes = 0;
iNumUniqueTextureCoords = 0;
iNumUniqueNormals = 0;
iNumFinalVertexes = 0;
FILE* InputFile;
char Buffer[1000];
bool bTri = false;
int delims[14] = {1000, 1000, 1000, 1000, 1000, 1000, 1000,1000, 1000, 1000, 1000, 1000, 1000, 1000};
char* substrings[15];
for (int lc1 = 0; lc1 < 15; lc1++)
substrings[lc1] = NULL;
InputFile = fopen(filename, "r");
if (InputFile == NULL)
return -1;
char* pret;
while (TRUE)
{
pret = fgets(Buffer, 1000, InputFile);
if (pret == NULL)
break;
if ((Buffer[0] == 'f') ||
(Buffer[0] == 'v'))
{
substrings[0] = Buffer;
//go through buffer
int iNumDelimsFound = 0;
int iOrigStrlen = strlen(Buffer);
for (int lc1 = 0; lc1 < iOrigStrlen; lc1++)
{
if (Buffer[lc1] < 32)
Buffer[lc1] = 0;
if ((Buffer[lc1] == ' ') || (Buffer[lc1] == '/'))
{
delims[iNumDelimsFound] = lc1;
Buffer[lc1] = 0;
iNumDelimsFound++;
substrings[iNumDelimsFound] = Buffer + lc1 + 1;
}
}
//now add
if (Buffer[0] == 'v')
if (Buffer[1] == 0)
{
//the x direction is reversed because when I did the model I had
// positive x as going backwards and I don't want that here
//note: as a result of this, I had to reverse the normals as well
//to compensate for this
UniqueVertexes[iNumUniqueVertexes].x = strtod(substrings[1], NULL);
UniqueVertexes[iNumUniqueVertexes].y = strtod(substrings[2], NULL);
UniqueVertexes[iNumUniqueVertexes].z = strtod(substrings[3], NULL);
//scale coords
UniqueVertexes[iNumUniqueVertexes].x *= COORD_SCALE;
UniqueVertexes[iNumUniqueVertexes].y *= COORD_SCALE;
UniqueVertexes[iNumUniqueVertexes].z *= COORD_SCALE;
//TEMP: set color
UniqueVertexes[iNumUniqueVertexes].colour = 0xffffffff;
// printf("VRT f %f %f %f \n",
// UniqueVertexes[iNumUniqueVertexes].x,
// UniqueVertexes[iNumUniqueVertexes].y,
// UniqueVertexes[iNumUniqueVertexes].z);
iNumUniqueVertexes++;
}
if (Buffer[0] == 'v')
if (Buffer[1] == 't')
{
UniqueVertexes[iNumUniqueTextureCoords].tu = strtod(substrings[1], NULL);
UniqueVertexes[iNumUniqueTextureCoords].tv = strtod(substrings[2], NULL);
iNumUniqueTextureCoords++;
}
if (Buffer[0] == 'v')
if (Buffer[1] == 'n')
{
UniqueVertexes[iNumUniqueNormals].nx = strtod(substrings[1], NULL);
UniqueVertexes[iNumUniqueNormals].ny = strtod(substrings[2], NULL);
UniqueVertexes[iNumUniqueNormals].nz = strtod(substrings[3], NULL);
iNumUniqueNormals++;
}
if (Buffer[0] == 'f')
{
int iNumFields = 3;
for (int lc5 = 4; lc5 < 13; lc5++)
{
if (substrings[lc5] != NULL)
if (substrings[lc5][0] >= 32)
iNumFields = lc5;
}
//plain triangle
if (iNumFields == 3)
{
int v_index1 = atoi(substrings[1]) - 1;
int v_index2 = atoi(substrings[2]) - 1;
int v_index3 = atoi(substrings[3]) - 1;
vertex normal = compute_normal(UniqueVertexes[v_index1], UniqueVertexes[v_index2], UniqueVertexes[v_index3]);
FinalVertexes[iNumFinalVertexes] = UniqueVertexes[v_index1];
copy_normal(&FinalVertexes[iNumFinalVertexes], &normal);
FinalVertexes[iNumFinalVertexes+1] = UniqueVertexes[v_index2];
copy_normal(&FinalVertexes[iNumFinalVertexes+1], &normal);
FinalVertexes[iNumFinalVertexes+2] = UniqueVertexes[v_index3];
copy_normal(&FinalVertexes[iNumFinalVertexes+2], &normal);
iNumFinalVertexes += 3;
}
//plain quad
if (iNumFields == 4)
{
int v_index1 = atoi(substrings[1]) - 1;
int v_index2 = atoi(substrings[2]) - 1;
int v_index3 = atoi(substrings[3]) - 1;
int v_index4 = atoi(substrings[4]) - 1;
vertex normal1 = compute_normal(UniqueVertexes[v_index1], UniqueVertexes[v_index2], UniqueVertexes[v_index3]);
FinalVertexes[iNumFinalVertexes] = UniqueVertexes[v_index1];
copy_normal(&FinalVertexes[iNumFinalVertexes], &normal1);
FinalVertexes[iNumFinalVertexes+1] = UniqueVertexes[v_index2];
copy_normal(&FinalVertexes[iNumFinalVertexes+1], &normal1);
FinalVertexes[iNumFinalVertexes+2] = UniqueVertexes[v_index3];
copy_normal(&FinalVertexes[iNumFinalVertexes+2], &normal1);
vertex normal2 = compute_normal(UniqueVertexes[v_index3], UniqueVertexes[v_index4], UniqueVertexes[v_index1]);
FinalVertexes[iNumFinalVertexes+3] = UniqueVertexes[v_index3];
copy_normal(&FinalVertexes[iNumFinalVertexes+3], &normal1);
FinalVertexes[iNumFinalVertexes+4] = UniqueVertexes[v_index4];
copy_normal(&FinalVertexes[iNumFinalVertexes+4], &normal1);
FinalVertexes[iNumFinalVertexes+5] = UniqueVertexes[v_index1];
copy_normal(&FinalVertexes[iNumFinalVertexes+5], &normal1);
iNumFinalVertexes += 6;
}
//textured triangle
if (iNumFields == 6)
{
int v_index1 = atoi(substrings[2]) - 1;
int v_index2 = atoi(substrings[1]) - 1;
int v_index3 = atoi(substrings[4]) - 1;
int v_index4 = atoi(substrings[3]) - 1;
int v_index5 = atoi(substrings[6]) - 1;
int v_index6 = atoi(substrings[5]) - 1;
vertex normal = compute_normal(UniqueVertexes[v_index1], UniqueVertexes[v_index3], UniqueVertexes[v_index5]);
FinalVertexes[iNumFinalVertexes] = UniqueVertexes[v_index1];
copy_normal(&FinalVertexes[iNumFinalVertexes], &normal);
FinalVertexes[iNumFinalVertexes+1] = UniqueVertexes[v_index3];
copy_normal(&FinalVertexes[iNumFinalVertexes+1], &normal);
FinalVertexes[iNumFinalVertexes+2] = UniqueVertexes[v_index5];
copy_normal(&FinalVertexes[iNumFinalVertexes+2], &normal);
FinalVertexes[iNumFinalVertexes].tu = UniqueVertexes[v_index2].tu;
FinalVertexes[iNumFinalVertexes].tv = UniqueVertexes[v_index2].tv;
FinalVertexes[iNumFinalVertexes+1].tu = UniqueVertexes[v_index4].tu;
FinalVertexes[iNumFinalVertexes+1].tv = UniqueVertexes[v_index4].tv;
FinalVertexes[iNumFinalVertexes+2].tu = UniqueVertexes[v_index6].tu;
FinalVertexes[iNumFinalVertexes+2].tv = UniqueVertexes[v_index6].tv;
iNumFinalVertexes += 3;
}
//textured quad
if (iNumFields == 8)
{
int v_index1 = atoi(substrings[2]) - 1;
int v_index2 = atoi(substrings[1]) - 1;
int v_index3 = atoi(substrings[4]) - 1;
int v_index4 = atoi(substrings[3]) - 1;
int v_index5 = atoi(substrings[6]) - 1;
int v_index6 = atoi(substrings[5]) - 1;
int v_index7 = atoi(substrings[8]) - 1;
int v_index8 = atoi(substrings[7]) - 1;
vertex normal1 = compute_normal(UniqueVertexes[v_index1], UniqueVertexes[v_index3], UniqueVertexes[v_index5]);
FinalVertexes[iNumFinalVertexes] = UniqueVertexes[v_index1];
copy_normal(&FinalVertexes[iNumFinalVertexes], &normal1);
FinalVertexes[iNumFinalVertexes+1] = UniqueVertexes[v_index3];
copy_normal(&FinalVertexes[iNumFinalVertexes+1], &normal1);
FinalVertexes[iNumFinalVertexes+2] = UniqueVertexes[v_index5];
copy_normal(&FinalVertexes[iNumFinalVertexes+2], &normal1);
FinalVertexes[iNumFinalVertexes].tu = UniqueVertexes[v_index2].tu;
FinalVertexes[iNumFinalVertexes].tv = UniqueVertexes[v_index2].tv;
FinalVertexes[iNumFinalVertexes+1].tu = UniqueVertexes[v_index4].tu;
FinalVertexes[iNumFinalVertexes+1].tv = UniqueVertexes[v_index4].tv;
FinalVertexes[iNumFinalVertexes+2].tu = UniqueVertexes[v_index6].tu;
FinalVertexes[iNumFinalVertexes+2].tv = UniqueVertexes[v_index6].tv;
vertex normal2 = compute_normal(UniqueVertexes[v_index5], UniqueVertexes[v_index7], UniqueVertexes[v_index1]);
FinalVertexes[iNumFinalVertexes+3] = UniqueVertexes[v_index5];
copy_normal(&FinalVertexes[iNumFinalVertexes+3], &normal1);
FinalVertexes[iNumFinalVertexes+4] = UniqueVertexes[v_index7];
copy_normal(&FinalVertexes[iNumFinalVertexes+4], &normal1);
FinalVertexes[iNumFinalVertexes+5] = UniqueVertexes[v_index1];
copy_normal(&FinalVertexes[iNumFinalVertexes+5], &normal1);
FinalVertexes[iNumFinalVertexes+3].tu = UniqueVertexes[v_index6].tu;
FinalVertexes[iNumFinalVertexes+3].tv = UniqueVertexes[v_index6].tv;
FinalVertexes[iNumFinalVertexes+4].tu = UniqueVertexes[v_index8].tu;
FinalVertexes[iNumFinalVertexes+4].tv = UniqueVertexes[v_index8].tv;
FinalVertexes[iNumFinalVertexes+5].tu = UniqueVertexes[v_index2].tu;
FinalVertexes[iNumFinalVertexes+5].tv = UniqueVertexes[v_index2].tv;
iNumFinalVertexes += 6;
}
}
}
}
fclose(InputFile);
return 0;
}
//***********************************************//
//***********************************************//
<file_sep>#include "common_classes.h"
#include "drag_table.h"
#pragma once
class cAerodynamicsModel
{
public:
cSharedMem* pSharedMem;
int init(cSharedMem* _pSharedMem)
{
pSharedMem = _pSharedMem;
return 0;
}
cForceMoment get_aerodyn_phase0(cState state);
cForceMoment get_aerodyn_phase1_stage1(cState state);
cForceMoment get_aerodyn_phase1_interstage(cState state);
cForceMoment get_aerodyn_phase1_stage2(cState state);
//utility function to retrieve the drag coefficient
double get_CD_phase0(double mach_number, double angle_of_attack);
double get_CL_phase0(double mach_number, double angle_of_attack);
//utility function to compute the angle of attack based on the state.
double compute_angle_of_attack(cState state);
//utility function to compute the mach number
double compute_mach_number(double air_density, double air_temp, double air_pressure, double velocity);
//another utility function to compute the linear interpolation of a table, this time based
//on mach number
double get_interp(double mach_number, const double* v_table);
private:
};<file_sep>#include "cIntegrator.h"
//*****************************************************//
//*****************************************************//
int cIntegrator::init(cSharedMem* _pSharedMem,
cForceModel* _pForceModel,
cControlModel* _pControlModel,
cAtmosphereModel* _pAtmosphereModel,
cAerodynamicsModel* _pAerodynamicsModel)
{
pSharedMem = _pSharedMem;
pForceModel = _pForceModel;
pControlModel = _pControlModel;
pAtmosphereModel = _pAtmosphereModel;
pAerodynamicsModel = _pAerodynamicsModel;
for (int lc1 = 0; lc1 < MAX_MASSES; lc1++)
Masses[lc1].State.reset();
printf("Integrator: init.\n");
return 0;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::exit()
{
printf("Integrator: exit.\n");
return 0;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::run_step_phase0(double time_step)
{
printf("Integrator Phase 0: run step. Time: %f\n", sim_time);
//in phase 0, the entire rocket is firing as one piece.
//save previous state
cState prev_state = Masses[0].State;
//calculate atmospheric conditions
pAtmosphereModel->calculate_atmosphere_phase0(Masses[0].State);
//calculate aerodynamic forces moments
cForceMoment aerodyns = pAerodynamicsModel->get_aerodyn_phase0(Masses[0].State);
//put thrust into system
cForceMoment thrust = pForceModel->Engine.get_thrust_phase0(prev_state);
cThrustEffect thrust_effect = pForceModel->Engine.get_thrust_effect_phase0(prev_state, thrust);
//load them into the integrator
load_inputs(thrust, thrust_effect, aerodyns);
//run the integration step
Masses[0].State = rk4_advance(Masses[0].State, time_step);
//recalculate control inputs
pControlModel->calculate_controls_phase0(Masses[0].State, prev_state, sim_time);
return 0;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::run_step_phase1(double time_step)
{
printf("Integrator Phase 1: run step. Time: %f\n", sim_time);
//in phase 1, we are tracking the motion of three objects, the first stage,
//the interstage fairing, and the second stage.
//only the second stage is powered, the first stage and the interstage
//are falling back to Earth.
//save previous states
cState prev_state_first = Masses[0].State;
cState prev_state_inter = Masses[1].State;
cState prev_state_second = Masses[2].State;
//calculate atmospheric conditions
pAtmosphereModel->calculate_atmosphere_phase1(Masses[0].State, Masses[1].State, Masses[2].State);
//calculate aerodynamic forces for fisrt stage
cForceMoment aerodyns_first = pAerodynamicsModel->get_aerodyn_phase1_stage1(Masses[0].State);
//calculate the first stage
cForceMoment thrust_first(0,0,0,0,0,0); //no thrust
cThrustEffect thrust_effect_first(0,0,0,0); //no thrust effect
//load them into the integrator
load_inputs(thrust_first, thrust_effect_first, aerodyns_first);
//run the integrator on the first stage
Masses[0].State = rk4_advance(Masses[0].State, time_step);
//calculate the interstage
cForceMoment aerodyns_inter = pAerodynamicsModel->get_aerodyn_phase1_interstage(Masses[1].State);
cForceMoment thrust_inter(0,0,0,0,0,0); //no thrust
cThrustEffect thrust_effect_inter(0,0,0,0); //no thrust effect
//load into integrator
load_inputs(thrust_inter, thrust_effect_inter, aerodyns_inter);
//run the integrator on the interstage
Masses[1].State = rk4_advance(Masses[1].State, time_step);
//calculate the second stage
cForceMoment aerodyns_second = pAerodynamicsModel->get_aerodyn_phase1_stage2(Masses[2].State);
cForceMoment thrust_second = pForceModel->Engine.get_thrust_phase1(prev_state_second);
cThrustEffect thrust_effect_second = pForceModel->Engine.get_thrust_effect_phase1(prev_state_second, thrust_second);
//load into integrator
load_inputs(thrust_second, thrust_effect_second, aerodyns_second);
//run the integrator on the second stage
Masses[2].State = rk4_advance(Masses[2].State, time_step);
//re-calculate control inputs on second stage
pControlModel->calculate_controls_phase1(Masses[2].State, prev_state_second, sim_time);
return 0;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::run_step(double time_step)
{
int sim_phase = pSharedMem->read_int(SIM_PHASE);
if (sim_phase == 0)
{
run_step_phase0(time_step);
}
if (sim_phase == 1)
{
run_step_phase1(time_step);
}
sim_time += time_step;
return 0;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::ic()
{
printf("Integrator: ic.\n");
//just a goof to put the start location at Cape Canaveral
cVec pos = cVec::compute_ecef_xyz(-80.5585, 28.4667, 6.3781e6);
Masses[0].State.x = pSharedMem->read_double(IC_PX_ECEF); //pos.x;
Masses[0].State.y = pSharedMem->read_double(IC_PY_ECEF); //pos.y;
Masses[0].State.z = pSharedMem->read_double(IC_PZ_ECEF); //pos.z;
Masses[0].State.vx = pSharedMem->read_double(IC_VX_ECEF); //0.0;
Masses[0].State.vy = pSharedMem->read_double(IC_VY_ECEF); //0.0;
Masses[0].State.vz = pSharedMem->read_double(IC_VZ_ECEF); //0.0;
double ic_pitch = pSharedMem->read_double(IC_PITCH_RAD);
double ic_roll = pSharedMem->read_double(IC_ROLL_RAD);
double ic_yaw = pSharedMem->read_double(IC_YAW_RAD);
Masses[0].State.att.set_rotation(ic_roll, ic_pitch, ic_yaw);
Masses[0].State.phi = Masses[0].State.att.get_phi();
Masses[0].State.psi = Masses[0].State.att.get_psi();
Masses[0].State.theta = Masses[0].State.att.get_theta();
Masses[0].State.wx = pSharedMem->read_double(IC_WX);//0.0;
Masses[0].State.wy = pSharedMem->read_double(IC_WY);//0.0;
Masses[0].State.wz = pSharedMem->read_double(IC_WZ);//0.0;
//read in a specified initial mass from SM
double sm_mass = pSharedMem->read_double(IC_MASS_FUEL_FIRST_STAGE);
//if the SM mass is 0 (i.e. invalid), use the default numbers instead
if (sm_mass == 0)
{
//source: user's guide
Masses[0].State.mass = 27500; //kg
//note: Falcon 1's user's guide says the first stage is carrying 21540 kg of propellant.
//the below assumes the rocket having
//2 axes of symmetry (thus only 3 different moments of inertia)
//the following integral assumes the rocket being a cylinder 0.85m in radius
//and 21.3m in length, and therefore the axis being in the middle.
Masses[0].State.Ixx = 13927.99375; //about main axis: 0.5*m*r*r
Masses[0].State.Iyy = 1464632.2; //about secondary axis: (1/12)*m*(3*r*r + L*L)
Masses[0].State.Izz = 1464632.2; //about secondary axis: (1/12)*m*(3*r*r + L*L)
} else
{
//not sure what to do here.
//umm.....assume non-fuel mass is 7970 kg, add the fuel mass to the total
Masses[0].State.mass = 7970 + sm_mass; //kg
//keep the rocket dimensions and inertias the same for lack of anything better I can do.
Masses[0].State.Ixx = 13927.99375; //about main axis: 0.5*m*r*r
Masses[0].State.Iyy = 1464632.2; //about secondary axis: (1/12)*m*(3*r*r + L*L)
Masses[0].State.Izz = 1464632.2; //about secondary axis: (1/12)*m*(3*r*r + L*L)
}
sim_time = 0;
num_masses = 1;
//reset all engine gimbals
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_TILT, 0);
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_ROLL, 0);
pSharedMem->write_double(STAGE2_ENGINE_GIMBAL_TILT, 0);
pSharedMem->write_double(STAGE2_ENGINE_GIMBAL_ROLL, 0);
pSharedMem->write_int(SIM_PHASE, 0);
return 0;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::first_stage_sep()
{
//move the phase marker
pSharedMem->write_int(SIM_PHASE, 1);
//break up the old mass into multiple pieces
//with slightly different reference positions
//first get a unit vector representing the main axis
//of the rocket
cVec axial = Masses[0].State.att.rotate_vector(1,0,0);
axial = Masses[0].State.convert_orientation_ENU_to_ECEF(axial);
//save the original pos
cVec old_pos(Masses[0].State.x, Masses[0].State.y, Masses[0].State.z);
//save the old velocity vector
cVec old_vel(Masses[0].State.vx, Masses[0].State.vy, Masses[0].State.vz);
//save the old attitude
cState old_state = Masses[0].State;
//reposition the new mass 0 point position at -5.23m of the old position
//(this is mostly cosmetic. The end-to-end length of the first stage is about 12.6m,
//this would basically put the new center for the first stage at exactly the middle of its length.)
cVec new_stage1_pos = old_pos + (axial * -5.23);
//reposition the interstage at +3.38m of the old position
//(again, cosmetic, based on the position of the interstage on the rocket.
cVec new_interstage_pos = old_pos + (axial * 3.38);
//reposition the second stage at +6.53m of the old position
cVec new_stage2_pos = old_pos + (axial * 6.53);
//Now determine the new velocities of the components.
//the charges that push apart the components have an unknown kinetic
//energy, so we'll just use a scaling factor to make the separation
//event more or less energetic.
double energy_scale = 1.0;
//assume that 4590 kg (i.e. no payload) of the remaining mass is the second stage,
//145kg is the interstage, and whatever is left is the first stage.
double first_stage_mass = Masses[0].State.mass - 4590.0 - 145.0;
//assume that interstage doesn't change momentum (retains original velocity)
//therefore ...
double v1 = -1.0;
double v2 = first_stage_mass / 4590.0;
cVec new_stage1_vel = old_vel + (axial*v1*energy_scale);
cVec new_stage2_vel = old_vel + (axial*v2*energy_scale);
//now set the new values
Masses[0].State.x = new_stage1_pos.x;
Masses[0].State.y = new_stage1_pos.y;
Masses[0].State.z = new_stage1_pos.z;
Masses[0].State.vx = new_stage1_vel.x;
Masses[0].State.vy = new_stage1_vel.y;
Masses[0].State.vz = new_stage1_vel.z;
//angular state remains unchanged.
Masses[0].State.mass = first_stage_mass; //new mass
Masses[0].State.Ixx = 1; //not really sure what to do here yet
Masses[0].State.Iyy = 1; //not really sure what to do here yet
Masses[0].State.Izz = 1; //not really sure what to do here yet
//for the interstage, state properties are the same as the original
Masses[1].State = old_state;
//the mass properties are different
Masses[1].State.mass = 145; //kg
Masses[1].State.Ixx = 1; //dunno?
Masses[1].State.Iyy = 1; //dunno?
Masses[1].State.Izz = 1; //dunno?
//for the second stage...
Masses[2].State = old_state;
Masses[2].State.x = new_stage2_pos.x;
Masses[2].State.y = new_stage2_pos.y;
Masses[2].State.z = new_stage2_pos.z;
Masses[2].State.vx = new_stage2_vel.x;
Masses[2].State.vy = new_stage2_vel.y;
Masses[2].State.vz = new_stage2_vel.z;
//the mass properties are different
Masses[2].State.mass = 4950; //kg
//for the new Ixx, Iyy, and Izz, assume for
//the moment that the 2nd stage is a uniform cylinder 0.85m in
//radius and 8.25m long.
Masses[2].State.Ixx = 1788.2; //about main axis: 0.5*m*r*r
Masses[2].State.Iyy = 28969.9; //about secondary axis: (1/12)*m*(3*r*r + L*L)
Masses[2].State.Izz = 28969.9; //about secondary axis: (1/12)*m*(3*r*r + L*L)
return 0;
}
//*****************************************************//
//*****************************************************//
cState cIntegrator::test_advance(cDerivative derivs, cState state, double time_step)
{
cState ret;
//NOTE: accelerations are assumed in ECEF frame of reference.
//apply the accelerations to velocities
ret.vx = state.vx + derivs.ax * time_step;
ret.vy = state.vy + derivs.ay * time_step;
ret.vz = state.vz + derivs.az * time_step;
//apply the (deriv) velocities to positions
ret.x = state.x + derivs.vx * time_step;
ret.y = state.y + derivs.vy * time_step;
ret.z = state.z + derivs.vz * time_step;
//NOTE: angular accelerations are assumed in BODY frame of reference.
//apply angular accelerations to velocities
ret.wx = state.wx + derivs.alx * time_step;
ret.wy = state.wy + derivs.aly * time_step;
ret.wz = state.wz + derivs.alz * time_step;
//apply the velocities to the quaternion
ret.att.set_rotation(state.phi, state.theta, state.psi);
//convert
cVec convert_vec = ret.att.rotate_vector(derivs.wx, derivs.wy, derivs.wz);
ret.att.apply_rotation(convert_vec.x, convert_vec.y, convert_vec.z, time_step);
//now get the new euler angles
ret.phi = ret.att.get_phi();
ret.psi = ret.att.get_psi();
ret.theta = ret.att.get_theta();
//state changes
ret.mass = state.mass + derivs.dmass * time_step;
ret.Ixx = state.Ixx + derivs.dIxx * time_step;
ret.Iyy = state.Iyy + derivs.dIyy * time_step;
ret.Izz = state.Izz + derivs.dIzz * time_step;
ret.Ixz = state.Ixz + derivs.dIxz * time_step;
ret.Iyz = state.Iyz + derivs.dIyz * time_step;
ret.Ixy = state.Ixy + derivs.dIxy * time_step;
return ret;
}
//*****************************************************//
//*****************************************************//
int cIntegrator::load_inputs(cForceMoment input_fm, cThrustEffect input_te, cForceMoment input_aero_fm)
{
//this function exists because the integrator does not know
//anything about there being three separate masses that might need
//to be integrated at any given time, and thus when we run the integrator,
//we "load" the stage-specific values (thrust, aerodynamic forces, etc.)
//via SM.
pSharedMem->write_double(THRUST_FX, input_fm.fx);
pSharedMem->write_double(THRUST_FY, input_fm.fy);
pSharedMem->write_double(THRUST_FZ, input_fm.fz);
pSharedMem->write_double(THRUST_MX, input_fm.mx);
pSharedMem->write_double(THRUST_MY, input_fm.my);
pSharedMem->write_double(THRUST_MZ, input_fm.mz);
pSharedMem->write_double(THRUST_EFFECT_DMASS, input_te.dMass);
pSharedMem->write_double(THRUST_EFFECT_DIXX, input_te.dIxx);
pSharedMem->write_double(THRUST_EFFECT_DIYY, input_te.dIyy);
pSharedMem->write_double(THRUST_EFFECT_DIZZ, input_te.dIzz);
pSharedMem->write_double(AERODYN_FX, input_aero_fm.fx);
pSharedMem->write_double(AERODYN_FY, input_aero_fm.fy);
pSharedMem->write_double(AERODYN_FZ, input_aero_fm.fz);
pSharedMem->write_double(AERODYN_MX, input_aero_fm.mx);
pSharedMem->write_double(AERODYN_MY, input_aero_fm.my);
pSharedMem->write_double(AERODYN_MZ, input_aero_fm.mz);
return 0;
}
//*****************************************************//
//*****************************************************//
cState cIntegrator::rk4_advance(cState state, double time_step)
{
cState s1 = state;
cState ret;
//first test advance
cDerivative k1 = pForceModel->get_derivatives(s1);
cState s2 = test_advance(k1, s1, time_step / 2.0);
cDerivative k2 = pForceModel->get_derivatives(s2);
cState s3 = test_advance(k2, s1, time_step / 2.0);
cDerivative k3 = pForceModel->get_derivatives(s3);
cState s4 = test_advance(k3, s1, time_step);
cDerivative k4 = pForceModel->get_derivatives(s4);
cDerivative k1234 = rk4_weighted_avg_derivs(k1, k2, k3, k4);
ret = test_advance(k1234, s1, time_step);
return ret;
}
//*****************************************************//
//*****************************************************//
cDerivative cIntegrator::rk4_weighted_avg_derivs(cDerivative k1, cDerivative k2, cDerivative k3, cDerivative k4)
{
cDerivative ret;
ret.alx = 0.166666666666666*(k1.alx + 2*k2.alx + 2*k3.alx + k4.alx);
ret.aly = 0.166666666666666*(k1.aly + 2*k2.aly + 2*k3.aly + k4.aly);
ret.alz = 0.166666666666666*(k1.alz + 2*k2.alz + 2*k3.alz + k4.alz);
ret.ax = 0.166666666666666*(k1.ax + 2*k2.ax + 2*k3.ax + k4.ax);
ret.ay = 0.166666666666666*(k1.ay + 2*k2.ay + 2*k3.ay + k4.ay);
ret.az = 0.166666666666666*(k1.az + 2*k2.az + 2*k3.az + k4.az);
ret.wx = 0.166666666666666*(k1.wx + 2*k2.wx + 2*k3.wx + k4.wx);
ret.wy = 0.166666666666666*(k1.wy + 2*k2.wy + 2*k3.wy + k4.wy);
ret.wz = 0.166666666666666*(k1.wz + 2*k2.wz + 2*k3.wz + k4.wz);
ret.vx = 0.166666666666666*(k1.vx + 2*k2.vx + 2*k3.vx + k4.vx);
ret.vy = 0.166666666666666*(k1.vy + 2*k2.vy + 2*k3.vy + k4.vy);
ret.vz = 0.166666666666666*(k1.vz + 2*k2.vz + 2*k3.vz + k4.vz);
ret.dmass = 0.166666666666666*(k1.dmass + 2*k2.dmass + 2*k3.dmass + k4.dmass);
ret.dIxx = 0.166666666666666*(k1.dIxx + 2*k2.dIxx + 2*k3.dIxx + k4.dIxx);
ret.dIyy = 0.166666666666666*(k1.dIyy + 2*k2.dIyy + 2*k3.dIyy + k4.dIyy);
ret.dIzz = 0.166666666666666*(k1.dIzz + 2*k2.dIzz + 2*k3.dIzz + k4.dIzz);
ret.dIxz = 0.166666666666666*(k1.dIxz + 2*k2.dIxz + 2*k3.dIxz + k4.dIxz);
ret.dIyz = 0.166666666666666*(k1.dIyz + 2*k2.dIyz + 2*k3.dIyz + k4.dIyz);
ret.dIxy = 0.166666666666666*(k1.dIxy + 2*k2.dIxy + 2*k3.dIxy + k4.dIxy);
return ret;
}
//*****************************************************//
//*****************************************************//<file_sep>#include "common_classes.h"
#include "cEngineModel.h"
#pragma once
class cForceModel
{
public:
cEngineModel Engine;
cForceMoment get_gravity_force(cState state);
cForceMoment get_ground_reaction_force(cState state);
cForceMoment get_aerodynamic_force(cState state);
cForceMoment get_aerodynamic_force_drag(cState state);
cForceMoment get_aerodynamic_force_lift(cState state);
cForceMoment get_centrifugal_force(cState state);
cForceMoment get_coriolis_force(cState state);
cDerivative get_derivatives(cState state);
cSharedMem* pSharedMem;
int init(cSharedMem* _pSharedMem)
{
pSharedMem = _pSharedMem;
Engine.init(pSharedMem);
return 0;
}
private:
};<file_sep>#include "cEngineModel.h"
//***********************************************************//
//***********************************************************//
cForceMoment cEngineModel::get_thrust_phase0(cState state)
{
//note: this is rated sea level thrust, which is limited by the
//fact that the exhaust gas can only be expanded to
//sea level pressure.
//Thrust is listed to increase to 400 kN in vacuum.
double rated_thrust = 347000; //newtons
cForceMoment ret(0, 0, 0, 0, 0, 0);
double gimbal_roll = pSharedMem->read_double(STAGE1_ENGINE_GIMBAL_ROLL);
double gimbal_tilt = pSharedMem->read_double(STAGE1_ENGINE_GIMBAL_TILT);
double x_thrust = cos(gimbal_tilt);
double y_thrust = sin(gimbal_tilt)*sin(gimbal_roll);
double z_thrust = sin(gimbal_tilt)*cos(gimbal_roll);
//use y and z thrusts to compute moments
//temp: use 21.3/2 = 11.65m as moment arm (correct value would require position of CG)
double x_moment = 0;
double y_moment = z_thrust * 11.65 * rated_thrust;
double z_moment = y_thrust * 11.65 * rated_thrust;
cVec input(x_thrust, y_thrust, z_thrust);
//this rotates from body to east-north-up
cVec thrust_enu = state.att.rotate_vector(input);
//we have to rotate again to get to ecef
cVec thrust_ecef = state.convert_orientation_ENU_to_ECEF(thrust_enu);
thrust_ecef.scale(rated_thrust);
// the fuel just burns for the entire first stage activity
// if (state.mass < (27500 - 29510))
// bBurning = false;
// else
bBurning = false;
//first check if there is an external command to turn on the engine
if (pSharedMem->read_int(STAGE1_ENGINE_ON) != 0)
bBurning = true;
//if we have less than 29510 - 21540 = 7970 kg of mass, stop burning because we have run out of fuel
if (state.mass < 7970)
bBurning = false;
if (bBurning == true)
{
ret.fx = thrust_ecef.x;
ret.fy = thrust_ecef.y;
ret.fz = thrust_ecef.z;
//note that, we are currently passing moments
//in the body frame of reference,
//while forces are being passed in ECEF frame of reference
ret.mx = x_moment;
ret.my = y_moment;
ret.mz = z_moment;
}
return ret;
}
//***********************************************************//
//***********************************************************//
cThrustEffect cEngineModel::get_thrust_effect_phase0(cState state, cForceMoment thrust)
{
cThrustEffect ret(0,0,0,0);
//Wikipedia lists a fuel burn of 140 kg/sec.
//but this is probably a figure for a specific time in flight as
//a 169 sec burn at this rate uses more fuel than the user's guide says
//the rocket carries.
if (bBurning == true)
{
//for the moment, just use an assumption that the 169 sec burn evenly burns all the
//21540 kg of available fuel at a constant rate, leading to about 127 kg/sec.
ret.dMass = -21540.0 / 169.0; //kg/sec
}
return ret;
}
//***********************************************************//
//***********************************************************//
cForceMoment cEngineModel::get_thrust_phase1(cState state)
{
double rated_thrust = 31000; //newtons
cForceMoment ret(0, 0, 0, 0, 0, 0);
double gimbal_roll = pSharedMem->read_double(STAGE2_ENGINE_GIMBAL_ROLL);
double gimbal_tilt = pSharedMem->read_double(STAGE2_ENGINE_GIMBAL_TILT);
double x_thrust = cos(gimbal_tilt);
double y_thrust = sin(gimbal_tilt)*sin(gimbal_roll);
double z_thrust = sin(gimbal_tilt)*cos(gimbal_roll);
//use y and z thrusts to compute moments
//temp: use 8.25/2 = 4.13m as moment arm (correct value would require position of CG)
double x_moment = 0;
double y_moment = z_thrust * 4.13 * rated_thrust;
double z_moment = y_thrust * 4.13 * rated_thrust;
cVec input(x_thrust, y_thrust, z_thrust);
//this rotates from body to east-north-up
cVec thrust_enu = state.att.rotate_vector(input);
//we have to rotate again to get to ecef
cVec thrust_ecef = state.convert_orientation_ENU_to_ECEF(thrust_enu);
thrust_ecef.scale(rated_thrust);
bBurning = false;
//first check if there is an external command to turn on the engine
if (pSharedMem->read_int(STAGE2_ENGINE_ON) != 0)
bBurning = true;
//if we have less than 4590 - 4050 = 540 kg of mass, stop burning because we have run out of fuel
if (state.mass < 540)
bBurning = false;
if (bBurning == true)
{
ret.fx = thrust_ecef.x;
ret.fy = thrust_ecef.y;
ret.fz = thrust_ecef.z;
//note that, we are currently passing moments
//in the body frame of reference,
//while forces are being passed in ECEF frame of reference
ret.mx = x_moment;
ret.my = y_moment;
ret.mz = z_moment;
}
return ret;
}
//***********************************************************//
//***********************************************************//
cThrustEffect cEngineModel::get_thrust_effect_phase1(cState state, cForceMoment thrust)
{
cThrustEffect ret(0,0,0,0);
if (bBurning == true)
{
//4050 kg in 378 sec
ret.dMass = -4050.0 / 378.0;
}
return ret;
}
//***********************************************************//
//***********************************************************//<file_sep>#include <math.h>
#include <windows.h>
#pragma once
//this is normal, "3d" vertex format
struct vertex{
float x, y, z;
float nx, ny, nz;
DWORD colour;
float tu, tv;
};
//this is the 2d vertex format
struct vertex2d{
float x, y; // screen position
float z; // Z-buffer depth
float rhw; // reciprocal homogeneous W
DWORD Diffuse; // diffuse color
float tu1, tv1; // texture coordinates
};
//we bring Titan6's cVec class because the D3DXVECTOR version
//only has single precision, and that is starting to cause us pain
class VECTOR3
{
public:
double x;
double y;
double z;
VECTOR3(double _x, double _y, double _z)
{
x = _x;
y = _y;
z = _z;
}
VECTOR3()
{
x = 0;
y = 0;
z = 0;
}
double mag()
{
double mag_squared = x*x + y*y + z*z;
if (mag_squared == 0.0)
return 0;
else
return sqrt(mag_squared);
}
void normalize()
{
double magnitude = mag();
if (magnitude != 0)
{
x = x / magnitude;
y = y / magnitude;
z = z / magnitude;
}
}
VECTOR3 get_normalized()
{
double magnitude = mag();
if (magnitude != 0)
return VECTOR3(x / magnitude, y / magnitude, z / magnitude);
else
return VECTOR3(0, 0, 0);
}
VECTOR3 scale(double factor)
{
x *= factor;
y *= factor;
z *= factor;
return VECTOR3(x,y,z);
}
VECTOR3 operator*(double scale)
{
VECTOR3 ret;
ret.x = this->x * scale;
ret.y = this->y * scale;
ret.z = this->z * scale;
return ret;
}
friend VECTOR3 operator * ( double scale, const VECTOR3& rhs)
{
VECTOR3 ret;
ret.x = rhs.x * scale;
ret.y = rhs.y * scale;
ret.z = rhs.z * scale;
return ret;
}
VECTOR3 operator+(const VECTOR3& rhs)
{
VECTOR3 ret;
ret.x = this->x + rhs.x;
ret.y = this->y + rhs.y;
ret.z = this->z + rhs.z;
return ret;
}
VECTOR3 operator-(const VECTOR3& rhs)
{
VECTOR3 ret;
ret.x = this->x - rhs.x;
ret.y = this->y - rhs.y;
ret.z = this->z - rhs.z;
return ret;
}
double dot(VECTOR3 other)
{
return x*other.x + y*other.y + z*other.z;
}
double component_along(VECTOR3 other)
{
// a dot b = |a||b| cos(theta)
VECTOR3 norm_a = get_normalized();
VECTOR3 norm_b = other.get_normalized();
double dot_product = norm_a.dot(norm_b); //equal to cos(theta)
return dot_product*mag();
}
VECTOR3 component_along_v(VECTOR3 other)
{
// a dot b = |a||b| cos(theta)
VECTOR3 norm_a = get_normalized();
VECTOR3 norm_b = other.get_normalized();
double dot_product = norm_a.dot(norm_b); //equal to cos(theta)
return norm_b*dot_product*mag();
}
void invert()
{
scale(-1.0);
}
};
//and our own cMatrix struct (this is the D3DMATRIX struct with the
//floats changed to doubles
typedef struct _MATRIX {
union {
struct {
double _11, _12, _13, _14;
double _21, _22, _23, _24;
double _31, _32, _33, _34;
double _41, _42, _43, _44;
};
double m[4][4];
};
} MATRIX;
vertex compute_normal(vertex p1, vertex p2, vertex p3);
int copy_normal(vertex* p1, vertex* p2);
MATRIX create_identity_matrix();
<file_sep>#include "cQuaternion.h"
//***********************************************//
//***********************************************//
double cQuaternion::get_phi()
{
return atan2(2*(w*i + j*k), 1 - 2*(i*i + j*j));
}
//***********************************************//
//***********************************************//
double cQuaternion::get_phi_deg()
{
return get_phi() * RAD_TO_DEG;
}
//***********************************************//
//***********************************************//
double cQuaternion::get_theta()
{
double convention_theta = asin(2*(w*j - k*i));
//this is done so that a positive theta yields the convention
//that the x-axis rotates towards the z
return convention_theta*-1;
}
//***********************************************//
//***********************************************//
double cQuaternion::get_theta_deg()
{
return get_theta()*RAD_TO_DEG;
}
//***********************************************//
//***********************************************//
double cQuaternion::get_psi()
{
return atan2(2*(w*k + i*j), 1 - 2*(j*j + k*k));
}
//***********************************************//
//***********************************************//
double cQuaternion::get_psi_deg()
{
return get_psi() * RAD_TO_DEG;
}
//***********************************************//
//***********************************************//
//performs a post-multiplication (this * other)
int cQuaternion::apply_quaternion(cQuaternion oth)
{
double nw = w*oth.w - i*oth.i - j*oth.j - k*oth.k;
double ni = w*oth.i + i*oth.w + j*oth.k - k*oth.j;
double nj = w*oth.j - i*oth.k + j*oth.w + k*oth.i;
double nk = w*oth.k + i*oth.j - j*oth.i + k*oth.w;
w = nw;
i = ni;
j = nj;
k = nk;
return 0;
}
//***********************************************//
//***********************************************//
int cQuaternion::set_rotation(double v_x, double v_y, double v_z, double rotation_rad)
{
//normalize
double magnitude = sqrt(v_x*v_x + v_y*v_y + v_z*v_z);
if (magnitude != 0)
{
v_x /= magnitude;
v_y /= magnitude;
v_z /= magnitude;
} else
{
v_x = 0;
v_y = 0;
v_z = 0;
}
double half_sine = sin(rotation_rad * 0.5);
w = cos(rotation_rad * 0.5);
i = half_sine*v_x;
j = half_sine*v_y;
k = half_sine*v_z;
return 0;
}
//***********************************************//
//***********************************************//
cVec cQuaternion::rotate_vector(cVec input)
{
return rotate_vector(input.x, input.y, input.z);
}
//***********************************************//
//***********************************************//
cVec cQuaternion::rotate_vector(double x, double y, double z)
{
cQuaternion q_input;
q_input.w = 0;
q_input.i = x;
q_input.j = y;
q_input.k = z;
cQuaternion q_output;
q_output.w = w;
q_output.i = i;
q_output.j = j;
q_output.k = k;
cQuaternion q_inverse;
q_inverse.w = w;
q_inverse.i = -i;
q_inverse.j = -j;
q_inverse.k = -k;
q_output.apply_quaternion(q_input);
q_output.apply_quaternion(q_inverse);
cVec ret(0, 0, 0);
ret.x = q_output.i;
ret.y = q_output.j;
ret.z = q_output.k;
return ret;
}
//***********************************************//
//***********************************************//
int cQuaternion::apply_rotation(double w_x, double w_y, double w_z, double dt)
{
double rot_mag = 0;
if ((w_x != 0) || (w_y != 0) || (w_z != 0))
rot_mag = sqrt(w_x*w_x + w_y*w_y + w_z*w_z)*dt;
cQuaternion q_new;
q_new.set_rotation(w_x, w_y, w_z, rot_mag);
cQuaternion q_curr;
q_curr.w = w;
q_curr.i = i;
q_curr.j = j;
q_curr.k = k;
//apply_quaternion(q_new);
//the new quaternion gets pre-multiplied onto the current quat
//not post-multiplied
q_new.apply_quaternion(q_curr);
w = q_new.w;
i = q_new.i;
j = q_new.j;
k = q_new.k;
return 0;
}
//***********************************************//
//***********************************************//
int cQuaternion::set_rotation(double phi, double theta, double psi)
{
//this is to enforce the convention that positive theta rotates the x-axis towards the z
theta *= -1;
double cosphi = cos(phi / 2.0);
double sinphi = sin(phi / 2.0);
double costheta = cos(theta / 2.0);
double sintheta = sin(theta / 2.0);
double cospsi = cos(psi / 2.0);
double sinpsi = sin(psi / 2.0);
w = cosphi*costheta*cospsi + sinphi*sintheta*sinpsi;
i = sinphi*costheta*cospsi - cosphi*sintheta*sinpsi;
j = cosphi*sintheta*cospsi + sinphi*costheta*sinpsi;
k = cosphi*costheta*sinpsi - sinphi*sintheta*cospsi;
return 0;
}
//***********************************************//
//***********************************************//
int cQuaternion::set_rotation_deg(double phi_deg, double theta_deg, double psi_deg)
{
return set_rotation(phi_deg * DEG_TO_RAD, theta_deg * DEG_TO_RAD, psi_deg*DEG_TO_RAD);
}
//***********************************************//
//***********************************************//
cVec cQuaternion::get_pitch_axis()
{
return rotate_vector(0, 1, 0);
}
//***********************************************//
//***********************************************//
cVec cQuaternion::get_roll_axis()
{
return rotate_vector(1, 0, 0);
}
//***********************************************//
//***********************************************//
cVec cQuaternion::get_yaw_axis()
{
return rotate_vector(0, 0, 1);
}
//***********************************************//
//***********************************************//
<file_sep>#include "main.h"
//instantiate the data recorder.
cDataRecorder DataRecorder;
//this is the main function of the program.
int main()
{
//initialize shared memory
init_sm();
//loop and read commands from
while (TRUE)
{
int iCommand = sm_read_int(RECORDER_COMMAND);
//clear to indicate reception
sm_write_int(RECORDER_COMMAND, 0);
//act on command:
//1 is quit
if (iCommand == 1)
break;
//2 is to start recording
if (iCommand == 2)
{
DataRecorder.record_begin();
}
//3 is to stop recording
if (iCommand == 3)
{
DataRecorder.record_end();
}
//4 is to export files
if (iCommand == 4)
{
DataRecorder.export_external_ephemeris(0, "stage1.e");
DataRecorder.export_external_ephemeris(1, "stage2.e");
}
//give the recorder a chance to capture
DataRecorder.capture_data();
//sleep for 1 second to yield time
Sleep(1);
}
return 0;
}<file_sep>#include "cD3D.h"
//*******************************************************//
//*******************************************************//
int cD3D::init()
{
D3D = Direct3DCreate9( D3D_SDK_VERSION);
if(D3D == NULL)
{
return -1;
}
for (int lc1 = 0; lc1 < MAX_D3D_DEVICES; lc1++)
{
Devices[lc1].init(lc1);
}
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D::exit()
{
for (int lc1 = 0; lc1 < MAX_D3D_DEVICES; lc1++)
{
Devices[lc1].exit();
}
if(D3D != NULL)
{
D3D->Release();
D3D=NULL;
}
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D::load_window_3d(int iWindow, HWND _hWindow, int _iWidth, int _iHeight)
{
if (iWindow < 0)
return -1;
if (iWindow >= MAX_D3D_DEVICES)
return -1;
Devices[iWindow].iHeight = _iHeight;
Devices[iWindow].iWidth = _iWidth;
Devices[iWindow].DeviceParams.BackBufferHeight = _iHeight;
Devices[iWindow].DeviceParams.BackBufferWidth = _iWidth;
Devices[iWindow].DeviceParams.BackBufferFormat = D3DFMT_UNKNOWN;
Devices[iWindow].DeviceParams.BackBufferCount = 0;
Devices[iWindow].DeviceParams.MultiSampleType = D3DMULTISAMPLE_NONE;//D3DMULTISAMPLE_8_SAMPLES; //D3DMULTISAMPLE_NONE;
Devices[iWindow].DeviceParams.MultiSampleQuality = 0;
Devices[iWindow].DeviceParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
Devices[iWindow].DeviceParams.hDeviceWindow = _hWindow;
Devices[iWindow].DeviceParams.Windowed = TRUE;
Devices[iWindow].DeviceParams.EnableAutoDepthStencil = TRUE;
Devices[iWindow].DeviceParams.AutoDepthStencilFormat = D3DFMT_D24X8; //D3DFMT_D16;
Devices[iWindow].DeviceParams.Flags = 0;
Devices[iWindow].DeviceParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
Devices[iWindow].DeviceParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
//Note D3DCREATE_FPU_PRESERVE
//If you don't do this, Direct3D can somehow change the precision of *all* following
//floating point calculations to single precision. Which will have some painful
//consequences when trying to show satellites in orbit...
HRESULT hr2 = D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, _hWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &Devices[iWindow].DeviceParams, &Devices[iWindow].Device);
Devices[iWindow].init_renderstate_3d();
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D::load_window_2d(int iWindow, HWND _hWindow, int _iWidth, int _iHeight)
{
if (iWindow < 0)
return -1;
if (iWindow >= MAX_D3D_DEVICES)
return -1;
Devices[iWindow].iHeight = _iHeight;
Devices[iWindow].iWidth = _iWidth;
Devices[iWindow].DeviceParams.BackBufferHeight = _iHeight;
Devices[iWindow].DeviceParams.BackBufferWidth = _iWidth;
Devices[iWindow].DeviceParams.BackBufferFormat = D3DFMT_UNKNOWN;
Devices[iWindow].DeviceParams.BackBufferCount = 0;
Devices[iWindow].DeviceParams.MultiSampleType = D3DMULTISAMPLE_NONE;//D3DMULTISAMPLE_8_SAMPLES; //D3DMULTISAMPLE_NONE;
Devices[iWindow].DeviceParams.MultiSampleQuality = 0;
Devices[iWindow].DeviceParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
Devices[iWindow].DeviceParams.hDeviceWindow = _hWindow;
Devices[iWindow].DeviceParams.Windowed = TRUE;
Devices[iWindow].DeviceParams.EnableAutoDepthStencil = TRUE;
Devices[iWindow].DeviceParams.AutoDepthStencilFormat = D3DFMT_D16;
Devices[iWindow].DeviceParams.Flags = 0;
Devices[iWindow].DeviceParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
Devices[iWindow].DeviceParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
//Note D3DCREATE_FPU_PRESERVE
//If you don't do this, Direct3D can somehow change the precision of *all* following
//floating point calculations to single precision. Which will have some painful
//consequences when trying to show satellites in orbit...
HRESULT hr2 = D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, _hWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &Devices[iWindow].DeviceParams, &Devices[iWindow].Device);
if (hr2 == D3DERR_DEVICELOST)
{
printf ("D3DERR_DEVICELOST\n");
}
if (hr2 == D3DERR_INVALIDCALL)
{
printf ("D3DERR_INVALIDCALL\n");
}
if (hr2 == D3DERR_NOTAVAILABLE)
{
printf("D3DERR_NOTAVAILABLE\n");
}
Devices[iWindow].init_renderstate_2d();
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D::render(VECTOR3 start_offset0, VECTOR3 start_offset1, double scale1, double sim_time)
{
if (Devices[0].Device != NULL)
Devices[0].render0(start_offset0, sim_time);
if (Devices[1].Device != NULL)
Devices[1].render1(start_offset1, scale1, sim_time);
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::init(int _iDeviceID)
{
Device = NULL;
iDeviceID = _iDeviceID;
m_font = NULL;
RenderList = new cRenderObject();
RenderList->init();
iHeight = 0;
iWidth = 0;
cam_yaw = 0;
cam_tilt = 0;
cam_dist = 20;
bViewChanged = false;
bFollow = false;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::exit()
{
if (RenderList != NULL)
{
RenderList->exit();
delete RenderList;
RenderList = NULL;
}
if (m_font != NULL)
{
m_font->Release();
m_font = NULL;
}
if (Device != NULL)
{
Device->Release();
Device = NULL;
}
return 0;
}
//*******************************************************//
//*******************************************************//
D3DMATRIX cD3D_Device::GetD3DMatrix(MATRIX input)
{
D3DMATRIX ret;
ret._11 = input._11;
ret._12 = input._12;
ret._13 = input._13;
ret._14 = input._14;
ret._21 = input._21;
ret._22 = input._22;
ret._23 = input._23;
ret._24 = input._24;
ret._31 = input._31;
ret._32 = input._32;
ret._33 = input._33;
ret._34 = input._34;
ret._41 = input._41;
ret._42 = input._42;
ret._43 = input._43;
ret._44 = input._44;
return ret;
}
//*******************************************************//
//*******************************************************//
//render a history line with the supplied history buffer
int cD3D_Device::render_history_line(cHistoryBuffer* pHistBuff, VECTOR3 position_offset, MATRIX CurrTransform)
{
//keep track of the number of vertexes we're actually going to render
int iNumVertexes = 0;
//fill the vertex buffer with the real points we're going to use
for (int i = 1; i < HISTORY_BUFFER_SIZE; i++)
{
//calculate the actual index we're using
int index = pHistBuff->curr_index - i;
//wrap around
if (index < 0)
index += HISTORY_BUFFER_SIZE;
//break if this point is not enabled
if (pHistBuff->Points[index].bValid == false)
break;
if (i > 1)
{
int prev_index = index + 1;
//wrap around
if (prev_index >= HISTORY_BUFFER_SIZE)
prev_index -= HISTORY_BUFFER_SIZE;
//otherwise put it's data into the buffer
pHistBuff->Vertexes[iNumVertexes].x = pHistBuff->Points[prev_index].px + position_offset.x;
pHistBuff->Vertexes[iNumVertexes].y = pHistBuff->Points[prev_index].py + position_offset.y;
pHistBuff->Vertexes[iNumVertexes].z = pHistBuff->Points[prev_index].pz + position_offset.z;
iNumVertexes++;
//otherwise put it's data into the buffer
pHistBuff->Vertexes[iNumVertexes].x = pHistBuff->Points[index].px + position_offset.x;
pHistBuff->Vertexes[iNumVertexes].y = pHistBuff->Points[index].py + position_offset.y;
pHistBuff->Vertexes[iNumVertexes].z = pHistBuff->Points[index].pz + position_offset.z;
//increment vertex count
iNumVertexes++;
}
}
//if we had less than 2 vertexes, exit early sicne we can't draw it
if (iNumVertexes < 2)
return 0;
//declare a raw pointer to retrieve the vertex buffer from D3D
vertex* pVert = NULL;
//now "lock in" the raw history data and get the pointer
pHistBuff->VertexBuffer->Lock(0, 0, (void**)&pVert, D3DLOCK_DISCARD);
//and now copy over the data from our "pre" vertex buffer
memcpy(pVert, pHistBuff->Vertexes, sizeof(vertex)*iNumVertexes);
//unlock the buffer
pHistBuff->VertexBuffer->Unlock();
//now render this buffer
//set transform
D3DMATRIX TransformInput = GetD3DMatrix(create_identity_matrix());//CurrTransform);
HRESULT hr = Device->SetTransform(D3DTS_WORLD, &TransformInput);
hr = Device->SetMaterial(&pHistBuff->Material);
//set up stream location
hr = Device->SetStreamSource(0, pHistBuff->VertexBuffer, 0, sizeof(vertex));
//actually render
hr = Device->DrawPrimitive(D3DPT_LINELIST, 0, iNumVertexes / 2);
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render_history_line_2d(cHistoryBuffer* pHistBuff, double x_offset, double y_offset, double input_scale)
{
//keep track of the number of vertexes we're actually going to render
int iNumVertexes = 0;
//fill the vertex buffer with the real points we're going to use
for (int i = 1; i < HISTORY_BUFFER_SIZE; i++)
{
//calculate the actual index we're using
int index = pHistBuff->curr_index - i;
//wrap around
if (index < 0)
index += HISTORY_BUFFER_SIZE;
//break if this point is not enabled
if (pHistBuff->Points[index].bValid == false)
break;
//do a range check (to prevent the history line from wrapping around)
if (i > 1)
{
int prev_index = index + 1;
//wrap around
if (prev_index >= HISTORY_BUFFER_SIZE)
prev_index -= HISTORY_BUFFER_SIZE;
//compute differences
double dx = pHistBuff->Points[index].px - pHistBuff->Points[prev_index].px;
double dy = pHistBuff->Points[index].py - pHistBuff->Points[prev_index].py;
double ds = dx*dx + dy*dy;
double s = 0;
if (ds > 0)
s = sqrt(ds);
//only add if we don't exceed a certain length
//this is different from the 3D history line implementation
//in that we are sending data to the buffer as lines, and not a line strip
if (s < 5.0)
{
//send both the previous point and the current one
pHistBuff->Vertexes[iNumVertexes].x = (pHistBuff->Points[prev_index].px + x_offset - 320) * input_scale + 320;
pHistBuff->Vertexes[iNumVertexes].y = (pHistBuff->Points[prev_index].py + y_offset - 240) * input_scale + 240;
pHistBuff->Vertexes[iNumVertexes].z = 0.5;
//increment vertex count
iNumVertexes++;
pHistBuff->Vertexes[iNumVertexes].x = (pHistBuff->Points[index].px + x_offset - 320) * input_scale + 320;
pHistBuff->Vertexes[iNumVertexes].y = (pHistBuff->Points[index].py + y_offset - 240) * input_scale + 240;
pHistBuff->Vertexes[iNumVertexes].z = 0.5;
//increment vertex count
iNumVertexes++;
//wrap around line segments
if ((pHistBuff->Points[index].px + x_offset) < 0.0)
{
pHistBuff->Vertexes[iNumVertexes-1].x += 640.0 * input_scale;
pHistBuff->Vertexes[iNumVertexes-2].x += 640.0 * input_scale;
}
if ((pHistBuff->Points[index].py + y_offset) < 0.0)
{
pHistBuff->Vertexes[iNumVertexes-1].y += 480.0 * input_scale;
pHistBuff->Vertexes[iNumVertexes-2].y += 480.0 * input_scale;
}
if ((pHistBuff->Points[index].px + x_offset) > 640.0)
{
pHistBuff->Vertexes[iNumVertexes-1].x -= 640.0 * input_scale;
pHistBuff->Vertexes[iNumVertexes-2].x -= 640.0 * input_scale;
}
if ((pHistBuff->Points[index].py + y_offset) > 480.0)
{
pHistBuff->Vertexes[iNumVertexes-1].y -= 480.0 * input_scale;
pHistBuff->Vertexes[iNumVertexes-2].y -= 480.0 * input_scale;
}
}
}
}
//if we had less than 2 vertexes, exit early sicne we can't draw it
if (iNumVertexes < 2)
return 0;
//declare a raw pointer to retrieve the vertex buffer from D3D
vertex2d* pVert = NULL;
//now "lock in" the raw history data and get the pointer
pHistBuff->VertexBuffer->Lock(0, 0, (void**)&pVert, D3DLOCK_DISCARD);
//note: we're doing it this way because "vertexes" is actually the 3D fvf buffer,
//while pVert is the 2D buffer. Since we're just copying over the x and y coordinates, I thought
//this was fine...for now.
for (int lc0 = 0; lc0 < iNumVertexes; lc0++)
{
pVert[lc0].x = pHistBuff->Vertexes[lc0].x;
pVert[lc0].y = pHistBuff->Vertexes[lc0].y;
pVert[lc0].z = pHistBuff->Vertexes[lc0].z;
pVert[lc0].Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
pVert[lc0].rhw = 1.0f;
}
//unlock the buffer
pHistBuff->VertexBuffer->Unlock();
//now render this buffer
HRESULT hr = Device->SetMaterial(&pHistBuff->Material);
//set up stream location
hr = Device->SetStreamSource(0, pHistBuff->VertexBuffer, 0, sizeof(vertex2d));
//actually render (not it's LINELIST isntead of LINESTRIP)
hr = Device->DrawPrimitive(D3DPT_LINELIST, 0, iNumVertexes / 2);
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
//adds a history buffer to a render object
int cD3D_Device::add_history_buffer(cRenderObject* input_object, bool initial_enable_status, D3DXCOLOR history_line_color)
{
//allocate a new history buffer
input_object->pHistoryBuffer = new cHistoryBuffer();
//set it's initial enable status
input_object->pHistoryBuffer->bEnable = initial_enable_status;
//initialize it's vertex buffer
init_vertex_buffer_for_history(input_object->pHistoryBuffer, HISTORY_BUFFER_SIZE);
//initialize it's material
ZeroMemory( &input_object->pHistoryBuffer->Material, sizeof(D3DMATERIAL9));
input_object->pHistoryBuffer->Material.Diffuse = history_line_color;
input_object->pHistoryBuffer->Material.Ambient = history_line_color;
input_object->pHistoryBuffer->Material.Emissive = history_line_color;
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
//adds a history buffer to a render object, 2D version
int cD3D_Device::add_history_buffer_2d(cRenderObject* input_object, bool initial_enable_status, D3DXCOLOR history_line_color)
{
//allocate a new history buffer
input_object->pHistoryBuffer = new cHistoryBuffer();
//set it's initial enable status
input_object->pHistoryBuffer->bEnable = initial_enable_status;
//initialize it's vertex buffer
init_vertex_buffer_for_history_2d(input_object->pHistoryBuffer, HISTORY_BUFFER_SIZE);
//initialize it's material
ZeroMemory( &input_object->pHistoryBuffer->Material, sizeof(D3DMATERIAL9));
input_object->pHistoryBuffer->Material.Diffuse = history_line_color;
input_object->pHistoryBuffer->Material.Ambient = history_line_color;
input_object->pHistoryBuffer->Material.Emissive = history_line_color;
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render_object(cRenderObject* object_to_render, MATRIX BaseTransform)
{
HRESULT hr = 0;
if (object_to_render == NULL)
return -1;
//DEBUG
//fprintf(dfile, "%s, %f, %f, %f,", object_to_render->Name, BaseTransform._41, BaseTransform._42,BaseTransform._43);
//calculate transform
if ((object_to_render->iOrientationMode & ORIENTATION_MODE_BODYXYZ) != 0)
BaseTransform = apply_body_translation(BaseTransform, object_to_render->px, object_to_render->py, object_to_render->pz);
if ((object_to_render->iOrientationMode & ORIENTATION_MODE_LATLONGPR) != 0)
BaseTransform = apply_body_latlongpr(BaseTransform, object_to_render->latitude, object_to_render->longitude, object_to_render->pr);
if ((object_to_render->iOrientationMode & ORIENTATION_MODE_PITCHROLLYAW) != 0)
BaseTransform = apply_body_pitchrollyaw(BaseTransform, object_to_render->pitch, object_to_render->roll, object_to_render->yaw);
//save the transformed position values
//note that we apply the original start offsets to retrieve the right "initial" position.
object_to_render->abs_position.x = BaseTransform._41 - save_start_offset.x;
object_to_render->abs_position.y = BaseTransform._42 - save_start_offset.y;
object_to_render->abs_position.z = BaseTransform._43 - save_start_offset.z;
if (object_to_render->VertexBuffer != NULL)
{
//set transform
D3DMATRIX TransformInput = GetD3DMatrix(BaseTransform);
hr = Device->SetTransform(D3DTS_WORLD, &TransformInput);
//render self
hr = Device->SetStreamSource(0, object_to_render->VertexBuffer, 0, sizeof(vertex));
//if (object_to_render->Texture != NULL)
hr = Device->SetTexture(0,object_to_render->Texture);
hr = Device->SetMaterial(&object_to_render->Material);
hr = Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, object_to_render->iNumVertexes / 3);
}
//if the render object has a history buffer, and it's enabled, render it here
if (object_to_render->pHistoryBuffer != NULL)
if (object_to_render->pHistoryBuffer->bEnable == true)
{
//get the last point in history
VECTOR3 last_point = object_to_render->pHistoryBuffer->get_last_point();
//only add a new point to the history if it changed
//if ((render_count_0 % 5) == 0)
if ((last_point.x != object_to_render->abs_position.x) ||
(last_point.y != object_to_render->abs_position.y) ||
(last_point.z != object_to_render->abs_position.z))
object_to_render->pHistoryBuffer->add_point(object_to_render->abs_position.x, object_to_render->abs_position.y, object_to_render->abs_position.z);
//render history line
render_history_line(object_to_render->pHistoryBuffer, save_start_offset, BaseTransform);
}
cRenderObject* pTrav = object_to_render->pFirstChild;
while (pTrav != NULL)
{
render_object(pTrav, BaseTransform);
pTrav = pTrav->pNextSibling;
}
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::update_vertex_buffer_2d_alt(cRenderObject* input_object, double x_offset, double y_offset, double input_scale)
{
//declare a pointer to receive the "real" vertex buffer location
//once locked
vertex2d* vertices = NULL;
double min_x = 0;
double min_y = 0;
double max_x = 0;
double max_y = 0;
double o_max_tu = 0;
double o_max_tv = 0;
//determine min and max, x and y
for (int lc1 = 0; lc1 < input_object->iNumVertexes; lc1++)
{
double x = (input_object->Vertexes2d[lc1].x + x_offset - 320) * input_scale + 320;
double y = (input_object->Vertexes2d[lc1].y + y_offset - 240) * input_scale + 240;
double tu = input_object->Vertexes2d[lc1].tu1;
double tv = input_object->Vertexes2d[lc1].tv1;
if (x > max_x)
max_x = x;
if (x < min_x)
min_x = x;
if (y > max_y)
max_y = y;
if (y < min_y)
min_y = y;
if (tu > o_max_tu)
o_max_tu = tu;
if (tv > o_max_tv)
o_max_tv = tv;
}
//determine tu and tv to use
double min_tu = (-320.0 - min_x) / (max_x - min_x);
double min_tv = (-240.0 - min_y) / (max_y - min_y);
double max_tu = (320.0 - min_x) / (max_x - min_x);
double max_tv = (240.0 - min_y) / (max_y - min_y);
//now lock the pointer
input_object->VertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD);
vertices[0].x = 320.0;
vertices[0].y = 240.0;
vertices[0].z = input_object->Vertexes2d[0].z;
vertices[0].rhw = input_object->Vertexes2d[0].rhw;
vertices[0].Diffuse = input_object->Vertexes2d[0].Diffuse;
vertices[0].tu1 = max_tu;
vertices[0].tv1 = min_tv;
vertices[1].x = 320.0;
vertices[1].y = -240.0;
vertices[1].z = input_object->Vertexes2d[1].z;
vertices[1].rhw = input_object->Vertexes2d[1].rhw;
vertices[1].Diffuse = input_object->Vertexes2d[1].Diffuse;
vertices[1].tu1 = max_tu;
vertices[1].tv1 = max_tv;
vertices[2].x = -320.0;
vertices[2].y = -240.0;
vertices[2].z = input_object->Vertexes2d[2].z;
vertices[2].rhw = input_object->Vertexes2d[2].rhw;
vertices[2].Diffuse = input_object->Vertexes2d[2].Diffuse;
vertices[2].tu1 = min_tu;
vertices[2].tv1 = max_tv;
vertices[3].x = -320.0;
vertices[3].y = 240.0;
vertices[3].z = input_object->Vertexes2d[3].z;
vertices[3].rhw = input_object->Vertexes2d[3].rhw;
vertices[3].Diffuse = input_object->Vertexes2d[3].Diffuse;
vertices[3].tu1 = min_tu;
vertices[3].tv1 = min_tv;
//unlock
input_object->VertexBuffer->Unlock();
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
//re-copy the contents of the local vertex storage to the
//actual vertex buffer, adding the specified x_offset and y_offset
int cD3D_Device::update_vertex_buffer_2d(cRenderObject* input_object, double x_offset, double y_offset, double input_scale)
{
//declare a pointer to receive the "real" vertex buffer location
//once locked
vertex2d* vertices = NULL;
//now lock the pointer
input_object->VertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD);
double x_wrap_offset = 0;
double y_wrap_offset = 0;
if (input_object->bFixedScale2D == true)
{
if ((input_object->Vertexes2d[0].x + x_offset) < 0.0)
x_wrap_offset = 640.0;
if ((input_object->Vertexes2d[0].x + x_offset) > 640.0)
x_wrap_offset = -640.0;
if ((input_object->Vertexes2d[0].y + y_offset) < 0.0)
y_wrap_offset = 480.0;
if ((input_object->Vertexes2d[0].y + y_offset) > 480.0)
y_wrap_offset = -480.0;
}
//copy over the vertices
for (int lc1 = 0; lc1 < input_object->iNumVertexes; lc1++)
{
//copy over each one
if (input_object->bFixedScale2D == false)
{
vertices[lc1].x = (input_object->Vertexes2d[lc1].x + x_offset - 320) * input_scale + 320;
vertices[lc1].y = (input_object->Vertexes2d[lc1].y + y_offset - 240) * input_scale + 240;
} else
{
vertices[lc1].x = (x_offset - 320 + x_wrap_offset) * input_scale + 320 + input_object->Vertexes2d[lc1].x;
vertices[lc1].y = (y_offset - 240 + y_wrap_offset) * input_scale + 240 + input_object->Vertexes2d[lc1].y;
}
vertices[lc1].z = input_object->Vertexes2d[lc1].z;
vertices[lc1].rhw = input_object->Vertexes2d[lc1].rhw;
vertices[lc1].Diffuse = input_object->Vertexes2d[lc1].Diffuse;
vertices[lc1].tu1 = input_object->Vertexes2d[lc1].tu1;
vertices[lc1].tv1 = input_object->Vertexes2d[lc1].tv1;
}
//unlock
input_object->VertexBuffer->Unlock();
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render_object_2d(cRenderObject* object_to_render, MATRIX BaseTransform, double input_scale)
{
HRESULT hr = 0;
if (object_to_render == NULL)
return -1;
double old_x_offset = BaseTransform._41;
double old_y_offset = BaseTransform._42;
if (object_to_render->VertexBuffer != NULL)
{
//add the object's own x and y offsets to the transform
BaseTransform._41 += object_to_render->px;
BaseTransform._42 += object_to_render->py;
BaseTransform._43 += object_to_render->pz;
//update the vertex buffer
update_vertex_buffer_2d(object_to_render, BaseTransform._41, BaseTransform._42, input_scale);
//disble the "alt" option for now...doesn't seem to work
//if ((object_to_render->bFixedScale2D == true) && (input_scale > 1.0))
// update_vertex_buffer_2d_alt(object_to_render, BaseTransform._41, BaseTransform._42, input_scale);
//else
//render self
hr = Device->SetStreamSource(0, object_to_render->VertexBuffer, 0, sizeof(vertex2d));
if (object_to_render->Texture != NULL)
hr = Device->SetTexture(0,object_to_render->Texture);
//hr = Device->SetMaterial(&object_to_render->Material);
//if 3 polys its a triangle
if (object_to_render->iNumVertexes == 3)
hr = Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
//if 4 its a square (triangle strip, that is 2 triangles with 4 points)
if (object_to_render->iNumVertexes == 4)
hr = Device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
//if the render object has a history buffer, and it's enabled, render it here
if (object_to_render->pHistoryBuffer != NULL)
if (object_to_render->pHistoryBuffer->bEnable == true)
{
//get the last point in history
VECTOR3 last_point = object_to_render->pHistoryBuffer->get_last_point();
//only add a new point to the history if it changed
//if ((render_count_1 % 5) == 0)
if ((last_point.x != object_to_render->px) ||
(last_point.y != object_to_render->py))
object_to_render->pHistoryBuffer->add_point(object_to_render->px, object_to_render->py, object_to_render->pz);
//render history line
render_history_line_2d(object_to_render->pHistoryBuffer, old_x_offset, old_y_offset, input_scale);
}
cRenderObject* pTrav = object_to_render->pFirstChild;
while (pTrav != NULL)
{
render_object_2d(pTrav, BaseTransform, input_scale);
pTrav = pTrav->pNextSibling;
}
return 0;
}
//*******************************************************//
//*******************************************************//
//this is the 2d version of the vertex buffer initializer
int cD3D_Device::init_vertex_buffer_2d(cRenderObject* pObject, int _iNumVertexes)
{
int vertex_size = sizeof(vertex2d);
pObject->iNumVertexes = _iNumVertexes;
HRESULT hr = Device->CreateVertexBuffer(vertex_size * pObject->iNumVertexes, D3DUSAGE_WRITEONLY, vertex_2d, D3DPOOL_MANAGED, &pObject->VertexBuffer, NULL);
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::init_vertex_buffer(cRenderObject* pObject, int _iNumVertexes)
{
int vertex_size = sizeof(vertex);
pObject->iNumVertexes = _iNumVertexes;
HRESULT hr = Device->CreateVertexBuffer(vertex_size * pObject->iNumVertexes, D3DUSAGE_WRITEONLY, vertex_fvf, D3DPOOL_MANAGED, &pObject->VertexBuffer, NULL);
return 0;
}
//*******************************************************//
//*******************************************************//
//this version adds a buffer for use by the history line
int cD3D_Device::init_vertex_buffer_for_history(cHistoryBuffer* pHistBuff, int _iNumVertexes)
{
int vertex_size = sizeof(vertex);
HRESULT hr = Device->CreateVertexBuffer(vertex_size * HISTORY_BUFFER_SIZE, D3DUSAGE_WRITEONLY, vertex_fvf, D3DPOOL_MANAGED, &pHistBuff->VertexBuffer, NULL);
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
//this version adds a buffer for use by the history line, 2d version
int cD3D_Device::init_vertex_buffer_for_history_2d(cHistoryBuffer* pHistBuff, int _iNumVertexes)
{
int vertex_size = sizeof(vertex2d);
HRESULT hr = Device->CreateVertexBuffer(vertex_size * HISTORY_BUFFER_SIZE, D3DUSAGE_WRITEONLY, vertex_2d, D3DPOOL_MANAGED, &pHistBuff->VertexBuffer, NULL);
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
//obsolete.
D3DXVECTOR3 cD3D_Device::calc_lookat()
{
D3DXVECTOR3 base = eye_vector;
//rotate yaw
base.x += sin(cam_yaw)*cos(cam_tilt);
base.y += cos(cam_yaw)*cos(cam_tilt);
base.z += sin(cam_tilt);
return base;
}
//*******************************************************//
//*******************************************************//
//obsolete.
D3DXVECTOR3 cD3D_Device::calc_eye()
{
D3DXVECTOR3 base = D3DXVECTOR3(0,0,0);
//rotate yaw
base.x = cam_dist*cos(cam_tilt)*sin(cam_yaw);
base.y = cam_dist*cos(cam_tilt)*cos(cam_yaw);
base.z = cam_dist*sin(cam_tilt);
return base;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::set_z_planes(double zNear, double zFar)
{
D3DXMATRIX projection_matrix;
float aspect;
aspect=((float)iWidth / (float)iHeight);
D3DXMatrixPerspectiveFovLH(&projection_matrix, //Result Matrix
D3DX_PI/4, //Field of View, in radians.
aspect, //Aspect ratio
zNear, //Near view plane
zFar ); //Far view plane
HRESULT hr = Device->SetTransform(D3DTS_PROJECTION, &projection_matrix);
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::init_views0()
{
D3DXMATRIX view_matrix;
//View point is 8 units back on the y-axis
eye_vector=D3DXVECTOR3( 0.0f, -24.0f, 0 );
//We are looking towards the origin
lookat_vector=calc_lookat();
//The "up" direction is the positive direction on the z-axis
up_vector=D3DXVECTOR3(0.0f,0.0f,1.0f);
D3DXMatrixLookAtRH(&view_matrix,
&eye_vector,
&lookat_vector,
&up_vector);
HRESULT hr = Device->SetTransform(D3DTS_VIEW, &view_matrix);
D3DXMATRIX projection_matrix;
float aspect;
aspect=((float)iWidth / (float)iHeight);
D3DXMatrixPerspectiveFovLH(&projection_matrix, //Result Matrix
D3DX_PI/4, //Field of View, in radians.
aspect, //Aspect ratio
1.0f, //Near view plane
4000000.0f ); //Far view plane
hr = Device->SetTransform(D3DTS_PROJECTION, &projection_matrix);
D3DVIEWPORT9 view_port;
view_port.X=0;
view_port.Y=0;
view_port.Width=float(iWidth);
view_port.Height=float(iHeight);
view_port.MinZ=0.0f;
view_port.MaxZ=1.0f;
hr = Device->SetViewport(&view_port);
return 0;
}
//*******************************************************//
//*******************************************************//
MATRIX cD3D_Device::apply_body_translation(MATRIX input, double px, double py, double pz)
{
//the original basis vectors
VECTOR3 xbody0 = VECTOR3(input._11, input._12, input._13);
VECTOR3 ybody0 = VECTOR3(input._21, input._22, input._23);
VECTOR3 zbody0 = VECTOR3(input._31, input._32, input._33);
VECTOR3 translate_vector = VECTOR3(0,0,0);
translate_vector = xbody0*px + ybody0*py + zbody0*pz;
input._41 += translate_vector.x;
input._42 += translate_vector.y;
input._43 += translate_vector.z;
return input;
}
//*******************************************************//
//*******************************************************//
int cRenderObject::set_name(char* _Name)
{
int len = strlen(_Name);
if (len > 79)
len = 79;
memset(Name, 0, 80);
memcpy(Name, _Name, len);
return 0;
}
//*******************************************************//
//*******************************************************//
MATRIX cD3D_Device::apply_body_latlongpr(MATRIX input, double latitude, double longitude, double pr)
{
//note: I am thinking that the matrix subscripts are being interpreted (column, row)
//rather than (row, column) as I learned in math.
//the original basis vectors
VECTOR3 xbody0 = VECTOR3(input._11, input._12, input._13);
VECTOR3 ybody0 = VECTOR3(input._21, input._22, input._23);
VECTOR3 zbody0 = VECTOR3(input._31, input._32, input._33);
//because of LH coordinate system,
//longitude applies in the following way:
//longtiude = 0 -> x = -1, y = 0
//longitude = +90 (90E) -> x = 0, y = 1
//longitude = +180 (dateline) -> x = 1, y = 0
//longitude = +270 (90W) -> x = 0, y = -1
//assumes body is aligned with forward along x-axis.
//perform rotation to account for longitude
VECTOR3 xbody1 = (cos(-longitude) * xbody0) - (sin(-longitude) * ybody0);
VECTOR3 zbody1 = zbody0;
VECTOR3 ybody1 = (cos(-longitude) * ybody0) + (sin(-longitude) * xbody0);
//perform rotation to account for to account for latitude
VECTOR3 xbody2 = (zbody1 * cos(-latitude)) - (xbody1 * sin(-latitude));
VECTOR3 zbody2 = (xbody1 * cos(-latitude)) + (zbody1 * sin(-latitude));
VECTOR3 ybody2 = ybody1;
//set orientations
input._11 = xbody2.x;
input._12 = xbody2.y;
input._13 = xbody2.z;
input._21 = ybody2.x;
input._22 = ybody2.y;
input._23 = ybody2.z;
input._31 = zbody2.x;
input._32 = zbody2.y;
input._33 = zbody2.z;
//add translations along body z axis to account for radius
input._41 += zbody2.x * pr;
input._42 += zbody2.y * pr;
input._43 += zbody2.z * pr;
return input;
}
//*******************************************************//
//*******************************************************//
MATRIX cD3D_Device::apply_body_pitchrollyaw(MATRIX input, double pitch, double roll, double yaw)
{
//note: I am thinking that the matrix subscripts are being interpreted (column, row)
//rather than (row, column) as I learned in math.
//the original basis vectors
VECTOR3 xbody0 = VECTOR3(input._11, input._12, input._13);
VECTOR3 ybody0 = VECTOR3(input._21, input._22, input._23);
VECTOR3 zbody0 = VECTOR3(input._31, input._32, input._33);
//assumes body is aligned with forward along x-axis.
//perform rotation to account for yaw
VECTOR3 xbody1 = (xbody0 * cos(yaw)) + (ybody0 * sin(yaw));
VECTOR3 zbody1 = zbody0;
VECTOR3 ybody1 = (ybody0 * cos(yaw)) - (xbody0 * sin(yaw));
//perform rotation to account for to account for pitch
VECTOR3 xbody2 = (xbody1 * cos(pitch)) - (zbody1 * sin(pitch));
VECTOR3 zbody2 = (zbody1 * cos(pitch)) + (xbody1 * sin(pitch));
VECTOR3 ybody2 = ybody1;
//perform rotation to account for to account for roll
VECTOR3 ybody3 = (ybody2 * cos(roll)) - (zbody2 * sin(roll));
VECTOR3 zbody3 = (zbody2 * cos(roll)) + (ybody2 * sin(roll));
VECTOR3 xbody3 = xbody2;
//set orientations
input._11 = xbody3.x;
input._12 = xbody3.y;
input._13 = xbody3.z;
input._21 = ybody3.x;
input._22 = ybody3.y;
input._23 = ybody3.z;
input._31 = zbody3.x;
input._32 = zbody3.y;
input._33 = zbody3.z;
return input;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::reverse_normals(cRenderObject* pObj)
{
vertex* vertices = NULL;
pObj->VertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD);
for (int lc1 = 0; lc1 < pObj->iNumVertexes; lc1++)
{
vertices[lc1].nx *= -1;
vertices[lc1].ny *= -1;
vertices[lc1].nz *= -1;
}
pObj->VertexBuffer->Unlock();
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::init_views1()
{
D3DXVECTOR3 eye_vector,lookat_vector,up_vector;
D3DXMATRIX view_matrix;
//View point is 8 units back on the Z-axis
eye_vector=D3DXVECTOR3( 0.0f, -24.0f, 0 );
//We are looking towards the origin
lookat_vector=calc_lookat();
//The "up" direction is the positive direction on the y-axis
up_vector=D3DXVECTOR3(0.0f,1.0f,0.0f);
D3DXMatrixLookAtLH(&view_matrix,
&eye_vector,
&lookat_vector,
&up_vector);
HRESULT hr = Device->SetTransform(D3DTS_VIEW, &view_matrix);
D3DXMATRIX projection_matrix;
float aspect;
aspect=((float)iWidth / (float)iHeight);
D3DXMatrixPerspectiveFovLH(&projection_matrix, //Result Matrix
D3DX_PI/4, //Field of View, in radians.
aspect, //Aspect ratio
1.0f, //Near view plane
100.0f ); //Far view plane
hr = Device->SetTransform(D3DTS_PROJECTION, &projection_matrix);
D3DVIEWPORT9 view_port;
view_port.X=0;
view_port.Y=0;
view_port.Width=iWidth;
view_port.Height=iHeight;
view_port.MinZ=0.0f;
view_port.MaxZ=1.0f;
hr = Device->SetViewport(&view_port);
return 0;
}
//*******************************************************//
//*******************************************************//
//load the supplied render object with 2D sprite
int cD3D_Device::load_with_sprite(cRenderObject* input_object, vertex2d* buffer, int _iNumVertexes, WCHAR* TextureFile)
{
//fail on NULL object
if (input_object == NULL)
return -1;
//reject if not 3 or 4 vertexes
if (_iNumVertexes > 4)
return -1;
if (_iNumVertexes < 3)
return -1;
//copy over the passed buffer into local storage
for (int lc1 =0 ; lc1 < _iNumVertexes; lc1++)
{
input_object->Vertexes2d[lc1] = buffer[lc1];
}
//initialize the vertex buffer
init_vertex_buffer_2d(input_object, _iNumVertexes);
//save the number of vertexes
input_object->iNumVertexes = _iNumVertexes;
if (TextureFile != NULL)
D3DXCreateTextureFromFile(Device, //Direct3D Device
TextureFile, //File Name
&input_object->Texture); //Texture handle
//done.
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::load_with_model(cRenderObject* input_object, vertex* buffer, int _iNumVertexes, WCHAR* TextureFile)
{
if (input_object == NULL)
return -1;
ZeroMemory( &input_object->Material, sizeof(D3DMATERIAL9));
input_object->Material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
input_object->Material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
// D3DXMatrixIdentity((D3DXMATRIX*)&input_object->Transform);
init_vertex_buffer(input_object, _iNumVertexes);
vertex* vertices = NULL;
input_object->VertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD);
for (int lc1 = 0; lc1 < _iNumVertexes; lc1++)
{
vertices[lc1] = buffer[lc1];
}
input_object->VertexBuffer->Unlock();
input_object->iNumVertexes = _iNumVertexes;
if (TextureFile != NULL)
D3DXCreateTextureFromFile(Device, //Direct3D Device
TextureFile, //File Name
&input_object->Texture); //Texture handle
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::set_views()
{
/*
if (bViewChanged == false)
return -1;
if (bFollow == false)
lookat_vector=calc_lookat();
else
eye_vector=calc_eye();
*/
D3DXMATRIX view_matrix;
D3DXMatrixLookAtLH(&view_matrix,
&eye_vector,
&lookat_vector,
&up_vector);
HRESULT hr = Device->SetTransform(D3DTS_VIEW, &view_matrix);
if (cam_dist < 5.0)
set_z_planes(cam_dist*0.2, cam_dist*1000000.0f);
else if (cam_dist < 20000.0)
set_z_planes(cam_dist*0.5, 5000000.0f);
else
set_z_planes(10000.0f, 5000000.0f);
bViewChanged = false;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::eye_tilt_down()
{
if (cam_tilt > -1.5)
cam_tilt -= 0.01;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::eye_forward()
{
D3DXVECTOR3 diff = lookat_vector - eye_vector;
diff = diff * 0.3;
eye_vector = eye_vector + diff;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::eye_back()
{
D3DXVECTOR3 diff = lookat_vector - eye_vector;
diff = diff * 0.3;
eye_vector = eye_vector - diff;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::eye_tilt_up()
{
if (cam_tilt < 1.5)
cam_tilt += 0.02;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::eye_tilt_left()
{
cam_yaw -= 0.02;
if (cam_yaw < 0)
cam_yaw = 6.28;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::eye_tilt_right()
{
cam_yaw += 0.01;
if (cam_yaw > 6.28)
cam_yaw = 0;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::pan_left()
{
eye_vector.x -= cos(cam_yaw);
eye_vector.z += sin(cam_yaw);
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::pan_right()
{
eye_vector.x += cos(cam_yaw);
eye_vector.z -= sin(cam_yaw);
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::pan_up()
{
eye_vector.x -= sin(cam_tilt)*cos(cam_yaw);
eye_vector.y += cos(cam_tilt);
eye_vector.z -= sin(cam_tilt)*sin(cam_yaw);
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::pan_down()
{
eye_vector.x += sin(cam_tilt)*cos(cam_yaw);
eye_vector.y -= cos(cam_tilt);
eye_vector.z += sin(cam_tilt)*sin(cam_yaw);
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::follow_on()
{
eye_vector.x = cam_dist*cos(cam_tilt)*sin(cam_yaw);
eye_vector.y = cam_dist*sin(cam_tilt);
eye_vector.z = cam_dist*cos(cam_tilt)*cos(cam_yaw);
lookat_vector.x = 0;
lookat_vector.y = 0;
lookat_vector.z = 0;
bFollow = true;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::zoom_out()
{
if (cam_dist < 4000000.0)
cam_dist = cam_dist * 1.1;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::zoom_in()
{
if (cam_dist > 2.0)
cam_dist = cam_dist * 0.9;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::follow_off()
{
bFollow = false;
bViewChanged = true;
//bLight0Changed = true;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render_text(double sim_time)
{
//convert the simulation time to seconds
int i_seconds = (int)sim_time;
//get number of hours
int i_hours = i_seconds / 3600;
//remove from total
i_seconds -= i_hours * 3600;
//get number of minutes
int i_minutes = i_seconds / 60;
//remove from total
i_seconds -= i_minutes*60;
// Create a colour for the text - in this case blue
D3DCOLOR fontColor = D3DCOLOR_ARGB(255,255,255,255);
// Create a rectangle to indicate where on the screen it should be drawn
RECT rct;
rct.left=2;
rct.right=400;
rct.top=10;
rct.bottom=rct.top+180;
char NText[50];
NText[0] = 0;
char OutText[800];
memset(OutText, 0, 80);
strcat(OutText, "Time: ");
NText[0] = 0;
itoa(i_hours, NText, 10);
strcat(OutText, NText);
strcat(OutText, ":");
itoa(i_minutes, NText, 10);
if (i_minutes < 10)
strcat(OutText, "0");
strcat(OutText, NText);
strcat(OutText, ":");
if (i_seconds < 10)
strcat(OutText, "0");
itoa(i_seconds, NText, 10);
strcat(OutText, NText);
// Draw some text
m_font_large->DrawTextA(NULL, OutText, -1, &rct, 0, fontColor );
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render_text_2d()
{
// Create a colour for the text - in this case green
D3DCOLOR fontColor = D3DCOLOR_ARGB(255,0,255,0);
// Create a rectangle to indicate where on the screen it should be drawn
RECT rct;
rct.left=2;
rct.right=200;
rct.top=10;
rct.bottom=rct.top+180;
char NText[50];
NText[0] = 0;
char OutText[800];
memset(OutText, 0, 80);
strcat(OutText, "Ground Track");
// Draw some text
m_font->DrawTextA(NULL, OutText, -1, &rct, 0, fontColor );
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render0(VECTOR3 start_offset, double sim_time)
{
//increment render count
render_count_0++;
//dfile = fopen("c:/output2.csv", "a+");
//fprintf(dfile, "time, %f,", sim_time);
set_views();
set_lights();
HRESULT hr = Device->Clear(0, //Number of rectangles to clear, we're clearing everything so set it to 0
NULL, //Pointer to the rectangles to clear, NULL to clear whole display
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, //What to clear. We don't have a Z Buffer or Stencil Buffer
0x00000000, //Colour to clear to (AARRGGBB)
1.0f, //Value to clear ZBuffer to, doesn't matter since we don't have one
0 ); //Stencil clear value, again, we don't have one, this value doesn't matter
if (hr != S_OK)
return -1;
hr = Device->BeginScene();
if (hr != S_OK)
return -1;
render_text(sim_time);
//D3DXMATRIX mat1;
//D3DXMatrixIdentity(&mat1);
MATRIX StartMatrix = create_identity_matrix();
//offset by start offset
StartMatrix._41 = start_offset.x;
StartMatrix._42 = start_offset.y;
StartMatrix._43 = start_offset.z;
//save start offsets
save_start_offset = start_offset;
//now start rendering
render_object(RenderList, StartMatrix);
hr = Device->EndScene();
if (hr != S_OK)
return -1;
hr = Device->Present(NULL, NULL, NULL, NULL);
//fprintf(dfile, "\n");
//fclose(dfile);
if (hr != S_OK)
return -1;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::render1(VECTOR3 start_offset, double input_scale, double sim_time)
{
//dfile = fopen("c:/output2.csv", "a+");
//fprintf(dfile, "time, %f,", sim_time);
//set_views();
//set_lights();
render_count_1++;
HRESULT hr = Device->Clear(0, //Number of rectangles to clear, we're clearing everything so set it to 0
NULL, //Pointer to the rectangles to clear, NULL to clear whole display
D3DCLEAR_TARGET, //What to clear. We don't have a Z Buffer or Stencil Buffer
D3DCOLOR_XRGB(0,0,0), //Colour to clear to (AARRGGBB)
1.0f, //Value to clear ZBuffer to, doesn't matter since we don't have one
0 ); //Stencil clear value, again, we don't have one, this value doesn't matter
if (hr != S_OK)
return -1;
hr = Device->BeginScene();
if (hr != S_OK)
return -1;
MATRIX StartMatrix = create_identity_matrix();
//offset by start offset
StartMatrix._41 = start_offset.x;
StartMatrix._42 = start_offset.y;
StartMatrix._43 = start_offset.z;
//now start rendering
render_object_2d(RenderList, StartMatrix, input_scale);
render_text_2d();
hr = Device->EndScene();
if (hr != S_OK)
return -1;
hr = Device->Present(NULL, NULL, NULL, NULL);
if (hr != S_OK)
return -1;
return 0;
}
//*******************************************************//
//*******************************************************//
int cRenderObject::init()
{
pFirstChild = NULL;
pNextSibling = NULL;
VertexBuffer = NULL;
Texture = NULL;
Vertexes = NULL;
pHistoryBuffer = NULL;
iNumVertexes = 0;
bFixedScale2D = false;
iOrientationMode = 0;
latitude = 0;
longitude = 0;
pr = 0;
pitch = 0;
roll = 0;
yaw = 0;
px = 0;
py = 0;
pz = 0;
return 0;
}
//*******************************************************//
//*******************************************************//
int cRenderObject::exit()
{
//release own
if (VertexBuffer != NULL)
{
VertexBuffer->Release();
VertexBuffer = NULL;
}
if (Texture != NULL)
{
Texture->Release();
Texture = NULL;
}
if (Vertexes != NULL)
{
delete [] Vertexes;
Vertexes = NULL;
iNumVertexes = 0;
}
//release history buffer if it exists
if (pHistoryBuffer != NULL)
{
delete pHistoryBuffer;
pHistoryBuffer = NULL;
}
cRenderObject* pTrav = pFirstChild;
cRenderObject* pNext;
while (pTrav != NULL)
{
pNext = pTrav->pNextSibling;
pTrav->exit();
delete pTrav;
pTrav = pNext;
}
return 0;
}
//*******************************************************//
//*******************************************************//
cRenderObject* cRenderObject::add_child()
{
if (pFirstChild == NULL)
{
pFirstChild = new cRenderObject();
pFirstChild->init();
return pFirstChild;
}
cRenderObject* pTail = pFirstChild;
while (pTail->pNextSibling != NULL)
pTail = pTail->pNextSibling;
cRenderObject* pNew = new cRenderObject();
pNew->init();
pTail->pNextSibling = pNew;
pTail = pNew;
return pNew;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::init_lights0()
{
ZeroMemory( &light0, sizeof(light0) );
light0.Type = D3DLIGHT_POINT;
light0.Position = eye_vector;//D3DXVECTOR3(0.0f, 10.0f, 20.0f);
light0.Range = 0.0; //<-- i.e. disabled//300.0f;
light0.Attenuation0 = 0.0f;
light0.Attenuation1 = 0.25f;
light0.Attenuation2 = 0.0f;
light0.Diffuse.r = light0.Diffuse.g = light0.Diffuse.b = 0.25f;
Device->SetLight( 0, &light0 );
Device->LightEnable(0, TRUE);
// Set light #0 to be a simple, faint grey directional light so
// the walls and floor are slightly different shades of grey
ZeroMemory( &light1, sizeof(light1) );
light1.Type = D3DLIGHT_DIRECTIONAL;
light1.Direction = D3DXVECTOR3(0.0f, 10.0f, 20.0f);
//light1.Range = 3000.0f;
//light1.Attenuation0 = 0.0f;
//light1.Attenuation1 = 0.25f;
//light1.Attenuation2 = 0.0f;
light1.Diffuse.r = light1.Diffuse.g = light1.Diffuse.b = 1.0f;
Device->SetLight( 1, &light1 );
Device->LightEnable(1, TRUE);
Device->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_XRGB(128,128,128));
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::build_globe(cRenderObject* pObject)
{
if (pObject == NULL)
return -1;
int divlat = 60;
int divlong = 60;
double inclat = 90.0 / divlat;
double inclong = 360.0 / divlong;
ZeroMemory( &pObject->Material, sizeof(D3DMATERIAL9));
pObject->Material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
pObject->Material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
pObject->iNumVertexes = divlat*divlong*12;
init_vertex_buffer(pObject, pObject->iNumVertexes);
vertex* vertices = NULL;
double scale = 10.0;
pObject->VertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD);
int ct = 0;
double rlat1 = 0;
double rlong1 = 0;
double rlat2 = 0;
double rlong2 = 0;
for (double longitude = 0; longitude < 360; longitude += inclong )
for (double latitude = 0; latitude < 90; latitude += inclat)
{
rlat1 = latitude * (3.14159 / 180.0);
rlat2 = (latitude + inclat) * (3.14159 / 180.0);
rlong1 = longitude * (3.14159 / 180.0);
rlong2 = (longitude + inclong) * (3.14159 / 180.0);
if (rlat1 > 1.5707)
rlat1 = 1.5707;
if (rlat2 > 1.5707)
rlat2 = 1.5707;
vertices[ct].x = scale*sin(rlong1)*cos(rlat1);
vertices[ct].z = scale*cos(rlong1)*cos(rlat1);
vertices[ct].y = scale*sin(rlat1);
vertices[ct].colour = 0xffffffff;
vertices[ct].tu = 1.0 - rlong1 / 6.283135;
vertices[ct].tv = 1.0 - (rlat1 / 3.141593) + 0.5;
vertices[ct+1].x = scale*sin(rlong2)*cos(rlat1);
vertices[ct+1].z = scale*cos(rlong2)*cos(rlat1);
vertices[ct+1].y = scale*sin(rlat1);
vertices[ct+1].colour = 0xffffffff;
vertices[ct+1].tu = 1.0 - rlong2 / 6.283135;
vertices[ct+1].tv = 1.0 - (rlat1 / 3.141593) + 0.5;
vertices[ct+2].x = scale*sin(rlong1)*cos(rlat2);
vertices[ct+2].z = scale*cos(rlong1)*cos(rlat2);
vertices[ct+2].y = scale*sin(rlat2);
vertices[ct+2].colour = 0xffffffff;
vertices[ct+2].tu = 1.0 - rlong1 / 6.283135;
vertices[ct+2].tv = 1.0 - (rlat2 / 3.141593) + 0.5;
vertex normal = compute_normal(vertices[ct], vertices[ct+1], vertices[ct+2]);
copy_normal(&vertices[ct], &normal);
copy_normal(&vertices[ct+1], &normal);
copy_normal(&vertices[ct+2], &normal);
ct += 3;
vertices[ct].x = scale*sin(rlong2)*cos(rlat1);
vertices[ct].z = scale*cos(rlong2)*cos(rlat1);
vertices[ct].y = scale*sin(rlat1);
vertices[ct].colour = 0xffffffff;
vertices[ct].tu = 1.0 - rlong2 / 6.283135;
vertices[ct].tv = 1.0 - (rlat1 / 3.141593) + 0.5;
vertices[ct+1].x = scale*sin(rlong2)*cos(rlat2);
vertices[ct+1].z = scale*cos(rlong2)*cos(rlat2);
vertices[ct+1].y = scale*sin(rlat2);
vertices[ct+1].colour = 0xffffffff;
vertices[ct+1].tu = 1.0 - rlong2 / 6.283135;
vertices[ct+1].tv = 1.0 - (rlat2 / 3.141593) + 0.5;
vertices[ct+2].x = scale*sin(rlong1)*cos(rlat2);
vertices[ct+2].z = scale*cos(rlong1)*cos(rlat2);
vertices[ct+2].y = scale*sin(rlat2);
vertices[ct+2].colour = 0xffffffff;
vertices[ct+2].tu = 1.0 - rlong1 / 6.283135;
vertices[ct+2].tv = 1.0 - (rlat2 / 3.141593) + 0.5;
copy_normal(&vertices[ct], &normal);
copy_normal(&vertices[ct+1], &normal);
copy_normal(&vertices[ct+2], &normal);
ct += 3;
normal.ny *= -1;
vertices[ct+2].x = scale*sin(rlong1)*cos(rlat1);
vertices[ct+2].z = scale*cos(rlong1)*cos(rlat1);
vertices[ct+2].y = -1*scale*sin(rlat1);
vertices[ct+2].colour = 0xffffffff;
vertices[ct+2].tu = 1.0 - rlong1 / 6.283135;
vertices[ct+2].tv = 1.0 - ((rlat1 / 3.141593)*-1) + 0.5;
vertices[ct+1].x = scale*sin(rlong2)*cos(rlat1);
vertices[ct+1].z = scale*cos(rlong2)*cos(rlat1);
vertices[ct+1].y = -1*scale*sin(rlat1);
vertices[ct+1].colour = 0xffffffff;
vertices[ct+1].tu = 1.0 - rlong2 / 6.283135;
vertices[ct+1].tv = 1.0 - ((rlat1 / 3.141593)*-1) + 0.5;
vertices[ct].x = scale*sin(rlong1)*cos(rlat2);
vertices[ct].z = scale*cos(rlong1)*cos(rlat2);
vertices[ct].y = -1*scale*sin(rlat2);
vertices[ct].colour = 0xffffffff;
vertices[ct].tu = 1.0 - rlong1 / 6.283135;
vertices[ct].tv = 1.0 - ((rlat2 / 3.141593)*-1) + 0.5;
copy_normal(&vertices[ct], &normal);
copy_normal(&vertices[ct+1], &normal);
copy_normal(&vertices[ct+2], &normal);
ct += 3;
vertices[ct+2].x = scale*sin(rlong2)*cos(rlat1);
vertices[ct+2].z = scale*cos(rlong2)*cos(rlat1);
vertices[ct+2].y = -1*scale*sin(rlat1);
vertices[ct+2].colour = 0xffffffff;
vertices[ct+2].tu = 1.0 - rlong2 / 6.283135;
vertices[ct+2].tv = 1.0 - ((rlat1 / 3.141593)*-1) + 0.5;
vertices[ct+1].x = scale*sin(rlong2)*cos(rlat2);
vertices[ct+1].z = scale*cos(rlong2)*cos(rlat2);
vertices[ct+1].y = -1*scale*sin(rlat2);
vertices[ct+1].colour = 0xffffffff;
vertices[ct+1].tu = 1.0 - rlong2 / 6.283135;
vertices[ct+1].tv = 1.0 - ((rlat2 / 3.141593)*-1) + 0.5;
vertices[ct].x = scale*sin(rlong1)*cos(rlat2);
vertices[ct].z = scale*cos(rlong1)*cos(rlat2);
vertices[ct].y = -1*scale*sin(rlat2);
vertices[ct].colour = 0xffffffff;
vertices[ct].tu = 1.0 - rlong1 / 6.283135;
vertices[ct].tv = 1.0 - ((rlat2 / 3.141593)*-1) + 0.5;
copy_normal(&vertices[ct], &normal);
copy_normal(&vertices[ct+1], &normal);
copy_normal(&vertices[ct+2], &normal);
ct += 3;
if (ct >= pObject->iNumVertexes)
break;
}
pObject->VertexBuffer->Unlock();
D3DXCreateTextureFromFile(Device, //Direct3D Device
//L"c:/infile.png", //File Name
L"c:/infile.jpg", //File Name
&pObject->Texture); //Texture handle
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::init_lights1()
{
// Set light #0 to be a simple, faint grey directional light so
// the walls and floor are slightly different shades of grey
ZeroMemory( &light0, sizeof(light0) );
light0.Type = D3DLIGHT_POINT;
light0.Position = eye_vector;//D3DXVECTOR3(0.0f, 10.0f, 20.0f);
light0.Range = 300.0f;
light0.Attenuation0 = 0.0f;
light0.Attenuation1 = 0.25f;
light0.Attenuation2 = 0.0f;
light0.Diffuse.r = light0.Diffuse.g = light0.Diffuse.b = 1.0f;
Device->SetLight( 0, &light0 );
Device->LightEnable(0, TRUE);
Device->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_XRGB(32,32,32));
bLight0Changed = false;
return 0;
}
//*******************************************************//
//*******************************************************//
int cD3D_Device::set_lights()
{
if (bLight0Changed == false)
return 0;
light0.Position = eye_vector;//D3DXVECTOR3(0.0f, 10.0f, 20.0f);
Device->SetLight( 0, &light0 );
bLight0Changed = false;
return 0;
}
//*******************************************************//
//*******************************************************//
//initialize a renderstate for 3D
int cD3D_Device::init_renderstate_3d()
{
//set vertex format
Device->SetFVF(vertex_fvf); //this is the "3D" vertex format
Device->SetRenderState( D3DRS_DITHERENABLE, FALSE );
Device->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
Device->SetRenderState( D3DRS_LIGHTING, TRUE);
Device->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE);//D3DZB_USEW); //D3DZB_TRUE);
//Device->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESS);
Device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE);
//Device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE);
Device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
Device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
Device->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
Device->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);//D3DTEXF_NONE);
Device->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);//D3DTEXF_NONE);
// Create a D3DX font object
D3DXCreateFont( Device, 20, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font );
// Create a D3DX font object
D3DXCreateFont( Device, 12, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font_small );
// Create a D3DX font object
D3DXCreateFont( Device, 36, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font_large );
return 0;
}
//*******************************************************//
//*******************************************************//
//initialize a renderstate for 2D
int cD3D_Device::init_renderstate_2d()
{
//set vertex format
Device->SetFVF(vertex_2d); //this is the "2d" vertex format
Device->SetRenderState( D3DRS_LIGHTING, FALSE);
Device->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE);
//Device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE);
Device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
Device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
Device->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
Device->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);//D3DTEXF_NONE);
Device->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);//D3DTEXF_NONE);
// Create a D3DX font object
D3DXCreateFont( Device, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font );
return 0;
}
//*******************************************************//
//*******************************************************//
<file_sep>//This is a Titan Project plugin for the popular aircraft simulator XPlane.
//It is intended a means for the Titan environment to use XPlane as a visualizer,
//if it is available.
//When enabled, the plugin will read state data from the Titan environment (i.e. from
//the state variables in the shared memory) and send them to XPlane for visualization.
#include <Windows.h>
//as directed, define APL to 0 and IBM to 1 to indicate we're compiling on Windows
#define APL 0
#define IBM 1
//includes to the XPlane API
#include <XPLMPlugin.h>
#include <XPLMDataAccess.h>
#include <XPLMDisplay.h>
#include <XPLMDefs.h>
//create a test data reference
XPLMDataRef ref1;<file_sep>//this library contains functions for accessing shared memory.
#include <Windows.h>
#include <stdio.h>
#include "../common/sm_defines.h"
_read_int_type _read_int;
_read_double_type _read_double;
_write_int_type _write_int;
_write_double_type _write_double;
int init_sm()
{
HMODULE hSharedMem;
hSharedMem = NULL;
hSharedMem = LoadLibraryA("Titan4DLL.dll");
printf("hSharedMem: %x.\n", hSharedMem);
if (hSharedMem == NULL)
{
printf("Allocation failure.\n");
return -1;
}
_read_int = (_read_int_type)GetProcAddress(hSharedMem, "_read_int");
_write_int = (_write_int_type)GetProcAddress(hSharedMem, "_write_int");
_read_double = (_read_double_type)GetProcAddress(hSharedMem, "_read_double");
_write_double = (_write_double_type)GetProcAddress(hSharedMem, "_write_double");
//done.
return 0;
}
//route to DLL functions
int sm_read_int (int addr)
{
return _read_int(addr);
}
//route to DLL function
double sm_read_double (int addr)
{
return _read_double(addr);
}
//route to DLL function
int sm_write_int (int addr, int value)
{
return _write_int(addr, value);
}
//route to DLL function
int sm_write_double (int addr, double value)
{
return _write_double(addr, value);
}
<file_sep>#pragma once
#define ENGINE_EXTERNAL_CONTROL 0x70
#define SIM_STEP_SIZE 0x80
#define SIM_COMMAND 0x90
#define VIS_COUNT 0x100
#define PHASE0_LONGITUDE 0x110 //radians
#define PHASE0_LATITUDE 0x120 //radians
#define PHASE0_R 0x130 //meters
#define PHASE0_PITCH 0x140 //radians
#define PHASE0_ROLL 0x150 //radians
#define PHASE0_YAW 0x160 //radians
#define SIM_TIME 0x170 //seconds
#define STAGE1_ENGINE_GIMBAL_ROLL 0x180 //radians
#define STAGE1_ENGINE_GIMBAL_TILT 0x190 //radians
#define PHASE0_X 0x200 //meters (ecef)
#define PHASE0_Y 0x210 //meters (ecef)
#define PHASE0_Z 0x220 //meters (ecef)
#define PHASE0_VX 0x230 //meters/sec
#define PHASE0_VY 0x240 //meters/sec
#define PHASE0_VZ 0x250 //meters/sec
#define PHASE0_WX 0x260 //rad/sec
#define PHASE0_WY 0x270 //rad/sec
#define PHASE0_WZ 0x280 //rad/sec
//these params are used for loading into the integrator
#define THRUST_FX 0x290 //newtons (ecef)
#define THRUST_FY 0x300
#define THRUST_FZ 0x310
//these params are used for loading into the integrator
#define THRUST_MX 0x320 //newton-meters (body)
#define THRUST_MY 0x330
#define THRUST_MZ 0x340
#define THRUST_EFFECT_DMASS 0x350
#define THRUST_EFFECT_DIXX 0x360
#define THRUST_EFFECT_DIYY 0x370
#define THRUST_EFFECT_DIZZ 0x380
#define SIM_PHASE 0x390
#define VIS_COMMAND 0x400
#define STAGE2_ENGINE_GIMBAL_ROLL 0x410 //radians
#define STAGE2_ENGINE_GIMBAL_TILT 0x420 //radians
#define PHASE0_AERODYN_FX 0x440
#define PHASE0_AERODYN_FY 0x450
#define PHASE0_AERODYN_FZ 0x460
#define PHASE0_AERODYN_MX 0x470
#define PHASE0_AERODYN_MY 0x480
#define PHASE0_AERODYN_MZ 0x490
#define PHASE0_AIR_DENSITY 0x4a0
#define PHASE0_STATIC_AIR_TEMPERATURE 0x4b0
#define PHASE0_STATIC_PRESSURE 0x4c0
#define PHASE0_ANGLE_OF_ATTACK 0x4d0
#define PHASE0_CD 0x4e0
#define PHASE0_CD0 0x4f0
#define PHASE0_RHO 0x500
#define PHASE0_Q1 0x510
#define PHASE0_Q2 0x520
#define PHASE0_Q3 0x530
#define PHASE0_Q4 0x540
#define PHASE0_MASS 0x550
#define PHASE0_FLIGHT_PATH_ANGLE 0x560
#define PHASE0_IXX 0x570
#define PHASE0_IYY 0x580
#define PHASE0_IZZ 0x590
#define PHASE1_STAGE1_X 0x1000
#define PHASE1_STAGE1_Y 0x1010
#define PHASE1_STAGE1_Z 0x1020
#define PHASE1_STAGE1_VX 0x1030
#define PHASE1_STAGE1_VY 0x1040
#define PHASE1_STAGE1_VZ 0x1050
#define PHASE1_STAGE1_PITCH 0x1060
#define PHASE1_STAGE1_ROLL 0x1070
#define PHASE1_STAGE1_YAW 0x1080
#define PHASE1_STAGE1_WX 0x1090
#define PHASE1_STAGE1_WY 0x10a0
#define PHASE1_STAGE1_WZ 0x10b0
#define PHASE1_STAGE1_R 0x10c0
#define PHASE1_STAGE1_LONG 0x10d0
#define PHASE1_STAGE1_LAT 0x10e0
#define PHASE1_STAGE1_AERODYN_FX 0x10f0
#define PHASE1_STAGE1_AERODYN_FY 0x1100
#define PHASE1_STAGE1_AERODYN_FZ 0x1110
#define PHASE1_STAGE1_AERODYN_MX 0x1120
#define PHASE1_STAGE1_AERODYN_MY 0x1130
#define PHASE1_STAGE1_AERODYN_MZ 0x1140
#define PHASE1_STAGE1_AIR_DENSITY 0x1150
#define PHASE1_STAGE1_STATIC_AIR_TEMPERATURE 0x1160
#define PHASE1_STAGE1_STATIC_PRESSURE 0x1170
#define PHASE1_STAGE1_ANGLE_OF_ATTACK 0x1180
#define PHASE1_STAGE1_CD 0x1190
#define PHASE1_STAGE1_CD0 0x11a0
#define PHASE1_STAGE1_RHO 0x11b0
#define PHASE1_STAGE1_Q1 0x11c0
#define PHASE1_STAGE1_Q2 0x11d0
#define PHASE1_STAGE1_Q3 0x11e0
#define PHASE1_STAGE1_Q4 0x11f0
#define PHASE1_STAGE1_MASS 0x1200
#define PHASE1_STAGE1_FLIGHT_PATH_ANGLE 0x1210
#define PHASE1_STAGE1_IXX 0x1220
#define PHASE1_STAGE1_IYY 0x1230
#define PHASE1_STAGE1_IZZ 0x1240
#define PHASE1_INTERSTAGE_X 0x2000
#define PHASE1_INTERSTAGE_Y 0x2010
#define PHASE1_INTERSTAGE_Z 0x2020
#define PHASE1_INTERSTAGE_VX 0x2030
#define PHASE1_INTERSTAGE_VY 0x2040
#define PHASE1_INTERSTAGE_VZ 0x2050
#define PHASE1_INTERSTAGE_PITCH 0x2060
#define PHASE1_INTERSTAGE_ROLL 0x2070
#define PHASE1_INTERSTAGE_YAW 0x2080
#define PHASE1_INTERSTAGE_WX 0x2090
#define PHASE1_INTERSTAGE_WY 0x20a0
#define PHASE1_INTERSTAGE_WZ 0x20b0
#define PHASE1_INTERSTAGE_R 0x20c0
#define PHASE1_INTERSTAGE_LONG 0x20d0
#define PHASE1_INTERSTAGE_LAT 0x20e0
#define PHASE1_INTERSTAGE_AERODYN_FX 0x20f0
#define PHASE1_INTERSTAGE_AERODYN_FY 0x2100
#define PHASE1_INTERSTAGE_AERODYN_FZ 0x2110
#define PHASE1_INTERSTAGE_AERODYN_MX 0x2120
#define PHASE1_INTERSTAGE_AERODYN_MY 0x2130
#define PHASE1_INTERSTAGE_AERODYN_MZ 0x2140
#define PHASE1_INTERSTAGE_AIR_DENSITY 0x2150
#define PHASE1_INTERSTAGE_STATIC_AIR_TEMPERATURE 0x2160
#define PHASE1_INTERSTAGE_STATIC_PRESSURE 0x2170
#define PHASE1_INTERSTAGE_ANGLE_OF_ATTACK 0x2180
#define PHASE1_INTERSTAGE_CD 0x2190
#define PHASE1_INTERSTAGE_CD0 0x21a0
#define PHASE1_INTERSTAGE_RHO 0x21b0
#define PHASE1_INTERSTAGE_Q1 0x21c0
#define PHASE1_INTERSTAGE_Q2 0x21d0
#define PHASE1_INTERSTAGE_Q3 0x21e0
#define PHASE1_INTERSTAGE_Q4 0x21f0
#define PHASE1_INTERSTAGE_MASS 0x2200
#define PHASE1_INTERSTAGE_FLIGHT_PATH_ANGLE 0x2210
#define PHASE1_INTERSTAGE_IXX 0x2220
#define PHASE1_INTERSTAGE_IYY 0x2230
#define PHASE1_INTERSTAGE_IZZ 0x2240
#define PHASE1_STAGE2_X 0x3000
#define PHASE1_STAGE2_Y 0x3010
#define PHASE1_STAGE2_Z 0x3020
#define PHASE1_STAGE2_VX 0x3030
#define PHASE1_STAGE2_VY 0x3040
#define PHASE1_STAGE2_VZ 0x3050
#define PHASE1_STAGE2_PITCH 0x3060
#define PHASE1_STAGE2_ROLL 0x3070
#define PHASE1_STAGE2_YAW 0x3080
#define PHASE1_STAGE2_WX 0x3090
#define PHASE1_STAGE2_WY 0x30a0
#define PHASE1_STAGE2_WZ 0x30b0
#define PHASE1_STAGE2_R 0x30c0
#define PHASE1_STAGE2_LONG 0x30d0
#define PHASE1_STAGE2_LAT 0x30e0
#define PHASE1_STAGE2_AERODYN_FX 0x30f0
#define PHASE1_STAGE2_AERODYN_FY 0x3100
#define PHASE1_STAGE2_AERODYN_FZ 0x3110
#define PHASE1_STAGE2_AERODYN_MX 0x3120
#define PHASE1_STAGE2_AERODYN_MY 0x3130
#define PHASE1_STAGE2_AERODYN_MZ 0x3140
#define PHASE1_STAGE2_AIR_DENSITY 0x3150
#define PHASE1_STAGE2_STATIC_AIR_TEMPERATURE 0x3160
#define PHASE1_STAGE2_STATIC_PRESSURE 0x3170
#define PHASE1_STAGE2_ANGLE_OF_ATTACK 0x3180
#define PHASE1_STAGE2_CD 0x3190
#define PHASE1_STAGE2_CD0 0x31a0
#define PHASE1_STAGE2_RHO 0x31b0
#define PHASE1_STAGE2_Q1 0x31c0
#define PHASE1_STAGE2_Q2 0x31d0
#define PHASE1_STAGE2_Q3 0x31e0
#define PHASE1_STAGE2_Q4 0x31f0
#define PHASE1_STAGE2_MASS 0x3200
#define PHASE1_STAGE2_FLIGHT_PATH_ANGLE 0x3210
#define PHASE1_STAGE2_IXX 0x3220
#define PHASE1_STAGE2_IYY 0x3230
#define PHASE1_STAGE2_IZZ 0x3240
//these params are used for loading into the integrator
#define AERODYN_FX 0x4000
#define AERODYN_FY 0x4010
#define AERODYN_FZ 0x4020
#define AERODYN_MX 0x4030
#define AERODYN_MY 0x4040
#define AERODYN_MZ 0x4050
//define initial positions
#define IC_PX_ECEF 0x5000
#define IC_PY_ECEF 0x5010
#define IC_PZ_ECEF 0x5020
#define IC_VX_ECEF 0x5030
#define IC_VY_ECEF 0x5040
#define IC_VZ_ECEF 0x5050
#define IC_PITCH_RAD 0x5060
#define IC_ROLL_RAD 0x5070
#define IC_YAW_RAD 0x5080
#define IC_WX 0x5090
#define IC_WY 0x50a0
#define IC_WZ 0x50b0
#define IC_MASS_FUEL_FIRST_STAGE 0x50c0
#define IC_IXX 0x50d0
#define IC_IYY 0x50e0
#define IC_IZZ 0x50f0
#define STAGE1_ENGINE_ON 0x5100
#define STAGE2_ENGINE_ON 0x5110
typedef int (__cdecl *_read_int_type) (int addr);
typedef double (__cdecl *_read_double_type) (int addr);
typedef int (__cdecl *_write_int_type) (int addr, int value);
typedef int (__cdecl *_write_double_type) (int addr, double value);
<file_sep>#include <windows.h>
#include <MMSystem.h>
//currently the powerpoint is relying on this function to retrieve the
//current gesture state.
//I have currently stubbed this out with calls to the keyboard instead,
//such that pushing H results in a "prev" code (1)
//and pushing J results in a "next" code (2)
//for real Kinect, replace with appropriate gesture determination.
__declspec(dllexport) int __stdcall GetActiveGesture()
{
if (GetAsyncKeyState((char)'H') != 0)
{
return 1;
}
if (GetAsyncKeyState((char)'J') != 0)
{
return 2;
}
return 0;
}
int WINAPI DllMain()
{
return TRUE;
}<file_sep>//these numbers are approximated off a chart, Figure 4.3 of the textbook
//"Rocket Propulsion Elements" by Sutton....
//these are for a V2 rocket.
//this is because this is the only rocket I have found hypersonic drag values for,
//for anything even close to a Falcon or any other kind of rocket.
//if I wanted accurate values, I would probably have to buy HyperCFD and input the geometry of
//the Falcon rocket and see what I get.
#define DRAG_TABLE_LENGTH 28
//mach numbers
const double M_table[28] = {0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0,
3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4};
//base drag numbers (at zero angle of attack)
const double cd0_table[28] = {0.145, 0.145, 0.145, 0.145, 0.180, //0.0 - 0.8
0.30, 0.41, 0.36, 0.30, 0.26, //1.0 - 1.8
0.242, 0.24, 0.23, 0.22, 0.21, //2.0 - 2.8
0.205, 0.20, 0.195, 0.19, 0.18, //3.0 - 3.8
0.175, 0.17, 0.165, 0.16, 0.155, //4.0 - 4.8
0.152, 0.150, 0.148}; //5.0-5.4
//linear coefficient of angle of attack on drag, per degree of angle of attack
const double cdaoa_deg_table[28] = {0.02, 0.02, 0.02, 0.02, 0.02, //0.0 - 0.8
0.025, 0.025, 0.025, 0.025, 0.025, //1.0 - 1.8
0.025, 0.025, 0.025, 0.025, 0.025, //2.0 - 2.8
0.025, 0.0235, 0.021, 0.0195, 0.018, //3.0 - 3.8
0.017, 0.016, 0.015, 0.014, 0.013, //4.0 - 4.8
0.0125, 0.0125, 0.0125}; //5.0 - 5.4
<file_sep>#include "common_classes.h"
#pragma once
class cThrustEffect
{
public:
double dMass;
double dIxx;
double dIyy;
double dIzz;
cThrustEffect(double _dMass, double _dIxx, double _dIyy, double _dIzz)
{
dMass = _dMass;
dIxx = _dIxx;
dIyy = _dIyy;
dIzz = _dIzz;
}
cThrustEffect()
{
dMass = 0;
dIxx = 0;
dIyy = 0;
dIzz = 0;
}
private:
};
class cEngineModel
{
public:
bool bBurning;
double mass_propellant;
cForceMoment get_thrust_phase0(cState state);
cThrustEffect get_thrust_effect_phase0(cState state, cForceMoment thrust);
cForceMoment get_thrust_phase1(cState state);
cThrustEffect get_thrust_effect_phase1(cState state, cForceMoment thrust);
cEngineModel()
{
bBurning = true;
}
cSharedMem* pSharedMem;
int init(cSharedMem* _pSharedMem)
{
pSharedMem = _pSharedMem;
return 0;
}
private:
};<file_sep>#include "main.h"
//**************************************************************************************//
//**************************************************************************************//
int map_sm()
{
//hSharedMem = LoadLibraryA("Titan4DLL.dll");
//read_int = (_read_int_type)GetProcAddress(hSharedMem, "_read_int");
//write_int = (_write_int_type)GetProcAddress(hSharedMem, "_write_int");
//read_double = (_read_double_type)GetProcAddress(hSharedMem, "_read_double");
//write_double = (_write_double_type)GetProcAddress(hSharedMem, "_write_double");
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int init()
{
Integrator.init(&SharedMem, &ForceModel, &ControlModel, &AtmosphereModel, &AerodynamicsModel);
ControlModel.init(&SharedMem);
ForceModel.init(&SharedMem);
AtmosphereModel.init(&SharedMem);
AerodynamicsModel.init(&SharedMem);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int exit()
{
Integrator.exit();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int startup_tests()
{
cState state;
//confirm latitude and longitude calculation are correct:
//prime meridian
state.x = 1;
state.y = 0;
state.z = 0;
double long1 = state.get_longitude_deg();
double lat1 = state.get_latitude_deg();
printf("lat: %f long: %f", lat1, long1);
if ((long1 == 0.0) && (lat1 == 0.0))
printf(" PASS\n");
else
printf(" FAIL\n");
//north pole
state.x = 0;
state.y = 0;
state.z = 1;
double long2 = state.get_longitude_deg();
double lat2 = state.get_latitude_deg();
printf("lat: %f long: %f", lat2, long2);
if (lat2 >= 90.0) //longitude can be anything
printf(" PASS\n");
else
printf(" FAIL\n");
//check quaternion attitude conversions
state.att.set_rotation(0,0,0);
cVec rtd = state.att.rotate_vector(cVec(1,0,0));
printf("0-0-0: %f, %f, %f\n", rtd.x, rtd.y, rtd.z);
state.att.set_rotation_deg(0,0,90.0);
rtd = state.att.rotate_vector(cVec(1,0,0));
printf("0-0-90: %f, %f, %f\n", rtd.x, rtd.y, rtd.z);
state.att.set_rotation_deg(0,90.0,0);
rtd = state.att.rotate_vector(cVec(1,0,0));
printf("0-90-0: %f, %f, %f\n", rtd.x, rtd.y, rtd.z);
/*
cVec vec_enu(0,0,1);
cVec vec_ecef = state.convert_orientation_ENU_to_ECEF(vec_enu);
printf("ret: %f, %f, %f\n", vec_ecef.x, vec_ecef.y, vec_ecef.z);
*/
cQuaternion quat;
quat.set_rotation_deg(0, -90.0, 0);
double phi1 = quat.get_phi();
double psi1 = quat.get_psi();
double theta1 = quat.get_theta();
quat.apply_rotation(0.01, 0, 0, 1.0);
double phi2 = quat.get_phi();
double psi2 = quat.get_psi();
double theta2 = quat.get_theta();
cQuaternion q1;
q1.set_rotation_deg(0, 90, 0);
cQuaternion q2;
q2.set_rotation_deg(90, 0, 0);
cQuaternion q3;
q3.set_rotation_deg(0, 0, 90);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int debug_run()
{
Integrator.ic();
while (Integrator.sim_time < 30.0)
{
Integrator.run_step(0.01);
}
while (Integrator.sim_time < 169.0)
{
Integrator.run_step(0.01);
}
Integrator.first_stage_sep();
for (int lc1 = 0; lc1 < 37800; lc1++)
Integrator.run_step(0.01);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int upload_coords_phase0()
{
SharedMem.write_double(PHASE0_R, Integrator.Masses[0].State.get_r() / 1000.0);
SharedMem.write_double(PHASE0_ROLL, Integrator.Masses[0].State.att.get_phi());
SharedMem.write_double(PHASE0_PITCH, Integrator.Masses[0].State.att.get_theta());
SharedMem.write_double(PHASE0_YAW, Integrator.Masses[0].State.att.get_psi());
SharedMem.write_double(PHASE0_LONGITUDE, Integrator.Masses[0].State.get_longitude());
SharedMem.write_double(PHASE0_LATITUDE, Integrator.Masses[0].State.get_latitude());
SharedMem.write_double(SIM_TIME, Integrator.sim_time);
SharedMem.write_double(PHASE0_X, Integrator.Masses[0].State.x);
SharedMem.write_double(PHASE0_Y, Integrator.Masses[0].State.y);
SharedMem.write_double(PHASE0_Z, Integrator.Masses[0].State.z);
SharedMem.write_double(PHASE0_VX, Integrator.Masses[0].State.vx);
SharedMem.write_double(PHASE0_VY, Integrator.Masses[0].State.vy);
SharedMem.write_double(PHASE0_VZ, Integrator.Masses[0].State.vz);
SharedMem.write_double(PHASE0_WX, Integrator.Masses[0].State.wx);
SharedMem.write_double(PHASE0_WY, Integrator.Masses[0].State.wy);
SharedMem.write_double(PHASE0_WZ, Integrator.Masses[0].State.wz);
SharedMem.write_double(PHASE0_Q1, Integrator.Masses[0].State.att.w);
SharedMem.write_double(PHASE0_Q2, Integrator.Masses[0].State.att.i);
SharedMem.write_double(PHASE0_Q3, Integrator.Masses[0].State.att.j);
SharedMem.write_double(PHASE0_Q4, Integrator.Masses[0].State.att.k);
SharedMem.write_double(PHASE0_MASS, Integrator.Masses[0].State.mass);
SharedMem.write_double(PHASE0_IXX, Integrator.Masses[0].State.Ixx);
SharedMem.write_double(PHASE0_IYY, Integrator.Masses[0].State.Iyy);
SharedMem.write_double(PHASE0_IZZ, Integrator.Masses[0].State.Izz);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int upload_coords_phase1()
{
SharedMem.write_double(SIM_TIME, Integrator.sim_time);
SharedMem.write_double(PHASE1_STAGE1_X, Integrator.Masses[0].State.x);
SharedMem.write_double(PHASE1_STAGE1_Y, Integrator.Masses[0].State.y);
SharedMem.write_double(PHASE1_STAGE1_Z, Integrator.Masses[0].State.z);
SharedMem.write_double(PHASE1_STAGE1_VX, Integrator.Masses[0].State.vx);
SharedMem.write_double(PHASE1_STAGE1_VY, Integrator.Masses[0].State.vy);
SharedMem.write_double(PHASE1_STAGE1_VZ, Integrator.Masses[0].State.vz);
SharedMem.write_double(PHASE1_STAGE1_PITCH, Integrator.Masses[0].State.att.get_theta());
SharedMem.write_double(PHASE1_STAGE1_ROLL, Integrator.Masses[0].State.att.get_phi());
SharedMem.write_double(PHASE1_STAGE1_YAW, Integrator.Masses[0].State.att.get_psi());
SharedMem.write_double(PHASE1_STAGE1_Q1, Integrator.Masses[0].State.att.w);
SharedMem.write_double(PHASE1_STAGE1_Q2, Integrator.Masses[0].State.att.i);
SharedMem.write_double(PHASE1_STAGE1_Q3, Integrator.Masses[0].State.att.j);
SharedMem.write_double(PHASE1_STAGE1_Q4, Integrator.Masses[0].State.att.k);
SharedMem.write_double(PHASE1_STAGE1_WX, Integrator.Masses[0].State.wx);
SharedMem.write_double(PHASE1_STAGE1_WY, Integrator.Masses[0].State.wy);
SharedMem.write_double(PHASE1_STAGE1_WZ, Integrator.Masses[0].State.wz);
SharedMem.write_double(PHASE1_STAGE1_R, Integrator.Masses[0].State.get_r() / 1000.0);
SharedMem.write_double(PHASE1_STAGE1_LONG, Integrator.Masses[0].State.get_longitude());
SharedMem.write_double(PHASE1_STAGE1_LAT, Integrator.Masses[0].State.get_latitude());
SharedMem.write_double(PHASE1_STAGE1_MASS, Integrator.Masses[0].State.mass);
SharedMem.write_double(PHASE1_STAGE1_IXX, Integrator.Masses[0].State.Ixx);
SharedMem.write_double(PHASE1_STAGE1_IYY, Integrator.Masses[0].State.Iyy);
SharedMem.write_double(PHASE1_STAGE1_IZZ, Integrator.Masses[0].State.Izz);
SharedMem.write_double(PHASE1_INTERSTAGE_X, Integrator.Masses[1].State.x);
SharedMem.write_double(PHASE1_INTERSTAGE_Y, Integrator.Masses[1].State.y);
SharedMem.write_double(PHASE1_INTERSTAGE_Z, Integrator.Masses[1].State.z);
SharedMem.write_double(PHASE1_INTERSTAGE_VX, Integrator.Masses[1].State.vx);
SharedMem.write_double(PHASE1_INTERSTAGE_VY, Integrator.Masses[1].State.vy);
SharedMem.write_double(PHASE1_INTERSTAGE_VZ, Integrator.Masses[1].State.vz);
SharedMem.write_double(PHASE1_INTERSTAGE_PITCH, Integrator.Masses[1].State.att.get_theta());
SharedMem.write_double(PHASE1_INTERSTAGE_ROLL, Integrator.Masses[1].State.att.get_phi());
SharedMem.write_double(PHASE1_INTERSTAGE_YAW, Integrator.Masses[1].State.att.get_psi());
SharedMem.write_double(PHASE1_INTERSTAGE_Q1, Integrator.Masses[1].State.att.w);
SharedMem.write_double(PHASE1_INTERSTAGE_Q2, Integrator.Masses[1].State.att.i);
SharedMem.write_double(PHASE1_INTERSTAGE_Q3, Integrator.Masses[1].State.att.j);
SharedMem.write_double(PHASE1_INTERSTAGE_Q4, Integrator.Masses[1].State.att.k);
SharedMem.write_double(PHASE1_INTERSTAGE_WX, Integrator.Masses[1].State.wx);
SharedMem.write_double(PHASE1_INTERSTAGE_WY, Integrator.Masses[1].State.wy);
SharedMem.write_double(PHASE1_INTERSTAGE_WZ, Integrator.Masses[1].State.wz);
SharedMem.write_double(PHASE1_INTERSTAGE_R, Integrator.Masses[1].State.get_r() / 1000.0);
SharedMem.write_double(PHASE1_INTERSTAGE_LONG, Integrator.Masses[1].State.get_longitude());
SharedMem.write_double(PHASE1_INTERSTAGE_LAT, Integrator.Masses[1].State.get_latitude());
SharedMem.write_double(PHASE1_INTERSTAGE_MASS, Integrator.Masses[1].State.mass);
SharedMem.write_double(PHASE1_INTERSTAGE_IXX, Integrator.Masses[1].State.Ixx);
SharedMem.write_double(PHASE1_INTERSTAGE_IYY, Integrator.Masses[1].State.Iyy);
SharedMem.write_double(PHASE1_INTERSTAGE_IZZ, Integrator.Masses[1].State.Izz);
SharedMem.write_double(PHASE1_STAGE2_X, Integrator.Masses[2].State.x);
SharedMem.write_double(PHASE1_STAGE2_Y, Integrator.Masses[2].State.y);
SharedMem.write_double(PHASE1_STAGE2_Z, Integrator.Masses[2].State.z);
SharedMem.write_double(PHASE1_STAGE2_VX, Integrator.Masses[2].State.vx);
SharedMem.write_double(PHASE1_STAGE2_VY, Integrator.Masses[2].State.vy);
SharedMem.write_double(PHASE1_STAGE2_VZ, Integrator.Masses[2].State.vz);
SharedMem.write_double(PHASE1_STAGE2_PITCH, Integrator.Masses[2].State.att.get_theta());
SharedMem.write_double(PHASE1_STAGE2_ROLL, Integrator.Masses[2].State.att.get_phi());
SharedMem.write_double(PHASE1_STAGE2_YAW, Integrator.Masses[2].State.att.get_psi());
SharedMem.write_double(PHASE1_STAGE2_Q1, Integrator.Masses[2].State.att.w);
SharedMem.write_double(PHASE1_STAGE2_Q2, Integrator.Masses[2].State.att.i);
SharedMem.write_double(PHASE1_STAGE2_Q3, Integrator.Masses[2].State.att.j);
SharedMem.write_double(PHASE1_STAGE2_Q4, Integrator.Masses[2].State.att.k);
SharedMem.write_double(PHASE1_STAGE2_WX, Integrator.Masses[2].State.wx);
SharedMem.write_double(PHASE1_STAGE2_WY, Integrator.Masses[2].State.wy);
SharedMem.write_double(PHASE1_STAGE2_WZ, Integrator.Masses[2].State.wz);
SharedMem.write_double(PHASE1_STAGE2_R, Integrator.Masses[2].State.get_r() / 1000.0);
SharedMem.write_double(PHASE1_STAGE2_LONG, Integrator.Masses[2].State.get_longitude());
SharedMem.write_double(PHASE1_STAGE2_LAT, Integrator.Masses[2].State.get_latitude());
SharedMem.write_double(PHASE1_STAGE2_MASS, Integrator.Masses[2].State.mass);
SharedMem.write_double(PHASE1_STAGE2_IXX, Integrator.Masses[2].State.Ixx);
SharedMem.write_double(PHASE1_STAGE2_IYY, Integrator.Masses[2].State.Iyy);
SharedMem.write_double(PHASE1_STAGE2_IZZ, Integrator.Masses[2].State.Izz);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int write_to_log_file()
{
FILE* pNew = fopen("output.txt", "a+");
if (pNew == NULL)
return -1;
fprintf(pNew, "%f,%f,%f,%f,%f,%f,%f,%f,%f\n", Integrator.Masses[0].State.x,
Integrator.Masses[0].State.y,
Integrator.Masses[0].State.z,
Integrator.Masses[1].State.x,
Integrator.Masses[1].State.y,
Integrator.Masses[1].State.z,
Integrator.Masses[2].State.x,
Integrator.Masses[2].State.y,
Integrator.Masses[2].State.z);
fclose(pNew);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
//The main program performs initialization, and then goes into a loop waiting for external
//commands from the simulation drivers.
int main()
{
init();
startup_tests();
//debug_run();
//exit();
//return 0;
/* SharedMem.write_double(IC_PX_ECEF, 919767);
SharedMem.write_double(IC_PY_ECEF, -5530997);
SharedMem.write_double(IC_PZ_ECEF, -3040108);
SharedMem.write_double(IC_VX_ECEF, 0);
SharedMem.write_double(IC_VY_ECEF, 0);
SharedMem.write_double(IC_VZ_ECEF, 0);
SharedMem.write_double(IC_WX, 0);
SharedMem.write_double(IC_WY, 0);
SharedMem.write_double(IC_WZ, 0);
SharedMem.write_double(IC_PITCH_RAD, 3.14159265/2.0);
SharedMem.write_double(IC_ROLL_RAD, 0);
SharedMem.write_double(IC_YAW_RAD, 0);
SharedMem.write_double(IC_MASS_FUEL_FIRST_STAGE, 0);
SharedMem.write_double(SIM_STEP_SIZE, 0.05);
SharedMem.write_double(ENGINE_EXTERNAL_CONTROL, 0);
Integrator.ic();
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
return 0;
*/
Integrator.ic();
while (TRUE)
{
Sleep(1);
int command = SharedMem.read_int(SIM_COMMAND);
if (command == 1)
{
Integrator.ic();
}
if (command == 2)
{
Integrator.run_step(SharedMem.read_double(SIM_STEP_SIZE));
write_to_log_file();
}
if (command == 3)
{
break;
}
if (command == 100)
{
Integrator.first_stage_sep();
}
SharedMem.write_int(SIM_COMMAND, 0);
int sim_phase = SharedMem.read_int(SIM_PHASE);
if (sim_phase == 0)
upload_coords_phase0();
if (sim_phase == 1)
upload_coords_phase1();
//upload state of external engine control
if (SharedMem.read_int(ENGINE_EXTERNAL_CONTROL) == 0)
ControlModel.bEnabled = true;
else
ControlModel.bEnabled = false;
}
SharedMem.write_int(SIM_COMMAND, 0);
exit();
return 0;
}<file_sep>#include "main.h"
//these are the required plugins for XPlane
PLUGIN_API int XPluginStart ( char * outName, char * outSignature, char * outDescription )
{
strcpy(outName, "Titan Project Plugin for XPlane");
strcpy(outSignature, "Vector.Inc.TitanProject");
strcpy(outDescription, "Uploads state data from Titan Project environment");
return 1;
}
//XPlane Plugin Stop callback
PLUGIN_API void XPluginStop ()
{
return;
}
//XPlane Plugin Enable callback
PLUGIN_API void XPluginEnable ()
{
return;
}
//XPlane Plugin Disable callback
PLUGIN_API void XPluginDisable ()
{
return;
}
//XPlane Receive Message callback
PLUGIN_API void XPluginReceiveMessage ( XPLMPluginID inFrom, long inMessage, void * inParam )
{
if (inFrom == XPLM_PLUGIN_XPLANE)
{
}
return;
}
//entry point of DLL function.
int WINAPI DllMain()
{
return TRUE;
}<file_sep>#include "common_classes.h"
//***********************************************//
//***********************************************//
vertex compute_normal(vertex p1, vertex p2, vertex p3)
{
vertex pn;
vertex rel1;
rel1.x = p2.x - p3.x;
rel1.y = p2.y - p3.y;
rel1.z = p2.z - p3.z;
vertex rel2;
rel2.x = p1.x - p2.x;
rel2.y = p1.y - p2.y;
rel2.z = p1.z - p2.z;
//compute cross product
pn.x = (rel1.y * rel2.z) - (rel2.y * rel1.z);
pn.y = (-1 * rel1.x * rel2.z) + (rel1.z * rel2.x);
pn.z = (rel1.x * rel2.y) - (rel2.x * rel1.y);
//normalize vector
double mag = sqrt( pn.x * pn.x + pn.y * pn.y + pn.z * pn.z);
pn.x /= mag;
pn.y /= mag;
pn.z /= mag;
pn.x *= -1;
pn.y *= -1;
pn.z *= -1;
pn.nx = pn.x;
pn.ny = pn.y;
pn.nz = pn.z;
return pn;
}
//***********************************************//
//***********************************************//
int copy_normal(vertex* p1, vertex* p2)
{
p1->nx = p2->nx;
p1->ny = p2->ny;
p1->nz = p2->nz;
return 0;
}
//***********************************************//
//***********************************************//
MATRIX create_identity_matrix()
{
MATRIX ret;
ret._11 = 1.0;
ret._22 = 1.0;
ret._33 = 1.0;
ret._44 = 1.0;
ret._12 = 0.0;
ret._13 = 0.0;
ret._14 = 0.0;
ret._21 = 0.0;
ret._23 = 0.0;
ret._24 = 0.0;
ret._31 = 0.0;
ret._32 = 0.0;
ret._34 = 0.0;
ret._41 = 0.0;
ret._42 = 0.0;
ret._43 = 0.0;
return ret;
}
//***********************************************//
//***********************************************//<file_sep>//Description: Titan1 was a testbed for all the various Direct3D
//rendering features that would be needed for the actual visualizer.
//Titan1 was used to test what would be needed to render lighted,
//textured polygons in Direct3D windowed mode.
#define IDI_ICON1 101
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
WNDCLASS wndclass1;
HWND hMainWnd;
HINSTANCE hAppInstance;
bool bRunFlag;
IDirect3D9 *g_D3D=NULL;
D3DPRESENT_PARAMETERS DeviceParams;
IDirect3DDevice9* g_d3d_device = NULL;
IDirect3DVertexBuffer9* g_vertex_buffer = NULL;
IDirect3DTexture9* g_texture = NULL;
struct vertex{
float x, y, z;
float nx, ny, nz;
DWORD colour;
float tu, tv;
};
const DWORD vertex_fvf=D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1|D3DFVF_DIFFUSE;
struct vertex2{
float x, y, z;
float nx, ny, nz;
float tu, tv;
};
const DWORD vertex_fvf2 = D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_NORMAL ;
double angle = 0;
LRESULT CALLBACK WndCallBackProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
//**************************************************************************************//
//**************************************************************************************//
int create_window()
{
wndclass1.lpszClassName = L"WindowClass1";
wndclass1.hInstance = hAppInstance;
wndclass1.hCursor = LoadCursor(hAppInstance, (LPCTSTR)IDC_ARROW);
wndclass1.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass1.lpfnWndProc = WndCallBackProc;
wndclass1.lpszMenuName = NULL;
wndclass1.style = CS_DBLCLKS;
wndclass1.hIcon = LoadIcon(hAppInstance, (LPCTSTR)IDI_ICON1);
wndclass1.cbClsExtra = 0;
wndclass1.cbWndExtra = 0;
RegisterClass(&wndclass1);
hMainWnd = CreateWindow(L"WindowClass1",
L"Main Application Window",
WS_VISIBLE | WS_SYSMENU | WS_CAPTION,
0,
0,
640,
480,
NULL,
NULL,
hAppInstance,
NULL);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
D3DMATRIX *dhMatrixTranslation(D3DMATRIX *p_out,float p_x,float p_y,float p_z){
p_out->_11 = 1.0f; p_out->_12 = 0.0f; p_out->_13 = 0.0f; p_out->_14 = 0.0f;
p_out->_21 = 0.0f; p_out->_22 = 1.0f; p_out->_23 = 0.0f; p_out->_24 = 0.0f;
p_out->_31 = 0.0f; p_out->_32 = 0.0f; p_out->_33 = 1.0f; p_out->_34 = 0.0f;
p_out->_41 = p_x; p_out->_42 = p_y; p_out->_43 = p_z; p_out->_44 = 1.0f;
return p_out;
}
//**************************************************************************************//
//**************************************************************************************//
D3DMATRIX *dhMatrixRotationX(D3DMATRIX *p_out, float p_angle ){
float my_sin, my_cos;
my_sin=(float)sin(p_angle);
my_cos=(float)cos(p_angle);
p_out->_11 = 1.0f; p_out->_12 = 0.0f; p_out->_13 = 0.0f; p_out->_14 = 0.0f;
p_out->_21 = 0.0f; p_out->_22 = my_cos; p_out->_23 = my_sin; p_out->_24 = 0.0f;
p_out->_31 = 0.0f; p_out->_32 = -my_sin; p_out->_33 = my_cos; p_out->_34 = 0.0f;
p_out->_41 = 0.0f; p_out->_42 = 0.0f; p_out->_43 = 0.0f; p_out->_44 = 1.0f;
return p_out;
}
//**************************************************************************************//
//**************************************************************************************//
D3DMATRIX *dhMatrixRotationY(D3DMATRIX *p_out, float p_angle ){
float my_sin, my_cos;
my_sin=(float)sin(p_angle);
my_cos=(float)cos(p_angle);
p_out->_11 = my_cos; p_out->_12 = 0.0f; p_out->_13 = my_sin; p_out->_14 = 0.0f;
p_out->_21 = 0.0f; p_out->_22 = 1.0f; p_out->_23 = 0.0f; p_out->_24 = 0.0f;
p_out->_31 = -my_sin; p_out->_32 = 0.0f; p_out->_33 = my_cos; p_out->_34 = 0.0f;
p_out->_41 = 0.0f; p_out->_42 = 0.0f; p_out->_43 = 0.0f; p_out->_44 = 1.0f;
return p_out;
}
//**************************************************************************************//
//**************************************************************************************//
D3DMATRIX *dhMatrixRotationZ(D3DMATRIX *p_out, float p_angle ){
float my_sin, my_cos;
my_sin=(float)sin(p_angle);
my_cos=(float)cos(p_angle);
p_out->_11 = my_cos; p_out->_12 = my_sin; p_out->_13 = 0.0f; p_out->_14 = 0.0f;
p_out->_21 = -my_sin; p_out->_22 = my_cos; p_out->_23 = 0.0f; p_out->_24 = 0.0f;
p_out->_31 = 0.0f; p_out->_32 = 0.0f; p_out->_33 = 1.0f; p_out->_34 = 0.0f;
p_out->_41 = 0.0f; p_out->_42 = 0.0f; p_out->_43 = 0.0f; p_out->_44 = 1.0f;
return p_out;
}
//**************************************************************************************//
//**************************************************************************************//
int init_d3d9()
{
g_D3D = Direct3DCreate9( D3D_SDK_VERSION);
if(!g_D3D){
//Handle error'
return -1;
}
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int init_d3d9device()
{
DeviceParams.BackBufferHeight = 480;
DeviceParams.BackBufferWidth = 640;
DeviceParams.BackBufferFormat = D3DFMT_UNKNOWN;
DeviceParams.BackBufferCount = 0;
DeviceParams.MultiSampleType = D3DMULTISAMPLE_NONE;
DeviceParams.MultiSampleQuality = 0;
DeviceParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
DeviceParams.hDeviceWindow = hMainWnd;
DeviceParams.Windowed = TRUE;
DeviceParams.EnableAutoDepthStencil = FALSE;
DeviceParams.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
DeviceParams.Flags = 0;
DeviceParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
DeviceParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
HRESULT hr2 = g_D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hMainWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &DeviceParams, &g_d3d_device);
//set vertex format
g_d3d_device->SetFVF(vertex_fvf);
//g_d3d_device->SetFVF(vertex_fvf2);
//g_d3d_device->SetRenderState( D3DRS_AMBIENT,
// D3DCOLOR_XRGB(10,10,10));
g_d3d_device->SetRenderState( D3DRS_DITHERENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_LIGHTING, TRUE);
hr2 = g_d3d_device->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_init_texture()
{
D3DXCreateTextureFromFile(g_d3d_device, //Direct3D Device
L"c:/cx2.png", //File Name
&g_texture); //Texture handle
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_release_texture()
{
g_texture->Release();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_setup_initial_transformations()
{
D3DXVECTOR3 eye_vector,lookat_vector,up_vector;
D3DXMATRIX view_matrix;
//View point is 8 units back on the Z-axis
eye_vector=D3DXVECTOR3( 0.0f, 0.0f, -4.0 );
//We are looking towards the origin
lookat_vector=D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
//The "up" direction is the positive direction on the y-axis
up_vector=D3DXVECTOR3(0.0f,1.0f,0.0f);
D3DXMatrixLookAtLH(&view_matrix,
&eye_vector,
&lookat_vector,
&up_vector);
HRESULT hr = g_d3d_device->SetTransform(D3DTS_VIEW, &view_matrix);
D3DXMATRIX projection_matrix;
float aspect;
aspect=((float)640.0 / (float)480.0);
D3DXMatrixPerspectiveFovLH(&projection_matrix, //Result Matrix
D3DX_PI/4, //Field of View, in radians.
aspect, //Aspect ratio
1.0f, //Near view plane
100.0f ); //Far view plane
hr = g_d3d_device->SetTransform(D3DTS_PROJECTION, &projection_matrix);
D3DVIEWPORT9 view_port;
view_port.X=0;
view_port.Y=0;
view_port.Width=640.0;
view_port.Height=480.0;
view_port.MinZ=0.0f;
view_port.MaxZ=1.0f;
hr = g_d3d_device->SetViewport(&view_port);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_create_vertex_buffer()
{
int vertex_size = sizeof(vertex);
HRESULT hr = g_d3d_device->CreateVertexBuffer(vertex_size * 512, D3DUSAGE_WRITEONLY, vertex_fvf, D3DPOOL_MANAGED, &g_vertex_buffer, NULL);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_set_vertex_buffer()
{
vertex* vertices = NULL;
g_vertex_buffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD);
vertices[2].x = -1;
vertices[2].y = -1;
vertices[2].z = 0;
vertices[2].nx = 0;
vertices[2].ny = 0;
vertices[2].nz = -1;
vertices[2].tu = 0.0;
vertices[2].tv = 0.0;
vertices[2].colour = 0xffffffff;
vertices[1].x = 1;
vertices[1].y = -1;
vertices[1].z = 0;
vertices[1].nx = 0;
vertices[1].ny = 0;
vertices[1].nz = -1;
vertices[1].tu = 1.0;
vertices[1].tv = 0.0;
vertices[1].colour = 0xffffffff;
vertices[0].x = -1;
vertices[0].y = 1;
vertices[0].z = 0;
vertices[0].nx = 0;
vertices[0].ny = 0;
vertices[0].nz = -1;
vertices[0].tu = 0.0;
vertices[0].tv = 1.0;
vertices[0].colour = 0xffffffff;
vertices[3].x = -1;
vertices[3].y = -1;
vertices[3].z = 0;
vertices[3].nx = 0;
vertices[3].ny = 0;
vertices[3].nz = 1;
vertices[3].tu = 0.0;
vertices[3].tv = 0.0;
vertices[3].colour = 0xffffffff;
vertices[4].x = 1;
vertices[4].y = -1;
vertices[4].z = 0;
vertices[4].nx = 0;
vertices[4].ny = 0;
vertices[4].nz = 1;
vertices[4].tu = 1.0;
vertices[4].tv = 0.0;
vertices[4].colour = 0xffffffff;
vertices[5].x = -1;
vertices[5].y = 1;
vertices[5].z = 0;
vertices[5].nx = 0;
vertices[5].ny = 0;
vertices[5].nz = 1;
vertices[5].tu = 0.0;
vertices[5].tv = 1.0;
vertices[5].colour = 0xffffffff;
vertices[8].x = 1;
vertices[8].y = 1;
vertices[8].z = 0;
vertices[8].nx = 0;
vertices[8].ny = 0;
vertices[8].nz = -1;
vertices[8].tu = 1.0;
vertices[8].tv = 1.0;
vertices[8].colour = 0xffffffff;
vertices[7].x = -1;
vertices[7].y = 1;
vertices[7].z = 0;
vertices[7].nx = 0;
vertices[7].ny = 0;
vertices[7].nz = -1;
vertices[7].tu = 0.0;
vertices[7].tv = 1.0;
vertices[7].colour = 0xffffffff;
vertices[6].x = 1;
vertices[6].y = -1;
vertices[6].z = 0;
vertices[6].nx = 0;
vertices[6].ny = 0;
vertices[6].nz = -1;
vertices[6].tu = 1.0;
vertices[6].tv = 0.0;
vertices[6].colour = 0xffffffff;
vertices[9].x = 1;
vertices[9].y = 1;
vertices[9].z = 0;
vertices[9].nx = 0;
vertices[9].ny = 0;
vertices[9].nz = 1;
vertices[9].tu = 1.0;
vertices[9].tv = 1.0;
vertices[9].colour = 0xffffffff;
vertices[10].x = -1;
vertices[10].y = 1;
vertices[10].z = 0;
vertices[10].nx = 0;
vertices[10].ny = 0;
vertices[10].nz = 1;
vertices[10].tu = 0.0;
vertices[10].tv = 1.0;
vertices[10].colour = 0xffffffff;
vertices[11].x = 1;
vertices[11].y = -1;
vertices[11].z = 0;
vertices[11].nx = 0;
vertices[11].ny = 0;
vertices[11].nz = 1;
vertices[11].tu = 1.0;
vertices[11].tv = 0.0;
vertices[11].colour = 0xffffffff;
g_vertex_buffer->Unlock();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_release_vertex_buffer()
{
g_vertex_buffer->Release();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_set_lights()
{
// Set light #0 to be a simple, faint grey directional light so
// the walls and floor are slightly different shades of grey
D3DLIGHT9 light; // Description of the D3D light
ZeroMemory( &light, sizeof(light) );
light.Type = D3DLIGHT_POINT;
//light.Direction = D3DXVECTOR3( 0.0, 0.0, 1.0 );
light.Position = D3DXVECTOR3(0.0f, 1.0f, -1.0f);
light.Range = 10.0f;
light.Attenuation0 = 0.0f;
light.Attenuation1 = 1.0f;
light.Attenuation2 = 0.0f;
light.Diffuse.r = light.Diffuse.g = light.Diffuse.b = 1.0f;
g_d3d_device->SetLight( 0, &light );
g_d3d_device->LightEnable(0, TRUE);
D3DMATERIAL9 material;
ZeroMemory( &material, sizeof(D3DMATERIAL9));
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
g_d3d_device->SetMaterial(&material);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
VOID D3DUtil_InitMaterial( D3DMATERIAL9& mtrl, FLOAT r, FLOAT g, FLOAT b,
FLOAT a )
{
ZeroMemory( &mtrl, sizeof(D3DMATERIAL9) );
mtrl.Diffuse.r = mtrl.Ambient.r = r;
mtrl.Diffuse.g = mtrl.Ambient.g = g;
mtrl.Diffuse.b = mtrl.Ambient.b = b;
mtrl.Diffuse.a = mtrl.Ambient.a = a;
}
//**************************************************************************************//
//**************************************************************************************//
int d3d9_render()
{
HRESULT hr = g_d3d_device->Clear(0, //Number of rectangles to clear, we're clearing everything so set it to 0
NULL, //Pointer to the rectangles to clear, NULL to clear whole display
D3DCLEAR_TARGET, //What to clear. We don't have a Z Buffer or Stencil Buffer
0x00000000, //Colour to clear to (AARRGGBB)
1.0f, //Value to clear ZBuffer to, doesn't matter since we don't have one
0 ); //Stencil clear value, again, we don't have one, this value doesn't matter
if (hr != S_OK)
return -1;
hr = g_d3d_device->BeginScene();
if (hr != S_OK)
return -1;
g_d3d_device->SetTexture(0,g_texture);
g_d3d_device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
g_d3d_device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
g_d3d_device->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
g_d3d_device->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_NONE);
g_d3d_device->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_NONE);
//g_d3d_device->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME );
g_d3d_device->SetStreamSource(0, //StreamNumber
g_vertex_buffer, //StreamData
0, //OffsetInBytes
sizeof(vertex)); //Stride
d3d9_setup_initial_transformations();
D3DMATRIX transform1;
dhMatrixRotationY(&transform1, angle);
g_d3d_device->SetTransform(D3DTS_WORLD, &transform1);
angle = angle + 0.01;
g_d3d_device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 4);
hr = g_d3d_device->EndScene();
if (hr != S_OK)
return -1;
hr = g_d3d_device->Present(NULL, NULL, NULL, NULL);
if (hr != S_OK)
return -1;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int exit_d3d9device()
{
if (g_d3d_device != NULL)
{
g_d3d_device->Release();
g_d3d_device = NULL;
}
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int exit_d3d9()
{
//Then at the end of your application
if(g_D3D){
g_D3D->Release();
g_D3D=NULL;
}
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
bRunFlag = true;
hAppInstance = hInstance;
create_window();
init_d3d9();
init_d3d9device();
d3d9_init_texture();
d3d9_create_vertex_buffer();
d3d9_set_lights();
//d3d9_setup_initial_transformations();
MSG WinMsg;
while (bRunFlag == true)
{
d3d9_set_vertex_buffer();
d3d9_render();
int iRet = PeekMessage(&WinMsg, NULL, 0, 0, PM_REMOVE);
while (iRet != 0)
{
TranslateMessage(&WinMsg);
DispatchMessage(&WinMsg);
iRet = PeekMessage(&WinMsg, NULL, 0, 0, PM_REMOVE);
}
}
d3d9_release_texture();
d3d9_release_vertex_buffer();
exit_d3d9device();
exit_d3d9();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
LRESULT CALLBACK WndCallBackProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
bRunFlag = 0;
break;
}
break;
case WM_CLOSE:
bRunFlag = 0;
break;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
//**************************************************************************************//
//**************************************************************************************//<file_sep>int sm_read_int (int addr);
double sm_read_double (int addr);
int sm_write_int (int addr, int value);
int sm_write_double (int addr, double value);
int init_sm();<file_sep>#include <windows.h>
#include <stdio.h>
#include <math.h>
#include "common_classes.h"
#define MAX_VERTEXES 200000
class cModelLoader
{
public:
int init();
int exit();
int load_obj_model(char* filename, double scale);
vertex UniqueVertexes[MAX_VERTEXES];
vertex FinalVertexes[MAX_VERTEXES];
int iNumUniqueVertexes;
int iNumUniqueTextureCoords;
int iNumUniqueNormals;
int iNumFinalVertexes;
private:
};<file_sep>#include "cAtmosphereModel.h"
//*****************************************************************//
//*****************************************************************//
//initialization function.
//grabs shared memory pointer and initializes atmosphere tables.
int cAtmosphereModel::init(cSharedMem* _pSharedMem)
{
//get shared memory pointer
pSharedMem = _pSharedMem;
//done.
return 0;
}
//*****************************************************************//
//*****************************************************************//
//this function uploads the atmospheric state to the appropriate shared memory variables,
//for use by other parts of the simulation as needed.
//It is done this way to allow the use of a separate program to calculate this if needed.
int cAtmosphereModel::calculate_atmosphere_phase0(cState state)
{
//calculate the air density for this state
double rho = get_air_density(state.get_r() - 6378100.0);
//get air temperature
double t = get_air_temperature(state.get_r() - 6378100.0);
//get air pressure
double p = get_air_pressure(state.get_r() - 6378100.0);
//upload these values to shared memory
pSharedMem->write_double(PHASE0_AIR_DENSITY, rho);
pSharedMem->write_double(PHASE0_STATIC_AIR_TEMPERATURE, t);
pSharedMem->write_double(PHASE0_STATIC_PRESSURE, p);
return 0;
}
//*****************************************************************//
//*****************************************************************//
int cAtmosphereModel::calculate_atmosphere_phase1(cState stage1_state, cState interstage_state, cState stage2_state)
{
//calculate for stage 1
//calculate the air density for this state
double rho = get_air_density(stage1_state.get_r() - 6378100.0);
//get air temperature
double t = get_air_temperature(stage1_state.get_r() - 6378100.0);
//get air pressure
double p = get_air_pressure(stage1_state.get_r() - 6378100.0);
//upload these values to shared memory
pSharedMem->write_double(PHASE1_STAGE1_AIR_DENSITY, rho);
pSharedMem->write_double(PHASE1_STAGE1_STATIC_AIR_TEMPERATURE, t);
pSharedMem->write_double(PHASE1_STAGE1_STATIC_PRESSURE, p);
//calculate for interstage
//calculate the air density for this state
rho = get_air_density(interstage_state.get_r() - 6378100.0);
//get air temperature
t = get_air_temperature(interstage_state.get_r() - 6378100.0);
//get air pressure
p = get_air_pressure(interstage_state.get_r() - 6378100.0);
//upload these values to shared memory
pSharedMem->write_double(PHASE1_INTERSTAGE_AIR_DENSITY, rho);
pSharedMem->write_double(PHASE1_INTERSTAGE_STATIC_AIR_TEMPERATURE, t);
pSharedMem->write_double(PHASE1_INTERSTAGE_STATIC_PRESSURE, p);
//calculate for stage 2
//calculate the air density for this state
rho = get_air_density(stage2_state.get_r() - 6378100.0);
//get air temperature
t = get_air_temperature(stage2_state.get_r() - 6378100.0);
//get air pressure
p = get_air_pressure(stage2_state.get_r() - 6378100.0);
//upload these values to shared memory
pSharedMem->write_double(PHASE1_STAGE2_AIR_DENSITY, rho);
pSharedMem->write_double(PHASE1_STAGE2_STATIC_AIR_TEMPERATURE, t);
pSharedMem->write_double(PHASE1_STAGE2_STATIC_PRESSURE, p);
return 0;
}
//*****************************************************************//
//*****************************************************************//
double cAtmosphereModel::get_interp(double altitude, const double* v_table)
{
//if we are lower than the lowest value in the h_table, then
//return the lowest value
if (altitude < h_table[0])
return v_table[0];
//if we're higher than the highest value, just return the highest value
if (altitude > h_table[ATM_TABLE_LENGTH -1])
return v_table[ATM_TABLE_LENGTH-1];
//initialize some indexes
int lower_index = 0;
int higher_index = 1;
//loop until altitude is lower than the value at the higher index
for (int i = 1; i < ATM_TABLE_LENGTH; i++)
{
if (altitude < h_table[i])
{
lower_index = i-1;
higher_index = i;
break;
}
}
//now set up linear interpolation
double base_val = v_table[lower_index];
double base_h = h_table[lower_index];
double dh = h_table[higher_index] - h_table[lower_index];
double dv = v_table[higher_index] - v_table[lower_index];
//dv/dh (we don't worry about divide by 0 because we know the h table always increments)
double gradient = dv/dh;
//actually calculate the value
return base_val + (altitude-base_h)*gradient;
}
//*****************************************************************//
//*****************************************************************//
double cAtmosphereModel::get_air_pressure(double altitude)
{
return get_interp(altitude, p_table);
}
//*****************************************************************//
//*****************************************************************//
double cAtmosphereModel::get_air_temperature(double altitude)
{
return get_interp(altitude, t_table);
}
//*****************************************************************//
//*****************************************************************//
double cAtmosphereModel::get_air_density(double altitude)
{
return get_interp(altitude, rho_table);
}
//*****************************************************************//
//*****************************************************************//<file_sep>#include "common_classes.h"
#pragma once
class cControlModel
{
public:
cSharedMem* pSharedMem;
//this parameter controls whether the internal controller is enabled or not.
bool bEnabled;
int init(cSharedMem* _pSharedMem)
{
pSharedMem = _pSharedMem;
bEnabled = true;
return 0;
}
int calculate_controls_phase0(cState state, cState prev_state, double sim_time);
int calculate_controls_phase1(cState state, cState prev_state, double sim_time);
private:
};<file_sep>// Kinect Header files
#include <Kinect.h>
#include <stdio.h>
int main()
{
//some defines
#define BODY_COUNT 6 //6 bodies
#define NUM_JOINTS 25 // 25 joints
//variables
HRESULT hr;
IKinectSensor* pSensor;
IBodyFrameSource* pBodyFrameSource = NULL;
ICoordinateMapper* pCoordinateMapper = NULL;
IBodyFrameReader* pBodyFrameReader = NULL;
//access the Kinect
hr = GetDefaultKinectSensor(&pSensor);
pSensor->Open();
//obtain some structures we need
pSensor->get_BodyFrameSource(&pBodyFrameSource);
pSensor->get_CoordinateMapper(&pCoordinateMapper);
pBodyFrameSource->OpenReader(&pBodyFrameReader);
//main loop
while (true)
{
//try to get frame
IBodyFrame* pBodyFrame = NULL;
hr = pBodyFrameReader->AcquireLatestFrame(&pBodyFrame);
if (SUCCEEDED(hr))
{
//////////////////////////////////////////////////
//download all the body data
IBody* ppBodies[BODY_COUNT] = { 0 };
pBodyFrame->GetAndRefreshBodyData(BODY_COUNT, ppBodies);
///////////////////////////////////////////////////
//go through each of the body slots
for (int i = 0; i < BODY_COUNT; ++i)
{
//safe check
if (ppBodies[i] != NULL)
{
//check to see whether Kinect actually found something in this slot
BOOLEAN bTracked = false;
ppBodies[i]->get_IsTracked(&bTracked);
//if we are...
if (bTracked == TRUE)
{
//DEBUG
printf("Body %d is active!\n", i);
/////////////////////////////////////////////
//Download the joint positions for all 25 joints
Joint joints[25];
ppBodies[i]->GetJoints(25, joints);
////////////////////////////////////////////
//go through all the joints and print out where
//it thinks the head and elbow are
for (int j = 0; j < _countof(joints); ++j)
{
if (joints[j].JointType == _JointType::JointType_Head)
printf("Head: x: %f y: %f z: %f\n", joints[j].Position.X, joints[j].Position.Y, joints[j].Position.Z);
if (joints[j].JointType == _JointType::JointType_ElbowLeft)
printf("Left Elbow: x: %f y: %f z: %f\n", joints[j].Position.X, joints[j].Position.Y, joints[j].Position.Z);
}
}
}
}
//release of bodies and frame
for (int i = 0; i < BODY_COUNT; ++i)
{
ppBodies[i]->Release();
}
pBodyFrame->Release();
} //end of succeeded getting frame
} //end while loop
//close
pSensor->Close();
return 0;
}<file_sep>//Description: Titan4 is the shared memory implementation
//that allows all of the other components to communicate with
//other. It uses the ability of a DLL to define a memory segment
//that is common to all instances of that DLL, to allow those who
//link to the DLL to access shared memory.
#include <windows.h>
#pragma data_seg(".myseg")
char Buffer[0x100000] = ""; //"all shared variables must be statically initialized" <-- very important!
#pragma data_seg()
__declspec(dllexport) char __cdecl _read8(int addr)
{
if (addr < 0)
return 0;
if (addr >= 0x100000)
return 0;
return Buffer[addr];
}
__declspec(dllexport) char __cdecl _write8(int addr, char data)
{
if (addr < 0)
return -1;
if (addr >= 0x100000)
return -1;
Buffer[addr] = data;
return 0;
}
__declspec(dllexport) int __cdecl _write_int(int addr, int value)
{
int* pi = (int*)(Buffer + addr);
*pi = value;
return 0;
}
__declspec(dllexport) int __cdecl _read_int(int addr)
{
int* pi = (int*)(Buffer + addr);
return *pi ;
}
__declspec(dllexport)int __cdecl _write_double(int addr, double value)
{
double* pf = (double*)(Buffer + addr);
*pf = value;
return 0;
}
__declspec(dllexport) double __cdecl _read_double(int addr)
{
double* pf = (double*)(Buffer + addr);
return *pf;
}
int WINAPI DllMain()
{
return TRUE;
}<file_sep>#include <stdio.h>
#include "cQuaternion.h"
#include "cSharedMem.h"
#include "cForceModel.h"
#include "cControlModel.h"
#include "cAtmosphereModel.h"
#include "cAerodynamicsModel.h"
#pragma once
#define MAX_MASSES 5
//###################################################//
//###################################################//
class cPointMass
{
public:
cState State;
private:
};
//###################################################//
//###################################################//
class cIntegrator
{
public:
cSharedMem* pSharedMem;
cForceModel* pForceModel;
cControlModel* pControlModel;
cAtmosphereModel* pAtmosphereModel;
cAerodynamicsModel* pAerodynamicsModel;
cPointMass Masses[MAX_MASSES];
double sim_time;
double num_masses;
cState test_advance(cDerivative derivs, cState state, double time_step);
cState rk4_advance(cState state, double time_step);
cDerivative rk4_weighted_avg_derivs(cDerivative k1, cDerivative k2, cDerivative k3, cDerivative k4);
int load_inputs(cForceMoment input_fm, cThrustEffect input_te, cForceMoment input_aero_fm);
int init(cSharedMem* _pSharedMem,
cForceModel* _pForceModel,
cControlModel* _pControlModel,
cAtmosphereModel* _pAtmosphereModel,
cAerodynamicsModel* _pAerodynamicsModel);
int exit();
int run_step_phase0(double time_step);
int run_step_phase1(double time_step);
int run_step(double time_step);
int ic();
int first_stage_sep();
private:
};<file_sep>#define RAD_TO_DEG 57.2957795
#define DEG_TO_RAD 0.0174532925<file_sep>#include "main.h"
LRESULT CALLBACK WndCallBackProc0(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndCallBackProc1(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
vertex2d square2d[] ={{ -960, 720, 0.5f, 1.0f, 0xFFFFFFFF, 0.0, 3.0 }, // x, y, z, rhw, color, tu, tv
{ -960, -720, 0.5f, 1.0f, 0xFFFFFFFF, 0.0, 0.0 },
{ 960, 720, 0.5f, 1.0f, 0xFFFFFFFF, 3.0, 3.0},
{ 960, -720, 0.5f, 1.0f, 0xFFFFFFFF, 3.0, 0.0}};
vertex2d sp2d[] = {{ -2, 2, 0.5f, 1.0f, 0xFFFFFFFF, 0.0, 1.0 }, // x, y, z, rhw, color, tu, tv
{ -2, -2, 0.5f, 1.0f, 0xFFFFFFFF, 0.0, 0.0 },
{ 2, 2, 0.5f, 1.0f, 0xFFFFFFFF, 1.0, 1.0},
{ 2, -2, 0.5f, 1.0f, 0xFFFFFFFF, 1.0, 0.0}};
float x, y; // screen position
float z; // Z-buffer depth
float rhw; // reciprocal homogeneous W
DWORD Diffuse; // diffuse color
DWORD Specular; // specular color
float tu1, tv1; // texture coordinates
//3D Objects
cRenderObject* pShip;
cRenderObject* pStage1Nozzle;
cRenderObject* pInterstage;
cRenderObject* pEarth;
cRenderObject* pStage2Nozzle;
cRenderObject* pStage2Main;
cRenderObject* pPayload;
//2D Objects
cRenderObject* pMap2D;
cRenderObject* pStage1_2D;
cRenderObject* pStage2_2D;
double input_scale;
//playing around
#include <Kinect.h>
//some defines
#define BODY_COUNT 6 //6 bodies
#define NUM_JOINTS 25 // 25 joints
IKinectSensor* pSensor;
IBodyFrameSource* pBodyFrameSource = NULL;
ICoordinateMapper* pCoordinateMapper = NULL;
IBodyFrameReader* pBodyFrameReader = NULL;
//**************************************************************************************//
//**************************************************************************************//
int initKinect()
{
//access the Kinect
HRESULT hr = GetDefaultKinectSensor(&pSensor);
pSensor->Open();
//obtain some structures we need
pSensor->get_BodyFrameSource(&pBodyFrameSource);
pSensor->get_CoordinateMapper(&pCoordinateMapper);
pBodyFrameSource->OpenReader(&pBodyFrameReader);
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int exitKinect()
{
pSensor->Close();
pSensor->Release();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int processKinect()
{
//try to get frame
IBodyFrame* pBodyFrame = NULL;
HRESULT hr = pBodyFrameReader->AcquireLatestFrame(&pBodyFrame);
if (SUCCEEDED(hr))
{
//////////////////////////////////////////////////
//download all the body data
IBody* ppBodies[BODY_COUNT] = { 0 };
pBodyFrame->GetAndRefreshBodyData(BODY_COUNT, ppBodies);
///////////////////////////////////////////////////
//go through each of the body slots
for (int i = 0; i < BODY_COUNT; ++i)
{
//safe check
if (ppBodies[i] != NULL)
{
//check to see whether Kinect actually found something in this slot
BOOLEAN bTracked = false;
ppBodies[i]->get_IsTracked(&bTracked);
//if we are...
if (bTracked == TRUE)
{
//DEBUG
//printf("Body %d is active!\n", i);
/////////////////////////////////////////////
//Download the joint positions for all 25 joints
Joint joints[25];
ppBodies[i]->GetJoints(25, joints);
////////////////////////////////////////////
//go through all the joints and print out where
//it thinks the head and elbow are
for (int j = 0; j < _countof(joints); ++j)
{
//if (joints[j].JointType == _JointType::JointType_Head)
// printf("Head: x: %f y: %f z: %f\n", joints[j].Position.X, joints[j].Position.Y, joints[j].Position.Z);
if (joints[j].JointType == _JointType::JointType_HandLeft)
{
D3D.Devices[0].cam_yaw = joints[j].Position.X;
D3D.Devices[0].cam_tilt = joints[j].Position.Y;
D3D.Devices[0].bViewChanged = true;
}
// printf("Left Elbow: x: %f y: %f z: %f\n", joints[j].Position.X, joints[j].Position.Y, joints[j].Position.Z);
}
}
}
}
//release of bodies and frame
for (int i = 0; i < BODY_COUNT; ++i)
{
ppBodies[i]->Release();
}
pBodyFrame->Release();
} //end of succeeded getting frame
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
D3DXVECTOR3 get_d3d_vector(VECTOR3 input)
{
return D3DXVECTOR3(input.x, input.y, input.z);
}
//**************************************************************************************//
//**************************************************************************************//
int calc_views_earthfixed(cD3D_Device* pDevice, double cam_dist, double cam_tilt, double cam_yaw)
{
double base_pitch = pDevice->RenderList->pitch;
double base_roll = pDevice->RenderList->roll;
double base_yaw = pDevice->RenderList->yaw;
//the original basis vectors
D3DXVECTOR3 xbody0 = D3DXVECTOR3(1,0,0);
D3DXVECTOR3 ybody0 = D3DXVECTOR3(0,1,0);
D3DXVECTOR3 zbody0 = D3DXVECTOR3(0,0,1);
//assumes body is aligned with forward along x-axis.
//perform rotation to account for yaw
D3DXVECTOR3 xbody1a = (cos(base_yaw) * xbody0) + (sin(base_yaw) * ybody0);
D3DXVECTOR3 zbody1a = zbody0;
D3DXVECTOR3 ybody1a = (cos(base_yaw) * ybody0) - (sin(base_yaw) * xbody0);
//perform rotation to account for to account for pitch
D3DXVECTOR3 xbody2a = (cos(base_pitch) * xbody1a) - (sin(base_pitch) * zbody1a);
D3DXVECTOR3 zbody2a = (cos(base_pitch) * zbody1a) + (sin(base_pitch) * xbody1a);
D3DXVECTOR3 ybody2a = ybody1a;
//perform rotation to account for to account for roll
D3DXVECTOR3 ybody3a = (cos(base_roll) * ybody2a) - (sin(base_roll) * zbody2a);
D3DXVECTOR3 zbody3a = (cos(base_roll) * zbody2a) + (sin(base_roll) * ybody2a);
D3DXVECTOR3 xbody3a = xbody2a;
//perform rotation to account for cam yaw
D3DXVECTOR3 xbody4 = (cos(cam_yaw) * xbody3a) + (sin(cam_yaw) * ybody3a);
D3DXVECTOR3 zbody4 = zbody3a;
D3DXVECTOR3 ybody4 = (cos(cam_yaw) * ybody3a) - (sin(cam_yaw) * xbody3a);
//perform rotation to account for cam tilt
D3DXVECTOR3 xbody5 = (cos(cam_tilt) * xbody4) + (sin(cam_tilt) * zbody4);
D3DXVECTOR3 zbody5 = (cos(cam_tilt) * zbody4) - (sin(cam_tilt) * xbody4);
D3DXVECTOR3 ybody5 = ybody4;
D3DXVECTOR3 base = D3DXVECTOR3(0,0,0);
base = cam_dist * xbody5;
pDevice->lookat_vector = D3DXVECTOR3(0,0,0);
pDevice->eye_vector = base;
pDevice->up_vector = zbody5;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int calc_views_targetfixed(cD3D_Device* pDevice, double r, double longitude, double latitude,
double cam_dist, double cam_tilt, double cam_yaw,
double target_pitch, double target_roll, double target_yaw, double x_body_offset)
{
//just set them all to 0 for now.
double base_pitch = 0;//pDevice->RenderList->pitch;
double base_roll = 0;//pDevice->RenderList->roll;
double base_yaw = 0; //cam_yaw;//pDevice->RenderList->yaw;
target_pitch = 0;
target_roll = 0;
target_yaw = 0;
//the original basis vectors
VECTOR3 xbody0 = VECTOR3(1,0,0);
VECTOR3 ybody0 = VECTOR3(0,1,0);
VECTOR3 zbody0 = VECTOR3(0,0,1);
//assumes body is aligned with forward along x-axis.
//perform rotation to account for yaw
VECTOR3 xbody1a = (cos(base_yaw) * xbody0) + (sin(base_yaw) * ybody0);
VECTOR3 zbody1a = zbody0;
VECTOR3 ybody1a = (cos(base_yaw) * ybody0) - (sin(base_yaw) * xbody0);
//perform rotation to account for to account for pitch
VECTOR3 xbody2a = (cos(base_pitch) * xbody1a) - (sin(base_pitch) * zbody1a);
VECTOR3 zbody2a = (cos(base_pitch) * zbody1a) + (sin(base_pitch) * xbody1a);
VECTOR3 ybody2a = ybody1a;
//perform rotation to account for to account for roll
VECTOR3 ybody3a = (cos(base_roll) * ybody2a) - (sin(base_roll) * zbody2a);
VECTOR3 zbody3a = (cos(base_roll) * zbody2a) + (sin(base_roll) * ybody2a);
VECTOR3 xbody3a = xbody2a;
//assumes body is aligned with forward along x-axis.
//perform rotation to account for longitude
VECTOR3 xbody1 = (cos(-longitude) * xbody3a) - (sin(-longitude) * ybody3a);
VECTOR3 zbody1 = zbody3a;
VECTOR3 ybody1 = (cos(-longitude) * ybody3a) + (sin(-longitude) * xbody3a);
//D3DXVECTOR3 xbody1 = (cos(longitude) * xbody0) - (sin(longitude) * ybody0);
//D3DXVECTOR3 zbody1 = zbody0;
//D3DXVECTOR3 ybody1 = (cos(longitude) * ybody0) + (sin(longitude) * xbody0);
//perform rotation to account for to account for latitude
VECTOR3 xbody2 = (cos(-latitude) * zbody1) - (sin(-latitude) * xbody1);
VECTOR3 zbody2 = (cos(-latitude) * xbody1) + (sin(-latitude) * zbody1);
VECTOR3 ybody2 = ybody1;
//assumes body is aligned with forward along x-axis.
//perform rotation to account for yaw
VECTOR3 xbody3 = (cos(target_yaw) * xbody2) + (sin(target_yaw) * ybody2);
VECTOR3 zbody3 = zbody2;
VECTOR3 ybody3 = (cos(target_yaw) * ybody2) - (sin(target_yaw) * xbody2);
//perform rotation to account for cam yaw
VECTOR3 xbody4 = (cos(cam_yaw) * xbody3) + (sin(cam_yaw) * ybody3);
VECTOR3 zbody4 = zbody3;
VECTOR3 ybody4 = (cos(cam_yaw) * ybody3) - (sin(cam_yaw) * xbody3);
//perform rotation to account for cam tilt
VECTOR3 xbody5 = (cos(cam_tilt) * xbody4) + (sin(cam_tilt) * zbody4);
VECTOR3 zbody5 = (cos(cam_tilt) * zbody4) - (sin(cam_tilt) * xbody4);
VECTOR3 ybody5 = ybody4;
VECTOR3 base = VECTOR3(0,0,0);
base = cam_dist * xbody5;
VECTOR3 pos = VECTOR3(0,0,0);
//
//pos = xbody3a*cos(latitude)*cos(3.14159 + longitude) - ybody3a*cos(latitude)*sin(3.14159 + longitude) + zbody3a*sin(latitude);
//pos = pos * r;
pDevice->lookat_vector = get_d3d_vector(pos);
pDevice->eye_vector = get_d3d_vector(base + pos);
pDevice->up_vector = get_d3d_vector(zbody5);
pDevice->bLight0Changed = true;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int map_sm()
{
hSharedMem = LoadLibraryA("Titan4DLL.dll");
read_int = (_read_int_type)GetProcAddress(hSharedMem, "_read_int");
write_int = (_write_int_type)GetProcAddress(hSharedMem, "_write_int");
read_double = (_read_double_type)GetProcAddress(hSharedMem, "_read_double");
write_double = (_write_double_type)GetProcAddress(hSharedMem, "_write_double");
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int update_coords_phase0()
{
pStage2Main->longitude = read_double(PHASE0_LONGITUDE);
pStage2Main->latitude = read_double(PHASE0_LATITUDE);
pStage2Main->pr = read_double(PHASE0_R) * 100.0;
pStage2Main->pitch = read_double(PHASE0_PITCH) * -1;
pStage2Main->roll = read_double(PHASE0_ROLL);
pStage2Main->yaw = read_double(PHASE0_YAW);
//TEMP HACK:
//this is to reverse the definition of yaw
// 0 heading = 90 yaw
// 90 heading = 0 yaw
// 180 heading = -90 yaw
// 270 heading = -180 yaw
pStage2Main->yaw = pStage2Main->yaw + 90.0*(3.14159/180.0);
pStage1Nozzle->pitch = read_double(STAGE1_ENGINE_GIMBAL_TILT);
pStage1Nozzle->yaw = read_double(STAGE1_ENGINE_GIMBAL_ROLL);
//set history buffer
pStage2Nozzle->pHistoryBuffer->bEnable = false;
pStage1Nozzle->pHistoryBuffer->bEnable = true;
//the number of degrees of long/lat per pixel is
double deg_to_pixel_longitude = 640.0 / 360.0;
double deg_to_pixel_latitude = (480.0 / 180.0) * -1;
//2D components
pStage2_2D->px = read_double(PHASE0_LONGITUDE) * RAD_TO_DEG * deg_to_pixel_longitude;
pStage2_2D->py = read_double(PHASE0_LATITUDE) * RAD_TO_DEG * deg_to_pixel_latitude;
pStage1_2D->px = pStage2_2D->px;
pStage1_2D->py = pStage2_2D->py;
//set history buffer for 2D
pStage2_2D->pHistoryBuffer->bEnable = false;
pStage1_2D->pHistoryBuffer->bEnable = true;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int update_coords_phase1()
{
//first stage
pShip->longitude = read_double(PHASE1_STAGE1_LONG);
pShip->latitude = read_double(PHASE1_STAGE1_LAT);
pShip->pr = read_double(PHASE1_STAGE1_R) * 100.0;
pShip->pitch = read_double(PHASE1_STAGE1_PITCH) * -1;
pShip->roll = read_double(PHASE1_STAGE1_ROLL);
pShip->yaw = read_double(PHASE1_STAGE1_YAW);
//TEMP HACK:
//this is to reverse the definition of yaw
// 0 heading = 90 yaw
// 90 heading = 0 yaw
// 180 heading = -90 yaw
// 270 heading = -180 yaw
pShip->yaw = pShip->yaw + 90.0*(3.14159/180.0);
pStage1Nozzle->pitch = read_double(STAGE1_ENGINE_GIMBAL_TILT);
pStage1Nozzle->yaw = read_double(STAGE1_ENGINE_GIMBAL_ROLL);
//second stage
pStage2Main->longitude = read_double(PHASE1_STAGE2_LONG);
pStage2Main->latitude = read_double(PHASE1_STAGE2_LAT);
pStage2Main->pr = read_double(PHASE1_STAGE2_R) * 100.0;
pStage2Main->pitch = read_double(PHASE1_STAGE2_PITCH) * -1;
pStage2Main->roll = read_double(PHASE1_STAGE2_ROLL);
pStage2Main->yaw = read_double(PHASE1_STAGE2_YAW);
//TEMP HACK:
//this is to reverse the definition of yaw
// 0 heading = 90 yaw
// 90 heading = 0 yaw
// 180 heading = -90 yaw
// 270 heading = -180 yaw
pStage2Main->yaw = pStage2Main->yaw + 90.0*(3.14159/180.0);
pStage2Nozzle->pitch = read_double(STAGE2_ENGINE_GIMBAL_TILT);
pStage2Nozzle->yaw = read_double(STAGE2_ENGINE_GIMBAL_ROLL);
//interstage
pInterstage->longitude = read_double(PHASE1_INTERSTAGE_LONG);
pInterstage->latitude = read_double(PHASE1_INTERSTAGE_LAT);
pInterstage->pr = read_double(PHASE1_INTERSTAGE_R) * 100.0;
pInterstage->pitch = read_double(PHASE1_INTERSTAGE_PITCH) * -1;
pInterstage->roll = read_double(PHASE1_INTERSTAGE_ROLL);
pInterstage->yaw = read_double(PHASE1_INTERSTAGE_YAW);
//TEMP HACK:
//this is to reverse the definition of yaw
// 0 heading = 90 yaw
// 90 heading = 0 yaw
// 180 heading = -90 yaw
// 270 heading = -180 yaw
pInterstage->yaw = pInterstage->yaw + 90.0*(3.14159/180.0);
//the number of degrees of long/lat per pixel is
double deg_to_pixel_longitude = 640.0 / 360.0;
double deg_to_pixel_latitude = (480.0 / 180.0) * -1;
//2D components
pStage2_2D->px = read_double(PHASE1_STAGE2_LONG) * RAD_TO_DEG * deg_to_pixel_longitude;
pStage2_2D->py = read_double(PHASE1_STAGE2_LAT) * RAD_TO_DEG * deg_to_pixel_latitude;
pStage1_2D->px = read_double(PHASE1_STAGE1_LONG) * RAD_TO_DEG * deg_to_pixel_longitude;
pStage1_2D->py = read_double(PHASE1_STAGE1_LAT) * RAD_TO_DEG * deg_to_pixel_latitude;
//set history buffer
pStage2Nozzle->pHistoryBuffer->bEnable = true;
pStage1Nozzle->pHistoryBuffer->bEnable = true;
//set history buffer for 2D
pStage2_2D->pHistoryBuffer->bEnable = true;
pStage1_2D->pHistoryBuffer->bEnable = true;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int first_stage_separation()
{
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int set_components_phase0()
{
/////////////////////////////////////////////////////////////////////////
//set relationships such that everything is a single group
pEarth = D3D.Devices[0].RenderList;
pEarth->pNextSibling = NULL;
pEarth->pFirstChild = pStage2Main;
pStage2Main->pNextSibling = NULL;//pPayload;
pStage2Main->pFirstChild = pShip;
pShip->pNextSibling = pStage1Nozzle;
pShip->pFirstChild = NULL;
pStage1Nozzle->pNextSibling = pInterstage;
pStage1Nozzle->pFirstChild = NULL;
pInterstage->pNextSibling = pStage2Nozzle;
pInterstage->pFirstChild = NULL;
pStage2Nozzle->pNextSibling = pPayload;
pStage2Nozzle->pFirstChild = NULL;
pPayload->pNextSibling = NULL;
pPayload->pFirstChild = NULL;
///////////////////////////////////////////////////////////////////////
pEarth->iOrientationMode = ORIENTATION_MODE_PITCHROLLYAW;
pStage2Main->latitude = 0;
pStage2Main->longitude = 0;
pStage2Main->pr = 105 * SHIP_SCALE;
pStage2Main->iOrientationMode = ORIENTATION_MODE_LATLONGPR | ORIENTATION_MODE_PITCHROLLYAW;
pShip->px = 0;//-8.5 * 0.8965 * SHIP_SCALE;
pShip->py = 0.0;
pShip->pz = 0.0;
pShip->pitch = 0;
pShip->roll = 0;
pShip->yaw = 0;
pShip->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
pStage1Nozzle->px = -8.5 * 0.8965 * SHIP_SCALE;
pStage1Nozzle->py = 0.0;
pStage1Nozzle->pz = 0.0;
pStage1Nozzle->pitch = 0;
pStage1Nozzle->roll = 0;
pStage1Nozzle->yaw = 0;
pStage1Nozzle->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
pInterstage->px = 3.1 * 0.8965 * SHIP_SCALE;
pInterstage->py = 0.0;
pInterstage->pz = 0.0;
pInterstage->pitch = 0;
pInterstage->roll = 0;
pInterstage->yaw = 0;
pInterstage->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
pStage2Nozzle->pitch = 0;
pStage2Nozzle->px = 6.1 * 0.8965 * SHIP_SCALE;
pStage2Nozzle->py = 0.0;
pStage2Nozzle->pz = 0.0;
pStage2Nozzle->pitch = 0;
pStage2Nozzle->roll = 0;
pStage2Nozzle->yaw = 0;
pStage2Nozzle->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
/*
pStage2Main->pitch = 0;
pStage2Main->px = 9.1 * 0.8965 * SHIP_SCALE;
pStage2Main->py = 0.0;
pStage2Main->pz = 0.0;
pStage2Main->pitch = 0;
pStage2Main->roll = 0;
pStage2Main->yaw = 0;
pStage2Main->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
*/
pPayload->pitch = 0;
pPayload->px = 10.3 * 0.8965 * SHIP_SCALE;
pPayload->py = 0.0;
pPayload->pz = 0.0;
pPayload->pitch = 0;
pPayload->roll = 0;
pPayload->yaw = 0;
pPayload->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
//this offsets everything
pPayload->px -= 9.1 * 0.8965 * SHIP_SCALE;
//pStage2Main->px -= 9.1 * 0.8965 * SHIP_SCALE;
pStage2Nozzle->px -= 9.1 * 0.8965 * SHIP_SCALE;
pInterstage->px -= 9.1 * 0.8965 * SHIP_SCALE;
pStage1Nozzle->px -= 9.1 * 0.8965 * SHIP_SCALE;
pShip->px -= 9.1 * 0.8965 * SHIP_SCALE;
/////////////////////
//now do the same for the 2D map
pMap2D = D3D.Devices[1].RenderList;
pMap2D->pNextSibling = NULL;
pMap2D->pFirstChild = pStage2_2D;
pStage2_2D->pNextSibling = pStage1_2D;
pStage2_2D->pFirstChild = NULL;
pStage1_2D->pNextSibling = NULL;
pStage1_2D->pFirstChild = NULL;
component_setup = 0;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
int set_components_phase1()
{
/////////////////////////////////////////////////////////////////////////
//set relationships such that everything into three groups, Stage1, Interstage and Stage2
pEarth = D3D.Devices[0].RenderList;
pEarth->pNextSibling = NULL;
pEarth->pFirstChild = pShip;
//top-level
pShip->pNextSibling = pInterstage;
pShip->pFirstChild = pStage1Nozzle;
pStage1Nozzle->pNextSibling = NULL;
pStage1Nozzle->pFirstChild = NULL;
//top-level
pInterstage->pNextSibling = pStage2Main;
pInterstage->pFirstChild = NULL;
//top-level
pStage2Main->pNextSibling = NULL;
pStage2Main->pFirstChild = pStage2Nozzle;
pStage2Nozzle->pNextSibling = pPayload;
pStage2Nozzle->pFirstChild = NULL;
pPayload->pNextSibling = NULL;
pPayload->pFirstChild = NULL;
///////////////////////////////////////////////////////////////////////
pEarth->iOrientationMode = ORIENTATION_MODE_PITCHROLLYAW;
pShip->latitude = 0;
pShip->longitude = 0;
pShip->pr = 105 * SHIP_SCALE;
pShip->iOrientationMode = ORIENTATION_MODE_LATLONGPR | ORIENTATION_MODE_PITCHROLLYAW;
pStage1Nozzle->pitch = 0.45;
pStage1Nozzle->px = -8.5 * 0.8965 * SHIP_SCALE;
pStage1Nozzle->py = 0.0;
pStage1Nozzle->pz = 0.0;
pStage1Nozzle->pitch = 0;
pStage1Nozzle->roll = 0;
pStage1Nozzle->yaw = 0;
pStage1Nozzle->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
pInterstage->latitude = 0;
pInterstage->longitude = 0;
pInterstage->pr = 105 * SHIP_SCALE;
pInterstage->iOrientationMode = ORIENTATION_MODE_LATLONGPR | ORIENTATION_MODE_PITCHROLLYAW;
pStage2Main->latitude = 0;
pStage2Main->longitude = 0;
pStage2Main->pr = 105 * SHIP_SCALE;
pStage2Main->iOrientationMode = ORIENTATION_MODE_LATLONGPR | ORIENTATION_MODE_PITCHROLLYAW;
pStage2Nozzle->pitch = 0;
pStage2Nozzle->px = (-3.0) * 0.8965 * SHIP_SCALE;
pStage2Nozzle->py = 0.0;
pStage2Nozzle->pz = 0.0;
pStage2Nozzle->pitch = 0;
pStage2Nozzle->roll = 0;
pStage2Nozzle->yaw = 0;
pStage2Nozzle->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
pPayload->pitch = 0;
pPayload->px = 1.2 * 0.8965 * SHIP_SCALE;
pPayload->py = 0.0;
pPayload->pz = 0.0;
pPayload->pitch = 0;
pPayload->roll = 0;
pPayload->yaw = 0;
pPayload->iOrientationMode = ORIENTATION_MODE_BODYXYZ | ORIENTATION_MODE_PITCHROLLYAW;
/////////////////////
//now do the same for the 2D map
pMap2D = D3D.Devices[1].RenderList;
pMap2D->pNextSibling = NULL;
pMap2D->pFirstChild = pStage1_2D;
pStage1_2D->pNextSibling = pStage2_2D;
pStage1_2D->pFirstChild = NULL;
pStage2_2D->pNextSibling = NULL;
pStage2_2D->pFirstChild = NULL;
component_setup = 1;
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
//this function calculates
//**************************************************************************************//
//**************************************************************************************//
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WindowManager.init(hInstance);
WindowManager.create_window(0, L"Class1", L"Main Application Window", WndCallBackProc0);
WindowManager.create_window(1, L"Class2", L"Secondary Application Window", WndCallBackProc1);
D3D.init();
D3D.load_window_3d(0, WindowManager.hWindows[0], 640, 480);
D3D.load_window_2d(1, WindowManager.hWindows[1], 640, 480);
D3D.Devices[0].init_views0();
D3D.Devices[1].init_views0();
D3D.Devices[0].init_lights0();
D3D.Devices[1].init_lights1();
Loader.init();
D3D.Devices[1].load_with_sprite(D3D.Devices[1].RenderList, square2d, 4, L"infile.png");
pMap2D = D3D.Devices[1].RenderList;
pStage2_2D = pMap2D->add_child();
D3D.Devices[1].load_with_sprite(pStage2_2D, sp2d, 4, L"stage2.png");
D3D.Devices[1].add_history_buffer(pStage2_2D, false, D3DXCOLOR(0,0,0,0));
pStage2_2D->set_name("stage2_2D");
pStage2_2D->bFixedScale2D = true;
pStage1_2D = pMap2D->add_child();
D3D.Devices[1].load_with_sprite(pStage1_2D, sp2d, 4, L"stage1.png");
pStage1_2D->set_name("stage1_2D");
D3D.Devices[1].add_history_buffer(pStage1_2D, true, D3DXCOLOR(0,0,0,0));
pStage1_2D->bFixedScale2D = true;
Loader.load_obj_model("globe.objx", 637810.0);
D3D.Devices[0].load_with_model(D3D.Devices[0].RenderList, Loader.FinalVertexes, Loader.iNumFinalVertexes, L"infile.png");
pEarth = D3D.Devices[0].RenderList;
pEarth->set_name("globe");
Loader.load_obj_model("stage1_main.objx", SHIP_SCALE);
pShip = D3D.Devices[0].RenderList->add_child();
D3D.Devices[0].load_with_model(pShip, Loader.FinalVertexes, Loader.iNumFinalVertexes, NULL);
D3D.Devices[0].reverse_normals(pShip);
pShip->set_name("stage1_main");
pStage1Nozzle = pShip->add_child();
Loader.load_obj_model("stage1_nozzle.objx", SHIP_SCALE);
D3D.Devices[0].load_with_model(pStage1Nozzle, Loader.FinalVertexes, Loader.iNumFinalVertexes, NULL);
D3D.Devices[0].reverse_normals(pStage1Nozzle);
pStage1Nozzle->set_name("stage1_nozzle");
D3D.Devices[0].add_history_buffer(pStage1Nozzle, true, D3DXCOLOR(1.0f, 0.0f, 0.0f, 1.0f));
pInterstage = pShip->add_child();
Loader.load_obj_model("interstage.objx", SHIP_SCALE);
D3D.Devices[0].load_with_model(pInterstage, Loader.FinalVertexes, Loader.iNumFinalVertexes, NULL);
D3D.Devices[0].reverse_normals(pInterstage);
pInterstage->set_name("interstage");
pStage2Nozzle = pShip->add_child();
Loader.load_obj_model("stage2_nozzle.objx", SHIP_SCALE * 2.0);
D3D.Devices[0].load_with_model(pStage2Nozzle, Loader.FinalVertexes, Loader.iNumFinalVertexes, NULL);
D3D.Devices[0].reverse_normals(pStage2Nozzle);
pStage2Nozzle->set_name("stage2_nozzle");
D3D.Devices[0].add_history_buffer(pStage2Nozzle, false, D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f));
pStage2Main = pShip->add_child();
Loader.load_obj_model("stage2_main.objx", SHIP_SCALE);
D3D.Devices[0].load_with_model(pStage2Main, Loader.FinalVertexes, Loader.iNumFinalVertexes, NULL);
D3D.Devices[0].reverse_normals(pStage2Main);
pStage2Main->set_name("stage2_main");
pPayload = pShip->add_child();
Loader.load_obj_model("payload.objx", SHIP_SCALE);
D3D.Devices[0].load_with_model(pPayload, Loader.FinalVertexes, Loader.iNumFinalVertexes, NULL);
D3D.Devices[0].reverse_normals(pPayload);
pPayload->set_name("payload");
D3D.Devices[0].follow_on();
D3D.Devices[1].follow_on();
set_components_phase0();
MSG WinMsg;
map_sm();
int count = 0;
camera_target = 0;
D3D.Devices[0].cam_dist = 18.0;
cRenderObject* object_to_follow = pShip;
//DEBUG
write_double(PHASE0_R, 6379.0);
write_double(PHASE0_LONGITUDE, 0);
write_double(PHASE0_LATITUDE, 0);
//DEBUG
pMap2D->px = 320;
pMap2D->py = 240;
//init scaling factor
input_scale = 1.0;
initKinect();
while (WindowManager.bRunFlag == true)
{
processKinect();
count++;
write_int(0x100, count);
//get command
int command = read_int(VIS_COMMAND);
write_int(VIS_COMMAND, 0);
if (command == 2)
{
pStage1Nozzle->pHistoryBuffer->clear();
pStage2Nozzle->pHistoryBuffer->clear();
pStage1_2D->pHistoryBuffer->clear();
pStage2_2D->pHistoryBuffer->clear();
}
//quit
if (command == 3)
break;
//update location
//update coordinates based on phase
int sim_phase = read_int(SIM_PHASE);
double sim_time = read_double(SIM_TIME);
if (sim_phase == 0)
{
if (component_setup != 0)
set_components_phase0();
update_coords_phase0();
object_to_follow = pStage2Main;
}
if (sim_phase == 1)
{
if (component_setup != 1)
set_components_phase1();
update_coords_phase1();
object_to_follow = pStage2Main;
}
if (camera_target == 0)
calc_views_targetfixed(&D3D.Devices[0], object_to_follow->pr, object_to_follow->longitude, object_to_follow->latitude, D3D.Devices[0].cam_dist, D3D.Devices[0].cam_tilt, D3D.Devices[0].cam_yaw, object_to_follow->pitch, object_to_follow->roll, object_to_follow->yaw, 0);
if (camera_target == 1)
calc_views_earthfixed(&D3D.Devices[0], D3D.Devices[0].cam_dist, D3D.Devices[0].cam_tilt, D3D.Devices[0].cam_yaw);
VECTOR3 pos = VECTOR3(0,0,0);
//the original basis vectors
VECTOR3 xbody0 = VECTOR3(1,0,0);
VECTOR3 ybody0 = VECTOR3(0,1,0);
VECTOR3 zbody0 = VECTOR3(0,0,1);
pos = xbody0*cos(-object_to_follow->latitude)*cos(-object_to_follow->longitude) - ybody0*cos(-object_to_follow->latitude)*sin(-object_to_follow->longitude) + zbody0*sin(-object_to_follow->latitude);
pos = pos * object_to_follow->pr;
D3D.render(VECTOR3(-pos.x, -pos.y, -pos.z), VECTOR3(0, 0, 0), input_scale, sim_time);
int iRet = PeekMessage(&WinMsg, NULL, 0, 0, PM_REMOVE);
while (iRet != 0)
{
TranslateMessage(&WinMsg);
DispatchMessage(&WinMsg);
iRet = PeekMessage(&WinMsg, NULL, 0, 0, PM_REMOVE);
}
Sleep(10);
}
write_int(SIM_COMMAND, 0);
D3D.exit();
exitKinect();
return 0;
}
//**************************************************************************************//
//**************************************************************************************//
LRESULT CALLBACK WndCallBackProc0(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
WindowManager.bRunFlag = 0;
break;
case VK_UP:
D3D.Devices[0].eye_tilt_up();
break;
case VK_DOWN:
D3D.Devices[0].eye_tilt_down();
break;
case VK_LEFT:
D3D.Devices[0].eye_tilt_left();
break;
case VK_RIGHT:
D3D.Devices[0].eye_tilt_right();
break;
case VK_PRIOR:
if (D3D.Devices[0].bFollow == false)
D3D.Devices[0].eye_forward();
else
D3D.Devices[0].zoom_in();
break;
case VK_NEXT:
if (D3D.Devices[0].bFollow == false)
D3D.Devices[0].eye_back();
else
D3D.Devices[0].zoom_out();
break;
case VK_NUMPAD8:
D3D.Devices[0].pan_up();
break;
case VK_NUMPAD4:
D3D.Devices[0].pan_left();
break;
case VK_NUMPAD6:
D3D.Devices[0].pan_right();
break;
case VK_NUMPAD2:
D3D.Devices[0].pan_down();
break;
case VK_F1:
//D3D.Devices[0].follow_on();
camera_target = 0;
D3D.Devices[0].cam_dist = 10.0;
break;
case VK_F2:
//D3D.Devices[0].follow_off();
camera_target = 1;
D3D.Devices[0].cam_dist = 120.0;
break;
}
break;
case WM_CLOSE:
WindowManager.bRunFlag = 0;
break;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
//**************************************************************************************//
//**************************************************************************************//
LRESULT CALLBACK WndCallBackProc1(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
WindowManager.bRunFlag = 0;
break;
case VK_UP:
//D3D.Devices[1].eye_tilt_up();
pMap2D->py += (10.0/input_scale);
//wrap around
if (pMap2D->py > 480.0)
pMap2D->py -= 480.0;
break;
case VK_DOWN:
//D3D.Devices[1].eye_tilt_down();
pMap2D->py -= (10.0/input_scale);
//wrap around
if (pMap2D->py < 0.0)
pMap2D->py += 480.0;
break;
case VK_LEFT:
//D3D.Devices[1].eye_tilt_left();
pMap2D->px += (10.0/input_scale);
//wrap around
if (pMap2D->px > 640.0)
pMap2D->px -= 640.0;
break;
case VK_RIGHT:
//D3D.Devices[1].eye_tilt_right();
pMap2D->px -= (10.0/input_scale);
//wrap around
if (pMap2D->px < 0.0)
pMap2D->px += 640.0;
break;
case VK_PRIOR:
if (input_scale < 20.0)
input_scale *= 1.1;
/*if (D3D.Devices[1].bFollow == false)
D3D.Devices[1].eye_forward();
else
D3D.Devices[1].zoom_in(); */
break;
case VK_NEXT:
if (input_scale > 1.0)
input_scale *= 0.9;
/*if (D3D.Devices[1].bFollow == false)
D3D.Devices[1].eye_back();
else
D3D.Devices[1].zoom_out(); */
break;
case VK_NUMPAD8:
D3D.Devices[1].pan_up();
break;
case VK_NUMPAD4:
D3D.Devices[1].pan_left();
break;
case VK_NUMPAD6:
D3D.Devices[1].pan_right();
break;
case VK_NUMPAD2:
D3D.Devices[1].pan_down();
break;
case VK_F1:
//D3D.Devices[1].follow_on();
camera_target = 0;
break;
case VK_F2:
//D3D.Devices[1].follow_off();
camera_target = 1;
break;
}
break;
case WM_CLOSE:
WindowManager.bRunFlag = 0;
break;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
//**************************************************************************************//
//**************************************************************************************//<file_sep>#include <windows.h>
#include <stdio.h>
#include <d3d9.h>
#include <d3dx9.h>
#include "common_classes.h"
//
#define MAX_D3D_DEVICES 10
//defines the size of the history buffer
#define HISTORY_BUFFER_SIZE 200000
#define ORIENTATION_MODE_NONE 0x00
#define ORIENTATION_MODE_LATLONGPR 0x01
#define ORIENTATION_MODE_PITCHROLLYAW 0x02
#define ORIENTATION_MODE_BODYXYZ 0x04
const DWORD vertex_fvf=D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1|D3DFVF_DIFFUSE;
const DWORD vertex_2d=D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1;
//this is a point in the history
class cHistoryPoint
{
public:
double px;
double py;
double pz;
double longitude;
double latitude;
double radius;
bool bValid; //whether this point is current filled with valid data
//default constructor
cHistoryPoint()
{
px = 0; py = 0; pz = 0; longitude = 0; latitude = 0; radius = 0; bValid = false;
}
private:
};
//this is a buffer that stores previous location history of the object in question.
class cHistoryBuffer
{
public:
//for now, save 10,000 points
cHistoryPoint Points[HISTORY_BUFFER_SIZE];
//this is the corresponding "pre" vertex buffer that will hold the vertex data that will actually be
//passed to the renderer. unfortunately this buffer has to be constructed every time, due to the changing
//position offsets.
vertex Vertexes[HISTORY_BUFFER_SIZE];
//this is the actual vertex buffer
IDirect3DVertexBuffer9* VertexBuffer;
//material which will define the line color
D3DMATERIAL9 Material;
//stores whether to draw the history for this buffer right now.
bool bEnable;
//the current "youngest" index (the one to draw first)
int curr_index;
//clear the history buffer
int clear()
{
//go through all points, but don't bother clearing the values,
//just set valid to 0
for (int i = 0; i < HISTORY_BUFFER_SIZE; i++)
Points[i].bValid = false;
//reset current index to 0
curr_index = 0;
return 0;
}
//default constructor
cHistoryBuffer()
{
curr_index = 0; bEnable = false;
}
//get last history point
VECTOR3 get_last_point()
{
int index = curr_index - 1;
//wrap
if (index < 0)
index += HISTORY_BUFFER_SIZE;
//if enabled
if (Points[index].bValid == false)
return VECTOR3(0,0,0);
//else use this
return VECTOR3(Points[index].px, Points[index].py, Points[index].pz);
}
//add a point to the history
int add_point(double px, double py, double pz)
{
//populate current index
Points[curr_index].px = px;
Points[curr_index].py = py;
Points[curr_index].pz = pz;
//enable
Points[curr_index].bValid = true;
//increment pointer
curr_index++;
//wrap if necessary
if (curr_index >= HISTORY_BUFFER_SIZE)
curr_index -= HISTORY_BUFFER_SIZE;
//done.
return 0;
}
private:
};
class cRenderObject
{
public:
char Name[80];
int set_name(char* _Name);
//this is the "pre" vertex buffer if we're 3D
vertex* Vertexes; //note: i'm not sure if this is actually used at the moment.
// vertex buffer if we're 2D
//note that it is a maximum of 4 vertices
vertex2d Vertexes2d[4];
//this is a flag to use fixed scale when rendering this object in 2D
bool bFixedScale2D;
//this is the number of vertices in either buffer
int iNumVertexes;
IDirect3DVertexBuffer9* VertexBuffer;
IDirect3DTexture9* Texture;
D3DMATERIAL9 Material;
int iOrientationMode;
double latitude;
double longitude;
double pr;
double pitch;
double roll;
double yaw;
double px;
double py;
double pz;
//this saves the "absolute" position of the object when it is calculated
VECTOR3 abs_position;
//this is an optional "history buffer" that contains
cHistoryBuffer* pHistoryBuffer;
int init();
int exit();
cRenderObject() { init(); }
cRenderObject* add_child();
cRenderObject* pFirstChild;
cRenderObject* pNextSibling;
private:
};
class cD3D_Device
{
public:
FILE* dfile;
IDirect3DDevice9* Device;
D3DPRESENT_PARAMETERS DeviceParams;
int iDeviceID;
cRenderObject* RenderList;
ID3DXFont *m_font;
ID3DXFont *m_font_large;
ID3DXFont *m_font_small;
D3DXVECTOR3 eye_vector;
D3DXVECTOR3 lookat_vector;
D3DXVECTOR3 up_vector;
bool bViewChanged;
double cam_yaw;
double cam_tilt;
double cam_dist;
D3DXVECTOR3 calc_lookat();
D3DXVECTOR3 calc_eye();
bool bFollow;
D3DLIGHT9 light0;
bool bLight0Changed;
D3DLIGHT9 light1;
int set_lights();
int render_text(double sim_time);
int render_text_2d();
int set_z_planes(double zNear, double zFar);
int render_count_0;
int render_count_1;
int build_globe(cRenderObject* pObject);
int iHeight;
int iWidth;
//this is used to save the original position offsets that the render call was started with
VECTOR3 save_start_offset;
//the "main" render function
int render_object(cRenderObject* object_to_render, MATRIX BaseTransform);
//the "main" render function for a 2D window
int render_object_2d(cRenderObject* object_to_render, MATRIX BaseTransform, double input_scale);
//this renders a history line using the supplied history buffer
int render_history_line(cHistoryBuffer* pHistBuff, VECTOR3 position_offset, MATRIX CurrTransform);
//the 2d version
int render_history_line_2d(cHistoryBuffer* pHistBuff, double x_offset, double y_offset, double input_scale);
MATRIX apply_body_translation(MATRIX input, double px, double py, double pz);
MATRIX apply_body_latlongpr(MATRIX input, double latitude, double longitude, double pr);
MATRIX apply_body_pitchrollyaw(MATRIX input, double pitch, double roll, double yaw);
D3DMATRIX GetD3DMatrix(MATRIX input);
int reverse_normals(cRenderObject* pObj);
int init(int _iDeviceID);
int exit();
int render0(VECTOR3 start_offset, double sim_time);
int render1(VECTOR3 start_offset, double input_scale, double sim_time);
int init_views0();
int init_views1();
int set_views();
//initializes a render object using an array of 3D vertices, and a texture file
int load_with_model(cRenderObject* input_object, vertex* buffer, int _iNumVertexes, WCHAR* TextureFile);
//adds a history buffer to a render object
int add_history_buffer(cRenderObject* input_object, bool initial_enable_status, D3DXCOLOR history_line_color);
//the 2D version
int add_history_buffer_2d(cRenderObject* input_object, bool initial_enable_status, D3DXCOLOR history_line_color);
//initializes a render object as a 2D sprite (a polygon and a texture file)
int load_with_sprite(cRenderObject* input_object, vertex2d* buffer, int _iNumVertexes, WCHAR* TextureFile);
int init_vertex_buffer(cRenderObject* pObject, int _iNumVertexes);
//2d version
int init_vertex_buffer_2d(cRenderObject* pObject, int _iNumVertexes);
//add one for the history
int init_vertex_buffer_for_history(cHistoryBuffer* pHistBuff, int _iNumVertexes);
//2D version
int init_vertex_buffer_for_history_2d(cHistoryBuffer* pHistBuff, int _iNumVertexes);
//2d version
int update_vertex_buffer_2d(cRenderObject* input_object, double x_offset, double y_offset, double input_scale);
//alternate 2d version, assumes that rendered object fills the screen
int update_vertex_buffer_2d_alt(cRenderObject* input_object, double x_offset, double y_offset, double input_scale);
int eye_tilt_up();
int eye_tilt_down();
int eye_tilt_left();
int eye_tilt_right();
int eye_forward();
int eye_back();
int pan_left();
int pan_right();
int pan_up();
int pan_down();
int zoom_in();
int zoom_out();
int follow_on();
int follow_off();
int init_lights0();
int init_lights1();
//initialize a renderstate for 3D viewing
int init_renderstate_3d();
//initialize a renderstate for 2D viewing
int init_renderstate_2d();
//DEBUG
int debug_write();
private:
};
class cD3D
{
public:
IDirect3D9* D3D;
int init();
int exit();
int load_window_3d(int iWindow, HWND _hWindow, int _iWidth, int _iHeight);
int load_window_2d(int iWindow, HWND _hWindow, int _iWidth, int _iHeight);
int render(VECTOR3 start_offset0, VECTOR3 start_offset1, double scale1, double sim_time);
cD3D_Device Devices[MAX_D3D_DEVICES];
private:
};<file_sep>#pragma once
#include <windows.h>
#include <stdio.h>
#include "sm_defines.h"
class cSharedMem
{
public:
_read_int_type read_int;
_read_double_type read_double;
_write_int_type write_int;
_write_double_type write_double;
HMODULE hSharedMem;
cSharedMem();
~cSharedMem();
private:
};<file_sep>//Description: Titan3 simply generates model files which are used by
//the visualizer (Titan2). The files are in Wavefront .obj format,
//and old, common, and simple format. A file is generated for each
//section of the rocket that could potentially move independently.
#include <stdio.h>
#include <math.h>
FILE* outfile;
struct vertex{
float x, y, z;
float nx, ny, nz;
unsigned long colour;
float tu, tv;
};
class vec
{
public:
double x;
double y;
double z;
vec()
{
x = 0;
y = 0;
z = 0;
}
vec(double _x, double _y, double _z)
{
x = _x;
y = _y;
z = _z;
}
vec operator+(vec A)
{
return vec(x+A.x, y+A.y,z+A.z);
}
vec operator-(vec A)
{
return vec(x-A.x, y-A.y,z-A.z);
}
vec operator*(double r)
{
return vec(x*r, y*r, z*r);
}
vec operator|(vec A)
{
return vec(y*A.z - z*A.y, z*A.x - x*A.z, x*A.y - y*A.x);
}
double mag()
{
return sqrt(x*x + y*y + z*z);
}
void normalize()
{
double magnitude = sqrt(x*x + y*y + z*z);
x = x / magnitude;
y = y / magnitude;
z = z / magnitude;
}
private:
};
int divlat;
int divlong;
double inclat;
double inclong;
double scale;
int iNumVertexes;
#define RESOLUTION 40
#define PI 3.14159265358
#define STAGE1_NOZZLE_SCALE 0.8382/93.5 //0.8382 meters per 93.5 pixels
#define ADDITIONAL_SCALE 0.5
vertex stage1_nozzle_vertices_inner[21][RESOLUTION];
vertex stage1_nozzle_vertices_outer[21][RESOLUTION];
vertex stage1_main_vertices[20][RESOLUTION];
vertex stage1_pipes_vertices[5][4][RESOLUTION];
vertex stage1_launch_mount_vertices[3][RESOLUTION];
vertex interstage_vertices_inner[2][RESOLUTION];
vertex interstage_vertices_outer[2][RESOLUTION];
vertex stage2_main_vertices[20][RESOLUTION];
double get_texture_coord_position(double longitude_deg)
{
double long_rad = longitude_deg * (3.14159 / 180.0);
double ratio = long_rad / 6.283135;
//now this maps from 0 to 1, but we actually want to start at 0.5 to 1.5 and wrap around
ratio += 0.5;
//if (ratio > 1.1)
// ratio -= 1;
return ratio;
}
int build_globe()
{
divlat = 60;
divlong = 60;
inclat = 90.0 / divlat;
inclong = 360.0 / divlong;
scale = 1.0;
iNumVertexes = divlat*divlong*8;
vertex* vertices = new vertex[divlat*divlong*8 + 400];
int ct = 0;
double rlat1 = 0;
double rlong1 = 0;
double rlat2 = 0;
double rlong2 = 0;
int r3 = 0;
int r2 = 1;
int r1 = 2;
int r0 = 3;
printf("ct: %d rlat1: %f\n", ct, rlat1);
for (double longitude = 0; longitude < 360; longitude += inclong )
for (double latitude = 0; latitude < 90; latitude += inclat)
{
printf("ct: %d longitude %f latitude %f\n", ct, longitude, latitude);
rlat1 = latitude * (3.14159 / 180.0);
rlat2 = (latitude + inclat) * (3.14159 / 180.0);
rlong1 = longitude * (3.14159 / 180.0);
rlong2 = (longitude + inclong) * (3.14159 / 180.0);
if (rlat1 > 1.5707)
rlat1 = 1.5707;
if (rlat2 > 1.5707)
rlat2 = 1.5707;
//longitude = 0 --> x = 1, y = 0 (prime meridian)
//longitude = 90 deg E --> x = 0, y = 1
vertices[ct+3].x = scale*cos(rlong1)*cos(rlat1);
vertices[ct+3].y = scale*sin(rlong1)*cos(rlat1); //RH to LH?
vertices[ct+3].z = scale*sin(rlat1);
vertices[ct+3].tu = get_texture_coord_position(longitude); //rlong1 / 6.283135;
vertices[ct+3].tv = 1.0 - ((rlat1 / 3.141593) + 0.5);
vertices[ct+2].x = scale*cos(rlong2)*cos(rlat1);
vertices[ct+2].y = scale*sin(rlong2)*cos(rlat1); //RH to LH?
vertices[ct+2].z = scale*sin(rlat1);
vertices[ct+2].tu = get_texture_coord_position(longitude + inclong); //rlong2 / 6.283135;
vertices[ct+2].tv = 1.0 - ((rlat1 / 3.141593) + 0.5);
vertices[ct+1].x = scale*cos(rlong2)*cos(rlat2);
vertices[ct+1].y = scale*sin(rlong2)*cos(rlat2); //RH to LH?
vertices[ct+1].z = scale*sin(rlat2);
vertices[ct+1].tu = get_texture_coord_position(longitude + inclong); // rlong2 / 6.283135;
vertices[ct+1].tv = 1.0 - ((rlat2 / 3.141593) + 0.5);
vertices[ct+0].x = scale*cos(rlong1)*cos(rlat2);
vertices[ct+0].y = scale*sin(rlong1)*cos(rlat2); //RH to LH?
vertices[ct+0].z = scale*sin(rlat2);
vertices[ct+0].tu = get_texture_coord_position(longitude); // //rlong1 / 6.283135;
vertices[ct+0].tv = 1.0 - ((rlat2 / 3.141593) + 0.5);
ct += 4;
vertices[ct+3].x = scale*cos(rlong1)*cos(rlat1);
vertices[ct+3].y = scale*sin(rlong1)*cos(rlat1); //RH to LH?
vertices[ct+3].z = -1*scale*sin(rlat1);
vertices[ct+3].tu = get_texture_coord_position(longitude); // rlong1 / 6.283135;
vertices[ct+3].tv = 1.0 - (((rlat1 / 3.141593)*-1) + 0.5);
vertices[ct+2].x = scale*cos(rlong1)*cos(rlat2);
vertices[ct+2].y = scale*sin(rlong1)*cos(rlat2); //RH to LH?
vertices[ct+2].z = -1*scale*sin(rlat2);
vertices[ct+2].tu = get_texture_coord_position(longitude); //rlong1 / 6.283135;
vertices[ct+2].tv = 1.0 - (((rlat2 / 3.141593)*-1) + 0.5);
vertices[ct+1].x = scale*cos(rlong2)*cos(rlat2);
vertices[ct+1].y = scale*sin(rlong2)*cos(rlat2); //RH to LH?
vertices[ct+1].z = -1*scale*sin(rlat2);
vertices[ct+1].tu = get_texture_coord_position(longitude + inclong); //rlong2 / 6.283135;
vertices[ct+1].tv = 1.0 - (((rlat2 / 3.141593)*-1) + 0.5);
vertices[ct+0].x = scale*cos(rlong2)*cos(rlat1);
vertices[ct+0].y = scale*sin(rlong2)*cos(rlat1); //RH to LH?
vertices[ct+0].z = -1*scale*sin(rlat1);
vertices[ct+0].tu = get_texture_coord_position(longitude + inclong); //rlong2 / 6.283135;
vertices[ct+0].tv = 1.0 - (((rlat1 / 3.141593)*-1) + 0.5);
ct += 4;
}
outfile = fopen("globe.objx", "w");
//write vertexes
for (int lc1 = 0; lc1 < iNumVertexes; lc1++)
{
//to convert RH to LH, try reversing all the x's
vertices[lc1].x *= -1;
fprintf(outfile, "v %f %f %f\n", vertices[lc1].x, vertices[lc1].y, vertices[lc1].z);
}
//write texture coords
for (int lc1 = 0; lc1 < iNumVertexes; lc1++)
{
fprintf(outfile, "vt %f %f\n", vertices[lc1].tu, vertices[lc1].tv);
}
//write faces
for (int lc1 = 0; lc1 < iNumVertexes; lc1+=4)
{
fprintf(outfile, "f %d %d %d %d\n", lc1+1, lc1+2, lc1+3, lc1+4);
}
delete [] vertices;
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int stage1_main_vertex_ring(int index, double xcenter, double ycenter, double zcenter, double radius)
{
double increment = (2*PI) / RESOLUTION;
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
stage1_main_vertices[index][lc1].x = xcenter;
stage1_main_vertices[index][lc1].y = ycenter + radius*sin(increment*lc1);
stage1_main_vertices[index][lc1].z = zcenter + radius*cos(increment*lc1);
stage1_main_vertices[index][lc1].x *= STAGE1_NOZZLE_SCALE;
stage1_main_vertices[index][lc1].y *= STAGE1_NOZZLE_SCALE;
stage1_main_vertices[index][lc1].z *= STAGE1_NOZZLE_SCALE;
stage1_main_vertices[index][lc1].tu = 0;
stage1_main_vertices[index][lc1].tv = 0;
}
return 0;
}
//*********************************************************//
//*********************************************************//
int stage1_nozzle_vertex_ring(int index, double xcenter, double ycenter, double zcenter, double radius)
{
double increment = (2*PI) / RESOLUTION;
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
stage1_nozzle_vertices_inner[index][lc1].x = xcenter;
stage1_nozzle_vertices_inner[index][lc1].y = ycenter + radius*sin(increment*lc1);
stage1_nozzle_vertices_inner[index][lc1].z = zcenter + radius*cos(increment*lc1);
stage1_nozzle_vertices_inner[index][lc1].x *= STAGE1_NOZZLE_SCALE * ADDITIONAL_SCALE;
stage1_nozzle_vertices_inner[index][lc1].y *= STAGE1_NOZZLE_SCALE * ADDITIONAL_SCALE;
stage1_nozzle_vertices_inner[index][lc1].z *= STAGE1_NOZZLE_SCALE * ADDITIONAL_SCALE;
stage1_nozzle_vertices_inner[index][lc1].tu = 0;
stage1_nozzle_vertices_inner[index][lc1].tv = 0;
stage1_nozzle_vertices_outer[index][lc1].x = xcenter;
stage1_nozzle_vertices_outer[index][lc1].y = ycenter + (radius*1.005)*sin(increment*lc1);
stage1_nozzle_vertices_outer[index][lc1].z = zcenter + (radius*1.005)*cos(increment*lc1);
stage1_nozzle_vertices_outer[index][lc1].x *= STAGE1_NOZZLE_SCALE * ADDITIONAL_SCALE;
stage1_nozzle_vertices_outer[index][lc1].y *= STAGE1_NOZZLE_SCALE * ADDITIONAL_SCALE;
stage1_nozzle_vertices_outer[index][lc1].z *= STAGE1_NOZZLE_SCALE * ADDITIONAL_SCALE;
stage1_nozzle_vertices_outer[index][lc1].tu = 0;
stage1_nozzle_vertices_outer[index][lc1].tv = 0;
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_stage1_nozzle_main_vertices()
{
for (int lc1 = 0; lc1 < 21; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", stage1_nozzle_vertices_inner[lc1][lc2].x, stage1_nozzle_vertices_inner[lc1][lc2].y, stage1_nozzle_vertices_inner[lc1][lc2].z);
}
for (int lc1 = 0; lc1 < 21; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", stage1_nozzle_vertices_outer[lc1][lc2].x, stage1_nozzle_vertices_outer[lc1][lc2].y, stage1_nozzle_vertices_outer[lc1][lc2].z);
}
return 20*2*RESOLUTION;
}
//*********************************************************//
//*********************************************************//
int print_stage1_nozzle_main_faces(int start)
{
int i1;
int i2;
int i3;
int i4;
int gap = 21*RESOLUTION;
for (int lc1 = 0; lc1 < 20; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
i1 = lc1*RESOLUTION + lc2;
i2 = lc1*RESOLUTION + lc2 + 1;
i3 = (lc1+1)*RESOLUTION + lc2 + 1;
i4 = (lc1+1)*RESOLUTION + lc2;
if (lc2 == (RESOLUTION-1))
{
i2 -= RESOLUTION;
i3 -= RESOLUTION;
}
fprintf(outfile, "f %d %d %d %d\n", i4+start+1, i3+start+1, i2+start+1, i1+start+1);
fprintf(outfile, "f %d %d %d %d\n", i1+start+1+gap, i2+start+1+gap, i3+start+1+gap, i4+start+1+gap);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int build_stage1_nozzle()
{
stage1_nozzle_vertex_ring(0, 500-500, 0, 0, 0.1);
stage1_nozzle_vertex_ring(1, 500-500, 0, 0, 55);
stage1_nozzle_vertex_ring(2, 432-500, 0, 0, 55);
stage1_nozzle_vertex_ring(3, 420-500, 0, 0, 53);
stage1_nozzle_vertex_ring(4, 409-500, 0, 0, 49);
stage1_nozzle_vertex_ring(5, 401-500, 0, 0, 45);
stage1_nozzle_vertex_ring(6, 393-500, 0, 0, 41);
stage1_nozzle_vertex_ring(7, 385-500, 0, 0, 37);
stage1_nozzle_vertex_ring(8, 379-500, 0, 0, 34);
stage1_nozzle_vertex_ring(9, 372-500, 0, 0, 32);
stage1_nozzle_vertex_ring(10, 365-500, 0, 0, 33);
stage1_nozzle_vertex_ring(11, 356-500, 0, 0, 38);
stage1_nozzle_vertex_ring(12, 348-500, 0, 0, 42);
stage1_nozzle_vertex_ring(13, 337-500, 0, 0, 48);
stage1_nozzle_vertex_ring(14, 317-500, 0, 0, 57);
stage1_nozzle_vertex_ring(15, 300-500, 0, 0, 64);
stage1_nozzle_vertex_ring(16, 276-500, 0, 0, 73);
stage1_nozzle_vertex_ring(17, 249-500, 0, 0, 81);
stage1_nozzle_vertex_ring(18, 218-500, 0, 0, 88);
stage1_nozzle_vertex_ring(19, 190-500, 0, 0, 92);
stage1_nozzle_vertex_ring(20, 175-500, 0, 0, 93);
outfile = fopen("stage1_nozzle.objx", "w");
print_stage1_nozzle_main_vertices();
print_stage1_nozzle_main_faces(0);
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int build_stage2_nozzle()
{
stage1_nozzle_vertex_ring(0, 371-371, 0, 0, 0.1);
stage1_nozzle_vertex_ring(1, 371-371, 0, 0, 274-256);
stage1_nozzle_vertex_ring(2, 333-371, 0, 0, 274-256);
stage1_nozzle_vertex_ring(3, 324-371, 0, 0, 270-256);
stage1_nozzle_vertex_ring(4, 319-371, 0, 0, 267-256);
stage1_nozzle_vertex_ring(5, 313-371, 0, 0, 267-256);
stage1_nozzle_vertex_ring(6, 307-371, 0, 0, 270-256);
stage1_nozzle_vertex_ring(7, 299-371, 0, 0, 276-256);
stage1_nozzle_vertex_ring(8, 288-371, 0, 0, 281-256);
stage1_nozzle_vertex_ring(9, 273-371, 0, 0, 288-256);
stage1_nozzle_vertex_ring(10, 260-371, 0, 0, 293-256);
stage1_nozzle_vertex_ring(11, 247-371, 0, 0, 297-256);
stage1_nozzle_vertex_ring(12, 236-371, 0, 0, 301-256);
stage1_nozzle_vertex_ring(13, 224-371, 0, 0, 304-256);
stage1_nozzle_vertex_ring(14, 212-371, 0, 0, 307-256);
stage1_nozzle_vertex_ring(15, 204-371, 0, 0, 309-256);
stage1_nozzle_vertex_ring(16, 195-371, 0, 0, 311-256);
stage1_nozzle_vertex_ring(17, 187-371, 0, 0, 313-256);
stage1_nozzle_vertex_ring(18, 173-371, 0, 0, 316-256);
stage1_nozzle_vertex_ring(19, 163-371, 0, 0, 318-256);
stage1_nozzle_vertex_ring(20, 162.9-371, 0, 0, 318-256);
outfile = fopen("stage2_nozzle.objx", "w");
print_stage1_nozzle_main_vertices();
print_stage1_nozzle_main_faces(0);
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int stage1_launch_mount_vertex_ring(int index, double xcenter, double ycenter, double zcenter, double radius)
{
double increment = (2*PI) / RESOLUTION;
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
stage1_launch_mount_vertices[index][lc1].x = xcenter;
stage1_launch_mount_vertices[index][lc1].y = ycenter + radius*sin(increment*lc1);
stage1_launch_mount_vertices[index][lc1].z = zcenter + radius*cos(increment*lc1);
stage1_launch_mount_vertices[index][lc1].x *= STAGE1_NOZZLE_SCALE;
stage1_launch_mount_vertices[index][lc1].y *= STAGE1_NOZZLE_SCALE;
stage1_launch_mount_vertices[index][lc1].z *= STAGE1_NOZZLE_SCALE;
stage1_launch_mount_vertices[index][lc1].tu = 0;
stage1_launch_mount_vertices[index][lc1].tv = 0;
}
return 0;
}
//*********************************************************//
//*********************************************************//
int fill_stage1_pipe_vertices(int index, double xstart, double ystart, double zstart, double xend, double yend, double zend, double radius)
{
vec start(xstart,ystart,zstart);
vec end(xend, yend, zend);
vec dir(xend -xstart, yend-ystart,zend -zstart);
dir.normalize();
//make a vector perpendicular to the direction vector.
//this turns out to be surprisingly easy.
vec vx(0, -dir.z, dir.y);
//there is one corner case, if the y and z directions are 0
//you would get (0,0,0) as the perpendicular vector.
//however, in that case the correct vector is easy to pick out
if (vx.mag() == 0)
vx = vec(0,1,0);
//create another vector perpendicular to the first two
vec vy = dir | vx;
double inc = (2*PI) / RESOLUTION;
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
vec vrt(0, 0, 0);
vrt = vx*sin(inc*lc1) + vy*cos(inc*lc1);
vrt = vrt*radius*0.01;
stage1_pipes_vertices[index][0][lc1].x = xstart + vrt.x;
stage1_pipes_vertices[index][0][lc1].y = ystart + vrt.y;
stage1_pipes_vertices[index][0][lc1].z = zstart + vrt.z;
stage1_pipes_vertices[index][0][lc1].x *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][0][lc1].y *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][0][lc1].z *= STAGE1_NOZZLE_SCALE;
}
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
vec vrt(0,0,0);
vrt = vx*sin(inc*lc1) + vy*cos(inc*lc1);
vrt = vrt*radius;
stage1_pipes_vertices[index][1][lc1].x = xstart + vrt.x;
stage1_pipes_vertices[index][1][lc1].y = ystart + vrt.y;
stage1_pipes_vertices[index][1][lc1].z = zstart + vrt.z;
stage1_pipes_vertices[index][1][lc1].x *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][1][lc1].y *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][1][lc1].z *= STAGE1_NOZZLE_SCALE;
}
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
vec vrt(0,0,0);
vrt = vx*sin(inc*lc1) + vy*cos(inc*lc1);
vrt = vrt*radius;
stage1_pipes_vertices[index][2][lc1].x = xend + vrt.x;
stage1_pipes_vertices[index][2][lc1].y = yend + vrt.y;
stage1_pipes_vertices[index][2][lc1].z = zend + vrt.z;
stage1_pipes_vertices[index][2][lc1].x *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][2][lc1].y *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][2][lc1].z *= STAGE1_NOZZLE_SCALE;
}
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
vec vrt(0,0,0);
vrt = vx*sin(inc*lc1) + vy*cos(inc*lc1);
vrt = vrt*radius*0.01;
stage1_pipes_vertices[index][3][lc1].x = xend + vrt.x;
stage1_pipes_vertices[index][3][lc1].y = yend + vrt.y;
stage1_pipes_vertices[index][3][lc1].z = zend + vrt.z;
stage1_pipes_vertices[index][3][lc1].x *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][3][lc1].y *= STAGE1_NOZZLE_SCALE;
stage1_pipes_vertices[index][3][lc1].z *= STAGE1_NOZZLE_SCALE;
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_stage1_main_vertices()
{
for (int lc1 = 0; lc1 < 20; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", stage1_main_vertices[lc1][lc2].x, stage1_main_vertices[lc1][lc2].y, stage1_main_vertices[lc1][lc2].z);
}
return 20*2*RESOLUTION;
}
//*********************************************************//
//*********************************************************//
int print_stage1_launch_mount_vertices()
{
for (int lc1 = 0; lc1 < 3; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", stage1_launch_mount_vertices[lc1][lc2].x, stage1_launch_mount_vertices[lc1][lc2].y, stage1_launch_mount_vertices[lc1][lc2].z);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_stage1_pipes_vertices()
{
for (int lc0 = 0; lc0 < 5; lc0++)
for (int lc1 = 0; lc1 < 4; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", stage1_pipes_vertices[lc0][lc1][lc2].x,stage1_pipes_vertices[lc0][lc1][lc2].y, stage1_pipes_vertices[lc0][lc1][lc2].z);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_stage1_pipes_faces(int start)
{
int i1;
int i2;
int i3;
int i4;
for (int lc0 = 0; lc0 < 5; lc0++)
for (int lc1 = 0; lc1 < 3; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
i1 = lc1*RESOLUTION + lc2;
i2 = lc1*RESOLUTION + lc2 + 1;
i3 = (lc1+1)*RESOLUTION + lc2 + 1;
i4 = (lc1+1)*RESOLUTION + lc2;
i1 += lc0 * 4 * RESOLUTION;
i2 += lc0 * 4 * RESOLUTION;
i3 += lc0 * 4 * RESOLUTION;
i4 += lc0 * 4 * RESOLUTION;
if (lc2 == (RESOLUTION-1))
{
i2 -= RESOLUTION;
i3 -= RESOLUTION;
}
fprintf(outfile, "f %d %d %d %d\n", i1+start+1, i2+start+1, i3+start+1, i4+start+1);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_stage1_main_faces(int start)
{
int i1;
int i2;
int i3;
int i4;
for (int lc1 = 0; lc1 < 19; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
i1 = lc1*RESOLUTION + lc2;
i2 = lc1*RESOLUTION + lc2 + 1;
i3 = (lc1+1)*RESOLUTION + lc2 + 1;
i4 = (lc1+1)*RESOLUTION + lc2;
if (lc2 == (RESOLUTION-1))
{
i2 -= RESOLUTION;
i3 -= RESOLUTION;
}
fprintf(outfile, "f %d %d %d %d\n", i4+start+1, i3+start+1, i2+start+1, i1+start+1);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_stage1_launch_mount_faces(int start)
{
int i1;
int i2;
int i3;
int i4;
for (int lc1 = 0; lc1 < 2; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
i1 = lc1*RESOLUTION + lc2;
i2 = lc1*RESOLUTION + lc2 + 1;
i3 = (lc1+1)*RESOLUTION + lc2 + 1;
i4 = (lc1+1)*RESOLUTION + lc2;
if (lc2 == (RESOLUTION-1))
{
i2 -= RESOLUTION;
i3 -= RESOLUTION;
}
fprintf(outfile, "f %d %d %d %d\n", i4+start+1, i3+start+1, i2+start+1, i1+start+1);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int build_stage1_main()
{
stage1_main_vertex_ring(0,1332-972,0,0,188-187.9);
stage1_main_vertex_ring(1,1329-972,0,0,210-187.9);
stage1_main_vertex_ring(2,1327-972,0,0,226-187.9);
stage1_main_vertex_ring(3,1324-972,0,0,236-187.9);
stage1_main_vertex_ring(4,1321-972,0,0,246-187.9);
stage1_main_vertex_ring(5,1316-972,0,0,255-187.9);
stage1_main_vertex_ring(6,1312-972,0,0,262-187.9);
stage1_main_vertex_ring(7,1307-972,0,0,269-187.9);
stage1_main_vertex_ring(8,1300-972,0,0,275-187.9);
stage1_main_vertex_ring(9,1288-972,0,0,279-187.9);
stage1_main_vertex_ring(10,1280-972,0,0,280-187.9);
stage1_main_vertex_ring(11,243-972,0,0,280-187.9);
stage1_main_vertex_ring(12,229-972,0,0,272-187.9);
stage1_main_vertex_ring(13,220-972,0,0,259-187.9);
stage1_main_vertex_ring(14,209-972,0,0,230-187.9);
stage1_main_vertex_ring(15,205-972,0,0,206-187.9);
stage1_main_vertex_ring(16,200-972,0,0,199-187.9);
stage1_main_vertex_ring(17,195-972,0,0,194-187.9);
stage1_main_vertex_ring(18,187-972,0,0,194-187.9);
stage1_main_vertex_ring(19,187-972,0,0,188-187.9);
fill_stage1_pipe_vertices(0, 203-972, 272-187.9, 0.0, 118-972, 0, 0, 5.0);
fill_stage1_pipe_vertices(1, 203-972, -(272-187.9), 0.0, 118-972, 0, 0, 5.0);
fill_stage1_pipe_vertices(2, 203-972, 0.0, 272-187.9, 118-972, 0, 0, 5.0);
fill_stage1_pipe_vertices(3, 203-972, 0.0, -(272-187.9), 118-972, 0, 0, 5.0);
fill_stage1_pipe_vertices(4, 203-972, 0.0, 0.0, 118-972, 0, 0, 5.0);
stage1_launch_mount_vertex_ring(0,254-972,0,0,280-187.9);
stage1_launch_mount_vertex_ring(1,209-972,0,0,280-187.9);
stage1_launch_mount_vertex_ring(2,209-972,0,0,220-187.9);
outfile = fopen("stage1_main.objx", "w");
print_stage1_main_vertices();
print_stage1_pipes_vertices();
print_stage1_launch_mount_vertices();
print_stage1_main_faces(0);
print_stage1_pipes_faces(20*RESOLUTION);
print_stage1_launch_mount_faces(20*RESOLUTION + 4*5*RESOLUTION);
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int build_stage2_main()
{
stage1_main_vertex_ring(0,751-751,0,0,256-255.9);
stage1_main_vertex_ring(1,751-751,0,0,312-255.9);
stage1_main_vertex_ring(2,719-751,0,0,336-255.9);
stage1_main_vertex_ring(3,712-751,0,0,336-255.9);
stage1_main_vertex_ring(4,704-751,0,0,340-255.9);
stage1_main_vertex_ring(5,686-751,0,0,344-255.9);
stage1_main_vertex_ring(6,668-751,0,0,348-255.9);
stage1_main_vertex_ring(7,667-751,0,0,349-255.9);
stage1_main_vertex_ring(8,665-751,0,0,349-255.9);
stage1_main_vertex_ring(9,664-751,0,0,349-255.9);
stage1_main_vertex_ring(10,663-751,0,0,349-255.9);
stage1_main_vertex_ring(11,662-751,0,0,349-255.9);
stage1_main_vertex_ring(12,661-751,0,0,349-255.9);
stage1_main_vertex_ring(13,660-751,0,0,349-255.9);
stage1_main_vertex_ring(14,659-751,0,0,349-255.9);
stage1_main_vertex_ring(15,658-751,0,0,349-255.9);
stage1_main_vertex_ring(16,657-751,0,0,349-255.9);
stage1_main_vertex_ring(17,656-751,0,0,349-255.9);
stage1_main_vertex_ring(18,420-751,0,0,349-255.9);
stage1_main_vertex_ring(19,420-751,0,0,256-255.9);
outfile = fopen("stage2_main.objx", "w");
print_stage1_main_vertices();
print_stage1_main_faces(0);
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int build_payload()
{
stage1_main_vertex_ring(0,1096-890,0,0,256-255.9);
stage1_main_vertex_ring(1,1095-890,0,0,262-255.9);
stage1_main_vertex_ring(2,1093-890,0,0,267-255.9);
stage1_main_vertex_ring(3,1088-890,0,0,271-255.9);
stage1_main_vertex_ring(4,1081-890,0,0,274-255.9);
stage1_main_vertex_ring(5,1073-890,0,0,277-255.9);
stage1_main_vertex_ring(6,1065-890,0,0,281-255.9);
stage1_main_vertex_ring(7,1055-890,0,0,285-255.9);
stage1_main_vertex_ring(8,1043-890,0,0,290-255.9);
stage1_main_vertex_ring(9,1034-890,0,0,295-255.9);
stage1_main_vertex_ring(10,1022-890,0,0,300-255.9);
stage1_main_vertex_ring(11,1010-890,0,0,305-255.9);
stage1_main_vertex_ring(12,995-890,0,0,311-255.9);
stage1_main_vertex_ring(13,974-890,0,0,320-255.9);
stage1_main_vertex_ring(14,934-890,0,0,330-255.9);
stage1_main_vertex_ring(15,891-890,0,0,338-255.9);
stage1_main_vertex_ring(16,890-890,0,0,338-255.9);
stage1_main_vertex_ring(17,889-890,0,0,338-255.9);
stage1_main_vertex_ring(18,719-890,0,0,339-255.9);
stage1_main_vertex_ring(19,718-890,0,0,256-255.9);
outfile = fopen("payload.objx", "w");
print_stage1_main_vertices();
print_stage1_main_faces(0);
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int interstage_vertex_ring(int index, double xcenter, double ycenter, double zcenter, double radius)
{
double increment = (2*PI) / RESOLUTION;
for (int lc1 = 0; lc1 < RESOLUTION; lc1++)
{
interstage_vertices_inner[index][lc1].x = xcenter;
interstage_vertices_inner[index][lc1].y = ycenter + radius*sin(increment*lc1);
interstage_vertices_inner[index][lc1].z = zcenter + radius*cos(increment*lc1);
interstage_vertices_inner[index][lc1].x *= STAGE1_NOZZLE_SCALE;
interstage_vertices_inner[index][lc1].y *= STAGE1_NOZZLE_SCALE;
interstage_vertices_inner[index][lc1].z *= STAGE1_NOZZLE_SCALE;
interstage_vertices_inner[index][lc1].tu = 0;
interstage_vertices_inner[index][lc1].tv = 0;
interstage_vertices_outer[index][lc1].x = xcenter;
interstage_vertices_outer[index][lc1].y = ycenter + (radius*1.01)*sin(increment*lc1);
interstage_vertices_outer[index][lc1].z = zcenter + (radius*1.01)*cos(increment*lc1);
interstage_vertices_outer[index][lc1].x *= STAGE1_NOZZLE_SCALE;
interstage_vertices_outer[index][lc1].y *= STAGE1_NOZZLE_SCALE;
interstage_vertices_outer[index][lc1].z *= STAGE1_NOZZLE_SCALE;
interstage_vertices_outer[index][lc1].tu = 0;
interstage_vertices_outer[index][lc1].tv = 0;
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_interstage_vertices()
{
for (int lc1 = 0; lc1 < 2; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", interstage_vertices_inner[lc1][lc2].x, interstage_vertices_inner[lc1][lc2].y, interstage_vertices_inner[lc1][lc2].z);
}
for (int lc1 = 0; lc1 < 2; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
fprintf(outfile, "v %f %f %f\n", interstage_vertices_outer[lc1][lc2].x, interstage_vertices_outer[lc1][lc2].y, interstage_vertices_outer[lc1][lc2].z);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int print_interstage_faces(int start)
{
int gap = 2*RESOLUTION;
int i1;
int i2;
int i3;
int i4;
for (int lc1 = 0; lc1 < 1; lc1++)
for (int lc2 = 0; lc2 < RESOLUTION; lc2++)
{
i1 = lc1*RESOLUTION + lc2;
i2 = lc1*RESOLUTION + lc2 + 1;
i3 = (lc1+1)*RESOLUTION + lc2 + 1;
i4 = (lc1+1)*RESOLUTION + lc2;
if (lc2 == (RESOLUTION-1))
{
i2 -= RESOLUTION;
i3 -= RESOLUTION;
}
fprintf(outfile, "f %d %d %d %d\n", i4+start+1, i3+start+1, i2+start+1, i1+start+1);
fprintf(outfile, "f %d %d %d %d\n", i1+gap+start+1, i2+start+gap+1, i3+start+gap+1, i4+start+gap+1);
}
return 0;
}
//*********************************************************//
//*********************************************************//
int build_interstage()
{
interstage_vertex_ring(0,0,0,0, 280-187.9 + 2);
interstage_vertex_ring(1,345,0,0, 280-187.9 + 2);
outfile = fopen("interstage.objx", "w");
print_interstage_vertices();
print_interstage_faces(0);
fclose(outfile);
return 0;
}
//*********************************************************//
//*********************************************************//
int main()
{
build_interstage();
build_stage1_nozzle();
build_stage1_main();
build_stage2_nozzle();
build_stage2_main();
build_globe();
build_payload();
return 0;
}<file_sep>#include "cForceModel.h"
//*****************************************//
//*****************************************//
cDerivative cForceModel::get_derivatives(cState state)
{
cDerivative ret;
cForceMoment total(0,0,0,0,0,0);
cThrustEffect thrust_effect(0,0,0,0);
//get thrust force and moment
total.fx = pSharedMem->read_double(THRUST_FX);
total.fy = pSharedMem->read_double(THRUST_FY);
total.fz = pSharedMem->read_double(THRUST_FZ);
total.mx = pSharedMem->read_double(THRUST_MX);
total.my = pSharedMem->read_double(THRUST_MY);
total.mz = pSharedMem->read_double(THRUST_MZ);
//get aerodynamic force and moment
total.fx += pSharedMem->read_double(AERODYN_FX);
total.fy += pSharedMem->read_double(AERODYN_FY);
total.fz += pSharedMem->read_double(AERODYN_FZ);
total.mx += pSharedMem->read_double(AERODYN_MX);
total.my += pSharedMem->read_double(AERODYN_MY);
total.mz += pSharedMem->read_double(AERODYN_MZ);
//get effect of thrust on mass properties
thrust_effect.dMass = pSharedMem->read_double(THRUST_EFFECT_DMASS);
thrust_effect.dIxx = pSharedMem->read_double(THRUST_EFFECT_DIXX);
thrust_effect.dIyy = pSharedMem->read_double(THRUST_EFFECT_DIYY);
thrust_effect.dIzz = pSharedMem->read_double(THRUST_EFFECT_DIZZ);
//now add the effect of ground reaction
total = total + get_ground_reaction_force(state);
//now add the effect of gravity
total = total + get_gravity_force(state);
//add centrifugal force
total = total + get_centrifugal_force(state);
//add coriolis force
total = total + get_coriolis_force(state);
ret.ax = total.fx / state.mass;
ret.ay = total.fy / state.mass;
ret.az = total.fz / state.mass;
//
ret.alx = (total.mx - (state.Izz - state.Iyy)*state.wy*state.wz) / state.Ixx;
ret.aly = (total.my - (state.Ixx - state.Izz)*state.wx*state.wz) / state.Iyy;
ret.alz = (total.mz - (state.Iyy - state.Ixx)*state.wx*state.wy) / state.Izz;
ret.wx = state.wx;
ret.wy = state.wy;
ret.wz = state.wz;
ret.vx = state.vx;
ret.vy = state.vy;
ret.vz = state.vz;
ret.dmass = 0 + thrust_effect.dMass;
ret.dIxx = 0 + thrust_effect.dIxx;
ret.dIyy = 0 + thrust_effect.dIyy;
ret.dIzz = 0 + thrust_effect.dIzz;
ret.dIxy = 0;
ret.dIxz = 0;
ret.dIyz = 0;
return ret;
}
//*****************************************//
//*****************************************//
cForceMoment cForceModel::get_gravity_force(cState state)
{
//get unit vector repreenting the direction
cVec dir(state.x, state.y, state.z);
//normalize and invert
dir.normalize();
dir.invert();
//now get the magnitude
//F_g = G*m_1*m_2/r^2
double force = ((6.67e-11)*state.mass*5.97e24);
if (dir.mag() != 0)
force = force / (state.x*state.x + state.y*state.y + state.z*state.z);
else
force = 0;
dir.scale(force);
cForceMoment ret;
ret.fx = dir.x;
ret.fy = dir.y;
ret.fz = dir.z;
ret.mx = 0;
ret.my = 0;
ret.mz = 0;
return ret;
}
//*****************************************//
//*****************************************//
cForceMoment cForceModel::get_centrifugal_force(cState state)
{
//get the angular velocity of the Earth's rotation
double w_earth = (2.0*cPI)/86400.0; //2 pi radians in 86400.0 seconds
//make this into a vector
cVec omega(0, 0, w_earth);
//create a vector that is the position vector
cVec r(state.x, state.y, state.z);
//get the first cross product
cVec omega_cross_r = omega.cross(r);
//get the second cross product
cVec ococr = omega.cross(omega_cross_r);
//now scale by the negative of the mass
cVec f_cen = ococr.scale(-state.mass);
//return the result
return cForceMoment(f_cen.x, f_cen.y, f_cen.z, 0, 0, 0);
}
//*****************************************//
//*****************************************//
cForceMoment cForceModel::get_coriolis_force(cState state)
{
//get the angular velocity of the Earth's rotation
double w_earth = (2.0*cPI)/86400.0; //2 pi radians in 86400.0 seconds
//make this into a vector
cVec omega(0, 0, w_earth);
//get the velocity as a vector
cVec v(state.vx, state.vy, state.vz);
//get the cross product
cVec omega_cross_v = omega.cross(v);
//scale by inverse of twice the mass
cVec f_cor = omega_cross_v.scale(state.mass * -2.0);
//return the result
return cForceMoment(f_cor.x, f_cor.y, f_cor.z, 0, 0, 0);
}
//*****************************************//
//*****************************************//
cForceMoment cForceModel::get_ground_reaction_force(cState state)
{
cForceMoment ret(0,0,0,0,0,0);
//get a vector representing the direction of the ground force
cVec dir(state.x, state.y, state.z);
dir.normalize();
//get the radius
double rad = sqrt(state.x*state.x + state.y*state.y + state.z*state.z);
//for now, the altitude, is relative to simply the mean radius of the earth
double alt = rad - (6378100.0);
if (alt >= 0)
{
ret.fx = 0;
ret.fy = 0;
ret.fz = 0;
ret.mx = 0;
ret.my = 0;
ret.mz = 0;
return ret;
}
//proportional (position) (elastic) component
double prop_cmp = -0.0001 * alt * state.mass; //there's no point in having it bounce
ret.fx = dir.x * prop_cmp;
ret.fy = dir.y * prop_cmp;
ret.fz = dir.z * prop_cmp;
//velocity (inelastic) component
cVec v(state.vx, state.vy, state.vz);
double vel_cmp = fabs(v.component_along(dir)) * state.mass*10;
ret.fx += dir.x * vel_cmp;
ret.fy += dir.y * vel_cmp;
ret.fz += dir.z * vel_cmp;
ret.mx = 0;
ret.my = 0;
ret.mz = 0;
//get ground friction force:
//start by getting z-component of velocity
cVec v_vert = v.component_along_v(dir);
//now remove that to get the purely ground component
cVec v_gnd = v - v_vert;
//now apply a constant (for now use the mass) in the opposite direction of the velocity
cVec f_friction = v_gnd * -state.mass;
//add that to the reaction force
ret.fx += f_friction.x;
ret.fy += f_friction.y;
ret.fz += f_friction.z;
return ret;
}
//*****************************************//
//*****************************************//<file_sep>//this project implements a Data Recording function for the simulation.
//It is implemented separately from the core simulation so that it could theoretically
//be hosted on another system, away from the recording itself.
#include <stdio.h>
#include <Windows.h>
#include "../common/sm_defines.h"
#include "../common/common_defines.h"
#include "../common/inc/TitanSM.h"
//this is the amount of data storage
#define DATA_STORAGE_FRAMES 1000000
//this is the number of objects we are tracking
#define NUM_OBJECTS 2
//definitions of recorder modes
#define RECORDER_MODE_INACTIVE 0
#define RECORDER_MODE_RECORDING 1
//this structure encapsulates the data stored in one cycle ("frame") of data recording.
class cRecordFrame
{
public:
//job number
int iJobNumber;
//time in seconds
double fTime;
//x coordinates in meters, ECEF
double fX_ECEF;
//y coordinates in meters, ECEF
double fY_ECEF;
//z coordinates in meters, ECEF
double fZ_ECEF;
//longitude
double fLongitude;
//latitude
double fLatitude;
//R (meters)
double fR;
//handy function to clear everything
int clear() { iJobNumber = -1; fTime = 0; return 0; }
private:
};
//class is the self-contained implementation of the data recorder.
class cDataRecorder
{
public:
//init function (this is a separate function just in case
//we ever need to init a second time).
int init();
//exit function (separate function just in case).
int exit();
//constructor (just calls init())
cDataRecorder() { init(); }
//destructor (just calls exit())
~cDataRecorder() { exit(); }
//this function is a way for the calling function
//to give the recorder a chance to capture data
int capture_data();
//start a recording.
int record_begin();
//stop a recording.
int record_end();
//set the recording interval
int set_recording_interval(double seconds_per_frame);
//export to external ephemeris
int export_external_ephemeris(int iObjNumber, const char* filename);
private:
//sub-function to record data during mission phase 0
int capture_data_phase0();
//sub-function to record data during mission phase 1
int capture_data_phase1();
//the current recorder mode
int iRecorderMode;
//this is the current data recording interval.
double fRecordInterval;
//the last time at which we recorded anything
double fLastRecordTime;
//this is the index of the next buffer slot that will be written.
int iCurrEntry;
//this is the current "job number" that the recorder is working on.
int iJobNumber;
//this is the underlying data storage.
//for initial simplicity, this is just a static array that functions as a circular buffer.
cRecordFrame DataBuffer[NUM_OBJECTS][DATA_STORAGE_FRAMES];
};<file_sep>//Description: Titan2 is the visualizer component.
//It reads in the state vector from the integrator
//and displays it both in a 2D plot, and 3D display.
#define SHIP_SCALE 0.1
#define DEG_TO_RAD (3.14159/180.0)
#define RAD_TO_DEG (180.0/3.14159)
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <stdio.h>
#include "cWindowManager.h"
#include "cD3D.h"
#include "cModelLoader.h"
#include "common_classes.h"
#include "sm_defines.h"
HMODULE hSharedMem;
typedef int (__cdecl *_read_int_type) (int addr);
typedef double (__cdecl *_read_double_type) (int addr);
typedef char (__cdecl *_read8_type) (int addr);
typedef int (__cdecl *_write_int_type) (int addr, int value);
typedef int (__cdecl *_write_double_type) (int addr, double value);
_read_int_type read_int;
_read_double_type read_double;
_read8_type read8;
_write_int_type write_int;
_write_double_type write_double;
cModelLoader Loader;
cWindowManager WindowManager;
cD3D D3D;
int camera_target = 0;
int component_setup = 0;<file_sep>#include "cSharedMem.h"
//*****************************************************************//
//*****************************************************************//
cSharedMem::cSharedMem()
{
hSharedMem = NULL;
hSharedMem = LoadLibraryA("Titan4DLL.dll");
printf("hSharedMem: %x.\n", hSharedMem);
if (hSharedMem == NULL)
{
printf("Allocation failure.\n");
return;
}
read_int = (_read_int_type)GetProcAddress(hSharedMem, "_read_int");
write_int = (_write_int_type)GetProcAddress(hSharedMem, "_write_int");
read_double = (_read_double_type)GetProcAddress(hSharedMem, "_read_double");
write_double = (_write_double_type)GetProcAddress(hSharedMem, "_write_double");
//DEBUG
printf("read_int: %x\n", read_int);
}
//*****************************************************************//
//*****************************************************************//
cSharedMem::~cSharedMem()
{
FreeLibrary(hSharedMem);
}
//*****************************************************************//
//*****************************************************************//
<file_sep>#include "cAerodynamicsModel.h"
//*****************************************************************//
//*****************************************************************//
//this function returns a vector
cForceMoment cAerodynamicsModel::get_aerodyn_phase0(cState state)
{
//assemble the quantities needed to produce the lift and drag forces:
//velocity
double v = state.get_v();
//for now, just assume that the reference area is pi*r^2 (r = 0.85m)
double ref_area = cPI * 0.85 * 0.85;
//retrieve the air density from the variable
double rho = pSharedMem->read_double(PHASE0_AIR_DENSITY);
//retrieve other aerodynamic quantities
double static_temp = pSharedMem->read_double(PHASE0_STATIC_AIR_TEMPERATURE);
double static_pressure = pSharedMem->read_double(PHASE0_STATIC_PRESSURE);
//compute the mach number
double mach_number = compute_mach_number(rho, static_temp, static_pressure, v);
//compute the angle fo attack
double angle_of_attack = compute_angle_of_attack(state);
//retrieve the drag coefficient
double CD = get_CD_phase0(mach_number, angle_of_attack);
//calculate the drag value
double drag = 0.5*rho*ref_area*v*v*CD;
//this vector is in the direction of the velocity.
cVec vel_vect(state.vx, state.vy, state.vz);
//get a normalized vector
cVec e_v = vel_vect.get_normalized();
//scale this by the negative drag (since it's operating negative to the velocity vector)
cVec v_drag = e_v.scale(-drag);
//retrieve the lift coefficient
double CL = get_CL_phase0(mach_number, angle_of_attack);
//calculate the magnitude of the lift
double lift = 0.5*rho*ref_area*v*v*CL;
//the lift acts in the direction that is the difference between the velocity vector and the heading vector.
//re-obtain the normalized velocity vector
e_v = vel_vect.get_normalized();
//intermediate: obtain the flight path angle (angle between current flight path and vertical)
cVec e_up = state.convert_orientation_ENU_to_ECEF(cVec(0,0,1)).get_normalized();
//get the dot product between the two unit vectors
double dot_product = e_v.dot(e_up);
//limit to prevent overflow
if (dot_product > 1.0)
dot_product = 1.0;
if (dot_product < -1.0)
dot_product = -1.0;
//now get the angle
double flight_path_angle = acos(dot_product);
//now invert the angle so that straight up is 90 degrees
flight_path_angle = (flight_path_angle * -1) + (cPI/2.0);
//upload to SM
pSharedMem->write_double(PHASE0_FLIGHT_PATH_ANGLE, flight_path_angle);
//obtain a heading vector:
//first get the heading vector in the EAST-NORTH-UP reference
cVec hdg_enu = state.att.rotate_vector(cVec(1,0,0)).get_normalized();
//now convert it to ECEF
cVec e_hdg = state.convert_orientation_ENU_to_ECEF(hdg_enu).get_normalized();
//now subtract one from the other and scale by the lift value:
//note that if the two vectors are exactly equal, then the lift value
//that comes out will be 0, due to the way get_normalized() works.
//This happens to be exactly what we want,
//although for a subtly different reason: a symmetrical rocket should have 0 lift at
//when flying straight ahead.
//the rationale for the subtraction order is this:
//the lift vector is in the direction going from velocity vector to the heading vector
//(i.e. for an aircraft, positive angle of attack (orientation vector above velocity vector)
//leads to upward lift)
cVec v_lift = ( e_hdg - e_v ).get_normalized().scale(lift);
//combine forces from lift and drag
cVec f_aero = v_lift + v_drag;
//return what we got. note that moments are 0 at the moment.
return cForceMoment(f_aero.x, f_aero.y, f_aero.z, 0, 0, 0);
}
//*****************************************************************//
//*****************************************************************//
cForceMoment cAerodynamicsModel::get_aerodyn_phase1_stage2(cState state)
{
//for now, we don't have any reliable data on what
//the aerodynamic forces on the 2nd stage might look like,
//so return 0 here for now.
cForceMoment ret(0,0,0,0,0,0);
//compute the angle fo attack
double angle_of_attack = compute_angle_of_attack(state);
double aoa_deg = angle_of_attack * RAD_TO_DEG;
//output to shared memory. don't know where to put this for now.
pSharedMem->write_double(PHASE1_STAGE2_ANGLE_OF_ATTACK, aoa_deg);
//this vector is in the direction of the velocity.
cVec vel_vect(state.vx, state.vy, state.vz);
//get a normalized vector
cVec e_v = vel_vect.get_normalized();
//intermediate: obtain the flight path angle (angle between current flight path and vertical)
cVec e_up = state.convert_orientation_ENU_to_ECEF(cVec(0,0,1)).get_normalized();
//get the dot product between the two unit vectors
double dot_product = e_v.dot(e_up);
//limit to prevent overflow
if (dot_product > 1.0)
dot_product = 1.0;
if (dot_product < -1.0)
dot_product = -1.0;
//now get the angle
double flight_path_angle = acos(dot_product);
//now invert the angle so that straight up is 90 degrees
flight_path_angle = (flight_path_angle * -1) + (cPI/2.0);
//upload to SM
pSharedMem->write_double(PHASE1_STAGE2_FLIGHT_PATH_ANGLE, flight_path_angle);
return ret;
}
//*****************************************************************//
//*****************************************************************//
cForceMoment cAerodynamicsModel::get_aerodyn_phase1_stage1(cState state)
{
//for now, we don't have any reliable data for this, so, return 0
cForceMoment ret(0,0,0,0,0,0);
//compute the angle fo attack
double angle_of_attack = compute_angle_of_attack(state);
double aoa_deg = angle_of_attack * RAD_TO_DEG;
//output to shared memory. don't know where to put this for now.
pSharedMem->write_double(PHASE1_STAGE1_ANGLE_OF_ATTACK, aoa_deg);
return ret;
}
//*****************************************************************//
//*****************************************************************//
cForceMoment cAerodynamicsModel::get_aerodyn_phase1_interstage(cState state)
{
//for now, we don't have any reliable data for this, so, return 0
cForceMoment ret(0,0,0,0,0,0);
//compute the angle fo attack
double angle_of_attack = compute_angle_of_attack(state);
double aoa_deg = angle_of_attack * RAD_TO_DEG;
//output to shared memory. don't know where to put this for now.
pSharedMem->write_double(PHASE1_INTERSTAGE_ANGLE_OF_ATTACK, aoa_deg);
return ret;
}
//*****************************************************************//
//*****************************************************************//
//this function retrieves the aerodynamic coefficient based on the state
double cAerodynamicsModel::get_CD_phase0(double mach_number, double angle_of_attack)
{
//get angle of attack in degrees
double aoa_deg = angle_of_attack * RAD_TO_DEG;
//interpolate cd0 and cdaoa from the table
double cd0 = get_interp(mach_number, cd0_table);
double cdaoa = get_interp(mach_number, cdaoa_deg_table);
double cd = cd0 + aoa_deg * cdaoa;
//output this to shared memory here, for lack of any idea where to put it
pSharedMem->write_double(PHASE0_CD, cd);
pSharedMem->write_double(PHASE0_CD0, cd0);
pSharedMem->write_double(PHASE0_ANGLE_OF_ATTACK, aoa_deg);
//return what we got
return cd;
}
//*****************************************************************//
//*****************************************************************//
//this function retrieves the aerodynamic coefficient based on the state
double cAerodynamicsModel::get_CL_phase0(double mach_number, double angle_of_attack)
{
//because we don't have reliable lift numbers for a finless rocket,
//we return 0, for now.
return 0.0;
}
//*****************************************************************//
//*****************************************************************//
//utility function to compute angle of attack based on state.
double cAerodynamicsModel::compute_angle_of_attack(cState state)
{
//obtain a normalized velocity vector
cVec e_v = cVec(state.vx, state.vy, state.vz).get_normalized();
//obtain a heading vector:
//first get the heading vector in the EAST-NORTH-UP reference
cVec hdg_enu = state.att.rotate_vector(cVec(1,0,0)).get_normalized();
//now convert it to ECEF
cVec e_hdg = state.convert_orientation_ENU_to_ECEF(hdg_enu).get_normalized();
//now use the dot production relation
// a dot b = |a||b| cos(theta) to get the angle between them.
//because both are already unit vectors there is no need to compute their magnitudes
double dot_product = e_v.dot(e_hdg);
//due to rounding errors? in the calculation of the dot product,
//we have to limit the dot product to a maximum of 1
if (dot_product > 1)
dot_product = 1;
//get the angle as the arccosine
return acos(dot_product);
}
//*****************************************************************//
//*****************************************************************//
double cAerodynamicsModel::get_interp(double mach_number, const double* v_table)
{
//if we are lower than the lowest value in the M_table, then
//return the lowest value
if (mach_number < M_table[0])
return v_table[0];
//if we're higher than the highest value, just return the highest value
if (mach_number > M_table[DRAG_TABLE_LENGTH -1])
return v_table[DRAG_TABLE_LENGTH-1];
//initialize some indexes
int lower_index = 0;
int higher_index = 1;
//loop until altitude is lower than the value at the higher index
for (int i = 1; i < DRAG_TABLE_LENGTH; i++)
{
if (mach_number < M_table[i])
{
lower_index = i-1;
higher_index = i;
break;
}
}
//now set up linear interpolation
double base_val = v_table[lower_index];
double base_M = M_table[lower_index];
double dM = M_table[higher_index] - M_table[lower_index];
double dv = v_table[higher_index] - v_table[lower_index];
//dv/dM (we don't worry about divide by 0 because we know the M table always increments)
double gradient = dv/dM;
//actually calculate the value
return base_val + (mach_number-base_M)*gradient;
}
//*****************************************************************//
//*****************************************************************//
//utility function to compute the mach number
double cAerodynamicsModel::compute_mach_number(double air_density, double air_temp, double air_pressure, double velocity)
{
//compute speed of sound:
//sqrt(gamma*R*T / M), where gamma = 1.4, R = 8.314510 J/mol-K, M = 0.0289645 kg/mol
double a = sqrt(1.4 * (8.314510 / 0.0289645) * air_temp);
//divide with velocity
return velocity / a;
}<file_sep>#this file
import ctypes
#some constants
DEG_TO_RAD = 3.14159265/180.0
RAD_TO_DEG = 1.0/DEG_TO_RAD
PI = 3.14159265
t4 = ctypes.cdll.Titan4DLL
_readDouble = t4._read_double
_readDouble.argtypes = [ctypes.c_int]
_readDouble.restype = ctypes.c_double
#wrapper for above
def readDouble(address):
#call import
return _readDouble(address)
_readInt = t4._read_int
_readInt.argtypes = [ctypes.c_int]
_readInt.restype = ctypes.c_int
#wrapper for above
def readInt(address):
#call import
return _readInt(address)
_writeDouble = t4._write_double
_writeDouble.argtypes = [ctypes.c_int, ctypes.c_double]
_writeDouble.restype = ctypes.c_int
#wrapper for above
def writeDouble(address, value):
#call import
return _writeDouble(address, value)
_writeInt = t4._write_int
_writeInt.argtypes = [ctypes.c_int, ctypes.c_int]
_writeInt.restype = ctypes.c_int
#this is a hard-coded list of objects that will be ints
int_list = ['SIM_COMMAND', 'STAGE1_ENGINE_ON', 'STAGE2_ENGINE_ON', 'VIS_COUNT', 'VIS_COMMAND', 'ENGINE_EXTERNAL_CONTROL', 'SIM_PHASE', 'RECORDER_COMMAND']
#wrapper for above
def writeInt(address, value):
#call import
return _writeInt(address, value)
#this class defines a "data object" that can be read
class data_object(object):
address = 0
name = ''
#constructor
def __init__(self, _address, _name):
self.address = _address
self.name = _name
#property function to get it's own value
def _get_value(self):
#DEBUG
#print "get value called."
#check if it's in the int override list
if self.name in int_list:
return readInt(self.address)
else:
return readDouble(self.address)
#property function set it's own value
def _set_value(self, value):
#DEBUG
#print "set value called."
#check if it's in the int override list
if self.name in int_list:
return writeInt(self.address, value)
else:
return writeDouble(self.address, value)
#property that uses the above two values
value = property(_get_value, _set_value)
#representation
def __repr__(self):
#DEBUG
#print "repr called."
#return value
return str(self.value)
#these two are invoked for a member variable of a class,
#when one tries to get or set it.
#it only works if the instance is itself a member of another class.
def __get__(self, obj, cls):
#DEBUG
#print "get called."
return self
#set it's own value
def __set__(self, obj, value):
#DEBUG
#print "set called."
#force a shallow copy (set the new value),
#rather than the python default "deep copy" (actually becoming the new object)
return self.set_value(value)
#overload all the operators to force them to work against
#the value and not the object itself
def __lt__(self, other):
return self.value < other
def __gt__(self, other):
return self.value > other
def __eq__(self, other):
return self.value == other
def __ne__(self, other):
return self.value <> other
def __le__(self, other):
return self.value <= other
def __ge__(self, other):
return self.value >= other
def __add__(self, other):
return self.value + other
def __sub__(self, other):
return self.value - other
def __mul__(self, other):
return self.value * other
def __floordiv__(self, other):
return self.value // other
def __mod__(self, other):
return self.value % other
def __pow__(self, other):
return pow(self.value, other)
def __lshift__(self, other):
return self.value << other
def __rshift__(self, other):
return self.value >> other
def __and__(self, other):
return self.value & other
def __xor__(self, other):
return self.value ^ other
def __or__(self, other):
return self.value | other
def __div__(self, other):
return self.value / other
def __truediv__(self, other):
return self.value / other
def __radd__(self, other):
return self.__add__(other)
def __rsub__(self, other):
return self.__sub__(other)
def __rmul__(self, other):
return self.__mul__(other)
def __rdiv__(self, other):
return self.__div__(other)
def __rtruediv__(self, other):
return self.__truediv__(other)
def __rfloordiv__(self, other):
return self.__floordiv__(other)
def __rmod__(self, other):
return self.__mod__(other)
def __rdivmod__(self, other):
return self.__divmod__(other)
def __rlshift__(self, other):
return self.__lshift__(other)
def __rrshift__(self, other):
return self.__rshift__(other)
def __rand__(self, other):
return self.__and__(other)
def __rxor__(self, other):
return self.__xor__(other)
def __ror__(self, other):
return self.__or__(other)
def __iadd__(self, other):
self.value = self.value + other
return self.value
def __isub__(self, other):
self.value = self.value - other
return self.value
def __imul__(self, other):
self.value = self.value * other
return self.value
def __idiv__(self, other):
self.value = self.value / other
return self.value
def __itruediv__(self, other):
self.value = self.value / other
return self.value
def __ifloordiv__(self, other):
self.value = self.value // other
return self.value
def __imod__(self, other):
self.value = self.value % other
return self.value
def __ipow__(self, other):
self.value = self.value ** other
return self.value
def __ilshift__(self, other):
self.value = self.value << other
return self.value
def __irshift__(self, other):
self.value = self.value >> other
return self.value
def __iand__(self, other):
self.value = self.value & other
return self.value
def __ixor__(self, other):
self.value = self.value ^ other
return self.value
def __ior__(self, other):
self.value = self.value | other
return self.value
def __neg__(self):
return self.value * -1
def __pos__(self):
return self.value
def __abs__(self):
return abs(self.value)
def __invert__(self):
return ~self.value
def __complex__(self):
return complex(self.value)
def __int__(self):
return int(self.value)
def __long__(self):
return long(self.value)
def __float__(self):
return float(self.value)
def __oct__(self):
return oct(self.value)
def __hex__(self):
return hex(self.value)
#this is a class that will hold all the parameters
class obj_collection(object):
#constructor
def __init__(self):
#now read in the sm_defines.h file
infile = open("sm_defines.h", "r")
#read in the lines
lines = infile.readlines()
#close the file
infile.close()
#now go through the lines and make objects out of each one
for line in lines:
#replace tabs with spaces
line = line.replace("\t", " ")
#remove all multiple spaces
for i in range(0, 10):
line = line.replace(" ", " ")
#if the line contains a define, keep processing
if "#define" in line:
substrs = line.split(" ")
#obtain the name, and the address
name = substrs[1]
#addr
addr = int(substrs[2], 16)
#create a named object using the exec statement
exec("self." + name + " = data_object(" + hex(addr) + ", '" + name + "')")
#modify the setattr function to force the assumption of data_object type
def __setattr__(self, name, value):
#DEBUG
#print "set attr called for name: " + name
#if the object already exists, check to make sure
#we don't stomp on a data type we don't want to stomp on
if name in dir(self):
obj = eval("self." + name)
if isinstance(obj, data_object):
#force it to use the value assignment if it's a data object
obj.value = value
else:
self.__dict__[name] = value
else:
self.__dict__[name] = value
#instantiate
global d
d = obj_collection()
<file_sep>#include "common_classes.h"
#include "atm_table.h"
#pragma once
class cAtmosphereModel
{
public:
cSharedMem* pSharedMem;
int init(cSharedMem* _pSharedMem);
int calculate_atmosphere_phase0(cState state);
int calculate_atmosphere_phase1(cState stage1_state, cState interstage_state, cState stage2_state);
//internal utility function to calculate the air temperature at the provided altitude above sea level.
double get_air_temperature(double altitude);
//internal utility function to calculate the air pressure at the provided altitude above sea level.
double get_air_pressure(double altitude);
//internal utility function to calculate the air density at the provided altitude above sea level.
double get_air_density(double altitude);
//this is the base linear interpolation function
double get_interp(double altitude, const double* v_table);
private:
};<file_sep>#include <windows.h>
#define IDI_ICON1 101
#define MAX_WINDOWS 10
class cWindowManager
{
public:
WNDCLASS wndclass1;
HWND hWindows[MAX_WINDOWS];
HINSTANCE hAppInstance;
bool bRunFlag;
int init(HINSTANCE _hAppInstance);
int create_window(int iWindow, LPWSTR ClassName, LPWSTR Name, WNDPROC _WndCallBackProc);
private:
};<file_sep>#include <math.h>
#include "cSharedMem.h"
#pragma once
#define cPI 3.14159265
#define RAD_TO_DEG (180.0/cPI)
#define DEG_TO_RAD (cPI/180.0)
class cVec
{
public:
double x;
double y;
double z;
cVec(double _x, double _y, double _z)
{
x = _x;
y = _y;
z = _z;
}
cVec()
{
x = 0;
y = 0;
z = 0;
}
double mag()
{
double mag_squared = x*x + y*y + z*z;
if (mag_squared == 0.0)
return 0;
else
return sqrt(mag_squared);
}
void normalize()
{
double magnitude = mag();
if (magnitude != 0)
{
x = x / magnitude;
y = y / magnitude;
z = z / magnitude;
}
}
cVec get_normalized()
{
double magnitude = mag();
if (magnitude != 0)
return cVec(x / magnitude, y / magnitude, z / magnitude);
else
return cVec(0, 0, 0);
}
cVec scale(double factor)
{
x *= factor;
y *= factor;
z *= factor;
return cVec(x,y,z);
}
cVec operator*(double scale)
{
cVec ret;
ret.x = this->x * scale;
ret.y = this->y * scale;
ret.z = this->z * scale;
return ret;
}
cVec operator+(const cVec& rhs)
{
cVec ret;
ret.x = this->x + rhs.x;
ret.y = this->y + rhs.y;
ret.z = this->z + rhs.z;
return ret;
}
cVec operator-(const cVec& rhs)
{
cVec ret;
ret.x = this->x - rhs.x;
ret.y = this->y - rhs.y;
ret.z = this->z - rhs.z;
return ret;
}
double dot(cVec other)
{
return x*other.x + y*other.y + z*other.z;
}
cVec cross(cVec other)
{
return cVec(y*other.z - z*other.y, z*other.x - x*other.z, x*other.y - y*other.x);
}
double component_along(cVec other)
{
// a dot b = |a||b| cos(theta)
cVec norm_a = get_normalized();
cVec norm_b = other.get_normalized();
double dot_product = norm_a.dot(norm_b); //equal to cos(theta)
return dot_product*mag();
}
cVec component_along_v(cVec other)
{
// a dot b = |a||b| cos(theta)
cVec norm_a = get_normalized();
cVec norm_b = other.get_normalized();
double dot_product = norm_a.dot(norm_b); //equal to cos(theta)
return norm_b*dot_product*mag();
}
void invert()
{
scale(-1.0);
}
//just a quick utility function to convert long-lat-alt into ECEF x,y,z
//Note: I could have done this using the Quaternion unit as well, but just for
//mental exercise I did it this way.
static cVec compute_ecef_xyz(double longitude_deg, double latitude_deg, double alt_meters)
{
//convert to radians
double long_rad = longitude_deg * DEG_TO_RAD;
double lat_rad = latitude_deg * DEG_TO_RAD;
//create unit vector with prescribed longitude and latitude
cVec output(cos(long_rad)*cos(lat_rad), sin(long_rad)*cos(lat_rad), sin(lat_rad));
//scale by altitude
output.scale(alt_meters);
//done.
return output;
}
};
class cQuaternion
{
public:
double w; //q0
double i; //q1
double j; //q2
double k; //q3
int apply_rotation(double w_x, double w_y, double w_z, double dt);
int set_rotation(double phi, double theta, double psi);
int set_rotation_deg(double phi_deg, double theta_deg, double psi_deg);
int set_rotation(double v_x, double v_y, double v_z, double rotation_rad);
int apply_quaternion(cQuaternion oth);
cVec get_pitch_axis();
cVec get_roll_axis();
cVec get_yaw_axis();
cVec rotate_vector(cVec input);
cVec rotate_vector(double x, double y, double z);
double get_theta();
double get_theta_deg();
double get_phi();
double get_phi_deg();
double get_psi();
double get_psi_deg();
~cQuaternion() { w = 0; i = 0; j = 0; k = 0; }
cQuaternion() { set_rotation(0, 0, 0); }
cQuaternion(double phi, double theta, double psi)
{
set_rotation(phi, theta, psi);
}
};
class cState
{
public:
//position
double x;
double y;
double z;
//attitude
double phi;
double psi;
double theta;
//attitude (quaternion)
cQuaternion att;
//velocity
double vx;
double vy;
double vz;
//angular velocity
double wx;
double wy;
double wz;
//properties
double mass;
double Ixx;
double Iyy;
double Izz;
double Ixy;
double Ixz;
double Iyz;
cState();
int reset();
double get_r();
double get_v();
double get_longitude()
{
//x axis of ECEF goes through prime meridian.
//the range of the return value matches with east (negative)
//and west (positive) longitudes well, so no need to recalculate.
return atan2(y, x);
}
double get_longitude_deg() {return get_longitude() * RAD_TO_DEG; }
double get_latitude()
{
//get the adjacent side (the opposite side is just z)
double adj = x*x + y*y;
if (adj > 0)
adj = sqrt(adj);
//latitude will end up as just positive(north) and negative (south)
return atan2(z, adj);
}
double get_latitude_deg() { return get_latitude() * RAD_TO_DEG; }
//ENU is "east-north-up" (which is unwittingly the convention I started with when I made the models...)
cVec convert_orientation_ENU_to_ECEF(cVec input)
{
double longitude = get_longitude();
double latitude = get_latitude();
//pre-processing:
// longitude = +0 --> psi = +90
// longitude = +90 --> psi = +180
// longitude = +/- 180 --> psi = +270 = -90
// longitude = +270 / -90 --> psi = 0
double equiv_psi = longitude + (cPI / 2.0);
if (equiv_psi >= (2*cPI))
equiv_psi -= (2*cPI);
//pre-processing:
// latitude = +90 --> phi = +0
// latitude = +45 --> phi = +45
// latitude = 0 --> phi = +90
// latitude = -45 --> phi = +135
// latitude = -90 --> phi = +180
double equiv_phi = (latitude - (cPI / 2.0))*-1;
//no range-wrapping needed since the desired ranges line up
cQuaternion latlong(equiv_phi, 0, equiv_psi);
return latlong.rotate_vector(input);
}
private:
};
class cDerivative
{
public:
double ax;
double ay;
double az;
double vx;
double vy;
double vz;
double alx;
double aly;
double alz;
double wx;
double wy;
double wz;
double dmass;
double dIxx;
double dIyy;
double dIzz;
double dIxz;
double dIyz;
double dIxy;
private:
};
class cForceMoment
{
public:
double fx;
double fy;
double fz;
double mx;
double my;
double mz;
cForceMoment(double _fx, double _fy, double _fz, double _mx, double _my, double _mz)
{
fx = _fx;
fy = _fy;
fz = _fz;
mx = _mx;
my = _my;
mz = _mz;
}
cForceMoment()
{
fx = 0;
fy = 0;
fz = 0;
mx = 0;
my = 0;
mz = 0;
}
cForceMoment operator+(const cForceMoment& rhs)
{
cForceMoment ret;
ret.fx = this->fx + rhs.fx;
ret.fy = this->fy + rhs.fy;
ret.fz = this->fz + rhs.fz;
ret.mx = this->mx + rhs.mx;
ret.my = this->my + rhs.my;
ret.mz = this->mz + rhs.mz;
return ret;
}
cForceMoment operator-(const cForceMoment& rhs)
{
cForceMoment ret;
ret.fx = this->fx - rhs.fx;
ret.fy = this->fy - rhs.fy;
ret.fz = this->fz - rhs.fz;
ret.mx = this->mx - rhs.mx;
ret.my = this->my - rhs.my;
ret.mz = this->mz - rhs.mz;
return ret;
}
private:
};
class cAtmState
{
public:
//SI unit: kg/m^3
double air_density;
//SI unit: kelvin
double static_air_temperature;
//default constructor
cAtmState()
{
air_density = 0;
static_air_temperature = 0;
}
//value constructor
cAtmState(double _air_density, double _static_air_temperature)
{
air_density = _air_density;
static_air_temperature = _static_air_temperature;
}
private:
};<file_sep>//Description: Titan6 is the dynamic simulation itself. It performs
//the integration of the equations of motion for the stages of the rocket.
//It reads in commands to start, stop or step from the shared memory, and
//outputs the state vectors to shared memory.
//standard includes
#include <windows.h>
#include <stdio.h>
//include the shared memory definition file
#include "sm_defines.h"
//include the shared utility classes
#include "common_classes.h"
//include the definitions of the classes we intend to instantiate
#include "cSharedMem.h"
#include "cIntegrator.h"
#include "cForceModel.h"
#include "cControlModel.h"
#include "cAtmosphereModel.h"
#include "cAerodynamicsModel.h"
//instantiate each of the pieces of the simulation here:
//the Shared Memory interface
cSharedMem SharedMem;
//the Force computation and aggregation
cForceModel ForceModel;
//the Integrator itself
cIntegrator Integrator;
//the (internal) Controller logic
cControlModel ControlModel;
//the Atmospheric property computation
cAtmosphereModel AtmosphereModel;
//the Aerodynamic Force computation
cAerodynamicsModel AerodynamicsModel;
<file_sep>#include "cControlModel.h"
//*****************************************************************//
//*****************************************************************//
int cControlModel::calculate_controls_phase0(cState state, cState prev_state, double sim_time)
{
if (bEnabled == false)
return 0;
//keep engine on
pSharedMem->write_int(STAGE1_ENGINE_ON, 1);
if (sim_time < 30.0)
{
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_TILT, 0.0);
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_ROLL, 0);
} else if (sim_time < 30.1)
{
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_TILT, 1.0*DEG_TO_RAD);
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_ROLL, 0);
} else
{
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_TILT, 0.0);
pSharedMem->write_double(STAGE1_ENGINE_GIMBAL_ROLL, 0);
}
return 0;
}
//*****************************************************************//
//*****************************************************************//
int cControlModel::calculate_controls_phase1(cState state, cState prev_state, double sim_time)
{
if (bEnabled == false)
return 0;
//keep engine on
pSharedMem->write_int(STAGE2_ENGINE_ON, 1);
//try to maintain theta above 0
if (state.theta < 0) //try to maintain angle at 0
{
double dtheta = state.theta - prev_state.theta;
pSharedMem->write_double(STAGE2_ENGINE_GIMBAL_TILT, 0.001*state.theta + 1.0*dtheta);
pSharedMem->write_double(STAGE2_ENGINE_GIMBAL_ROLL, 0);
} else
{
pSharedMem->write_double(STAGE2_ENGINE_GIMBAL_TILT, 0);
pSharedMem->write_double(STAGE2_ENGINE_GIMBAL_ROLL, 0);
}
return 0;
}
//*****************************************************************//
//*****************************************************************//
<file_sep>#include "cWindowManager.h"
//*******************************************************//
//*******************************************************//
int cWindowManager::init(HINSTANCE _hAppInstance)
{
hAppInstance = _hAppInstance;
bRunFlag = TRUE;
for (int lc1 = 0; lc1 < MAX_WINDOWS; lc1++)
{
hWindows[lc1] = 0;
}
return 0;
}
//*******************************************************//
//*******************************************************//
int cWindowManager::create_window(int iWindow, LPWSTR ClassName, LPWSTR Name, WNDPROC _WndCallBackProc)
{
wndclass1.lpszClassName = ClassName;
wndclass1.hInstance = hAppInstance;
wndclass1.hCursor = LoadCursor(hAppInstance, (LPCTSTR)IDC_ARROW);
wndclass1.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass1.lpfnWndProc = _WndCallBackProc;
wndclass1.lpszMenuName = NULL;
wndclass1.style = CS_DBLCLKS;
wndclass1.hIcon = LoadIcon(hAppInstance, (LPCTSTR)IDI_ICON1);
wndclass1.cbClsExtra = 0;
wndclass1.cbWndExtra = 0;
RegisterClass(&wndclass1);
hWindows[iWindow] = CreateWindow(ClassName,
Name,
WS_VISIBLE | WS_SYSMENU | WS_CAPTION,
0,
0,
640,
480,
NULL,
NULL,
hAppInstance,
NULL);
return 0;
}
//*******************************************************//
//*******************************************************//<file_sep>#this file implements simulation control functions on top of
#the variables imported by titan7.
#import the math library
import math
#
import time
#bring in the data
execfile("DataInterface.py")
#this encapsulates sending the simulation a command
#(mainly adds the waiting for the sim to acknowledge that it received it
def send_sim_command(cmd_number):
#dispatch to sim
d.SIM_COMMAND = cmd_number
#wait until it sets it back to 0 to confirm completion
while d.SIM_COMMAND != 0:
time.sleep(0.001)
#this function calculates ECEF x,y and z for a given lat-long-alt
def calc_ecef_xyz(lat_deg, long_deg, alt_m):
#convert to radians
lat_rad = lat_deg * DEG_TO_RAD
long_rad = long_deg * DEG_TO_RAD
#convert altitude to distance from earth center
r_m = alt_m + 6378100.0
#compute x,y and z
px = r_m * math.cos(long_rad) * math.cos(lat_rad)
py = r_m * math.sin(long_rad) * math.cos(lat_rad)
pz = r_m * math.sin(lat_rad)
#return the result
return [px, py, pz]
#this function does an IC with the supplied parameters.
#note that it defaults to a launch at cape canaveral
def ic(ic_long_deg = -80.5585, ic_lat_deg = 28.4667, ic_alt_m = 0, \
ic_pitch_deg = 90.0, ic_roll_deg = 0.0, ic_yaw_deg = 0.0):
#get px, py and pz
[px, py, pz] = calc_ecef_xyz(ic_lat_deg, ic_long_deg, ic_alt_m)
#convert pitch/roll/yaw to radians
ic_pitch_rad = ic_pitch_deg * DEG_TO_RAD
ic_roll_rad = ic_roll_deg * DEG_TO_RAD
ic_yaw_rad = ic_yaw_deg * DEG_TO_RAD
#write values to the IC variables:
#position
d.IC_PX_ECEF = px
d.IC_PY_ECEF = py
d.IC_PZ_ECEF = pz
#euler angles
d.IC_PITCH_RAD = ic_pitch_rad
d.IC_ROLL_RAD = ic_roll_rad
d.IC_YAW_RAD = ic_yaw_rad
#set all other needed variables to defaults i don't know what else to do:
#velocity
d.IC_VX_ECEF = 0
d.IC_VY_ECEF = 0
d.IC_VZ_ECEF = 0
#angular velocity
d.IC_WX = 0
d.IC_WY = 0
d.IC_WZ = 0
#mass (indicate to sim to use defaults
d.IC_MASS_FUEL_FIRST_STAGE = 0
#set step size and engine control
d.SIM_STEP_SIZE = 0.05 #50 msec
#set engine control
d.ENGINE_EXTERNAL_CONTROL = 0 #internal for the moment
#tell Display to clear history lines
clear_history_lines()
#then send command to the sim to IC
send_sim_command(1)
#tell the sim to step
def step(step_size = 0.05):
#set the timestep
d.SIM_STEP_SIZE = step_size
#send command to the sim
send_sim_command(2)
#tell the sim to perform a first stage separation
def first_stage_separation():
#print out
print "T = " + str(d.SIM_TIME)[0:6] + ". Commanded first stage separation."
#send command to the sim
send_sim_command(100)
#wait 100 msec to allow it to go through
time.sleep(0.1)
#tell the GUI to clear the history lines
def clear_history_lines():
#DEBUG
print "commanded reset of history lines."
#send command to visualizer
d.VIS_COMMAND = 2
#define an engine controller class
class EngineController(object):
#altitude threshold trigger
altitude_threshold = False
#save the last variables
last_r = 0
last_theta = 0
#target r
target_r = 6378.1 + 290.0
target_theta = 0
#
hit_apogee = False
hit_seco = False
#
terminal_guidance = False
#utility function to prescribe a tilt angle for the first stage
#flight, which moves the rocket towards a target pitch angle.
#the control is based on a PD control that attempts to
#model the rocket as a critically damped harmonic oscillator
#in the rotation axis.
def prescribe_tilt_angle_first_stage(self, _k, target_theta, theta, theta_rate):
#abort if too early.
if d.SIM_TIME < 1.0:
return 0.0
#define the moment_arm we are using
lgt = 11.65 #assume this for now, 11.65m
#define the proportional constant (note: we could use IYY or IZZ here....the rocket is symmetrical about either, so...)
k = d.PHASE0_IZZ*_k
#define the differential constant as the value for the
#supplied k that would make a critically damped harmonic oscillator
#out of the resulting system.
c = 2*math.sqrt(d.PHASE0_IZZ*k)
#now compute the required torque this would require
#note: I determined the signs by trial and error.
tau = k*(theta - target_theta) + c*theta_rate
#now compute the tilt angle that would create that torque.
#note we're using the approximation of sin(tilt) = tilt since
#we won't be using large angles anyway.
#first, compute the magnitude of the thrust
thrust_magnitude = math.sqrt(d.THRUST_FX*d.THRUST_FX + d.THRUST_FY*d.THRUST_FY + d.THRUST_FZ *d.THRUST_FZ)
#if current thrust is 0, return 0 since we tilting is pointless
#and we can avoid a divide-by-zero later
if thrust_magnitude == 0:
return 0
#otherwise compute.
#assume the moment arm for the first stage is 11.65m
tilt_angle = tau / (lgt*thrust_magnitude)
#return this value
return tilt_angle
#same for second stage
def prescribe_tilt_angle_second_stage(self, _k, target_theta, theta, theta_rate):
#define the moment_arm we are using
lgt = 4.13 #assume this for now, 4.13m
#define the proportional constant
k = d.PHASE1_STAGE2_IZZ*_k
#define the differential constant as the value for the
c = 2*math.sqrt(d.PHASE1_STAGE2_IZZ*k)
#now compute the required torque this would require
tau = k*(theta - target_theta) + c*theta_rate
#now compute the tilt angle that would create that torque.
#first, compute the magnitude of the thrust
thrust_magnitude = math.sqrt(d.THRUST_FX*d.THRUST_FX + d.THRUST_FY*d.THRUST_FY + d.THRUST_FZ *d.THRUST_FZ)
#if current thrust is 0, return 0 since we tilting is pointless
#and we can avoid a divide-by-zero later
if thrust_magnitude == 0:
return 0
#otherwise compute.
tilt_angle = tau / (lgt*thrust_magnitude)
#return this value
return tilt_angle
#this function does the engine control during stage1
def engine_control_stage1(self, time_step):
#stage 1 engine control
#for now, always command the engine to be on
d.STAGE1_ENGINE_ON = 1
#compute pitch rate
theta_rate = (d.PHASE0_PITCH.value - self.last_theta) / time_step
#save new last value (remember to use value here.)
self.last_theta = d.PHASE0_PITCH.value
self.last_r = d.PHASE0_R.value
#at exactly 30 seconds, print that we're beginning pitch-over maneuver
if math.fabs(d.SIM_TIME - 30.0) < 0.001:
print "T = 30.0: beginning pitch-over maneuver."
#at 35 seconds, finish pitch-over, start gravity turn.
if math.fabs(d.SIM_TIME - 35.0) < 0.001:
print "T = 35.0: finish pitch-over at FPA = " + str(d.PHASE0_FLIGHT_PATH_ANGLE * RAD_TO_DEG)[0:5] + " deg. Beginning gravity turn."
#before 30 seconds ...beginning...straight up.
if d.SIM_TIME < 30.0:
d.STAGE1_ENGINE_GIMBAL_TILT = 0
d.STAGE1_ENGINE_GIMBAL_ROLL = 0
#30-35 seconds: start pitch over maneuver
elif d.SIM_TIME < 35.0:
d.STAGE1_ENGINE_GIMBAL_TILT = self.prescribe_tilt_angle_first_stage(2.0, 79.0*DEG_TO_RAD, d.PHASE0_PITCH.value, theta_rate)
d.STAGE1_ENGINE_GIMBAL_ROLL = d.PHASE0_YAW
#otherwise do gravity turn maneuver
else:
d.STAGE1_ENGINE_GIMBAL_TILT = self.prescribe_tilt_angle_first_stage(5.0, d.PHASE0_FLIGHT_PATH_ANGLE.value, d.PHASE0_PITCH.value, theta_rate)
d.STAGE1_ENGINE_GIMBAL_ROLL = d.PHASE0_YAW
#this function does the engine control during stage2
def engine_control_stage2(self, time_step):
#stage 2 engine control
#for now, always command the engine to be on
if self.hit_seco == False:
d.STAGE2_ENGINE_ON = 1
#compute pitch rate
theta_rate = (d.PHASE1_STAGE2_PITCH.value - self.last_theta) / time_step
#if current r is previous one, we hit apogee, and we need to halt simulation
if d.PHASE1_STAGE2_R.value < self.last_r:
if self.hit_apogee == False:
#calculate the velocity we reached.
v = math.sqrt(d.PHASE1_STAGE2_VX * d.PHASE1_STAGE2_VX + d.PHASE1_STAGE2_VY * d.PHASE1_STAGE2_VY + d.PHASE1_STAGE2_VZ * d.PHASE1_STAGE2_VZ)
print "T = " + str(d.SIM_TIME)[0:6] + ". Reached apogee at altitude: " + str(self.last_r - 6378.1)[0:7] + " km. velocity: " + str(v)[0:6] + " m/s."
self.hit_apogee = True
#if we've run out of fuel
if d.PHASE1_STAGE2_MASS <= 590.0: #leave 50kg of fuel
if self.hit_seco == False:
#turn off engine
d.STAGE2_ENGINE_ON = 0
#calculate the velocity we reached.
v = math.sqrt(d.PHASE1_STAGE2_VX * d.PHASE1_STAGE2_VX + d.PHASE1_STAGE2_VY * d.PHASE1_STAGE2_VY + d.PHASE1_STAGE2_VZ * d.PHASE1_STAGE2_VZ)
print "T = " + str(d.SIM_TIME)[0:6] + ". Hit SECO. Altitude: " + str(self.last_r - 6378.1)[0:7] + " km. velocity: " + str(v)[0:6] + " m/s."
self.hit_seco = True
#abort once both are true
if self.hit_seco and self.hit_apogee:
pass
#return 0
#save new last value (remember to use value here.)
self.last_theta = d.PHASE1_STAGE2_PITCH.value
self.last_r = d.PHASE1_STAGE2_R.value
#if math.fabs(d.SIM_TIME - 30.0) < 0.001:
# print "T = 30.0: beginning pitch-over maneuver."
#do gravity turn maneuver
if d.PHASE1_STAGE2_FLIGHT_PATH_ANGLE.value >= (5.0*DEG_TO_RAD):
d.STAGE2_ENGINE_GIMBAL_TILT = self.prescribe_tilt_angle_second_stage(8.0, d.PHASE1_STAGE2_FLIGHT_PATH_ANGLE.value, d.PHASE1_STAGE2_PITCH.value, theta_rate)
d.STAGE2_ENGINE_GIMBAL_ROLL = d.PHASE1_STAGE2_YAW
#otherwise go into terminal guidance
else:
if self.terminal_guidance == False:
self.terminal_guidance = True
#DEBUG
print "T = " + str(d.SIM_TIME)[0:6] + ". Engage Terminal Guidance mode."
d.STAGE2_ENGINE_GIMBAL_TILT = self.prescribe_tilt_angle_second_stage(8.0, 10.0*DEG_TO_RAD, d.PHASE1_STAGE2_PITCH.value, theta_rate)
d.STAGE2_ENGINE_GIMBAL_ROLL = d.PHASE1_STAGE2_YAW
#main engine control function
def engine_control(self, time_step):
if d.SIM_PHASE == 0:
return self.engine_control_stage1(time_step)
elif d.SIM_PHASE == 1:
return self.engine_control_stage2(time_step)
#instantiate
global engine_controller
engine_controller = EngineController()
#this performs a simulation run
def simulation_run(step_size = 0.05):
#initialize the sim (<NAME>)
ic(ic_long_deg = 167.73, ic_lat_deg = 8.72)
#initialize the engine controller
engine_controller.hit_seco = False
#turn on external engien control
d.ENGINE_EXTERNAL_CONTROL = 1
#keep track if we've commmand sep or not
commanded_sep = False
#create an infinite loop here:
while True:
#step the sim
step(step_size)
#run the engine control function
ret = engine_controller.engine_control(step_size)
if ret == 0:
print "Simulation run completed."
return 0
#if we're in phase 0, and the stage 1 rocket mass is less than or equal to 7970kg (out of fuel)
if (d.SIM_PHASE == 0) and (d.PHASE0_MASS <= 7970.0) and (commanded_sep == False):
first_stage_separation()
commanded_sep = True
#if we're in phase 1, and the stage 2 rocket mass is less than or equal to 540kg (empty mass)
#quit
if (d.SIM_PHASE == 1) and (d.PHASE1_STAGE2_MASS <= 540.0):
#break
pass
<file_sep># titan-rocket
Test Repository
<file_sep>#include "common_classes.h"
#pragma once
<file_sep>//this is the implementation of the data recorder.
#include "main.h"
//**********************************************************************************
//**********************************************************************************
//the init function
int cDataRecorder::init()
{
//clear arrays
for (int i = 0; i < DATA_STORAGE_FRAMES; i++)
for (int j = 0; j < NUM_OBJECTS; j++)
{
DataBuffer[j][i].clear();
}
//reset pointers and job numbers
iCurrEntry = 0;
iJobNumber = 0;
//set recorder mode to inactive
iRecorderMode = RECORDER_MODE_INACTIVE;
//default record interval is 0.2 seconds
fRecordInterval = 0.2;
//reset last record time
fLastRecordTime = 0;
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//the exit function
int cDataRecorder::exit()
{
//nothing to do here, yet.
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//the function to begin recording
int cDataRecorder::record_begin()
{
//increment job number
iJobNumber += 1;
//set recorder mode
iRecorderMode = RECORDER_MODE_RECORDING;
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//the function to end recording
int cDataRecorder::record_end()
{
//set recorder mode
iRecorderMode = RECORDER_MODE_INACTIVE;
//done
return 0;
}
//**********************************************************************************
//**********************************************************************************
//set the recording interval
int cDataRecorder::set_recording_interval(double seconds_per_frame)
{
//screen invalid values
if (seconds_per_frame <= 0)
return -1;
//actually set it
fRecordInterval = seconds_per_frame;
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//give data recorder a chance to capture data.
int cDataRecorder::capture_data()
{
//exit if not recording
if (iRecorderMode != RECORDER_MODE_RECORDING)
return 0;
//obtain simulation time
double sim_time = sm_read_double(SIM_TIME);
//exit if not time to record.
if ((sim_time - fLastRecordTime) < fRecordInterval)
return 0;
//otherwise obtain data:
//obtain the mission phase
int sim_phase = sm_read_int(SIM_PHASE);
//route to appropriate sub-function based on phase
if (sim_phase == 0)
capture_data_phase0();
if (sim_phase == 1)
capture_data_phase1();
//increment the recorder position
iCurrEntry += 1;
//if we exceeded the boundaries, go back to 0
if (iCurrEntry >= DATA_STORAGE_FRAMES)
iCurrEntry = 0;
//update last record time
fLastRecordTime = sim_time;
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//sub-function for gathering data during phase 0
int cDataRecorder::capture_data_phase0()
{
//in phase 0 the rocket is a single body, so both objects have the same position.
//object 0:
//job number
DataBuffer[0][iCurrEntry].iJobNumber = iJobNumber;
//sim time
DataBuffer[0][iCurrEntry].fTime = sm_read_double(SIM_TIME);
//x,y,z positions
DataBuffer[0][iCurrEntry].fX_ECEF = sm_read_double(PHASE0_X);
DataBuffer[0][iCurrEntry].fY_ECEF = sm_read_double(PHASE0_Y);
DataBuffer[0][iCurrEntry].fZ_ECEF = sm_read_double(PHASE0_Z);
//lat, long, r
DataBuffer[0][iCurrEntry].fLongitude = sm_read_double(PHASE0_LONGITUDE);
DataBuffer[0][iCurrEntry].fLatitude = sm_read_double(PHASE0_LATITUDE);
DataBuffer[0][iCurrEntry].fR = sm_read_double(PHASE0_R);
//object 1:
//job number
DataBuffer[1][iCurrEntry].iJobNumber = iJobNumber;
//sim time
DataBuffer[1][iCurrEntry].fTime = sm_read_double(SIM_TIME);
//x,y,z positions
DataBuffer[1][iCurrEntry].fX_ECEF = sm_read_double(PHASE0_X);
DataBuffer[1][iCurrEntry].fY_ECEF = sm_read_double(PHASE0_Y);
DataBuffer[1][iCurrEntry].fZ_ECEF = sm_read_double(PHASE0_Z);
//lat, long, r
DataBuffer[1][iCurrEntry].fLongitude = sm_read_double(PHASE0_LONGITUDE);
DataBuffer[1][iCurrEntry].fLatitude = sm_read_double(PHASE0_LATITUDE);
DataBuffer[1][iCurrEntry].fR = sm_read_double(PHASE0_R);
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//sub-function for gathering data during phase 1
int cDataRecorder::capture_data_phase1()
{
//in phase 1 the rocket is in three pieces, so we record separate positions for each.
//...although we currently don't record the position of the interstage.
//object 0 (stage 1 lower stage):
//job number
DataBuffer[0][iCurrEntry].iJobNumber = iJobNumber;
//sim time
DataBuffer[0][iCurrEntry].fTime = sm_read_double(SIM_TIME);
//x,y,z positions
DataBuffer[0][iCurrEntry].fX_ECEF = sm_read_double(PHASE1_STAGE1_X);
DataBuffer[0][iCurrEntry].fY_ECEF = sm_read_double(PHASE1_STAGE1_Y);
DataBuffer[0][iCurrEntry].fZ_ECEF = sm_read_double(PHASE1_STAGE1_Z);
//lat, long, r
DataBuffer[0][iCurrEntry].fLongitude = sm_read_double(PHASE1_STAGE1_LONG);
DataBuffer[0][iCurrEntry].fLatitude = sm_read_double(PHASE1_STAGE1_LAT);
DataBuffer[0][iCurrEntry].fR = sm_read_double(PHASE1_STAGE1_R);
//object 1 (stage 2 upper stage):
//job number
DataBuffer[1][iCurrEntry].iJobNumber = iJobNumber;
//sim time
DataBuffer[1][iCurrEntry].fTime = sm_read_double(SIM_TIME);
//x,y,z positions
DataBuffer[1][iCurrEntry].fX_ECEF = sm_read_double(PHASE1_STAGE2_X);
DataBuffer[1][iCurrEntry].fY_ECEF = sm_read_double(PHASE1_STAGE2_Y);
DataBuffer[1][iCurrEntry].fZ_ECEF = sm_read_double(PHASE1_STAGE2_Z);
//lat, long, r
DataBuffer[1][iCurrEntry].fLongitude = sm_read_double(PHASE1_STAGE2_LONG);
DataBuffer[1][iCurrEntry].fLatitude = sm_read_double(PHASE1_STAGE2_LAT);
DataBuffer[1][iCurrEntry].fR = sm_read_double(PHASE1_STAGE2_R);
//done.
return 0;
}
//**********************************************************************************
//**********************************************************************************
//export the data to external ephemeris format
int cDataRecorder::export_external_ephemeris(int iObjNumber, const char* filename)
{
//create a file at the indicated filename
FILE* pFile = fopen(filename, "w");
//abort if error
if (pFile == NULL)
{
//
printf("export_external_ephemeris(): error, could not create file.\n");
return -1;
}
//do some homework to obtain some required parameters we need:
//find the earliest data point with the current job number
int iCurrEarliestIndex = -1;
double fEarliestTime = 0;
//go through all the data
for (int i = 0; i < DATA_STORAGE_FRAMES; i++)
{
//if the job number matches
if (DataBuffer[iObjNumber][i].iJobNumber == iJobNumber)
{
//we have no data yet, use this point
if (iCurrEarliestIndex == -1)
{
iCurrEarliestIndex = i;
fEarliestTime = DataBuffer[iObjNumber][i].fTime;
}
else if (DataBuffer[iObjNumber][i].fTime < fEarliestTime) //if we have an earlier time, use that
{
iCurrEarliestIndex = i;
fEarliestTime = DataBuffer[iObjNumber][i].fTime;
}
}
}
//now get the last data point
int iLastIndex = iCurrEntry - 1;
//wrap up if we hit 0
if (iLastIndex < 0)
iLastIndex += DATA_STORAGE_FRAMES;
//now obtain the difference between the two points
int iDifference = iLastIndex - iCurrEarliestIndex;
//if the value is less tha 0, wrap back around
if (iDifference < 0)
iDifference += DATA_STORAGE_FRAMES;
//save the number of points
//the number of points is the difference between earliest and current
//(i.e. diff plus one)
int iNumPoints = iDifference+1;
//start writing file data:
//version stamp
fprintf(pFile, "stk.v.8.0\n\n");
//"BEGIN ephemeris" keyword
fprintf(pFile, "BEGIN Ephemeris\n\n");
fprintf(pFile, "NumberOfEphemerisPoints %d\n", iNumPoints);
//distance unit is kilometers
fprintf(pFile, "DistanceUnit Kilometers\n");
//central body is Earth
fprintf(pFile, "CentralBody Earth\n");
//coordinate system is Fixed (ECEF)
fprintf(pFile, "CoordinateSystem Fixed\n\n");
//ephemeris format, for now is LLATimePos
fprintf(pFile, "EphemerisLLATimePos\n\n");
//starting index is earliest index
int iCurrWriteIndex = iCurrEarliestIndex;
//now go through the databuffer and export the data
for (int j = 0; j < iNumPoints; j++)
{
double ft = DataBuffer[iObjNumber][iCurrWriteIndex].fTime;
double fx = DataBuffer[iObjNumber][iCurrWriteIndex].fX_ECEF;
double fy = DataBuffer[iObjNumber][iCurrWriteIndex].fY_ECEF;
double fz = DataBuffer[iObjNumber][iCurrWriteIndex].fZ_ECEF;
double flat = DataBuffer[iObjNumber][iCurrWriteIndex].fLatitude * RAD_TO_DEG;
double flong = DataBuffer[iObjNumber][iCurrWriteIndex].fLongitude * RAD_TO_DEG;
double fa = DataBuffer[iObjNumber][iCurrWriteIndex].fR - 6378.1; //umm....we need a better way to altitude here.
//write the data
fprintf(pFile, "%6.6f %6.6f %6.6f %6.6f\n", ft, flat, flong, fa);
//increment and wrap
iCurrWriteIndex += 1;
if (iCurrWriteIndex >= DATA_STORAGE_FRAMES)
iCurrWriteIndex = 0;
}
//then finish
fprintf(pFile, "\nEND Ephemeris");
//close the file
fclose(pFile);
//done.
return 0;
} | ec6816a77a6a5d4a4b105ef719cd57c6a7be26f5 | [
"Markdown",
"C",
"Python",
"C++"
] | 47 | C++ | leeswecho/titan-rocket | e100f2d4614ad4f1ebaa3b8c025d7333cf97eb7c | 99af79103926d8eca29b5a399d96c0a46387e029 |
refs/heads/master | <repo_name>stacytao/musical-intersection<file_sep>/musical-intersection/model.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_pyfile('../instance/config.py')
db = SQLAlchemy(app)
rooms = db.Table('rooms', db.Model.metadata,
db.Column('user_id', db.Integer, db.ForeignKey('user.user_id')),
db.Column('room_id', db.Integer, db.ForeignKey('room.room_id'))
)
top_artists = db.Table('top_artists', db.Model.metadata,
db.Column('artist_id', db.Integer, db.ForeignKey('artist.artist_id')),
db.Column('room_id', db.Integer, db.ForeignKey('room.room_id'))
)
class User(db.Model):
__tablename__ = 'user'
user_id = db.Column(db.Unicode(80), primary_key=True, unique=True, nullable=False)
display_name = db.Column(db.Unicode(80), nullable=False)
href = db.Column(db.Unicode(80), nullable=False)
hostings = db.relationship('Room', backref=db.backref('host'))
spotify_playlists = db.Column(db.Unicode(), nullable=True)
access_token = db.Column(db.Unicode(150), nullable=False)
class Room(db.Model):
__tablename__ = 'room'
room_id = db.Column(db.Unicode(80), primary_key=True, unique=True, nullable=False)
timestamp = db.Column(db.DateTime, nullable=False)
host_id = db.Column(db.Integer, db.ForeignKey('user.user_id'))
users = db.relationship('User', secondary=rooms, backref=db.backref('rooms', lazy='dynamic'))
playlist_id = db.Column(db.Unicode(80), unique=True, nullable=True)
playlist_timestamp = db.Column(db.DateTime, nullable=True)
intersection_count = db.Column(db.Integer, nullable=True)
top_artists = db.relationship('Artist', secondary=top_artists, backref=db.backref('top_artists', lazy='dynamic'))
class Artist(db.Model):
__tablename__ = 'artist'
artist_id = db.Column(db.Unicode(80), primary_key=True, unique=True, nullable=False)
artist_name = db.Column(db.Unicode(80), nullable=False)
<file_sep>/musical-intersection/views.py
from flask import Blueprint, g, render_template, request, redirect, session, url_for
from functools import wraps
from werkzeug.security import generate_password_hash, check_password_hash
import json
import requests
import base64
import urllib
import random
from collections import Counter
from . import util
from .model import *
bp = Blueprint("views", __name__)
# https://developer.spotify.com/web-api/authorization-guide/
# Client Keys
CLIENT_ID = "ea09c385c6404736a90e6394c3ce75a5"
CLIENT_SECRET = "707a7398285d4be68ac64eb47f69cc03"
# Spotify URLS
SPOTIFY_AUTH_URL = "https://accounts.spotify.com/authorize"
SPOTIFY_TOKEN_URL = "https://accounts.spotify.com/api/token"
SPOTIFY_API_BASE_URL = "https://api.spotify.com"
API_VERSION = "v1"
SPOTIFY_API_URL = "{}/{}".format(SPOTIFY_API_BASE_URL, API_VERSION)
# Server-side Parameters
CLIENT_SIDE_URL = "http://127.0.0.1"
PORT = 5000
REDIRECT_URI = "{}:{}/callback/q".format(CLIENT_SIDE_URL, PORT)
SCOPE = "playlist-modify-public playlist-modify-private playlist-read-private playlist-read-collaborative"
STATE = ""
SHOW_DIALOG_bool = True
SHOW_DIALOG_str = str(SHOW_DIALOG_bool).lower()
auth_query_parameters = {
"response_type": "code",
"redirect_uri": REDIRECT_URI,
"scope": SCOPE,
# "state": STATE,
# "show_dialog": SHOW_DIALOG_str,
"client_id": CLIENT_ID
}
@bp.before_app_request
def load_logged_in_user():
user_id = session.get("user_id")
if user_id is None:
g.user = None
else:
g.user = User.query.filter_by(user_id=user_id).first()
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if g.user is None:
return redirect(url_for("views.spotify", next=request.url))
return f(*args, **kwargs)
return decorated_function
@bp.route("/")
def index():
return render_template("/home/index.html")
@bp.route("/spotify")
def spotify():
# Auth Step 1: Authorization
url_args = "&".join(["{}={}".format(key,urllib.parse.quote(val)) for key,val in auth_query_parameters.items()])
auth_url = "{}/?{}".format(SPOTIFY_AUTH_URL, url_args)
return redirect(auth_url)
@bp.route("/spotify/switch")
def spotify_switch():
# Auth Step 1: Authorization
url_args = "&".join(["{}={}".format(key,urllib.parse.quote(val)) for key,val in auth_query_parameters.items()])
url_args += "&{}={}".format("show_dialog", urllib.parse.quote(SHOW_DIALOG_str))
auth_url = "{}/?{}".format(SPOTIFY_AUTH_URL, url_args)
return redirect(auth_url)
@bp.route("/callback/q")
def callback():
if 'error' in request.args:
return redirect(url_for('views.index'))
# Auth Step 4: Requests refresh and access tokens
auth_token = request.args['code']
code_payload = {
"grant_type": "authorization_code",
"code": str(auth_token),
"redirect_uri": REDIRECT_URI
}
auth_str = "{}:{}".format(CLIENT_ID, CLIENT_SECRET)
base64encoded = base64.b64encode(auth_str.encode())
headers = {
"Authorization": "Basic {}".format(base64encoded.decode())
}
post_request = requests.post(SPOTIFY_TOKEN_URL, data=code_payload, headers=headers)
# Auth Step 5: Tokens are Returned to Application
response_data = json.loads(post_request.text)
print(response_data)
if 'error' in response_data:
print("redirecting")
return redirect(url_for('views.spotify'))
access_token = response_data["access_token"]
# Auth Step 6: Use the access token to access Spotify API
authorization_header = {
"Authorization": "Bearer {}".format(access_token)
}
# Get profile data
user_profile_api_endpoint = "{}/me".format(SPOTIFY_API_URL)
profile_response = requests.get(user_profile_api_endpoint, headers=authorization_header)
profile_data = json.loads(profile_response.text)
if 'error' in profile_data:
print("redirecting")
return redirect(url_for('views.spotify'))
print(profile_data)
print()
# Get user playlist data
playlists_api_endpoint = "{}/playlists".format(profile_data["href"])
playlists_response = requests.get(playlists_api_endpoint, headers=authorization_header)
playlists_data = json.loads(playlists_response.text)
# print(playlists_data)
if 'error' in playlists_data:
print("redirecting")
return redirect(url_for('views.spotify'))
# print(playlists_data)
# print()
user = User.query.filter_by(user_id=profile_data["id"]).first()
if user is None:
user = util.add_to_user_table(profile_data, playlists_response.text, access_token)
else:
util.update_user_playlists(user, profile_data, playlists_response.text, access_token)
session.clear()
session["user_id"] = user.user_id
session["user_name"] = user.display_name
session["access_token"] = access_token
return redirect(request.args.get("next") or url_for("views.rooms"))
###########
# ROOMS #
###########
@bp.route("/rooms", methods=["POST", "GET"])
@login_required
def rooms():
print(request)
if request.method == "POST" and "form-button" in request.form:
room_code = request.form["code"]
room = Room.query.filter_by(room_id=room_code).first()
# if user is None:
# return render_template("/room/rooms.html", error=errors)
return redirect(url_for("views.room", room_id=room.room_id))
user = User.query.filter_by(user_id=session["user_id"]).first()
return render_template("/room/rooms.html", hostings=user.hostings)
@bp.route("/create")
@login_required
def create_room():
room = util.add_to_room_table(session["user_id"])
return redirect(url_for("views.room", room_id=room.room_id))
@bp.route("/room/<room_id>", methods=["POST", "GET"])
@login_required
def room(room_id):
room = Room.query.filter_by(room_id=room_id).first()
room = util.add_user_to_room(room, session["user_id"])
host = room.host
members = set(room.users) - set([host])
if request.method == "POST" and "form-button" in request.form:
print()
print("CALCULATING INTERSECTION")
print()
header = {
"Authorization": "Bearer {}".format(session["access_token"]),
"Content-Type": "application/json"
}
playlist_id = room.playlist_id
if playlist_id is None:
# Create playlist
code_payload = {
"name": "Room {} Intersection".format(room_id)
}
playlists_api_endpoint = "{}/playlists".format(host.href)
playlists_response = requests.post(playlists_api_endpoint, data=json.dumps(code_payload), headers=header)
playlists_data = json.loads(playlists_response.text)
if 'error' in playlists_data:
print("redirecting")
return redirect(url_for('views.spotify'))
# print(playlists_data)
# print()
playlist_id = playlists_data["id"]
util.add_playlist_to_room(room, playlist_id)
all_user_tracks = []
all_user_artists = []
for user in room.users:
current_user = User.query.filter_by(user_id=user.user_id).first()
access_token = current_user.access_token
spotify_playlists = current_user.spotify_playlists
playlists = json.loads(spotify_playlists)
authorization_header = {"Authorization":"Bearer {}".format(access_token)}
user_tracks = []
user_artists = []
# Get tracks in playlist
for p in playlists["items"]:
playlist_api_endpoint = p["tracks"]["href"]
playlist_response = requests.get(playlist_api_endpoint, headers=authorization_header)
playlist_data = json.loads(playlist_response.text)
print(playlist_data)
if 'error' in playlist_data:
print("redirecting")
return redirect(url_for('views.spotify'))
user_tracks += [item["track"]["uri"] for item in playlist_data["items"]]
user_artists += [(artist["name"], artist["id"]) for item in playlist_data["items"] for artist in item["track"]["artists"]]
print(len(user_tracks))
all_user_tracks.append(user_tracks)
all_user_artists.append(user_artists)
# GET INTERSECTION
track_intersection = set(all_user_tracks[0]).intersection(*all_user_tracks)
count = len(track_intersection)
print("Track Intersection Count: {}".format(count))
if count > 100:
sample = random.sample(track_intersection, 100)
else:
sample = track_intersection
# print(intersection)
# Populate playlist
code_payload = {
"uris": list(sample)
}
playlist_api_endpoint = "https://api.spotify.com/v1/playlists/{}/tracks".format(playlist_id)
playlist_response = requests.put(playlist_api_endpoint, data=json.dumps(code_payload), headers=header)
playlist_data = json.loads(playlist_response.text)
print(playlist_data)
if 'error' in playlist_data:
print("redirecting")
return redirect(url_for('views.spotify'))
util.update_playlist_info(room, count)
# GET TOP ARTISTS
artist_unique_intersection = set(all_user_artists[0]).intersection(*all_user_artists)
artist_intersection = Counter([artist for user_artists in all_user_artists for artist in user_artists if artist in artist_unique_intersection])
print("Artist Intersection Count: {}".format(len(artist_intersection)))
top_artists = artist_intersection.most_common(5)
print(top_artists)
util.update_top_artists_info(room, top_artists)
return render_template("/room/room.html", host=host, members=members, room=room)
return render_template("/room/room.html", host=host, members=members, room=room)
<file_sep>/musical-intersection/templates/user/register.html
{% extends "user/user-form.html" %}
{% block user_form_title %}Register{% endblock %}
{% block user_form_details %}
Already have an account?
<a href="/login">Login</a>.
{% endblock %}
{% block additional_fields %}
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" id="name" required>
</div>
{% endblock %}
{% block submit %}
<input type="submit" name="form-button" value="Register" class="btn btn-primary">
{% endblock %}<file_sep>/musical-intersection/util.py
import random
import string
import datetime
from .model import *
def init_db():
db.create_all()
###########
# ROOMS #
###########
def add_to_room_table(host_id):
code = ''.join(random.choices(string.ascii_uppercase, k=6))
while Room.query.filter_by(room_id=code).count() > 0:
code = ''.join(random.choices(string.ascii_uppercase, k=6))
host = User.query.filter_by(user_id=host_id).first()
room = Room(
room_id=code,
timestamp=datetime.datetime.now(),
host=host
)
room.users.append(host)
db.session.add(room)
db.session.commit()
return room
def add_user_to_room(room, user_id):
user = User.query.filter_by(user_id=user_id).first()
room.users.append(user)
db.session.commit()
return room
def add_playlist_to_room(room, playlist_id):
room.playlist_id = playlist_id
room.playlist_datetime = datetime.datetime.now()
db.session.commit()
return room
def update_playlist_info(room, count):
room.intersection_count = count
room.playlist_datetime = datetime.datetime.now()
db.session.commit()
return room
def update_top_artists_info(room, top_artists):
room.top_artists.clear()
for ((name, uri), count) in top_artists:
artist = Artist.query.filter_by(artist_id=uri).first()
# print(artist is None)
if artist is None:
artist = Artist(
artist_id=uri,
artist_name=name
)
room.top_artists.append(artist)
db.session.commit()
return room
###########
# USERS #
###########
def add_to_user_table(profile_data, playlists_data, access_token):
user = User(
user_id=profile_data["id"],
display_name=profile_data["display_name"],
href=profile_data["href"],
spotify_playlists=playlists_data,
access_token=access_token
)
db.session.add(user)
db.session.commit()
return user
def update_user_playlists(user, profile_data, playlists_data, access_token):
user.display_name = profile_data["display_name"]
user.href = profile_data["href"]
user.spotify_playlists = playlists_data
user.access_token = access_token
db.session.commit()
<file_sep>/musical-intersection/__init__.py
import os
from flask import Flask
from .model import db
from .views import bp
from .util import *
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev'
)
app.config.from_pyfile('config.py', silent=True)
# ensure the instance folder exists
try:
os.makedirs(app.instance_path)
except OSError:
pass
app.register_blueprint(bp)
db.init_app(app)
try:
init_db()
except:
db.session.rollback()
| 867e96b683cba23d5fdf7782d9e394acb50e41b2 | [
"Python",
"HTML"
] | 5 | Python | stacytao/musical-intersection | 60e18e4efe5a024fa4d51e970dc8d917a19a5372 | 44e5bfeaec80511b9ea27e24777b16005e49a0cb |
refs/heads/master | <file_sep>import React, { Component } from "react";
import { Link } from "react-router-dom";
import ball from "../logo.jpeg";
import { connect } from "react-redux";
class Home extends Component {
render() {
const { posts } = this.props;
const postList = posts.length ? (
posts.map((card) => {
return (
<div className="post card" key={card.id}>
<div className="image-style">
<img src={ball} alt="" />
</div>
<div className="card-content">
<Link to={"/" + card.id}>
<span className="card-title">{card.title}</span>
</Link>
<p>{card.body}</p>
</div>
{/* <div className="card-action">
<a href="/">This is a link</a>
<a href="/">This is a link</a>
</div> */}
</div>
);
})
) : (
<div className="center">No Posts to show</div>
);
return (
<div className="home container">
<h3 className="center">Posts</h3>
{postList}
</div>
);
}
}
const mapStateToProps = (state) => {
return {
posts: state.post,
};
};
export default connect(mapStateToProps)(Home);
<file_sep>import React from "react";
import { NavLink, Link, withRouter } from "react-router-dom";
const Navbar = (props) => {
// setTimeout(() => {
// props.history.push("/about");
// }, 1000);
return (
<nav>
<div className="nav-wrapper">
<a href="#" className="brand-logo right">
Logo
</a>
<ul id="nav-mobile" className="left hide-on-med-and-down">
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
<li>
<Link to="/Contact">Contact</Link>
</li>
</ul>
</div>
</nav>
);
};
export default withRouter(Navbar);
<file_sep>import React, { Component } from "react";
import {connect} from 'react-redux';
class Post extends Component {
handleDeleteClick=()=>{
this.props.deletePost(this.props.post.id)
}
render() {
const post = this.props.post ? (
<div>
<div className="post">
<h4>{this.props.post.title}</h4>
<p>{this.props.post.body}</p>
<div className="center">
<button className="btn btn-primary" onClick={this.handleDeleteClick}>Delete Post</button>
</div>
</div>
</div>
) : (
<div>Post Not Found !! </div>
);
return <div className="container">{post}</div>;
}
}
const mapStateToProps=(state,ownProps)=>
{
let id =ownProps.match.params.post_id;
return {
post:state.post.find(post=>post.id===id)
}
}
const mapDispatchToProps=(dispatch)=>
{
return {
deletePost:(id)=>dispatch({type:'DELETE_POST',id:id})
}
}
export default connect(mapStateToProps,mapDispatchToProps)(Post);
<file_sep>const initState={
post:[
{id:'1',title:'Lorem Morem Poku 1',body:'Body 1 Body'},
{id:'2',title:'Lorem Morem Poku 2',body:'Body 2 Body'},
{id:'3',title:'Lorem Morem Poku 3',body:'Body 3 Body'}
]
}
const rootReducer=(state=initState,action)=>{
if (action.type==='DELETE_POST') {
let newPosts=state.post.filter(post=>{
return post.id!==action.id});
return {
...state,
post:newPosts
};
}
return state;
}
export default rootReducer; | c6caa3884c3d1aa13e17e8da837052ee4ef36c61 | [
"JavaScript"
] | 4 | JavaScript | furkanemrea/redux-blog-tutorial | 894f7e6f1eab1ff488612e7844fc08b19926f283 | 8748a893173278e96d3f95c9e7fe097dc1486cd8 |
refs/heads/master | <file_sep>import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { DealEntryComponent } from './deal-entry/deal-entry.component';
import { ReactiveFormsModule } from '@angular/forms';
import { BlotterComponent } from './blotter/blotter.component';
import {AgGridModule} from "ag-grid-angular/main";
@NgModule({
declarations: [
AppComponent,
DealEntryComponent,
BlotterComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
ReactiveFormsModule,
AgGridModule.withComponents(
[])
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
| e9bab9dc26d57cb3e2beaaf5d679f542f3e672e7 | [
"TypeScript"
] | 1 | TypeScript | sathyapv92/s | 8df32b74dfdc4311c5e26ba46d57a5d3b56b9780 | 6956dcde13d961b858e6b0e9d09420ab20b1167c |
refs/heads/master | <repo_name>kenoba10/Automated-War-Level-Editor<file_sep>/Automated War Level Editor/Unit.cs
using System;
using System.Runtime.Serialization;
namespace Automated_War_Level_Editor
{
[DataContract]
public class Unit
{
public Unit()
{
}
[DataMember(Name="id")]
public string ID
{
get;
set;
}
[DataMember(Name="name")]
public string Name
{
get;
set;
}
}
}
<file_sep>/Automated War Level Editor/Level.cs
using System;
using System.Runtime.Serialization;
namespace Automated_War_Level_Editor
{
[DataContract]
public class Position
{
public Position()
{
}
public Position(int x, int y)
{
X = x;
Y = y;
}
[DataMember(Name ="x")]
public int X
{
get;
set;
}
[DataMember(Name ="y")]
public int Y
{
get;
set;
}
}
[DataContract]
public class Level
{
public Level()
{
}
public Level(string title, string story, int width)
{
Title = title;
Story = story;
StartingPositions = new Position[8];
for(int i = 0; i < 8; i++)
{
StartingPositions[i] = new Position(width - 1, width - 1);
}
Tiles = new string[width][];
for(int i = 0; i < width; i++)
{
Tiles[i] = new string[width];
for(int j = 0; j < width; j++)
{
Tiles[i][j] = "";
}
}
}
[DataMember(Name ="title")]
public string Title
{
get;
set;
}
[DataMember(Name ="story")]
public string Story
{
get;
set;
}
[DataMember(Name ="startingPositions")]
public Position[] StartingPositions
{
get;
set;
}
[DataMember(Name ="tiles")]
public string[][] Tiles
{
get;
set;
}
}
}
<file_sep>/Automated War Level Editor/Window.cs
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Automated_War_Level_Editor
{
public partial class Window : Form
{
public static readonly string INSTALL_LOCATION = "./";
public static readonly float WIDTH = 618.0f;
private List<Wall> walls;
private List<Unit> units;
private List<Bitmap> wallBitmaps;
private List<Bitmap> unitBitmaps;
private Dictionary<string, Wall> wallDictionary;
private Dictionary<string, Unit> unitDictionary;
private List<string> undoActions;
private List<string> redoActions;
private string file;
private bool saved;
public Window()
{
Level = null;
InitializeComponent();
Bitmap bitmap = new Bitmap(map.Width, map.Height);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.Clear(Color.FromArgb(64, 32, 0));
}
map.Image = bitmap;
LoadStartingPositions();
LoadWalls();
LoadUnits();
undoActions = new List<string>();
redoActions = new List<string>();
file = "";
saved = true;
Application.ApplicationExit += new EventHandler(OnExit);
}
private void LoadStartingPositions()
{
listBox1.Items.Add("Starting Position 1");
listBox1.Items.Add("Starting Position 2");
listBox1.Items.Add("Starting Position 3");
listBox1.Items.Add("Starting Position 4");
listBox1.Items.Add("Starting Position 5");
listBox1.Items.Add("Starting Position 6");
listBox1.Items.Add("Starting Position 7");
listBox1.Items.Add("Starting Position 8");
}
private void LoadWalls()
{
walls = AssetLoader.LoadWalls();
wallBitmaps = AssetLoader.LoadWallBitmaps(walls);
wallDictionary = new Dictionary<string, Wall>();
foreach(Wall wall in walls)
{
wallDictionary.Add(wall.ID, wall);
listBox2.Items.Add(wall.Name + " Wall");
}
}
private void LoadUnits()
{
units = AssetLoader.LoadUnits();
unitBitmaps = AssetLoader.LoadUnitBitmaps(units);
unitDictionary = new Dictionary<string, Unit>();
foreach (Unit unit in units)
{
unitDictionary.Add(unit.ID, unit);
listBox3.Items.Add(unit.Name);
}
}
private void OnNewClicked(object sender, EventArgs e)
{
if (Level != null && !saved)
{
DialogResult result = MessageBox.Show("Would you like to save your current level?", "Save", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
if (file == "")
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
AssetLoader.SaveLevel(Level, dialog.FileName);
file = dialog.FileName;
}
}
else
{
AssetLoader.SaveLevel(Level, file);
}
}
if(result != DialogResult.Cancel)
{
WindowLevelInfo level = new WindowLevelInfo(this, true);
if (level.ShowDialog() == DialogResult.OK)
{
UpdateMap();
undoActions.Clear();
redoActions.Clear();
saved = false;
}
}
}
else
{
WindowLevelInfo level = new WindowLevelInfo(this, true);
if (level.ShowDialog() == DialogResult.OK)
{
UpdateMap();
undoActions.Clear();
redoActions.Clear();
saved = false;
}
}
}
private void OnOpenClicked(object sender, EventArgs e)
{
if (Level != null && !saved)
{
DialogResult result = MessageBox.Show("Would you like to save your current level?", "Save", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
if (file == "")
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
AssetLoader.SaveLevel(Level, dialog.FileName);
file = dialog.FileName;
}
}
else
{
AssetLoader.SaveLevel(Level, file);
}
}
if (result != DialogResult.Cancel)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
Level = AssetLoader.OpenLevel(dialog.FileName);
file = dialog.FileName;
UpdateMap();
undoActions.Clear();
redoActions.Clear();
saved = true;
}
}
}
else
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
Level = AssetLoader.OpenLevel(dialog.FileName);
file = dialog.FileName;
UpdateMap();
undoActions.Clear();
redoActions.Clear();
saved = true;
}
}
}
private void OnSaveClicked(object sender, EventArgs e)
{
if (Level != null)
{
if (file == "")
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
AssetLoader.SaveLevel(Level, dialog.FileName);
file = dialog.FileName;
saved = true;
}
}
else
{
AssetLoader.SaveLevel(Level, file);
saved = true;
}
}
}
private void OnSaveAsClicked(object sender, EventArgs e)
{
if (Level != null)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
AssetLoader.SaveLevel(Level, dialog.FileName);
file = dialog.FileName;
saved = true;
}
}
}
private void OnQuitClicked(object sender, EventArgs e)
{
Application.Exit();
}
private void OnExit(object sender, EventArgs e)
{
if (Level != null && !saved)
{
DialogResult result = MessageBox.Show("Would you like to save your current level?", "Save", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
if (file == "")
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.InitialDirectory = "./";
dialog.Filter = "JSON|*.json";
if (dialog.ShowDialog() == DialogResult.OK)
{
AssetLoader.SaveLevel(Level, dialog.FileName);
file = dialog.FileName;
}
}
else
{
AssetLoader.SaveLevel(Level, file);
}
}
}
}
private void OnUndoClicked(object sender, EventArgs e)
{
if (Level != null && undoActions.Count > 0)
{
string actionToUndo = undoActions[undoActions.Count - 1];
undoActions.Remove(actionToUndo);
redoActions.Add(actionToUndo);
string[] commands = actionToUndo.Split('_');
switch (commands[0])
{
case "startingPosition":
Level.StartingPositions[int.Parse(commands[1])] = new Position(int.Parse(commands[2]), int.Parse(commands[3]));
break;
case "wall":
if(commands[1] == "add")
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "";
}
else
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "wall_" + commands[2];
}
break;
case "unit":
if (commands[1] == "add")
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "";
}
else
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "unit_" + commands[2];
}
break;
}
UpdateMap();
saved = false;
}
}
private void OnRedoClicked(object sender, EventArgs e)
{
if (Level != null && redoActions.Count > 0)
{
string actionToRedo = redoActions[redoActions.Count - 1];
redoActions.Remove(actionToRedo);
undoActions.Add(actionToRedo);
string[] commands = actionToRedo.Split('_');
switch (commands[0])
{
case "startingPosition":
Level.StartingPositions[int.Parse(commands[1])] = new Position(int.Parse(commands[4]), int.Parse(commands[5]));
break;
case "wall":
if (commands[1] == "add")
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "wall_" + commands[2];
}
else
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "";
}
break;
case "unit":
if (commands[1] == "add")
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "unit_" + commands[2];
}
else
{
Level.Tiles[int.Parse(commands[3])][int.Parse(commands[4])] = "";
}
break;
}
UpdateMap();
saved = false;
}
}
private void OnShowStartsClicked(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 0;
}
private void OnShowWallsClicked(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
private void onShowUnitsClicked(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 2;
}
private void OnEditInfoClicked(object sender, EventArgs e)
{
if (Level != null)
{
WindowLevelInfo level = new WindowLevelInfo(this, false);
if (level.ShowDialog() == DialogResult.OK)
{
UpdateMap();
saved = false;
}
}
}
private void OnAboutClicked(object sender, EventArgs e)
{
MessageBox.Show("Automated War Level Editor(v1.0.0)\nCreated By: Distropian Games");
}
private void OnMapClicked(object sender, MouseEventArgs e)
{
if (Level != null)
{
float width = Level.Tiles.Length;
float tileWidth = Window.WIDTH / width;
float tileX = Math.Max(0.0f, Math.Min(width - 1.0f, e.Location.X / tileWidth));
float tileY = Math.Max(0.0f, Math.Min(width - 1.0f, e.Location.Y / tileWidth));
if (e.Button == MouseButtons.Left)
{
switch (tabControl1.SelectedIndex)
{
case 0:
if (listBox1.SelectedIndex != -1)
{
undoActions.Add("startingPosition_" + listBox1.SelectedIndex + "_" + Level.StartingPositions[listBox1.SelectedIndex].X + "_" + Level.StartingPositions[listBox1.SelectedIndex].Y + "_" + (int)tileX + "_" + (int)tileY);
Level.StartingPositions[listBox1.SelectedIndex] = new Position((int)tileX, (int)tileY);
UpdateMap();
saved = false;
}
break;
case 1:
if (listBox2.SelectedIndex != -1)
{
if (Level.Tiles[(int)tileX][(int)tileY] != "")
{
string type = Level.Tiles[(int)tileX][(int)tileY].Split('_')[0];
string id = Level.Tiles[(int)tileX][(int)tileY].Split('_')[1];
undoActions.Add(type + "_remove_" + id + "_" + (int)tileX + "_" + (int)tileY);
}
undoActions.Add("wall_add_" + walls[listBox2.SelectedIndex].ID + "_" + (int)tileX + "_" + (int)tileY);
Level.Tiles[(int)tileX][(int)tileY] = "wall_" + walls[listBox2.SelectedIndex].ID;
UpdateMap();
saved = false;
}
break;
case 2:
if (listBox3.SelectedIndex != -1)
{
if (Level.Tiles[(int)tileX][(int)tileY] != "")
{
string type = Level.Tiles[(int)tileX][(int)tileY].Split('_')[0];
string id = Level.Tiles[(int)tileX][(int)tileY].Split('_')[1];
undoActions.Add(type + "_remove_" + id + "_" + (int)tileX + "_" + (int)tileY);
}
undoActions.Add("unit_add_" + units[listBox3.SelectedIndex].ID + "_" + (int)tileX + "_" + (int)tileY);
Level.Tiles[(int)tileX][(int)tileY] = "unit_" + units[listBox3.SelectedIndex].ID;
UpdateMap();
saved = false;
}
break;
}
}
else if (e.Button == MouseButtons.Right)
{
if (Level.Tiles[(int)tileX][(int)tileY] != "")
{
string type = Level.Tiles[(int)tileX][(int)tileY].Split('_')[0];
string id = Level.Tiles[(int)tileX][(int)tileY].Split('_')[1];
undoActions.Add(type + "_remove_" + id + "_" + (int)tileX + "_" + (int)tileY);
}
Level.Tiles[(int)tileX][(int)tileY] = "";
UpdateMap();
saved = false;
}
}
}
private void UpdateMap()
{
float width = Level.Tiles.Length;
float tileWidth = Window.WIDTH / width;
using (Graphics g = Graphics.FromImage(map.Image))
{
g.Clear(Color.FromArgb(64, 32, 0));
for (int i = 0; i < 8; i++)
{
Position position = Level.StartingPositions[i];
g.FillRectangle(Brushes.White, position.X * tileWidth, position.Y * tileWidth, tileWidth, tileWidth);
}
for (int i = 0; i < width; i++)
{
for (int j = 0; j < width; j++)
{
string tile = Level.Tiles[i][j];
if (tile != "")
{
if (tile.StartsWith("wall_"))
{
g.DrawImage(wallBitmaps[walls.IndexOf(wallDictionary[tile.Substring("wall_".Length)])], i * tileWidth, j * tileWidth, tileWidth, tileWidth);
}
else if (tile.StartsWith("unit_"))
{
g.DrawImage(unitBitmaps[units.IndexOf(unitDictionary[tile.Substring("unit_".Length)])], i * tileWidth, j * tileWidth, tileWidth, tileWidth);
}
}
}
}
for (int i = 0; i < width; i++)
{
for (int j = 0; j < width; j++)
{
g.DrawRectangle(Pens.Black, i * tileWidth, j * tileWidth, tileWidth, tileWidth);
}
}
g.FillRectangle(Brushes.White, Window.WIDTH / 2.0f - (tileWidth / 4.0f), Window.WIDTH / 2.0f - (tileWidth / 4.0f), tileWidth / 2.0f, tileWidth / 2.0f);
}
map.Invalidate();
}
public Level Level
{
get;
set;
}
}
}
<file_sep>/Automated War Level Editor/Wall.cs
using System;
using System.Runtime.Serialization;
namespace Automated_War_Level_Editor
{
[DataContract]
public class Wall
{
public Wall()
{
}
[DataMember(Name="id")]
public string ID
{
get;
set;
}
[DataMember(Name="name")]
public string Name
{
get;
set;
}
}
}
<file_sep>/Automated War Level Editor/AssetLoader.cs
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Text;
namespace Automated_War_Level_Editor
{
public static class AssetLoader
{
public static List<Wall> LoadWalls()
{
List<Wall> walls = new List<Wall>();
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Wall));
string[] files = Directory.GetFiles(Window.INSTALL_LOCATION + "content/walls/");
foreach(string file in files)
{
using (FileStream stream = new FileStream(file, FileMode.Open))
{
Wall wall = (Wall)serializer.ReadObject(stream);
walls.Add(wall);
}
}
return walls;
}
public static List<Bitmap> LoadWallBitmaps(List<Wall> walls)
{
List<Bitmap> bitmaps = new List<Bitmap>();
foreach(Wall wall in walls)
{
bitmaps.Add(new Bitmap(Window.INSTALL_LOCATION + "textures/walls/" + wall.ID + ".png"));
}
return bitmaps;
}
public static List<Unit> LoadUnits()
{
List<Unit> units = new List<Unit>();
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Unit));
string[] files = Directory.GetFiles(Window.INSTALL_LOCATION + "content/units/");
foreach (string file in files)
{
using (FileStream stream = new FileStream(file, FileMode.Open))
{
Unit unit = (Unit)serializer.ReadObject(stream);
units.Add(unit);
}
}
return units;
}
public static List<Bitmap> LoadUnitBitmaps(List<Unit> units)
{
List<Bitmap> bitmaps = new List<Bitmap>();
foreach (Unit unit in units)
{
bitmaps.Add(new Bitmap(Window.INSTALL_LOCATION + "textures/units/" + unit.ID + "/editor.png"));
}
return bitmaps;
}
public static Level OpenLevel(string path)
{
using (FileStream stream = new FileStream(path, FileMode.Open))
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Level));
return (Level)serializer.ReadObject(stream);
}
}
public static void SaveLevel(Level level, string path)
{
using (MemoryStream stream = new MemoryStream())
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Level));
serializer.WriteObject(stream, level);
File.WriteAllText(path, Encoding.UTF8.GetString(stream.ToArray()));
}
}
}
}
<file_sep>/Automated War Level Editor/WindowLevelInfo.cs
using System;
using System.Windows.Forms;
namespace Automated_War_Level_Editor
{
public partial class WindowLevelInfo : Form
{
private Window window;
private bool create;
public WindowLevelInfo(Window window, bool create)
{
this.window = window;
this.create = create;
InitializeComponent();
if (!create)
{
textBox1.Text = window.Level.Title;
textBox2.Text = window.Level.Story;
comboBox1.SelectedIndex = window.Level.Tiles.Length / 8 - 1;
}
else
{
comboBox1.SelectedIndex = 1;
}
}
private void OnOkClicked(object sender, EventArgs e)
{
if (create)
{
window.Level = new Level(textBox1.Text, textBox2.Text, (comboBox1.SelectedIndex + 1) * 8);
}
else
{
window.Level.Title = textBox1.Text;
window.Level.Story = textBox2.Text;
int width = (comboBox1.SelectedIndex + 1) * 8;
for (int i = 0; i < 8; i++)
{
window.Level.StartingPositions[i] = new Position(width - 1, width - 1);
}
string[][] newTiles = new string[width][];
for (int i = 0; i < width; i++)
{
newTiles[i] = new string[width];
for (int j = 0; j < width; j++)
{
newTiles[i][j] = "";
}
}
for (int i = 0; i < Math.Min(window.Level.Tiles.Length, width); i++)
{
for (int j = 0; j < Math.Min(window.Level.Tiles.Length, width); j++)
{
newTiles[i][j] = window.Level.Tiles[i][j];
}
}
window.Level.Tiles = newTiles;
}
DialogResult = DialogResult.OK;
}
}
}
| 1f1c4c4210977948e12d609c5def46904091a8df | [
"C#"
] | 6 | C# | kenoba10/Automated-War-Level-Editor | 51ce539e806f4a40df8fcf0c8186e30eb7e3a250 | 8769b905025cbadea338f2de632d3c7f5f52daed |
refs/heads/master | <file_sep>browser = chrome
url = https://demo.opencart.com/index.php?route=account/login
username = <EMAIL>
password = <PASSWORD>
headless = false
incognito = true
highlight = false<file_sep>browser = chrome
url = https://demo.opencart.com/index.php?route=account/login
username = <EMAIL>
password = <PASSWORD>
headless = false
incognito = true
highlight = false<file_sep>package com.qa.opencart.tests;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.qa.opencart.base.BaseTest;
import com.qa.opencart.utils.Contants;
public class LoginPageTest extends BaseTest {
@Test(priority = 1)
public void loginPageTitleTest(){
String title = loginPage.getLoginPateTitle();
System.out.println("login page title : " + title);
Assert.assertEquals(title, Contants.LOGIN_PAGE_TITLE);
}
@Test(priority = 2)
public void forgotPwdLinkTest(){
Assert.assertTrue(loginPage.isForgotPwdLinkExist());;
}
@Test(priority = 3)
public void loginTest(){
accPage = loginPage.doLogin(prop.getProperty("username"), prop.getProperty("password"));
Assert.assertEquals(accPage.getAccPageTitle(),Contants.HOME_PAGE_TITLE);
}
}
<file_sep>package com.qa.opencart.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import com.qa.opencart.utils.Contants;
import com.qa.opencart.utils.ElementUtil;
public class LoginPage {
private WebDriver driver;
private ElementUtil elementUtil;
//Page Objects - By Locators - OR
private By username = By.id("input-email");
private By password = By.id("input-password");
private By loginButton = By.xpath("//input[@value='Login']");
private By forgotPwd = By.xpath("//div[@class='form-group']/a[text()='Forgotten Password']");
private By registerLink = By.linkText("Register");
//constructor
public LoginPage (WebDriver driver){
this.driver = driver;
elementUtil = new ElementUtil(driver);
}
//page actions
public String getLoginPateTitle(){
return elementUtil.waitForTitleIs(5, Contants.LOGIN_PAGE_TITLE);
}
public boolean isForgotPwdLinkExist(){
return elementUtil.doIsDisplayed(forgotPwd);
}
public AccountsPage doLogin(String un , String pwd){
System.out.println("login with :" +un +" : "+pwd);
elementUtil.doSendKeys(username, un);
elementUtil.doSendKeys(password, pwd);
elementUtil.doClick(loginButton);
return new AccountsPage(driver);
}
public RegisterPage navigateToRegisterPage(){
elementUtil.doClick(registerLink);
return new RegisterPage(driver);
}
}
<file_sep>browser = chrome
url = https://demo.opencart.com/index.php?route=account/login
username = <EMAIL>
password = <PASSWORD>
headless = false
incognito = true
highlight = false
<file_sep>package com.qa.opencart.pages;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.qa.opencart.utils.ElementUtil;
public class SearchResultPage {
private WebDriver driver;
ElementUtil elementUtil;
By searchItemResult = By.cssSelector("div.product-layout div.product-thumb");
By resultItems = By.cssSelector("div.product-thumb h4 a");
public SearchResultPage(WebDriver driver){
this.driver = driver;
elementUtil = new ElementUtil(driver);
}
public int getProductResultsCount(){
return elementUtil.getElements(searchItemResult).size();
}
public ProductInfoPage selectProductFromResults(String productName){
List<WebElement> resultsItemsList = elementUtil.getElements(resultItems);
System.out.println("total number of items displayed : "+ productName + ":" + resultsItemsList.size());
for(WebElement e: resultsItemsList)
if(e.getText().equals(productName)){
e.click();
break;
}
return new ProductInfoPage(driver);
}
} | 76ed98c118cf4255db6e7870b2e5fc0142db1122 | [
"Java",
"INI"
] | 6 | INI | anupsahu16/PracticePOMProject | cd93730b70d7fab42487c6accef4a2717c3dd0d5 | ce71b054444761ea7f82aea2938378e477b613b4 |
refs/heads/master | <repo_name>akariv/pylexia<file_sep>/pylexia/__init__.py
import Levenshtein
class obejct(object):
def __getattr__(self,attr):
scores = sorted([ (Levenshtein.ratio(attr,a),a) for a in self.__dict__.keys() ],reverse=True)
return object.__getattribute__(self,scores[0][1])
<file_sep>/setup.py
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'PyLexia',
'author': '<NAME>',
'url': 'URL to get it at.',
'author_email': '<EMAIL>',
'version': '0.1',
'install_requires': ['python-Levenshtein'],
'packages': ['pylexia'],
'scripts': [],
'name': 'pylexia'
}
setup(**config)
<file_sep>/README.md
## PyLexia
#### a Python library for people who can't spell
Without further ado:
from pylexia import obejct
class test(obejct):
def __init__(self):
self.permissions = [ "read", "write"]
self.counter = 2
self.amount = 31
if __name__=="__main__":
t = test()
print t.premissions
print t.conter
print t.ammount
Then:
$ python text.py
['read', 'write']
2
31
| 696e2a91fa1823561a6eafaf0d8c8d2cb12bf69b | [
"Markdown",
"Python"
] | 3 | Python | akariv/pylexia | ca509d3d1ebd1c36e78b8073d1b98233567858d2 | f303681b9f80f3881deee702df268eb8aec1e6ef |
refs/heads/master | <repo_name>taiyuanhy/threeMap<file_sep>/README.md
# threeMap
- 基于ThreeJS 实现的一个地图控件,主要是自己学习。
- 参照[THREE_MAP](https://github.com/lyqandy/THREE_MAP)并作修改

- [Demo](https://www.thingjs.com/uearth/threeMap/index.html)
<file_sep>/src/Const.js
let Const = {
worldWidth: 20037508.3427892,
earthRadius: 6378137,
tileSize:256
}
export default Const; | dc7adb667e9606c797d166830af0553347c9f075 | [
"Markdown",
"JavaScript"
] | 2 | Markdown | taiyuanhy/threeMap | 1e7ddd64eed4f4ccd348e1e3316427d34b3ddecd | 39fd5187785b8f46bf3a9f01a495e6aaa859e770 |
refs/heads/master | <file_sep>require 'yoga/version'
# Encapsulates all the logic of the gem.
module Yoga
end
<file_sep># Yoga
Yoga classes in my gym are available to book one day in advance. It is easy to miss a spot due to the high demand.
This program books classes for me as soon as they are available.
## Installation
$ gem install yoga
## Usage
$ yoga
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests.
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
<file_sep>$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'yoga'
require 'devtools/spec_helper'
| a7af71706f34c77dc1f6bd87b06094a53f91308f | [
"Markdown",
"Ruby"
] | 3 | Ruby | wilsonsilva/yoga | 8d826cbca06733334dc86dfc7a1bef02a1653b39 | 96ff61ad2750c123b2c84002fdd1ef51eb6e71db |
refs/heads/master | <file_sep>package main
import (
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
"strings"
. "wallet"
)
var (
_handleFunc map[string](func(shim.ChaincodeStubInterface, string, string, string) pb.Response)
)
func init() {
_handleFunc = make(map[string](func(shim.ChaincodeStubInterface, string, string, string) pb.Response))
_handleFunc["init"] = InitHandle
_handleFunc["payment"] = TransferHandle
_handleFunc["refund"] = TransferHandle
_handleFunc["reward"] = RewardHandle
_handleFunc["f-to-f"] = TransferHandle
}
type WalletChain struct{}
func (w *WalletChain) Init(stub shim.ChaincodeStubInterface) pb.Response {
return shim.Success(nil)
}
func (w *WalletChain) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
_, args := stub.GetFunctionAndParameters()
fmt.Printf("args=%v\r\n", args)
if len(args) < 1 {
return shim.Error("Incorrect number of arguments.")
}
subFunc := args[0]
if subFunc == "query" {
if len(args) < 2 {
return shim.Error("Incorrect number of arguments")
}
cmd := args[1]
if cmd == "basic" {
key := args[2]
return QueryHandle(stub, key)
} else if cmd == "total" {
q := args[2]
return TotalHandle(stub, q)
} else {
return shim.Error("invalid query cmd.")
}
} else {
if len(args) < 5 {
return shim.Error("Incorrect number of arguments")
}
cmd := args[1]
to := args[2]
from := args[3]
param := args[4]
fmt.Printf("subfunc=%v, cmd=%v, to=%v, from=%v, param=%v\r\n", subFunc, cmd, to, from, param)
cmd = strings.ToLower(cmd)
if fun, ok := _handleFunc[cmd]; ok {
return fun(stub, from, to, param)
}
return shim.Error("Invalid invoke function name.\r\n")
}
}
func main() {
err := shim.Start(new(WalletChain))
if err != nil {
fmt.Printf("Error starting Wallet chaincode: %v\r\n", err)
}
}
<file_sep>package wallet
import (
"encoding/json"
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
// func KeysHandle(stub shim.ChaincodeStubInterface, from string, to string, param string) pb.Response {
// req := &KeysReq{}
// err := json.Unmarshal([]byte(param), req)
// if err != nil {
// return shim.Error(err.Error())
// }
// keys, err := stub.GetStateByRange(req.Start, req.End)
// for {
// if keys.HasNext() {
// kv, _ := keys.Next()
// fmt.Printf("kv=%v\r\n", kv)
// } else {
// break
// }
// }
// keys.Close()
// return shim.Success(nil)
// }
func InitHandle(stub shim.ChaincodeStubInterface, from, to, param string) pb.Response {
req := &Wallet{}
err := json.Unmarshal([]byte(param), req)
if err != nil {
return shim.Error(err.Error())
}
if req.Available < 0 {
return shim.Error("available cannot be less than zero")
}
// if req.Ico < 0 {
// return shim.Error("ico cannot be less than zero")
// }
toBytes, err := stub.GetState(to)
if err != nil {
return shim.Error(err.Error())
}
if toBytes != nil {
return shim.Error("addr already exists")
}
err = stub.PutState(to, []byte(param))
if err != nil {
return shim.Error(err.Error())
}
// retList := make([]*CommonReply, 0)
// retList = append(retList, &CommonReply{
// Address: to,
// Available: req.Available,
// })
reply := &CommonReply{
Address: to,
Value: req.Available,
From: "",
Fvalue: 0,
Amount: req.Available,
}
ret, _ := json.Marshal(reply)
return shim.Success(ret)
}
func TransferHandle(stub shim.ChaincodeStubInterface, from, to, param string) pb.Response {
req := &CommonReq{}
err := json.Unmarshal([]byte(param), req)
if err != nil {
return shim.Error(err.Error())
}
if req.Number < 0 {
return shim.Error("number cannot be less than zero")
}
fromBytes, err := stub.GetState(from)
if err != nil {
return shim.Error(err.Error())
}
if fromBytes == nil {
return shim.Error("from addr not exist")
}
toByte, err := stub.GetState(to)
if err != nil {
return shim.Error(err.Error())
}
//if toByte == nil {
// return shim.Error("to addr not exist")
//}
fromWallet := &Wallet{}
err = json.Unmarshal(fromBytes, fromWallet)
if err != nil {
return shim.Error(err.Error())
}
toWallet := &Wallet{}
if toByte != nil {
err = json.Unmarshal(toByte, toWallet)
if err != nil {
return shim.Error(err.Error())
}
} else {
toWallet.Available = 0
}
if fromWallet.Available < req.Number {
return shim.Error("from addr have not enough coin")
}
fromWallet.Available -= req.Number
toWallet.Available += req.Number
fromState, _ := json.Marshal(fromWallet)
err = stub.PutState(from, fromState)
if err != nil {
return shim.Error(err.Error())
}
toState, _ := json.Marshal(toWallet)
err = stub.PutState(to, toState)
if err != nil {
return shim.Error(err.Error())
}
// retList := make([]*CommonReply, 0)
// retList = append(retList, &CommonReply{
// Address: from,
// Available: fromWallet.Available,
// })
// retList = append(retList, &CommonReply{
// Address: to,
// Available: toWallet.Available,
// })
reply := &CommonReply{
Address: to,
Value: toWallet.Available,
From: from,
Fvalue: fromWallet.Available,
Amount: req.Number,
}
ret, _ := json.Marshal(reply)
return shim.Success(ret)
}
func RewardHandle(stub shim.ChaincodeStubInterface, from, to, param string) pb.Response {
req := &CommonReq{}
err := json.Unmarshal([]byte(param), req)
if err != nil {
return shim.Error(err.Error())
}
if req.Number < 0 {
return shim.Error("number cannot be less than zero")
}
toBytes, err := stub.GetState(to)
if err != nil {
return shim.Error(err.Error())
}
if toBytes == nil {
return shim.Error("to addr not exist")
}
toWallet := &Wallet{}
err = json.Unmarshal(toBytes, toWallet)
if err != nil {
return shim.Error(err.Error())
}
toWallet.Available += req.Number
toState, _ := json.Marshal(toWallet)
err = stub.PutState(to, toState)
if err != nil {
return shim.Error(err.Error())
}
// retList := make([]*CommonReply, 0)
// retList = append(retList, &CommonReply{
// Address: to,
// Available: toWallet.Available,
// })
reply := &CommonReply{
Address: to,
Value: toWallet.Available,
From: from,
Fvalue: 0,
Amount: req.Number,
}
ret, _ := json.Marshal(reply)
return shim.Success(ret)
}
func QueryHandle(stub shim.ChaincodeStubInterface, key string) pb.Response {
stateBytes, err := stub.GetState(key)
if err != nil {
return shim.Error("addr not exist")
}
return shim.Success(stateBytes)
}
func TotalHandle(stub shim.ChaincodeStubInterface, q string) pb.Response {
keys, err := stub.GetQueryResult(q)
if err != nil {
return shim.Error(err.Error())
}
for {
if keys.HasNext() {
kv, _ := keys.Next()
fmt.Printf("kv=%v\r\n", kv)
} else {
break
}
}
keys.Close()
return shim.Success(nil)
}
<file_sep>package controllers
import (
"encoding/json"
"fmt"
"github.com/astaxie/beego"
"io/ioutil"
"net/http"
"net/url"
//"strings"
)
type OrderErr struct {
Code int `json:"code"`
Addr string `json:"address"`
Msg string `json:"msg"`
}
type OrderResponse struct {
Addr string `json:"address"`
}
type OrderController struct {
beego.Controller
}
func (this *OrderController) genError(code int, addr, msg string) string {
orderErr := OrderErr{
Code: code,
Addr: addr,
Msg: msg,
}
ret, _ := json.Marshal(orderErr)
return string(ret)
}
func (this *OrderController) Order() {
invoiceId := this.GetString("invoice_id")
//value := this.GetString("value")
callBack := CALLBACK_ADDR + "notify?invoice_id=" + invoiceId + "&secret=" + SECRET
urlCallBack := url.QueryEscape(callBack)
fmt.Printf("callback=%v\r\n", callBack)
fmt.Printf("callback111=%v\r\n", urlCallBack)
url := BLOCKCHAIN_RECEIVE_ROOT + "v2/receive?" + "key=" + API_KEY + "&callback=" + urlCallBack + "&xpub=" + XPUB
resp, err := http.Get(url)
if err != nil {
this.Ctx.Output.Body([]byte(this.genError(1, "", err.Error())))
return
}
defer resp.Body.Close()
if err != nil {
this.Ctx.Output.Body([]byte(this.genError(2, "", err.Error())))
return
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
this.Ctx.Output.Body([]byte(this.genError(3, "", err.Error())))
return
}
fmt.Printf("body=%v\r\n", string(body))
orderRes := &OrderResponse{}
err = json.Unmarshal(body, orderRes)
if err != nil {
this.Ctx.Output.Body([]byte(this.genError(4, "", err.Error())))
return
}
if orderRes.Addr == "" {
this.Ctx.Output.Body([]byte(this.genError(5, "", "addr is nil.")))
return
}
this.Ctx.Output.Body([]byte(this.genError(0, orderRes.Addr, "success")))
}
<file_sep>package controllers
const (
//BLOCKCHAIN_ROOT = "https://blockchain.info/"
BLOCKCHAIN_RECEIVE_ROOT = "https://api.blockchain.info/"
CALLBACK_ADDR = "http://192.168.127.12:9900/"
SECRET = ""
XPUB = ""
API_KEY = ""
)
<file_sep>package main
import (
"beego_web"
)
func main() {
beego_web.Main()
}
<file_sep>## redchain-blockchain based on Hyperledger fabric
redchain-block chain retained the essential and security characteristics of block chain technology, combined with the complex needs of the social network, to form a social block chain system suitable for self-organization, distributed node,mutual trust social network and corresponding economic and social system. It combines individual people with goods, trade, money, organizations and societies through block chain systems.
on the basis of the open source [fabric series](https://github.com/hyperledger/fabric), redevelope to understand the depth of the industry integration with tck which respectively support private chain, chain alliance, and public chain, realize chain security, digital and decentralization, as follows:
- the transaction process is irreversible, the results can not be tampered with, the transaction process can be tracked.
- all process use private key signature, permissions as endorsement, represent user's really behavior, the transaction process can not be interfered, so it realize authorized behavior.
- the transaction is decentralized,the participating nodes reach consensus status in the distributed network via pbtf (Byzantine algorithm) to ensure the stability and performance of the transaction.
- distributed ledger,transaction data which save to any data node and dynamically extended to new nodes.
- intelligent contracts which agreed on business logic can be easily expand.
## redevelop of the Hyperledger fabric as follows:
<p>fabric-ca and fabric can't sovle account, applications which isolated issues; </p>
<p>performance monitoring and intelligent routing of fabric nodes;</p>
<p>dynamic extension node and security issues </p><file_sep>package beego_web
import (
_ "beego_web/routers"
"github.com/astaxie/beego"
)
func Main() {
beego.Run()
}
<file_sep>package cfg
import (
"fmt"
"os"
)
func StdError(v ...interface{}) {
fmt.Fprint(os.Stderr, v)
}
func StdErrorf(format string, v ...interface{}) {
fmt.Fprintf(os.Stderr, format, v)
}
func StdOut(v ...interface{}) {
fmt.Fprint(os.Stdout, v)
}
func StdOutf(format string, v ...interface{}) {
fmt.Fprintf(os.Stdout, format, v)
}
<file_sep>package blockchain
import (
"fmt"
)
type Transaction struct {
Hash string `json:"hash"`
Ver int `json:"ver"`
VinSz int `json:"vin_sz"`
VoutSz int `json:"vout_sz"`
LockTime int `json:"lock_time"`
Size int `json:"size"`
RelayedBy string `json:"relayed_by"`
BlockHeight int `json:"block_height"`
TxIndex int `json:"tx_index"`
Inputs []*Inputs `json:"inputs"`
Out []*Out `json:"out"`
}
type Transactions struct {
Transactions []*Transaction `json:"txs"`
}
func (c *Client) GetTransaction(transaction string) (*Transaction, error) {
rsp := &Transaction{}
var path = "/rawtx/" + transaction
e := c.loadResponse(path, rsp, false)
if e != nil {
fmt.Print(e)
}
return rsp, e
}
func (c *Client) GetUnconfirmedTransactions() (*Transactions, error) {
rsp := &Transactions{}
var path = "/unconfirmed-transactions"
e := c.loadResponse(path, rsp, true)
if e != nil {
fmt.Print(e)
}
return rsp, e
}
<file_sep>CREATE DATABASE orders;
create table orders (
`sender` VARCHAR(128) NOT NULL,
`hash` VARCHAR(128) NOT NULL,
`value` INT(10) NOT NULL DEFAULT 0,
`verify` INT(10) NOT NULL DEFAULT 0,
INDEX `sender` (`sender`)
);<file_sep>package cfg
import (
"fmt"
"log"
"os"
"path"
"path/filepath"
"time"
)
var (
LOGFILE_MAXSIZE_DEFAULT int64 = 50 << 20
_logger_map map[string]*log.Logger
_logfile_maxsize int64 = LOGFILE_MAXSIZE_DEFAULT
_logfile_base string
)
func init() {
_logger_map = make(map[string]*log.Logger)
}
func GetLogger(typ string) *log.Logger {
if logger, ok := _logger_map[typ]; ok {
return logger
}
file, err := OpenLogFile(_logfile_base+"."+typ, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
if err != nil {
fmt.Printf("error opening file %v\n", err)
return nil
}
logger := log.New(file, "", log.LstdFlags)
_logger_map[typ] = logger
return logger
}
func InitLogger(logfile string, maxSize int64) {
var err error
var fullpath string
if filepath.IsAbs(logfile) { // start with slash, just open
fullpath = logfile
} else {
fullpath = path.Join(_base_path, "", logfile)
}
dir, filename := path.Split(logfile)
if filename == "" {
fullpath = path.Join(fullpath, "log")
}
_logfile_base = fullpath
err = os.MkdirAll(dir, 0777)
if err != nil {
LogFatalf("MkdirAll err:", err)
return
}
_logfile_maxsize = int64(maxSize) << 10 //单位是k
if _logfile_maxsize < (1 << 16) { //日志文件最小64k
_logfile_maxsize = LOGFILE_MAXSIZE_DEFAULT
}
log.Println("logfile size:", _logfile_maxsize)
startLogger(fullpath)
}
func startLogger(logfile string) {
f, err := OpenLogFile(logfile, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
log.Printf("cannot open logfile %v\n", err)
os.Exit(-1)
}
log.SetOutput(f)
}
func tmpLog(p *[]byte, format string, v ...interface{}) {
*p = append([]byte(fmt.Sprintf(format, v...)), (*p)...)
}
type LogFile struct {
*os.File
}
func OpenLogFile(name string, flag int, perm os.FileMode) (file *LogFile, err error) {
f, err := os.OpenFile(name, flag, perm)
if err != nil {
return nil, err
}
lf := LogFile{}
lf.File = f
return &lf, nil
}
func (f *LogFile) Write(p []byte) (int, error) {
fi, err := f.Stat()
if err != nil {
tmpLog(&p, "file.Stat err:%v.", err)
}
if fi.Size() >= _logfile_maxsize {
now := int64(time.Now().UnixNano() / 1000000)
curFileName := f.Name()
newFileName := fmt.Sprintf("%s.%d", f.Name(), now)
err = os.Rename(curFileName, newFileName)
if err != nil {
tmpLog(&p, "[RAW] rename [%s] to [%s] err:%v\n",
curFileName, newFileName, err)
}
newFile, err := os.OpenFile(curFileName,
os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
tmpLog(&p, "[RAW] open file %s err:%v", curFileName, err)
} else {
f.File.Close()
f.File = newFile
}
}
return f.File.Write(p)
}
<file_sep>WORKPATH=$(shell pwd)
OUTPATH=bin/
all:
GOPATH=${WORKPATH} go install beego_main
clean:
cd ${WORKPATH} && rm -rf ${OUTPATH}<file_sep>package routers
import (
"beego_web/controllers"
"github.com/astaxie/beego"
)
func init() {
beego.Router("/notify", &controllers.NotifyController{}, "*:Notify")
beego.Router("/order", &controllers.OrderController{}, "*:Order")
}
<file_sep>package cfg
import (
"fmt"
"log"
"os"
"runtime"
"time"
)
const (
LOG_DEBUG = 0
LOG_INFO = 1
LOG_WARN = 2
LOG_ERROR = 3
LOG_FATAL = 4
debug_str = "[DEBUG]"
info_str = "[ INFO]"
warn_str = "\033[036;1m[ WARN]\033[036;0m"
error_str = "\033[031;1m[ERROR]\033[031;0m"
fatal_str = "\033[031;1m[FATAL]\033[031;0m"
default_calldepth = 3
err
)
const (
Llongfile = 1 << iota //log调用者路径
Lshortfile //log调用者文件名
Lfuncname //调用函数名
LerrorExit //error log关闭程序
Lfilemask = Llongfile | Lshortfile | Lfuncname
)
//debug模块定义
const (
LDM_NONE = 0
LDM_ALL = 1
LDM_QUEST = 2
LDM_LOGIN = 3
)
var (
_log_level = LOG_INFO
_log_flag = Lshortfile | Lfuncname //| LerrorExit
_log_debug_modules map[int]bool
_log_debug_all bool = true
_log_current_module int = LDM_ALL
)
func init() {
_log_debug_modules = make(map[int]bool)
_log_debug_modules[1] = true //默认开启全部打印
}
func logPrefix(calldepth int) (ret string) {
if (_log_flag & Lfilemask) != 0 {
var ok bool
var funcName string
pc, file, line, ok := runtime.Caller(calldepth)
if !ok {
file = "???"
line = 0
}
if (_log_flag & Llongfile) != 0 {
ret += file + fmt.Sprintf(":%d ", line)
} else if (_log_flag & Lshortfile) != 0 {
for i := len(file) - 1; i > 0; i-- {
if file[i] == '/' {
file = file[i+1:]
break
}
}
ret += file + fmt.Sprintf(":%d ", line)
}
if (_log_flag & Lfuncname) != 0 {
fc := runtime.FuncForPC(pc)
if fc != nil {
funcName = fc.Name() + "()"
} else {
funcName = "?()"
}
ret += funcName
}
}
return
}
func SetFlag(flag int) {
_log_flag = flag
}
func AddDebugModule(module int) {
_log_debug_modules[module] = true
if module == LDM_ALL {
_log_debug_all = true
}
}
func ClearDebugModules() {
_log_debug_modules = make(map[int]bool)
_log_debug_all = false
}
func SetCurrentDebugModule(m int) {
_log_current_module = m
}
func ClearCurrentDebugModule() {
_log_current_module = LDM_NONE
}
func NaLog(v ...interface{}) {
if _log_level > LOG_INFO {
return
}
str := formatLog(LOG_INFO, default_calldepth, v...)
log.Println(str)
}
func LogDebug(v ...interface{}) {
if _log_level > LOG_DEBUG {
return
}
if _log_debug_all == false {
if _, exist := _log_debug_modules[_log_current_module]; !exist {
return
}
}
str := formatLog(LOG_DEBUG, default_calldepth, v...)
log.Println(str)
}
func LogDebugc(calldepth int, v ...interface{}) {
if _log_level > LOG_DEBUG {
return
}
if _log_debug_all == false {
if _, exist := _log_debug_modules[_log_current_module]; !exist {
return
}
}
str := formatLog(LOG_DEBUG, calldepth, v...)
log.Println(str)
}
func LogDebugf(format string, v ...interface{}) {
if _log_level > LOG_DEBUG {
return
}
if _log_debug_all == false {
if _, exist := _log_debug_modules[_log_current_module]; !exist {
return
}
}
str := formatLogf(LOG_DEBUG, default_calldepth, format, v...)
log.Println(str)
}
func Log(v ...interface{}) {
if _log_level > LOG_INFO {
return
}
str := formatLog(LOG_INFO, default_calldepth, v...)
log.Println(str)
}
func Logc(calldepth int, v ...interface{}) {
if _log_level > LOG_INFO {
return
}
str := formatLog(LOG_INFO, calldepth, v...)
log.Println(str)
}
func Logf(format string, v ...interface{}) {
if _log_level > LOG_INFO {
return
}
str := formatLogf(LOG_INFO, default_calldepth, format, v...)
log.Println(str)
}
func LogWarn(v ...interface{}) {
if _log_level > LOG_ERROR {
return
}
str := formatLog(LOG_WARN, default_calldepth, v...)
log.Println(str)
}
func LogWarnc(calldepth int, v ...interface{}) {
if _log_level > LOG_ERROR {
return
}
str := formatLog(LOG_WARN, calldepth, v...)
log.Println(str)
}
func LogWarnf(format string, v ...interface{}) {
if _log_level > LOG_WARN {
return
}
str := formatLogf(LOG_WARN, default_calldepth, format, v...)
log.Println(str)
}
func LogErr(v ...interface{}) {
if _log_level > LOG_WARN {
return
}
str := formatLog(LOG_ERROR, default_calldepth, v...)
if logger := GetLogger("error"); logger != nil {
logger.Println(str)
}
if (_log_flag & LerrorExit) != 0 {
log.Fatalln(str)
} else {
log.Println(str)
}
}
func LogErrc(calldepth int, v ...interface{}) {
if _log_level > LOG_WARN {
return
}
str := formatLog(LOG_ERROR, calldepth, v...)
if logger := GetLogger("error"); logger != nil {
logger.Println(str)
}
if (_log_flag & LerrorExit) != 0 {
log.Fatalln(str)
} else {
log.Println(str)
}
}
func LogErrf(format string, v ...interface{}) {
if _log_level > LOG_ERROR {
return
}
str := formatLogf(LOG_ERROR, default_calldepth, format, v...)
if logger := GetLogger("error"); logger != nil {
logger.Println(str)
}
if (_log_flag & LerrorExit) != 0 {
log.Fatalln(str)
} else {
log.Println(str)
}
}
func LogAlertf(format string, v ...interface{}) {
str := formatLogf(LOG_ERROR, default_calldepth, format, v...)
fmt.Fprintf(os.Stderr, str+"\n")
LogErrc(default_calldepth+1, str)
}
func LogFatal(v ...interface{}) {
str := formatLog(LOG_FATAL, default_calldepth, v...)
log.Println(str)
if logger := GetLogger("error"); logger != nil {
logger.Println(str)
}
//log.Fatalln(logPrefix(default_calldepth)+fatal_str, fmt.Sprint(v...))
}
func LogFatalc(calldepth int, v ...interface{}) {
str := formatLog(LOG_FATAL, calldepth, v...)
log.Println(str)
if logger := GetLogger("error"); logger != nil {
logger.Println(str)
}
//log.Fatalln(logPrefix(calldepth)+fatal_str, fmt.Sprint(v...))
}
func LogFatalf(format string, v ...interface{}) {
str := formatLogf(LOG_FATAL, default_calldepth, format, v...)
log.Println(str)
if logger := GetLogger("error"); logger != nil {
logger.Println(str)
}
//log.Fatal(logPrefix(default_calldepth)+fatal_str+" ", fmt.Sprintf(format, v...))
}
func formatLog(level int, calldepth int, v ...interface{}) string {
var pre_str string
var post_str string
switch level {
case LOG_DEBUG:
pre_str = debug_str
case LOG_INFO:
pre_str = info_str
case LOG_WARN:
pre_str = warn_str
case LOG_ERROR:
pre_str = error_str
case LOG_FATAL:
pre_str = fatal_str
}
post_str = " [" + logPrefix(calldepth) + "]"
return fmt.Sprint(pre_str, fmt.Sprint(v...), post_str)
}
func formatLogf(level int, calldepth int, format string, v ...interface{}) string {
var pre_str string
var post_str string
switch level {
case LOG_DEBUG:
pre_str = debug_str
case LOG_INFO:
pre_str = info_str
case LOG_WARN:
pre_str = warn_str
case LOG_ERROR:
pre_str = error_str
case LOG_FATAL:
pre_str = fatal_str
}
post_str = " [" + logPrefix(calldepth) + "]"
return fmt.Sprint(pre_str, fmt.Sprintf(format, v...), post_str)
}
//
func RunLog(tag string, start time.Time, timeLimit float64) {
dis := time.Now().Sub(start).Seconds()
if dis > timeLimit {
Logf("%v startat %v ,cost %v ", tag,
start.Format("2006-01-02 15:04:05"), time.Now().Sub(start))
}
}
func StatusLog(format string, v ...interface{}) {
str := formatLogf(LOG_INFO, default_calldepth, format, v...)
log.Println(str)
if logger := GetLogger("status"); logger != nil {
logger.Println(str)
}
}
<file_sep>package wallet
type Wallet struct {
Available float64 `json:"available"`
Ico float64
Version int64
}
type CommonReq struct {
Number float64 `json:"number"`
}
// type CommonReply struct {
// Address string `json:"address"`
// Available float64 `json:"available"`
// }
type CommonReply struct {
Address string `json:"address"`
Value float64 `json:"value"`
From string `json:"from"`
Fvalue float64 `json:"fvalue"`
Amount float64 `json:"amount"`
}
<file_sep>WORKPATH=$(shell pwd)
OUTPATH=bin/
all:
GOPATH=${WORKPATH} go build -o ${OUTPATH}cryptogen
clean:
cd ${WORKPATH} && rm -rf ${OUTPATH}<file_sep>/*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ca
import (
"crypto"
"crypto/ecdsa"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"math/big"
"os"
"time"
"path/filepath"
// "github.com/hyperledger/fabric/bccsp"
// "github.com/hyperledger/fabric/bccsp/signer"
// "github.com/hyperledger/fabric/bccsp/factory"
"csp"
"fmt"
"reflect"
"encoding/asn1"
"errors"
)
type CA struct {
Name string
//SignKey *ecdsa.PrivateKey
Signer crypto.Signer
SignCert *x509.Certificate
}
// NewCA creates an instance of CA and saves the signing key pair in
// baseDir/name
func NewCA(baseDir, org, name string) (*CA, error) {
var response error
var ca *CA
err := os.MkdirAll(baseDir, 0755)
if err == nil {
priv, signer, err := csp.GeneratePrivateKey(baseDir)
response = err
if err == nil {
// get public signing certificate
ecPubKey, err := csp.GetECPublicKey(priv)
response = err
if err == nil {
template := x509Template()
//this is a CA
template.IsCA = true
template.KeyUsage |= x509.KeyUsageDigitalSignature |
x509.KeyUsageKeyEncipherment | x509.KeyUsageCertSign |
x509.KeyUsageCRLSign
template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}
//set the organization for the subject
subject := subjectTemplate()
subject.Organization = []string{org}
subject.CommonName = name
template.Subject = subject
template.SubjectKeyId = priv.SKI()
x509Cert, err := genCertificateECDSA(baseDir, name, &template, &template,
ecPubKey, signer)
response = err
if err == nil {
ca = &CA{
Name: name,
Signer: signer,
SignCert: x509Cert,
}
}
}
}
}
return ca, response
}
// 测试生成根证书
func NewCAOut(baseDir, org, name string, isCa bool) {
err := os.MkdirAll(baseDir, 0755)
if err == nil {
priv, signer, err := csp.GeneratePrivateKey(baseDir)
if err == nil {
// get public signing certificate
ecPubKey, err := csp.GetECPublicKey(priv)
if err == nil {
template := x509Template()
//this is a CA
template.IsCA = isCa
template.KeyUsage |= x509.KeyUsageDigitalSignature |
x509.KeyUsageKeyEncipherment | x509.KeyUsageCertSign |
x509.KeyUsageCRLSign
template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}
//set the organization for the subject
subject := subjectTemplate()
subject.Organization = []string{org}
subject.CommonName = name
template.Subject = subject
template.SubjectKeyId = priv.SKI()
genCertificateECDSA(baseDir, name, &template, &template,
ecPubKey, signer)
}
}
}
}
// 从根证书文件读取的bytes来获取CA对象
func NewCAFromBytes(baseDir, org, name string, certs []byte) (*CA, error) {
var response error
var ca *CA
certBlock, _ := pem.Decode(certs)
//fmt.Printf("certBlock=%v", certBlock.Bytes)
parCert, err := x509.ParseCertificate(certBlock.Bytes)
if err != nil {
fmt.Printf("parse certs file error:%v\r\n", err)
return nil, err
}
test := isCACert(parCert)
fmt.Printf("test = %v, parisca=%v, keyusage=%v\r\n", test, parCert.IsCA, parCert.KeyUsage)
// parCert.IsCA = true
// parCert.KeyUsage |= x509.KeyUsageDigitalSignature |
// x509.KeyUsageKeyEncipherment | x509.KeyUsageCertSign |
// x509.KeyUsageCRLSign
// parCert.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}
// tca, err := NewCA("/tmp", org, name)
// parCert := tca.SignCert
err = os.MkdirAll(baseDir, 0755)
if err == nil {
priv, signer, err := csp.GeneratePrivateKey(baseDir)
response = err
if err == nil {
// get public signing certificate
ecPubKey, err := csp.GetECPublicKey(priv)
response = err
if err == nil {
template := x509Template()
//this is a CA
template.IsCA = true
template.KeyUsage |= x509.KeyUsageDigitalSignature |
x509.KeyUsageKeyEncipherment | x509.KeyUsageCertSign |
x509.KeyUsageCRLSign
template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}
//set the organization for the subject
subject := subjectTemplate()
subject.Organization = []string{org}
subject.CommonName = name
template.Subject = subject
template.SubjectKeyId = priv.SKI()
//fmt.Printf("template subject key id=%v, keyusage=%v\r\n", template.SubjectKeyId, template.KeyUsage)
// x509Cert, err := genCertificateECDSA(baseDir, name, &template, parCert,
// ecPubKey, signer)
x509Cert, err := genCertificateECDSA(baseDir, name, &template, parCert,
ecPubKey, signer)
// fmt.Printf("my parisca=%v, keyusage=%v\r\n", x509Cert.IsCA, x509Cert.KeyUsage)
// fmt.Printf("my cert ca test start ------------\r\n")
// test = isCACert(x509Cert)
// fmt.Printf("my cert ca test end --------------\r\n")
response = err
if err == nil {
ca = &CA{
Name: name,
Signer: signer,
SignCert: x509Cert,
}
}
}
}
}
// opts := &factory.FactoryOpts{
// ProviderName: "SW",
// SwOpts: &factory.SwOpts{
// HashFamily: "SHA2",
// SecLevel: 256,
// FileKeystore: &factory.FileKeystoreOpts{
// KeyStorePath: baseDir,
// },
// },
// }
// csp, err := factory.GetBCCSPFromOpts(opts)
// if err != nil {
// fmt.Printf("get csp error:%v\r\n", err)
// return nil, err
// }
// priv, err := csp.KeyGen(&bccsp.ECDSAP256KeyGenOpts{Temporary: false})
// if err != nil {
// fmt.Printf("ken gen error:%v\r\n", err)
// return nil, err
// }
// // create a crypto.Signer
// sig, err := signer.New(csp, priv)
// if err != nil {
// fmt.Printf("create signer err:%v\r\n", err)
// return nil, err
// }
// ca = &CA{
// Name: name,
// Signer: sig,
// SignCert: x509Cert,
// }
return ca, response
}
// SignCertificate creates a signed certificate based on a built-in template
// and saves it in baseDir/name
func (ca *CA) SignCertificate(baseDir, name string, sans []string, pub *ecdsa.PublicKey,
ku x509.KeyUsage, eku []x509.ExtKeyUsage) (*x509.Certificate, error) {
template := x509Template()
template.KeyUsage = ku
template.ExtKeyUsage = eku
//set the organization for the subject
subject := subjectTemplate()
subject.CommonName = name
template.Subject = subject
template.DNSNames = sans
cert, err := genCertificateECDSA(baseDir, name, &template, ca.SignCert,
pub, ca.Signer)
if err != nil {
return nil, err
}
return cert, nil
}
// default template for X509 subject
func subjectTemplate() pkix.Name {
return pkix.Name{
Country: []string{"US"},
Locality: []string{"San Francisco"},
Province: []string{"California"},
}
}
// default template for X509 certificates
func x509Template() x509.Certificate {
//generate a serial number
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit)
now := time.Now()
//basic template to use
x509 := x509.Certificate{
SerialNumber: serialNumber,
NotBefore: now,
NotAfter: now.Add(3650 * 24 * time.Hour), //~ten years
BasicConstraintsValid: true,
}
return x509
}
// generate a signed X509 certficate using ECDSA
func genCertificateECDSA(baseDir, name string, template, parent *x509.Certificate, pub *ecdsa.PublicKey,
priv interface{}) (*x509.Certificate, error) {
//create the x509 public cert
certBytes, err := x509.CreateCertificate(rand.Reader, template, parent, pub, priv)
if err != nil {
return nil, err
}
//write cert out to file
fileName := filepath.Join(baseDir, name+"-cert.pem")
certFile, err := os.Create(fileName)
if err != nil {
return nil, err
}
//pem encode the cert
err = pem.Encode(certFile, &pem.Block{Type: "CERTIFICATE", Bytes: certBytes})
certFile.Close()
if err != nil {
return nil, err
}
x509Cert, err := x509.ParseCertificate(certBytes)
if err != nil {
return nil, err
}
return x509Cert, nil
}
/// 以下为测试代码
// isCACert does a few checks on the certificate,
// assuming it's a CA; it returns true if all looks good
// and false otherwise
func isCACert(cert *x509.Certificate) bool {
_, err := getSubjectKeyIdentifierFromCert(cert)
if err != nil {
return false
}
if !cert.IsCA {
return false
}
return true
}
// getSubjectKeyIdentifierFromCert returns the Subject Key Identifier for the supplied certificate
// Subject Key Identifier is an identifier of the public key of this certificate
func getSubjectKeyIdentifierFromCert(cert *x509.Certificate) ([]byte, error) {
var SKI []byte
for _, ext := range cert.Extensions {
fmt.Printf("ext.Id=%v\r\n", ext.Id)
// Subject Key Identifier is identified by the following ASN.1 tag
// subjectKeyIdentifier (2 5 29 14) (see https://tools.ietf.org/html/rfc3280.html)
if reflect.DeepEqual(ext.Id, asn1.ObjectIdentifier{2, 5, 29, 14}) {
fmt.Printf("equal ok\r\n")
_, err := asn1.Unmarshal(ext.Value, &SKI)
if err != nil {
return nil, fmt.Errorf("Failed to unmarshal Subject Key Identifier, err %s", err)
}
return SKI, nil
}
}
fmt.Printf("oh no\r\n")
return nil, errors.New("subjectKeyIdentifier not found in certificate")
}<file_sep>package controllers
import (
"beego_web/db"
"fmt"
"github.com/astaxie/beego"
"strconv"
)
type NotifyController struct {
beego.Controller
}
func (this *NotifyController) Notify() {
sender := this.GetString("invoice_id")
hash := this.GetString("transaction_hash")
sv := this.GetString("value")
test := this.GetString("test")
val, _ := strconv.Atoi(sv)
if test == "true" {
return
}
fmt.Printf("sender=%v, hash=%v, sv=%v, test=%v\r\n", sender, hash, sv, test)
// err := db.InsertOrder(sender, hash, val)
// if err != nil {
// this.Ctx.Output.Body([]byte("error"))
// return
// }
this.Ctx.Output.Body([]byte("*ok*"))
}
<file_sep>package db
import (
"database/sql"
//"database/sql/driver"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
var (
mydb = &sql.DB{}
)
func init() {
var err error
mydb, err = sql.Open("mysql", "fabric:fabric@tcp(127.0.0.1:3306)/orders")
if err != nil {
fmt.Printf("open mysql fail, err=%v\r\n", err)
}
}
func InsertOrder(sender, hash string, value int) error {
_, err := mydb.Exec("INSERT INTO `orders` (`sender`, `hash`, `value`) VALUES (?,?,?)", sender, hash, value)
if err != nil {
fmt.Printf("insert sql err: %v\r\n", err)
return err
}
return nil
}
| 66dd112851523ce7d4bce984b2df1fdeda7673c4 | [
"Markdown",
"SQL",
"Go",
"Makefile"
] | 19 | Go | energicchainblock/redchain-blockchain | 8cb908f0deaffc66c95f27e8ccf7d0602e57e7c9 | 4f0198c6dae8db2d3ccdaf4343f7b53027c7853e |
refs/heads/master | <file_sep># Advent of Code 2017
Advent of Code 2017 solutions
https://adventofcode.com
<file_sep>fun rowToNumbers(row: String): List<Int> {
val split = row.split(" ")
val list = mutableListOf<Int>()
for (num in split) {
list.add(num.toInt())
}
return list.toList()
}
fun getVal(list: List<Int>, compare: (Int, Int)->Boolean): Int {
var x = list.first()
for (i in list) {
if (compare(x, i)) {
x = i
}
}
return x
}
fun getChecksum(spreadsheet: String): Int {
var sum = 0
val rows = spreadsheet.split("\n")
val gt = fun(currentMax: Int, listItem: Int): Boolean = currentMax < listItem
val lt = fun(currentMin: Int, listItem: Int): Boolean = currentMin > listItem
for (row in rows) {
val numbers = rowToNumbers(row)
val max = getVal(numbers, gt)
val min = getVal(numbers, lt)
val diff = max - min
sum += diff
}
return sum
}
fun main(args: Array<String>) {
val spreadsheet = """
1236 741 557 1029 144 101 1968 2159 1399 80 1139 1167 1695 82 90 2236
2134 106 107 1025 584 619 191 496 80 352 351 2267 1983 1973 97 1244
3227 179 691 3177 172 1636 3781 2020 3339 2337 189 3516 1500 176 159 3279
201 688 364 180 586 659 623 577 188 265 403 670 195 720 115 37
1892 1664 2737 2676 849 2514 923 171 311 218 255 2787 1271 188 1278 2834
150 3276 204 603 3130 587 3363 3306 2890 127 176 174 383 3309 213 1620
5903 3686 200 230 6040 4675 6266 179 5375 1069 283 82 6210 6626 6398 1954
942 2324 1901 213 125 2518 655 189 2499 160 2841 2646 198 173 1841 200
232 45 272 280 44 248 50 266 296 297 236 254 58 212 276 48
563 768 124 267 153 622 199 591 204 125 93 656 198 164 797 506
243 4746 1785 204 568 4228 2701 4303 188 4148 4831 1557 4692 166 4210 3656
72 514 1572 172 1197 750 1392 1647 1587 183 1484 213 1614 718 177 622
1117 97 2758 2484 941 1854 1074 264 2494 83 1434 96 2067 2825 2160 92
2610 1290 204 2265 1374 2581 185 852 207 175 3308 1500 2898 1120 1892 3074
2322 1434 301 2156 98 2194 587 1416 1521 94 1985 424 91 119 1869 1073
66 87 176 107 2791 109 21 92 3016 2239 1708 3175 3210 2842 446 484
""".trimIndent().replace("\t", " ")
println(getChecksum(spreadsheet))
}
<file_sep>// Solves both first and second problem
fun redistribute(banks: MutableList<Int>) {
val max = banks.max()!!
var index = banks.indexOf(max)
var blocksToAlloc = max
banks[index] = 0
while (blocksToAlloc > 0) {
++index
if (index >= banks.size) {
index = 0
}
++banks[index]
--blocksToAlloc
}
}
fun main(args: Array<String>) {
val input = "5 1 10 0 1 7 13 14 3 12 8 10 7 12 0 6"
val banks = input.split(" ").map { it.toInt() }.toMutableList()
val occuredCombinations = mutableListOf<String>()
var combination: String
while (true) {
redistribute(banks)
combination = banks.fold("") { acc: String, i: Int -> "$acc$i " }
if (occuredCombinations.find {it == combination} != null) {
break
}
occuredCombinations.add(combination)
}
val loopSize = (occuredCombinations.size) - occuredCombinations.indexOf(combination)
println("Number of combinations: ${occuredCombinations.size + 1}")
println("Loop size: $loopSize")
}
<file_sep>class Point(var x: Int, var y: Int)
fun main(args: Array<String>) {
val squares = mutableListOf<MutableList<Int>>()
for (i in 0..1000) {
val list = MutableList(1001, fun(_: Int) = 0)
squares.add(list)
}
val p = Point(500, 500)
squares[p.y][p.x] = 1
++p.x
squares[p.y][p.x] = 1
while (squares[p.y][p.x] < 325489) {
if (squares[p.y][p.x - 1] != 0 && squares[p.y - 1][p.x] == 0) {
--p.y
} else if (squares[p.y][p.x - 1] == 0 && squares[p.y + 1][p.x] != 0) {
--p.x
} else if (squares[p.y + 1][p.x] == 0 && squares[p.y][p.x + 1] != 0) {
++p.y
} else if (squares[p.y][p.x + 1] == 0 && squares[p.y - 1][p.x] != 0) {
++p.x
}
squares[p.y][p.x] = arrayOf(
squares[p.y - 1][p.x - 1], squares[p.y - 1][p.x], squares[p.y - 1][p.x + 1], // Row above
squares[p.y][p.x - 1], squares[p.y][p.x], squares[p.y][p.x + 1], // Current row
squares[p.y + 1][p.x - 1], squares[p.y + 1][p.x], squares[p.y + 1][p.x + 1] // Row below
).sum()
}
println(squares[p.y][p.x])
}
<file_sep>
fun isValid(phrase: String): Boolean {
val split = phrase.split(" ")
val ordered = split.map { it.toList().sorted() }
val set = ordered.toSet()
return ordered.size == set.size
}
fun main(args: Array<String>) {
val input = """
bdwdjjo avricm cjbmj ran lmfsom ivsof
mxonybc fndyzzi gmdp gdfyoi inrvhr kpuueel wdpga vkq
bneh ylltsc vhryov lsd hmruxy ebnh pdln vdprrky
fumay zbccai qymavw zwoove hqpd rcxyvy
bcuo khhkkro mpt dxrebym qwum zqp lhmbma esmr qiyomu
qjs giedut mzsubkn rcbugk voxk yrlp rqxfvz kspz vxg zskp
srceh xdwao reshc shecr
dcao isz wwse bbdgn ewsw qkze pwu
lbnvl lviftmr zqiv iadanl fdhrldn dlaani lxy dhfndrl fkoukx
raovmz pdysjsw hqps orsyqw rrwnzcz vrzoam jjljt
wgt gzi icpwp qeefgbe msadakj jbbrma sbj dufuujx zex
cfzx bvyu eswr hafcfy klw bgnhynv qrf aop
rzlq atrzcpb hpl pajjw cdxep ean aptzcrb rzcbapt
xogpf ucc nsukoz umtfbw xfvth ozusnk fopxg ubp iflb
xot nqcdyu kpwix szo cyxv hpmp hwtrc zso nyuqdc aha
mkzf cat tkjprc izxdggf obspan lmlbg bsyspf twox
lfmfrd ooclx tcl clt
dxvnyd nxwojj arutn eyqocj swzao tmh juvpezm
teu eman rlmdmk xkbodv fvrcm zorgy wmwe
hmo fdayx duciqf cgt duciqf
imjnv vfmsha cyrusow xjswoq nclrmjy sjxowq ynjrcml
rwbsay alsi bmzpvw ozq aduui nihwx glwdiz ixmkgfx
vtjzc ntkh zekj qrbkjhn zekj lyfnbg
afaig jqhli oie lhwyduh kqfnraz nfrzaqk mayfg iljqh
inb zum zmu dnl zjxg vrdziq ypdnsvt
uhbzmre mpdxm alkbmsq aopjmkl mqxenry ayvkrf zxvs qkfqva
fimjr ccv cnug crdsv
bqyve lhxdj ydu qbyve vihwjr vyodhc
vmng dyttyf noagpji tdtyfy ewiest ogg
kgscfj klmsv vmksl vmlks
qlvh veo wruft wtm fbrlvjr evo wvwmny dhp bvrlrfj lvt vgzuyyw
mxuro orxmu tivu tjdq ojjvju cdd
kjexme gxbysxp yxrum hinrklv fxehytd qkt tqk umryx nim
kywnux wab tzrft dsaz jgwuw dubarmi fle wjguvr umjp uzncwj mzz
qokwh zrda xywufk tbxhhj eejqaoa hwoqk zer hwt hbjxth xyf hmh
eregs qdx tdequa agrlrg mwwpba qjie yrjvhr txujk
iyot fxwdcb zvwfv vfzwv wvkw ncwbr wdejrr ltcdza
waix eza znmonya ldfghws ialwfvc dey ubsz uhbnh svgekg nonzyam
bryz tfbqn xznfmw xiplgww wwxigpl jxzcgxl rzyb
cqvl rrcoqxs staeuqr hzzow cwv tsvol dio coc ddavii uuojy
txbn qvkkyh gbqnjtq ndpkqr srt bkpqfmm ytycev ypcv bpqmmfk
uqkjmul dour zgq ztango yrrjhrg ufxnmuw
ekxbcv vkxbec xbcevk jiq bar
wczff qdu cwffz hhk wlvyg
zjlconc osgsro dajzo hqih ehml
hnio shccluw cpu ivaby tormn vkef abv vkef ivaby
xgbdeso xiizs omqwy sbtnnt khago evviclw xyu dtvg wsyxfuc humewp
cnzu bia vdyqrf wwb qveum hmh ouupgc owli
pjpmfxa dvd lxgh ndy gwph oebfkqv vtlxdg efl ekj dyn
mvan nmdkc ucyshia mavn ecst poo
oybm pjwm bmyo wovgu xykziaq obmy eiirhqd
xkvomx yxvv oxxpth elh vxvy lhe ycn
okxglw gmaangx gnxaamg yduzrr nzwxtnd rcxcu xjjvno yat cin gaxnamg yss
oicgs rrol zvnbna rrol
abb edpnxuo peoudxn bab ceay
ncpkfz gvwunb fckpzn caafx pkcfzn tsfl
fnrt ymenkpq wodubcm niv nvi ziluu cuowbdm zocg pdakwt mlzxkex nuxqclo
uouxcgl stgua otadr ideannq wizxunv iqsdpj mxddt ldst ucxogul
rbrwyhk wqoz zqwo ikwgexl atpu iza
smo yolp pcahlu muljxkq cbkljmz zlbcmkj zvbmgz eaiv ncv zplifm yplo
ocutdhz zmnaap llgv llzpl loavju guzkfq saay rxyhng cwxzx lcv anrnzs
etyzx tcm upxrtvd imyoiu rdpj fed dmm
gonqa szteh szteh razdqh phyff upf knfqfaf knfqfaf fpsgl kakag
mcju mixskop isrwat lcr nfyi lcr aaevr nfyi pqrbk gnful
xfmr fkmnq fbnhd mxrf litniid xbae frxm zcenf
yuh lzojtj rqsh hyu
vbjgql yeshsuv lokt efqota wpwjfu ykyq rxc fxxh ycqfkk gndts vdf
wnylmr kkuruxm azr xukrkum dohkwx dmdb
bjiyrwf dvf fdv vdf gnokekr
jsaq hcww iayqtu llv gdpxdrd hwlo nosjit wpm lcab fcgwr
fxjp bys nnf xzllckh bys hvojw zcwtgwz wye ccyvjv
grafa hbb ghk wkdpsf ufa uoqmysd
yvacf kssbff iovrm mvrio cfbpb avh zzje
gqd qmsen wkvrfz vhtsa zrwfkv gul zkvwrf
hrbi svaogb aogsvb bgrk hibr jbtkr
ljl ryc mrewrge yky
fcqyymt emk qcmyytf mcfvusb luy qany cbsvumf
oknt mcozuc ccmuoz uoccmz
uziil xobutwf acnof iqgwl diso
sekq fxbtsuv ddnnqg rnemlt dngnqd hhgjfus stxvubf
lajcp qgiw fyz blrlcd pviwv buh wnkk
wolqfk nvpapfc rwcqxfz xobno yzjfz irpj wolqfk wbnwjt
vmabj noiljne hhqf holxkbk swwzx ylgj lnmxy lqodhk abjvm bmsrf
bpnp yrz pjepxxs jlmhuy vihlx zacm inuazhc xsxjepp
tryl kryh eonvaad ucevssk umkxg lqej nswopjj svkeucs bmh stosxxz
cfdwd dmfdrvm ibuhsz nwtgmb pjt dmfdrvm cqdcm fzjjz afa ibuhsz
erwp abn jwx ynmkkj rhgg abn epd atqhs rst rhgg
jtnp cegdsoy gfuvfbg gdmn ahlsc
jgrp diu jrgp onjnml nojmnl vxockc
lakqyuw khq dcpiwt ykwlqua hkq plklx ujbckec hjcvur jnp pvyf
usuvoo jkih ylafyy yhio jureyj
uazisdf cnwlfnf ewodatr woaddkd wbla qmn atdrowe
bnyepaa ntqh xppe ydtsw ppex
yewjwsp jxylmtk ijese ewry ijese kbja nfml zeuwcsh juimz
qbvmf nca zsfreo uurgaiz twe fbqmv ncwi etdcsk atowfp
jeotslx kgdpzp wxlcww pdd dcn ddp
macllv ldl kyluine lbt hbxbr wxcaspp ezwvc qxkeu
ivg gxv zsf ucr uff yrz
tdlwbny bqlrlz tbynwdl lwtbdny
tnekq pdaievs ttwpfh xfm fcaa
zqqhl zbf fbz uqrv bfz ffwavhk foccg
vcw ebqdd cwv eddbq nrmq
hpiusz sizphu xzq sgyehk wgagkv hsygek
vagkxa iou frqdnnr ipcg uxvh vvh eskf katgpiq aqktigp gzvseyi
xkwgd kzfxk pgdy fmtvq ngf rshx zti pamviob ely knz
hwo rteohu qzwoe rotuhe wzb
bsqgg tid dti gtats dit
sjtux djwxv dljwjq xwvjd xnqfvx veqdrtl uxtsj nnkjn wnhilaf unirrp
fruuqjk gtote gooklg bzwhim zfnccmm ezipnf cxwdxa wfu fdca
zcyxb byzxc cxbyz pgcqco ivlxz
wrjh zfdinsf ihw xwosiah hdg xpiabno bilyy azdeczg javuwa
rinlv dcpt qhencba mmb njxw gadc
qwcpua qzyzt cxjsgh kumh byiimas qhsgf qytzz rqqruwp ismyiba xydcxz rwkscqa
xbzefi hltca ibzxfe fkx xizbfe wvaynts
oyuce vzk ouxvj gfh efgbv ubc nyb bxnbhd mtwboe whksy ovmrt
ljrebp tacn bpjler utphw wmfw rcnha
drdnic eyodes rcnidd yseeod
umxmsf kfroz ukhjin awpnnnu ooyyohh tuv rafano jze
bakz lfzpjyg gfkqcgn kzh zwpvk gqfngck
jpaony ojpnya hmro xaaz tovary aaxz iel pbg
swvbgc bbhjp yvrcddd rhj clfu eao afrkegn qvvb yvcx nxjmdo rcvtx
conbjy jeqtri wvujt jeqtri rkhllgw tsdt zowreo qxr qbpragn kuzmplw wvujt
jrpxyp hchljy rkowqb eeaf ltllebb gtksrwx iazx vnsfmc zzrxw hlcjyh
piehb cjdzt eqn kuje rls oaewoz lrqwt lcrrq
hdjowxv uknhlv hluknv pokxg
txiqxfr fyyp pyyf xfxtrqi tvm rtvby cfx trx nwrf kqrxtat alwot
wdaadr stexpow ardawd uejqxc
wwgwjel wwgwjel mtjt wwgwjel
mczx uua lgceb dqru vkcea tcet ruz
jkt yroojr qdrtdu wze ovwz fdmqnr xxsyfd kchytwl hctlkwy gyd
eif irnrce iamhxgh bmis uxye azrwdi sznv yuowb vdlqqxu
dxdjyj hngqwzs yhwku qhsctfe rhbc rchb tqhcfse
fxyxnzs qtxevin rvtxtc iqnxtve
zgbpk mwzxx bgpkz wkpkn
rjiym iub lcyw agbtlb bzhx osv rbtf
emmyu uoflio tinih skpqaj rbor gezbhhv ine mij qlqte uuj ycns
owmwc uhxv pyho ftjh jzsg blqn bszyo bob trbycy mkru
mwgz bbqsmpp fgzs bihhg bbn pjxxexs qrqmt htsxfwo qltqp vqqaxi
lpr wcvy sxjqq ltd rftdgv pdnog ymu
qhcos shuy icdhucu lrikh rwslv yxbgibl rcomhn wakirz
civdmee owlzocl vedecim rogmjnn pix pohcmk dsjm yworm
vzdpxp lvt inufv yofqt omm qfoty qrlseqy amkt kjcvg vgkjc
huhq quhh levzsws sjuun ofgqr cjhp nfxbbft rnt wtbd tbzab
tjftkx xpfcv hvftvhw lpypbjg batrn fhwhtvv uthl arbtn brb sthv
ogr uyuxdco bpjgir edztxv sxtgu jzfmx ihnauz zwegqkr kvkw
mhxthf pervvn gshy jig ezjteq ckkcpy gww
tiljyki rpe prcojy tjkylii moxu
pjsdqc lgqydfd lohck emrtejw axwmo wuuv rfi qzyncmw gjijdfb bljfd xrs
ywjab gynzi relf kziy xmsby izyk ocwoho kqnyh bwayj
bhjlz uonz jhmzuq eiajoos zjnbj tomj bmyv hjlbz fgw jjbnz
kszz xzw xzw prtznyb
ghzk vxhwt thxwv slwpayp qxegmi dawdwo kgzh
ibpcvuf wnuwxu sbf jsj bfjynl cdp jbylnf
epaxr vfhf hvff azepadz pwf sbo pgfzya hslyo rqqj rmklw hwtta
yyolko pwbvxvg xdwl yfje hftep kzzsr kho jeyf yvslxpw kfyv
xmk juyjxy eqno mdwklum reg dgn cirh wmxfyj bnxlgo dlobk
oyv gshqyot jgcqe dsf gyohqst gqgeojo egoogjq dmqpyp
sypianq yss lmhu ulmh itilh ndkda lhiit
qbxxl bxxql ikald nfap qixwbqq
jtqhqty ljysnl nwoj toa bmmyj pal
ahktew sxody nkvsf pbxyt baws wgwfwej bevgzm jus hcvajfy kzrb jwgwewf
jzsb szbj ujngwf nfuuf lfiuxdu uufnf orsy
vgo hto isstyul gau wsmxoqw
uxw itwf epaw hec wape hemol rpwyosc xzxmrll eetz zui kagca
mjncux muv rygdeis rygdeis
qgkqjvf iprzibd fkvqqgj llcrl vbh vlf lllrc zwrunt
dslsa wvoex eqbwj tjem gbx ayn xcan fnacl xggxon gnwjlh
yzosv hcxjiz yvon gcgd
bixpny ecln sda eymt bjiwk
rlcad lrdca adoqfzs rgty mds pwb kmwj
wkai pmryffq rrdmodc wgyx taz yxwg nkap
auynzwc vzg uapdv qkrh
ldmuysp oyu kpn ejbl mfifa bzs hwyn brlw qpzqx uyilao ysdumpl
czoxoj pwnultl wezolbw lyk aonesgb
nqy nhb nle yycp lgtbo ojf dytwyh ufa
rwr eph obg peh pejret prjtee ovgz
vdqf vdqf ycjrg ovzl lelbe vdqf
gvagdqm gvdgqam dmb zaxe nepzwn
emwh bkkbgec qwdgk mhvfsrf wmdfpp ekzuua
mbqw lgkyazt ckyhvnq uladwo owt
qwiwd pbo tkjoqda zapo dygqopv zzdlwfn
qty dhb iinncba ytq kvh idgoevt chx waq
ulffsvk vplsz ulffsvk uxsh cpwgxd ikgcacx nrirke uowcjvn
gknmxr grkxnm fco dilyyj grmxkn
saqxkh uhue nvu fef xsuxq ekyyoc bcaavd
qltwqa vrmpv vhra nof yprauc vkreojm eaq igiy mec
wvheiyg uthy gpvcs nhnjrne mqaejr tfnsly zfbhn entcc nystfl cpq
zxv jzk dwsjgrd gqqxhp xqxu naunwc yeh qzpkz awcnnu aoosa icadax
vpmqmg qmvpgm tqs mvpqmg
inehzu zwxeoy jxia fcyzxc hwikd
bzwnp kamsen ajpn kdls bzh xqcb bzwnp cmjnfa wmgx
hbuhc qgvhxy smzkxh zzebox hbcuh net wyrdppc yvgxqh
oeum oemu iyags xaipdi euom
tqljgoq ghtdhw xhnni lux qltojqg lki zxztda pcqjif acpzvwy
ydijaq kbyjxpu onyd hsfgz geqvbg
rwoih xog dtbzyr ryzbdt tdbyzr
vcdxf zosw pardxfz bmb mscmain lwfc jvq hbszcqh fxomsmm ahnugx
zutsemg pqzil ddv nsstz gmeuzst bedvy xkzzjpw xlqbd
xxf ltnnu yeb hbml agj meovtjr qrul kexerkw xxf
tqrpd hhcx bmdv nlmr pnu pajdtc rpatqi yekedx oeiuew epsshog
ttbfpv plairk toh jagfsg njnqpa tmwh vwqp irtxv
vdky uwc tkkkztp vdky vdky qlcw lza
rzie yundymy pwgx wtwtbg kpiw mewnb liveysj uvsbn
jgfvyny hacg pzra arpz uowswu puzsfu hoe heo vrq naup
hqv vrl uko qgpikho lligvxa wdld qgpikho
whvby yomxwj dieffc jkprinh dsaqy yfrnba woyq yexeb mjn cbszn xeswvvo
wowtgu rciyg rlas bra quyfec ihe thuu asxhscu bsbdpbi ogxosu
vydsaet tvnkjq piedkzj foeiqz zqivt iatsju tjnqvk drauaf vqitz invoz
cppn jqzw zmxr qksuas iifmjg xtkgf cppn cppn jpsd
nkifpsq cxdx bokxhm ebww kghagrp bofhrl grc cheuzyj
ibgrlvm hrcx jjuoh ipmt
hcoqkh fzt rgravb cimauj jxjq blct qhc vjxw pqpg qzp
jycxz xcv czxjy vxc
liljaur cgmg neldxb xfummcq yfhiukd dnqhl iolxn cmewhb
hpvoihj fkwokod txy uuktw vmqqb dpldzh yxmcay cyaxmy xycaym wekr
ccnaf wuxc ecadb vbgpt ccntf sezo skjdkbf fnctc
hqdtwho kdhyman bjtcjvr bwllva ncyffyr
xprn jrrvmj pdw yvexm ewbflbe eapml rvrmjj xmevy rxyzhf
wjcbpy qdgtcp cfjh muww fhg sgfdleo nelpte yucqa aavev
rci vqypsqt xmg rzii
gramh wwprtc ampdhw dajr
ovrm mdyhpbl mdylbph aykz
cbmo fxs nuugu guunu upt ljjuhjw nituh utp kxqc
rhabal rhabal rhabal vah lfrs
nrq qway ftzp rtjcks mbygdtd hsiqbh wypqb rtjcks cllp hsiqbh
ywa anhcf nvd puqkwg molrwck wsctx xvd molrwck
wox jzq jfen wcvus cswvu oxw irg lmu tpj viahm jesic
qenad neqad smlgi ydwzq ppdemvs ucyuf qtunm eoqx jlgv
sucpl nrdwbl ltvetok npbw ozzw hafyay sjmui sjmui jkqlq pyn pbuopx
nxgaiu ybyl meo kgh saqjaz xhbqr otelcyp vkwc
iqrl ldjlwvl ajhrl dnhutr gkknyqs mcvluet fgyu ogiz cxo aiunl orb
psd cyq xpoyqny yqc kozqh vonfd uhozwz pds hcpw
tvaxder tulwmw qiw avddbmh irog vynjzcc refx efxr emnvk
myjx npqk whm egw kpy igrrohg ukglx ldnuqw caqg ynx fckhnsh
dafv bkdoqg zcqvbco xgikoac cvbqczo
rtzhpwk ukuyp bayhzp upkuy ahbpyz
oarcuv pnlkxvw fqdkj hwzsz nauwl lpufibz vzfbgc unkluxy rwh xuknuyl
vxhsaj ppdxw qrswqtu ulwv uqtqwsr ppxwd
cww cww cww scu
wiiikwa bfpewt zbgxfkl iqpk tpbwfe aazdcxj ipqk icggn fwn fjr
net ovxuwpz yvzmzd yvzmzd
xgar czuhp vuhisaq fgrqxy evvrtf mnmar lsk
hld mxuedug itswju vmmejqx snzslqj toe bbmugph mgubhpb mowj nrjnzu
qbz ouhye hsldmp lcf hyhlrb ewvle zko
cke mupaq quapm eck
owu zdt lales tzd apjjo fhpx bmuktbw dvehpz
libvl zxypk azazc vtsom ohdzycb
kiowxnc scxygrf ckxnwio ycxsrgf
vcjj fqz lfawfx mps zhv qykch vhz psu zud spu fnpvkx
scfvum fuktgk tua ieosetl wwmjtt exnsw wwmttj plvd pfb kku pdbom
wkfw snukd wkfw gyaojdf bjw htagy cdsp
beh gatqxcu ibrooxr ssww orrioxb eenkqz
jlv affah mtbemf tylh aafhf
zqfajd uwzrw csouuip qzadjf
gsnlrw tcel hha tfbzrp ild aenqa
iirfxef kdux yvj vbzgj
ibx pfll rgkp nancij llpf xib gbkfy
uvw kkbavj pznsnk okigtxl ogitxkl eobbs xhaz wroabn ltogxki
bivdf lotvmoh vrb kpaeeue tdab qhukcb qmy kuqf kesu
egs hbsfeu esg twxko uib
ocraimu qilp ijmx eco nhevqp juxf ksejr bcqqau uhpt
pyx jmpglf juokd dxszjw cml vcjge pfg
gxwrt btmimse dkpbha idmz mtignka ngakmti
dpjhm jyalra hukf imocr lkgt rqywn quhe fukh
nbau xyc bdh yni xaawxm cyx xwaaxm akx gyodqe htbifc
bywdxe bfrp rvb rndl onal jghiwb nuta aint qlciwcx
fpic yrqce land soxhci qzc zoebsq hcdohcc fzhcl iyxb dqinum hchdcoc
zok ghgp zok lmk
ozfz zofz dkdekzb sqc
gfti zuqvg cexmtyl qwuqnj stepb erduqhy cuoizcs qudyreh kqvfdd guzqv
jrugz jzugr lmqu jgihgo hjfbz duxkn unxkd
ckiys dbqmi ckiys ckiys
iylp uvvdp pluifaa djo
esxec rwvel djxppqf jymwt ilm aiz upn aiz wrfefwi rwvel
nitgjr pokxuy puhdwg qtxpb veylp zqvzkbd lrvpcgu zuy rnigjt ibci
jboyzq ogcldr hlon ywav jqqtz qjzqt vyaw cok
aqdw jxn hqknh azbylg
jya qpxtmsj hqrtsgg qjtpxsm
pofcs sxw dlvru dlvur swx
yphvvb qqyyfsp sjkbff dqyerxe jxzes oof
pwbya txk bbwsj ywgimd kmdpc bawpy lbnt
bkbazff ldmaq tyfl acqurpy ndnrp
asw ctiv mnxzyc weeuwb gsn bzk irbyhxl cgqomj izy zbk
yrxcrbt bcrryxt pofe wwzl
vuaqez kbtuyai vuaqez dxqud uvo gmhtg dxqud
tpzs gqdxpxo zzpgta uurjx xpqxodg
cil lsv vznqw vro zqzvjhm jhgauzw uxnwk lci zpgpu frjvyzo tsv
zfvcuim gwn gnw dxfppok
btb goof iwadca aac tbb jha uvzi
qah ned ipmure kyta ffhrwe njz paq kaag xmlui
rkmw vrblwyy gpax hxsf zpbza gypuwf jbib ypcjwd vrlybyw
yfjljn uxpvg huik jsnah nkhsg yfjljn lqzsz
hagjlqx agnax jqalxgh rvjgtc mjrmph azznzcq gxajlqh
ipki bhoabp rmiyl dmjyxl zzsmap aju
tyjrr rigrf ciq qic avmwu jtr wpq
vuf cosgytm toycgms ufv qzpcbrs
epzgxr lydrsj ezxrpg expzgr
ecm prj kmak makk jpr
ccwyq txy okj matxa socoa
zrjphq gigayv ywkfmru yrwukmf fxjjrha gqkxx zhjy tisutx kufrywm izjfj igg
lfhgsro gsroflh wrpo lofhgsr
kgkgj wkhnab ubrjaoa ubrjaoa ubrjaoa ggdgh
hztutpn epnqmz ffcroq mnqpez niibpn kdloak xjui ozttj lyzsc pzgq inpnib
kruz sjqp mmd hhdxjgc mauouma asevvo upjwqi hxcgjhd etqzagp
zylf qime cho oraid svytv gqrjufv mker cho vnkyiin tjms
dotjul qyv hnh cibtg gdpauyx wzp
fabtira ejxoeor cqyethv ndjrq hnxn joq otng lrr csytrub
txhgepd fwdaanm nawdamf pxine qqrn pronw exnip qwkimt rvy
kuxzhi jln urzxtw rzu ebsuylm tscru qwlhfgq nnu nuchvz vuht
cqgu camlr umkltcf stx izp rtdwxff wkfvs
jhje cxix lefcrsu nebv idfzhic xqri xkft
utzxb znb ietupd uqgbhje aobip oawjwm hetyan uqtqv hpwzyri kwxyu
jvzvbt xuyvp aegdkb srbw bzabpf lyfriez cruyfu
nhi nih aeb ihn
hcf zypt djcm pkjx pvhh
rhvxcfk exydvk ids hybme hnk yfchvs mjbo meocn
rpboxr rxoprb hdzje zhedj
ziildbo apzvatr vsv isndq ebxyy ntm tdttg wkvdh qnids vkdhw xxolip
ywu uyw ipcjz pjzci xjn kvgk vsocprw
euzo njlpv ndrlhi drlnhi ivmjkb fjrtxta skvgmrd
gbyvj dkck gevpfvb lhadhx rgjcdn yraxh bdk oen vqryd bkr
vgkp hncttxb wgxh gdyjo bbdfzvc xhgw rznzgda yxrrlo gxhw
ifjlb fpecyic svhjp ilmj oxgr svhaf
vbqky lhccj xtmm xzjyykn oqmdq qywir bswly
euxxziv totzer vsxfx leo djho uoeaz edaig fbu lumbi
ooqtwq pvo kid vpo jxin bod btqc fbyuz
jhabi mronu htqqyz umjcbv sgnbp wyn cetmt pcjf
tnrkcyl dduuhxh rylkctn pwj rtynkcl mzzfomr
rxx ldqffi ulappk nltawbn tplhb kyb cqyi
vzkw gviooah vxh xeae ohvcad oaiwcj dkx
sdofdjt hcifv dqws sia mlwm vfich kavh myzue roops mzuye
uxs nlbmjp nlbmjp tlaxa tlaxa
ynnisp twx xtw jgkc yinpns
kumorsm wav xhx bpvz clqc ffmadzl ndny ymslo lobv
ljzabj tqhves mezh pwn wue dwfqq lynvtt boeknvi xqbd pkud tzlanis
lgq qiikzl oihnsr pivtjmu qhic yvmeebg rxu qgl yuxnqse dvu faxqez
ldk mlwja vmdqr yzlxiua amlubt ejmzfx nonm zhkxbn gaqbnqq
ttc ctt kneknx smtnaft abljip tct
uybhbiw zwojzlm cfxoopp abulenj znz zzn opllzmm yufk witwxzp
qvkybwi rdbxb qiuizmo fqgne jgot jxz dqhapn
vzinf ehaley amnk laheye invfz
pedakl ivld agzyhr wmzba tzzzg bazwm wjwgux thrnxkn
cmyhae nwfs nfsw kmh pxkaffq
vdf szupev tyunp qiiu deevxmy wozvtt nelnr kgdexy gparqj hajavz biizn
pwspk skpwp ontbjee pkspw cfbj
ihsmh djxtak wkzllao oyr djxtak prc
uhvihqq jrgf hdfek pdrfpt tghz gthz awae wcygi wujti svq fhedk
gnfhsj odqlt netmsul rviio nkzw nkzw
xyvc clxw cyxv lxcw
duegck pkviu npwsp zdx wpvn dmxgnv ixv fybs xteru
vih kgk hads boaddu daiwo hozoufv nef vtcplc isiw
tzqoo dqlgvno jzlay sywx ecej addt ecej addt mnfcu
ymgmby zegudpx ipsjai ger wcwjw brzebb
eqekxlx itra xekelxq exqkexl
rciu ojaa ircu nxjga puvmwou remgu
sltth pprimb slnxopq avtir hvpv ppww fhfap wisn kzs jcuuuuf
xbppc ydpbq zhjh oym iljzvk vsb
ueye shtps uccehi ccheiu dqm yeeu
gwywf lcpv qza qza gzuovj jfzffyh oybfxqv
aawi ynsvdco azdoz cqr tnyquq xlyvbx eca kcalpes
zumgzhy rou kguqa vubw bwgd qprxcg etnbev nqmi
fyd tuoz uwclqn cgl lrpkf irz dizv nxze clg jghx jbpt
kwuanos eorjr tcahp kwuanos cyrpfji zxayggd kwuanos jkqt qqvbork lizk
vtu ovje vhg ovje vtu zcy hrhtr puawfgv
bliz exp wot svxv epx
jiqgxwj yips hjsatc jgsrno msfp vxvbt bba bqmw xjgpgog
vpvypp ggwp wggp gndp hedpse afji hcqgof
hxueubt hiynoa qqzaj ohb qway
akq nfnes sdrlza nfnes weq
udxpdpx gctuv llhxuow rqtetm hdbnpte oebapv civy oeobu ftgivd pykj
pbgbvn jgmr xrz dfn gosjobw ndf
gnf dtbsnc fwcmml tscdnb fgn qgadusl eifpk
vmnv yuxrup qcphi tanc tnca kjrv cphqi
hclggs sghglc fgplp odn pfglp emkrulf whwtmbs qnuyg
wcxtr ani ain sha hsa zxbkf bzxokat qezo ljqxi xqcwfmd dxo
waiq smpbu dbyka uibxjrg nze wiqa rfpts ddjsjv jqqjez bpusm
lpcxf vsbj owjwc tuqj vkrgrh jsjdepv oil lxrjox frsxsi clr
vzunp prwk nnd rfs vpuzn
pqpqv lvsk sqxf nhobsm hakbn ywj
xxu uxx szqnmi lnwtmx
akq nmlw fupwsth jduvhva
nac wwlxqck hpbce vxxqa fyp xvxqa kxwclqw yvlmv bfwi
pzxjbj nvwv mdooiez vvftp enjrsck iypu uhru fpx omtd
llxgp qwf pwaj cuhb scloot hbcu jgp vjw ooclst
sisd akawvzd wvdzkaa gyoij ikt eeeosb jiwiup
tche vxj sbctqv jvx gosur usgor ibo yqxo qqgd zspl
cidd welisl fxblxqk qxbklfx fbdoqcz glhq iylodvz zvds ghlq
cnsa hrxst mrnkqtj bptq jmi cpbcofs kveyeur uzmga modphm rtx kntqjrm
dvyup usfaq rtghoec bvcos fqsua zohwwg
onf vncybi dlaxni oqyqqkn
okfwa qyyx ebnv llql nphq etdt ytgivlo jwgwz kiob
ann vqnqvpx wth lpwid bjvzw xpwqxcj azg ioeyzzp onwf
smy epzomx xep yid zctvrfj astdj cfg fgc eriuxt
rljqgin wzobzrh cuwtx vcsbx tmg tuysq vxipgho
ewp rsrnsj wgeyin lrji ddgt utol xxwut fjiwopa
upu ftvqbk tfkvbq fdwga rmu puu hbiasjw
cfl lmqkb lfc wbtlfi uqsjs ejgmphi tbliwf nzcela gzb
zop unwmiu acull mkwh hvruknw rfk mmhaz iqmenq fifino
iczua bjut tlgf zicau jtbu
mtka ipd mdifj kps
irqkysw xfsjl tedx yckkbx iktxb sqxn pbfvubv uudzppz
mdrn cihat wcext kufs awwtjok pfjg
wdevt tyo zzbp pqlqq wdevt
yhatqkv ntuhw tdfd buxazh xbcsv bas gkv rbzi tddf jbj bsa
malip hiiy qezz yhii wlfojre
zqnfll bssveq lprwbep bhqml tztbt
npnxotu yupdytb jptqo klfydfe fpucmfq svxcqr unopxnt
gdpz gwj iytiohu efk ctjzf asade abhotq brmhu tbtdur zzksbh
kxft klzslf tjdzciy lzslkf
ejei ezmemvg xlt zte tbwhz dgnfpao zotck wus uaz gbwbb
dgednf vypmbs eiytot empfmny
uopmui uehue wdvzt adpfcif mutl ifaztka vydi xumtz orstno
dleero olxiq gxnlfm nfmxlg wloeavr olhrwg hrjd yicj ymyeex qav gxyjgfq
hevj rqcne zycgb qgqtn rqcne ptfvu yyyu zlm hevj
zrkhuh sttnkt hkuzhr vqtu
ppsfm kcao qjq dgadglx cxaawjn pbucfu fed qgioarc dfe ricoaqg
vmawf oktunea zraoir gkt zraoir jcvkqoq
mqgml ecawug ugwace szwul iwbmooj owmiojb
auggaw cypcuw npci vuyxijd pofswjx vdkrgx xylk rom ksj
qmwx jgsrdj ikva xzxw avik
zzhcqu rbg pywjdn wyndpj zchuqz
wzd wqycftu yldezp zovuy oydia hovewe
kfid qkkk thak qhbf rvzlzvu uuxh pbj hkat gow oeqcw knqqzha
sua itv hfpg bdqye bznlrk hfpg bdqye kvir kaai ggtz jqn
ulggl guitamm tkpckso fupacz otxtqpd jxnqc
ueesb ndyik vjftz jgqqv nrcf
krh dqpmsw fybzynl zhjbvkw exefc rhs neq ldprb bhhvxm pjwirun
ymavl qwxr yavml wagwc ekokrpq zewppw iumcgin cxdvwx
wwdukav kuawvwd kowv dkwvuwa
eazot bil tzu vdwwbm fvauwrq
esq tixokph yspf ztoxfut lgzush pwv swh pwv auqhuu tixokph
pdbeyxi poio mugfkb brwbbx aao uszw fokjeb uswz
sbs ryjr ptispi tvnhu htunv vthnu
czjmg hbdjhvi jrkoy fpgwc syafy aar kvnq eaecsb wqzpx
twtp dvl uvyje qtlzj dsvyr qpjnj eyoigx bhgpccy gwn dtuf
mxit xunctu vbyks wmqc jriuupl ybvks uncutx nsoxwrb ykt prc
yye mgf uhc irowpc dsdv iwaxod ftavlj dxzp tcch tcch mefz
rxe xwrrgl xwrrgl duu rxe xbbgoe
ucsz akswcd ojrmqq cox hgfh lxwu ltnnf cenikcp
opjhdp svwezr svwezr opjhdp
qojlkl ircxqnt utfmdg fcvr vehkcvt ufmzcpv xwlh ddavv xel bwlz fii
rzkayeh iursm zhily hdnq fqydfvt uwoy hptpiqu tdqy bgr xdr
ymruz umzry hbltwya jhwhzk flh tahylbw bdbaimb qscbp ntkuf
uxpato owsqyao vaog oenomkc usrmnc epua vzkppls
qxqczbk qyguz alawj xgjawtw wxtjgwa snfcdmz
fjfgos rmpd mgs vbk dlls jkljao eoovdfb ucdvaoq qmjmqku ney porr
nmcrqz zcoxpk dlnzksd ymh zyg spxss ruyk bychq gsgv eusiuid mnrqcz
jbzadnx lzl sdamer okoico frqisrm lxet agriw
xceoqr qai vahc jjzifsn exg
igjpn wfy ukn aag quro wklsq cjq bgtjrdz gmub wyhh
fzlwnm mygfn vkzwvw zvhsex gfki
ijvzgai ebmeq wssfmbq uguh sfuutm nwkgmex dxael liakdxs rnf sky yowpxc
bjzkyjh fced nji esowk qxsubsk qgtts
nkdgo bbjfq fgnxnhd gfjchl jetdb xubsgj eiju ldlm oxsx znft bbqfj
xovcnob pxfe pmstes yzkdm iqlvha nmcziix fexp ivqalh rxecqps
xpyew xudfud wwqe qhfjlcu epv fnrbgyv ihli qngtx yjlfg ozqbzn esp
timl gcohx vqzic gzm shwlkkv icqzv urchuc
xpqq gaqzwo cci dowahsr gaqzwo
jjsagdl umbpxre kyre zvaryft tmw pxpnjy
aqovcz nunq nnuq xjrvvh autjmit jiatumt
elg lps lge zjjot hwz tmqrup xaxxmo zlbzp uftd fukdad kvpymsm
iokwzal ywti zbdmzbu lprywe wbgbwza ypogbga kzliwao wstqi eqm keaeaj gbabwwz
lwfpk mhufe eddzgd ljxyqy vhzkct uemhf
lwqil fzugdo faq feppo usl llwqi
nje hthr ropq qvcepu bexszfj avmzjvv zajmvvv fhcd xnc cnx qnuaux
kvksn dphbyz nsx wrcc ccrw
nzpa pzzunfv ygzjy gxrrtcj hrt trh pwxpg yifgjmo fnupzzv wbzx
aepti rbojui ypvhe ubojri tcema aan dntkw qjx bfvmyos tcm hvoqytn
qpwq exu jvsiwj gsw avr vbemldy
xsbzpf xbzyvx xax sxh vpxt gccy xxa zhgbwoa hwwxoky fhvdxfc pvtx
pnsa ovtjolz tyutl eyjjzt jvtoolz owbypvr tytlu ewtzgec
cyg dwwk eihsp aeuk bbnay aluwyz hdmv uaek mwt ihpse wjhnkeg
fhzx vjetz vjub tejvz
ewwyb jidhu pyvyenn igtnyd tiwr akwkkbi myz xxjwb jjrdeg
jbkuw kwir rkiw ubwkj
bltffuw lftwufb hhsh wfbtulf nrxaa rlszi toijxnz czlci
bqrm pga zgblgcw pgwhhn lcgzwbg bcgzlgw yqb
mhjj vjoa gnjlc kclcr ito ofksy giavy fpqeioj
bkiqmif izidbui sttxxi bswhkxp sduuw
mjgnvw mjgwnv ojzyuv gvj
qxn kkhc whd fgwk auzugg augzgu kqfov wfgk
spdxbnu xpfofsb bpfsoxf ahjywql spbxoff
bwqxhlm wbqlxmh kqgpl fyzgf guhkvgx ovk qhmp gnrmu wvd wedj
vvwf hcnc vvwsngj qedzoxm hcnc qedzoxm kjthdi cbwqep qtvu
gio iqklmro noqablo bab jiqc rwebyg rqkloim wzmgs uunl amqs iwj
snxj szobqt zcgvwv wiyqknu
uto jteikwd cew gqsks hmvjtcy sach
zpgl qnkoex amhufmr figns upv xezrl rjleak nwrna
pzkvrdz dtonazj gtr gfxucuf lstjl lsjtl rgkope kzpdzrv lyptn zfxjys ttk
ddxgm lumlgki jhv doft kok swy ckds swy ddxgm lbfbdv
qfs rcufzgz iaiqw qfs qfs
nvkbo sgv mquwb ritpye nbkov poex hraorm qrrr qdt qefl
irxannd fiud ehyb ggx plqg pvvn uuptop tcvbm abuf bcfnmw
qwya ukblz epmbfr vmlon yqwa
hlo mmv vmm mvm
svzpxun yugbbe sbbpxs dmy xspbbs zhpovyf fyovhzp cpbt pke
zgk gft zybs zrgcoo ypu bue htgo
xnesq srsx pkzaoh cfqzugh
lntd nvxetbv clykjpd svmibpx evxtvnb yldkpjc
jsqq tzwak hephg eqwczd ioisa yim tmdifn mceip
kuwqz wzkqu zwchmj lfec uexne iztp llityt
kvamkpc pvbryqh ion cwizjde gln kcpvmak pzzlw gnl
ydeqf bfaab sydqhbp smsxdjr pynrs cqymt
onb eiab bno nob
mqslq scnelxv hyllrf scnelxv mqslq wmnbk
pttu kubby lgop bbyuk gsk skg ikktlbb inbyvz
xznvl zwtdj vbxdyd clhw
hgy zudelp ickc drfjgn iyws xhc
zzv wik iorhat qkb kjb lykdz vrce yjsjwj
gyw xzgbi efus uuy
hwcy ujdun bjjuvd jbdvju onnk xeyy mmp onkn qyzl
jwfm ptjwrbl hhuv uolz adyweh qpj wxyogp igvnojq jmfw pqs fsnirby
""".trimIndent()
val phrases = input.split("\n")
val numOfValid = phrases.map { isValid(it) }.filter { it }.size
println(numOfValid)
}
<file_sep>import kotlin.math.abs
import kotlin.math.ceil
import kotlin.math.sqrt
fun findNearestSquareRoot(num: Int): Int {
val nearestRoot = ceil(sqrt(num.toDouble())).toInt()
return if (nearestRoot % 2 == 0) {
nearestRoot + 1
} else {
nearestRoot
}
}
fun main(args: Array<String>) {
val input = 325489
val nearestRoot = findNearestSquareRoot(input)
val rightBottom = nearestRoot * nearestRoot
val leftBottom = rightBottom - nearestRoot + 1
val leftTop = leftBottom - nearestRoot + 1
val rightTop = leftTop - nearestRoot + 1
val rightLowest = rightTop - nearestRoot + 2
val horizontalPos = when (input) {
in leftTop..leftBottom -> leftTop
in rightLowest..rightTop -> rightBottom
else -> input
}
val horizontal = if (horizontalPos >= leftBottom) {
val midVal = leftBottom + (nearestRoot / 2.0).toInt()
abs(horizontalPos - midVal)
} else {
val midVal = rightTop + (nearestRoot / 2.0).toInt()
abs(horizontalPos - midVal)
}
val verticalPosition = when (input) {
in leftBottom..rightBottom -> leftBottom
in leftTop..rightTop -> leftTop
else -> input
}
val vertical = if (verticalPosition < leftTop) {
val midVal = rightTop - (nearestRoot / 2.0).toInt()
abs(verticalPosition - midVal)
} else {
val midVal = leftTop + (nearestRoot / 2.0).toInt()
abs(verticalPosition - midVal)
}
println(horizontal + vertical)
}
| 9500a9f6cedda2fcd5cf661c86a35009451af15a | [
"Markdown",
"Kotlin"
] | 6 | Markdown | fpeterek/Advent-Of-Code | d5bdf89e106cd84bb4ad997363a887c02cb6664b | cdae14908dc15e94bbe4fcedcf9e1acc9f4a5be7 |
refs/heads/master | <repo_name>StubbornPlatypus/web-project<file_sep>/JSPTemplate2/src/logic/Context.java
package logic;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.ArrayList;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import model.MySQLDB;
import model.User;
//This class is a middle layer class between the "communication" layers
//and the back-end/model/db layers. it provides mainly business logic to
//your web site.
//it has two constructors, one usually used from servlets/listeners modules
//and the other used from jsp pages
public class Context {
HttpServletRequest request;
HttpServletResponse response;
HttpSession session;
ServletContext application;
PrintWriter out;
static MySQLDB dbc= new MySQLDB();
private final String SESSION_KEY_USER= "currentUser";
private final String SESSION_KEY_MANAGER= "isManager";
//used mainly from JSP
public Context(PageContext pContext) throws Exception {
this((HttpServletRequest)pContext.getRequest(),
(HttpServletResponse)pContext.getResponse());
}
//used mainly from servlets...
public Context(HttpServletRequest request, HttpServletResponse response) throws Exception {
this.request = request;
this.response = response;
this.session = request.getSession();
this.application = this.session.getServletContext();
try {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
this.out = response.getWriter();
if (dbc.IsDbConnected() == false) {
throw(new Exception("no db connection"));
}
} catch (IOException e) {};
}
public void insertAlertDlg(String msg, String forwardToPage){
out.write("<script charset=\"UTF-8\">");
out.write("alert('" + msg + "');");
//out.write("setTimeout(function(){window.location.href='secondpage.jsp'},1000);");
if (forwardToPage!= null)
out.write("window.location.href='"+ forwardToPage + "';");
out.write("</script>");
}
public void handleLogout(){
this.session.removeAttribute(SESSION_KEY_USER);
try {
response.sendRedirect("home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public boolean isLoggedIn(){
return (this.session.getAttribute(SESSION_KEY_USER)!= null);
}
public boolean isManager(){
User u = (User) this.session.getAttribute(SESSION_KEY_USER);
return (u!= null) && u.getRole().equals(User.MGR_ROLE);
}
public String getCurrentUserName() {
User u = (User) this.session.getAttribute(SESSION_KEY_USER);
return (u==null)?"אורח": u.getNickName();
}
public void handleLogin() {
String nickname= request.getParameter("nickname");
String password= request.getParameter("password");
try {
User u = dbc.UserAuthenticate(nickname, password);
if(u!=null) {
this.session.setAttribute(SESSION_KEY_USER, u);
String url = "home.jsp?name=" + URLEncoder.encode(nickname, "UTF-8");
response.sendRedirect(url);
//you might need to encode the url in some unresolved cases where sessionID needs to be enforced
//response.sendRedirect(response.encodeRedirectURL(url));
}
else {
request.setAttribute("error", "שם המשתמש או הסיסמא אינם נכונים, אנא נסה שוב");
request.getRequestDispatcher("tofes.jsp").forward(request, response);
}
} catch (IOException | ServletException e) {
e.printStackTrace();
}
}
public void handleRegistration() {
String nickname= request.getParameter("nickname");
if (userCanBeRegistered(nickname)){
dbc.AddNewUser(userFromRequest());
handleLogin();
}
else {
request.setAttribute("error", "שם משתמש זה כבר בשימוש, אנא הזן שם אחר");
try {
request.getRequestDispatcher("tofes.jsp").forward(request, response);
} catch (ServletException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public String getFieldFromRequest(String key)
{
String x = request.getParameter(key);
return (request.getParameter(key) != null? request.getParameter(key): "");
}
private User userFromRequest() {
User u = new User();
u.setNickName(getFieldFromRequest("nickname"));
u.setPassword(getFieldFromRequest("<PASSWORD>"));
u.setRole(getFieldFromRequest("role"));
//update this method to reflect your user object
return u;
}
private boolean userCanBeRegistered(String nickname){
return !dbc.UserExists(nickname);
}
public void handleUnknownRequest() {
try {
response.sendRedirect("home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
<file_sep>/JSPTemplate2/WebContent/js/tofes.js
function approve(){
window.alert("Thank you for registering");
}<file_sep>/JSPTemplate2/src/model/MySQLDB.java
package model;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
public class MySQLDB {
Connection con;
public MySQLDB(){
String connectionURL = "jdbc:mysql://localhost:3306/mysqldb?serverTimezone=Asia/Jerusalem";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con= DriverManager.getConnection(connectionURL, "root", "SQL<PASSWORD>");
} catch (Exception e) {
System.out.println("error in connecting to the DB");
con = (Connection)null;
}
}
public boolean IsDbConnected()
{
return con != null;
}
public boolean UserExists(String nickname){
try{
Statement statement = con.createStatement();
String queryString = "SELECT * FROM users WHERE nickname='" + nickname + "'";
ResultSet rs = statement.executeQuery(queryString);
return((rs != null) && (rs.next()));
} catch (Exception e) {
System.out.println("error in querying the DB");
return true;
}
}
public void AddNewUser(User user){
String sqlString = "INSERT INTO users" + " (nickname, password, role)"
+ "VALUES ('"
+ user.getNickName() + "', '"
+ user.getPassword() + "', '"
+ user.getRole() + "')";
try {
Statement statement = con.createStatement();
statement.executeUpdate(sqlString);
statement.close();
} catch(SQLException ex) {
System.out.println("SQLException: " + ex.getMessage());
}
}
public boolean ModifyUser(User user){
try {
String updString = "UPDATE users SET password =?, role = ?"
+ " WHERE nickname='" + user.getNickName() + "'" ;
PreparedStatement statement = con.prepareStatement(updString);
statement.setString(3, user.getPassword());
statement.setString(4, user.getRole());
statement.executeUpdate();
statement.close();
return true;
} catch(SQLException ex) {System.out.println("SQLException: " + ex.getMessage());
return false;
}
}
public User UserAuthenticate(String name, String pass){
try{
Statement statement = con.createStatement();
String queryString = "SELECT * FROM users WHERE nickname='" + name + "' and password='" + pass + "'" ;
ResultSet rs = statement.executeQuery(queryString);
if (rs.next()==true) {
User u = new User();
u.setId(rs.getInt("id"));
u.setNickName(rs.getString("nickname"));
u.setRole(rs.getString("role"));
return u;
}
else return null;
} catch (Exception e) {
System.out.println("error in querying the DB");
return null;
}
}
public List<User> getAllUsers()
{
Statement statement;
ResultSet rs;
try {
statement = con.createStatement();
String queryString;
queryString = "SELECT * FROM users";
rs = statement.executeQuery(queryString);
List<User> result = new ArrayList<User>();
while(rs.next()) {
User u = new User();
u.setNickName(rs.getString(rs.findColumn("nickname")));
u.setPassword(rs.getString(rs.findColumn("password")));
u.setRole(rs.getString(rs.findColumn("role")));
u.setId(rs.getInt(rs.findColumn("id")));
result.add(u);
}
return result;
} catch (SQLException e)
{
System.out.println("error in querying the DB");
e.printStackTrace();
return null;
}
}
public List<String> getAllUsersNickNames()
{
Statement statement;
ResultSet rs;
try {
statement = con.createStatement();
String queryString;
queryString = "SELECT nickname FROM users";
queryString += " order by nickname DESC";
rs = statement.executeQuery(queryString);
List<String> users = new ArrayList<String>();
while (rs.next())
users.add(rs.getString(rs.findColumn("nickname")));
return users;
} catch (SQLException e)
{
System.out.println("error in querying the DB");
e.printStackTrace();
return null;
}
}
public boolean DeleteUser(String nickName)
{
try{
String delString = "DELETE FROM users WHERE nickname=?";
PreparedStatement statement = con.prepareStatement(delString);
statement.setString(1, nickName);
statement.executeUpdate();
return true;
} catch (Exception e) {
System.out.println("error deleting the user");
return false;
}
}
public void Close() {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
finally {
con = null;
}
}
}
| c6e1a43e1a16a8fb09036dc7f742f42b72d8073e | [
"JavaScript",
"Java"
] | 3 | Java | StubbornPlatypus/web-project | f6ab28aa7363bddcd8a9ab105d3e9f0522eedd46 | fd3284a9e159f50ad145c951004db43d34d9d925 |
refs/heads/main | <repo_name>jhonloza/kilari-wow<file_sep>/app/Http/Middleware/Cliente.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use phpseclib3\Math\BigInteger;
abstract class Cliente
{
/**
* @var BigInteger Local public ephemeral value
*/
protected $clientPublicEphemeralValue;
/**
* @var BigInteger A generator modulo N
*/
protected $g;
/**
* @var BigInteger Remote public ephemeral value
*/
protected $hostPublicEphemeralValue;
/**
* @var BigInteger Multiplier parameter (K)
*/
protected $multiplier;
/**
* @var BigInteger A large safe prime
*/
protected $N;
/**
* @var string User's salt
*/
protected $salt;
/**
* @var BigInteger Local secret ephemeral value
*/
protected $secretEphemeralValue;
/**
* @var BigInteger Computed session key
*/
protected $sessionKey;
/**
* @var string Hashed session key
*/
protected $strongSessionKey;
/**
* @var string User's username (I)
*/
protected $username;
/**
* SRP Client constructor.
*
* @param string $identity User's identity (username)
* @param string|null $salt User's salt
* @param array|null $options Various options for SRP Client
*/
public function __construct(string $identity, string $salt = null, array $options = null)
{
$this->g = new BigInteger($options['g'] ?? '07', 16);
$this->multiplier = new BigInteger('03', 16);
$this->N = new BigInteger(
$options['N'] ?? '894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7',
16
);
$this->salt = $salt;
$this->username = $identity;
}
/**
* Sets user's salt
*
* @param string $salt
*/
public function setSalt(string $salt): void
{
$this->salt = $salt;
}
/**
* @return string
*/
public function getSessionKey(): string
{
return $this->sessionKey->toHex();
}
/**
* @return string
*/
public function getStrongSessionKey(): string
{
return $this->strongSessionKey;
}
/**
* @return BigInteger Random scrambling parameter
*/
public function computeRandomScramblingParameter(): BigInteger
{
$hash = sha1($this->clientPublicEphemeralValue->toHex().$this->hostPublicEphemeralValue->toHex());
return new BigInteger($hash, 16);
}
/**
* @return string
*/
public function computeClientSessionKeyProof(): string
{
$A = $this->clientPublicEphemeralValue->toHex();
$B = $this->hostPublicEphemeralValue->toHex();
$I = sha1($this->username);
$K = $this->strongSessionKey;
$Ng = sha1($this->N->toHex()) ^ sha1($this->g->toHex());
$s = $this->salt;
return sha1($Ng.$I.$s.$A.$B.$K);
}
/**
* @param string $M User's calculated proof of session
*
* @return string
*/
public function computeHostSessionKeyProof(string $M): string
{
return sha1($this->clientPublicEphemeralValue->toHex().$M.$this->strongSessionKey);
}
/**
* Generates both private and public ephemeral values but returns only public value
*
* @return BigInteger
* @throws Exception
*/
protected function generateEphemeralValues(): BigInteger
{
$public = null;
while (!$public || bcmod($public, $this->N) === 0) {
$secret = $this->generateSecretEphemeralValue();
$public = $this->computePublicEphemeralValue($secret);
}
$this->secretEphemeralValue = $secret ?? null;
return $public;
}
/**
* Returns hex of public ephemeral value
*
* @return string
*/
abstract public function getPublicEphemeralValue(): string;
/**
* @return BigInteger
* @throws Exception
*/
public function generateSecretEphemeralValue(): BigInteger
{
return new BigInteger($this->getRandomNumber(16), 16);
}
/**
* Generate hex string of defined length of random bytes
*
* @param int $length
*
* @return string
* @throws Exception
*/
protected function getRandomNumber(int $length): string
{
return bin2hex(random_bytes($length));
}
/**
* @param BigInteger $value Secret ephemeral value
*
* @return BigInteger Public ephemeral value
*/
abstract public function computePublicEphemeralValue(BigInteger $value): BigInteger;
}
<file_sep>/app/Http/Middleware/Configuration.php
<?php
/**
* Database connection information.
* This should be updated to the information of your CMaNGOS realmd database!
*/
define('DB_HOST', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '<PASSWORD>');
define('DB_DATABASE_NAME', 'tbcrealmd');
define('DB_PORT', '3306');
/**
* Set your GM level, expansion pack and more here.
* GM_LEVEL:
* 0 - Player
* 1 - Moderator
* 2 - Game Master
* 3 - Administrator
*
* EXPANSION_PACK:
* 0 - Classic
* 1 - The Burning Crusade
* 2 - Wrath of the Lich King
*/
define('GM_LEVEL', '0');
define('EXPANSION_PACK', '1');
<file_sep>/app/Http/Middleware/HostCliente.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use phpseclib3\Math\BigInteger;
class HostCliente extends Cliente
{
/**
* @var BigInteger User's verifier
*/
private $verifier;
/**
* HostClient constructor.
*
* @param string $identity
* @param string $salt
* @param string $verifier
* @param string $clientPublicEphemeralValue
* @param array|null $options
*/
public function __construct(
string $identity,
string $salt,
string $verifier,
string $clientPublicEphemeralValue,
array $options = null
) {
$this->clientPublicEphemeralValue = new BigInteger($clientPublicEphemeralValue, 16);
$this->verifier = new BigInteger($verifier, 16);
parent::__construct($identity, $salt, $options);
}
/**
* Returns hex of public ephemeral value
*
* @return string
* @throws Exception
*/
public function getPublicEphemeralValue(): string
{
$this->hostPublicEphemeralValue = $this->generateEphemeralValues();
return $this->hostPublicEphemeralValue->toHex();
}
/**
*
*/
public function calculateSessionKey(): void
{
// Random scrambling parameter
$u = $this->computeRandomScramblingParameter();
$avu = $this->clientPublicEphemeralValue->multiply($this->verifier->powMod($u, $this->N));
// Session key
$this->sessionKey = $avu->powMod($this->secretEphemeralValue, $this->N);
// Strong session key
$this->strongSessionKey = sha1($this->sessionKey->toHex());
}
/**
* @param BigInteger $b Host's secret ephemeral value
*
* @return BigInteger Host's public ephemeral value
*/
public function computePublicEphemeralValue(BigInteger $b): BigInteger
{
return $this->multiplier->multiply($this->verifier)->add($this->g->powMod($b, $this->N))->modPow(
new BigInteger(1),
$this->N
);
}
public function validateClientSessionKeyProof(string $proof): bool
{
return $this->computeClientSessionKeyProof() === $proof;
}
}
<file_sep>/app/Http/Middleware/UserCliente.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use phpseclib3\Math\BigInteger;
use RuntimeException;
class UserCliente extends Cliente
{
/**
* Returns hex of public ephemeral value
*
* @return string
* @throws Exception
*/
public function getPublicEphemeralValue(): string
{
$this->clientPublicEphemeralValue = $this->generateEphemeralValues();
return $this->clientPublicEphemeralValue->toHex();
}
/**
* @param string $value
*/
public function setHostPublicEphemeralValue(string $value): void
{
$this->hostPublicEphemeralValue = new BigInteger($value, 16);
}
/**
* Generate verifier using username, password and existing salt
*
* @param string $p User's password in plaintext
*
* @return string
* @throws Exception
*/
public function generateVerifier(string $p): string
{
$privateKey = $this->computePrivateKey($p);
$verifier = $this->computeVerifier($privateKey);
return $verifier->toHex();
}
/**
* Computes private key using salt and identity which is derived from username and password
*
* @param string $p User's password in plaintext
*
* @return BigInteger
*/
public function computePrivateKey(string $p): BigInteger
{
if (empty($this->salt)) {
throw new RuntimeException('Received empty salt.');
}
if (empty($this->username)) {
throw new RuntimeException('Received empty username.');
}
$salt = $this->reverseHex($this->salt);
$salt = hex2bin($salt);
$identity = hash('sha1', strtoupper($this->username.':'.$p), true);
$sha = sha1($salt.$identity);
$sha = $this->reverseHex($sha);
return new BigInteger($sha, 16);
}
/**
* Reverses input hex
*
* @param string $string Hex string to reverse
*
* @return string
*/
private function reverseHex(string $string): string
{
for ($i = 0, $length = strlen($string); $i < $length; $i += 2) {
$bytes[] = substr($string, $i, 2);
}
return implode(array_reverse($bytes ?? []));
}
/**
* Computes verifier using private key
*
* @param BigInteger $x Computed private key using identity and salt
*
* @return BigInteger
*/
private function computeVerifier(BigInteger $x): BigInteger
{
return $this->g->modPow($x, $this->N);
}
/**
* Generates random salt using 32 random bytes
*
* @return string
* @throws Exception
*/
public function generateSalt(): string
{
return $this->salt = $this->getRandomNumber(32);
}
/**
* @param BigInteger $a User's secret ephemeral value
*
* @return BigInteger User's public ephemeral value
*/
public function computePublicEphemeralValue(BigInteger $a): BigInteger
{
return $this->g->powMod($a, $this->N);
}
/**
* @param BigInteger $x Computed private key using identity and salt
*/
public function calculateSessionKey(BigInteger $x): void
{
// Random scrambling parameter
$u = $this->computeRandomScramblingParameter();
$v = $this->computeVerifier($x);
$kv = $this->multiplier->multiply($v);
$aux = $this->secretEphemeralValue->add($u->multiply($x));
// Session key
$this->sessionKey = $this->hostPublicEphemeralValue->subtract($kv)->modPow($aux, $this->N);
// Strong session key
$this->strongSessionKey = sha1($this->sessionKey->toHex());
}
public function validateHostSessionKeyProof(string $M, $proof): bool
{
return $this->computeHostSessionKeyProof($M) === $proof;
}
}
<file_sep>/app/Http/Controllers/Auth/RegisterController.php
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Middleware\UserCliente;
use App\Models\Account;
//use mysqli;
include __DIR__.'/../../Middleware/Configuration.php';
require __DIR__.'/../../../../vendor/autoload.php';
class RegisterController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
//return "hola";
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
public function registro(){
//return "hola";
return view('login-register.register');
}
//Funcion de registrar
public function resultregister(Request $request){
//$db = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE_NAME, DB_PORT);
$username = $request->username;
$password = $request->password;
$vpassword = $request->vpassword;
$email = $request->email;
/* Set the join date. */
$joinDate = date('Y-m-d H:i:s');
/* Set GM Level. */
$gmLevel = GM_LEVEL;
/* Set expansion pack - The Burning Crusade. */
$expansion = EXPANSION_PACK;
if($username == null){
echo '<script language="javascript">alert("Llene los campos obligatorios *Nombre de usuario ");history.go(-1);</script>';
} elseif ($password == null){
echo '<script language="javascript">alert("Llene los campos obligatorios *Contraseña ");history.go(-1);</script>';
} elseif($vpassword == null){
echo '<script language="javascript">alert("Llene los campos obligatorios *Verificar contraseña ");history.go(-1);</script>';
} elseif($email == null){
echo '<script language="javascript">alert("Llene los campos obligatorios *Email ");history.go(-1);</script>';
} elseif($password == $vpassword){
$cliente = new UserCliente($username);
$salt = $cliente -> generateSalt();
$verified = $cliente -> generateVerifier($password);
$ip = $_SERVER['REMOTE_ADDR'];
$acount = new Account();
$acount -> username = $username;
$acount -> gmlevel = $gmLevel;
$acount -> sessionkey = '';
$acount -> v = $verified;
$acount -> s = $salt;
$acount -> email = $email;
$acount -> joindate = $joinDate;
$acount -> lockedIp = $ip;
$acount -> failed_logins = 0;
$acount -> locked = 0;
$acount -> active_realm_id = 0;
$acount -> expansion = $expansion;
$acount -> mutetime = 0;
$acount -> locale = '';
$acount -> token = '';
$acount -> save();
echo '<script language="javascript">alert("Registro completo!");</script>';
return view('home');
} else{
echo '<script language="javascript">alert("Las contraseñas no coinciden");history.go(-1);</script>';
}
}
}
| 5ada7136578a9c86c0c5e012fa194103a20cfee5 | [
"PHP"
] | 5 | PHP | jhonloza/kilari-wow | a6eda0d22d002ca8fb66a4c1bff02fc3beb09fe9 | aa78f19cc5aa0cf4042dd755f4d088bc4b796184 |
refs/heads/master | <repo_name>MBalciunas/BankingSystem<file_sep>/src/main/java/com/javatask/banksystem/utils/Constants.java
package com.javatask.banksystem.utils;
public class Constants {
public static final String emailValidationRegex = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@" +
"(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$";
}
<file_sep>/src/main/java/com/javatask/banksystem/services/TransactionService.java
package com.javatask.banksystem.services;
import com.javatask.banksystem.models.transaction.Transaction;
import com.javatask.banksystem.models.transaction.TransactionRepository;
import com.javatask.banksystem.models.transaction.TransactionType;
import org.springframework.stereotype.Service;
@Service
public class TransactionService {
private TransactionRepository transactionRepository;
public TransactionService(TransactionRepository transactionRepository) {
this.transactionRepository = transactionRepository;
}
public Transaction saveNewTransaction(long amount, TransactionType transactionType) {
Transaction transaction = Transaction.builder().amount(amount).transactionType(transactionType).build();
return transactionRepository.save(transaction);
}
}
<file_sep>/src/main/java/com/javatask/banksystem/models/client/Client.java
package com.javatask.banksystem.models.client;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.javatask.banksystem.models.transaction.Transaction;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.List;
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Client {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@NotNull
private String email;
@NotNull
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String password;
private long balance;
@OneToMany
private List<Transaction> transactions;
}
<file_sep>/src/main/java/com/javatask/banksystem/controllers/ClientController.java
package com.javatask.banksystem.controllers;
import com.javatask.banksystem.models.client.Client;
import com.javatask.banksystem.services.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;
@Controller
@RequestMapping("clients")
public class ClientController {
private ClientService clientService;
@Autowired
public ClientController(ClientService clientService) {
this.clientService = clientService;
}
@PostMapping("/signup")
public ResponseEntity signUp(@RequestBody Client client) {
try {
clientService.signUpAccount(client);
} catch (IllegalStateException e) {
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(HttpStatus.OK);
}
@PostMapping("/deposit")
public ResponseEntity deposit(@RequestBody Map<String, String> request) {
long balance;
try {
balance = clientService.depositAmount(request.get("email"), request.get("password"), Long.parseLong(request.get("amount")));
} catch (IllegalStateException e) {
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(balance, HttpStatus.OK);
}
@PostMapping("/withdraw")
public ResponseEntity withdraw(@RequestBody Map<String, String> request) {
long balance;
try {
balance = clientService.withdrawAmount(request.get("email"), request.get("password"), Long.parseLong(request.get("amount")));
} catch (IllegalStateException e) {
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(balance, HttpStatus.OK);
}
@GetMapping("/getInfo")
public ResponseEntity getInfo(@RequestBody Client client) {
try {
client = clientService.getInfo(client);
} catch (IllegalStateException e) {
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(client, HttpStatus.OK);
}
}
<file_sep>/src/main/java/com/javatask/banksystem/models/client/ClientRepository.java
package com.javatask.banksystem.models.client;
import org.springframework.data.repository.CrudRepository;
import java.util.Optional;
public interface ClientRepository extends CrudRepository<Client, Long> {
Optional<Client> findByEmail(String email);
}
| fe4491914ef854e8654c5104202750721c38a777 | [
"Java"
] | 5 | Java | MBalciunas/BankingSystem | d8c891471b5c66a9b293b0f4aec272b5560c89cd | 5b67528e8bcb726d07c915eb3f90d17e10031de7 |
refs/heads/master | <repo_name>TMCognitic/BxlForm.DemoSecurity<file_sep>/BxlForm.DemoSecurity.Models.Global/Services/CategoryService.cs
using BxlForm.DemoSecurity.Models.Global.Data;
using BxlForm.DemoSecurity.Models.Global.Mappers;
using BxlForm.DemoSecurity.Models.Global.Repositories;
using System;
using System.Collections.Generic;
using System.Text;
using Tools.Connections.Database;
namespace BxlForm.DemoSecurity.Models.Global.Services
{
public class CategoryService : ICategoryRepository
{
private readonly Connection _connection;
public CategoryService(Connection connection)
{
_connection = connection;
}
public IEnumerable<Category> Get()
{
Command command = new Command("Select Id, Name From Category;", false);
return _connection.ExecuteReader(command, dr => dr.ToCategory());
}
}
}
<file_sep>/BxlForm.DemoSecurity.Models.Client/Repositories/ICategoryRepository.cs
using BxlForm.DemoSecurity.Models.Client.Data;
using System;
using System.Collections.Generic;
using System.Text;
namespace BxlForm.DemoSecurity.Models.Client.Repositories
{
public interface ICategoryRepository
{
IEnumerable<Category> Get();
}
}
<file_sep>/BxlForm.DemoSecurity.Models.Global/Repositories/ICategoryRepository.cs
using BxlForm.DemoSecurity.Models.Global.Data;
using System.Collections.Generic;
namespace BxlForm.DemoSecurity.Models.Global.Repositories
{
public interface ICategoryRepository
{
IEnumerable<Category> Get();
}
}
| 5ed96e3f53f2830508652d0f2656e9073ffa0244 | [
"C#"
] | 3 | C# | TMCognitic/BxlForm.DemoSecurity | 9119d33c5b9060fcb1f4381210e73fff0fe5e5d6 | 7c02b15331210f5f887ab24df068ef8155f7c23b |
refs/heads/master | <file_sep>/// <reference types="cypress" />
import BasePage from "./BasePage";
export class HelpPage extends BasePage{
HelpPage(){
}
elements = {
content: () => cy.get(".a-row"),
tracking: () => cy.get(":nth-child(1) > .a-size-medium > .a-link-normal")
}
help_content_is_visible() {
this.elements.content().should('be.visible');
}
}
export default HelpPage<file_sep>/// <reference types="cypress" />
import BasePage from "./BasePage";
export class LoginPage extends BasePage{
LoginPage(){
}
elements = {
email: () => cy.get("#ap_email"),
continue: () => cy.get("#continue"),
password: () => cy.get("#ap_password"),
signin: () => cy.get("#signInSubmit"),
warning: () => cy.get("#auth-warning-message-box")
}
login_content_is_visible() {
this.elements.email().should('be.visible');
}
}
export default LoginPage<file_sep> /// <reference types="cypress" />
import BasePage from "../Pages/BasePage";
import HomePage from "../Pages/HomePage";
import ResultsPage from "../Pages/ResultsPage";
import LoginPage from "../Pages/LoginPage";
import CartPage from "../Pages/CartPage";
import OccasionPage from "../Pages/OccasionsPage";
import BestsellerPage from "../Pages/BestsellerPage";
import GiftcardPage from "../Pages/GiftcardPage";
import SellerPage from "../Pages/SellerPage";
import HelpPage from "../Pages/HelpPage";
import RegisterPage from "../Pages/RegisterPage";
import { Given, When, Then, And, Before } from "cypress-cucumber-preprocessor/steps";
describe("Amazon Web Tests", function () {
const basepage = new BasePage();
const homepage = new HomePage();
const resultspage = new ResultsPage();
const loginpage = new LoginPage();
const cartpage = new CartPage();
const occasionspage = new OccasionPage();
const bestsellerpage = new BestsellerPage();
const giftcardpage = new GiftcardPage();
const sellerpage = new SellerPage();
const helppage = new HelpPage();
const registerpage = new RegisterPage();
it("Try to login with bad credentials", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
basepage.click_header1_accountlist();
cy.title().should('include', 'Logowanie');
loginpage.login_content_is_visible();
loginpage.elements.email().type('<EMAIL>');
loginpage.elements.continue().click();
loginpage.elements.password().type('<EMAIL>');
loginpage.elements.signin().click();
loginpage.elements.warning().should('be.visible');
}),
it("Try to search for 'playstation 4'", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
basepage.elements.header1_search_input().type("playstation 4");
basepage.elements.header1_search_button().click();
resultspage.elements.content().should("be.visible");
}),
it("Try to select 'Uroda' and search for 'pomadka'", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
basepage.elements.header1_search_dropdown().select("Uroda");
basepage.elements.header1_search_input().type("pomadka");
basepage.elements.header1_search_button().click();
resultspage.elements.results().contains("pomadka")
}),
it("Try to register with bad credentials", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
cy.scrollTo("bottom");
homepage.elements.register().should("be.visible");
homepage.elements.register().scrollIntoView().click();
registerpage.elements.username().type("Lastbinder");
registerpage.elements.email().type("<EMAIL>");
registerpage.elements.password().type("<PASSWORD>");
registerpage.elements.password_check().type("<PASSWORD>");
registerpage.elements.continue().click();
cy.title().should('include', 'Rejestracja');
})
it("Try to register with good credentials", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
cy.scrollTo("bottom");
homepage.elements.register().should("be.visible");
homepage.elements.register().scrollIntoView().click();
registerpage.elements.username().type("Lastbinder");
registerpage.elements.email().type("<EMAIL>");
registerpage.elements.password().type("<PASSWORD>");
registerpage.elements.password_check().type("<PASSWORD>");
registerpage.elements.continue().click();
cy.title().should('include', 'Potwierd');
})
it("Try to go to 'Echo i Alexa' -> 'Inteligentne głośniki' through hamburger menu", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
basepage.click_header2_menu();
basepage.elements.header2_menu_open().should('be.visible');
basepage.elements.header2_menu_open_alexa().should('be.visible').click();
basepage.elements.header2_menu_open_alexa_echo().should('be.visible').click();
cy.title().should('include', 'Inteligentne');
})
it("Try to go to 'Dział obługi klienta' and write 'Paczki' in search input and press enter", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
basepage.click_header2_dzialobslugi();
cy.title().should('include', 'Pomoc')
cy.get('#helpsearch').type('Paczki {enter}')
helppage.elements.tracking().should('be.visible')
})
it("Try to go to 'Sport i Turystyka' -> 'Bieganie' through hamburger menu", () =>{
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
basepage.click_header2_menu();
basepage.elements.header2_menu_open().should('be.visible');
basepage.elements.header2_menu_open_sport().should('be.visible').click();
basepage.elements.header2_menu_open_sport_bieganie().should('be.visible').click();
cy.title().should('include', 'Bieganie');
})
})<file_sep>/// <reference types="cypress" />
import BasePage from "./BasePage";
export class OccassionsPage extends BasePage{
OccassionsPage(){
}
elements = {
content: () => cy.get("#slot-15")
}
occasions_content_is_visible() {
this.elements.content().should('be.visible');
}
}
export default OccassionsPage<file_sep>/// <reference types="cypress" />
import BasePage from "../Pages/BasePage";
import HomePage from "../Pages/HomePage";
import ResultsPage from "../Pages/ResultsPage";
import LoginPage from "../Pages/LoginPage";
import CartPage from "../Pages/CartPage";
import OccasionPage from "../Pages/OccasionsPage";
import BestsellerPage from "../Pages/BestsellerPage";
import GiftcardPage from "../Pages/GiftcardPage";
import SellerPage from "../Pages/SellerPage";
import HelpPage from "../Pages/HelpPage";
import { Given, When, Then, And, Before } from "cypress-cucumber-preprocessor/steps";
describe("Check header logo redirection", function () {
const basepage = new BasePage();
const homepage = new HomePage();
const resultspage = new ResultsPage();
const loginpage = new LoginPage();
const cartpage = new CartPage();
const occasionspage = new OccasionPage();
const bestsellerpage = new BestsellerPage();
const giftcardpage = new GiftcardPage();
const sellerpage = new SellerPage();
const helppage = new HelpPage();
Before(() => {
});
Given("I am on home page", () => {
cy.visit("https://www.amazon.pl/");
cy.get('#sp-cc-accept').click();
});
When("I click on header logo", () => {
basepage.click_header1_logo();
});
Then("I am redirected to homepage", () => {
cy.url().should('eq',"https://www.amazon.pl/ref=nav_logo");
});
And("home content is visible", () => {
homepage.content_is_visible();
});
//
When("I click on header supply button", () => {
basepage.click_header1_dostawa();
});
Then("supplybox content is visible", () => {
basepage.elements.header1_dostawa_okno().should('be.visible');
});
//
When("I type text into header search input", () => {
basepage.elements.header1_search_input().type("sas");
});
And("click search button", () => {
basepage.click_header1_search_button();
});
Then("I am redirected to results page", () => {
cy.title().should('include', 'sas');
});
And("result content is visible", () => {
resultspage.results_content_is_visible();
});
//
When("I click on header login button", () => {
basepage.click_header1_accountlist();
});
Then("I am redirected to login page", () => {
cy.title().should('include', 'Logowanie');
});
And("login content is visible", () => {
loginpage.login_content_is_visible();
});
//
When("I click on header order button", () => {
basepage.click_header1_orders();
});
//
When("I click on header cart button", () => {
basepage.click_header1_cart();
});
Then("I am redirected to cart page", () => {
cy.title().should('include', 'koszyk');
});
And("cart content is visible", () => {
cartpage.cart_content_is_visible();
});
//
When("I click on header hamburger menu", () => {
basepage.click_header2_menu();
});
Then("menubox content is visible", () => {
basepage.elements.header2_menu_open().should('be.visible');
});
//
When("I click on header Okazje button", () => {
basepage.click_header2_okazje();
});
Then("I am redirected to occasions page", () => {
cy.title().should('include', 'Okazje');
});
And("occasions content is visible", () => {
occasionspage.occasions_content_is_visible();
});
//
When("I click on header Bestsellery button", () => {
basepage.click_header2_bestsellery();
});
Then("I am redirected to bestseller page", () => {
cy.title().should('include', 'Bestsellery');
});
And("bestseller content is visible", () => {
bestsellerpage.bestseller_content_is_visible();
});
//
When("I click on header Karty podarunkowe button", () => {
basepage.click_header2_karty();
});
Then("I am redirected to giftcards page", () => {
cy.title().should('include', 'Karty');
});
And("giftcart content is visible", () => {
giftcardpage.giftcard_content_is_visible();
});
//
When("I click on header Sprzedawaj na Amazon button", () => {
basepage.click_header2_sprzedawaj();
});
Then("I am redirected to seller page", () => {
cy.title().should('include', 'Sprzedawaj');
});
And("seller content is visible", () => {
sellerpage.seller_content_is_visible();
});
//
When("I click on header Dział Obsługi Klienta button", () => {
basepage.click_header2_dzialobslugi();
});
Then("I am redirected to Help page", () => {
cy.title().should('include', 'Pomoc');
});
And("help content is visible", () => {
helppage.help_content_is_visible();
});
//
When("I click on header random text button", () => {
basepage.click_header2_okazje();
});
Then("I am redirected to another page", () => {
cy.title().should('include', 'Okazje');
});
And("another content is visible", () => {
occasionspage.occasions_content_is_visible();
});
//
});
<file_sep># Cypress-Cucumber-Web-Tests
Example BDD tests made with Cucumber and Gherkin language and E2E Cypress tests of the web.
<file_sep>/// <reference types="cypress" />
import BasePage from "./BasePage";
export class RegisterPage extends BasePage{
RegisterPage(){
}
elements = {
content: () => cy.get(".a-box a-spacing-extra-large"),
username: () => cy.get("#ap_customer_name"),
email: () => cy.get("#ap_email"),
password: () => cy.get("#ap_password"),
password_check: () => cy.get("#ap_password_check"),
continue: () => cy.get("#continue")
}
register_content_is_visible() {
this.elements.content().should('be.visible');
}
}
export default RegisterPage;<file_sep>/// <reference types="cypress" />
import BasePage from "./BasePage";
export class CartPage extends BasePage{
CartPage(){
}
elements = {
content: () => cy.get("#sc-retail-cart-container")
}
cart_content_is_visible() {
this.elements.content().should('be.visible');
}
}
export default CartPage<file_sep>/// <reference types="cypress" />
import BasePage from "./BasePage";
export class ResultsPage extends BasePage{
ResultsPage(){
}
elements = {
content: () => cy.get("#a-page"),
results: () => cy.get(".a-color-state")
}
results_content_is_visible() {
this.elements.content().should('be.visible');
}
}
export default ResultsPage | 66c613f3a3626dc62f61018ce29b8ac632c48042 | [
"JavaScript",
"Markdown"
] | 9 | JavaScript | fanfanafankianki/Cypress-Cucumber-Functional-Web-Tests | 480350e0626c59eb48686cbc299e8ff26fe17700 | 5be8afb287add093297bb8e5e80cf4bee2168993 |
refs/heads/master | <repo_name>okfiera/dgt<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/InitialData/InitialDataInfractions.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.InitialData
{
public class InitialDataInfractions
{
public static void Seed(UnitOfWork.MainBCUnitOfWork context)
{
var infraction1 = InfractionFactory.CreateInfraction(EntityGuids.Vehicles.FerrariGTO,
EntityGuids.InfractionTypes.ExcesoVelocidad20, EntityGuids.Drivers.IagoAspas, DateTime.Now);
infraction1.CreatedDate = DateTime.Now;
infraction1.GenerateNewIdentity();
context.Infractions.AddOrUpdate(infraction1);
var infraction2 = InfractionFactory.CreateInfraction(EntityGuids.Vehicles.SeatLeon,
EntityGuids.InfractionTypes.DobleFila, EntityGuids.Drivers.FranBeltran, DateTime.Now);
infraction2.CreatedDate = DateTime.Now;
infraction2.GenerateNewIdentity();
context.Infractions.AddOrUpdate(infraction2);
var infraction3 = InfractionFactory.CreateInfraction(EntityGuids.Vehicles.BmwM3,
EntityGuids.InfractionTypes.SinCinturonSeguridad, EntityGuids.Drivers.NemanjaRadoja, DateTime.Now);
infraction3.CreatedDate = DateTime.Now;
infraction3.GenerateNewIdentity();
context.Infractions.AddOrUpdate(infraction3);
}
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/ApiManagerBrands.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Brands;
using Newtonsoft.Json;
namespace Presentation.Windows.Seedwork.Api
{
public class ApiManagerBrands: ApiManagerBase
{
public static async Task<List<BrandDTO>> GetAllBrands()
{
using (var client = GetHttpClient())
{
const string urlKey = "brands";
using (var response = await client.GetAsync(urlKey))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<BrandDTO>();
else
{
var items = JsonConvert.DeserializeObject<BrandDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/Drivers/DriverDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.Drivers
{
public class DriverDTO
{
/// <summary>
/// Get or set Driver identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Driver identifier (DNF, NIF, NIE)
/// </summary>
public string Identifier { get; set; }
/// <summary>
/// Driver first name
/// </summary>
public string FirstName { get; set; }
/// <summary>
/// Driver last name
/// </summary>
public string LastName { get; set; }
/// <summary>
/// Driver full name (first name with last name)
/// </summary>
public string FullName { get; set; }
/// <summary>
/// Driver remaining points.
/// </summary>
public int Points { get; set; }
/// <summary>
/// Get or set Created date
/// </summary>
public DateTime? CreatedDate { get; set; }
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/Mapping/InfractionTypeEntityConfiguration.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping
{
class InfractionTypeEntityConfiguration
:EntityTypeConfiguration<InfractionType>
{
public InfractionTypeEntityConfiguration()
{
//Configure keys and properties
this.HasKey(c => c.Id);
this.Property(c => c.Name)
.HasMaxLength(150)
.IsRequired();
this.Property(c => c.Points)
.IsRequired();
this.Property(c => c.Description)
.HasMaxLength(500)
.IsOptional();
//Table mappings
this.ToTable("InfractionTypes");
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionAg/Infraction.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using Domain.Seedwork;
using Infrastructure.GlobalResources;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg
{
public class Infraction: BaseEntity, IValidatableObject
{
#region Properties
/// <summary>
/// Get or set car driver identifier
/// </summary>
public Guid DriverId { get; set; }
/// <summary>
/// Get car driver
/// </summary>
public virtual Driver Driver { get; private set; }
/// <summary>
/// Get or set car vehicle identifier
/// </summary>
public Guid VehicleId { get; set; }
/// <summary>
/// Get car vehicle
/// </summary>
public virtual Vehicle Vehicle { get; private set; }
/// <summary>
/// Get or set car InfractionType identifier
/// </summary>
public Guid InfractionTypeId { get; set; }
/// <summary>
/// Get car InfractionType
/// </summary>
public virtual InfractionType InfractionType { get; private set; }
/// <summary>
/// Get or set infraction date time
/// </summary>
public DateTime Date { get; set; }
#endregion
#region Public methods
/// <summary>
/// Associate vehicle to current infraction
/// </summary>
/// <param name="vehicle"></param>
public void SetVehicle(Vehicle vehicle)
{
if (vehicle == null || vehicle.IsTransient())
throw new ArgumentNullException(String.Format(CommonMessages.exception_CannotAssociateTransientOrNullEntity, Names.Vehicle));
this.VehicleId = vehicle.Id;
this.Vehicle = vehicle;
}
/// <summary>
/// Associate driver to current infraction
/// </summary>
/// <param name="driver"></param>
public void SetDriver(Driver driver)
{
if (driver == null || driver.IsTransient())
throw new ArgumentNullException(String.Format(CommonMessages.exception_CannotAssociateTransientOrNullEntity, Names.Driver));
this.DriverId = driver.Id;
this.Driver = driver;
}
/// <summary>
/// Associate infractionType to current infraction
/// </summary>
/// <param name="infractionType"></param>
public void SetInfractionType(InfractionType infractionType)
{
if (infractionType == null || infractionType.IsTransient())
throw new ArgumentNullException(String.Format(CommonMessages.exception_CannotAssociateTransientOrNullEntity, Names.InfractionType));
this.InfractionTypeId = infractionType.Id;
this.InfractionType = infractionType;
}
#endregion
#region IValidatableObject implementation
/// <summary>
/// <see cref="IValidatableObject.Validate"/>
/// </summary>
/// <param name="validationContext"><see cref="IValidatableObject.Validate"/></param>
/// <returns><see cref="IValidatableObject.Validate"/></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var validationResults = new List<ValidationResult>();
//Check driver
if (this.DriverId == Guid.Empty)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Driver), new string[] { "DriverId" }));
//Check vehicle
if (this.VehicleId == Guid.Empty)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Vehicle), new string[] { "VehicleId" }));
//Check infraction type
if (this.InfractionTypeId == Guid.Empty)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.InfractionType), new string[] { "InfractionType" }));
//Check Date is passed
if (this.Date > DateTime.Now)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.DateTimeMustBePassed, Names.Date), new string[] { "Date" }));
return validationResults;
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionAg/IInfractionRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg
{
public interface IInfractionRepository:IRepository<Infraction>
{
/// <summary>
/// Get Infractions grouped by Type
/// </summary>
/// <returns></returns>
IEnumerable<InfractionStats> GetInfractionsStats();
/// <summary>
/// Get total infractions
/// </summary>
int Count();
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/DriverAg/DriverSpecifications.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork.Specification;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg
{
public static class DriverSpecifications
{
/// <summary>
/// Specification for Driver with Identifier equals <param name="identifier" />
/// </summary>
/// <param name="identifier">The Driver identifier (Nif, Nie, ...)</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Driver> WithIdentifier(string identifier)
{
//Check arguments
if (string.IsNullOrEmpty(identifier))
throw new ArgumentNullException("Identifier");
return new DirectSpecification<Driver>(p => p.Identifier.ToUpper().Equals(identifier.ToUpper()));
}
/// <summary>
/// Specification for Driver with points (> 0) />
/// </summary>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Driver> Enabled()
{
//Check arguments
return new DirectSpecification<Driver>(p => p.Points > 0);
}
/// <summary>
/// Specification for Driver without points (== 0) />
/// </summary>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Driver> Disabled()
{
//Check arguments
return new DirectSpecification<Driver>(p => p.Points == 0);
}
/// <summary>
/// Specification for Driver with name, domain or comments like <param name="text"></param>
/// </summary>
/// <param name="text">Tex to search</param>
/// <returns>Associated specification for this criteria</returns>
public static Specification<Driver> FullText(string text)
{
Specification<Driver> specification = new TrueSpecification<Driver>();
if (!String.IsNullOrEmpty(text))
{
var firstNameSpec = new DirectSpecification<Driver>(s => s.FirstName.ToLower().Contains(text.ToLower()));
var lastNameSpec = new DirectSpecification<Driver>(s => s.LastName.ToLower().Contains(text.ToLower()));
var identifierSpec = new DirectSpecification<Driver>(s => s.Identifier.ToLower().Contains(text.ToLower()));
specification &= (firstNameSpec || lastNameSpec || identifierSpec);
}
return specification;
}
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/InfractionTypes/InfractionTypeDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.InfractionTypes
{
public class InfractionTypeDTO
{
/// <summary>
/// Get or set Brand identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Infraction type name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Infraction type associated points
/// </summary>
public int Points { get; set; }
/// <summary>
/// Infraction type description
/// </summary>
public string Description { get; set; }
/// <summary>
/// Get or set Created date
/// </summary>
public DateTime? CreatedDate { get; set; }
}
}
<file_sep>/Presentation.Windows.UI/UcControls/UcHome.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.UcControls
{
public partial class UcHome : UserControl
{
#region Members
private List<InfractionDTO> _lastInfractions = new List<InfractionDTO>();
private List<InfractionStatsDTO> _infractionStats = new List<InfractionStatsDTO>();
#endregion
#region Constructor
public UcHome()
{
InitializeComponent();
this.cmbItems.SelectedIndex = 0;
}
#endregion
#region Control events
private void chart1_Enter(object sender, EventArgs e)
{
}
private void UcHome_Enter(object sender, EventArgs e)
{
}
private void UcHome_Load(object sender, EventArgs e)
{
//this.GetLastInfractions();
}
private async void cmbItems_SelectedIndexChanged(object sender, EventArgs e)
{
await this.GetLastInfractions();
}
#endregion
#region Private methods
private async Task GetLastInfractions()
{
var count = int.Parse(this.cmbItems.SelectedItem.ToString());
this._lastInfractions = await ApiManagerInfractions.GetLast(count);
this.infractionDTOBindingSource.DataSource = _lastInfractions;
}
private async Task GetInfractionStats()
{
this.chart1.Series[0].Points.Clear();
var stats = await ApiManagerInfractions.GetStats();
if (stats != null && stats.Any())
{
this._infractionStats = stats;
this.infractionDTOBindingSource.DataSource = this._infractionStats;
foreach(var s in _infractionStats)
this.chart1.Series[0].Points.AddXY(s.Name, s.Count);
}
else
{
_infractionStats = new List<InfractionStatsDTO>();
}
}
private async Task GetItemsTotal()
{
var result = await ApiManagerTotals.GetItemTotals();
this.itemsCountsDTOBindingSource.DataSource = result;
}
#endregion
#region Public methods
public async void RefreshControl()
{
await this.GetInfractionStats();
await this.GetLastInfractions();
await this.GetItemsTotal();
}
#endregion
}
}
<file_sep>/Domain.Seedwork/Extensions/LinqExtensions.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Objects;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Data.Entity;
namespace Domain.Seedwork.Extensions
{
public static partial class LinqExtensions
{
public class Node<T>
{
internal Node() { }
public int Level { get; internal set; }
public Node<T> Parent { get; internal set; }
public T Item { get; internal set; }
public IList<Node<T>> Children { get; internal set; }
}
public static IEnumerable<Node<T>> ByHierarchy<T>(
this IEnumerable<T> source,
Func<T, bool> startWith,
Func<T, T, bool> connectBy)
{
return source.ByHierarchy<T>(startWith, connectBy, null);
}
private static IEnumerable<Node<T>> ByHierarchy<T>(
this IEnumerable<T> source,
Func<T, bool> startWith,
Func<T, T, bool> connectBy,
Node<T> parent)
{
int level = (parent == null ? 0 : parent.Level + 1);
if (source == null)
throw new ArgumentNullException("source");
if (startWith == null)
throw new ArgumentNullException("startWith");
if (connectBy == null)
throw new ArgumentNullException("connectBy");
foreach (T value in from item in source
where startWith(item)
select item)
{
var children = new List<Node<T>>();
Node<T> newNode = new Node<T>
{
Level = level,
Parent = parent,
Item = value,
Children = children.AsReadOnly()
};
foreach (Node<T> subNode in source.ByHierarchy<T>(possibleSub => connectBy(value, possibleSub),
connectBy, newNode))
{
children.Add(subNode);
}
yield return newNode;
}
}
public static void DumpHierarchy<T>(this IEnumerable<Node<T>> nodes, Func<T, string> display)
{
DumpHierarchy<T>(nodes, display, 0);
}
private static void DumpHierarchy<T>(IEnumerable<LinqExtensions.Node<T>> nodes, Func<T, string> display, int level)
{
foreach (var node in nodes)
{
for (int i = 0; i < level; i++) Console.Write(" ");
Console.WriteLine(display(node.Item));
if (node.Children != null)
DumpHierarchy(node.Children, display, level + 1);
}
}
/// <summary>
/// Traverse a hierarchical structure with LINQ-to-Hierarchical
/// <see cref="http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/fe90c616-3e2a-480a-9d6a-59b3eb467130/"/>
/// </summary>
public static IEnumerable<T> Flatten<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> before, Func<T, IEnumerable<T>> after)
{
foreach (var item in items)
{
if (before != null)
{
foreach (var b in before(item))
{
yield return b;
}
}
yield return item;
if (after != null)
{
foreach (var a in after(item))
{
yield return a;
}
}
}
}
/// <summary>
/// Adds an equivalent SQL WHERE IN() clause to the query, restricting results to a given range
/// </summary>
/// <typeparam name="TEntity">Type of entity to query</typeparam>
/// <typeparam name="TValue">Type of value to query against</typeparam>
/// <param name="query">Existing query</param>
/// <param name="selector">Expression to retrieve query field</param>
/// <param name="collection">Collection of values to limit query</param>
/// <returns>Query with added WHERE IN() clause</returns>
public static IEnumerable<TEntity> WhereIn<TEntity, TValue>
(
this ObjectQuery<TEntity> query,
Expression<Func<TEntity, TValue>> selector,
IEnumerable<TValue> collection
)
{
ParameterExpression p = selector.Parameters.Single();
//if there are no elements to the WHERE clause,
//we want no matches:
if (!collection.Any()) return query.Where(x => false);
if (collection.Count() > 3000) //could move this value to config
throw new ArgumentException("Collection too large - execution will cause stack overflow", "collection");
IEnumerable<Expression> equals = collection.Select(value =>
(Expression)Expression.Equal(selector.Body,
Expression.Constant(value, typeof(TValue))));
Expression body = equals.Aggregate(Expression.Or);
return query.Where(Expression.Lambda<Func<TEntity, bool>>(body, p));
}
}
}
<file_sep>/Presentation.Windows.UI/UcControls/UcInfractions.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Presentation.Windows.Seedwork.Api;
using Presentation.Windows.UI.SecondaryForms;
namespace Presentation.Windows.UI.UcControls
{
public partial class UcInfractions : UserControl
{
#region Members
private List<InfractionDTO> infractions = new List<InfractionDTO>();
private List<InfractionTypeDTO> infractionTypes = new List<InfractionTypeDTO>();
#endregion
#region Constructor
public UcInfractions()
{
InitializeComponent();
}
#endregion
#region Control events
private void UcInfractions_Load(object sender, EventArgs e)
{
SetResources();
this.dtpFilterFrom.Checked = false;
this.dtpFilterTo.Checked = false;
}
private async void cmdAddInfraction_Click(object sender, EventArgs e)
{
var frmAddNewInfraction = new FrmAddNewInfraction();
var infractionAdded = frmAddNewInfraction.AddNewInfraction();
if (frmAddNewInfraction.DialogResult == DialogResult.OK && infractionAdded != null)
{
this.txtFilterDriverIdentifier.Text = infractionAdded.DriverIdentifier;
this.txtFilterVehicleLicense.Text = infractionAdded.VehicleLicense;
await this.SearchInfractions();
}
}
private async void cmdSearch_Click(object sender, EventArgs e)
{
await this.SearchInfractions();
}
#endregion
#region Private methods
public async Task SearchInfractions()
{
if (this.infractionTypes == null || !this.infractionTypes.Any())
await this.LoadInfractionTypes();
DateTime? from = null;
if (this.dtpFilterFrom.Checked)
from = this.dtpFilterFrom.Value;
DateTime? to = null;
if (this.dtpFilterTo.Checked)
to = this.dtpFilterTo.Value;
var infractionTypeId = "";
if (this.cmbFilterInfractionType.SelectedValue.ToString() != Guid.Empty.ToString())
infractionTypeId = this.cmbFilterInfractionType.SelectedValue.ToString();
this.infractions = await ApiManagerInfractions.Search(this.txtFilterVehicleLicense.Text, this.txtFilterDriverIdentifier.Text, infractionTypeId, from, to );
if (infractions == null || !infractions.Any())
MessageBox.Show("No se ha encontrado ningún resultado", "Búsqueda de infracciones", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
this.infractionDTOBindingSource.DataSource = infractions;
}
private void SetResources()
{
this.cmdAddInfraction.Image = Properties.Resources.addnew;
this.cmdSearch.Image = Properties.Resources.zoom;
}
private async Task LoadInfractionTypes()
{
this.infractionTypes = new List<InfractionTypeDTO>()
{
new InfractionTypeDTO() {Name = "TODAS"}
};
var it = await ApiManagerInfractionTypes.GetAllInfractionTypes();
this.infractionTypes.AddRange(it);
this.infractionTypeDTOBindingSource.DataSource = this.infractionTypes;
}
#endregion
}
}
<file_sep>/Infrastructure.CrossCutting.NetFramework/Caching/CacheManager.cs
using Infrastructure.Crosscutting.Caching;
using System;
using System.Configuration;
using System.Runtime.Caching;
namespace Infrastructure.Crosscutting.NetFramework.Caching
{
/// <summary>
/// Cache manager implementation
/// </summary>
public sealed class CacheManager
: ICacheManager
{
#region Members
private ObjectCache _defaultCache;
private readonly bool _cacheEnabled;
#endregion
#region Constructor
/// <summary>
/// Create a new instance of CacheManager
/// </summary>
public CacheManager()
{
var strCacheEnabled = ConfigurationManager.AppSettings["CacheEnabled"];
Boolean.TryParse(strCacheEnabled, out _cacheEnabled);
}
#endregion
#region ICacheManager implementation
/// <summary>
/// <see cref="ICacheManager"/>
/// </summary>
/// <typeparam name="TResult"><see cref="ICacheManager"/></typeparam>
/// <param name="cacheItemConfig"><see cref="ICacheManager"/></param>
/// <param name="result"><see cref="ICacheManager"/></param>
/// <returns><see cref="ICacheManager"/></returns>
public bool TryGet<TResult>(CacheItemConfig cacheItemConfig, out TResult result)
{
if (cacheItemConfig != null)
{
//get default cache
_defaultCache = MemoryCache.Default;
string cacheKey = cacheItemConfig.CacheKey.GetCacheKey();
object cacheItem = _defaultCache[cacheKey];
//Check if Cache is Enabled
if (!_cacheEnabled)
cacheItem = null;
if(cacheItem != null && _cacheEnabled)
{
try
{
result = (TResult)cacheItem;
return true;
}
catch (Exception)
{
result = default(TResult);
return false;
}
}
else
{
result = default(TResult);
return false;
}
}
else
throw new ArgumentNullException("cacheItemConfig");
}
/// <summary>
/// <see cref="ICacheManager"/>
/// </summary>
/// <param name="cacheItemConfig"><see cref="ICacheManager"/></param>
/// <param name="value"><see cref="ICacheManager"/></param>
public void Add(CacheItemConfig cacheItemConfig, object value)
{
if (value != null && cacheItemConfig != null)
{
//get default cache
_defaultCache = MemoryCache.Default;
var cachekey = cacheItemConfig.CacheKey.GetCacheKey();
var expirationTime = cacheItemConfig.ExpirationTime;
var cacheItemPolicy = new CacheItemPolicy
{
AbsoluteExpiration = DateTimeOffset.Now.AddTicks(expirationTime.Ticks)
};
_defaultCache.Add(cachekey, value, cacheItemPolicy);
}
}
/// <summary>
/// <see cref="ICacheManager"/>
/// </summary>
/// <param name="cacheKey"><see cref="ICacheManager"/></param>
/// <returns><see cref="ICacheManager"/></returns>
public bool Remove(CacheKey cacheKey)
{
//get default cache
_defaultCache = MemoryCache.Default;
if (!_defaultCache.Contains(cacheKey.KeyName))
return false;
else
{
_defaultCache.Remove(cacheKey.KeyName);
return true;
}
}
/// <summary>
/// <see cref="ICacheManager"/>
/// </summary>
/// <returns><see cref="ICacheManager"/></returns>
public void ClearAll()
{
MemoryCache.Default.Dispose();
_defaultCache = MemoryCache.Default;
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/SecondaryForms/FrmAddNewInfractionType.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.SecondaryForms
{
public partial class FrmAddNewInfractionType : Form
{
#region Members
private InfractionTypeDTO _infractionType;
#endregion
#region Constructor
public FrmAddNewInfractionType()
{
InitializeComponent();
}
#endregion
#region Control events
private void FrmAddNewInfractionType_Load(object sender, EventArgs e)
{
}
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private async void cmdAccept_Click(object sender, EventArgs e)
{
if (this.ValidateData())
{
try
{
this._infractionType = await ApiManagerInfractionTypes.AddNew(this._infractionType);
this.DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
MessageBox.Show("Ha ocurrido el siguiente error:" + Environment.NewLine + Environment.NewLine + ex.GetBaseException().Message, "DGT", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
#endregion
#region Public methods
public InfractionTypeDTO AddNewInfractionType()
{
ClearErrors();
this._infractionType = new InfractionTypeDTO();
this.infractionTypeDTOBindingSource.DataSource = this._infractionType;
this.infractionTypeDTOBindingSource.MoveFirst();
var dialogResult = this.ShowDialog();
if (dialogResult == DialogResult.OK)
return this._infractionType;
else
return null;
}
#endregion
#region Private methods
private bool ValidateData()
{
this.ClearErrors();
var result = true;
if (String.IsNullOrEmpty(this.nameTextBox.Text.Trim()))
{
errP.SetError(this.nameTextBox, "Campo obligatorio");
result = false;
}
return result;
}
private void ClearErrors()
{
foreach (Control ctr in this.groupBox1.Controls)
{
errP.SetError(ctr, "");
}
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleDriverAgg/VehicleDriver.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using Domain.Seedwork;
using Infrastructure.GlobalResources;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg
{
public class VehicleDriver : BaseEntity, IValidatableObject
{
#region Members
#endregion
#region Properties
/// <summary>
/// Associated vehicle identifier
/// </summary>
public Guid VehicleId { get; set; }
/// <summary>
/// Associated vehicle
/// </summary>
public virtual Vehicle Vehicle { get; private set; }
/// <summary>
/// Associated driver identifier
/// </summary>
public Guid DriverId { get; set; }
/// <summary>
/// Associated driver
/// </summary>
public virtual Driver Driver { get; private set; }
#endregion
#region Public methods
/// <summary>
/// Associate brand to current car
/// </summary>
/// <param name="brand"></param>
public void SetVehicle(Vehicle brand)
{
if (brand == null || brand.IsTransient())
throw new ArgumentNullException(String.Format(CommonMessages.exception_CannotAssociateTransientOrNullEntity, Names.Vehicle));
this.VehicleId = brand.Id;
this.Vehicle = brand;
}
/// <summary>
/// Associate brand to current car
/// </summary>
/// <param name="brand"></param>
public void SetDriver(Driver brand)
{
if (brand == null || brand.IsTransient())
throw new ArgumentNullException(String.Format(CommonMessages.exception_CannotAssociateTransientOrNullEntity, Names.Driver));
this.DriverId = brand.Id;
this.Driver = brand;
}
#endregion
#region IValidatableObject implementation
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var validationResults = new List<ValidationResult>();
//Check vehicle
if (this.VehicleId == Guid.Empty)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Vehicle), new string[] { "VehicleId" }));
//Check driver
if (this.DriverId == Guid.Empty)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Driver), new string[] { "DriverId" }));
return validationResults;
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/Migrations/Configuration.cs
using Infrastructure.Data.MainBoundedContext.DgtModule.InitialData;
namespace Infrastructure.Data.MainBoundedContext.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<UnitOfWork.MainBCUnitOfWork>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
protected override void Seed(UnitOfWork.MainBCUnitOfWork context)
{
//DgtModule entities
InitialDataBrands.Seed(context);
InitialDataDrivers.Seed(context);
InitialDataInfractionTypes.Seed(context);
InitialDataVehicles.Seed(context);
InitialDataInfractions.Seed(context);
//// Custom indexes
CustomIndexes.CreateCustomIndexes(context);
context.SaveChanges();
}
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/InitialData/InitialDataDrivers.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using System.Data.Entity.Migrations;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.InitialData
{
public static class InitialDataDrivers
{
public static void Seed(UnitOfWork.MainBCUnitOfWork context)
{
var iagoAspas = new Driver() { FirstName = "Iago", LastName = "Aspas", Identifier = "0000000A", CreatedDate = DateTime.Now};
iagoAspas.ChangeCurrentIdentity(EntityGuids.Drivers.IagoAspas);
iagoAspas.AddPoints(10);
context.Drivers.AddOrUpdate(iagoAspas);
var nemanjaRadoja = new Driver() { FirstName = "Nemanja", LastName = "Radoja", Identifier = "11111111B", CreatedDate = DateTime.Now };
nemanjaRadoja.ChangeCurrentIdentity(EntityGuids.Drivers.NemanjaRadoja);
nemanjaRadoja.AddPoints(10);
context.Drivers.AddOrUpdate(nemanjaRadoja);
var franBeltran = new Driver() { FirstName = "Fran", LastName = "Beltrán", Identifier = "2222222C", CreatedDate = DateTime.Now };
franBeltran.ChangeCurrentIdentity(EntityGuids.Drivers.FranBeltran);
franBeltran.AddPoints(9);
context.Drivers.AddOrUpdate(franBeltran);
}
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/_ApiResult.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Presentation.Windows.Seedwork.Api
{
public class ErrorItem
{
public string path { get; set; }
public string message { get; set; }
}
public abstract class ApiResultBase
{
public Boolean ok { get; set; }
public string message { get; set; }
}
public class ApiResult<T> : ApiResultBase
{
public T result { get; set; }
}
public class ApiResultError : ApiResultBase
{
private List<ErrorItem> _errors = null;
public List<ErrorItem> errors
{
get
{
if (_errors == null)
_errors = new List<ErrorItem>();
return _errors;
}
set { _errors = new List<ErrorItem>(value); }
}
}
}
<file_sep>/Presentation.Windows.UI/SecondaryForms/FrmAttachDriver.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
using Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.SecondaryForms
{
public partial class FrmAttachDriver : Form
{
#region Members
private VehicleDTO vehicleDTO;
private DriverDTO driverDTO;
private VehicleDriverDTO vehicleDriverDTO;
#endregion
#region Constructor
public FrmAttachDriver()
{
InitializeComponent();
}
#endregion
#region Control events
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private async void cmdAccept_Click(object sender, EventArgs e)
{
if (this.driverDTO != null)
{
try
{
this.vehicleDriverDTO = await ApiManagerVehicles.AttachDriver(this.vehicleDTO.License, this.driverDTO.Identifier);
this.DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
MessageBox.Show("Ha ocurrido el siguiente error:" + Environment.NewLine + Environment.NewLine + ex.GetBaseException().Message, "DGT", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
MessageBox.Show("No hay conductor seleccionado", "Añadir conductor habitual",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
private void FrmAttachDriver_Load(object sender, EventArgs e)
{
this.cmdAccept.Image = Properties.Resources.ok;
this.cmdCancel.Image = Properties.Resources.cancel;
}
private void txtIdentifierFilter_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtIdentifierFilter.Text = "";
this.driverDTO = null;
this.driverDTOBindingSource.Clear();
this.cmdAccept.Enabled = false;
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtIdentifierFilter.Text.Trim();
if (!String.IsNullOrEmpty(filter))
{
e.Handled = true;
this.GetDriverByIdentifier(filter);
}
}
}
#endregion
#region Public methods
public void AttachDriver(VehicleDTO _vehicleDTO)
{
if (_vehicleDTO == null)
throw new ArgumentNullException("_vehicleDTO");
this.vehicleDTO = _vehicleDTO;
ClearErrors();
this.vehicleDTOBindingSource.DataSource = vehicleDTO;
this.ShowDialog();
}
#endregion
#region private methods
private void ClearErrors()
{
this.errP.SetError(this.txtIdentifierFilter, "");
}
private async void GetDriverByIdentifier(string identifier)
{
if (!String.IsNullOrEmpty(identifier))
{
var result = await ApiManagerDrivers.GetByNifNie(identifier);
if (result != null)
{
this.driverDTOBindingSource.DataSource = result;
this.driverDTO = result;
this.cmdAccept.Enabled = true;
this.cmdAccept.Focus();
}
else
{
this.driverDTO = null;
this.driverDTOBindingSource.Clear();
this.cmdAccept.Enabled = false;
MessageBox.Show("No se ha encontrado ningún Conductor con el NIF/NIE " + identifier,
"Añadir conductor habitual",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
else
{
this.cmdAccept.Enabled = false;
MessageBox.Show("Debes introducir el NIF/NIE del conductor", "Añadir conductor habitual",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
#endregion
}<file_sep>/Presentation.Windows.Seedwork/Api/ApiManagerDrivers.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers;
using Newtonsoft.Json;
namespace Presentation.Windows.Seedwork.Api
{
public class ApiManagerDrivers: ApiManagerBase
{
const string URL_KEY = "drivers";
public static async Task<List<DriverDTO>> Search(string filter)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/search/" + filter))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<DriverDTO>();
else
{
var items = JsonConvert.DeserializeObject<DriverDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<List<VehicleDriverDTO>> GetDriversByVehicleLicense(string license)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/vehicle/" + license))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<VehicleDriverDTO>();
else
{
var items = JsonConvert.DeserializeObject<VehicleDriverDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<DriverDTO> GetByNifNie(string identifier)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/identifier/" + identifier))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return null;
else
{
var item = JsonConvert.DeserializeObject<DriverDTO>(result);
return item;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<DriverDTO> AddNew(DriverDTO driver)
{
using (var client = GetHttpClient())
{
var serializeObject = JsonConvert.SerializeObject(driver);
var content = new StringContent(serializeObject, Encoding.UTF8, "application/json");
using (var response = await client.PostAsync(URL_KEY + "/save", content))
{
if (response.IsSuccessStatusCode)
{
if (response.Content != null)
{
var stringResult = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<DriverDTO>(stringResult);
return result;
}
else
return null;
}
else
{
//Logger.Error("Error creando {0} '{1}'.", syncEntity.Singular(), obj.Name);
throw new Exception(await CastResultError(response));
}
}
}
}
}
}
<file_sep>/Infrastructure.CrossCutting.NetFramework/Adapter/AutomapperTypeAdapterFactory.cs
//===================================================================================
// Microsoft Developer & Platform Evangelism
//===================================================================================
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//===================================================================================
// Copyright (c) Microsoft Corporation. All Rights Reserved.
// This code is released under the terms of the MS-LPL license,
// http://microsoftnlayerapp.codeplex.com/license
//===================================================================================
using AutoMapper;
using Infrastructure.Crosscutting.Adapter;
using System;
using System.Diagnostics;
using System.Linq;
namespace Infrastructure.Crosscutting.NetFramework.Adapter
{
public class AutomapperTypeAdapterFactory
:ITypeAdapterFactory
{
#region Constructor
/// <summary>
/// Create a new Automapper type adapter factory
/// </summary>
public AutomapperTypeAdapterFactory()
{
try
{
//scan all assemblies finding Automapper Profile
var profiles = AppDomain.CurrentDomain
.GetAssemblies()
.SelectMany(a => a.GetTypes())
.Where(t => t.BaseType == typeof(Profile));
var y = profiles.ToList();
Mapper.Initialize(cfg =>
{
foreach (var item in profiles)
{
try
{
if (item.FullName != "AutoMapper.SelfProfiler`2" &&
item.FullName != "AutoMapper.Configuration.MapperConfigurationExpression" &&
item.FullName != "AutoMapper.Configuration.MapperConfigurationExpression+NamedProfile")
{
cfg.AddProfiles(item);
}
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}
});
}
catch (System.Reflection.ReflectionTypeLoadException typeEx)
{
var msg = "";
foreach (var i in typeEx.LoaderExceptions)
{
msg += i.Message + Environment.NewLine;
}
throw new Exception(msg);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region ITypeAdapterFactory Members
public ITypeAdapter Create()
{
return new AutomapperTypeAdapter();
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/Repositories/BrandRepository.cs
using Domain.Seedwork;
using Domain.Seedwork.Specification;
using Infrastructure.Data.MainBoundedContext.UnitOfWork;
using Infrastructure.Data.Seedwork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.Repositories
{
public class BrandRepository: Repository<Brand>, IBrandRepository
{
#region Constructor
/// <summary>
/// Create a new instance of BrandRepository
/// </summary>
/// <param name="unitOfWork">Associated unit of work</param>
public BrandRepository(MainBCUnitOfWork unitOfWork)
: base(unitOfWork)
{
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/UcControls/UcVehicles.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
using Presentation.Windows.Seedwork.Api;
using Presentation.Windows.UI.SecondaryForms;
namespace Presentation.Windows.UI.UcControls
{
public partial class UcVehicles : UserControl
{
#region Members
private List<VehicleDTO> vehicles = new List<VehicleDTO>();
private VehicleDTO currentVehicle;
#endregion
#region Constructor
public UcVehicles()
{
InitializeComponent();
}
#endregion
#region Control events
private void UcVehicles_Load(object sender, EventArgs e)
{
SetResources();
}
private void UcVehicles_Enter(object sender, EventArgs e)
{
SetResources();
}
private async void cmdAddNewVehicle_Click(object sender, EventArgs e)
{
var frmAddNewVehicle = new FrmAddNewVehicle();
var driverAdded = frmAddNewVehicle.AddNewVehicle();
if (frmAddNewVehicle.DialogResult == DialogResult.OK && driverAdded != null)
{
this.txtFilter.Text = driverAdded.License;
await this.SearchVehicles(driverAdded.License);
}
}
private async void txtFilter_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtFilter.Text = "";
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtFilter.Text;
e.Handled = true;
await this.SearchVehicles(filter);
}
}
private void vehicleDTOBindingSource_CurrentChanged(object sender, EventArgs e)
{
this.currentVehicle = this.vehicleDTOBindingSource.Current as VehicleDTO;
if (currentVehicle != null)
{
GetInfractions(currentVehicle.License);
GetDrivers(currentVehicle.License);
}
}
#endregion
#region Private methods
public async Task SearchVehicles(string filter = null)
{
if (filter == null)
filter = this.txtFilter.Text;
this.vehicles = await ApiManagerVehicles.Search(filter);
if (vehicles == null || !vehicles.Any())
MessageBox.Show("No se ha encontrado ningún resultado", "Búsqueda de vehículos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
{
this.vehicleDTOBindingSource.DataSource = vehicles;
this.vehicleDriverDTOBindingSource.MoveFirst();
}
}
private void SetResources()
{
this.cmdAddNewVehicle.Image = Properties.Resources.addnew;
this.lnkAddDriver.Image = Properties.Resources.create16x16;
}
private async void GetInfractions(string license)
{
var results = await ApiManagerInfractions.ByVehicleLicense(license);
this.infractionDTOBindingSource.DataSource = results;
}
private async void GetDrivers(string license)
{
var results = await ApiManagerDrivers.GetDriversByVehicleLicense(license);
this.vehicleDriverDTOBindingSource.DataSource = results;
}
#endregion
private void lnkAddDriver_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (currentVehicle != null)
{
var frmAttachDriver = new FrmAttachDriver();
frmAttachDriver.AttachDriver(currentVehicle);
if (frmAttachDriver.DialogResult == DialogResult.OK)
{
this.GetDrivers(this.currentVehicle.License);
}
}
else
MessageBox.Show("No hay ningún vehículo seleccionado", "Añadir conductor habitual",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
<file_sep>/Domain.Seedwork/BaseEntity.cs
using System;
namespace Domain.Seedwork
{
public abstract class BaseEntity: Entity
{
#region Properties
/// <summary>
/// Get or set created date
/// </summary>
public DateTime CreatedDate { get; set; }
#endregion
#region Constructor
/// <summary>
/// Create a new instance of AggRootEntity
/// </summary>
protected BaseEntity()
{
this.CreatedDate = DateTime.Now;
}
#endregion
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/Controllers/DriversController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Application.MainBoundedContext.Services;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
namespace DistributedServices.MainBoundedContext.Api.Controllers
{
public class DriversController : ApiController
{
#region Members
private readonly IDgtAppService _dgtAppService;
#endregion
#region Constructor
public DriversController(IDgtAppService dgtAppService)
{
//Check dependencies
if (dgtAppService == null)
throw new ArgumentNullException("dgtAppService");
//Assign dependencies
this._dgtAppService = dgtAppService;
}
#endregion
#region Api methods
[HttpGet]
[Route("api/drivers/{id:guid}")]
public IHttpActionResult Get(Guid id)
{
var driverDTO = this._dgtAppService.GetDriverById(id);
return Ok(driverDTO);
}
[HttpGet]
[Route("api/drivers/identifier/{identifier}")]
public IHttpActionResult Nif(string identifier)
{
var driverDTO = this._dgtAppService.GetDriverByNifNie(identifier);
return Ok(driverDTO);
}
[HttpGet]
[Route("api/drivers/search/{filter}")]
public IHttpActionResult Search(string filter)
{
var driverDTO = this._dgtAppService.SearchDrivers(filter);
return Ok(driverDTO);
}
[HttpGet]
[Route("api/drivers/vehicle/{license}")]
public IHttpActionResult GetDriversByVehicleLicense(string license)
{
var vehiclesDTO = this._dgtAppService.GetDriversByVehicle(license);
return Ok(vehiclesDTO);
}
[HttpPost]
[Route("api/drivers/save")]
public IHttpActionResult Save(DriverDTO dto)
{
try
{
var result = this._dgtAppService.AddNewDriver(dto);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
#endregion
}
}
<file_sep>/Infrastructure.CrossCutting.Seedwork/Caching/CacheItemConfig.cs
using System;
namespace Infrastructure.Crosscutting.Caching
{
/// <summary>
/// A cache item configuration
/// </summary>
public class CacheItemConfig
{
#region Properties
readonly CacheKey _cacheKey;
/// <summary>
/// Get the associated cached key
/// </summary>
public CacheKey CacheKey
{
get
{
return _cacheKey;
}
}
readonly TimeSpan _expirationTime;
/// <summary>
/// Get the associted expiration time
/// </summary>
public TimeSpan ExpirationTime
{
get
{
return _expirationTime;
}
}
#endregion
#region Constructor
/// <summary>
/// Create a new instance of cache item
/// </summary>
/// <param name="cacheKey">The cached key</param>
public CacheItemConfig(CacheKey cacheKey)
: this(cacheKey, new TimeSpan(0, 0, 10))
{
}
/// <summary>
/// Create a new instance of cache item
/// </summary>
/// <param name="cacheKey">The cached key</param>
/// <param name="expirationTime">Associated expiration time</param>
public CacheItemConfig(CacheKey cacheKey, TimeSpan expirationTime)
{
if (cacheKey == (CacheKey)null)
throw new ArgumentNullException("cacheKey");
_cacheKey = cacheKey;
_expirationTime = expirationTime;
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/UcControls/UcDrivers.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Presentation.Windows.Seedwork.Api;
using Presentation.Windows.UI.SecondaryForms;
namespace Presentation.Windows.UI.UcControls
{
public partial class UcDrivers : UserControl
{
#region Members
private List<DriverDTO> drivers = new List<DriverDTO>();
#endregion
#region Constructor
public UcDrivers()
{
InitializeComponent();
}
#endregion
#region Control events
private void UcDrivers_Load(object sender, EventArgs e)
{
SetResources();
}
private async void cmdAddNewDriver_Click(object sender, EventArgs e)
{
var frmAddNewDriver = new FrmAddNewDriver();
var driverAdded = frmAddNewDriver.AddNewDriver();
if (frmAddNewDriver.DialogResult == DialogResult.OK && driverAdded != null)
{
this.txtFilter.Text = driverAdded.Identifier;
await this.SearchDrivers(driverAdded.Identifier);
}
}
private async void txtFilter_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtFilter.Text = "";
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtFilter.Text;
e.Handled = true;
await this.SearchDrivers(filter);
}
}
private void cmdClearLocalFilter_Click(object sender, EventArgs e)
{
this.txtFilter.Text = "";
this.driverDTOBindingSource.DataSource = this.drivers.OrderBy(m => m.FullName);
}
private async void driverDTOBindingSource_CurrentChanged(object sender, EventArgs e)
{
await GetDriverVehicles();
await GetDriverInfractions();
}
#endregion
#region Private methods
public async Task SearchDrivers(string filter = null)
{
if (filter == null)
filter = this.txtFilter.Text;
if (!String.IsNullOrEmpty(filter))
{
this.drivers = await ApiManagerDrivers.Search(filter);
if (drivers == null || !drivers.Any())
MessageBox.Show("No se ha encontrado ningún resultado", "Búsqueda de conductores", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
this.driverDTOBindingSource.DataSource = drivers;
}
}
private async Task GetDriverVehicles()
{
var currentDriver = this.driverDTOBindingSource.Current as DriverDTO;
if (currentDriver != null)
{
var vehicles = await ApiManagerVehicles.ByDriverIdentifier(currentDriver.Identifier);
this.vehicleDriverDTOBindingSource.DataSource = vehicles;
}
}
private async Task GetDriverInfractions()
{
var currentDriver = this.driverDTOBindingSource.Current as DriverDTO;
if (currentDriver != null)
{
var infractions = await ApiManagerInfractions.ByDriverIdentifier(currentDriver.Identifier);
this.infractionDTOBindingSource.DataSource = infractions;
}
}
private void SetResources()
{
this.cmdAddNewDriver.Image = Properties.Resources.addnew;
}
#endregion
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/Brands/BrandDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.Brands
{
public class BrandDTO
{
/// <summary>
/// Get or set Brand identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Get or set the Brand name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Get or set Created date
/// </summary>
public DateTime? CreatedDate { get; set; }
}
}
<file_sep>/Presentation.Windows.UI/UcControls/UcBrands.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Brands;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.UcControls
{
public partial class UcBrands : UserControl
{
#region Members
private List<BrandDTO> brands = new List<BrandDTO>();
#endregion
#region Constructor
public UcBrands()
{
InitializeComponent();
}
#endregion
#region Control events
private async void UcBrands_Load(object sender, EventArgs e)
{
await this.SearchBrands();
}
private void txtFilter_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtFilter.Text = "";
this.brandDTOBindingSource.DataSource = this.brands.OrderBy(m => m.Name);
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtFilter.Text;
this.brandDTOBindingSource.DataSource = this.brands.Where(m => m.Name.ToLower().Contains(filter.ToLower())).OrderBy(m => m.Name);
e.Handled = true;
}
}
private void cmdClearLocalFilter_Click(object sender, EventArgs e)
{
this.txtFilter.Text = "";
this.brandDTOBindingSource.DataSource = this.brands.OrderBy(m => m.Name);
}
#endregion
#region Private methods
public async Task SearchBrands()
{
this.brands = await ApiManagerBrands.GetAllBrands();
this.brandDTOBindingSource.DataSource = this.brands.OrderBy(m => m.Name);
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/Repositories/InfractionRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg;
using Infrastructure.Data.MainBoundedContext.UnitOfWork;
using Infrastructure.Data.Seedwork;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.Repositories
{
public class InfractionRepository: Repository<Infraction>, IInfractionRepository
{
#region Constructor
/// <summary>
/// Create a new instance of InfractionRepository
/// </summary>
/// <param name="unitOfWork">Associated unit of work</param>
public InfractionRepository(MainBCUnitOfWork unitOfWork)
: base(unitOfWork)
{
}
#endregion
#region IInfractionRepository implementation
/// <summary>
/// <see cref="IInfractionRepository"/>
/// </summary>
/// <returns><see cref="IInfractionRepository"/></returns>
public IEnumerable<InfractionStats> GetInfractionsStats()
{
var currentUnitOfWork = this.UnitOfWork as MainBCUnitOfWork;
var set = currentUnitOfWork.CreateSet<Infraction>();
var result = set
.GroupBy(n => n.InfractionType.Name)
.Select(n => new InfractionStats()
{
Name= n.Key,
Count = n.Count()
}
)
.OrderBy(n => n.Name);
return result;
}
/// <summary>
/// <see cref="IInfractionRepository"/>
/// </summary>
public int Count()
{
var currentUnitOfWork = this.UnitOfWork as MainBCUnitOfWork;
var set = currentUnitOfWork.CreateSet<Infraction>();
return set.Count();
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionAg/InfractionStats.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg
{
public class InfractionStats
{
/// <summary>
/// Infraction type name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Number el infractions per current infraction type
/// </summary>
public int Count { get; set; }
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/Controllers/InfractionTypesController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Application.MainBoundedContext.Services;
namespace DistributedServices.MainBoundedContext.Api.Controllers
{
public class InfractionTypesController : ApiController
{
#region Members
private readonly IDgtAppService _dgtAppService;
#endregion
#region Constructor
public InfractionTypesController(IDgtAppService dgtAppService)
{
//Check dependencies
if (dgtAppService == null)
throw new ArgumentNullException("dgtAppService");
//Assign dependencies
this._dgtAppService = dgtAppService;
}
#endregion
#region Api methods
[HttpGet]
public IHttpActionResult Get()
{
var infractionTypesDTO = this._dgtAppService.GetAllInfractionTypes();
return Ok(infractionTypesDTO);
}
[HttpPost]
public IHttpActionResult Post(InfractionTypeDTO dto)
{
try
{
var result = this._dgtAppService.AddNewInfractionType(dto);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleAgg/VehicleFactory.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg
{
public static class VehicleFactory
{
public static Vehicle CreateVehicle(string license, Guid brandId, string model)
{
var v = new Vehicle()
{
License = license,
BrandId = brandId,
Model = model
};
return v;
}
public static Vehicle CreateVehicle(string license, Brand brand, string model)
{
var v = new Vehicle()
{
License = license,
Model = model
};
v.SetBrand(brand);
return v;
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/DriverAg/Driver.cs
using Domain.Seedwork;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
using Infrastructure.GlobalResources;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg
{
public class Driver: BaseEntity, IValidatableObject
{
#region Members
private const int INITIAL_POINTS = 12;
private const int MAX_POINTS = 15;
#endregion
#region Properties
/// <summary>
/// Driver identifier (DNF, NIF, NIE)
/// </summary>
public string Identifier { get; set; }
/// <summary>
/// Driver first name
/// </summary>
public string FirstName { get; set; }
/// <summary>
/// Driver last name
/// </summary>
public string LastName { get; set; }
/// <summary>
/// Driver full name (first name with last name)
/// </summary>
public string FullName => this.FirstName + " " + this.LastName;
/// <summary>
/// Driver remaining points.
/// </summary>
public int Points { get; set; }
#endregion
#region Public methods
/// <summary>
/// Remove driver points
/// </summary>
/// <param name="pointsToRemove">Points to remove to driver</param>
/// <returns></returns>
public int RemovePoints(int pointsToRemove)
{
if (this.Points < pointsToRemove)
this.Points = 0;
else
this.Points = this.Points - pointsToRemove;
return this.Points;
}
/// <summary>
/// Add driver points
/// </summary>
/// <param name="pointsToAdd">Points to add to driver</param>
/// <returns></returns>
public int AddPoints(int pointsToAdd)
{
var p = this.Points + pointsToAdd;
if (p < MAX_POINTS)
p = MAX_POINTS;
this.Points = p;
return this.Points;
}
/// <summary>
/// Set initial points
/// </summary>
/// <returns></returns>
public void SetInitialPoints()
{
this.Points = INITIAL_POINTS;
}
#endregion
#region IValidatableObject implementation
/// <summary>
/// <see cref="IValidatableObject.Validate"/>
/// </summary>
/// <param name="validationContext"><see cref="IValidatableObject.Validate"/></param>
/// <returns><see cref="IValidatableObject.Validate"/></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var validationResults = new List<ValidationResult>();
//Check Identifier
if (String.IsNullOrEmpty(Identifier) || String.IsNullOrWhiteSpace(Identifier))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Identifier), new string[] { "Identifier" }));
else if(Identifier.Length < 5 || Identifier.Length > 25)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.InvalidFormat, Names.Identifier), new string[] { "Identifier" }));
//Check First name
if (String.IsNullOrEmpty(FirstName) || String.IsNullOrWhiteSpace(FirstName))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.FirstName), new string[] { "FirstName" }));
//Check Last name
if (String.IsNullOrEmpty(LastName) || String.IsNullOrWhiteSpace(LastName))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.LastName), new string[] { "LastName" }));
// Check points
if(this.Points < 0 || this.Points > MAX_POINTS)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.Range, Names.Points, 0, MAX_POINTS), new string[] { "Points" }));
return validationResults;
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/Repositories/VehicleDriverRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
using Infrastructure.Data.MainBoundedContext.UnitOfWork;
using Infrastructure.Data.Seedwork;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.Repositories
{
public class VehicleDriverRepository: Repository<VehicleDriver>, IVehicleDriverRepository
{
#region Constructor
/// <summary>
/// Create a new instance of VehicleDriverRepository
/// </summary>
/// <param name="unitOfWork">Associated unit of work</param>
public VehicleDriverRepository(MainBCUnitOfWork unitOfWork)
: base(unitOfWork)
{
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/SecondaryForms/FrmAddNewDriver.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.SecondaryForms
{
public partial class FrmAddNewDriver : Form
{
#region Members
private DriverDTO _driver;
#endregion
#region Constructor
public FrmAddNewDriver()
{
InitializeComponent();
SetResources();
}
#endregion
#region Control events
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private async void cmdAccept_Click(object sender, EventArgs e)
{
if (this.ValidateData())
{
try
{
this._driver = await ApiManagerDrivers.AddNew(this._driver);
this.DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
MessageBox.Show("Ha ocurrido el siguiente error:" + Environment.NewLine + Environment.NewLine + ex.GetBaseException().Message, "DGT", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
#endregion
#region Public methods
public DriverDTO AddNewDriver()
{
ClearErrors();
this._driver = new DriverDTO();
this.driverDTOBindingSource.DataSource = this._driver;
this.driverDTOBindingSource.MoveFirst();
var dialogResult = this.ShowDialog();
if (dialogResult == DialogResult.OK)
return this._driver;
else
return null;
}
#endregion
#region Private methods
private bool ValidateData()
{
this.ClearErrors();
var result = true;
// Check identification
if (String.IsNullOrEmpty(this.identifierTextBox.Text.Trim()))
{
errP.SetError(this.identifierTextBox, "Campo obligatorio");
result = false;
}
// Check first name
if (String.IsNullOrEmpty(this.firstNameTextBox.Text.Trim()))
{
errP.SetError(this.firstNameTextBox, "Campo obligatorio");
result = false;
}
// Check last name
if (String.IsNullOrEmpty(this.lastNameTextBox.Text.Trim()))
{
errP.SetError(this.lastNameTextBox, "Campo obligatorio");
result = false;
}
return result;
}
private void ClearErrors()
{
foreach (Control ctr in this.groupBox1.Controls)
{
errP.SetError(ctr, "");
}
}
private void SetResources()
{
this.cmdCancel.Image = global::Presentation.Windows.UI.Properties.Resources.cancel;
this.cmdAccept.Image = global::Presentation.Windows.UI.Properties.Resources.ok;
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/Mapping/BrandEntityConfiguration.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping
{
class BrandEntityConfiguration
:EntityTypeConfiguration<Brand>
{
public BrandEntityConfiguration()
{
//Configure keys and properties
this.HasKey(c => c.Id);
this.Property(c => c.Name)
.HasMaxLength(150)
.IsRequired();
//Table mappings
this.ToTable("Brands");
}
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/Controllers/BrandsController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Application.MainBoundedContext.Services;
namespace DistributedServices.MainBoundedContext.Api.Controllers
{
public class BrandsController : ApiController
{
#region Members
private readonly IDgtAppService _dgtAppService;
#endregion
#region Constructor
public BrandsController(IDgtAppService dgtAppService)
{
//Check dependencies
if (dgtAppService == null)
throw new ArgumentNullException("dgtAppService");
//Assign dependencies
this._dgtAppService = dgtAppService;
}
#endregion
#region Api methods
[HttpGet]
public IHttpActionResult Get()
{
var brandsDTO = this._dgtAppService.GetAllBrands();
return Ok(brandsDTO);
}
[HttpGet]
public IHttpActionResult Get(Guid id)
{
var brandDTO = this._dgtAppService.GetBrandById(id);
return Ok(brandDTO);
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionTypeAg/InfractionType.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
using Infrastructure.GlobalResources;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg
{
public class InfractionType: BaseEntity, IValidatableObject
{
#region Members
private const int MAX_POINTS = 15;
#endregion
#region Properties
/// <summary>
/// Infraction type name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Infraction type associated points
/// </summary>
public int Points { get; set; }
/// <summary>
/// Infraction type description
/// </summary>
public string Description { get; set; }
#endregion
#region IValidatableObject implementation
/// <summary>
/// <see cref="IValidatableObject.Validate"/>
/// </summary>
/// <param name="validationContext"><see cref="IValidatableObject.Validate"/></param>
/// <returns><see cref="IValidatableObject.Validate"/></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var validationResults = new List<ValidationResult>();
//Check Last name
if (String.IsNullOrEmpty(Name) || String.IsNullOrWhiteSpace(Name))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Name), new string[] { "Name" }));
// Check points
if (this.Points < 0 || this.Points > MAX_POINTS)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.Range, Names.Points, 0, MAX_POINTS), new string[] { "Points" }));
return validationResults;
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/UcControls/UcInfractionTypes.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Presentation.Windows.Seedwork.Api;
using Presentation.Windows.UI.SecondaryForms;
namespace Presentation.Windows.UI.UcControls
{
public partial class UcInfractionTypes : UserControl
{
#region Members
private List<InfractionTypeDTO>infractionTypes = new List<InfractionTypeDTO>();
#endregion
#region Constructor
public UcInfractionTypes()
{
InitializeComponent();
}
#endregion
#region Control events
private async void UcInfractionTypes_Load(object sender, EventArgs e)
{
this.infractionTypes = await ApiManagerInfractionTypes.GetAllInfractionTypes();
this.infractionTypeDTOBindingSource.DataSource = this.infractionTypes.OrderBy(m => m.Name);
SetResources();
}
private void txtFilter_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtFilter.Text = "";
this.infractionTypeDTOBindingSource.DataSource = this.infractionTypes.OrderBy(m => m.Name);
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtFilter.Text;
this.infractionTypeDTOBindingSource.DataSource = this.infractionTypes.Where(m => m.Name.ToLower().Contains(filter.ToLower())).OrderBy(m => m.Name);
e.Handled = true;
}
}
private void cmdClearLocalFilter_Click(object sender, EventArgs e)
{
this.txtFilter.Text = "";
this.infractionTypeDTOBindingSource.DataSource = this.infractionTypes.OrderBy(m => m.Name);
}
private void cmdAddNewInfractionType_Click(object sender, EventArgs e)
{
var frmAddNewInfractionType = new FrmAddNewInfractionType();
var infractionTypeAdded = frmAddNewInfractionType.AddNewInfractionType();
if (frmAddNewInfractionType.DialogResult == DialogResult.OK && infractionTypeAdded != null)
{
this.infractionTypes.Add(infractionTypeAdded);
this.infractionTypeDTOBindingSource.Add(infractionTypeAdded);
}
}
#endregion
#region Private methods
private void SetResources()
{
this.cmdAddNewInfractionType.Image = Properties.Resources.addnew;
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace Presentation.Windows.UI
{
static class Program
{
public static FrmSplash frmSplash = null;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
//show splash
Thread splashThread = new Thread(new ThreadStart(
delegate
{
frmSplash = new FrmSplash();
System.Windows.Forms.Application.Run(frmSplash);
}
));
splashThread.SetApartmentState(ApartmentState.STA);
splashThread.Start();
//run form - time taking operation
FrmContainer mainForm = new FrmContainer();
mainForm.Load += new EventHandler(mainForm_Load);
try
{
System.Windows.Forms.Application.Run(mainForm);
}
catch (Exception ex)
{
MessageBox.Show("Ha ocurrido un error en la aplicación", "DGT", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
static void mainForm_Load(object sender, EventArgs e)
{
//close splash
if (frmSplash == null)
{
return;
}
frmSplash.Invoke(new Action(frmSplash.Close));
frmSplash.Dispose();
frmSplash = null;
}
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/ApiManagerInfractions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Newtonsoft.Json;
namespace Presentation.Windows.Seedwork.Api
{
public class ApiManagerInfractions: ApiManagerBase
{
const string URL_KEY = "infractions";
public static async Task<List<InfractionDTO>> Search(string vehicleLicense, string driverIdentifier, string infractionTypeId, DateTime? from, DateTime? to)
{
var url = URL_KEY + "/search/?";
if (!String.IsNullOrEmpty(vehicleLicense))
url += "vehicleLicense=" + vehicleLicense + "&";
if (!String.IsNullOrEmpty(driverIdentifier))
url += "driverIdentifier=" + driverIdentifier + "&";
if (!String.IsNullOrEmpty(infractionTypeId))
url += "infractionTypeId=" + infractionTypeId + "&";
if (from != null)
url += "from=" + from.Value.ToString("yyyy-MM-dd") + "&";
if (to != null)
url += "to=" + to.Value.ToString("yyyy-MM-dd") + "&";
if (url.EndsWith("&"))
url = url.Substring(0, url.Length - 1);
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(url))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<InfractionDTO>();
else
{
var items = JsonConvert.DeserializeObject<InfractionDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<InfractionDTO> AddNew(InfractionDTO infraction)
{
using (var client = GetHttpClient())
{
var serializeObject = JsonConvert.SerializeObject(infraction);
var content = new StringContent(serializeObject, Encoding.UTF8, "application/json");
using (var response = await client.PostAsync(URL_KEY + "/save", content))
{
if (response.IsSuccessStatusCode)
{
if (response.Content != null)
{
var stringResult = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<InfractionDTO>(stringResult);
return result;
}
else
return null;
}
else
{
throw new Exception(await CastResultError(response));
}
}
}
}
public static async Task<List<InfractionDTO>> ByDriverIdentifier(string identifier)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/driver/" + identifier))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<InfractionDTO>();
else
{
var items = JsonConvert.DeserializeObject<InfractionDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<List<InfractionDTO>> ByVehicleLicense(string license)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/vehicle/" + license))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<InfractionDTO>();
else
{
var items = JsonConvert.DeserializeObject<InfractionDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<List<InfractionDTO>> GetLast(int count)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/last/" + count))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<InfractionDTO>();
else
{
var items = JsonConvert.DeserializeObject<InfractionDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<List<InfractionStatsDTO>> GetStats()
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/stats"))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<InfractionStatsDTO>();
else
{
var items = JsonConvert.DeserializeObject<InfractionStatsDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
}
}
<file_sep>/Infrastructure.CrossCutting.Seedwork/Caching/CacheKey.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Infrastructure.Crosscutting.Caching
{
/// <summary>
/// Represent a cache key information for Cache manager
/// </summary>
public sealed class CacheKey
{
#region Properties
private readonly string _keyName;
/// <summary>
/// Get the key name for this cache key
/// </summary>
public string KeyName
{
get { return _keyName; }
}
private Dictionary<string, string> _cacheVaryParams;
/// <summary>
/// Get the name value collection of elements that vary the cache item
/// </summary>
public Dictionary<string, string> CacheVaryParams
{
get { return _cacheVaryParams; }
}
#endregion
#region Constructor
/// <summary>
/// Create a new instance of CacheKey
/// </summary>
/// <param name="keyName">the key name</param>
public CacheKey(string keyName)
{
//check preconditions for this input params!
if (String.IsNullOrEmpty(keyName)
||
String.IsNullOrWhiteSpace(keyName))
{
throw new ArgumentNullException("keyName");
}
_keyName = keyName;
}
/// <summary>
/// Create a new instance of CacheKey
/// </summary>
/// <param name="keyName">The cache key name</param>
/// <param name="varyParams">The vary params of this cache item</param>
public CacheKey(string keyName, Dictionary<string, string> varyParams)
{
//check preconditions for this input params!
if (String.IsNullOrEmpty(keyName)
||
String.IsNullOrWhiteSpace(keyName))
{
throw new ArgumentNullException("keyName");
}
if (varyParams != null
&&
varyParams.Count > 0)
{
_cacheVaryParams = varyParams;
}
}
/// <summary>
/// Create a new instance of CacheKey
/// </summary>
/// <param name="keyName">The cache key name</param>
/// <param name="varyParams">The vary params of this cache item</param>
/// <example>
/// CacheKey key = new CacheKey("keyName",new {PropA="value",PropB=2});
/// </example>
public CacheKey(string keyName, object varyParams)
{
//check preconditions for this input params!
if (String.IsNullOrEmpty(keyName)
||
String.IsNullOrWhiteSpace(keyName))
{
throw new ArgumentNullException("keyName");
}
_keyName = keyName;
//extract vary params from this anonimous type
ExtractVaryParams(varyParams);
}
#endregion
#region Private Methods
private void ExtractVaryParams(object varyParams)
{
if (varyParams != null)
{
Type anonimousType = varyParams.GetType();
var result = anonimousType
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Select(pi => new {Name = pi.Name, Value = pi.GetValue(varyParams, null)});
if (result != null
&&
result.Any())
{
_cacheVaryParams = new Dictionary<string, string>();
result.ToList().ForEach(item => _cacheVaryParams.Add(item.Name, item.Value.ToString()));
}
}
}
#endregion
#region Public Methods
/// <summary>
/// Get composed cache key
/// </summary>
/// <returns>String represent the key for cache item</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public string GetCacheKey()
{
StringBuilder keyBuilder = new StringBuilder();
keyBuilder.Append(_keyName);
keyBuilder.Append("#");
if (_cacheVaryParams != null
&&
_cacheVaryParams.Count > 0)
{
foreach (var item in _cacheVaryParams)
{
keyBuilder.Append(string.Format(CultureInfo.InvariantCulture, "{0};{1}", item.Key, item.Value));
keyBuilder.Append(";");
}
//remove last ;
--keyBuilder.Length;
}
return keyBuilder.ToString();
}
/// <summary>
/// Override ToString
/// </summary>
/// <returns></returns>
public override string ToString()
{
return GetCacheKey();
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/InitialData/EntityGuids.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.InitialData
{
public static class EntityGuids
{
public static class Drivers
{
public static Guid IagoAspas = new Guid("bbe34513-f141-47e4-91c5-5515c8e6be3f");
public static Guid NemanjaRadoja = new Guid("56eb93f6-6327-4a33-8969-34adf528af93");
public static Guid FranBeltran = new Guid("2f700442-b36b-419b-a28c-9a7e0c7bd5e4");
}
public static class Vehicles
{
public static Guid FerrariGTO = new Guid("9d6a4ddd-6273-4e0a-ad8e-646b8c63b175");
public static Guid BmwM3 = new Guid("08ef46a2-f0f7-4e69-8154-0547ea779872");
public static Guid SeatLeon = new Guid("5051c165-c7f8-4c76-ad76-ecf65deb74f5");
}
public static class InfractionTypes
{
public static Guid ExcesoVelocidad20 = new Guid("d8cda5d4-452d-419f-8301-116671115623");
public static Guid ExcesoVelocidad40 = new Guid("1a259575-8f80-44ec-8d5a-4213c4ac7f06");
public static Guid ExcesoVelocidad60 = new Guid("a7ca4248-3ec9-4f35-90ed-2f0681ef9114");
public static Guid DobleFila = new Guid("deb907d3-1341-4dd6-826f-b765e8afda16");
public static Guid SinCinturonSeguridad = new Guid("1fb833dc-6bad-4e89-a858-226e6c2fefa8");
}
public static class Brands
{
public static Guid AbarthBrandId = new Guid("50ed8514-fec6-46cb-b914-34d40e93710b");
public static Guid AlfaRomeoBrandId = new Guid("7dab8ad6-0d8e-4318-861e-df4a9ecd7845");
public static Guid AlpineBrandId = new Guid("090cc18f-ff4b-40fa-88b6-5a69453a0567");
public static Guid AstonMartinBrandId = new Guid("c54a5b97-8ab3-42bf-bfda-0d4823f86bee");
public static Guid AudiBrandId = new Guid("64ace552-8947-4e4e-a592-f2a9e1bd119f");
public static Guid BentleyBrandId = new Guid("a994ceff-b8bb-4e30-a5e5-6064e47185eb");
public static Guid BMWBrandId = new Guid("fd198954-3df6-467b-8dbc-b0feab956391");
public static Guid BugattiBrandId = new Guid("e206aeda-3375-485b-847c-ad8c753c6a9e");
public static Guid BYDBrandId = new Guid("4189b8d0-5a47-458d-8982-00eca08b7e94");
public static Guid CadillacBrandId = new Guid("90030b41-9d19-479e-adc6-decb97fe9a31");
public static Guid CaterhamBrandId = new Guid("25f1f56c-4832-45d7-a1e1-d82ff4c9c18f");
public static Guid ChevroletBrandId = new Guid("f3bdbbc3-e233-48f6-a085-2764106624fd");
public static Guid CitroënBrandId = new Guid("a22e5c9c-2bd7-4680-add6-99d19766eaf6");
public static Guid CupraBrandId = new Guid("3e276dab-ff88-4ea4-9428-8ed94d5c3251");
public static Guid DaciaBrandId = new Guid("29bb9b99-3462-4f39-a828-e401a06d762e");
public static Guid DSBrand = new Guid("8e64cee3-5127-4558-8865-bc5ef2eb088c");
public static Guid FerrariBrandId = new Guid("a9e87cc5-338a-483a-a1a1-96e787f21ed7");
public static Guid FiatBrandId = new Guid("16035d4f-d555-453e-bb7c-b7f05e0514c2");
public static Guid FordBrandId = new Guid("264b0380-1a13-48c9-b204-bcd2eeae1428");
public static Guid HondaBrandId = new Guid("6a99c551-f9d5-42fd-be39-da133a98f822");
public static Guid HyundaiBrandId = new Guid("d47655b3-a456-45ee-ae28-65ad1d3d47d1");
public static Guid InfinitiBrandId = new Guid("328ff0da-484b-448a-846b-907a40dce7c0");
public static Guid IsuzuBrandId = new Guid("6535ee74-9ebb-4477-8447-025358b8b00e");
public static Guid JaguarBrandId = new Guid("e68a8475-bb42-4286-8a32-95ac9fa1e94c");
public static Guid JeepBrandId = new Guid("9c04ac18-84bb-4c0e-81ac-9a6e0b89813f");
public static Guid KIABrandId = new Guid("0405942f-adee-423c-8857-7901e381af1e");
public static Guid LadaBrandId = new Guid("caab192c-18fd-4950-b462-b30f52626f96");
public static Guid LamborghiniBrandId = new Guid("fb839133-38f5-4347-b442-7d21b88487fd");
public static Guid LanciaBrandId = new Guid("12d53665-2ed6-49d3-9b0f-7fdfdb53bb93");
public static Guid LandRoverBrandId = new Guid("ddd9110e-d4f8-4854-a19f-adc35e02068c");
public static Guid LexusBrandId = new Guid("51fc0891-f920-470b-b188-eca099d798b6");
public static Guid LotusBrandId = new Guid("59d823eb-2326-4472-8b22-dacc812a81df");
public static Guid MahindraBrandId = new Guid("b47ecb53-95b7-4d49-953a-b8300158c667");
public static Guid MaseratiBrandId = new Guid("863271c4-5352-45ce-970b-e3bb85f08156");
public static Guid MazdaBrandId = new Guid("e93d8fa7-4e6e-4d40-9b24-a2cdae10e0b1");
public static Guid McLarenBrandId = new Guid("49308e35-7016-4d8a-8958-fc1e7052aff5");
public static Guid MercedesBrandId = new Guid("41094f96-569f-4e30-bc7e-069ad44de42e");
public static Guid MiniBrandId = new Guid("ed552fbb-842f-472a-8ac2-62ee70fb0649");
public static Guid MitsubishiBrandId = new Guid("d1291c11-6a3a-48bd-9e4f-1c525239432c");
public static Guid MorganBrandId = new Guid("9037c033-802a-430a-a706-25240e734795");
public static Guid NissanBrandId = new Guid("ab8d386c-2116-4fe6-b5d6-bc4b01a0f946");
public static Guid OpelBrandId = new Guid("e8859245-ccdb-48e4-a512-665a267ad2ce");
public static Guid PeugeotBrandId = new Guid("0f80e5c2-7ad5-4584-9bff-178f4064df38");
public static Guid PorscheBrandId = new Guid("1cdb9d43-c361-4ac5-b26d-0d52a2463d14");
public static Guid RenaultBrandId = new Guid("3e14c502-970d-43dd-a99b-f44139fe59c3");
public static Guid RollsRoyceBrandId = new Guid("533bffce-2f57-44b0-a5ef-44650acab7a8");
public static Guid SeatBrandId = new Guid("3ab9ce82-6b4b-47ea-9454-34217cc14305");
public static Guid ŠkodaBrandId = new Guid("2776ccc3-334b-4471-bc60-784cdeb22c9b");
public static Guid SmartBrandId = new Guid("c631dd21-c3fa-4750-90fd-2b54ece988d7");
public static Guid SsangYongBrandId = new Guid("777989fa-f121-4edb-8c74-745fe05661a2");
public static Guid SubaruBrandId = new Guid("602df1c2-33cc-4078-9f32-25544e8b6744");
public static Guid SuzukiBrandId = new Guid("653ce868-ad39-4806-88b5-6e2ad4400177");
public static Guid TATABrandId = new Guid("6eb4e739-a0ef-4e20-b3e2-69615d4c1529");
public static Guid TeslaBrandId = new Guid("4b269ab7-f075-4b08-a882-abceaefe19c3");
public static Guid ToyotaBrandId = new Guid("f05d35c1-fddb-4898-a784-40fee261c6d1");
public static Guid VolkswagenBrandId = new Guid("ae5843fb-c2bb-4629-a107-c261ef02c85f");
public static Guid VolvoBrandId = new Guid("8ba36d01-fdf0-47db-9ada-dca07a312678");
}
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/Repositories/VehicleRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using Infrastructure.Data.MainBoundedContext.UnitOfWork;
using Infrastructure.Data.Seedwork;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.Repositories
{
public class VehicleRepository: Repository<Vehicle>, IVehicleRepository
{
#region Constructor
/// <summary>
/// Create a new instance of VehicleRepository
/// </summary>
/// <param name="unitOfWork">Associated unit of work</param>
public VehicleRepository(MainBCUnitOfWork unitOfWork)
: base(unitOfWork)
{
}
#endregion
#region IVehicleRepository implementation
public int Count()
{
var currentUnitOfWork = this.UnitOfWork as MainBCUnitOfWork;
var set = currentUnitOfWork.CreateSet<Vehicle>();
return set.Count();
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/BrandAgg/Brand.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
using Infrastructure.GlobalResources;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg
{
public class Brand: BaseEntity, IValidatableObject
{
#region Properties
/// <summary>
/// Get or set Brand name
/// </summary>
public string Name { get; set; }
#endregion
#region IValidatableObject implementation
/// <summary>
/// <see cref="IValidatableObject.Validate"/>
/// </summary>
/// <param name="validationContext"><see cref="IValidatableObject.Validate"/></param>
/// <returns><see cref="IValidatableObject.Validate"/></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var validationResults = new List<ValidationResult>();
//Check First name
if (String.IsNullOrEmpty(Name) || String.IsNullOrWhiteSpace(Name))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Name), new string[] { "Name" }));
return validationResults;
}
#endregion
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/Controllers/InfractionsController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Application.MainBoundedContext.Services;
namespace DistributedServices.MainBoundedContext.Api.Controllers
{
public class InfractionsController : ApiController
{
#region Members
private readonly IDgtAppService _dgtAppService;
#endregion
#region Constructor
public InfractionsController(IDgtAppService dgtAppService)
{
//Check dependencies
if (dgtAppService == null)
throw new ArgumentNullException("dgtAppService");
//Assign dependencies
this._dgtAppService = dgtAppService;
}
#endregion
#region Api methods
[HttpPost]
[Route("api/infractions/save")]
public IHttpActionResult Save(InfractionDTO dto)
{
try
{
var result = this._dgtAppService.AddNewInfraction(dto);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("api/infractions/driver/{driverIdentifier}")]
public IHttpActionResult GetInfractionsByDriver(string driverIdentifier)
{
try
{
var results = _dgtAppService.SearchInfractions("", driverIdentifier, null, null, null);
return Ok(results);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("api/infractions/last/{count}")]
public IHttpActionResult GetLastInfractions(int count = 15)
{
try
{
var results = _dgtAppService.GetLastInfractions(count);
return Ok(results);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("api/infractions/vehicle/{vehicleLicense}")]
public IHttpActionResult GetInfractionsByLicense(string vehicleLicense)
{
try
{
var results = _dgtAppService.SearchInfractions(vehicleLicense, "", null, null, null);
return Ok(results);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("api/infractions/stats")]
public IHttpActionResult GetInfractionStats()
{
try
{
var results = _dgtAppService.GetInfractionStats();
return Ok(results);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("api/totals")]
public IHttpActionResult GetTotals()
{
try
{
var results = _dgtAppService.GetItemsCount();
return Ok(results);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("api/infractions/search/")]
public IHttpActionResult Search()
{
try
{
var queries = this.Request.GetQueryNameValuePairs().ToDictionary(p => p.Key, p => p.Value);
var vehicleLicense = "";
var driverIdentifier = "";
Guid? infractionTypeId = null;
DateTime? from = null;
DateTime? to = null;
foreach (var query in queries)
{
if (query.Key.ToLower() == "vehiclelicense")
vehicleLicense = query.Value;
if (query.Key.ToLower() == "driveridentifier")
driverIdentifier = query.Value;
if (query.Key.ToLower() == "infractiontypeid")
infractionTypeId = new Guid(query.Value);
if (query.Key.ToLower() == "from")
from = DateTime.ParseExact(query.Value, "yyyy-MM-dd",
System.Globalization.CultureInfo.InvariantCulture);
if (query.Key.ToLower() == "to")
to = DateTime.ParseExact(query.Value, "yyyy-MM-dd",
System.Globalization.CultureInfo.InvariantCulture);
}
var results = _dgtAppService.SearchInfractions(vehicleLicense, driverIdentifier, infractionTypeId, from, to);
return Ok(results);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
#endregion
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/Mapping/VehicleEntityConfiguration.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping
{
class VehicleEntityConfiguration
:EntityTypeConfiguration<Vehicle>
{
public VehicleEntityConfiguration()
{
//Configure keys and properties
this.HasKey(c => c.Id);
this.Property(c => c.License)
.HasMaxLength(10)
.IsRequired();
this.Property(c => c.BrandId)
.IsRequired();
this.Property(c => c.Model)
.HasMaxLength(50)
.IsRequired();
//Configure table associations
this.HasRequired(c => c.Brand)
.WithMany()
.HasForeignKey(c => c.BrandId)
.WillCascadeOnDelete(false);
//Configure table mappings
this.ToTable("Vehicles");
}
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/Infractions/ItemsCountsDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.Infractions
{
public class ItemsCountsDTO
{
public int VehiclesCount { get; set; }
public int DriversCount { get; set; }
public int InfractionsCount { get; set; }
}
}
<file_sep>/README.md
## APLICACIÓN PARA LA GESTIÓN DE INFRACCIONES
#### Aplicación basada en el proyecto DDD NLayared .NET 4.0 Architecture de César de la Torre ####
https://blogs.msdn.microsoft.com/cesardelatorre/2010/03/25/our-brand-new-ddd-n-layered-net-4-0-architecture-guide-book-and-sample-app-in-codeplex/

### Dependencias
Para el control de inicio (estadísticas), se utiliza el componente Microsoft Chart Control para Microsoft .NET Framework 3.5. La dirección de descarga es
https://www.microsoft.com/es-es/download/details.aspx?id=14422
### Base de datos (SQL Express)
1. En Visual Studio, Abrir el Package Manager Console
2. Establecer Default project = "Infrastructure.Data.MainBoundedContext"
3. Ejecutar los siguientes comandos en el Package Manager Console:
* Add-Migration Initial
* Update-Database
### Descripción de la solución
La aplicación se divide en dos partes.
1. **CLIENTE**: Comprende los proyectos que se encuentran dentro de la carpeta **"Presentation"**. Son aplicaciones Windows que se ejecutan en la máquina del usuario. Se conectan con el servidor realizando llamadas REST al proyecto DistributedServices.MainBoundedContext.Api
* **Presentation.Windows.Seedwork:** Librerías para el manejo de las llamadas REST al servidor.
* **Presentation.Windows.UI:** Aplicación principal.
1. **SERVIDOR**: Comprenden los demás proyectos. Se ejecutan el el **Servidor**.
* **DistributedServices.MainBoundedContext.Api:** Servicios REST desarrollados con Web API 2
* **Application.Seedwork:** Proyecto que contiene métodos (proyecciones de entidades a dtos, validaciones, ...) que serán utilizados en la capa Application.MainBoundedContext
* **Application.MainBoundedContext:** En este proeycto se reciben las solicitudes de la capa de servicios REST, se procesan las entidades, y se devuelven los resultados en formato DTOs.
* **Application.MainBoundedContext.DTO:** Proyecto donde se encuentran definidos todos las clases DTO. También se definen como se van a mapear las Entidades del dominio en objetos DTO por medio de AutoMapper.
* **Domain.Seedwork:** Proyecto donde se establecen las clases base y métodos utilizados en las capas del dominio.
* **Domain.MainBoundedContext:** Proyecto donde se definen las entidades, y los repositorios de cada entidad. En algunas clases también se utiliza el patrón Factory
* **Infrastructure.GlobalResources:** Proyecto donde se encuentrar los recursos de texto utilizados en los demás proyectos.
* **Infrastructure.CrossCutting.Seedwork:** Definición de tipos (Caching, Loging, ...) que se utilizarán en el proyecto Infrastructure.CrossCutting.NetFramework.
* **Infrastructure.CrossCutting.NetFramework:** Implementación de las clases definidas en el proyecto anterior.
* **Infrastructure.CrossCutting.MainBoundedContext.IoC:** Proyecto que implementa el patrón ID (Inyección de dependencias).
* **Infrastructure.Data.Seedwork:** Definición de los tipos utilizados en el contexto, y la clase Repository, de la que heredarán cada uno de los repositorios de las entidades del dominio.
* **Infrastructure.Data.MainBoundedContext:** Proyecto donde se encuentran:
* El contexto principal (MainBCUnitOfWork)
* Cada uno de los repositorios de cada entidad (DgtModule/Repositories/*Repository.cs)
* Los registros iniciales de cada una de las entidades (DgtModule/InitialData/InitialData*.cs)
* Los archivos de migración utilizados por Entity Framework Code First
* La definición de cómo cada entidad se guarda en la Base de datos (DgtModule/UnitOfWork/Mapping/*EntityConfiguration.cs)<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/BrandAgg/IBrandRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg
{
public interface IBrandRepository: IRepository<Brand>
{
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/DriverAg/DriverFactory.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg
{
public static class DriverFactory
{
public static Driver CreateDriver(string identifier, string firstName, string lastName, int? points)
{
var driver = new Driver()
{
Identifier = identifier,
FirstName = firstName,
LastName = lastName
};
if (points != null)
driver.Points = points.Value;
return driver;
}
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/_ApiManagerBase.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Presentation.Windows.Seedwork.Api
{
#region Protected methods
public abstract class ApiManagerBase
{
protected static HttpClient GetHttpClient()
{
var apiUrl = ConfigurationManager.AppSettings["ApiUrl"];
var client = new HttpClient() { BaseAddress = new Uri(apiUrl) };
return client;
}
protected static async Task<string> CastResultError(HttpResponseMessage response)
{
var stringErrorResult = await response.Content.ReadAsStringAsync();
if (String.IsNullOrEmpty(stringErrorResult))
return GetHttpError(response);
else
{
var errorMessage = "";
var result = JsonConvert.DeserializeObject<ApiResultError>(stringErrorResult);
if (!string.IsNullOrEmpty(result.message))
errorMessage = result.message + Environment.NewLine;
if (result.errors != null && result.errors.Any())
{
foreach (var error in result.errors.Where(e => !String.IsNullOrEmpty(e.message)))
errorMessage += error.message + Environment.NewLine;
}
return errorMessage;
}
}
protected static string GetHttpError(HttpResponseMessage msg)
{
var message = "";
switch (msg.StatusCode)
{
case HttpStatusCode.NotFound:
message = String.Format("La dirección '{0}' no es correcta", msg.RequestMessage.RequestUri);
break;
case HttpStatusCode.InternalServerError:
message = String.Format("La solicitud a la dirección '{0}' ha generado el siguiente error:" + Environment.NewLine + msg.ReasonPhrase, msg.RequestMessage.RequestUri);
break;
case HttpStatusCode.Redirect:
message = String.Format("La dirección '{0}' ha sido movida", msg.RequestMessage.RequestUri);
break;
case HttpStatusCode.Forbidden:
message = String.Format("No tiene acceso a la url solicitada ({0}).", msg.RequestMessage.RequestUri);
break;
case HttpStatusCode.Unauthorized:
message = String.Format("No tiene autorización para solicitar la url ({0}).", msg.RequestMessage.RequestUri);
break;
}
if (String.IsNullOrEmpty(message))
{
if (!String.IsNullOrEmpty(msg.ReasonPhrase))
message = String.Format("Ha ocurrido el siguiente error solicitando la dirección '{0}'" + Environment.NewLine + "{1}", msg.RequestMessage.RequestUri, msg.ReasonPhrase);
else
message = String.Format("Ha ocurrido un error solicitando la dirección '{0}'", msg.RequestMessage.RequestUri);
}
return message;
}
}
#endregion
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleDriverAgg/VehicleDriverSpecifications.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork.Specification;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg
{
public static class VehicleDriverSpecifications
{
/// <summary>
/// Specification for VehicleDriver with Driver equals <param name="driverId" />
/// </summary>
/// <param name="driverId">Car driver plate</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<VehicleDriver> WithDriver(Guid? driverId)
{
Specification<VehicleDriver> specification = new TrueSpecification<VehicleDriver>();
//Check arguments
if (driverId != null && driverId != Guid.Empty)
specification = new DirectSpecification<VehicleDriver>(v => v.DriverId == driverId);
return specification;
}
/// <summary>
/// Specification for VehicleDriver with Vehicle equals <param name="vehicleId" />
/// </summary>
/// <param name="vehicleId">Car vehicle plate</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<VehicleDriver> WithVehicle(Guid? vehicleId)
{
Specification<VehicleDriver> specification = new TrueSpecification<VehicleDriver>();
//Check arguments
if (vehicleId != null && vehicleId != Guid.Empty)
specification = new DirectSpecification<VehicleDriver>(v => v.VehicleId == vehicleId);
return specification;
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleAgg/VehicleSpecifications.cs
using System;
using Domain.Seedwork.Specification;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg
{
public static class VehicleSpecifications
{
/// <summary>
/// Specification for Vehicle with License equals <param name="license" />
/// </summary>
/// <param name="license">Car license plate</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Vehicle> WithLicense(string license)
{
//Check arguments
if (string.IsNullOrEmpty(license))
throw new ArgumentNullException("license");
return new DirectSpecification<Vehicle>(p => p.License.ToUpper().Equals(license.ToUpper()));
}
/// <summary>
/// Specification for Vehicle with Brand equals <param name="brandId" />
/// </summary>
/// <param name="brandId">Car brand plate</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Vehicle> WithBrand(Guid? brandId)
{
Specification<Vehicle> specification = new TrueSpecification<Vehicle>();
//Check arguments
if (brandId != null && brandId != Guid.Empty)
specification = new DirectSpecification<Vehicle>(v => v.BrandId == brandId);
return specification;
}
/// <summary>
/// Specification for Vehicle with model equals to <param name="model"></param>
/// </summary>
/// <param name="model">Tex to search</param>
/// <returns>Associated specification for this criteria</returns>
public static Specification<Vehicle> WithModel(string model)
{
Specification<Vehicle> specification = new TrueSpecification<Vehicle>();
//Check arguments
if (!String.IsNullOrEmpty(model))
specification = new DirectSpecification<Vehicle>(s => s.Model.ToLower().Contains(model.ToLower()));
return specification;
}
/// <summary>
/// Specification for Vehicle with name, domain or comments like <param name="text"></param>
/// </summary>
/// <param name="text">Tex to search</param>
/// <returns>Associated specification for this criteria</returns>
public static Specification<Vehicle> FullText(string text)
{
Specification<Vehicle> specification = new TrueSpecification<Vehicle>();
if (!String.IsNullOrEmpty(text))
{
var licenseSpec = new DirectSpecification<Vehicle>(s => s.License.ToLower().Contains(text.ToLower()));
var brandSpec = new DirectSpecification<Vehicle>(s => s.Brand.Name.ToLower().Contains(text.ToLower()));
var modelSpec = new DirectSpecification<Vehicle>(s => s.Model.ToLower().Contains(text.ToLower()));
specification &= (licenseSpec || brandSpec || modelSpec);
}
return specification;
}
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/Mapping/DriverEntityConfiguration.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping
{
class DriverEntityConfiguration
:EntityTypeConfiguration<Driver>
{
public DriverEntityConfiguration()
{
//Configure keys and properties
this.HasKey(c => c.Id);
this.Property(c => c.Identifier)
.HasMaxLength(20)
.IsRequired();
this.Property(c => c.FirstName)
.HasMaxLength(150)
.IsRequired();
this.Property(c => c.LastName)
.HasMaxLength(300)
.IsRequired();
this.Property(c => c.Points)
.IsRequired();
}
}
}
<file_sep>/Infrastructure.CrossCutting.Seedwork/Caching/ICacheManager.cs
namespace Infrastructure.Crosscutting.Caching
{
/// <summary>
/// Base contract for cache manager. This contract
/// expose basic methods for work with cache in solution
/// </summary>
public interface ICacheManager
{
/// <summary>
/// Try get if object exist in cache and set result in <paramref name="result"/>
/// </summary>
/// <typeparam name="TResult">type of returned result</typeparam>
/// <param name="cacheItemConfig">Cahe item specification</param>
/// <param name="result">result if exist in cache</param>
/// <returns>True if object exist in cache, else false</returns>
bool TryGet<TResult>(CacheItemConfig cacheItemConfig, out TResult result);
/// <summary>
/// Add new object in underliying cache
/// </summary>
/// <param name="cacheItemConfig">The cache item spec</param>
/// <param name="value">The item to add</param>
void Add(CacheItemConfig cacheItemConfig, object value);
/// <summary>
/// Remove object in cache
/// </summary>
/// <param name="cacheKey">Key identifier of item to delete</param>
/// <returns>
/// True if element is removed in cache, if not false
/// </returns>
bool Remove(CacheKey cacheKey);
/// <summary>
/// Remove object in cache
/// </summary>
/// <returns>
/// Remove all items from cache
/// </returns>
void ClearAll();
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionAg/InfractionFactory.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg
{
public static class InfractionFactory
{
public static Infraction CreateInfraction(Vehicle vehicle, Driver driver, InfractionType infractionType, DateTime date)
{
var infraction = new Infraction()
{
VehicleId = vehicle.Id,
InfractionTypeId = infractionType.Id,
Date = date
};
infraction.SetVehicle(vehicle);
infraction.SetInfractionType(infractionType);
infraction.SetDriver(driver);
return infraction;
}
public static Infraction CreateInfraction(Guid vehicleId, Guid infractionTypeId, Guid driverId, DateTime date)
{
var infraction = new Infraction()
{
VehicleId = vehicleId,
InfractionTypeId = infractionTypeId,
DriverId = driverId,
Date = date
};
return infraction;
}
}
}
<file_sep>/Application.MainBoundedContext/Services/DgtAppService.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Brands;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
using Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers;
using Application.Seedwork;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
using Infrastructure.GlobalResources;
namespace Application.MainBoundedContext.Services
{
public class DgtAppService : IDgtAppService
{
#region Members
private const int INITIAL_POINTS = 12;
private readonly IBrandRepository _brandRepository;
private readonly IInfractionTypeRepository _infractionTypeRepository;
private readonly IDriverRepository _driverRepository;
private readonly IVehicleRepository _vehicleRepository;
private readonly IVehicleDriverRepository _vehicleDriverRepository;
private readonly IInfractionRepository _infractionRepository;
#endregion
#region Constructor
/// <summary>
/// Create a new instance of DgtAppService
/// </summary>
public DgtAppService(
IBrandRepository brandRepository,
IInfractionTypeRepository infractionTypeRepository,
IDriverRepository driverRepository,
IVehicleRepository vehicleRepository,
IInfractionRepository infractionRepository,
IVehicleDriverRepository vehicleDriverRepository)
{
//Check dependencies
if (brandRepository == null)
throw new ArgumentNullException("brandRepository");
if (infractionTypeRepository == null)
throw new ArgumentNullException("infractionTypeRepository");
if (driverRepository == null)
throw new ArgumentNullException("driverRepository");
if (vehicleRepository == null)
throw new ArgumentNullException("vehicleRepository");
if (infractionRepository == null)
throw new ArgumentNullException("infractionRepository");
if (vehicleDriverRepository == null)
throw new ArgumentNullException("vehicleDriverRepository");
// Assign dependencies
_brandRepository = brandRepository;
_infractionTypeRepository = infractionTypeRepository;
_driverRepository = driverRepository;
_vehicleRepository = vehicleRepository;
_infractionRepository = infractionRepository;
_vehicleDriverRepository = vehicleDriverRepository;
}
#endregion
#region IDgtAppService implementation
#region Brands methods
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<BrandDTO> GetAllBrands()
{
// Query criteria
IEnumerable<Brand> brands = _brandRepository.GetAll();
if (brands != null && brands.Any())
return brands.OrderByDescending(m => m.CreatedDate).ProjectedAsCollection<BrandDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public BrandDTO GetBrandById(Guid id)
{
var result = _brandRepository.Get(id);
if (result != null)
return result.ProjectedAs<BrandDTO>();
else
return null;
}
#endregion
#region Infraction types methods
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<InfractionTypeDTO> GetAllInfractionTypes()
{
IEnumerable<InfractionType> infractionTypes = _infractionTypeRepository.GetAll();
if (infractionTypes != null && infractionTypes.Any())
return infractionTypes.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<InfractionTypeDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public InfractionTypeDTO AddNewInfractionType(InfractionTypeDTO infractionTypeDTO)
{
if (infractionTypeDTO == null)
throw new ArgumentNullException("infractionTypeDTO");
// Check InfractionType name is not repeated
var repeatedName = _infractionTypeRepository.GetFiltered(i => i.Name.ToLower() == infractionTypeDTO.Name.ToLower());
if (repeatedName != null && repeatedName.Any())
throw new InvalidOperationException(String.Format(CommonMessages.exception_ItemAlreadyExistsWithProperty, Names.InfractionType, Names.Name, infractionTypeDTO.Name));
// Cast and save item
var infractionType = MaterializeInfractionTypeFromDto(infractionTypeDTO);
infractionType.GenerateNewIdentity();
infractionType.CreatedDate = DateTime.Now;
infractionType.Validate();
_infractionTypeRepository.Add(infractionType);
_infractionTypeRepository.UnitOfWork.Commit();
return infractionType.ProjectedAs<InfractionTypeDTO>();
}
#endregion
#region Driver methods
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<DriverDTO> SearchDrivers(string filter)
{
if (String.IsNullOrEmpty(filter))
throw new ArgumentNullException("filter");
var fulltextSpec = DriverSpecifications.FullText(filter);
var result = _driverRepository.AllMatching(fulltextSpec);
if (result != null && result.Any())
return result.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<DriverDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public DriverDTO GetDriverById(Guid id)
{
var result = _driverRepository.Get(id);
if (result != null)
return result.ProjectedAs<DriverDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public DriverDTO GetDriverByNifNie(string identifier)
{
if (String.IsNullOrEmpty(identifier))
throw new ArgumentNullException("identifier");
var identifierSpec = DriverSpecifications.WithIdentifier(identifier);
var result = _driverRepository.AllMatching(identifierSpec);
if (result != null && result.Any())
return result.First().ProjectedAs<DriverDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <param name="vehicleLicense"><see cref="IDgtAppService"/></param>
/// <param name="driverIdentifier"><see cref="IDgtAppService"/></param>
/// <returns></returns>
public VehicleDriverDTO AttachDriverToVehicle(string vehicleLicense, string driverIdentifier)
{
// Check arguments
if (String.IsNullOrEmpty(vehicleLicense))
throw new ArgumentNullException(vehicleLicense);
if (String.IsNullOrEmpty(driverIdentifier))
throw new ArgumentNullException(driverIdentifier);
//Get vehicle
Vehicle vehicle;
var vehicleResult = _vehicleRepository.GetFiltered(v => v.License.ToLower() == vehicleLicense.ToLower());
if (vehicleResult == null || !vehicleResult.Any())
throw new InvalidOperationException(String.Format(CommonMessages.exception_EntityWithIdNotExists,
Names.Vehicle, vehicleLicense));
else
vehicle = vehicleResult.First();
// Get driver
Driver driver;
var driverResult = _driverRepository.GetFiltered(v => v.Identifier.ToLower() == driverIdentifier.ToLower());
if (driverResult == null || !driverResult.Any())
throw new InvalidOperationException(String.Format(CommonMessages.exception_EntityWithIdNotExists,
Names.Driver, driverIdentifier));
else
driver = driverResult.First();
// Check driver is not assigned to vehicle
var repeatedDriver = _vehicleDriverRepository.GetFiltered(v => v.DriverId == driver.Id && v.VehicleId == vehicle.Id);
if(repeatedDriver != null && repeatedDriver.Any())
throw new InvalidOperationException(String.Format(CommonMessages.exception_DriverAlreadyIsHabitualDriverOfVehicle,
driver.Identifier, vehicle.License));
// Create assignation
var vd = new VehicleDriver {DriverId = driver.Id, VehicleId = vehicle.Id, CreatedDate = DateTime.Now};
vd.GenerateNewIdentity();
// Save changes
_vehicleDriverRepository.Add(vd);
_vehicleDriverRepository.UnitOfWork.Commit();
return vd.ProjectedAs<VehicleDriverDTO>();
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public DriverDTO AddNewDriver(DriverDTO driverDTO)
{
if (driverDTO == null)
throw new ArgumentNullException("driverDTO");
// Check driver identifier is unique
var identifierSpec = DriverSpecifications.WithIdentifier(driverDTO.Identifier);
var repeatedIdentifierDriver = _driverRepository.AllMatching(identifierSpec);
if(repeatedIdentifierDriver != null && repeatedIdentifierDriver.Any())
throw new InvalidOperationException(String.Format(CommonMessages.exception_ItemAlreadyExistsWithProperty, Names.Driver, Names.Identifier, driverDTO.Identifier));
// Cast dto to driver and save
var driver = MaterializeDriverFromDto(driverDTO);
// Set initial points for new drivers
driver.SetInitialPoints();
driver.GenerateNewIdentity();
driver.CreatedDate = DateTime.Now;
driver.Validate();
_driverRepository.Add(driver);
_driverRepository.UnitOfWork.Commit();
return driver.ProjectedAs<DriverDTO>();
}
#endregion
#region Vehicle methods
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<VehicleDTO> GetAllVehicles()
{
var result = _vehicleRepository.GetAll();
if (result != null && result.Any())
return result.OrderByDescending(v => v.CreatedDate).ProjectedAsCollection<VehicleDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public VehicleDTO GetVehicleById(Guid id)
{
var result = _vehicleRepository.Get(id);
if (result != null)
return result.ProjectedAs<VehicleDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public VehicleDTO GetVehicleByLicense(string license)
{
if (String.IsNullOrEmpty(license))
throw new ArgumentNullException("license");
var licenseSpec = VehicleSpecifications.WithLicense(license);
var result = _vehicleRepository.AllMatching(licenseSpec);
if (result != null && result.Any())
return result.First().ProjectedAs<VehicleDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public VehicleDTO AddNewVehicle(VehicleDTO vehicleDTO)
{
if (vehicleDTO == null)
throw new ArgumentNullException("vehicleDTO");
// Check vehicle license is unique
var licenseSpec = VehicleSpecifications.WithLicense(vehicleDTO.License);
var repeatedLicenseVehicle = _vehicleRepository.AllMatching(licenseSpec);
if (repeatedLicenseVehicle != null && repeatedLicenseVehicle.Any())
throw new InvalidOperationException(String.Format(CommonMessages.exception_ItemAlreadyExistsWithProperty, Names.Vehicle, Names.License, vehicleDTO.License));
// Cast dto to vehicle and save
var vehicle = MaterializeVehicleFromDto(vehicleDTO);
vehicle.GenerateNewIdentity();
vehicle.CreatedDate = DateTime.Now;
// Add habitual driver
var driver = _driverRepository.Get(vehicleDTO.DriverId);
if (driver == null)
throw new InvalidOperationException(String.Format(CommonMessages.exception_EntityWithIdNotExists,
Names.Driver, vehicleDTO.DriverId));
// Check driver vehicles
var driverVehicles = _vehicleDriverRepository.GetFiltered(vd => vd.DriverId == driver.Id);
if (driverVehicles.Count() > 10)
throw new InvalidOperationException(String.Format(CommonMessages.exception_DriverMaxVehicles,
driver.Identifier, 10));
// Add VehicleDriver item
var vehicleDriver = new VehicleDriver() {VehicleId = vehicle.Id, DriverId = driver.Id};
vehicleDriver.GenerateNewIdentity();
vehicleDriver.CreatedDate = DateTime.Now;
// Validate items and save
vehicle.Validate();
vehicleDriver.Validate();
_vehicleRepository.Add(vehicle);
_vehicleRepository.UnitOfWork.Commit();
_vehicleDriverRepository.Add(vehicleDriver);
_vehicleDriverRepository.UnitOfWork.Commit();
return vehicle.ProjectedAs<VehicleDTO>();
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<VehicleDTO> SearchVehicles(string filter)
{
if (String.IsNullOrEmpty(filter))
throw new ArgumentNullException("filter");
var fulltextSpec = VehicleSpecifications.FullText(filter);
var result = _vehicleRepository.AllMatching(fulltextSpec);
if (result != null && result.Any())
return result.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<VehicleDTO>();
else
return null;
}
#endregion
#region Infractions methods
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public InfractionDTO AddNewInfraction(InfractionDTO infractionDTO)
{
try
{
if (infractionDTO == null)
throw new ArgumentNullException("infractionDTO");
// Get associated driver
var driver = _driverRepository.Get(infractionDTO.DriverId);
if (driver == null)
throw new InvalidOperationException(String.Format(CommonMessages.exception_EntityWithIdNotExists,
Names.Driver, infractionDTO.DriverId));
//Get associated vehicle
var vehicle = _vehicleRepository.Get(infractionDTO.VehicleId);
if (vehicle == null)
throw new InvalidOperationException(String.Format(CommonMessages.exception_EntityWithIdNotExists,
Names.Vehicle, infractionDTO.VehicleId));
// Check vehicle belong to driver
var vehicleDriver =
_vehicleDriverRepository.GetFiltered(vd => vd.DriverId == driver.Id && vd.VehicleId == vehicle.Id);
if (vehicleDriver == null || !vehicleDriver.Any())
throw new InvalidOperationException(String.Format(
CommonMessages.exception_VehicleDoesNowBelongToDriver,
vehicle.License, driver.Identifier));
// Get associated infraction type
var infractionType = _infractionTypeRepository.Get(infractionDTO.InfractionTypeId);
if (infractionType == null)
throw new InvalidOperationException(String.Format(CommonMessages.exception_EntityWithIdNotExists,
Names.InfractionType, infractionDTO.InfractionTypeId));
// Materialize infraction from dto
var infraction = MaterializeInfractionFromDto(infractionDTO);
infraction.Validate();
infraction.GenerateNewIdentity();
infraction.CreatedDate = DateTime.Now;
_infractionRepository.Add(infraction);
// Remove points to driver
driver.RemovePoints(infractionType.Points);
_infractionRepository.UnitOfWork.Commit();
_driverRepository.UnitOfWork.Commit();
return infraction.ProjectedAs<InfractionDTO>();
}
catch (ApplicationValidationErrorsException valEx)
{
string erMsg = "";
foreach (var item in valEx.ValidationErrors)
erMsg += Environment.NewLine + item;
throw new Exception(erMsg);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<InfractionDTO> SearchInfractions(string vehicleLicense, string driverIdentifier, Guid? infractionTypeId, DateTime? from, DateTime? to)
{
var vehicleLicenseSpec = InfractionSpecifications.WithVehicleLicense(vehicleLicense);
var driverIdentifierSpec = InfractionSpecifications.WithDriverIdentifier(driverIdentifier);
var infractionTypeSpec = InfractionSpecifications.WithInfractionType(infractionTypeId);
var dateSpec = InfractionSpecifications.WithDateRange(from, to);
var specs = vehicleLicenseSpec & driverIdentifierSpec & infractionTypeSpec & dateSpec;
var results = _infractionRepository.AllMatching(specs);
if (results != null && results.Any())
return results.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<InfractionDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <param name="count"><see cref="IDgtAppService"/></param>
/// <returns><see cref="IDgtAppService"/></returns>
public List<InfractionDTO> GetLastInfractions(int count)
{
var results = _infractionRepository.GetAll().OrderByDescending(i => i.CreatedDate).Take(count);
if (results != null && results.Any())
return results.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<InfractionDTO>();
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public List<InfractionStatsDTO> GetInfractionStats()
{
var stats = _infractionRepository.GetInfractionsStats();
if (stats != null && stats.Any())
{
var result = new List<InfractionStatsDTO>();
foreach (var s in stats)
result.Add(new InfractionStatsDTO { Name = s.Name, Count = s.Count });
return result;
}
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <returns><see cref="IDgtAppService"/></returns>
public ItemsCountsDTO GetItemsCount()
{
var result = new ItemsCountsDTO
{
VehiclesCount = _vehicleRepository.Count(),
DriversCount = _driverRepository.Count(),
InfractionsCount = _infractionRepository.Count()
};
return result;
}
#endregion
#region VehicleDriver methods
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <param name="driverIdentifier"><see cref="IDgtAppService"/></param>
/// <returns><see cref="IDgtAppService"/></returns>
public List<VehicleDriverDTO> GetVehiclesByDriver(string driverIdentifier)
{
if (!String.IsNullOrEmpty(driverIdentifier))
{
var results =
_vehicleDriverRepository.GetFiltered(d =>
d.Driver.Identifier.ToLower() == driverIdentifier.ToLower());
if (results != null && results.Any())
return results.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<VehicleDriverDTO>();
else
return null;
}
else
return null;
}
/// <summary>
/// <see cref="IDgtAppService"/>
/// </summary>
/// <param name="vehicleLicense"><see cref="IDgtAppService"/></param>
/// <returns><see cref="IDgtAppService"/></returns>
public List<VehicleDriverDTO> GetDriversByVehicle(string vehicleLicense)
{
if (!String.IsNullOrEmpty(vehicleLicense))
{
var results =
_vehicleDriverRepository.GetFiltered(d =>
d.Vehicle.License.ToLower() == vehicleLicense.ToLower());
if (results != null && results.Any())
return results.OrderByDescending(i => i.CreatedDate).ProjectedAsCollection<VehicleDriverDTO>();
else
return null;
}
else
return null;
}
#endregion
#endregion
#region Private methods
private InfractionType MaterializeInfractionTypeFromDto(InfractionTypeDTO dto)
{
var it = new InfractionType()
{
Name = dto.Name,
Points = dto.Points,
Description = dto.Description
};
if (dto.Id != Guid.Empty)
it.ChangeCurrentIdentity(dto.Id);
return it;
}
private Driver MaterializeDriverFromDto(DriverDTO dto)
{
var driver = DriverFactory.CreateDriver(dto.Identifier, dto.FirstName, dto.LastName, dto.Points);
if (dto.Id != Guid.Empty)
driver.ChangeCurrentIdentity(dto.Id);
return driver;
}
private Vehicle MaterializeVehicleFromDto(VehicleDTO dto)
{
var vehicle = VehicleFactory.CreateVehicle(dto.License, dto.BrandId, dto.Model);
if (dto.Id != Guid.Empty)
vehicle.ChangeCurrentIdentity(dto.Id);
return vehicle;
}
private Infraction MaterializeInfractionFromDto(InfractionDTO dto)
{
var infraction = InfractionFactory.CreateInfraction(dto.VehicleId, dto.InfractionTypeId, dto.DriverId, dto.Date);
return infraction;
}
#endregion
#region IDisposable implementation
public void Dispose()
{
throw new NotImplementedException();
}
#endregion
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionTypeAg/IInfractionTypeRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg
{
public interface IInfractionTypeRepository: IRepository<InfractionType>
{
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/Migrations/CustomIndexes.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Infrastructure.Data.MainBoundedContext.Migrations
{
public static class CustomIndexes
{
public static void CreateCustomIndexes(UnitOfWork.MainBCUnitOfWork context)
{
//Drivers identification
context.Database.ExecuteSqlCommand("IF EXISTS (SELECT 'X' FROM sysindexes WHERE id = (SELECT OBJECT_ID('Drivers')) AND name = 'IX_Identifier') DROP INDEX Drivers.IX_Identifier");
context.Database.ExecuteSqlCommand("CREATE INDEX IX_Identifier ON Drivers(Identifier)");
//Vehicle license
context.Database.ExecuteSqlCommand("IF EXISTS (SELECT 'X' FROM sysindexes WHERE id = (SELECT OBJECT_ID('Vehicles')) AND name = 'IX_License') DROP INDEX Vehicles.IX_License");
context.Database.ExecuteSqlCommand("CREATE INDEX IX_License ON Vehicles(License)");
//Infractions date
context.Database.ExecuteSqlCommand("IF EXISTS (SELECT 'X' FROM sysindexes WHERE id = (SELECT OBJECT_ID('Infractions')) AND name = 'IX_Date') DROP INDEX Infractions.IX_Date");
context.Database.ExecuteSqlCommand("CREATE INDEX IX_Date ON Infractions(Date)");
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/InfractionAg/InfractionSpecifications.cs
using System;
using Domain.Seedwork.Specification;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg
{
public static class InfractionSpecifications
{
/// <summary>
/// Specification for Infraction with Driver id equals <param name="driverId" />
/// </summary>
/// <param name="driverId">The Infraction driver identifier</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Infraction> WithDriverId(Guid? driverId)
{
Specification<Infraction> specification = new TrueSpecification<Infraction>();
//Check arguments
if (driverId != null && driverId != Guid.Empty)
specification = new DirectSpecification<Infraction>(v => v.DriverId == driverId);
return specification;
}
/// <summary>
/// Specification for Infraction with Driver Identifier equals <param name="driverIdentifier" />
/// </summary>
/// <param name="driverIdentifier">The Infraction driver identifier</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Infraction> WithDriverIdentifier(string driverIdentifier)
{
Specification<Infraction> specification = new TrueSpecification<Infraction>();
//Check arguments
if (!String.IsNullOrEmpty(driverIdentifier))
specification = new DirectSpecification<Infraction>(v => v.Driver.Identifier.ToLower() == driverIdentifier.ToLower());
return specification;
}
/// <summary>
/// Specification for Infraction with Vehicle Id equals <param name="vehicleId" />
/// </summary>
/// <param name="vehicleId">The Infraction vehicle identifier</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Infraction> WithVehicleId(Guid? vehicleId)
{
Specification<Infraction> specification = new TrueSpecification<Infraction>();
//Check arguments
if (vehicleId != null && vehicleId != Guid.Empty)
specification = new DirectSpecification<Infraction>(v => v.VehicleId == vehicleId);
return specification;
}
/// <summary>
/// Specification for Infraction with Vehicle license plate equals <param name="vehicleLicense" />
/// </summary>
/// <param name="vehicleLicense">The Infraction vehicle identifier</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Infraction> WithVehicleLicense(string vehicleLicense)
{
Specification<Infraction> specification = new TrueSpecification<Infraction>();
//Check arguments
if (!String.IsNullOrEmpty(vehicleLicense))
specification = new DirectSpecification<Infraction>(v => v.Vehicle.License.ToLower() == vehicleLicense.ToLower());
return specification;
}
/// <summary>
/// Specification for Infraction with Infraction Type Id equals <param name="infractionTypeId" />
/// </summary>
/// <param name="infractionTypeId">The Infraction vehicle identifier</param>
/// <returns>Associated specification for this criterion</returns>
public static Specification<Infraction> WithInfractionType(Guid? infractionTypeId)
{
Specification<Infraction> specification = new TrueSpecification<Infraction>();
//Check arguments
if (infractionTypeId != null && infractionTypeId != Guid.Empty)
specification = new DirectSpecification<Infraction>(v => v.InfractionTypeId == infractionTypeId);
return specification;
}
/// <summary>
/// Specification for Get Infractions between <param name="from"></param> and <param name="to"></param>
/// </summary>
/// <param name="from">Infractions date min criteria></param>
/// <param name="to">Infractions date max criteria></param>
/// <returns>Associated specification for this criteria</returns>
public static Specification<Infraction> WithDateRange(DateTime? from, DateTime? to)
{
var fromD = DateTime.MinValue;
if (from.HasValue)
fromD = new DateTime(from.Value.Year, from.Value.Month, from.Value.Day);
var toD = DateTime.Now;
if (to.HasValue)
toD = new DateTime(to.Value.Year, to.Value.Month, to.Value.Day).AddDays(1).AddMilliseconds(-1);
return new DirectSpecification<Infraction>(o => o.Date >= fromD && o.Date <= toD);
}
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/VehiclesDrivers/VehicleDriverDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers
{
public class VehicleDriverDTO
{
/// <summary>
/// Get or set identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Associated vehicle identifier
/// </summary>
public Guid VehicleId { get; set; }
/// <summary>
/// Associated vehicle
/// </summary>
public string VehicleName{ get; set; }
/// <summary>
/// Associated vehicle license
/// </summary>
public string VehicleLicense { get; set; }
/// <summary>
/// Associated driver identifier
/// </summary>
public Guid DriverId { get; set; }
/// <summary>
/// Associated driver full name
/// </summary>
public string DriverFullName { get; set; }
/// <summary>
/// Associated driver identifier
/// </summary>
public string DriverIdentifier { get; set; }
/// <summary>
/// Associated Driver Points
/// </summary>
public int DriverPoints { get; set; }
/// <summary>
/// Get or set Created date
/// </summary>
public DateTime? CreatedDate { get; set; }
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/InitialData/InitialDataVehicles.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using System.Data.Entity.Migrations;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.InitialData
{
public class InitialDataVehicles
{
public static void Seed(UnitOfWork.MainBCUnitOfWork context)
{
var ferrariGTO = new Vehicle() { BrandId = EntityGuids.Brands.FerrariBrandId, Model = "GTO", License="1234-ABC", CreatedDate = DateTime.Now };
ferrariGTO.ChangeCurrentIdentity(EntityGuids.Vehicles.FerrariGTO);
context.Vehicles.AddOrUpdate(ferrariGTO);
var iagoAspas_Ferrari = new VehicleDriver() {DriverId = EntityGuids.Drivers.IagoAspas, VehicleId = EntityGuids.Vehicles.FerrariGTO, CreatedDate = DateTime.Now};
iagoAspas_Ferrari.GenerateNewIdentity();
context.VehiclesDrivers.Add(iagoAspas_Ferrari);
var bmwM3 = new Vehicle() { BrandId = EntityGuids.Brands.BMWBrandId, Model = "M3", License = "4546-BBF", CreatedDate = DateTime.Now };
bmwM3.ChangeCurrentIdentity(EntityGuids.Vehicles.BmwM3);
context.Vehicles.AddOrUpdate(bmwM3);
var nemanjaRadoja_BMW = new VehicleDriver() { DriverId = EntityGuids.Drivers.NemanjaRadoja, VehicleId = EntityGuids.Vehicles.BmwM3, CreatedDate = DateTime.Now };
nemanjaRadoja_BMW.GenerateNewIdentity();
context.VehiclesDrivers.Add(nemanjaRadoja_BMW);
var seatLeon = new Vehicle() { BrandId = EntityGuids.Brands.SeatBrandId, Model = "Leon", License = "66547-AC", CreatedDate = DateTime.Now };
seatLeon.ChangeCurrentIdentity(EntityGuids.Vehicles.SeatLeon);
context.Vehicles.AddOrUpdate(seatLeon);
var seatLeon_FranBeltran = new VehicleDriver() { DriverId = EntityGuids.Drivers.FranBeltran, VehicleId = EntityGuids.Vehicles.SeatLeon, CreatedDate = DateTime.Now };
seatLeon_FranBeltran.GenerateNewIdentity();
context.VehiclesDrivers.Add(seatLeon_FranBeltran);
var iagoAspas_SeatLeon = new VehicleDriver() { DriverId = EntityGuids.Drivers.IagoAspas, VehicleId = EntityGuids.Vehicles.SeatLeon, CreatedDate = DateTime.Now };
iagoAspas_SeatLeon.GenerateNewIdentity();
context.VehiclesDrivers.Add(iagoAspas_SeatLeon);
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleAgg/Vehicle.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
using Domain.Seedwork;
using Infrastructure.GlobalResources;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg
{
public class Vehicle: BaseEntity, IValidatableObject
{
#region Properties
/// <summary>
/// Get or set vehicle license plate
/// </summary>
public string License { get; set; }
/// <summary>
/// Card brand identifier
/// </summary>
public Guid BrandId { get; set; }
public virtual Brand Brand{ get; private set; }
/// <summary>
/// Get or set vehicle model
/// </summary>
public string Model { get; set; }
#endregion
#region Public methods
/// <summary>
/// Associate brand to current car
/// </summary>
/// <param name="brand"></param>
public void SetBrand(Brand brand)
{
if(brand == null || brand.IsTransient())
throw new ArgumentNullException(String.Format(CommonMessages.exception_CannotAssociateTransientOrNullEntity, Names.Brand));
this.BrandId = brand.Id;
this.Brand = brand;
}
#endregion
#region IValidatableObject implementation
/// <summary>
/// <see cref="IValidatableObject.Validate"/>
/// </summary>
/// <param name="validationContext"><see cref="IValidatableObject.Validate"/></param>
/// <returns><see cref="IValidatableObject.Validate"/></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var validationResults = new List<ValidationResult>();
//Check license
if (String.IsNullOrEmpty(License) || String.IsNullOrWhiteSpace(License))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.License), new string[] { "License" }));
//Check model
if (String.IsNullOrEmpty(Model) || String.IsNullOrWhiteSpace(Model))
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Model), new string[] { "Model" }));
//Check brand
if (this.BrandId == Guid.Empty)
validationResults.Add(new ValidationResult(String.Format(CommonValidations.FieldCannotBeEmpty, Names.Brand), new string[] { "BrandId" }));
return validationResults;
}
#endregion
}
}
<file_sep>/Application.MainBoundedContext/Services/IDgtAppService.cs
using Application.MainBoundedContext.DTO.DgtModule.Brands;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers;
namespace Application.MainBoundedContext.Services
{
public interface IDgtAppService: IDisposable
{
#region Brands
/// <summary>
/// Get all Brands
/// </summary>
/// <returns>List of Brand representations</returns>
List<BrandDTO> GetAllBrands();
/// <summary>
/// Get Brand by identifier
/// </summary>
/// <param name="id">Brand identifier</param>
/// <returns></returns>
BrandDTO GetBrandById(Guid id);
#endregion
//-----------------------------------------------------------------------
#region Infraction types
/// <summary>
/// Get all Infraction types
/// </summary>
/// <returns>List of infraction type representations</returns>
List<InfractionTypeDTO> GetAllInfractionTypes();
/// <summary>
/// Add new Infraction type
/// </summary>
/// <param name="infractionType">Infraction type to create</param>
/// <returns>Infraction type representation created</returns>
InfractionTypeDTO AddNewInfractionType(InfractionTypeDTO infractionType);
#endregion
//-----------------------------------------------------------------------
#region Drivers
/// <summary>
/// Search drivers by text filter
/// </summary>
/// <param name="filter">Filter</param>
/// <returns>Returns drivers representations that match</returns>
List<DriverDTO> SearchDrivers(string filter);
/// <summary>
/// Get driver by Id
/// </summary>
/// <param name="id">Driver id</param>
/// <returns>Driver representation that match</returns>
DriverDTO GetDriverById(Guid id);
/// <summary>
/// Get driver by NIF, NIE, ...
/// </summary>
/// <param name="identifier">NIF, NIE, ...</param>
/// <returns>Driver representation that match</returns>
DriverDTO GetDriverByNifNie(string identifier);
/// <summary>
/// Attach driver to vehicle
/// </summary>
/// <param name="vehicleLicense">Vehicle license plate</param>
/// <param name="driverIdentifier">Driver identifier</param>
/// <returns></returns>
VehicleDriverDTO AttachDriverToVehicle(string vehicleLicense, string driverIdentifier);
/// <summary>
/// Add new Driver
/// </summary>
/// <param name="driver">Driver to add</param>
/// <returns>Driver representation created</returns>
DriverDTO AddNewDriver(DriverDTO driver);
#endregion
//-----------------------------------------------------------------------
#region Vehicles
/// <summary>
/// Get all vehicles
/// </summary>
/// <returns></returns>
List<VehicleDTO> GetAllVehicles();
/// <summary>
/// Get vehicle by Id
/// </summary>
/// <param name="id">Vehicle id</param>
/// <returns>Vehicle representation that match</returns>
VehicleDTO GetVehicleById(Guid id);
/// <summary>
/// Get vehicle by license
/// </summary>
/// <param name="license">Vehicle license plate</param>
/// <returns>Vehicle representation that match</returns>
VehicleDTO GetVehicleByLicense(string license);
/// <summary>
/// Add new Vehicle
/// </summary>
/// <param name="vehicle">Vehicle to add</param>
/// <returns>Vehicle representation created</returns>
VehicleDTO AddNewVehicle(VehicleDTO vehicle);
/// <summary>
/// Search vehicles
/// </summary>
/// <param name="filter">Filter to search</param>
/// <returns>Vehicle representation</returns>
List<VehicleDTO> SearchVehicles(string filter);
#endregion
//-----------------------------------------------------------------------
#region Infractions
/// <summary>
/// Add new Infraction
/// </summary>
/// <param name="dto">Infraction representation to create</param>
/// <returns>Infraction representation created</returns>
InfractionDTO AddNewInfraction(InfractionDTO dto);
/// <summary>
/// Search infractions
/// </summary>
/// <param name="vehicleLicense">Vehicle license plate filter</param>
/// <param name="driverIdentifier">Driver NIF / NIE</param>
/// <param name="infractionTypeId">Infraction type filter</param>
/// <param name="from">Infraction from date filter</param>
/// <param name="to">Infraction to date filter</param>
/// <returns>Infractions representations that match</returns>
List<InfractionDTO> SearchInfractions(string vehicleLicense, string driverIdentifier, Guid? infractionTypeId, DateTime? from, DateTime? to);
/// <summary>
/// Get last number of infractions
/// </summary>
/// <param name="count">Number of elements to show</param>
/// <returns>Infraction representations</returns>
List<InfractionDTO> GetLastInfractions(int count);
/// <summary>
/// Get infraction stats
/// </summary>
/// <returns>Infraction stats representation</returns>
List<InfractionStatsDTO> GetInfractionStats();
/// <summary>
/// Get items counts
/// </summary>
/// <returns>ItemsCountsDTO</returns>
ItemsCountsDTO GetItemsCount();
#endregion
//-----------------------------------------------------------------------
#region VehicleDriver
/// <summary>
/// Get Vehicles by driver identifier
/// </summary>
/// <param name="driverIdentifier">Driver NIF, NIE</param>
/// <returns></returns>
List<VehicleDriverDTO> GetVehiclesByDriver(string driverIdentifier);
/// <summary>
/// Get Drivers by vehicle license
/// </summary>
/// <param name="vehicleLicense">Vehicle license</param>
/// <returns></returns>
List<VehicleDriverDTO> GetDriversByVehicle(string vehicleLicense);
#endregion
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/ApiManagerVehicles.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
using Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers;
using Newtonsoft.Json;
namespace Presentation.Windows.Seedwork.Api
{
public class ApiManagerVehicles: ApiManagerBase
{
const string URL_KEY = "vehicles";
public static async Task<List<VehicleDTO>> Search(string filter = "")
{
var url = URL_KEY + "/all";
if (!String.IsNullOrEmpty(filter))
url = URL_KEY + "/search/" + filter;
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(url))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<VehicleDTO>();
else
{
var items = JsonConvert.DeserializeObject<VehicleDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<List<VehicleDriverDTO>> ByDriverIdentifier(string identifier)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/driver/" + identifier))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<VehicleDriverDTO>();
else
{
var items = JsonConvert.DeserializeObject<VehicleDriverDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<VehicleDTO> GetByLicense(string license)
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY + "/license/" + license))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return null;
else
{
var item = JsonConvert.DeserializeObject<VehicleDTO>(result);
return item;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<VehicleDTO> AddNew(VehicleDTO vehicle)
{
using (var client = GetHttpClient())
{
var serializeObject = JsonConvert.SerializeObject(vehicle);
var content = new StringContent(serializeObject, Encoding.UTF8, "application/json");
using (var response = await client.PostAsync(URL_KEY + "/save", content))
{
if (response.IsSuccessStatusCode)
{
if (response.Content != null)
{
var stringResult = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<VehicleDTO>(stringResult);
return result;
}
else
return null;
}
else
{
throw new Exception(await CastResultError(response));
}
}
}
}
public static async Task<VehicleDriverDTO> AttachDriver(string vehicleLicense, string driverIdentifier)
{
using (var client = GetHttpClient())
{
var url = String.Format("vehicles-drivers/{0}/{1}", vehicleLicense, driverIdentifier);
using (var response = await client.PostAsync(url, null))
{
if (response.IsSuccessStatusCode)
{
if (response.Content != null)
{
var stringResult = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<VehicleDriverDTO>(stringResult);
return result;
}
else
return null;
}
else
{
throw new Exception(await CastResultError(response));
}
}
}
}
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/Vehicles/VehicleDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.Vehicles
{
public class VehicleDTO
{
/// <summary>
/// Get or set Vehicle identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Get or set vehicle license plate
/// </summary>
public string License { get; set; }
/// <summary>
/// Vehicle brand identifier
/// </summary>
public Guid BrandId { get; set; }
/// <summary>
/// Vehicle brand name
/// </summary>
public string BrandName{ get; set; }
/// <summary>
/// Get or set vehicle model
/// </summary>
public string Model { get; set; }
/// <summary>
/// Vehicle full name
/// </summary>
public string VehicleFullName { get; set; }
/// <summary>
/// Get or ser habitual driver
/// </summary>
public Guid DriverId { get; set; }
/// <summary>
/// Get or set Created date
/// </summary>
public DateTime? CreatedDate { get; set; }
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/BaseEntity.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule
{
public abstract class BaseEntity: Entity
{
/// <summary>
/// Get or set created date
/// </summary>
public DateTime CreatedDate { get; set; }
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/Mapping/InfractionEntityConfiguration.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping
{
class InfractionEntityConfiguration
:EntityTypeConfiguration<Infraction>
{
public InfractionEntityConfiguration()
{
//Configure keys and properties
this.HasKey(c => c.Id);
this.Property(c => c.DriverId)
.IsRequired();
this.Property(c => c.VehicleId)
.IsRequired();
this.Property(c => c.InfractionTypeId)
.IsRequired();
this.Property(c => c.Date)
.IsRequired();
// Configure table associations
this.HasRequired(s => s.Driver)
.WithMany()
.HasForeignKey(s => s.DriverId)
.WillCascadeOnDelete(true);
this.HasRequired(s => s.Vehicle)
.WithMany()
.HasForeignKey(s => s.VehicleId)
.WillCascadeOnDelete(true);
this.HasRequired(s => s.InfractionType)
.WithMany()
.HasForeignKey(s => s.InfractionTypeId)
.WillCascadeOnDelete(true);
//Table mappings
this.ToTable("Infractions");
}
}
}
<file_sep>/Infrastructure.CrossCutting.MainBoundedContext.IoC/IoCUnityContainer.cs
using Application.MainBoundedContext.Services;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
using Infrastructure.Crosscutting.Adapter;
using Infrastructure.Crosscutting.Logging;
using Infrastructure.Crosscutting.NetFramework.Adapter;
using Infrastructure.Crosscutting.NetFramework.Caching;
using Infrastructure.Crosscutting.NetFramework.Logging;
using Infrastructure.Crosscutting.NetFramework.Validator;
using Infrastructure.Crosscutting.Validator;
using Infrastructure.Data.MainBoundedContext.DgtModule.Repositories;
using Unity;
using Unity.Lifetime;
namespace Infrastructure.CrossCutting.MainBoundedContext.IoC
{
public static class Container
{
#region Members
private static IUnityContainer _container;
#endregion
#region Properties
/// <summary>
/// Get the current configured container
/// </summary>
/// <returns>Configured container</returns>
public static IUnityContainer Current
{
get
{
if (_container == null)
_container = BuildUnityContainer();
return _container;
}
}
#endregion
#region Public methods
public static IUnityContainer BuildUnityContainer()
{
// Take into account that Types and Mappings registration could be also done using the UNITY XML configuration
//But we prefer doing it here (C# code) because we'll catch errors at compiling time instead execution time,
//if any type has been written wrong.
_container = new UnityContainer();
//-> Unit of Work and repositories
//container.RegisterType<IMainBCUnitOfWork, MainBCUnitOfWork>(new PerResolveLifetimeManager());
// _container.RegisterType(typeof(MainBCUnitOfWork), new PerResolveLifetimeManager());
//
//-> ADAPTERS ---------------------------------------------------------------------------------------------------------------------------
//
_container.RegisterType<ITypeAdapterFactory, AutomapperTypeAdapterFactory>(new ContainerControlledLifetimeManager());
//
//-> CACHE MANAGERS ----------------------------------------------------------------------------------------------------------
_container.RegisterType<Crosscutting.Caching.ICacheManager, CacheManager>();
//
//-> REPOSITORIES -----------------------------------------------------------------------------------------------------------------------
//
// -> CommonModule
_container.RegisterType<IBrandRepository, BrandRepository>();
_container.RegisterType<IInfractionTypeRepository, InfractionTypeRepository>();
_container.RegisterType<IDriverRepository, DriverRepository>();
_container.RegisterType<IInfractionRepository, InfractionRepository>();
_container.RegisterType<IVehicleRepository, VehicleRepository>();
_container.RegisterType<IVehicleDriverRepository, VehicleDriverRepository>();
//
//-> DOMAIN SERVICES ----------------------------------------------------------------------------------------------------------------
//
//
//-> APPLICATION SERVICES ----------------------------------------------------------------------------------------------------------
//
// -> CommonModule
_container.RegisterType<IDgtAppService, DgtAppService>();
//Return container
return _container;
}
public static void ConfigureFactories(IUnityContainer container)
{
LoggerFactory.SetCurrent(new TraceSourceLogFactory());
EntityValidatorFactory.SetCurrent(new DataAnnotationsEntityValidatorFactory());
var typeAdapterFactory = container.Resolve<ITypeAdapterFactory>();
TypeAdapterFactory.SetCurrent(typeAdapterFactory);
}
#endregion
}
}
<file_sep>/Application.Seedwork/ValidationExtensionMethods.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Infrastructure.Crosscutting.Validator;
namespace Application.Seedwork
{
public static class ValidationExtensionMethods
{
/// <summary>
/// Validate Entity calling IValidatableObject.Validate
/// </summary>
/// <param name="item">Entity to validate</param>
public static void Validate<TEntity>(this TEntity item)
where TEntity : class, new()
{
//Recover validator
var validator = EntityValidatorFactory.CreateValidator();
//Validate entity
if (!validator.IsValid(item))
throw new ApplicationValidationErrorsException(validator.GetInvalidMessages(item));
}
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/InitialData/InitialDataInfractionTypes.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.InitialData
{
public static class InitialDataInfractionTypes
{
public static void Seed(UnitOfWork.MainBCUnitOfWork context)
{
var excesoVelocidad20 = new InfractionType() { Name = "Exceder la velocidad máxima permitida en un 20%", Points = 2, CreatedDate = DateTime.Now };
excesoVelocidad20.ChangeCurrentIdentity(EntityGuids.InfractionTypes.ExcesoVelocidad20);
context.InfractionTypes.AddOrUpdate(excesoVelocidad20);
var excesoVelocidad40 = new InfractionType() { Name = "Exceder la velocidad máxima permitida en un 40%", Points = 4, CreatedDate = DateTime.Now };
excesoVelocidad40.ChangeCurrentIdentity(EntityGuids.InfractionTypes.ExcesoVelocidad40);
context.InfractionTypes.AddOrUpdate(excesoVelocidad40);
var excesoVelocidad60 = new InfractionType() { Name = "Exceder la velocidad máxima permitida en un 60%", Points = 8, CreatedDate = DateTime.Now };
excesoVelocidad60.ChangeCurrentIdentity(EntityGuids.InfractionTypes.ExcesoVelocidad60);
context.InfractionTypes.AddOrUpdate(excesoVelocidad60);
var aparcarEnDobleFila = new InfractionType() { Name = "Aparcar en doble fila", Points = 2, CreatedDate = DateTime.Now };
aparcarEnDobleFila.ChangeCurrentIdentity(EntityGuids.InfractionTypes.DobleFila);
context.InfractionTypes.AddOrUpdate(aparcarEnDobleFila);
var sinCinturonSeguridad = new InfractionType() { Name = "No llevar el cinturón de seguridad", Points = 3, CreatedDate = DateTime.Now };
sinCinturonSeguridad.ChangeCurrentIdentity(EntityGuids.InfractionTypes.SinCinturonSeguridad);
context.InfractionTypes.AddOrUpdate(sinCinturonSeguridad);
}
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/MainBCUnitOfWork.cs
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.Validation;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.BrandAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.InfractionTypeAg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
using Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping;
using Infrastructure.Data.Seedwork;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork
{
public class MainBCUnitOfWork
: DbContext, IQueryableUnitOfWork
{
#region IDbSet Members
///
/// Brands
///
private IDbSet<Brand> _brands;
public IDbSet<Brand> Brands => _brands ?? (_brands = base.Set<Brand>());
///
/// InfractionTypes
///
private IDbSet<InfractionType> _infractionTypes;
public IDbSet<InfractionType> InfractionTypes => _infractionTypes ?? (_infractionTypes = base.Set<InfractionType>());
///
/// Vehicles
///
private IDbSet<Vehicle> _vehicles;
public IDbSet<Vehicle> Vehicles => _vehicles ?? (_vehicles = base.Set<Vehicle>());
///
/// Drivers
///
private IDbSet<Driver> _drivers;
public IDbSet<Driver> Drivers => _drivers ?? (_drivers = base.Set<Driver>());
///
/// Infractions
///
private IDbSet<Infraction> _infractions;
public IDbSet<Infraction> Infractions => _infractions ?? (_infractions = base.Set<Infraction>());
///
/// VehicleDrivers
///
private IDbSet<VehicleDriver> _vehiclesDrivers;
public IDbSet<VehicleDriver> VehiclesDrivers => _vehiclesDrivers ?? (_vehiclesDrivers = base.Set<VehicleDriver>());
#endregion
#region IQueryableUnitOfWork Members
public DbSet<TEntity> CreateSet<TEntity>()
where TEntity : class
{
return base.Set<TEntity>();
}
public void Attach<TEntity>(TEntity item)
where TEntity : class
{
//attach and set as unchanged
base.Entry<TEntity>(item).State = EntityState.Unchanged;
}
public void SetModified<TEntity>(TEntity item)
where TEntity : class
{
//this operation also attach item in object state manager
base.Entry<TEntity>(item).State = EntityState.Modified;
}
public void ApplyCurrentValues<TEntity>(TEntity original, TEntity current)
where TEntity : class
{
//if it is not attached, attach original and set current values
base.Entry<TEntity>(original).CurrentValues.SetValues(current);
}
public void Commit()
{
try
{
base.SaveChanges();
}
catch (DbEntityValidationException dbex)
{
var errMsgs = new List<String>();
foreach (var err in dbex.EntityValidationErrors)
foreach (var valErr in err.ValidationErrors)
errMsgs.Add(valErr.ErrorMessage);
var result = "";
foreach (var e in errMsgs)
result += e + Environment.NewLine;
throw new Exception(result);
}
}
public void CommitAndRefreshChanges()
{
bool saveFailed = false;
do
{
try
{
base.SaveChanges();
saveFailed = false;
}
catch (DbUpdateConcurrencyException ex)
{
saveFailed = true;
ex.Entries.ToList()
.ForEach(entry =>
{
entry.OriginalValues.SetValues(entry.GetDatabaseValues());
});
}
} while (saveFailed);
}
public void RollbackChanges()
{
// set all entities in change tracker
// as 'unchanged state'
base.ChangeTracker.Entries()
.ToList()
.ForEach(entry => entry.State = EntityState.Unchanged);
}
public IEnumerable<TEntity> ExecuteQuery<TEntity>(string sqlQuery, params object[] parameters)
{
return base.Database.SqlQuery<TEntity>(sqlQuery, parameters);
}
public int ExecuteCommand(string sqlCommand, params object[] parameters)
{
return base.Database.ExecuteSqlCommand(sqlCommand, parameters);
}
#endregion
#region DbContext Overrides
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//Remove unused conventions
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
//Dgt entities configuration
modelBuilder.Configurations.Add(new BrandEntityConfiguration());
modelBuilder.Configurations.Add(new InfractionTypeEntityConfiguration());
modelBuilder.Configurations.Add(new DriverEntityConfiguration());
modelBuilder.Configurations.Add(new VehicleEntityConfiguration());
modelBuilder.Configurations.Add(new InfractionEntityConfiguration());
modelBuilder.Configurations.Add(new VehicleDriverEntityConfiguration());
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/FrmContainer.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Presentation.Windows.Seedwork.Api;
using Presentation.Windows.UI.UcControls;
namespace Presentation.Windows.UI
{
public partial class FrmContainer : Form
{
#region Members
private enum Option
{
Home = 0,
InfractionTypes = 1,
Infractions = 2,
Drivers = 3,
Vehicles = 4,
Brands = 5
}
protected UcHome UcHome;
protected UcBrands UcBrands;
protected UcDrivers UcDrivers;
protected UcInfractions UcInfractions;
protected UcInfractionTypes UcInfractionTypes;
protected UcVehicles UcVehicles;
#endregion
#region Control events
#region Menu options
private void tsbExit_Click(object sender, EventArgs e)
{
if (MessageBox.Show("¿Desea salir de la Aplicación?", "Salir de la Aplicación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
System.Windows.Forms.Application.Exit();
}
private void tsbInfractionTypes_Click(object sender, EventArgs e)
{
ShowControl(Option.InfractionTypes);
}
private void FrmContainer_Load(object sender, EventArgs e)
{
ShowControl(Option.Home);
}
private void tsbInicio_Click(object sender, EventArgs e)
{
ShowControl(Option.Home);
}
private void tsbInfractions_Click(object sender, EventArgs e)
{
ShowControl(Option.Infractions);
}
private void tsbDrivers_Click(object sender, EventArgs e)
{
ShowControl(Option.Drivers);
}
private void tsbVehicles_Click(object sender, EventArgs e)
{
ShowControl(Option.Vehicles);
}
private void tsbBrands_Click(object sender, EventArgs e)
{
ShowControl(Option.Brands);
}
private async void ShowControl(Option option)
{
Control currentControl = null;
switch (option)
{
case Option.Home:
if (UcHome == null) UcHome = new UcHome();
UcHome.RefreshControl();
currentControl = UcHome;
break;
case Option.Brands:
if (UcBrands == null) UcBrands = new UcBrands();
currentControl = UcBrands;
break;
case Option.Drivers:
if (UcDrivers == null) UcDrivers = new UcDrivers();
await UcDrivers.SearchDrivers();
currentControl = UcDrivers;
break;
case Option.Infractions:
if (UcInfractions == null) UcInfractions = new UcInfractions();
await UcInfractions.SearchInfractions();
currentControl = UcInfractions;
break;
case Option.InfractionTypes:
if (UcInfractionTypes == null) UcInfractionTypes = new UcInfractionTypes();
currentControl = UcInfractionTypes;
break;
case Option.Vehicles:
if (UcVehicles == null) UcVehicles = new UcVehicles();
await UcVehicles.SearchVehicles();
currentControl = UcVehicles;
break;
}
if (currentControl != null)
{
currentControl.Dock = DockStyle.Fill;
this.panelContainer.Controls.Clear();
this.panelContainer.Controls.Add(currentControl);
}
}
#endregion
public FrmContainer()
{
InitializeComponent();
SetResources();
this.InitializeContext();
Thread.Sleep(1000);
}
private async void InitializeContext()
{
// Call api to initialize context
await ApiManagerBrands.GetAllBrands();
}
private void SetResources()
{
this.tsbInicio.Image = Properties.Resources.home;
this.tsbInfractionTypes.Image = Properties.Resources.infraction_types;
this.tsbInfractions.Image = Properties.Resources.infractions;
this.tsbDrivers.Image = Properties.Resources.drivers;
this.tsbVehicles.Image = Properties.Resources.vehicles;
this.tsbBrands.Image = Properties.Resources.brands;
this.tsbExit.Image = Properties.Resources.exit;
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/SecondaryForms/FrmAddNewVehicle.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.Brands;
using Application.MainBoundedContext.DTO.DgtModule.Drivers;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.SecondaryForms
{
public partial class FrmAddNewVehicle : Form
{
#region Members
private VehicleDTO _vehicle;
private List<BrandDTO> _brands;
private DriverDTO _driver;
private bool _showDriver = false;
#endregion
#region Constructor
public FrmAddNewVehicle()
{
InitializeComponent();
SetResources();
}
#endregion
#region Control events
private void FrmAddNewVehicle_Load(object sender, EventArgs e)
{
LoadBrands();
ShowDriver(false);
}
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private async void cmdAccept_Click(object sender, EventArgs e)
{
if (this.ValidateData())
{
try
{
this._vehicle = await ApiManagerVehicles.AddNew(this._vehicle);
this.DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
MessageBox.Show("Ha ocurrido el siguiente error:" + Environment.NewLine + Environment.NewLine + ex.GetBaseException().Message, "DGT", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void txtIdentifier_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtIdentifier.Text = "";
var current = this.vehicleDTOBindingSource.Current as VehicleDTO;
if (current != null)
current.DriverId = Guid.Empty;
ShowDriver(false);
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtIdentifier.Text.Trim();
if (!String.IsNullOrEmpty(filter))
{
e.Handled = true;
this.GetDriverByIdentifier(filter);
}
}
}
#endregion
#region Public methods
public VehicleDTO AddNewVehicle()
{
ClearErrors();
this._vehicle = new VehicleDTO();
this.vehicleDTOBindingSource.DataSource = this._vehicle;
this.vehicleDTOBindingSource.MoveFirst();
var dialogResult = this.ShowDialog();
if (dialogResult == DialogResult.OK)
return this._vehicle;
else
return null;
}
#endregion
#region Private methods
private bool ValidateData()
{
this.ClearErrors();
var result = true;
var v = this.vehicleDTOBindingSource.Current as VehicleDTO;
// Check brand
if (v.BrandId == Guid.Empty)
{
errP.SetError(this.brandIdComboBox, "Campo obligatorio");
result = false;
}
// Check model
if (String.IsNullOrEmpty(v.Model))
{
errP.SetError(this.modelTextBox, "Campo obligatorio");
result = false;
}
// Check license
if (String.IsNullOrEmpty(v.License))
{
errP.SetError(this.licenseTextBox, "Campo obligatorio");
result = false;
}
// Check driverId
if (v.DriverId == Guid.Empty)
{
errP.SetError(this.txtIdentifier, "Campo obligatorio");
this.ShowDriver(false);
result = false;
}
// Check habitual driver
return result;
}
private void ClearErrors()
{
foreach (Control ctr in this.groupBox1.Controls)
{
errP.SetError(ctr, "");
}
}
private void SetResources()
{
this.cmdCancel.Image = Properties.Resources.cancel;
this.cmdAccept.Image = Properties.Resources.ok;
}
private async void LoadBrands()
{
this._brands = new List<BrandDTO>();
this._brands.Add(new BrandDTO() {Id = Guid.Empty, Name = "Seleccionar marca"});
var b = await ApiManagerBrands.GetAllBrands();
this._brands.AddRange(b);
this.brandDTOBindingSource.DataSource = this._brands;
}
private async void GetDriverByIdentifier(string identifier)
{
var driver = await ApiManagerDrivers.GetByNifNie(identifier);
if (driver != null)
{
var current = this.vehicleDTOBindingSource.Current as VehicleDTO;
if (current != null)
{
current.DriverId = driver.Id;
this.driverDTOBindingSource.DataSource = driver;
ShowDriver(true);
}
}
else
{
MessageBox.Show("No se ha encontrado ningún resultado", "Búsqueda de conductor",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
ShowDriver(false);
}
}
private void ShowDriver(bool value)
{
this.paneDriverNOTSetted.Visible = !value;
this.paneDriverSetted.Visible = value;
}
#endregion
}
}
<file_sep>/Application.MainBoundedContext.DTO/DgtModule/Infractions/InfractionStatsDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.Infractions
{
public class InfractionStatsDTO
{
/// <summary>
/// Get or set the InfractionType name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Get or set infraction count by Infraction Type
/// </summary>
public int Count { get; set; }
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/DgtModule/Repositories/DriverRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg;
using Infrastructure.Data.MainBoundedContext.UnitOfWork;
using Infrastructure.Data.Seedwork;
namespace Infrastructure.Data.MainBoundedContext.DgtModule.Repositories
{
public class DriverRepository: Repository<Driver>, IDriverRepository
{
#region Constructor
/// <summary>
/// Create a new instance of DriverRepository
/// </summary>
/// <param name="unitOfWork">Associated unit of work</param>
public DriverRepository(MainBCUnitOfWork unitOfWork)
: base(unitOfWork)
{
}
#endregion
#region IDriverRespository
public int Count()
{
var currentUnitOfWork = this.UnitOfWork as MainBCUnitOfWork;
var set = currentUnitOfWork.CreateSet<Driver>();
return set.Count();
}
#endregion
}
}
<file_sep>/Presentation.Windows.UI/FrmSplash.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Presentation.Windows.UI
{
public partial class FrmSplash : Form
{
public FrmSplash()
{
InitializeComponent();
// DGT Logo
this.imgDgtLogo.Image = Properties.Resources.DGT_logo;
this.imgDgtLogo.SizeMode = PictureBoxSizeMode.Zoom;
// Loading image
this.imgLoading.Image = Properties.Resources.loading160x24;
this.imgDgtLogo.SizeMode = PictureBoxSizeMode.Zoom;
this.StartPosition = FormStartPosition.CenterScreen;
}
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/Controllers/VehicleController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Application.MainBoundedContext.Services;
using Application.MainBoundedContext.DTO.DgtModule.Vehicles;
namespace DistributedServices.MainBoundedContext.Api.Controllers
{
public class VehicleController : ApiController
{
#region Members
private readonly IDgtAppService _dgtAppService;
public const string GuidPattern = @"^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$";
#endregion
#region Constructor
public VehicleController(IDgtAppService dgtAppService)
{
//Check dependencies
if (dgtAppService == null)
throw new ArgumentNullException("dgtAppService");
//Assign dependencies
this._dgtAppService = dgtAppService;
}
#endregion
#region Api methods
[HttpGet]
[Route("api/vehicles/{id:guid}")]
public IHttpActionResult Get(Guid id)
{
var vehicleDTO = this._dgtAppService.GetVehicleById(id);
return Ok(vehicleDTO);
}
[HttpGet]
[Route("api/vehicles/all")]
public IHttpActionResult All()
{
var vehicleDTO = this._dgtAppService.GetAllVehicles();
return Ok(vehicleDTO);
}
[HttpGet]
[Route("api/vehicles/search/{filter}")]
public IHttpActionResult Search(string filter)
{
var vehicleDTO = this._dgtAppService.SearchVehicles(filter);
return Ok(vehicleDTO);
}
[HttpGet]
[Route("api/vehicles/license/{license}")]
public IHttpActionResult Nif(string license)
{
var vehicleDTO = this._dgtAppService.GetVehicleByLicense(license);
return Ok(vehicleDTO);
}
[HttpGet]
[Route("api/vehicles/driver/{identifier}")]
public IHttpActionResult GetVehicleDrivers(string identifier)
{
var vehicleDTO = this._dgtAppService.GetVehiclesByDriver(identifier);
return Ok(vehicleDTO);
}
[HttpPost]
[Route("api/vehicles/save")]
public IHttpActionResult Save(VehicleDTO dto)
{
try
{
var result = this._dgtAppService.AddNewVehicle(dto);
return Ok(result);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpPost]
[Route("api/vehicles-drivers/{vehicleLicense}/{driverIdentifier}")]
public IHttpActionResult AttachDriverToVehicle(string vehicleLicense, string driverIdentifier)
{
try
{
var vehicleDTO = this._dgtAppService.AttachDriverToVehicle(vehicleLicense, driverIdentifier);
return Ok(vehicleDTO);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
#endregion
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/App_Start/WebApiConfig.cs
using System.Web.Http;
namespace DistributedServices.MainBoundedContext.Api.App_Start
{
public class WebApiConfig
{
public static string ControllerOnly = "ApiControllerOnly";
public static string ControllerAndId = "ApiControllerAndGuiid";
public static string ControllerAction = "ApiControllerAction";
public static string ControllerActionAndId = "ApiControllerActionAndGuid";
public const string GuidPattern =
@"^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$";
public static void Configure(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: ControllerOnly,
routeTemplate: "api/{controller}"
);
config.Routes.MapHttpRoute(
name: ControllerAndId,
routeTemplate: "api/{controller}/{id}",
defaults: null, //defaults: new { id = RouteParameter.Optional } //,
constraints: new { id = GuidPattern } // id must be all digits
);
config.Routes.MapHttpRoute(
name: ControllerAction,
routeTemplate: "api/{controller}/{action}"
);
config.Routes.MapHttpRoute(
name: ControllerActionAndId,
routeTemplate: "api/{controller}/{action}/{id}",
defaults: null, //defaults: new { id = RouteParameter.Optional } //,
constraints: new { id = GuidPattern } // id must be all digits
);
}
}
}<file_sep>/Application.MainBoundedContext.DTO/DgtModule/Infractions/InfractionDTO.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application.MainBoundedContext.DTO.DgtModule.Infractions
{
public class InfractionDTO
{
/// <summary>
/// Get or set infraction identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Get or set infraction driver identifier
/// </summary>
public Guid DriverId { get; set; }
/// <summary>
/// Driver infraction driver full name
/// </summary>
public string DriverFullName { get; set; }
/// <summary>
/// Get or set infraction driver identifier
/// </summary>
public string DriverIdentifier { get; set; }
/// <summary>
/// Get or set infraction vehicle identifier
/// </summary>
public Guid VehicleId { get; set; }
/// <summary>
/// Get or set infraction vehicle license
/// </summary>
public string VehicleLicense { get; set; }
/// <summary>
/// Get or set infraction vehicle brand and model
/// </summary>
public string VehicleFullName { get; set; }
/// <summary>
/// Get or set Infraction type identifier
/// </summary>
public Guid InfractionTypeId { get; set; }
/// <summary>
/// Get or set infraction type name
/// </summary>
public string InfractionTypeName { get; set; }
/// <summary>
/// Get or set infraction points
/// </summary>
public int InfractionPoints { get; set; }
/// <summary>
/// Get or set infraction date
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// Get or set Created date
/// </summary>
public DateTime? CreatedDate { get; set; }
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/Controllers/TestController.cs
using System;
using System.Collections.Generic;
using System.Web.Http;
using Application.MainBoundedContext.Services;
namespace DistributedServices.MainBoundedContext.Api.Controllers
{
public class TestController : ApiController
{
[HttpGet]
public IHttpActionResult Get()
{
return Ok("WebApi working ...");
}
}
}
<file_sep>/DistributedServices.MainBoundedContext.Api/App_Start/UnityConfig.cs
using System.Web.Http;
using Infrastructure.CrossCutting.MainBoundedContext.IoC;
using Unity;
using Unity.WebApi;
namespace DistributedServices.MainBoundedContext.Api
{
public static class UnityConfig
{
public static void RegisterComponents()
{
//Register types
IUnityContainer container = Container.BuildUnityContainer();
//Configure factories
Container.ConfigureFactories(container);
GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
}
}
}<file_sep>/Presentation.Windows.UI/SecondaryForms/FrmAddNewInfraction.cs
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Application.MainBoundedContext.DTO.DgtModule.VehiclesDrivers;
using Presentation.Windows.Seedwork.Api;
namespace Presentation.Windows.UI.SecondaryForms
{
public partial class FrmAddNewInfraction : Form
{
#region Members
private InfractionDTO _infraction;
private List<InfractionTypeDTO> _infractionTypes;
#endregion
#region Constructor
public FrmAddNewInfraction()
{
InitializeComponent();
}
#endregion
#region Control events
private void FrmAddNewInfraction_Load(object sender, EventArgs e)
{
SetResources();
LoadInfractionTypes();
}
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private async void cmdAccept_Click(object sender, EventArgs e)
{
if (this.ValidateData())
{
try
{
this._infraction = await ApiManagerInfractions.AddNew(this._infraction);
this.DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
MessageBox.Show("Ha ocurrido el siguiente error:" + Environment.NewLine + Environment.NewLine + ex.GetBaseException().Message, "DGT", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void txtLicenseFilter_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.txtLicenseFilter.Text = "";
var current = this.infractionDTOBindingSource.Current as InfractionDTO;
if (current != null)
{
current.VehicleId = Guid.Empty;
}
e.Handled = true;
}
else if (e.KeyChar == (char)Keys.Enter)
{
var filter = this.txtLicenseFilter.Text.Trim();
if (!String.IsNullOrEmpty(filter))
{
e.Handled = true;
this.GetVehicleByLicense(filter);
}
}
}
#endregion
#region Public methods
public InfractionDTO AddNewInfraction()
{
ClearErrors();
this._infraction = new InfractionDTO();
this.infractionDTOBindingSource.DataSource = this._infraction;
this.infractionDTOBindingSource.MoveFirst();
var dialogResult = this.ShowDialog();
if (dialogResult == DialogResult.OK)
return this._infraction;
else
return null;
}
#endregion
#region Private methods
private void ClearErrors()
{
foreach (Control ctr in this.groupBox1.Controls)
{
errP.SetError(ctr, "");
}
}
private void SetResources()
{
this.cmdCancel.Image = Properties.Resources.cancel;
this.cmdAccept.Image = Properties.Resources.ok;
}
private async void LoadInfractionTypes()
{
this._infractionTypes = new List<InfractionTypeDTO>()
{
new InfractionTypeDTO() {Name = " Seleccionar infracción", Points = 0}
};
var i = await ApiManagerInfractionTypes.GetAllInfractionTypes();
this._infractionTypes.AddRange(i);
this.infractionTypeDTOBindingSource.DataSource = this._infractionTypes;
}
private void ShowVehicle(bool value)
{
}
private async void GetVehicleByLicense(string license)
{
var infraction = this.infractionDTOBindingSource.Current as InfractionDTO;
if (infraction != null)
{
var v = await ApiManagerVehicles.GetByLicense(license);
if (v != null)
{
infraction.VehicleId = v.Id;
infraction.VehicleFullName = v.VehicleFullName;
infraction.VehicleLicense = v.License;
this.lblVehicleFullName.Text = v.VehicleFullName;
GetDriversByVehicleLicense(license);
}
else
{
MessageBox.Show("No se ha encontrado ningún resultado", "Buscar vehículo", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
infraction.VehicleId = Guid.Empty;
infraction.VehicleFullName = "";
infraction.VehicleLicense = "";
this.lblVehicleFullName.Text = "";
this.vehicleDriverDTOBindingSource.DataSource = null;
}
}
}
private async void GetDriversByVehicleLicense(string license)
{
var infraction = this.infractionDTOBindingSource.Current as InfractionDTO;
if (infraction != null)
{
var drivers = await ApiManagerDrivers.GetDriversByVehicleLicense(license);
if (drivers != null && drivers.Any())
{
this.vehicleDriverDTOBindingSource.DataSource = drivers;
if (drivers.Count == 1)
{
infraction.DriverId = drivers.First().DriverId;
infraction.DriverFullName = drivers.First().DriverFullName;
infraction.DriverIdentifier = drivers.First().DriverIdentifier;
this.lblDriverIdentifier.Text = drivers.First().DriverIdentifier;
this.lblDriverFullName.Text = drivers.First().DriverFullName;
}
else
{
infraction.DriverId = drivers.First().DriverId;
infraction.DriverFullName = drivers.First().DriverFullName;
infraction.DriverIdentifier = drivers.First().DriverIdentifier;
this.lblDriverIdentifier.Text = drivers.First().DriverIdentifier;
this.lblDriverFullName.Text = drivers.First().DriverFullName;
}
}
else
{
infraction.DriverId = Guid.Empty;
infraction.DriverFullName = "";
infraction.DriverIdentifier = "";
this.lblDriverIdentifier.Text = "";
this.lblDriverFullName.Text = "";
this.vehicleDriverDTOBindingSource.DataSource = null;
}
}
}
private void GetDriverByIdentifier(string identifier)
{
}
#endregion
private bool ValidateData()
{
this.ClearErrors();
var result = true;
var v = this.infractionDTOBindingSource.Current as InfractionDTO;
v.Date = this.dateDateTimePicker.Value;
if (v.Date > DateTime.Now)
{
this.errP.SetError(this.dateDateTimePicker, "La fecha no puede ser posterior al momento actual");
result = false;
}
if (v.DriverId == Guid.Empty)
{
this.errP.SetError(this.lblDriverIdentifier, "Campo obligatorio");
this.errP.SetError(this.lblDriverFullName, "Campo obligatorio");
result = false;
}
if (v.VehicleId == Guid.Empty)
{
this.errP.SetError(this.txtLicenseFilter, "Campo obligatorio");
result = false;
}
if (v.InfractionTypeId == Guid.Empty)
{
this.errP.SetError(this.infractionTypeIdComboBox, "Campo obligatorio");
result = false;
}
// Check habitual driver
return result;
}
private void label2_Click(object sender, EventArgs e)
{
}
private void infractionTypeDTOBindingSource_CurrentChanged(object sender, EventArgs e)
{
var current = this.infractionTypeDTOBindingSource.Current as InfractionTypeDTO;
if (current.Id == Guid.Empty)
this.panePoints.Visible = false;
else
this.panePoints.Visible = true;
}
private void vehicleDriverDTOBindingSource_CurrentChanged(object sender, EventArgs e)
{
var vehicleDriver= this.vehicleDriverDTOBindingSource.Current as VehicleDriverDTO;
var infraction = this.infractionDTOBindingSource.Current as InfractionDTO;
if (vehicleDriver != null & infraction != null)
{
infraction.DriverId = vehicleDriver.DriverId;
infraction.DriverFullName = vehicleDriver.DriverFullName;
infraction.DriverIdentifier = vehicleDriver.DriverIdentifier;
this.lblDriverIdentifier.Text = vehicleDriver.DriverIdentifier;
this.lblDriverFullName.Text = vehicleDriver.DriverFullName;
}
}
private void label6_Click(object sender, EventArgs e)
{
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleDriverAgg/IVehicleDriverRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg
{
public interface IVehicleDriverRepository : IRepository<VehicleDriver>
{
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/ApiManagerInfractionTypes.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.InfractionTypes;
using Newtonsoft.Json;
using System.Net.Http;
namespace Presentation.Windows.Seedwork.Api
{
public class ApiManagerInfractionTypes: ApiManagerBase
{
const string URL_KEY = "infractiontypes";
public static async Task<List<InfractionTypeDTO>> GetAllInfractionTypes()
{
using (var client = GetHttpClient())
{
using (var response = await client.GetAsync(URL_KEY))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new List<InfractionTypeDTO>();
else
{
var items = JsonConvert.DeserializeObject<InfractionTypeDTO[]>(result).ToList();
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
public static async Task<InfractionTypeDTO> AddNew(InfractionTypeDTO infractionType)
{
using (var client = GetHttpClient())
{
var serializeObject = JsonConvert.SerializeObject(infractionType);
var content = new StringContent(serializeObject, Encoding.UTF8, "application/json");
using (var response = await client.PostAsync(URL_KEY, content))
{
if (response.IsSuccessStatusCode)
{
if (response.Content != null)
{
var stringResult = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<InfractionTypeDTO>(stringResult);
return result;
}
else
return null;
}
else
{
//Logger.Error("Error creando {0} '{1}'.", syncEntity.Singular(), obj.Name);
throw new Exception(await CastResultError(response));
}
}
}
}
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/VehicleAgg/IVehicleRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.VehicleAgg
{
public interface IVehicleRepository: IRepository<Vehicle>
{
/// <summary>
/// Returns total vehicles
/// </summary>
int Count();
}
}
<file_sep>/Domain.MainBoundedContext/DgtModule/Aggregates/DriverAg/IDriverRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Seedwork;
namespace Domain.MainBoundedContext.DgtModule.Aggregates.DriverAg
{
public interface IDriverRepository: IRepository<Driver>
{
/// <summary>
/// Get total drivers
/// </summary>
int Count();
}
}
<file_sep>/Presentation.Windows.Seedwork/Api/ApiManagerTotals.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.MainBoundedContext.DTO.DgtModule.Brands;
using Application.MainBoundedContext.DTO.DgtModule.Infractions;
using Newtonsoft.Json;
namespace Presentation.Windows.Seedwork.Api
{
public class ApiManagerTotals: ApiManagerBase
{
public static async Task<ItemsCountsDTO> GetItemTotals()
{
using (var client = GetHttpClient())
{
const string urlKey = "totals";
using (var response = await client.GetAsync(urlKey))
{
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
if (result == null || result == "null")
return new ItemsCountsDTO();
else
{
var items = JsonConvert.DeserializeObject<ItemsCountsDTO>(result);
return items;
}
}
else
throw new Exception(GetHttpError(response));
}
}
}
}
}
<file_sep>/Infrastructure.Data.MainBoundedContext/UnitOfWork/Mapping/VehicleDriverEntityConfiguration.cs
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.MainBoundedContext.DgtModule.Aggregates.VehicleDriverAgg;
namespace Infrastructure.Data.MainBoundedContext.UnitOfWork.Mapping
{
class VehicleDriverEntityConfiguration
:EntityTypeConfiguration<VehicleDriver>
{
public VehicleDriverEntityConfiguration()
{
//Configure keys and properties
this.HasKey(c => c.Id);
this.Property(c => c.VehicleId)
.IsRequired();
this.Property(c => c.DriverId)
.IsRequired();
//Configure table associations
this.HasRequired(c => c.Vehicle)
.WithMany()
.HasForeignKey(c => c.VehicleId)
.WillCascadeOnDelete(false);
this.HasRequired(c => c.Driver)
.WithMany()
.HasForeignKey(c => c.DriverId)
.WillCascadeOnDelete(false);
//Configure table mappings
this.ToTable("VehiclesDrivers");
}
}
}
| 30c9276f1bd452a7a196f4294740e4503d9af6fc | [
"Markdown",
"C#"
] | 90 | C# | okfiera/dgt | 773e981b87ae3dc4d374abec5f77f0ebed0e6180 | e0e386a98f856af2142aa8c5a3bd38691672b8a2 |
refs/heads/master | <repo_name>lugerf/AdventOfCode2019<file_sep>/Day1/Day2.py
# Init
input = []
result = 0
# Read in quest data:
with open("input_day2.txt") as f:
for line in f:
input.append(line.split(","))
class intcode:
def __init__(self, *args, **kwargs):
self.codes = {1: "ADD", 2: "MULTIPLY", 99: "STOP"}
self.data = input
intcode_machine = intcode(input)
print(intcode_machine.data)
<file_sep>/Day2/AdventOfcodeDay2/AdventOfcodeDay2/Program.cs
using System;
using System.IO;
using System.Collections.Generic;
namespace AdventOfcodeDay2
{
class Program
{
static void Main(string[] args)
{
#region Declarations
// Constants
string PATHINPUTDATA = @"C:\Users\lugerf\Source\Repos\AdventOfCode\Day2\AdventOfcodeDay2\AdventOfcodeDay2\data\input.txt";
int OPERATIONRANGE = 4;
int TARGETRESULT = 19690720;
// Properties
// Variables
#endregion
#region Init
Data InputData = new Data(PATHINPUTDATA);
IntcodeComputer computer = new IntcodeComputer(InputData.GetDataAsList(), OPERATIONRANGE);
// Day 2 part 1: Set to 1202 error state
computer.Code.Code[1] = 12;
computer.Code.Code[2] = 2;
#endregion
#region Main
// Day 2 part 1
computer.RunComputation();
// Day 2 part 2
Simulator sim = new Simulator(TARGETRESULT, InputData, OPERATIONRANGE);
sim.RunSimulation();
using (TextWriter tw = new StreamWriter("SimulationResult.txt"))
{
foreach (string result in sim.SimulationResults)
{
tw.WriteLine(result);
}
}
Console.WriteLine(string.Format("Result of day 2 part 1 is equal to: {0}", computer.Code.Code[0]));
Console.WriteLine(string.Format("Result of day 2 part 2 is equal to: {0}, given noun = {1}, verb = {2}", (100 * sim.resultNoun + sim.resultVerb), sim.resultNoun, sim.resultVerb));
#endregion
}
}
}
<file_sep>/Day2/AdventOfcodeDay2/AdventOfcodeDay2/Simulator.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace AdventOfcodeDay2
{
class Simulator
{
#region Declarations
// Constants
// Properties
public Data InitialCode { get; private set; }
public int OperationRange { get; private set; }
public IntcodeComputer Computer {get; private set;}
public int TargetResult { get; set; }
public int resultVerb { get; set; }
public int resultNoun { get; set; }
public List<string> SimulationResults { get; set; }
// Variables
int verbCounter;
int nounCounter;
#endregion
#region Init
public Simulator(int targetResult, Data input, int operationRange)
{
InitialCode = input;
TargetResult = targetResult;
OperationRange = operationRange;
SimulationResults = new List<string>();
Computer = new IntcodeComputer(InitialCode.GetDataAsList(), OperationRange);
}
#endregion
#region Main
public void RunSimulation()
{
for (nounCounter = 0; nounCounter < 100; nounCounter++)
{
for (verbCounter = 0; verbCounter < 100; verbCounter++)
{
Computer.Code.Code[1] = nounCounter;
Computer.Code.Code[2] = verbCounter;
// Compute and log
Computer.RunComputation();
SimulationResults.Add(string.Format("{0}, verb={1}, noun={2}", Computer.Code.Code[0].ToString(), nounCounter, verbCounter)); //Test
// Compare with result
if (Computer.Code.Code[0] == TargetResult)
{
resultNoun = nounCounter;
resultVerb = verbCounter;
break;
}
else
{
Computer.ResetInput(InitialCode.GetDataAsList());
}
}
if (Computer.Code.Code[0] == TargetResult)
{
break;
}
}
}
#endregion
}
}
<file_sep>/Day3/Day3/Day3/Wire.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
namespace Day3
{
public class Wire
{
// Constants
public static readonly int[] StartCoordinate = { 0, 0, 0 };
// Class Properties
public int[] CurrentCoordinate { get; private set; } // X, Y, Steps
public List<int[]> WireCoordinates { get; private set; }
#region Init
public Wire()
{
// X, Y, Steps
CurrentCoordinate = new int[] { 0, 0, 0 };
WireCoordinates = new List<int[]>();
}
#endregion
#region Processing
/// <summary>
/// Calculates a range of coordinates based on the input commands
/// </summary>
/// <param name="input"></param>
public void CalculateWireCoordinates(string input)
{
// Parse
Tuple<string, int> commandSet = ParseCommandInput(input);
// Process
switch (commandSet.Item1)
{
case "R":
for (int i = 0; i < commandSet.Item2; i++)
{
IncreaseXCoordinate();
WireCoordinates.Add(CurrentCoordinate.ToArray());
}
break;
case "L":
for (int i = 0; i < commandSet.Item2; i++)
{
DecreaseXCoordinate();
WireCoordinates.Add(CurrentCoordinate.ToArray());
}
break;
case "U":
for (int i = 0; i < commandSet.Item2; i++)
{
IncreaseYCoordinate();
WireCoordinates.Add(CurrentCoordinate.ToArray());
}
break;
case "D":
for (int i = 0; i < commandSet.Item2; i++)
{
DecreaseYCoordinate();
WireCoordinates.Add(CurrentCoordinate.ToArray());
}
break;
default:
// Should never happen
break;
}
}
#endregion
#region Helping Methods
private Tuple<string, int> ParseCommandInput(string input)
{
// init
string command = "";
int length = 0;
string pattern = @"^(?'command'[RLUD])(?'length'\d{1,4})";
Regex regex = new Regex(pattern);
// parsing
GroupCollection groups = regex.Match(input).Groups;
command = groups["command"].Value;
int i = 0;
if (Int32.TryParse(groups["length"].Value, out i))
{
length = i;
}
return new Tuple<string, int>(command, length);
}
/// <summary>
/// Increase X coordinate + 1
/// </summary>
public void IncreaseXCoordinate()
{
// X coordinate
CurrentCoordinate[0] = CurrentCoordinate[0] + 1;
// Steps
CurrentCoordinate[2] = CurrentCoordinate[2] + 1;
}
/// <summary>
/// Decrease X coordinate - 1
/// </summary>
public void DecreaseXCoordinate()
{
// X-Coordinate
CurrentCoordinate[0] = CurrentCoordinate[0] - 1;
// Steps
CurrentCoordinate[2] = CurrentCoordinate[2] + 1;
}
/// <summary>
/// Increase Y coordinate + 1
/// </summary>
public void IncreaseYCoordinate()
{
// Y Coordinate
CurrentCoordinate[1] = CurrentCoordinate[1] + 1;
// Steps
CurrentCoordinate[2] = CurrentCoordinate[2] + 1;
}
/// <summary>
/// Decrease Y coordinate - 1
/// </summary>
public void DecreaseYCoordinate()
{
// Y Coordinate
CurrentCoordinate[1] = CurrentCoordinate[1] - 1;
// Steps
CurrentCoordinate[2] = CurrentCoordinate[2] + 1;
}
#endregion
}
}
<file_sep>/Day1/Day1.py
import math
input = []
alternative_input = [100756]
with open("input_day1.txt") as f:
for line in f:
input.append(int(line))
def calc_fuel(input_list):
result = 0
for mass in input_list:
result = result + ((math.floor(mass / 3)) - 2)
return result
def calc_fuel_detailes(input_list):
return [((math.floor(mass / 3)) - 2) for mass in input_list]
def calc_fuel_for_fuel(input):
result = 0
last_calculated_fuel = input
while last_calculated_fuel >= 0:
fuel_to_add = math.floor(last_calculated_fuel / 3) - 2
if fuel_to_add > 0:
result = result + fuel_to_add
last_calculated_fuel = fuel_to_add
return result
result_stepOne_detailed = calc_fuel_detailes(input)
result_additional_fuel_per_module = [
calc_fuel_for_fuel(x) for x in result_stepOne_detailed
]
final_result = sum(result_stepOne_detailed) + sum(result_additional_fuel_per_module)
print(f"Result: {final_result}")
<file_sep>/Day4/Day4/Day4/Program.cs
using System;
using System.Collections.Generic;
namespace Day4
{
class Program
{
/// <summary>
/// Task:
/// For range: 372304 - 847060
/// Get the number of passwords which:
/// - two adjacent numbers are the same
/// - from left to right digits never decrease
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
// Task 1:
// Init
List<int> taskOneResult = new List<int>();
// Processing
for (int i = 372304; i < 847060; i++)
{
if (StaticHelper.AdjacentNumbersInCode(i.ToString()) && StaticHelper.AllDigitsDoIncrease(i.ToString()))
{
taskOneResult.Add(i);
}
}
Console.WriteLine($"The number of matching codes are: {taskOneResult.Count}");
}
}
}
<file_sep>/Day3/Day3/Day3/Program.cs
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace Day3
{
class Program
{
static void Main(string[] args)
{
var inputPath = @"C:\Users\lugerf\Source\Repos\AdventOfCode\Day3\Day3\Day3\Input.txt";
// Read in input data;
string[] input = File.ReadAllLines(inputPath);
// Split to wire input
string[] inputWireOne = input[0].Split(',');
string[] inputWireTwo = input[1].Split(',');
// Construct wires
Wire wireOne = new Wire();
Wire wireTwo = new Wire();
foreach (string commandSet in inputWireOne)
{
wireOne.CalculateWireCoordinates(commandSet);
}
foreach (string commandSet in inputWireTwo)
{
wireTwo.CalculateWireCoordinates(commandSet);
}
// Get subset of all matching coordinates of wireOne and wireTwo
List<int[]> matchingCoordinatesTaskOne = new List<int[]>();
List<List<int[]>> matchingCoordinatesTaskTwo = new List<List<int[]>>();
List<int[]> coordinatesWireOne = new List<int[]>();
List<int[]> coordinatesWireTwo = new List<int[]>();
matchingCoordinatesTaskTwo.Add(coordinatesWireOne);
matchingCoordinatesTaskTwo.Add(coordinatesWireTwo);
foreach (int[] wireOneCoordinate in wireOne.WireCoordinates)
{
foreach (int[] wireTwoCoordinate in wireTwo.WireCoordinates)
{
//Console.WriteLine($"{wireOneCoordinate[0]}{wireOneCoordinate[1]}, {wireTwoCoordinate[0]}{wireTwoCoordinate[1]}");
if ((wireOneCoordinate[0] == wireTwoCoordinate[0]) && (wireOneCoordinate[1] == wireTwoCoordinate[1]))
{
// Task 1
matchingCoordinatesTaskOne.Add(wireOneCoordinate);
// Task 2
matchingCoordinatesTaskTwo[0].Add(wireOneCoordinate);
matchingCoordinatesTaskTwo[1].Add(wireTwoCoordinate);
}
}
}
// Calculate task one: Manhattan distance for each potential result
List<int> resultCoordinates = new List<int>();
foreach (int[] matchedCoordinate in matchingCoordinatesTaskOne)
{
int result = Math.Abs(matchedCoordinate[0]) + Math.Abs(matchedCoordinate[1]);
resultCoordinates.Add(result);
Console.WriteLine($"{matchedCoordinate[0]} + {matchedCoordinate[1]} = {result}");
}
resultCoordinates.Sort();
Console.WriteLine($"Final Result Task One: {resultCoordinates[0]}");
// Calculate task two: Shortest distance by steps.
foreach (List<int[]> wire in matchingCoordinatesTaskTwo)
{
foreach (int[] coordinate in wire)
{
Console.WriteLine($"Wire {wire.ToString()}: X={coordinate[0]}, Y={coordinate[1]} in Steps={coordinate[2]}");
}
}
}
}
}
<file_sep>/Day2/AdventOfcodeDay2/AdventOfcodeDay2/IntCode.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace AdventOfcodeDay2
{
/// <summary>
/// Data class for IntCode computer. Everything related to the IntCode including data operations
/// </summary>
public class IntCode
{
#region Definition
// Constants
int[] OPERATIONCODES = new int[] { 1, 2, 99 };
// Properties
public List<int> Code { get; private set; }
public int RangeOfOperationSet { get; private set; }
// Variables
private int indexCurrentPosition;
public int currentOperationCode;
#endregion
#region Init
public IntCode(List<int> data, int rangeOfOperationSet)
{
Code = data;
RangeOfOperationSet = rangeOfOperationSet;
indexCurrentPosition = 0;
SetOperationCode();
}
#endregion
#region Helper
/// <summary>
/// SetOperationCode sets the operation code equal to the current position at data
/// </summary>
public void SetOperationCode()
{
int operationCode = Code[indexCurrentPosition];
if (OPERATIONCODES.Contains(operationCode))
{
currentOperationCode = operationCode;
}
else
{
throw new Exception(String.Format("OperationCode is not known to the IncCode computer:", operationCode));
}
}
/// <summary>
/// MoveToNextExecutionSet sets current Position dependent on the current position + defined range of operation.
/// </summary>
public void MoveToNextExecutionSet()
{
indexCurrentPosition = indexCurrentPosition + RangeOfOperationSet;
currentOperationCode = Code[indexCurrentPosition];
}
/// <summary>
/// Add() performs an addition operation of the IntCode computer
/// </summary>
public void Add()
{
int valueFirstOperand = Code[Code[indexCurrentPosition + 1]];
int valueSecondOperand = Code[Code[indexCurrentPosition + 2]];
int indexOutput = Code[indexCurrentPosition + 3];
Code[indexOutput] = valueFirstOperand + valueSecondOperand;
}
/// <summary>
/// Multiply() performs a multiplication operation of the Intcode computer
/// </summary>
public void Multiply()
{
int valueFirstOperand = Code[Code[indexCurrentPosition + 1]];
int valueSecondOperand = Code[Code[indexCurrentPosition + 2]];
int indexOutput = Code[indexCurrentPosition + 3];
Code[indexOutput] = valueFirstOperand * valueSecondOperand;
}
#endregion
}
}
<file_sep>/Day2/AdventOfcodeDay2/AdventOfcodeDay2/IntcodeComputer.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace AdventOfcodeDay2
{
public class IntcodeComputer
{
#region Declarations
// Constants
// Properties
public IntCode Code { get; set; }
public int OperationRange {get; set;}
// Variables
#endregion
#region Init
public IntcodeComputer(List<int> input, int operationRange)
{
OperationRange = operationRange;
Code = new IntCode(input, operationRange);
}
#endregion
#region Main
public void RunComputation()
{
while (Code.currentOperationCode != 99)
{
switch (Code.currentOperationCode)
{
case 1:
Code.Add();
break;
case 2:
Code.Multiply();
break;
default:
break;
}
Code.MoveToNextExecutionSet();
}
}
#endregion
#region Helper
public void ResetInput(List<int> data)
{
Code = new IntCode(data, OperationRange);
}
#endregion
}
}
<file_sep>/Day4/Day4/Day4/StaticHelper.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Day4
{
static class StaticHelper
{
#region Helpers
/// <summary>
/// Checks if an input code has digits which are the same and are next to each other. Returns a boolean value.
/// </summary>
/// <param name="codeToCheck"></param>
/// <returns></returns>
public static bool AdjacentNumbersInCode(string codeToCheck)
{
bool result = false;
char lastDigit = new char();
for (int i = 0; i < codeToCheck.Length; i++)
{
if (codeToCheck[i] == lastDigit)
{
result = true;
}
lastDigit = codeToCheck[i];
}
return result;
}
/// <summary>
/// Checks if an input code has only increasing digits from left to right. Returns a boolean value.
/// </summary>
/// <param name="codeToCheck"></param>
/// <returns></returns>
public static bool AllDigitsDoIncrease(string codeToCheck)
{
bool result = true;
char lastDigit = new char();
for (int i = 0; i < codeToCheck.Length; i++)
{
if (codeToCheck[i] >= lastDigit)
{
// result still true
}
else
{
// criteria not met
result = false;
}
lastDigit = codeToCheck[i];
}
return result;
}
#endregion
}
}
<file_sep>/Day2/AdventOfcodeDay2/AdventOfcodeDay2/Data.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace AdventOfcodeDay2
{
class Data
{
#region Definitions
// Constants
// Properties
string Path { get; set; }
string RawTextContent { get; set; }
public List<Object> Results { get; set; }
// Class Variables
#endregion
/// <summary>
/// Data reads data from OS harddrive and manipulates it's content.
/// Helping methods to return the data in necessary ways.
/// </summary>
/// <param name="path"></param>
public Data(string path)
{
// Init
Results = new List<object>();
SetInputPath(path);
ReadDataFromTextFile();
}
/// <summary>
/// SetInputPath reads in path parameter, checks it for validity and sets class property if successful
/// </summary>
/// <param name="path"></param>
private void SetInputPath(string path)
{
if (File.Exists(path))
{
Path = path;
}
else
{
throw new FileNotFoundException("File on specified input path does not exist");
}
}
/// <summary>
/// ReadDataFromTextFile reads data from a local text file into the class property File
/// </summary>
private void ReadDataFromTextFile()
{
if (File.Exists(Path))
{
RawTextContent = File.ReadAllText(Path);
if (string.IsNullOrEmpty(RawTextContent))
{
throw new Exception("File does not contain any data");
}
}
}
/// <summary>
/// GetDataAsList returns the file content as a list of strings
/// </summary>
/// <returns></returns>
public List<int> GetDataAsList()
{
List<int> result = new List<int>();
string[] splitContent = RawTextContent.Split(',');
foreach (string item in splitContent)
{
result.Add(int.Parse(item));
}
Results.Add(result);
return result;
}
}
}
| 88034b46147c201a7d2f34e02cc978732d21cba8 | [
"C#",
"Python"
] | 11 | Python | lugerf/AdventOfCode2019 | 6d6afcf6ae446648cb86e740ed816a4a381c9ee6 | a9560d914404e2eac2abf1250983bd11abb9d875 |
refs/heads/master | <repo_name>shapshuk/OSiSP2<file_sep>/menu.cpp
#include <iostream>
#include "menu.h"
int getVariant(int count) {
int variant;
char s[100];
scanf("%s", s);
while (sscanf(s, "%d", &variant) != 1 || variant < 1 || variant > count) {
printf("Incorrect input. Try again: "); // выводим сообщение об ошибке
scanf("%s", s); // считываем строку повторно
}
return variant;
}
void printMenu() {
system("cls"); // очищаем экран
printf("What do you want to do?\n");
printf("1. Start\n");
printf("2. Settings\n");
printf("3. Exit\n");
printf(">");
}
void settings(int &nMapSize, int &seed) {
int variant = 0;
do {
system("cls");
printf("1. Map size = %i \n", nMapSize);
printf("2. Map seed = %i \n", seed);
//printf("3. Player's speed = %f \n", fSpeed);
printf("3. Close\n");
printf(">");
variant = getVariant(3);
switch (variant) {
case 1:
int mapSize;
printf("\n\n\nEnter new value for map size (odd only) - ");
scanf("%i", &mapSize);
nMapSize = mapSize;
//nMapWidth = mapSize;
break;
case 2:
int mapSeed;
printf("\n\n\nEnter new value for map seed - ");
scanf("%i", &mapSeed);
seed = mapSeed;
break;
/*case 3:
int playersSpeed;
printf("\n\n\nEnter new value for player's speed - ");
scanf("%f", &playersSpeed);
fSpeed = playersSpeed;
break;*/
}
if (variant != 3)
system("pause");
} while (variant != 3);
}<file_sep>/main.cpp
#include <Windows.h>
#include "game.h"
#include "menu.h"
int nMapSize = 17;
int seed = 1;
int main()
{
int variant;
do {
printMenu();
variant = getVariant(3);
switch (variant) {
case 1:
startGame(nMapSize, seed);
break;
case 2:
settings(nMapSize, seed);
break;
}
if (variant != 3)
system("pause");
} while (variant != 3);
return 0;
}<file_sep>/game.h
#pragma once
#include <string>
using namespace std;
string getMap(int& nMapSize, int seed);
void startGame(int mapSize, int seed);
<file_sep>/CMakeLists.txt
cmake_minimum_required(VERSION 3.17)
project(Kursovaya)
set(CMAKE_CXX_STANDARD 14)
add_executable(Kursovaya main.cpp "menu.h" "game.h" "game.cpp" "menu.cpp")<file_sep>/menu.h
#pragma once
int getVariant(int count);
void printMenu();
void settings(int &nMapSize, int &seed); | fbafc545bd598c6fa7d1c894bf6913c0d3ec4f74 | [
"C",
"CMake",
"C++"
] | 5 | C++ | shapshuk/OSiSP2 | cfc17e1b89fd45bfa1f6207dffe6811c4ce6c001 | 0173124afa2519ec20915089431050c46a13e973 |
refs/heads/master | <file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,ChannelInfoSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,ChannelInfoSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,ChannelInfoSchema.xsd
channelInfo,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.channelinfoprecheckser;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-10-26T15:38:21.218+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "ChannelInfoPreCheckSer",
portName = "ChannelInfoPreCheckSerSOAP",
targetNamespace = "http://ws.chinaunicom.cn/ChannelInfoPreCheckSer/",
endpointInterface = "cn.chinaunicom.ws.channelinfoprecheckser.ChannelInfoPreCheckSer")
public class ChannelInfoPreCheckSerImpl implements ChannelInfoPreCheckSer {
private static final Logger LOG = Logger.getLogger(ChannelInfoPreCheckSerImpl.class.getName());
/* (non-Javadoc)
* @see cn.chinaunicom.ws.channelinfoprecheckser.ChannelInfoPreCheckSer#channelInfoPreCheck(cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.CHANNEL_INFO_PRECHECK_INPUT parameters )*
*/
public cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.CHANNEL_INFO_PRECHECK_OUTPUT channelInfoPreCheck(cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.CHANNEL_INFO_PRECHECK_INPUT parameters) {
LOG.info("Executing operation channelInfoPreCheck");
System.out.println(parameters);
try {
cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.CHANNEL_INFO_PRECHECK_OUTPUT _return = null;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.client.inquiryauditinfo;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IInquiryEASAuditSV;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.IPublishIfBase;
import com.ai.uip.platform.vo.PublishIfCfgVo;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvRequest;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvResponse;
import com.unicom.mss.soa.msgheader.MsgHeader;
/**
* 查询报账审批记录信息服务(分页)
* @author wud
*
*/
public class InquiryEASAuditPublishImpl implements IPublishIfBase {
private static final Log logger = LogFactory.getLog(InquiryEASAuditPublishImpl.class);
@Override
public HashMap<String, Object> pubIfParamGen(List<String> contentIdLst, PublishIfCfgVo ifVo, Long logId, String syncType,
HashMap<String, Long> batchMap) {
//请求的信息
SB_EAS_EAS_InquiryEASAuditInfoSrvRequest req = new SB_EAS_EAS_InquiryEASAuditInfoSrvRequest();
//返回给框架的请求map值
HashMap<String, Object> map = new HashMap<String, Object>();
map.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
map.put(Constants.MapResult.MAP_RESULTMSG, "成功");
/*输入的消息头:MsgHeader */
MsgHeader msgHeader = new MsgHeader();
String province_code = "";
//contentIdLst中的值 = PAY_BATCH_ID/PROVINCE_CODE/START_LAST_UPDATE_DATE/END_LAST_UPDATE_DATE
// 或:_19_20100907123627_20110907124455
for(int i = 0;i < contentIdLst.size(); i++) {
try {
//当前页的数目,batch_no字段存的就是当前页的值,是用 contentIdLst.get(i)作为key的
//当前页得从uip_SYNC_RECORD表中查到
msgHeader.setCURRENT_PAGE(BigDecimal.valueOf( batchMap.get( contentIdLst.get(i) ) ));
//依次得到四个值为:aaa123(y/n) 19 20100907123627 20110907124455
String[] contents = contentIdLst.get(i). split("_" , 4);
/*设置查询条件*/
if( !(contents[0] == null || contents[0].trim().equals("")) ) {
//第一个参数不为空的情况就传bill_no
req.setBILL_NO( contents[0] );
} else {
/*否则就传两个查询的时间*/
req.setSTART_LAST_UPDATE_DATE( CastUtil.str2Date( contents[2] )); //最后更新开始时间
req.setEND_LAST_UPDATE_DATE( CastUtil.str2Date( contents[3] )); //设置最后更新结束时间
}
province_code = contents[1];
//设置省份编码
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
String proviceCode2 = BucUtil.getCfgCodeDesc( Constants.CFG_CODE_TRANS_SOA_AREA,province_code);
req.setPROVINCE_CODE( proviceCode2 );
req.setAUDIT_STATUS( BigDecimal.valueOf( 3 ) ); //规定统一设置为3
req.setSOURCE_NAME( Constants.USER_ID ); //UC
}catch (Exception e) {
map.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "参数组成异常");
map.put(Constants.MapResult.MAP_RESULTCODE, Constants.SERVICE_FLAG_FALSE);
e.printStackTrace();
}
}
msgHeader.setENVIRONMENT_NAME( Constants.DATASOURCE_CENTER );
msgHeader.setPAGE_SIZE( BigDecimal.valueOf( Constants.PROCESS_MAX_PAGE_SIZE )); //给定的值 暂时为1000
msgHeader.setPROVINCE_CODE( "" );
msgHeader.setSOURCE_SYSTEM_ID( Constants.SOURCE_SYSTEM_ID );
msgHeader.setSOURCE_SYSTEM_NAME( Constants.SOURCE_SYSTEM_NAME );
msgHeader.setSUBMIT_DATE(CastUtil.getCurrentTimestamp());
msgHeader.setTOTAL_RECORD(BigDecimal.valueOf( Constants.PAGE_TOTAL_RECORD )); //给定的值 -1
msgHeader.setUSER_ID( Constants.USER_ID );
msgHeader.setUSER_NAME( Constants.USER_NAME );
/*设置消息头*/
req.setMsgHeader( msgHeader );
/** 放入map中*/
map.put(Constants.MapResult.MAP_RESULTOBJ, req);
return map;
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg, PublishIfCfgVo ifVo, Long logId ,
List<String> contentIdLst , HashMap<String,Long> batchMap) {
SB_EAS_EAS_InquiryEASAuditInfoSrvResponse resp = (SB_EAS_EAS_InquiryEASAuditInfoSrvResponse)ifMsg;
HashMap<String,Object> resultMap = new HashMap<String,Object>();
if(resp != null){
//输出的集合,直接从resp得到
List<SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem> outPutList = resp.getSB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection()
.getSB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
if( outPutList == null || outPutList.size() == 0){
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "查询结果outPutList为空!!!");
// 输出的列表不为空的时候,并且当SERVICE_FLAG=TRUE
}else if( resp.getSERVICE_FLAG().equals( Constants.SERVICE_FLAG_TRUE) ) {
/**------------------------第一步:判断是否处理分页-------------------------------*/
//判断是否是最后页 ? 如果是,不再做处理 : 如果不是,在record表中插入一条数据 【其它的不变,只是batch_no比上一次加 1 】
BigDecimal totalPage = resp.getTOTAL_PAGE();
BigDecimal currentPage = resp.getCURRENT_PAGE();
//若至少有一个为空
if(totalPage == null || currentPage == null ){
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "totalPage, currentPage 中有为空,出现异常");
//是最后一页,不用再处理了
} else if( currentPage.intValue() == totalPage.intValue() ){
//不是最后一页(插表)
} else if ( currentPage.intValue() < totalPage.intValue() ){
/**在record表中插入一条记录,用以再发送一次请求*/
try {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
String procinceCode = BucUtil.getCfgCodeValue(Constants.CFG_CODE_TRANS_SOA_AREA,outPutList.get(0).getPROVINCE_CODE());
// CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,procinceCode );
getService().insertUipSyncRecord( outPutList.get(0), resp , contentIdLst , batchMap,procinceCode);
} catch (Exception e) {
e.printStackTrace();
}
logger.debug("-------------插record表成功:totalPage = " + totalPage + ",插入batch_no = " + (currentPage.doubleValue()+1) );
} else {
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "currentPage>totalPage,出现异常");
}
/**------------------------第二步:更新和插入-------------------------------*/
/**1. 更新:支付记录表TF_CHL_PAY_APPLY -> 时间和状态*/
/**2. 插入相应数据到:支付状态变更记录TF_CHL_PAY_APPLY_STATE -> 数据由支付记录表查得和outPutList获得*/
try {
String procinceCode = BucUtil.getCfgCodeValue(Constants.CFG_CODE_TRANS_SOA_AREA,outPutList.get(0).getPROVINCE_CODE());
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,procinceCode );
getService().updateApply( outPutList ,procinceCode);
} catch (Exception e) {
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "更新或插入数据时出错wud,TF_CHL_PAY_APPLY,TF_CHL_PAY_APPLY_STATE ");
e.printStackTrace();
}
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "---------------------处理成功!!!--------------");
}else {
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "对方返回对象resp的SERVICE_FLAG为FALSE!!");
}
}else {
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "对方返回对象SB_EAS_EAS_InquiryEASAuditInfoSrvResponse为空");
}
return resultMap;
}
/**
* 调用服务层,用以操作数据库
* @return
*/
private IInquiryEASAuditSV getService() {
return (IInquiryEASAuditSV) ServiceFactory.getService(IInquiryEASAuditSV.class);
}
@Override
public HashMap<String, Object> pubIfServiceAdapter(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
return null;
}
@Override
public HashMap<String, Object> pubIfServiceContinue(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
return null;
}
public static void main(String args[]){
InquiryEASAuditPublishImpl inquiry = new InquiryEASAuditPublishImpl();
List<String> b = new ArrayList<String>();
String PAY_BATCH_ID = "122";
b.add( PAY_BATCH_ID );
System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
HashMap<String,Long> myMap = new HashMap<String,Long>();
myMap.put(PAY_BATCH_ID, Long.valueOf(1)); // 380 1
inquiry.pubIfParamGen(b, null, Long.valueOf(0), "2", myMap);
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++-----------");
}
@Override
public boolean pubIfRetErrorMax(String contentId) {
// TODO Auto-generated method stub
return false;
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.channelinfoser;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-10-26T15:38:17.640+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "ChannelInfoSer",
portName = "ChannelInfoSerSOAP",
targetNamespace = "http://ws.chinaunicom.cn/ChannelInfoSer/",
endpointInterface = "cn.chinaunicom.ws.channelinfoser.ChannelInfoSer")
public class ChannelInfoSerImpl implements ChannelInfoSer {
private static final Logger LOG = Logger.getLogger(ChannelInfoSerImpl.class.getName());
/* (non-Javadoc)
* @see cn.chinaunicom.ws.channelinfoser.ChannelInfoSer#channelInfo(cn.chinaunicom.ws.channelinfoser.unibssbody.CHANNEL_INFO_INPUT parameters )*
*/
public cn.chinaunicom.ws.channelinfoser.unibssbody.CHANNEL_INFO_OUTPUT channelInfo(cn.chinaunicom.ws.channelinfoser.unibssbody.CHANNEL_INFO_INPUT parameters) {
LOG.info("Executing operation channelInfo");
System.out.println(parameters);
try {
cn.chinaunicom.ws.channelinfoser.unibssbody.CHANNEL_INFO_OUTPUT _return = null;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>
package cn.chinaunicom.ws.precheckresultser;
/**
* Please modify this class to meet your needs
* This class is not complete
*/
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-04-10T13:57:26.895+08:00
* Generated source version: 2.3.5
*
*/
public final class PrecheckResultSer_PrecheckResultSerSOAP_Client {
private static final QName SERVICE_NAME = new QName("http://ws.chinaunicom.cn/PrecheckResultSer/", "PrecheckResultSer");
private PrecheckResultSer_PrecheckResultSerSOAP_Client() {
}
public static void main(String args[]) throws java.lang.Exception {
URL wsdlURL = PrecheckResultSer_Service.WSDL_LOCATION;
if (args.length > 0) {
File wsdlFile = new File(args[0]);
try {
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
PrecheckResultSer_Service ss = new PrecheckResultSer_Service(wsdlURL, SERVICE_NAME);
PrecheckResultSer port = ss.getPrecheckResultSerSOAP();
{
System.out.println("Invoking precheckResult...");
cn.chinaunicom.ws.precheckresultser.unibssbody.PRECHECK_RESULT_INPUT _precheckResult_parameters = null;
cn.chinaunicom.ws.precheckresultser.unibssbody.PRECHECK_RESULT_OUTPUT _precheckResult__return = port.precheckResult(_precheckResult_parameters);
System.out.println("precheckResult.result=" + _precheckResult__return);
}
System.exit(0);
}
}
<file_sep>package com.ai.uchintService.server.importCnapsCodeInfo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IImportCnapsCodeInfoSV;
import com.ai.uchintService.busi.service.interfaces.IImportContractInfoSV;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.Constants;
//import com.ai.uint.daemonTimer.impl.BsdmUchlAsynEjbTimerSVImpl;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
import com.ailk.uchannel.cnapsmdmupdate.param.CNAPSMDMRequestVo;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.ErrorOutputCollection;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.ErrorOutputItem;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.ResponseOutputCollection;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.ResponseOutputItem;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvInputItem;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvRequest;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvResponse;
import com.unicom.mss.soa.msgheader.MsgHeader;
public class ImportCnapsCodeInfoAction implements IRecIfBase {
private static final String EJB_SV_DEF_CNAPS_CODE_SYNC = "CnapsCodeInfo";
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
SB_UC_UC_ImportCnapsCodeInfoSrvResponse repObj = new SB_UC_UC_ImportCnapsCodeInfoSrvResponse();
ErrorOutputCollection errorCol = new ErrorOutputCollection();
List<ErrorOutputItem> errorList = new ArrayList<ErrorOutputItem>();
ResponseOutputCollection respCol = new ResponseOutputCollection();
List<ResponseOutputItem> respList = new ArrayList<ResponseOutputItem>();
ErrorOutputItem errorItem = null;
ResponseOutputItem responseItem = null;
List<SB_UC_UC_ImportCnapsCodeInfoSrvInputItem> CnapsCodeInfoList = ((SB_UC_UC_ImportCnapsCodeInfoSrvRequest) ifMsg)
.getSB_UC_UC_ImportCnapsCodeInfoSrvInputCollection()
.getSB_UC_UC_ImportCnapsCodeInfoSrvInputItem();
MsgHeader CnapsCodeHead = ((SB_UC_UC_ImportCnapsCodeInfoSrvRequest) ifMsg)
.getMsgHeader();
HashMap<String, Object> map = new HashMap<String, Object>();
// Map<String, Object> retMap = BucUtil.confirmHead(CnapsCodeHead);
// 验证条数与500的界限
if (CnapsCodeInfoList.size() > 500) {
// for (int i = 0; i < CnapsCodeInfoList.size(); i++) {
// errorItem = new ErrorOutputItem();
// errorItem.setBATCH_ID(CnapsCodeInfoList.get(i).getBATCH_ID());
// errorItem.setENTITY_NAME("CNAPS");
// errorItem.setERROR_MESSAGE("数据超过500条");
// errorItem.setPRI_KEY(CnapsCodeInfoList.get(i).getPRI_KEY());
// errorItem.setRECORD_NUMBER(CnapsCodeInfoList.get(i)
// .getMDM_CODE());
// errorList.add(errorItem);
//
// }
//
// errorCol.setErrorOutputItem(errorList);
// respCol.setResponseOutputItem(respList);
// repObj.setErrorCollection(errorCol);
// repObj.setResponseCollection(respCol);
repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
repObj.setINSTANCE_ID(new BigDecimal(0));
repObj.setSERVICE_MESSAGE("数据超过500条");
HashMap<String, Object> obj = new HashMap<String, Object>();
obj.put("resultCode", Constants.MapResultCode.CODE_FORMAT_ERROR);
obj.put("resultMsg", "数据超过500条");
obj.put("retObj", repObj);
return obj;
}
// 校验头信息
Map<String, Object> retMap = BucUtil.confirmHead(CnapsCodeHead);
if (new Boolean(retMap.get(Constants.retMap_TAG).toString())) {
// 头信息校验通过
for (int i = 0; i < CnapsCodeInfoList.size(); i++) {
SB_UC_UC_ImportCnapsCodeInfoSrvInputItem item = CnapsCodeInfoList
.get(i);
// 校验体信息
Map<String, Object> retmap1 = confirmBean(item);
if (new Boolean(retmap1.get(Constants.retMap_TAG).toString())) {
// 体信息校验成功
// 判断操作类型
if (item.getOPERATE_TYPE().equals("I")) {
try {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
if (getService().ifZero(item.getMDM_CODE())) {
// 有联行信息 直接放入错误列表
errorItem = new ErrorOutputItem();
errorItem.setERROR_MESSAGE("此条联行号已经存在");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setENTITY_NAME("CNAPS");
errorList.add(errorItem);
} else {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
getService().add(item);
ResponseOutputItem respItem = new ResponseOutputItem();
respItem.setBATCH_ID(item.getBATCH_ID());
respItem.setPRI_KEY(item.getPRI_KEY());
respItem.setRECORD_NUMBER(item.getMDM_CODE());
respList.add(respItem);
}
} catch (Exception e) {
errorItem = new ErrorOutputItem();
errorItem.setERROR_MESSAGE("插入数据库异常");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setENTITY_NAME("CNAPS");
errorList.add(errorItem);
}
/***
* 0不存在 1存在 1.MDM_CODE、BANK_CODE、CNAPS_CODE
* 判断是否存在,存在插入错误列表 ,该信息已存在 返回 在action service begin
* 2.判断省份存不存在,返回标记。 3.判断地市存在不存在,返回标记。 4.判断银行代码是否存在,返回标记。
* 5.根据省份标记、地市标记、银行标记插入3张表。 service end 6.放到正确列表中 action
*
*/
} else if (item.getOPERATE_TYPE().equals("M")) {
try {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
if (getService().ifZero(item.getMDM_CODE())) {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
CNAPSMDMRequestVo reqVo = getService().update(item);
if(reqVo!=null){
CnapsCodeThreadForEjb therd = new CnapsCodeThreadForEjb(Constants.SB_UC_UC_ImportCnapsCodeInfoSrv,"",EJB_SV_DEF_CNAPS_CODE_SYNC,1,item.getPRI_KEY(),item.getMDM_CODE(),0,reqVo);
therd.start();
}
// 修改成功,返回结果
ResponseOutputItem respItem = new ResponseOutputItem();
respItem.setBATCH_ID(item.getBATCH_ID());
respItem.setPRI_KEY(item.getPRI_KEY());
respItem.setRECORD_NUMBER(item.getMDM_CODE());
// respItem.setREQUEST_ID();
respList.add(respItem);
} else {
errorItem = new ErrorOutputItem();
errorItem.setERROR_MESSAGE("该条修改联行号信息不存在");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setENTITY_NAME("CNAPS");
errorList.add(errorItem);
}
} catch (Exception e) {
errorItem = new ErrorOutputItem();
errorItem.setERROR_MESSAGE("插入数据库异常");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setENTITY_NAME("CNAPS");
errorList.add(errorItem);
}
// xiugai
/***
* 1.MDM_CODE、BANK_CODE、CNAPS_CODE 判断是否存在,不存在插入错误列表
* ,该信息不存在 返回 2.同新增 3.需要把原记录插入历史表。
*/
} else if (item.getOPERATE_TYPE().equals("D")) {
try {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
if (getService().ifOld(item.getEX_MDM_CODE())) {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
CNAPSMDMRequestVo reqVo = getService().combinCnapsCode(item);
CnapsCodeThreadForEjb therd = new CnapsCodeThreadForEjb(Constants.SB_UC_UC_ImportCnapsCodeInfoSrv,"",EJB_SV_DEF_CNAPS_CODE_SYNC,1,item.getPRI_KEY(),item.getMDM_CODE(),0,reqVo);
therd.start();
// 合并成功,返回结果
ResponseOutputItem respItem = new ResponseOutputItem();
respItem.setBATCH_ID(item.getBATCH_ID());
respItem.setPRI_KEY(item.getPRI_KEY());
respItem.setRECORD_NUMBER(item.getMDM_CODE());
// respItem.setREQUEST_ID();
respList.add(respItem);
} else {
errorItem = new ErrorOutputItem();
errorItem.setERROR_MESSAGE("该条合并联行号信息不存在");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setENTITY_NAME("CNAPS");
errorList.add(errorItem);
}
} catch (Exception e) {
errorItem = new ErrorOutputItem();
errorItem.setERROR_MESSAGE("插入数据库异常");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setENTITY_NAME("CNAPS");
errorList.add(errorItem);
// errorCol.getErrorOutputItem().add(errorItem);
// errorCol.setErrorOutputItem(errorList);
// repObj.setErrorCollection(errorCol);
// e.printStackTrace();
// return map;
}
// hebing
/***
* 1. mdm_code= EX_MDM_CODE判断是否存在,不存在插入错误列表 ,该信息不存在
* 2.同修改
*/
}
} else {
// 体信息错误,返回错误信息
// 放入错误列表
errorItem = new ErrorOutputItem();
errorItem.setENTITY_NAME("CNAPS");
errorItem.setBATCH_ID(item.getBATCH_ID());
errorItem.setPRI_KEY(item.getPRI_KEY());
errorItem.setRECORD_NUMBER(item.getMDM_CODE());
// errorItem.setERROR_MESSAGE("该条信息有错误");
errorItem.setERROR_MESSAGE(BucUtil
.getStringForList((List<String>) retmap1
.get(Constants.retMap_ERRORList)));
errorList.add(errorItem);
}
}
} else {
for (int i = 0; i < CnapsCodeInfoList.size(); i++) {
errorItem = new ErrorOutputItem();
errorItem.setENTITY_NAME("CNAPS");
errorItem.setBATCH_ID(CnapsCodeInfoList.get(i).getBATCH_ID());
errorItem.setPRI_KEY(CnapsCodeInfoList.get(i).getPRI_KEY());
errorItem.setRECORD_NUMBER(CnapsCodeInfoList.get(i)
.getMDM_CODE());
// errorItem.setERROR_MESSAGE("头信息错误");
errorItem.setERROR_MESSAGE(BucUtil
.getStringForList((List<String>) retMap
.get(Constants.retMap_ERRORList)));
errorList.add(errorItem);
}
errorCol.setErrorOutputItem(errorList);
repObj.setErrorCollection(errorCol);
// repObj.setResponseCollection(respCol);
repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
repObj.setSERVICE_MESSAGE("头信息格式错误");
repObj.setINSTANCE_ID(new BigDecimal(0));
// HashMap<String, Object> map = new HashMap<String, Object>();
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "处理失败");
map.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
return map;
}
errorCol.setErrorOutputItem(errorList);
respCol.setResponseOutputItem(respList);
if (errorList.size()<=0) {
repObj.setSERVICE_MESSAGE("处理成功");
repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_TRUE);
}else {
repObj.setSERVICE_MESSAGE("处理失败");
repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
}
repObj.setINSTANCE_ID(new BigDecimal(0));
repObj.setErrorCollection(errorCol);
repObj.setResponseCollection(respCol);
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_SUCCESSFUL);
map.put(Constants.MapResult.MAP_RESULTMSG, "处理成功");
map.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
return map;
// if (new Boolean(retMap.get(Constants.retMap_TAG).toString())) {
// }
// TODO Auto-generated method stub
}
public Map<String, Object> confirmBean(
SB_UC_UC_ImportCnapsCodeInfoSrvInputItem item) {
boolean temp = true;
List<String> errorList = new ArrayList();
Map<String, Object> map = new HashMap<String, Object>();
if (item.getPRI_KEY() == null || item.getPRI_KEY().length() == 0) {
temp = false;
errorList.add("PRI_KEY不能为空");
}
if (item.getPRI_KEY()!=null && item.getPRI_KEY().length()>60) {
temp = false;
errorList.add("PRI_KEY大于60位");
}
if (item.getBATCH_ID() == null || item.getBATCH_ID().length() == 0) {
temp = false;
errorList.add("BATCH_ID不能为空");
}
if (item.getBATCH_ID()!= null && item.getBATCH_ID().length()>30) {
temp = false;
errorList.add("BATCH_ID 大于30位");
}
if (item.getOPERATE_TYPE() == null
|| item.getOPERATE_TYPE().length() == 0) {
temp = false;
errorList.add("OPERATE_TYPE不能为空");
}
if (item.getOPERATE_TYPE() != null && !"I".equals(item.getOPERATE_TYPE()) && !"M".equals(item.getOPERATE_TYPE()) && !"D".equals(item.getOPERATE_TYPE())) {
temp = false;
errorList.add("OPERATE_TYPE数据不合法");
}
if ("D".equals(item.getOPERATE_TYPE())) {
if (item.getEX_MDM_CODE()== null || item.getEX_MDM_CODE().length()== 0) {
temp = false;
errorList.add("EX_MDM_CODE不能为空");
}
}
if (item.getMDM_CODE() == null || item.getMDM_CODE().length() == 0) {
temp = false;
errorList.add("MDM_CODE不能为空");
}
if (item.getMDM_CODE()!= null && item.getMDM_CODE().length()>50) {
temp = false;
errorList.add("MDM_CODE大于50位");
}
if (item.getIS_CNAPS() == null || item.getIS_CNAPS().length() == 0) {
temp = false;
errorList.add("IS_CNAPS不能为空");
}
if (item.getIS_CNAPS() != null && !"Y".equals(item.getIS_CNAPS())
&& !"N".equals(item.getIS_CNAPS())) {
temp = false;
errorList.add("IS_CNAPS数据不合法");
}
if (item.getIS_CNAPS() != null && "Y".equals(item.getIS_CNAPS())) {
if (item.getCNAPS_CODE() == null
|| item.getCNAPS_CODE().length() == 0) {
temp = false;
errorList.add("CNAPS_CODE不能为空");
}else {
if (item.getCNAPS_CODE().length()>100) {
temp = false;
errorList.add("CNAPS_CODE大于100位");
}
}
}
if (item.getIS_CNAPS() != null && "N".equals(item.getIS_CNAPS())) {
if (item.getCNAPS_CODE() == null || item.getCNAPS_CODE().length() == 0) {
}
else {
temp = false;
errorList.add("CNAPS_CODE值必须为空");
}
}
if (item.getBANK_CODE() == null || item.getBANK_CODE().length() == 0) {
temp = false;
errorList.add("BANK_CODE不能为空");
}
if (item.getBANK_CODE()!= null && item.getBANK_CODE().length()>50) {
temp = false;
errorList.add("BANK_CODE大于50位");
}
if (item.getBANK_NAME() == null || item.getBANK_NAME().length() == 0) {
temp = false;
errorList.add("BANK_NAME不能为空");
}
if (item.getBANK_NAME()!= null && item.getBANK_NAME().length()>250) {
temp = false;
errorList.add("BANK_NAME大于250位");
}
if (item.getCITY_CODE() == null || item.getCITY_CODE().length() == 0) {
temp = false;
errorList.add("CITY_CODE不能为空");
}
if (item.getCITY_CODE()!= null && item.getCITY_CODE().length()>50) {
temp = false;
errorList.add("CITY_CODE大于50位");
}
if (item.getCITY_NAME() == null || item.getCITY_NAME().length() == 0) {
temp = false;
errorList.add("CITY_NAME不能为空");
}
if (item.getCITY_NAME()!= null && item.getCITY_NAME().length()>300) {
temp = false;
errorList.add("CITY_NAME大于300位");
}
if (item.getPROVINCE_CODE() == null
|| item.getPROVINCE_CODE().length() == 0) {
temp = false;
errorList.add("PROVINCE_CODE不能为空");
}
if (item.getPROVINCE_CODE()!= null && item.getPROVINCE_CODE().length()>60) {
temp = false;
errorList.add("PROVINCE_CODE大于60位");
}
if (item.getPROVINCE_NAME() == null
|| item.getPROVINCE_NAME().length() == 0) {
temp = false;
errorList.add("PROVINCE_NAME不能为空");
}
if (item.getPROVINCE_NAME()!= null && item.getPROVINCE_NAME().length()>100) {
temp = false;
errorList.add("PROVINCE_NAME大于100位");
}
if (item.getBRANCH_NAME() == null
|| item.getBRANCH_NAME().length() == 0) {
temp = false;
errorList.add("BRANCH_NAME不能为空");
}
if (item.getBRANCH_NAME()!= null && item.getBRANCH_NAME().length()>250) {
temp = false;
errorList.add("BRANCH_NAME大于250位");
}
//System.out.println("这是字节的输出"+item.getBANK_NAME().getBytes().length);
map.put(Constants.retMap_TAG, temp);
map.put(Constants.retMap_ERRORList, errorList);
return map;
}
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
return null;
}
public IImportCnapsCodeInfoSV getService() {
return (IImportCnapsCodeInfoSV) ServiceFactory
.getService(IImportCnapsCodeInfoSV.class);
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.staffinfoser;
import java.util.Map;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ws.util.UipWsSrvUtil;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-10-26T15:38:41.716+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "StaffInfoSer",
portName = "StaffInfoSerSOAP",
targetNamespace = "http://ws.chinaunicom.cn/StaffInfoSer/",
endpointInterface = "cn.chinaunicom.ws.staffinfoser.StaffInfoSer")
public class StaffInfoSerImpl implements StaffInfoSer {
private static final Logger LOG = Logger.getLogger(StaffInfoSerImpl.class.getName());
private static final String BUSI_IMPL_CLASS = "com.ai.uchintService.ejb.paramImpl.staffInfoSrv.StaffInfoSrvImpl";
private static final String OPERATE_CODE = "staffInfo";
/* (non-Javadoc)
* @see cn.chinaunicom.ws.staffinfoser.StaffInfoSer#staffInfo(cn.chinaunicom.ws.staffinfoser.unibssbody.STAFF_INFO_INPUT parameters )*
*/
public cn.chinaunicom.ws.staffinfoser.unibssbody.STAFF_INFO_OUTPUT staffInfo(cn.chinaunicom.ws.staffinfoser.unibssbody.STAFF_INFO_INPUT parameters) {
LOG.info("Executing operation staffInfo");
System.out.println(parameters);
try {
Map<String, Object> resultMap = UipWsSrvUtil.cxfWsProcess(parameters, this.getClass(), OPERATE_CODE, BUSI_IMPL_CLASS);
if (resultMap == null || resultMap.get(Constants.ResultMap.ResultKey.RESULT_CODE) == null) {
throw new RuntimeException("处理失败");
} else if (((String)resultMap.get(Constants.ResultMap.ResultKey.RESULT_CODE)).equals(Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS)) {
return (cn.chinaunicom.ws.staffinfoser.unibssbody.STAFF_INFO_OUTPUT)resultMap.get(Constants.ResultMap.ResultKey.RESULT_OBJ);
} else {
throw new RuntimeException("处理失败:"+(String)resultMap.get(Constants.ResultMap.ResultKey.RESULT_MSG));
}
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>
package cn.chinaunicom.ws.precheckresultser.unibssbody.precheckresultreq;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PRECHECK_NO">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="RESULT_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4"/>
* <minLength value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="RESULT_DESC">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="500"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"precheckNO",
"resultCODE",
"resultDESC",
"para"
})
@XmlRootElement(name = "PRECHECK_RESULT_REQ")
public class PRECHECK_RESULT_REQ {
@XmlElement(name = "PRECHECK_NO", required = true)
protected String precheckNO;
@XmlElement(name = "RESULT_CODE", required = true)
protected String resultCODE;
@XmlElement(name = "RESULT_DESC", required = true)
protected String resultDESC;
@XmlElement(name = "PARA")
protected List<PRECHECK_RESULT_REQ.PARA> para;
/**
* Gets the value of the precheck_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRECHECK_NO() {
return precheckNO;
}
/**
* Sets the value of the precheck_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRECHECK_NO(String value) {
this.precheckNO = value;
}
/**
* Gets the value of the result_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESULT_CODE() {
return resultCODE;
}
/**
* Sets the value of the result_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESULT_CODE(String value) {
this.resultCODE = value;
}
/**
* Gets the value of the result_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESULT_DESC() {
return resultDESC;
}
/**
* Sets the value of the result_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESULT_DESC(String value) {
this.resultDESC = value;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PRECHECK_RESULT_REQ.PARA }
*
*
*/
public List<PRECHECK_RESULT_REQ.PARA> getPARA() {
if (para == null) {
para = new ArrayList<PRECHECK_RESULT_REQ.PARA>();
}
return this.para;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraID",
"paraVALUE"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraID;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>package com.ai;
import java.awt.GraphicsConfiguration;
import java.awt.Window;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.jaxws.JaxWsClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import com.ai.uip.core.util.EncryptUtil;
import com.ai.uip.core.util.FtpUtil;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvRequest;
public class test {
private static final String EJB_SV_DEF_CNAPS_CODE_SYNC = "CnapsCodeInfo";
// public static void main(String[] strs){
//
//
// /**
// * 调用ejb测试
// */
// CNAPSMDMRequestVo reqVo = new CNAPSMDMRequestVo();
// reqVo.setOperateType(reqVo.MERGE);
// CNAPSMDMVo svo = new CNAPSMDMVo();
// svo.setObjectType(svo.SOURCE);
// svo.setMdmCode("101");
// svo.setBranchName("bbb");
// CNAPSMDMVo tvo =new CNAPSMDMVo();
// tvo.setObjectType(svo.TARGET);
// tvo.setMdmCode("100");
// tvo.setBranchName("bbb111");
// List<CNAPSMDMVo> cnapsmdmLists = new ArrayList<CNAPSMDMVo>();
// cnapsmdmLists.add(svo);
// cnapsmdmLists.add(tvo);
// reqVo.setCnapsmdmLists(cnapsmdmLists);
// CnapsCodeThreadForEjb therd = new
// CnapsCodeThreadForEjb(Constants.SB_UC_UC_ImportCnapsCodeInfoSrv,"",EJB_SV_DEF_CNAPS_CODE_SYNC,1,"1","1",0,reqVo);
// therd.start();
// System.out.println("1111111111111");
// }
// public static void main(String[] strs) {
// String ss = "74.001";
// String[] ss2 = ss.split("[.]");
// for (int i = 0; i < ss2.length; i++) {
// System.out.println(ss2[i]);
// }
// try {
// Object obj = executeWS3(
// 1,
// "http://mss.unicom.com/SB_UC_UC_ImportPaymentResultInfoSrv",
// "SB_UC_UC_ImportPaymentResultInfoSrv",
// "http://localhost:7001/ucint/ws/SB_UC_UC_ImportPaymentResultInfoSrv?wsdl",
// "com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SBUCUCImportPaymentResultInfoSrv",
// "com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvRequest",
// "process",new SB_UC_UC_ImportPaymentResultInfoSrvRequest());
// System.out.println(obj);
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
public static void main(String[] strs) {
String pass = EncryptUtil.getEncrypt("<PASSWORD>");
FtpUtil.downFile("ftp://tstsdma1:"+pass+"@10.1.247.2/unibss/tstusers/tstsdma1/homax", "C_B_83_BSDM_CHL_20130109_0002_B_1.XML.gz", "D:\\qudao", "N");
}
public static Object executeWS3(long outTime, String nameSpace,
String serviceName, String addr, String ifClass, String paramClass,
String serviceMeth, Object arg) throws Exception {
try {
URL url = new URL(addr);
// HttpURLConnection hc = (HttpURLConnection) url.openConnection();
// hc.setConnectTimeout(3);
// hc.setReadTimeout(3);vvvvvvvvvvvvvvv
HttpClient httpClient = new HttpClient();
Service service = Service.create(url, new QName(nameSpace,
serviceName));
Object obj = service.getPort(Class.forName(ifClass));
// JaxWsClientProxy jj = new JaxWsClientProxy();
if (outTime > 0) {
Client client = ClientProxy.getClient(obj);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(outTime);
httpClientPolicy.setReceiveTimeout(outTime);
http.setClient(httpClientPolicy);
javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) obj;
Map<String, Object> context = bp.getRequestContext();
context.put("com.sun.xml.ws.connect.timeout", outTime);
context.put("com.sun.xml.ws.request.timeout", outTime);
// Map<String, Object> requestContext = ((BindingProvider)
// service).getRequestContext();
// requestContext.put("com.sun.xml.ws.connect.timeout",
// outTime);
// requestContext.put("com.sun.xml.ws.request.timeout",
// outTime);
}
Method meth = obj.getClass().getMethod(serviceMeth,
Class.forName(paramClass));
Object[] args = new Object[1];
args[0] = arg;
Object retObj = meth.invoke(obj, args);
return retObj;
} catch (Exception e) {
System.out.println(e.getMessage());
throw e;
}
}
}
<file_sep>
package com.ai.uchintService.ejb.VO.ChannelInfo;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
public class ChannelInfoReqVO implements Serializable {
protected String operateTYPE;
protected String chnlCODE;
protected String chnlNAME;
protected String chnlDESC;
protected String chnlORGID;
protected String state;
protected String stateDESC;
protected String chnlKINDID;
protected String localKINDID;
protected String chnlCLASSID;
protected String chainFLAG;
protected String isRWDCNT;
protected String paySCOPE;
protected String payCHNLCODE;
protected String superCHNLCODE;
protected String seflCHNLCODE;
protected String rwdCNTDATE;
protected String provinceCODE;
protected String cityCODE;
protected String managerAREACODE;
protected String areaTYPE;
protected String chnlCHAINLEVEL;
protected String chnlLEVEL;
protected String isINPUTSYSTEM;
protected BigInteger systemNUM;
protected String isMINIHALL;
protected String chnlAREAKINDID;
protected String bankCODE;
protected String bankNO;
protected String bankACCTNAME;
protected String address;
protected String chnlLINKMANNAME;
protected String chnlLINKMANSEX;
protected String chnlEMAIL;
protected String chnlFAX;
protected String chnlADDR;
protected String chnlOFFICEPHONE;
protected String chnlPHONE;
protected String chnlPOSTALCODE;
protected String managerDEPTCODE;
protected String managerSTAFFCODE;
protected String managerPHONE;
protected String remark;
protected String affiliatetime;
protected String createSTAFFCODE;
protected String createTIME;
protected ChannelInfoReqVO.DEVLIST devlist;
protected List<ChannelInfoReqVO.PARA> para;
/**
* Gets the value of the operate_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATE_TYPE() {
return operateTYPE;
}
/**
* Sets the value of the operate_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATE_TYPE(String value) {
this.operateTYPE = value;
}
/**
* Gets the value of the chnl_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CODE() {
return chnlCODE;
}
/**
* Sets the value of the chnl_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CODE(String value) {
this.chnlCODE = value;
}
/**
* Gets the value of the chnl_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_NAME() {
return chnlNAME;
}
/**
* Sets the value of the chnl_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_NAME(String value) {
this.chnlNAME = value;
}
/**
* Gets the value of the chnl_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_DESC() {
return chnlDESC;
}
/**
* Sets the value of the chnl_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_DESC(String value) {
this.chnlDESC = value;
}
/**
* Gets the value of the chnl_ORG_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ORG_ID() {
return chnlORGID;
}
/**
* Sets the value of the chnl_ORG_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ORG_ID(String value) {
this.chnlORGID = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE(String value) {
this.state = value;
}
/**
* Gets the value of the state_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE_DESC() {
return stateDESC;
}
/**
* Sets the value of the state_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE_DESC(String value) {
this.stateDESC = value;
}
/**
* Gets the value of the chnl_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_KIND_ID() {
return chnlKINDID;
}
/**
* Sets the value of the chnl_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_KIND_ID(String value) {
this.chnlKINDID = value;
}
/**
* Gets the value of the local_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLOCAL_KIND_ID() {
return localKINDID;
}
/**
* Sets the value of the local_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLOCAL_KIND_ID(String value) {
this.localKINDID = value;
}
/**
* Gets the value of the chnl_CLASS_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CLASS_ID() {
return chnlCLASSID;
}
/**
* Sets the value of the chnl_CLASS_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CLASS_ID(String value) {
this.chnlCLASSID = value;
}
/**
* Gets the value of the chain_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHAIN_FLAG() {
return chainFLAG;
}
/**
* Sets the value of the chain_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHAIN_FLAG(String value) {
this.chainFLAG = value;
}
/**
* Gets the value of the is_RWD_CNT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_RWD_CNT() {
return isRWDCNT;
}
/**
* Sets the value of the is_RWD_CNT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_RWD_CNT(String value) {
this.isRWDCNT = value;
}
/**
* Gets the value of the pay_SCOPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_SCOPE() {
return paySCOPE;
}
/**
* Sets the value of the pay_SCOPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_SCOPE(String value) {
this.paySCOPE = value;
}
/**
* Gets the value of the pay_CHNL_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_CHNL_CODE() {
return payCHNLCODE;
}
/**
* Sets the value of the pay_CHNL_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_CHNL_CODE(String value) {
this.payCHNLCODE = value;
}
/**
* Gets the value of the super_CHNL_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSUPER_CHNL_CODE() {
return superCHNLCODE;
}
/**
* Sets the value of the super_CHNL_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUPER_CHNL_CODE(String value) {
this.superCHNLCODE = value;
}
/**
* Gets the value of the sefl_CHNL_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSEFL_CHNL_CODE() {
return seflCHNLCODE;
}
/**
* Sets the value of the sefl_CHNL_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSEFL_CHNL_CODE(String value) {
this.seflCHNLCODE = value;
}
/**
* Gets the value of the rwd_CNT_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRWD_CNT_DATE() {
return rwdCNTDATE;
}
/**
* Sets the value of the rwd_CNT_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRWD_CNT_DATE(String value) {
this.rwdCNTDATE = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the manager_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_AREA_CODE() {
return managerAREACODE;
}
/**
* Sets the value of the manager_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_AREA_CODE(String value) {
this.managerAREACODE = value;
}
/**
* Gets the value of the area_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_TYPE() {
return areaTYPE;
}
/**
* Sets the value of the area_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_TYPE(String value) {
this.areaTYPE = value;
}
/**
* Gets the value of the chnl_CHAIN_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CHAIN_LEVEL() {
return chnlCHAINLEVEL;
}
/**
* Sets the value of the chnl_CHAIN_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CHAIN_LEVEL(String value) {
this.chnlCHAINLEVEL = value;
}
/**
* Gets the value of the chnl_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LEVEL() {
return chnlLEVEL;
}
/**
* Sets the value of the chnl_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LEVEL(String value) {
this.chnlLEVEL = value;
}
/**
* Gets the value of the is_INPUT_SYSTEM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_INPUT_SYSTEM() {
return isINPUTSYSTEM;
}
/**
* Sets the value of the is_INPUT_SYSTEM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_INPUT_SYSTEM(String value) {
this.isINPUTSYSTEM = value;
}
/**
* Gets the value of the system_NUM property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSYSTEM_NUM() {
return systemNUM;
}
/**
* Sets the value of the system_NUM property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSYSTEM_NUM(BigInteger value) {
this.systemNUM = value;
}
/**
* Gets the value of the is_MINI_HALL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_MINI_HALL() {
return isMINIHALL;
}
/**
* Sets the value of the is_MINI_HALL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_MINI_HALL(String value) {
this.isMINIHALL = value;
}
/**
* Gets the value of the chnl_AREA_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_AREA_KIND_ID() {
return chnlAREAKINDID;
}
/**
* Sets the value of the chnl_AREA_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_AREA_KIND_ID(String value) {
this.chnlAREAKINDID = value;
}
/**
* Gets the value of the bank_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_CODE() {
return bankCODE;
}
/**
* Sets the value of the bank_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_CODE(String value) {
this.bankCODE = value;
}
/**
* Gets the value of the bank_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NO() {
return bankNO;
}
/**
* Sets the value of the bank_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NO(String value) {
this.bankNO = value;
}
/**
* Gets the value of the bank_ACCT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCT_NAME() {
return bankACCTNAME;
}
/**
* Sets the value of the bank_ACCT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCT_NAME(String value) {
this.bankACCTNAME = value;
}
/**
* Gets the value of the address property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getADDRESS() {
return address;
}
/**
* Sets the value of the address property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setADDRESS(String value) {
this.address = value;
}
/**
* Gets the value of the chnl_LINKMAN_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LINKMAN_NAME() {
return chnlLINKMANNAME;
}
/**
* Sets the value of the chnl_LINKMAN_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LINKMAN_NAME(String value) {
this.chnlLINKMANNAME = value;
}
/**
* Gets the value of the chnl_LINKMAN_SEX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LINKMAN_SEX() {
return chnlLINKMANSEX;
}
/**
* Sets the value of the chnl_LINKMAN_SEX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LINKMAN_SEX(String value) {
this.chnlLINKMANSEX = value;
}
/**
* Gets the value of the chnl_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_EMAIL() {
return chnlEMAIL;
}
/**
* Sets the value of the chnl_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_EMAIL(String value) {
this.chnlEMAIL = value;
}
/**
* Gets the value of the chnl_FAX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_FAX() {
return chnlFAX;
}
/**
* Sets the value of the chnl_FAX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_FAX(String value) {
this.chnlFAX = value;
}
/**
* Gets the value of the chnl_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ADDR() {
return chnlADDR;
}
/**
* Sets the value of the chnl_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ADDR(String value) {
this.chnlADDR = value;
}
/**
* Gets the value of the chnl_OFFICE_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_OFFICE_PHONE() {
return chnlOFFICEPHONE;
}
/**
* Sets the value of the chnl_OFFICE_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_OFFICE_PHONE(String value) {
this.chnlOFFICEPHONE = value;
}
/**
* Gets the value of the chnl_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_PHONE() {
return chnlPHONE;
}
/**
* Sets the value of the chnl_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_PHONE(String value) {
this.chnlPHONE = value;
}
/**
* Gets the value of the chnl_POSTALCODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_POSTALCODE() {
return chnlPOSTALCODE;
}
/**
* Sets the value of the chnl_POSTALCODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_POSTALCODE(String value) {
this.chnlPOSTALCODE = value;
}
/**
* Gets the value of the manager_DEPT_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_DEPT_CODE() {
return managerDEPTCODE;
}
/**
* Sets the value of the manager_DEPT_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_DEPT_CODE(String value) {
this.managerDEPTCODE = value;
}
/**
* Gets the value of the manager_STAFF_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_STAFF_CODE() {
return managerSTAFFCODE;
}
/**
* Sets the value of the manager_STAFF_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_STAFF_CODE(String value) {
this.managerSTAFFCODE = value;
}
/**
* Gets the value of the manager_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_PHONE() {
return managerPHONE;
}
/**
* Sets the value of the manager_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_PHONE(String value) {
this.managerPHONE = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the affiliatetime property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAFFILIATETIME() {
return affiliatetime;
}
/**
* Sets the value of the affiliatetime property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAFFILIATETIME(String value) {
this.affiliatetime = value;
}
/**
* Gets the value of the create_STAFF_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_CODE() {
return createSTAFFCODE;
}
/**
* Sets the value of the create_STAFF_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_CODE(String value) {
this.createSTAFFCODE = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the devlist property.
*
* @return
* possible object is
* {@link ChannelInfoReqVO.DEVLIST }
*
*/
public ChannelInfoReqVO.DEVLIST getDEVLIST() {
return devlist;
}
/**
* Sets the value of the devlist property.
*
* @param value
* allowed object is
* {@link ChannelInfoReqVO.DEVLIST }
*
*/
public void setDEVLIST(ChannelInfoReqVO.DEVLIST value) {
this.devlist = value;
}
public List<ChannelInfoReqVO.PARA> getPARA() {
if (para == null) {
para = new ArrayList<ChannelInfoReqVO.PARA>();
}
return this.para;
}
public static class DEVLIST {
protected List<ChannelInfoReqVO.DEVLIST.DEVELOPER> developer;
public List<ChannelInfoReqVO.DEVLIST.DEVELOPER> getDEVELOPER() {
if (developer == null) {
developer = new ArrayList<ChannelInfoReqVO.DEVLIST.DEVELOPER>();
}
return this.developer;
}
public static class DEVELOPER {
protected String devOPERATE;
protected String devCODE;
protected String devTYPEID;
protected String devNAME;
protected String devSTAFFCODE;
protected String userPID;
protected String linkmanPHONE;
protected String linkmanEMAIL;
protected String groupACCT;
protected String linkmanADDR;
protected String linkmanPOSTCODE;
protected String remark;
protected String bssSYSCODE;
protected String bssSYSCODE2;
/**
* Gets the value of the dev_OPERATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_OPERATE() {
return devOPERATE;
}
/**
* Sets the value of the dev_OPERATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_OPERATE(String value) {
this.devOPERATE = value;
}
/**
* Gets the value of the dev_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_CODE() {
return devCODE;
}
/**
* Sets the value of the dev_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_CODE(String value) {
this.devCODE = value;
}
/**
* Gets the value of the dev_TYPE_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_TYPE_ID() {
return devTYPEID;
}
/**
* Sets the value of the dev_TYPE_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_TYPE_ID(String value) {
this.devTYPEID = value;
}
/**
* Gets the value of the dev_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_NAME() {
return devNAME;
}
/**
* Sets the value of the dev_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_NAME(String value) {
this.devNAME = value;
}
/**
* Gets the value of the dev_STAFF_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_STAFF_CODE() {
return devSTAFFCODE;
}
/**
* Sets the value of the dev_STAFF_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_STAFF_CODE(String value) {
this.devSTAFFCODE = value;
}
/**
* Gets the value of the user_PID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSER_PID() {
return userPID;
}
/**
* Sets the value of the user_PID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSER_PID(String value) {
this.userPID = value;
}
/**
* Gets the value of the linkman_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_PHONE() {
return linkmanPHONE;
}
/**
* Sets the value of the linkman_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_PHONE(String value) {
this.linkmanPHONE = value;
}
/**
* Gets the value of the linkman_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_EMAIL() {
return linkmanEMAIL;
}
/**
* Sets the value of the linkman_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_EMAIL(String value) {
this.linkmanEMAIL = value;
}
/**
* Gets the value of the group_ACCT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGROUP_ACCT() {
return groupACCT;
}
/**
* Sets the value of the group_ACCT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGROUP_ACCT(String value) {
this.groupACCT = value;
}
/**
* Gets the value of the linkman_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_ADDR() {
return linkmanADDR;
}
/**
* Sets the value of the linkman_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_ADDR(String value) {
this.linkmanADDR = value;
}
/**
* Gets the value of the linkman_POSTCODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_POSTCODE() {
return linkmanPOSTCODE;
}
/**
* Sets the value of the linkman_POSTCODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_POSTCODE(String value) {
this.linkmanPOSTCODE = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the bss_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE() {
return bssSYSCODE;
}
/**
* Sets the value of the bss_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE(String value) {
this.bssSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE2() {
return bssSYSCODE2;
}
/**
* Sets the value of the bss_SYS_CODE2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE2(String value) {
this.bssSYSCODE2 = value;
}
}
}
public static class PARA {
protected String paraID;
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>package com.unicom.mss.sb_eas_eas_importamountinfosrv;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2011-09-01T13:52:42.002+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_ImportAmountInfoSrv", name = "SB_EAS_EAS_ImportAmountInfoSrv")
@XmlSeeAlso({ObjectFactory.class, com.unicom.mss.soa.msgheader.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SBEASEASImportAmountInfoSrv {
@WebResult(name = "SB_EAS_EAS_ImportAmountInfoSrvResponse", targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_ImportAmountInfoSrv", partName = "payload")
@WebMethod(action = "process")
public SB_EAS_EAS_ImportAmountInfoSrvResponse process(
@WebParam(partName = "payload", name = "SB_EAS_EAS_ImportAmountInfoSrvRequest", targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_ImportAmountInfoSrv")
SB_EAS_EAS_ImportAmountInfoSrvRequest payload
);
}
<file_sep>package com.ai.uchintService.server.importContractInfo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IImportContractInfoSV;
import com.ai.uchintService.common.bo.TF_CHL_AGREEMENTBean;
import com.ai.uchintService.common.bo.TF_CHL_AGREEMENTEngine;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.ErrorCollection;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.ErrorItem;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.ResponseCollecion;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.ResponseItem;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvInputCollection;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvInputItem;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvRequest;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvResponse;
import com.unicom.mss.sb_uc_uc_importcontractinfosrv.VendorInfoItem;
import com.unicom.mss.soa.msgheader.MsgHeader;
/**
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Nov 15, 2011
*/
public class ImportContractInfoAction implements IRecIfBase{
@Override
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
HashMap<String, Object> map = new HashMap<String, Object>();
//请求报文
SB_UC_UC_ImportContractInfoSrvRequest requestMsg = null;
SB_UC_UC_ImportContractInfoSrvInputCollection inputCol = null;
List<SB_UC_UC_ImportContractInfoSrvInputItem> inputItemList = null;
//请求报文头
MsgHeader msgHead = null;
//返回报文
SB_UC_UC_ImportContractInfoSrvResponse responseMsg = null;
ErrorCollection errCol = new ErrorCollection();
List<ErrorItem> errItemList = new ArrayList<ErrorItem>();
ResponseCollecion respCol = new ResponseCollecion();
List<ResponseItem> respList = new ArrayList<ResponseItem>();
try {
requestMsg = (SB_UC_UC_ImportContractInfoSrvRequest)ifMsg;
inputCol = requestMsg.getSB_UC_UC_ImportContractInfoSrvInputCollection();
inputItemList = inputCol.getSB_UC_UC_ImportContractInfoSrvInputItem();
msgHead = requestMsg.getMsgHeader();
responseMsg = new SB_UC_UC_ImportContractInfoSrvResponse();
//-------------校验请求报文 start-------------------
//请求报文头非空校验
boolean headFlag = true;
String headErrStr = "";
if (msgHead.getSOURCE_SYSTEM_ID() == null || msgHead.getSOURCE_SYSTEM_ID().length() == 0) {
headFlag = false;
headErrStr += "源系统ID[SOURCE_SYSTEM_ID]不能为空! ";
}
if(msgHead.getSOURCE_SYSTEM_NAME() == null || msgHead.getSOURCE_SYSTEM_NAME().length() == 0) {
headFlag = false;
headErrStr += "源系统名称[SOURCE_SYSTEM_NAME]不能为空! ";
}
if(msgHead.getUSER_ID() == null || msgHead.getUSER_ID().length() == 0) {
headFlag = false;
headErrStr += "用户ID[USER_ID]不能为空! ";
}
if(msgHead.getUSER_NAME() == null || msgHead.getUSER_NAME().length() == 0) {
headFlag = false;
headErrStr += "用户名称[USER_NAME]不能为空!";
}
//遍例报文体内容
for(int i=0;i<inputItemList.size();i++){
SB_UC_UC_ImportContractInfoSrvInputItem inputItem = inputItemList.get(i);
boolean inputItemFlag = true;
String inputItemErrStr = "";
if (inputItem.getPRI_KEY() == null || inputItem.getPRI_KEY().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "唯一关键字[PRI_KEY]不能为空! ";
}
if (inputItem.getBATCH_ID() == null || inputItem.getBATCH_ID().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "批次号[BATCH_ID]不能为空! ";
}
if (inputItem.getHEARDER_ID() == null || inputItem.getHEARDER_ID().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "头ID[HEARDER_ID()]不能为空! ";
}
if (inputItem.getPROVINCE_CODE() == null || inputItem.getPROVINCE_CODE().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "省份代码[PROVINCE_CODE]不能为空! ";
}
if (inputItem.getORG_NAME() == null || inputItem.getORG_NAME().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "OU名称[ORG_NAME]不能为空! ";
}
if (inputItem.getORG_NAME() != null && inputItem.getORG_NAME().length()<6) {
inputItemFlag = false;
inputItemErrStr += "OU名称[ORG_NAME]长度不能小于6! ";
}
if (inputItem.getTYPE_FLAG() != null && !inputItem.getTYPE_FLAG().equals("1") && !inputItem.getTYPE_FLAG().equals("2")) {
inputItemFlag = false;
inputItemErrStr += "是否是框架协议合同[TYPE_FLAG] 传值有误! ";
}
if (inputItem.getCONTRACT_NUMBER() == null || inputItem.getCONTRACT_NUMBER().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "合同编号不能为空! ";
}
if (inputItem.getCONTRACT_NAME() == null || inputItem.getCONTRACT_NAME().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "合同名称[CONTRACT_NUMBER]不能为空! ";
}
if (inputItem.getAUDIT_DATE() == null) {
inputItemFlag = false;
inputItemErrStr += "盖章签订日期[AUDIT_DATE]不能为空! ";
}
if (inputItem.getLAST_UPDATE_DATE() == null ) {
inputItemFlag = false;
inputItemErrStr += "最后更新时间[LAST_UPDATE_DATE]不能为空! ";
}
if (inputItem.getACTION_TYPE() == null || inputItem.getACTION_TYPE().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "操作类别不能为空! ";
}
if (inputItem.getACTION_TYPE() != null && !inputItem.getACTION_TYPE().equals("1") && !inputItem.getACTION_TYPE().equals("2")
&& !inputItem.getACTION_TYPE().equals("3")
&& !inputItem.getACTION_TYPE().equals("4")
&& !inputItem.getACTION_TYPE().equals("5")
&& !inputItem.getACTION_TYPE().equals("6")) {
inputItemFlag = false;
inputItemErrStr += "操作类别传值有误! ";
}
if (inputItem.getEMP_HR() == null || inputItem.getEMP_HR().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "合同承办人的HR员工号[EMP_HR]不能为空! ";
}
if (inputItem.getEMP_NAME() == null || inputItem.getEMP_NAME().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "合同承办人的HR的姓名[EMP_NAME]不能为空! ";
}
if (inputItem.getCONTRACT_STATUS() == null || inputItem.getCONTRACT_STATUS().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "合同状态[CONTRACT_STATUS]不能为空! ";
}
if (inputItem.getCONTRACT_TYPE() == null || inputItem.getCONTRACT_TYPE().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "合同类型[CONTRACT_TYP]不能为空! ";
}
if (inputItem.getRESERVED_6() != null && !inputItem.getRESERVED_6().equals("")) {
String[] unitArr = inputItem.getRESERVED_6().split("@");
for(String str : unitArr) {
if (!str.contains("_")) {
inputItemFlag = false;
inputItemErrStr += "我方签约主体[RESERVED_6]格式不正确! ";
}
}
}
if (inputItem.getVENDOR_INFO().getVendorInfoItem() == null || inputItem.getVENDOR_INFO().getVendorInfoItem().size()==0) {
inputItemFlag = false;
inputItemErrStr += "供应商信息实体不能为空! ";
}
//供应商信息实体
List<VendorInfoItem> vendorInfoList = inputItem.getVENDOR_INFO().getVendorInfoItem();
for (int j = 0; j < vendorInfoList.size(); j++) {
VendorInfoItem vendorInfo = vendorInfoList.get(j);
if (vendorInfo.getHEARDER_ID() == null || vendorInfo.getHEARDER_ID().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "供应商:头ID[HEARDER_ID]不能为空! ";
}
if (vendorInfo.getBATCH_ID() == null || vendorInfo.getBATCH_ID().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "供应商:批次号[BATCH_ID]不能为空! ";
}
if (vendorInfo.getVENDOR_NUM() != null && vendorInfo.getVENDOR_NUM().length() > 30) {
inputItemFlag = false;
inputItemErrStr += "供应商:供应商编号[VENDOR_NUM]长度不能超过30! ";
}
if (vendorInfo.getVENDOR_NAME() == null || vendorInfo.getVENDOR_NAME().length() == 0) {
inputItemFlag = false;
inputItemErrStr += "供应商:供应商名称[VENDOR_NAME]不能为空 ";
}
}
//-------------校验请求报文 end-------------------
//返回信息数据实体
ResponseItem respItem = new ResponseItem();
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setRECORD_NUMBER(inputItem.getCONTRACT_NUMBER());
respItem.setCONTRACT_ID(inputItem.getCONTRACT_ID());
respList.add(respItem);
//操作类别
String actionType = inputItem.getACTION_TYPE() !=null ? inputItem.getACTION_TYPE() : "" ;
//新增
if (actionType.equals("1")) {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
if (getService().ifAgreenNo(inputItem.getCONTRACT_NUMBER())) {
errItemList.add(getErrorItem(inputItem, "新增失败:合同编号已存在!"));
errCol.setErrorItem(errItemList);
responseMsg.setErrorCollection(errCol);
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
responseMsg.setSERVICE_MESSAGE("新增失败:合同编号已存在!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "新增失败:合同编号已存在");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
}
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
getService().addContract(inputItem);
//只更新合同状态
} else if(actionType.equals("2")) {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
if (!getService().ifAgreenNo(inputItem.getCONTRACT_NUMBER())) {
errItemList.add(getErrorItem(inputItem, "操作失败:合同编号不存在!"));
errCol.setErrorItem(errItemList);
responseMsg.setErrorCollection(errCol);
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
responseMsg.setSERVICE_MESSAGE("操作失败:合同编号不存在!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "操作失败:合同编号不存在");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
}
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
getService().updateState(inputItem.getCONTRACT_STATUS(), inputItem.getCONTRACT_NUMBER());
//返回成功,不处理
} else if(actionType.equals("3")) {
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_TRUE);
responseMsg.setSERVICE_MESSAGE("直接返回成功!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_SUCCESSFUL);
map.put(Constants.MapResult.MAP_RESULTMSG, "直接返回成功");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
//更新所有字段
} else if(actionType.equals("4")) {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
if (!getService().ifAgreenNo(inputItem.getCONTRACT_NUMBER())) {
errItemList.add(getErrorItem(inputItem, "操作失败:合同编号不存在!"));
errCol.setErrorItem(errItemList);
responseMsg.setErrorCollection(errCol);
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
responseMsg.setSERVICE_MESSAGE("操作失败:合同编号不存在!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "操作失败:合同编号不存在");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
}
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
getService().updateContract(inputItem);
//只更新合同履行人一个字段
} else if(actionType.equals("5")) {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
if (!getService().ifAgreenNo(inputItem.getCONTRACT_NUMBER())) {
errItemList.add(getErrorItem(inputItem, "操作失败:合同编号不存在!"));
errCol.setErrorItem(errItemList);
responseMsg.setErrorCollection(errCol);
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
responseMsg.setSERVICE_MESSAGE("操作失败:合同编号不存在!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "操作失败:合同编号不存在");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
}
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
getService().updatePerformerMail(inputItem.getRESERVED_15(), inputItem.getCONTRACT_NUMBER());
//合同存在:执行4,合同不存在:执行1
} else if(actionType.equals("6")) {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
// TF_CHL_AGREEMENTBean[] agreeMents = TF_CHL_AGREEMENTEngine.getBeans(" AGREE_NO='"+inputItem.getCONTRACT_NUMBER()+"'",null);
TF_CHL_AGREEMENTBean[] agreeMents =getService().getTF_CHL_AGREEMENTBean(inputItem.getCONTRACT_NUMBER());
if (agreeMents != null && agreeMents.length>0) {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
getService().updateContract(inputItem);
} else {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
getService().addContract(inputItem);
}
}
//报文头或者报文体校验不通过
if (!headFlag || !inputItemFlag) {
String errorStr = (headErrStr+inputItemErrStr).length()>1000? (headErrStr+inputItemErrStr).substring(0,1000) : (headErrStr+inputItemErrStr);
errItemList.add(getErrorItem(inputItem, errorStr));
}
}
//返回信息设置
responseMsg.setINSTANCE_ID(new BigDecimal(0));
if (errItemList.size()>0) {
errCol.setErrorItem(errItemList);
responseMsg.setErrorCollection(errCol); //错误时才返回ErrorCollection
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
responseMsg.setSERVICE_MESSAGE("处理失败!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "处理失败");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
} else {
respCol.setResponseItem(respList);
responseMsg.setResponseCollecion(respCol); //成功时才返回ResponseCollection
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_TRUE);
responseMsg.setSERVICE_MESSAGE("处理成功!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_SUCCESSFUL);
map.put(Constants.MapResult.MAP_RESULTMSG, "执行成功");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
}
} catch (Exception e) {
e.printStackTrace();
//返回信息设置
errCol.setErrorItem(errItemList);
//respCol.setResponseItem(respList);
responseMsg.setErrorCollection(errCol);
//responseMsg.setResponseCollecion(respCol);
responseMsg.setINSTANCE_ID(new BigDecimal(0));
responseMsg.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
responseMsg.setSERVICE_MESSAGE("处理失败!");
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "处理失败");
map.put(Constants.MapResult.MAP_RESULTOBJ, responseMsg);
return map;
}
}
/**
* 返回的错误实体
* @param inputItem
* @return
*/
private ErrorItem getErrorItem(SB_UC_UC_ImportContractInfoSrvInputItem inputItem,String errMsg) {
ErrorItem errorItem = new ErrorItem();
//errorItem.setENTITY_NAME(inputItem.getCONTRACT_NAME());
errorItem.setENTITY_NAME("CONTRACT");
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setERROR_MESSAGE(errMsg);
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setRECORD_NUMBER(inputItem.getCONTRACT_NUMBER());
errorItem.setCONTRACT_ID(inputItem.getCONTRACT_ID());
return errorItem;
}
@Override
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
return null;
}
/**
* 验证报文头
* @param msgHead
* @return
* @deprecated
*/
private HashMap<String, Object> validateMsgHead(MsgHeader msgHead) {
boolean flag = true;
HashMap<String, Object> returnMap = new HashMap<String, Object>();
List<String> errList = new ArrayList<String>();
if (msgHead.getSOURCE_SYSTEM_ID() == null || msgHead.getSOURCE_SYSTEM_ID().length() == 0) {
flag = false;
errList.add("源系统ID不能为空!");
}
if(msgHead.getSOURCE_SYSTEM_NAME() == null || msgHead.getSOURCE_SYSTEM_NAME().length() == 0) {
flag = false;
errList.add("源系统名称不能为空!");
}
if(msgHead.getUSER_ID() == null || msgHead.getUSER_ID().length() == 0) {
flag = false;
errList.add("用户ID不能为空!");
}
if(msgHead.getUSER_NAME() == null || msgHead.getUSER_NAME().length() == 0) {
flag = false;
errList.add("用户名称不能为空!");
}
returnMap.put("flag", flag);
returnMap.put("errList", errList);
return returnMap;
}
public IImportContractInfoSV getService() {
return (IImportContractInfoSV)ServiceFactory.getService(IImportContractInfoSV.class);
}
}
<file_sep>package com.ai.uchintService.restServer.util;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uchintService.httpServer.dataServ.interfaces.IUipHttpRequestSV;
import com.ai.uchintService.httpServer.dataServ.interfaces.IUipHttpSrvReceiveLogSV;
public class RestUtil {
private static long requestid;
private static long logId;
public static void insertLog(String json, String operateName,
String requestUri) {
try {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER, "01");
IUipHttpRequestSV uipHttpRequestSV = (IUipHttpRequestSV) ServiceFactory
.getService(IUipHttpRequestSV.class);
IUipHttpSrvReceiveLogSV uipHttpSrvReceiveLogSV = (IUipHttpSrvReceiveLogSV) ServiceFactory
.getService(IUipHttpSrvReceiveLogSV.class);
if(json==null){
json="";
}
requestid = uipHttpRequestSV.addRequest(json);
logId = uipHttpSrvReceiveLogSV.insertRecord(operateName,
requestUri, requestid);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void updateLog(String respJson){
try
{
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
IUipHttpRequestSV uipHttpRequestSV = (IUipHttpRequestSV)ServiceFactory.getService(IUipHttpRequestSV.class);
IUipHttpSrvReceiveLogSV uipHttpSrvReceiveLogSV = (IUipHttpSrvReceiveLogSV)ServiceFactory.getService(IUipHttpSrvReceiveLogSV.class);
uipHttpRequestSV.updateRespStringParam(requestid, respJson);
uipHttpSrvReceiveLogSV.updateRecord(logId, null, "", "", "02", "", "", 0, 0, 0);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
<file_sep>package com.ai.uchintService.common.util;
public final class Constants {
/**
* 返回给接口框架返回值定义
*/
public final static class MapResult {
public final static String MAP_RESULTCODE = "resultCode";
public final static String MAP_RESULTMSG = "resultMsg";
public final static String MAP_RESULTOBJ = "retObj";
public final static String MAP_RESULTDETAIL = "resultDetail";
}
/**
* 返回给接口框架返回值定义
*/
public final static class RMSREDUCECODE {
public final static String UC0101 = "UC0101";//渠道业务减收暂估数据
public final static String UC0201 = "UC0201";//渠道业务减收暂估冲销数据
public final static String UC0301 = "UC0301";//渠道业务减收实结数据
public final static String UC1001 = "UC1001";//业业映射关系参数表
public final static String UC1002 = "UC1002";//渠道指标科目参数表
}
/**
* 返回给预存款充值同步的值
*/
public final static class AgentChargeInfoSyncCode {
public final static String CODE0000 = "0000";
public final static String CODE0105 = "0105";
public final static String CODE0106 = "0106";
public final static String CODE0111 = "0111";
}
/**
* 预存营业款和押金保证金
*/
public static String PAY_AGENT_PRE_PAY_RECH_SYNC = "AgentPrePayRechSync_001";
public static String PAY_AGENT_DEPOSIT_RECH_SYNC = "AgentDepositRechSync_001";
/**
* 沃易购余额查询透传接口
*/
public static String QryAgentWOEGOMarginInfoSrv = "QryAgentWOEGOMarginInfoSrv_001";
/**
* 接口编码配置,服务端提供给uip使用
* 格式:buc_接口注释_序列
* 最大长度40
*/
public static String BUC_SB_UC_UC_ImportPaymentResultInfoSrv="buc_paymentResultInfo_001";
public static String SB_UC_UC_ImportContracInfoSrv="buc_importContractInfo_001_01";
public static String SB_EAS_EAS_ImportAmountInfoSrv="buc_amountinfo_001";
public static String SB_UC_UC_ChannelInfoSrv="buc_channelInfo_001_01";
public static String SB_UC_UC_DepartmentInfoSrv="buc_departmentInfo_001_01";
public static String SB_UC_UC_ImportCnapsCodeInfoSrv="buc_CnapsCodeInfo_001";
public static String SB_UC_UC_InquiryUCInputVATMatchInfoSrv="buc_inquiryUCInputVATMatchInfo_001";
//黑卡专项
public static String ECIP_InquiryChannelInfoSrv = "ecip_inquirychannelinfosrv_001";
public static String CHANNEL_INFO_0000 = "0000";
public static String CHANNEL_INFO_9999 = "9999";
public static String CHANNEL_INFO_00 = "00";
public static String CHANNEL_INFO_01 = "01";
public static String CHANNEL_INFO_02 = "02";
//合作方导入@20141020
public static String SB_UC_UC_ImportPartnerInfoSrv="buc_partnerinfo_001";
/**一次最大能够处理的数量*/
public final static int PROCESS_MAX_PAGE_SIZE = 1000; //由1000改为了1,为了测试的方便,
/**分页中的TOTAL_RECORD*/
public final static int PAGE_TOTAL_RECORD = -1;
/**省份编码转换 参数类型*/
public final static String CFG_CODE_TRANS_SOA_AREA = "SOA_AREA";
/**
* 沃易购审批状态
*/
public static final String WOEGSTATUS_00 = "00";
public static final String WOEGSTATUS_01 = "01";
public static final String WOEGSTATUS_02 = "02";
/**
* 验证范围的数组
*/
public static String[] TD_M_PAYMENT_INI_PAY_AMOUNT_STRS={"1","2","3","4","5","6","7","8","9","0","."};
/**
* 业务小类固定值
*/
public static String BUSI_SUB_TYPE = "21210201220101";
/**
* 对方返回处理结果 Y成功 N失败 R审批退回
*/
public static String PUBLISH_RESULT_CODE_Y = "Y";
public static String PUBLISH_RESULT_CODE_N = "N";
public static String PUBLISH_RESULT_CODE_R = "R";
public static String PUBLISH_RETURN_FLAG_S = "SUCCESS";
public static String PUBLISH_RETURN_FLAG_F = "FAIL";
public static String PUBLISH_RETURN_FLAG_R = "RETURN";
/**
* 对端返回对应表里面的状态
*/
public static String RESULT_CODE_STATUS_Y = "10";
public static String RESULT_CODE_STATUS_N = "4";
public static String RESULT_CODE_STATUS_R = "3";
/**
* 更新员工UPDATE_STAFF_ID
*/
public static String UPDATE_STAFF_ID_VALUE = "100";
/**
* 输出包头SERVICE_FLAG
*/
public static String SERVICE_FLAG_FALSE = "FALSE";
public static String SERVICE_FLAG_TRUE = "TRUE";
/**
* MsgHeader 系统ID和系统名
*/
public static String SOURCE_SYSTEM_ID = "EAS";
public static String SOURCE_SYSTEM_NAME = "报账系统";
public static String SOURCE_SYSTEM_ID_ERP = "ERP";
public static String SOURCE_SYSTEM_NAME_ERP = "ERP系统";
public static String USER_ID= "UC";
public static String USER_NAME = "渠道系统";
/**
* 沃易购系统
*/
public static String WO_UC_ImportAgentInfoSrv="buc_wo_importagentinfo_001_01";
public static String WO_UC_InquiryAgentAuditInfoSrvOUT="buc_wo_inquiryagentauditinfo_001_01";
public static String WOEGOU_SYSTEM_ID = "WOEGO";
/**
* 沃易购系统报文标识
*/
public static String WOEGOU_AGENT_TYPE_1 = "1";
public static String WOEGOU_AGENT_TYPE_2 = "2";
public static String WOEGOU_ATTACHMEN_FLAG_0 = "0";
public static String WOEGOU_ATTACHMEN_FLAG_1 = "1";
public static String WOEGOU_TAXPAYER_TYPE_0 = "0";
public static String WOEGOU_TAXPAYER_TYPE_1 = "1";
public static String WOEGOU_TAXPAYER_TYPE_2 = "2";
/**
* 沃易购输出包头RSPCODE
*/
public static String WOEGOU_RSPCODE_0000 = "0000"; //处理成功
public static String WOEGOU_RSPCODE_1100 = "1100";//报文体内容超过500条
public static String WOEGOU_RSPCODE_1000 = "1000";//渠道系统入库失败
public static String WOEGOU_RSPCODE_1001 = "1001";//报文字段格式错误
public static String WOEGOU_RSPCODE_1002 = "1002";//报文字段长度错误
public static String WOEGOU_RSPCODE_1003 = "1003";//解析请求报文失败
public static String WOEGOU_RSPCODE_1004 = "1004";//报文头信息不正确
public static String WOEGOU_RSPCODE_1101 = "1101";//代理商信息已经存在
public static String WOEGOU_RSPCODE_1102 = "1102";//代理商信息入库异常
public static String WOEGOU_RSPCODE_1103 = "1103";//AgentID在数据库中无记录
public static String WOEGOU_ORDER_STATE = "1";//沃易购订单状态
public static String WOEGOU_AGENT_FLAG = "3";//沃易购代理商标识
public static String WOEGOU_APPROVAL_STATUS_00 = "00";//沃易购订单审批状态 待补入
public static String WOEGOU_BUSI_OPER_1000 = "1000";
/**
* 财务调用服务端返回
*/
/** * 成功 */
public static String TF_CHL_PAY_APPLY_RESP_SUCCESS = "0000";
/** * 数据校验不通过 */
public static String TF_CHL_PAY_APPLY_RESP_CODE_ERROR = "1901";
/** * 其它错误 */
public static String TF_CHL_PAY_APPLY_RESP_CODE_OTHER = "8888";
/**
* 返回包标识
*/
public static String retMap_TAG="tag";
public static String retMap_ERRORList="errorList";
/**
* 清帐单返回包标识
*/
public static String QZMap_TAG="tag";
public static String QZMap_ErrorInfo="errorInfo";
public static String QZMap_ErrorList="errorList";
/**
* 返回给接口框架返回值resultCode
*/
public final static class MapResultCode {
public final static String CODE_FORMAT_ERROR="3";
public final static String CODE_TIMEOUT="1";
public final static String CODE_AUTHORITY_CHECK_ERROR="2";
public final static String CODE_TERMINAL_SYSTEM_ERROR="4";
public final static String CODE_OTHER_ERROR="9";
public final static String CODE_SUCCESSFUL="0";
}
/**
* ERP FTP文件接口subject_id
*/
public final static class ERPFtpFileSubjectId {
//预提
public final static int SUBJECT_ID_WITHHOLDING=100;
//应付
public final static int SUBJECT_ID_PAYABLE=200;
//实付
public final static int SUBJECT_ID_FACTPAYMENT=300;
//税金
public final static int SUBJECT_ID_TAXES=400;
}
/**
* ERP业务类型编码
*/
public final static class ERPFtpBCodeType {
//预提
public static final String BCODE_WITHHOLDING = "UC01";
//应付
public static final String BCODE_PAYABLE = "UC02";
//实付
public static final String BCODE_FACTPAYMENT = "UC04";
//税金
public static final String BCODE_TAXES = "UC03";
//预提冲销
public static final String BCODE_Eliminations = "UC05";
}
/**
* 分中心配置
*/
public static String DATASOURCE_CENTER="qudao";
public static String DATASOURCE_CENTER_QZ="qingzhang";
/**
* SEQ
*/
//public static String RECORD_ID$SEQ="RECORD_";
public static String RECORD_ID$SEQ="RECORD_ID$SEQ";
public static String SERIAL_NO$SEQ="TF_CHL_PAY_A_S$SERIAL_";
public static String T_CHL_INVOICE_PACKAGE$ID="T_CHL_INVOICE_PACKAGE$ID$SEQ";
/**
* td_m_area
*/
public static String TD_M_AREA_09="09";
/**
* 结算对象类型
*/
public static String PAY_OBJECT_TYPE_CHNL = "01";
public static String PAY_OBJECT_TYPE_OBJECT = "02";
/**
* 导入合同接口:补录标志
*/
public static String SUPPLY_FLAG_WBR = "00";
/**
* 导入合同接口:数据来源
*/
public static String DATA_SOURCES_ZS = "01";
/**
* 文件上传状态
*/
//生成空文件未上传
public static String FILE_STATE_UNDO = "1";
//上传成功
public static String FILE_STATE_SUCC = "2";
//上传失败
public static String FILE_STATE_FAIL = "3";
//TF_CHL_INVOICE_PACKAGE表STATUS字段
public static String INVOICE_PACKAGE_STATUS_SUCCESS = "06";
public static String INVOICE_PACKAGE_STATUS_FAIL = "04";
public static String INVOICE_PACKAGE_STATUS_EXCEPTION = "09";
public static String INVOICE_PACKAGE_STATUS_DOING = "00";
//营改增科目
public static String INVOICE_CONCATENATED_SEGMENTS_A = "999.0.00.888.0.0.00.0.0";
public static String INVOICE_CONCATENATED_SEGMENTS_B = "999.0.00.888.0.0.00.0.0";
//接口数据源
public static String DATA_SOURCES_JK = "01";
//O:打开,P:永久关闭,C:已关闭,F:将来-录入,N,从未打开
public static String CLOSING_STATUS_SUCCESS = "O";
//营改增公司段
public static String COMPANY_SEGMENT = "999";
/**
* 文件上传多文件分割符
* @author liangwei
*
*/
public static String FTPFILENAMES = "&";
/**
* 代理商资金归集
* @author homax
*
*/
public final static class Agent {
/**
* operate_code
*/
public final static String ORDER_SUB = "agent_orderSus_001";
public final static String ACCT_INFO = "agent_acctInfo001";
public final static String Bank_Payment_Schema = "Payment_Schema_001";
public final static String BANK_REALPAYMENT_FUNDNOTIFY = "paymentrefundnotify_001";
public final static String QRY_PAY_INFO = "qry_pay_info_001";
public final static String ACTION_TYPE_CONTRACT_ADD = "0130";
public final static String ACTION_TYPE_CONTRACT_DEL= "0133";
public final static String MSG_SENDER_CCNL ="CCNL";
public final static String MSG_SERVER_BSS="BSS";
public final static String MSG_SERVER_EPAY="EPAY";
public final static String TRADE_HISTORY_INFO = "trade_historyInfo001";
public final static String AGENCY_SIGN_QIAN_TADE = "SIGN_QIAN_TADE_001";
public final static String AGENCY_SIGN_CALL_TADE = "SIGN_CALL_TADE_001";
//协议信息查询接口
public final static String AGENCY_SIGN_QUERY_SER = "SIGN_QUERY_SER_001";
}
}
<file_sep>package com.ai.uip.ejb.interfaces;
import com.ai.uint.ejb.vo.FtpSVRequestVO;
import com.ai.uint.ejb.vo.FtpSVResponseVO;
import com.ai.uint.ejb.vo.PassEjbSVRequestVO;
import com.ai.uint.ejb.vo.PassEjbSVResponseVO;
import com.ai.uint.ejb.vo.PrechekRequestVO;
import com.ai.uint.ejb.vo.PrecheckResponseVO;
public interface UipUchlEjbSVRemote {
//发送服务
public PrecheckResponseVO process(PrechekRequestVO requestParam);
//直接调用其他系统EJB服务
public PassEjbSVResponseVO passEjbSV(PassEjbSVRequestVO requestParam);
//重发服务
public void reProcess(long detailId);
//刷参服务
public void refreshConfParam();
//上传对账文件回执
public FtpSVResponseVO ftpFile(FtpSVRequestVO requestVO);
//刷参服务
public void refreshEjbCallType(String type);
//联行号重发功能
public void cnapsCodeRedo(long logID);
}
<file_sep>package com.unicom.ecip.inquirychannelinfosrv;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;
/**
* This class was generated by Apache CXF 2.7.11
* 2015-03-04T11:41:01.200+08:00
* Generated source version: 2.7.11
*
*/
@WebServiceClient(name = "InquiryChannelInfoSrv",
wsdlLocation = "InquiryChannelInfoSrv.wsdl",
targetNamespace = "http://ecip.unicom.com/InquiryChannelInfoSrv")
public class InquiryChannelInfoSrv_Service extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://ecip.unicom.com/InquiryChannelInfoSrv", "InquiryChannelInfoSrv");
public final static QName InquiryChannelInfoSrvPort = new QName("http://ecip.unicom.com/InquiryChannelInfoSrv", "InquiryChannelInfoSrvPort");
static {
URL url = InquiryChannelInfoSrv_Service.class.getResource("InquiryChannelInfoSrv.wsdl");
if (url == null) {
url = InquiryChannelInfoSrv_Service.class.getClassLoader().getResource("InquiryChannelInfoSrv.wsdl");
}
if (url == null) {
java.util.logging.Logger.getLogger(InquiryChannelInfoSrv_Service.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "InquiryChannelInfoSrv.wsdl");
}
WSDL_LOCATION = url;
}
public InquiryChannelInfoSrv_Service(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public InquiryChannelInfoSrv_Service(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public InquiryChannelInfoSrv_Service() {
super(WSDL_LOCATION, SERVICE);
}
/*
//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
public InquiryChannelInfoSrv_Service(WebServiceFeature ... features) {
super(WSDL_LOCATION, SERVICE, features);
}
//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
public InquiryChannelInfoSrv_Service(URL wsdlLocation, WebServiceFeature ... features) {
super(wsdlLocation, SERVICE, features);
}
//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
public InquiryChannelInfoSrv_Service(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
super(wsdlLocation, serviceName, features);
}
*/
/**
*
* @return
* returns InquiryChannelInfoSrv
*/
@WebEndpoint(name = "InquiryChannelInfoSrvPort")
public InquiryChannelInfoSrv getInquiryChannelInfoSrvPort() {
return super.getPort(InquiryChannelInfoSrvPort, InquiryChannelInfoSrv.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns InquiryChannelInfoSrv
*/
@WebEndpoint(name = "InquiryChannelInfoSrvPort")
public InquiryChannelInfoSrv getInquiryChannelInfoSrvPort(WebServiceFeature... features) {
return super.getPort(InquiryChannelInfoSrvPort, InquiryChannelInfoSrv.class, features);
}
}
<file_sep>
package cn.chinaunicom.ws.agencybankpaymentser.unibssbody.agencysigncontracttradereq;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="TRADE_TYPE_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4"/>
* <minLength value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AGENCY_SIGN_LIST" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CHNL_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_KIND_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AGENCY_SERIAL_NUMBER" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTRACT_INFO">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CONTRACT_NUMBER">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LEVEL_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EVERYTIME_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DATE_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREDIT_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SIGN_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CARD_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACCOUNT_LAST_FOUR">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4"/>
* <minLength value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_CERTTYPEID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_CERTNUM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"tradeTYPECODE",
"orderID",
"agencySIGNLIST"
})
@XmlRootElement(name = "AGENCY_SIGN_CONTRACT_REQ")
public class AGENCY_SIGN_CONTRACT_REQ {
@XmlElement(name = "TRADE_TYPE_CODE", required = true)
protected String tradeTYPECODE;
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "AGENCY_SIGN_LIST")
protected List<AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST> agencySIGNLIST;
/**
* Gets the value of the trade_TYPE_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTRADE_TYPE_CODE() {
return tradeTYPECODE;
}
/**
* Sets the value of the trade_TYPE_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTRADE_TYPE_CODE(String value) {
this.tradeTYPECODE = value;
}
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the agencySIGNLIST property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the agencySIGNLIST property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAGENCY_SIGN_LIST().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST }
*
*
*/
public List<AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST> getAGENCY_SIGN_LIST() {
if (agencySIGNLIST == null) {
agencySIGNLIST = new ArrayList<AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST>();
}
return this.agencySIGNLIST;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CHNL_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_KIND_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AGENCY_SERIAL_NUMBER" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTRACT_INFO">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CONTRACT_NUMBER">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LEVEL_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EVERYTIME_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DATE_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREDIT_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SIGN_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CARD_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACCOUNT_LAST_FOUR">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4"/>
* <minLength value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_CERTTYPEID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_CERTNUM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"chnlCODE",
"chnlNAME",
"chnlKINDID",
"provinceCODE",
"cityCODE",
"managerAREACODE",
"agencySERIALNUMBER",
"contractINFO",
"para"
})
public static class AGENCY_SIGN_LIST {
@XmlElement(name = "CHNL_CODE", required = true)
protected String chnlCODE;
@XmlElement(name = "CHNL_NAME")
protected String chnlNAME;
@XmlElement(name = "CHNL_KIND_ID", required = true)
protected String chnlKINDID;
@XmlElement(name = "PROVINCE_CODE")
protected String provinceCODE;
@XmlElement(name = "CITY_CODE")
protected String cityCODE;
@XmlElement(name = "MANAGER_AREA_CODE")
protected String managerAREACODE;
@XmlElement(name = "AGENCY_SERIAL_NUMBER")
protected String agencySERIALNUMBER;
@XmlElement(name = "CONTRACT_INFO", required = true)
protected AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.CONTRACT_INFO contractINFO;
@XmlElement(name = "PARA")
protected List<AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.PARA> para;
/**
* Gets the value of the chnl_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CODE() {
return chnlCODE;
}
/**
* Sets the value of the chnl_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CODE(String value) {
this.chnlCODE = value;
}
/**
* Gets the value of the chnl_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_NAME() {
return chnlNAME;
}
/**
* Sets the value of the chnl_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_NAME(String value) {
this.chnlNAME = value;
}
/**
* Gets the value of the chnl_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_KIND_ID() {
return chnlKINDID;
}
/**
* Sets the value of the chnl_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_KIND_ID(String value) {
this.chnlKINDID = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the manager_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_AREA_CODE() {
return managerAREACODE;
}
/**
* Sets the value of the manager_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_AREA_CODE(String value) {
this.managerAREACODE = value;
}
/**
* Gets the value of the agency_SERIAL_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAGENCY_SERIAL_NUMBER() {
return agencySERIALNUMBER;
}
/**
* Sets the value of the agency_SERIAL_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAGENCY_SERIAL_NUMBER(String value) {
this.agencySERIALNUMBER = value;
}
/**
* Gets the value of the contract_INFO property.
*
* @return
* possible object is
* {@link AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.CONTRACT_INFO }
*
*/
public AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.CONTRACT_INFO getCONTRACT_INFO() {
return contractINFO;
}
/**
* Sets the value of the contract_INFO property.
*
* @param value
* allowed object is
* {@link AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.CONTRACT_INFO }
*
*/
public void setCONTRACT_INFO(AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.CONTRACT_INFO value) {
this.contractINFO = value;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.PARA }
*
*
*/
public List<AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.PARA> getPARA() {
if (para == null) {
para = new ArrayList<AGENCY_SIGN_CONTRACT_REQ.AGENCY_SIGN_LIST.PARA>();
}
return this.para;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CONTRACT_NUMBER">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LEVEL_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EVERYTIME_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DATE_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREDIT_VALUE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SIGN_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CARD_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACCOUNT_LAST_FOUR">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4"/>
* <minLength value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_CERTTYPEID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACTOR_CERTNUM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"contractNUMBER",
"levelVALUE",
"everytimeVALUE",
"dateVALUE",
"creditVALUE",
"signDATE",
"bankNAME",
"bankCARDTYPE",
"accountLASTFOUR",
"actorNAME",
"actorCERTTYPEID",
"actorCERTNUM"
})
public static class CONTRACT_INFO {
@XmlElement(name = "CONTRACT_NUMBER", required = true)
protected String contractNUMBER;
@XmlElement(name = "LEVEL_VALUE")
protected String levelVALUE;
@XmlElement(name = "EVERYTIME_VALUE")
protected String everytimeVALUE;
@XmlElement(name = "DATE_VALUE")
protected String dateVALUE;
@XmlElement(name = "CREDIT_VALUE")
protected String creditVALUE;
@XmlElement(name = "SIGN_DATE")
protected String signDATE;
@XmlElement(name = "BANK_NAME", required = true)
protected String bankNAME;
@XmlElement(name = "BANK_CARD_TYPE", required = true)
protected String bankCARDTYPE;
@XmlElement(name = "ACCOUNT_LAST_FOUR", required = true)
protected String accountLASTFOUR;
@XmlElement(name = "ACTOR_NAME")
protected String actorNAME;
@XmlElement(name = "ACTOR_CERTTYPEID")
protected String actorCERTTYPEID;
@XmlElement(name = "ACTOR_CERTNUM")
protected String actorCERTNUM;
/**
* Gets the value of the contract_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTRACT_NUMBER() {
return contractNUMBER;
}
/**
* Sets the value of the contract_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTRACT_NUMBER(String value) {
this.contractNUMBER = value;
}
/**
* Gets the value of the level_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLEVEL_VALUE() {
return levelVALUE;
}
/**
* Sets the value of the level_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLEVEL_VALUE(String value) {
this.levelVALUE = value;
}
/**
* Gets the value of the everytime_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEVERYTIME_VALUE() {
return everytimeVALUE;
}
/**
* Sets the value of the everytime_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEVERYTIME_VALUE(String value) {
this.everytimeVALUE = value;
}
/**
* Gets the value of the date_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDATE_VALUE() {
return dateVALUE;
}
/**
* Sets the value of the date_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDATE_VALUE(String value) {
this.dateVALUE = value;
}
/**
* Gets the value of the credit_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREDIT_VALUE() {
return creditVALUE;
}
/**
* Sets the value of the credit_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREDIT_VALUE(String value) {
this.creditVALUE = value;
}
/**
* Gets the value of the sign_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSIGN_DATE() {
return signDATE;
}
/**
* Sets the value of the sign_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSIGN_DATE(String value) {
this.signDATE = value;
}
/**
* Gets the value of the bank_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NAME() {
return bankNAME;
}
/**
* Sets the value of the bank_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NAME(String value) {
this.bankNAME = value;
}
/**
* Gets the value of the bank_CARD_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_CARD_TYPE() {
return bankCARDTYPE;
}
/**
* Sets the value of the bank_CARD_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_CARD_TYPE(String value) {
this.bankCARDTYPE = value;
}
/**
* Gets the value of the account_LAST_FOUR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getACCOUNT_LAST_FOUR() {
return accountLASTFOUR;
}
/**
* Sets the value of the account_LAST_FOUR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setACCOUNT_LAST_FOUR(String value) {
this.accountLASTFOUR = value;
}
/**
* Gets the value of the actor_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getACTOR_NAME() {
return actorNAME;
}
/**
* Sets the value of the actor_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setACTOR_NAME(String value) {
this.actorNAME = value;
}
/**
* Gets the value of the actor_CERTTYPEID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getACTOR_CERTTYPEID() {
return actorCERTTYPEID;
}
/**
* Sets the value of the actor_CERTTYPEID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setACTOR_CERTTYPEID(String value) {
this.actorCERTTYPEID = value;
}
/**
* Gets the value of the actor_CERTNUM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getACTOR_CERTNUM() {
return actorCERTNUM;
}
/**
* Sets the value of the actor_CERTNUM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setACTOR_CERTNUM(String value) {
this.actorCERTNUM = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraID",
"paraVALUE"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraID;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.IUC_TD_MDM_AREAValue;
public class UC_TD_MDM_AREABean extends DataContainer implements DataContainerInterface,IUC_TD_MDM_AREAValue{
private static String m_boName = "bo.UC_TD_MDM_AREA";
public final static String S_State = "STATE";
public final static String S_ParentAreaCode = "PARENT_AREA_CODE";
public final static String S_AreaName = "AREA_NAME";
public final static String S_AreaCode = "AREA_CODE";
public final static String S_AreaLevel = "AREA_LEVEL";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UC_TD_MDM_AREABean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("此种数据容器不能重置业务对象类型");
}
public void initState(String value){
this.initProperty(S_State,value);
}
public void setState(String value){
this.set(S_State,value);
}
public void setStateNull(){
this.set(S_State,null);
}
public String getState(){
return DataType.getAsString(this.get(S_State));
}
public String getStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_State));
}
public void initParentAreaCode(String value){
this.initProperty(S_ParentAreaCode,value);
}
public void setParentAreaCode(String value){
this.set(S_ParentAreaCode,value);
}
public void setParentAreaCodeNull(){
this.set(S_ParentAreaCode,null);
}
public String getParentAreaCode(){
return DataType.getAsString(this.get(S_ParentAreaCode));
}
public String getParentAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ParentAreaCode));
}
public void initAreaName(String value){
this.initProperty(S_AreaName,value);
}
public void setAreaName(String value){
this.set(S_AreaName,value);
}
public void setAreaNameNull(){
this.set(S_AreaName,null);
}
public String getAreaName(){
return DataType.getAsString(this.get(S_AreaName));
}
public String getAreaNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_AreaName));
}
public void initAreaCode(String value){
this.initProperty(S_AreaCode,value);
}
public void setAreaCode(String value){
this.set(S_AreaCode,value);
}
public void setAreaCodeNull(){
this.set(S_AreaCode,null);
}
public String getAreaCode(){
return DataType.getAsString(this.get(S_AreaCode));
}
public String getAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AreaCode));
}
public void initAreaLevel(int value){
this.initProperty(S_AreaLevel,new Integer(value));
}
public void setAreaLevel(int value){
this.set(S_AreaLevel,new Integer(value));
}
public void setAreaLevel(Integer value){
this.set(S_AreaLevel,value);
}
public Integer getAreaLevelAsInteger(){
return (Integer )this.get(S_AreaLevel);
}
public void setAreaLevelNull(){
this.set(S_AreaLevel,null);
}
public int getAreaLevel(){
return DataType.getAsInt(this.get(S_AreaLevel));
}
public int getAreaLevelInitialValue(){
return DataType.getAsInt(this.getOldObj(S_AreaLevel));
}
}
<file_sep>package com.unicom.ecip.inquirychannelinfosrv;
import java.util.HashMap;
import java.util.logging.Logger;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.recif.IRecIfProcessorSRV;
@javax.jws.WebService(
serviceName = "InquiryChannelInfoSrv",
portName = "InquiryChannelInfoSrvPort",
targetNamespace = "http://ecip.unicom.com/InquiryChannelInfoSrv",
// wsdlLocation = "file:/D:/src/workspace/uip-uc_dev/wsdl/ImportAgentInfoSrv/importAgentInfoSrv.wsdl",
wsdlLocation = "classpath:wsdl/InquiryChannelInfoSrv/InquiryChannelInfoSrv.wsdl",
endpointInterface = "com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrv")
public class InquiryChannelInfoSrvImpl implements InquiryChannelInfoSrv {
private static final Logger LOG = Logger.getLogger(InquiryChannelInfoSrvImpl.class.getName());
@SuppressWarnings("unchecked")
@Override
public InquiryChannelInfoSrvOUT process(InquiryChannelInfoSrvIN payload) {
LOG.info("Executing operation process");
System.out.println(payload);
try {
IRecIfProcessorSRV recIfProcessorSRV = (IRecIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.ECIP_InquiryChannelInfoSrv, payload);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
InquiryChannelInfoSrvOUT _return = (InquiryChannelInfoSrvOUT)map.get(Constants.MapResult.MAP_RESULTOBJ);
// ImportAgentInfoSrvOUT _return = new ImportAgentInfoSrvOUT();
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.client.amountInfo;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IImportAmountInfoSV;
import com.ai.uchintService.common.bo.UCH_TF_CHL_PAY_APPLY_DETAILBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_CHANNELBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_DEVELOPERBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uint.ftp.impl.DownloadFileTimerPorcessSVImpl;
import com.ai.uip.core.util.WSUtil;
import com.ai.uip.platform.IPublishIfBase;
import com.ai.uip.platform.vo.PublishIfCfgVo;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.AMOUNT_LINE_INFOCollection;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.AMOUNT_LINE_INFOItem;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.ErrorCollection;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.ErrorItem;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.SB_EAS_EAS_ImportAmountInfoSrvInputCollection;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.SB_EAS_EAS_ImportAmountInfoSrvInputItem;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.SB_EAS_EAS_ImportAmountInfoSrvRequest;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.SB_EAS_EAS_ImportAmountInfoSrvResponse;
import com.unicom.mss.soa.msgheader.MsgHeader;
/**
* 提供实付信息的操作
*
* @author zhoujm
*/
public class ImportAmountInfoPublishImpl implements IPublishIfBase {
private static final Log logger = LogFactory
.getLog(ImportAmountInfoPublishImpl.class);
/**
* 生成发送的数据
*/
@Override
public HashMap<String, Object> pubIfParamGen(List<String> contentIdLst,
PublishIfCfgVo ifVo, Long logId, String syncType,
HashMap<String, Long> batchMap) {
MsgHeader msgHeader = new MsgHeader();
SB_EAS_EAS_ImportAmountInfoSrvRequest req = new SB_EAS_EAS_ImportAmountInfoSrvRequest();
SB_EAS_EAS_ImportAmountInfoSrvInputCollection Collection = new SB_EAS_EAS_ImportAmountInfoSrvInputCollection();
List<SB_EAS_EAS_ImportAmountInfoSrvInputItem> amountInfoList = new ArrayList<SB_EAS_EAS_ImportAmountInfoSrvInputItem>();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_SUCCESSFUL);
map.put(Constants.MapResult.MAP_RESULTMSG, "成功");
HashMap<String, String> tempMap = new HashMap<String, String>();
/** 1 循环内容ID列表 支付信息列表组成 */
for (int i = 0; i < contentIdLst.size(); i++) {
//paybatchid_provice_code
//123_09
String[] temp=contentIdLst.get(i).split(";");
String pay_batch_id = null;
String emailStr = null;
String pay_line = null;
//省份代码
String proviceCode = null;
if(temp.length==4){
pay_batch_id = temp[0];
//省份代码
proviceCode = temp[1];
//邮箱
emailStr = temp[2];
//支付通道
pay_line = temp[3];
}else{
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "contentId格式不正确");
map.put(Constants.MapResult.MAP_RESULTOBJ, req);
return map;
}
// 1.取pay_batch_id
// 2.根据pay_batch_id到tf_chl_pay_apply表取记录 (多条)amountBeans
// 3.遍历amountBeans 数组转成相应的AMOUNT_LINE_INFOItem 放到list
SB_EAS_EAS_ImportAmountInfoSrvInputItem amountItem = null;
UC_TF_CHL_PAY_APPLYBean amountBean = null;
try {
// UC_TF_CHL_PAY_APPLYBean[] payBeans = UC_TF_CHL_PAY_APPLYEngine
// .getBeans(
// "1=1 and PAY_BATCH_ID='" + pay_batch_id + "'",
// new HashMap());
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,proviceCode);
UC_TF_CHL_PAY_APPLYBean[] payBeans =getSevice().getPayBeans(pay_batch_id,proviceCode);
List<AMOUNT_LINE_INFOItem> amountlineList = new ArrayList<AMOUNT_LINE_INFOItem>();
AMOUNT_LINE_INFOCollection amountCollection = new AMOUNT_LINE_INFOCollection();
/* 插入实体类信息 */
AMOUNT_LINE_INFOItem amountlineItem = null;
if (payBeans != null && payBeans.length > 0) {
Double sumAmount = 0.00;
for (int j = 0; j < payBeans.length; j++) {
amountlineItem = new AMOUNT_LINE_INFOItem();
amountBean = payBeans[j];
//取渠道资料库
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
//UC_TF_CHL_CHANNELBean chlbean = UC_TF_CHL_CHANNELEngine.getBean(Long.valueOf(amountBean.getChnlId()));
/*记录的唯一标识*/
amountlineItem.setPRI_KEY(String.valueOf(logId)+ String.valueOf(j));
/* 批次号 */
amountlineItem.setBATCH_ID(amountBean.getPayBatchId());
/* 头ID */
amountlineItem.setHEADER_ID(amountBean.getPayBatchId());
/* 行ID */
amountlineItem.setLINE_ID(amountBean.getLineNo() + "");
/* 单据编号 */
amountlineItem.setBILL_NO(amountBean.getBillNo() + "");
/* 业务小类 */
amountlineItem.setBUSI_SUB_TYPE(Constants.BUSI_SUB_TYPE);
// if(chlbean!=null){
/* 渠道名称 */
if(amountBean.getPayObjectType().equals(Constants.PAY_OBJECT_TYPE_OBJECT)){
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
UC_TF_CHL_DEVELOPERBean developer = getSevice().getDeveloperBean(amountBean.getPayObjectId());
if(developer!=null){
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,proviceCode);
UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetail = getSevice().getApplyDetailbean(amountBean.getSerialNo(),proviceCode)[0];
if(applyDetail!=null){
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
UC_TF_CHL_CHANNELBean chlbean=getSevice().getChlbean(applyDetail.getAgentChnlId());
if(chlbean!=null){
String vendorName = "";
if(developer.getDevName()!=null&&!"".equals(developer.getDevName())){
vendorName = chlbean.getChnlName()+":"+developer.getDevName();
}else{
vendorName = chlbean.getChnlName()+":"+amountBean.getBankAcctName();
}
amountlineItem.setVENDOR_NAME(vendorName);
}
}
}
/* 渠道编码 */
amountlineItem.setVENDOR_NUMBER(developer.getDevCode());
}else{
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
/* 渠道编码 */
UC_TF_CHL_CHANNELBean chlbean=getSevice().getChlbean(amountBean.getPayObjectId());
if(chlbean!=null){
amountlineItem.setVENDOR_NUMBER(chlbean.getChnlCode());
amountlineItem.setVENDOR_NAME(chlbean.getChnlName());
}
}
// }
/* 本位币付款金额 */
DecimalFormat df = new DecimalFormat("#0.00#");
String inipayAmount = df.format(amountBean.getPayMoney());
amountlineItem.setINI_PAY_AMOUNT(new BigDecimal(inipayAmount));
sumAmount += amountBean.getPayMoney();
/* 收款方开户银行 */
amountlineItem.setPAYER_BANK_NAME(amountBean.getBankCode());
/* 收款方银行账户名称 */
amountlineItem.setBANK_ACCOUNT_NAME(amountBean.getBankAcctName());
/* 收款方银行账号 */
amountlineItem.setBANK_ACCOUNT_NUM(amountBean.getBankNo());
/*关联公司往来段*/
String segMent5="0";
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"98");
segMent5 = getSevice().getSegMent5(amountlineItem.getVENDOR_NUMBER());
amountlineItem.setSEGMENT5(segMent5);
amountlineList.add(amountlineItem);
}
/**插入实付基本信息*/
amountCollection.setAMOUNT_LINE_INFOItem(amountlineList);
amountItem = new SB_EAS_EAS_ImportAmountInfoSrvInputItem();
amountItem.setAMOUNT_LINE_INFO(amountCollection);
/*记录的唯一标识*/
amountItem.setPRI_KEY(String.valueOf(logId));
/* 批次号 */
amountItem.setBATCH_ID(payBeans[0].getPayBatchId());
/* 头ID */
amountItem.setHEADER_ID(payBeans[0].getPayBatchId());
/* 数据来源 */
amountItem.setSOURCE_NAME("UC");
/* 省份代码 */
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
String proviceCode2 = BucUtil.getCfgCodeDesc( Constants.CFG_CODE_TRANS_SOA_AREA,proviceCode);
amountItem.setPROVINCE_CODE(proviceCode2);
/* 业务类型 */
amountItem.setBUSI_TYPE(BigDecimal.valueOf(21));
/* 本位币汇总付款金额 */
DecimalFormat df = new DecimalFormat("#0.00#");
String Amount = df.format(sumAmount);
amountItem.setINI_TOTAL_AMOUNT(new BigDecimal(Amount));
/* 币种 */
amountItem.setCURRENCY_CODE("CNY");
/* 支付方式 */
amountItem.setPAY_TYPE("EFT");
/* 单据编号 */
amountItem.setBILL_NO(payBeans[0].getBillNo()+"");
/* 操作类型 */
if(amountBean.getPayState().equals("6")){
amountItem.setOPERATE_TYPE(BigDecimal.valueOf(1));
}else{
amountItem.setOPERATE_TYPE(BigDecimal.valueOf(0));
}
/* 支付发起人邮箱 */
if(emailStr!=null){
amountItem.setPAYER_EMAIL(emailStr);
}
/*行实体总数*/
amountItem.setTOTAL_LINE_QTY(BigDecimal.valueOf(amountCollection.getAMOUNT_LINE_INFOItem().size()));
amountItem.setRESERVED_1(pay_line);
amountInfoList.add(amountItem);
} else {
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "没有取到实体"
+ pay_batch_id + "信息,请检查表数据!");
map.put(Constants.MapResult.MAP_RESULTOBJ, req);
return map;
}
}
catch (Exception e) {
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_OTHER_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "参数组成异常");
e.printStackTrace();
}
}
Collection.setSB_EAS_EAS_ImportAmountInfoSrvInputItem(amountInfoList);
/** 2 包头组成 */
msgHeader.setSOURCE_SYSTEM_ID(Constants.SOURCE_SYSTEM_ID);
msgHeader.setSOURCE_SYSTEM_NAME(Constants.SOURCE_SYSTEM_NAME);
msgHeader.setUSER_ID(Constants.USER_ID);
msgHeader.setUSER_NAME(Constants.USER_NAME);
msgHeader.setSUBMIT_DATE(CastUtil.getCurrentTimestamp());
/** 3 放入请求对象中 */
req.setMsgHeader(msgHeader);
req.setSB_EAS_EAS_ImportAmountInfoSrvInputCollection(Collection);
/** 4 放入map中 */
map.put(Constants.MapResult.MAP_RESULTOBJ, req);
return map;
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg,
PublishIfCfgVo ifVo, Long logId,List<String> contentIdLst,HashMap<String,Long> batchMap ) {
SB_EAS_EAS_ImportAmountInfoSrvResponse repObj = (SB_EAS_EAS_ImportAmountInfoSrvResponse) ifMsg;
HashMap<String, Object> resultMap = new HashMap<String, Object>();
/**
* 取省份代码
*/
String proviceCode ="";
String payBatchId = "";
if(contentIdLst.size()>0){
String[] temp=contentIdLst.get(0).split(";");
//省份代码
payBatchId = temp[0];
proviceCode = temp[1];
}
if("0".equals(repObj.getSERVICE_MESSAGE())){
//成功 校验,导入全部成功时
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "操作成功");
resultMap.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
}
else if("1".equals(repObj.getSERVICE_MESSAGE())||"2".equals(repObj.getSERVICE_MESSAGE())){
//全部失败 按照批次号更新记录
ErrorCollection errorCol = repObj.getErrorCollection();
if(errorCol!=null){
List<ErrorItem> errorList = errorCol.getErrorItem() ;
if(errorList!=null&&errorList.size()>0){
//按照批次号更新
try{
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,proviceCode);
getSevice().updatePayInfoForbatchIdAndLineNo(errorList,proviceCode);
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "操作成功");
resultMap.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
}catch(Exception e){
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "更新数据库失败");
resultMap.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
e.printStackTrace();
}
}
}
}else if("3".equals(repObj.getSERVICE_MESSAGE())||"4".equals(repObj.getSERVICE_MESSAGE())){
ErrorCollection errorCol = repObj.getErrorCollection();
if(errorCol!=null){
List<ErrorItem> errorList = errorCol.getErrorItem() ;
if(errorList!=null&&errorList.size()>0){
//按照批次号更新
try{
// CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,ifVo.getSubsBean().getDataScope());
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,proviceCode);
getSevice().updatePayInfoForbatchIdAndLineNo(errorList,proviceCode);
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_TERMINAL_SYSTEM_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "操作成功");
resultMap.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
}catch(Exception e){
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "更新数据库失败");
resultMap.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
e.printStackTrace();
}
}
}
}else if("false".equals(repObj.getSERVICE_FLAG())&&repObj.getErrorCollection().getErrorItem().size()<=0&&repObj.getResponseCollection().getResponseItem().size()<=0){
try{
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,proviceCode);
getSevice().updatePayInfoForbatchIdAndLineNoFailStatus(payBatchId,proviceCode);
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "message!=1并且错误列表为空");
}catch(Exception e){
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "更新数据库失败");
resultMap.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
e.printStackTrace();
}
}else{
resultMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
resultMap.put(Constants.MapResult.MAP_RESULTMSG, "message!=1并且错误列表为空");
}
return resultMap;
}
@Override
public HashMap<String, Object> pubIfServiceAdapter(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
// HashMap<String, Object> map = new HashMap<String, Object>();
// String nameSpace = ifVo.getServiceBean().getNameSpace();
// String serviceName = ifVo.getServiceBean().getServiceName();
// String addr = ifVo.getServiceBean().getServicePath();
// String ifClass = ifVo.getServiceBean().getServiceImplClass();
// String paramClass = ifVo.getOperBean().getParamImplClass();
// String serviceMeth = ifVo.getOperBean().getOperateMeth();
// Object obj = null;
// map.put(Constants.MapResult.MAP_RESULTCODE,
// Constants.MapResultCode.CODE_SUCCESSFUL);
// map.put(Constants.MapResult.MAP_RESULTMSG, "成功");
// try {
// obj = WSUtil.executeWS2(nameSpace, serviceName, addr, ifClass,
// paramClass, serviceMeth, ifMsg);
//
//
// } catch (Exception e) {
// map.put(Constants.MapResult.MAP_RESULTCODE,
// Constants.MapResultCode.CODE_OTHER_ERROR);
// map.put(Constants.MapResult.MAP_RESULTMSG, "调用对方服务异常");
// e.printStackTrace();
// }
// map.put(Constants.MapResult.MAP_RESULTOBJ, obj);
// return map;
return null;
}
@Override
public HashMap<String, Object> pubIfServiceContinue(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
return null;
}
public static void main(String args[]) {
try{
DownloadFileTimerPorcessSVImpl dd = new DownloadFileTimerPorcessSVImpl();
dd.process("self_date_acct", "self_date_acct", "123123");
// ImportAmountInfoPublishImpl amountuch = new ImportAmountInfoPublishImpl();
// List<String> c = new ArrayList<String>();
// c.add("2175201204260000004066;75;<EMAIL>");
// amountuch.pubIfParamGen(c, null, Long.valueOf(0), "2", null);
}catch(Exception e){
e.printStackTrace();
}
}
private static IImportAmountInfoSV getSevice() {
return (IImportAmountInfoSV) ServiceFactory.getService(IImportAmountInfoSV.class);
}
@Override
public boolean pubIfRetErrorMax(String contentId) {
// TODO Auto-generated method stub
return false;
}
}
<file_sep>
package com.unicom.mss.soa.msgheader;
import java.math.BigDecimal;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.w3._2001.xmlschema.Adapter1;
/**
* <p>Java class for MsgHeader complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MsgHeader">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SOURCE_SYSTEM_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="SOURCE_SYSTEM_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="USER_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="USER_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="SUBMIT_DATE" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="PAGE_SIZE" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="CURRENT_PAGE" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="TOTAL_RECORD" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="PROVINCE_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ENVIRONMENT_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MsgHeader", propOrder = {
"sourceSYSTEMID",
"sourceSYSTEMNAME",
"userID",
"userNAME",
"submitDATE",
"pageSIZE",
"currentPAGE",
"totalRECORD",
"provinceCODE",
"environmentNAME"
})
public class MsgHeader {
@XmlElement(name = "SOURCE_SYSTEM_ID", required = true, nillable = true)
protected String sourceSYSTEMID;
@XmlElement(name = "SOURCE_SYSTEM_NAME", required = true, nillable = true)
protected String sourceSYSTEMNAME;
@XmlElement(name = "USER_ID", required = true, nillable = true)
protected String userID;
@XmlElement(name = "USER_NAME", required = true, nillable = true)
protected String userNAME;
@XmlElement(name = "SUBMIT_DATE", required = true, type = String.class, nillable = true)
@XmlJavaTypeAdapter(Adapter1 .class)
@XmlSchemaType(name = "dateTime")
protected Date submitDATE;
@XmlElement(name = "PAGE_SIZE", required = true, nillable = true)
protected BigDecimal pageSIZE;
@XmlElement(name = "CURRENT_PAGE", required = true, nillable = true)
protected BigDecimal currentPAGE;
@XmlElement(name = "TOTAL_RECORD", required = true, nillable = true)
protected BigDecimal totalRECORD;
@XmlElement(name = "PROVINCE_CODE", required = true, nillable = true)
protected String provinceCODE;
@XmlElement(name = "ENVIRONMENT_NAME", required = true, nillable = true)
protected String environmentNAME;
/**
* Gets the value of the source_SYSTEM_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSOURCE_SYSTEM_ID() {
return sourceSYSTEMID;
}
/**
* Sets the value of the source_SYSTEM_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSOURCE_SYSTEM_ID(String value) {
this.sourceSYSTEMID = value;
}
/**
* Gets the value of the source_SYSTEM_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSOURCE_SYSTEM_NAME() {
return sourceSYSTEMNAME;
}
/**
* Sets the value of the source_SYSTEM_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSOURCE_SYSTEM_NAME(String value) {
this.sourceSYSTEMNAME = value;
}
/**
* Gets the value of the user_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSER_ID() {
return userID;
}
/**
* Sets the value of the user_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSER_ID(String value) {
this.userID = value;
}
/**
* Gets the value of the user_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSER_NAME() {
return userNAME;
}
/**
* Sets the value of the user_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSER_NAME(String value) {
this.userNAME = value;
}
/**
* Gets the value of the submit_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getSUBMIT_DATE() {
return submitDATE;
}
/**
* Sets the value of the submit_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUBMIT_DATE(Date value) {
this.submitDATE = value;
}
/**
* Gets the value of the page_SIZE property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getPAGE_SIZE() {
return pageSIZE;
}
/**
* Sets the value of the page_SIZE property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setPAGE_SIZE(BigDecimal value) {
this.pageSIZE = value;
}
/**
* Gets the value of the current_PAGE property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getCURRENT_PAGE() {
return currentPAGE;
}
/**
* Sets the value of the current_PAGE property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setCURRENT_PAGE(BigDecimal value) {
this.currentPAGE = value;
}
/**
* Gets the value of the total_RECORD property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getTOTAL_RECORD() {
return totalRECORD;
}
/**
* Sets the value of the total_RECORD property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTOTAL_RECORD(BigDecimal value) {
this.totalRECORD = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the environment_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getENVIRONMENT_NAME() {
return environmentNAME;
}
/**
* Sets the value of the environment_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setENVIRONMENT_NAME(String value) {
this.environmentNAME = value;
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.util.HashMap;
import java.util.List;
import com.ai.uchintService.busi.service.interfaces.IInquiryEASAuditSV;
import com.ai.uchintService.common.bo.UCH_TF_CHL_PAY_APPLY_DETAILBean;
import com.ai.uchintService.common.bo.UCH_TF_CHL_PAY_APPLY_DETAILEngine;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYEngine;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLY_STATEBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLY_STATEEngine;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.core.bo.UipSyncRecordEngine;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvResponse;
public class InquiryEASAuditSVImpl implements IInquiryEASAuditSV{
// @Override
// public UC_TF_CHL_PAY_APPLYBean[] getAPPLYBeans(String pay_batch_id, String province_code, Long batch_no) throws Exception {
//
// return UC_TF_CHL_PAY_APPLYEngine.getBeans( " PAY_BATCH_ID = " + pay_batch_id + " and BATCH_NO = " + batch_no , null );
// }
@Override
public boolean insertUipSyncRecord( SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem outputItem , SB_EAS_EAS_InquiryEASAuditInfoSrvResponse resp ,
List<String> contentIdLst , HashMap<String,Long> batchMap,String procinceCode) throws Exception {
//定义要插入的类实例
UipSyncRecordBean recordBean = new UipSyncRecordBean();
recordBean.isNew();
//取值,设置ID
//recordBean.setRecordId( Long.valueOf( CastUtil.getSequenceNextVal(Constants.RECORD_ID$SEQ ) ));
recordBean.setRecordId( Long.valueOf( CastUtil.getSequenceNextValbyAllName(Constants.RECORD_ID$SEQ ) ));
//暂定为120
recordBean.setSubjectId( 502 );
//暂定为201109
recordBean.setMonth( "201109" );
//设置省份编码
//if( outputItem.getPROVINCE_CODE() != null){
recordBean.setProvinceCode( procinceCode);
//}
//给定值
recordBean.setContentKind("04");
//传得的值
if(contentIdLst.size()>0){
recordBean.setContentId( contentIdLst.get(0));
}
//在上次的页数上加一
recordBean.setBatchNo( resp.getCURRENT_PAGE().longValue() + 1 );
//当前的插入时间
recordBean.setInsertTime( CastUtil.getCurrentTimestamp() );
//设置为初始状态
recordBean.setState("00");
//不锁定
recordBean.setLockStatus( 0 );
//保存
UipSyncRecordEngine.save( recordBean );
return true;
}
@Override
// public boolean updateApply( List<SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem> outPutList,String provinceCode) throws Exception {
//
// //循环由outPutList得到的每条数据
// for (int i = 0; i < outPutList.size(); i++){
//
// SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem outputItem = outPutList.get( i );
// String appState=outputItem.getAPPROVED_STATUS().toString();
// //判断是否为终结状态,终结状态不做更新
// UC_TF_CHL_PAY_APPLYBean[] beans = UC_TF_CHL_PAY_APPLYEngine.getBeans("bill_no ='"+outputItem.getBILL_NO()+"' and province_code='"+provinceCode+"' order by update_date desc",null);
// if(beans.length>0){
// String payBatchId = beans[0].getPayBatchId();
// int tag = Integer.parseInt(beans[0].getPayState());
//// String payBatchId = BucUtil.getPayBatchIdForBillNo(outputItem.getBILL_NO());
//// int tag = BucUtil.getStateForPayBatchId(payBatchId);
//
// if(appState.equals("1")){
// if(tag!=10&&tag!=4&&tag!=3&&tag!=2&&tag!=31&&tag!=1){
//// if(tag<2){
// //由pay_batch_id查询出要更新的那条(多条)记录
// String sql = " pay_batch_id = " + payBatchId +" and province_code='"+provinceCode+"'";
//
// UC_TF_CHL_PAY_APPLYBean[] updateApplyBeans = UC_TF_CHL_PAY_APPLYEngine.getBeans( sql , null );
//
// /**1.循环更新数组中每一个表UC_TF_CHL_PAY_APPLYBean -> (状态和时间) */
// if(updateApplyBeans.length>0){
// for(int n = 0; n < updateApplyBeans.length; n++){
// //取到要更新的TF_CHL_PAY_APPLY表
// UC_TF_CHL_PAY_APPLYBean updateApplyBean = updateApplyBeans[ n ];
// updateApplyBean.isModified();
//
// //更新时间
// updateApplyBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//
// //更新状态
// if(outputItem.getAPPROVED_STATUS() != null){
// updateApplyBean.setPayState( outputItem.getAPPROVED_STATUS() + "" );
// }
// //人员id
// updateApplyBean.setUpdateStaffId(Constants.UPDATE_STAFF_ID_VALUE);
// //总账凭证号
// updateApplyBean.setVoucherNumber(outputItem.getVOUCHER_NUMBER());
// //保存这条记录
// UC_TF_CHL_PAY_APPLYEngine.save( updateApplyBean ) ;
// //根据支付状态表SERIAL_NO查询支付状态明细表的记录
// UCH_TF_CHL_PAY_APPLY_DETAILBean[] applyDetailBeans = UCH_TF_CHL_PAY_APPLY_DETAILEngine.getBeans("SERIAL_NO='" + updateApplyBean.getSerialNo()+"' and province_code='"+provinceCode+"'", null);
//
// //更新支付状态明细表的支付状态和支付信息表状态一致
// for(int l=0;l<applyDetailBeans.length;l++ ){
// UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetailBean = applyDetailBeans[l];
// applyDetailBean.isModified();
// applyDetailBean.setPayState(updateApplyBean.getPayState());
// UCH_TF_CHL_PAY_APPLY_DETAILEngine.save(applyDetailBean);
// }
//
// }
//
//
//
// /**2.插入一批 TF_CHL_PAY_APPLY_STATE 记录,先由BILL_NO查得多条数据,然后由*/
//
// //定义要插入的BO
// UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
// insertStateBean.isNew();
//
// /*流水号*/
// insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
// /* 批次号*/
// if( Long.valueOf( updateApplyBeans[0].getBillNo()) != null)
// insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[0].getBillNo()));
//
// /*行号*/
// insertStateBean.setLineNo(0);
// /*记录的唯一标识*/
// if( null != updateApplyBeans[0].getPayBatchId() )
// insertStateBean.setPayBatchId(updateApplyBeans[0].getPayBatchId());
//
// //insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
//
// /*状态*/
// if( null != updateApplyBeans[0].getPayState())
// insertStateBean.setPayState(updateApplyBeans[0].getPayState());
//
// //insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
//
// insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
// /*结算类型*/
// insertStateBean.setPayObjectType(updateApplyBeans[0].getPayObjectType());
// /*对象id*/
// insertStateBean.setPayObjectId("0");
// /*更新日期*/
// insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//
// //保存到表中
// UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
// }
// }else{
//// String sql = " pay_batch_id = " + payBatchId;
// String sql = " pay_batch_id = " + payBatchId +" and province_code='"+provinceCode+"'";
//
// UC_TF_CHL_PAY_APPLYBean[] updateApplyBeans = UC_TF_CHL_PAY_APPLYEngine.getBeans( sql , null );
//
// if(updateApplyBeans.length>0){
// //定义要插入的BO
// UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
// insertStateBean.isNew();
//
// /*流水号*/
// insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
// /* 批次号*/
// if( Long.valueOf( updateApplyBeans[0].getBillNo()) != null)
// insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[0].getBillNo()));
//
// /*行号*/
// insertStateBean.setLineNo(0);
// /*记录的唯一标识*/
// if( null != updateApplyBeans[0].getPayBatchId() )
// insertStateBean.setPayBatchId(updateApplyBeans[0].getPayBatchId());
//
// //insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
//
// /*状态*/
// insertStateBean.setPayState(appState);
//
// //insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
//
// insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
// /*结算类型*/
// insertStateBean.setPayObjectType(updateApplyBeans[0].getPayObjectType());
// /*对象id*/
// insertStateBean.setPayObjectId("0");
// /*更新日期*/
// insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//
// //保存到表中
// UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
// }
//
// }
// }else{
// if(tag!=10&&tag!=4&&tag!=3&&tag!=2&&tag!=31){
//// if(tag<2){
// //由pay_batch_id查询出要更新的那条(多条)记录
//// String sql = " pay_batch_id = " + payBatchId;
// String sql = " pay_batch_id = " + payBatchId +" and province_code='"+provinceCode+"'";
//
// UC_TF_CHL_PAY_APPLYBean[] updateApplyBeans = UC_TF_CHL_PAY_APPLYEngine.getBeans( sql , null );
//
// /**1.循环更新数组中每一个表UC_TF_CHL_PAY_APPLYBean -> (状态和时间) */
// if(updateApplyBeans.length>0){
// for(int n = 0; n < updateApplyBeans.length; n++){
// //取到要更新的TF_CHL_PAY_APPLY表
// UC_TF_CHL_PAY_APPLYBean updateApplyBean = updateApplyBeans[ n ];
// updateApplyBean.isModified();
//
// //更新时间
// updateApplyBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//
// //更新状态
// if(outputItem.getAPPROVED_STATUS() != null){
// updateApplyBean.setPayState( outputItem.getAPPROVED_STATUS() + "" );
// }
// //人员id
// updateApplyBean.setUpdateStaffId(Constants.UPDATE_STAFF_ID_VALUE);
// //总账凭证号
// updateApplyBean.setVoucherNumber(outputItem.getVOUCHER_NUMBER());
// //保存这条记录
// UC_TF_CHL_PAY_APPLYEngine.save( updateApplyBean ) ;
// //根据支付状态表SERIAL_NO查询支付状态明细表的记录
// UCH_TF_CHL_PAY_APPLY_DETAILBean[] applyDetailBeans = UCH_TF_CHL_PAY_APPLY_DETAILEngine.getBeans("SERIAL_NO='" + updateApplyBean.getSerialNo()+"' and province_code='"+provinceCode+"'", null);
//
// //更新支付状态明细表的支付状态和支付信息表状态一致
// for(int l=0;l<applyDetailBeans.length;l++ ){
// UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetailBean = applyDetailBeans[l];
// applyDetailBean.isModified();
// applyDetailBean.setPayState(updateApplyBean.getPayState());
// UCH_TF_CHL_PAY_APPLY_DETAILEngine.save(applyDetailBean);
// }
//
// }
//
//
//
// /**2.插入一批 TF_CHL_PAY_APPLY_STATE 记录,先由BILL_NO查得多条数据,然后由*/
//
// //定义要插入的BO
// UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
// insertStateBean.isNew();
//
// /*流水号*/
// insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
// /* 批次号*/
// if( Long.valueOf( updateApplyBeans[0].getBillNo()) != null)
// insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[0].getBillNo()));
//
// /*行号*/
// insertStateBean.setLineNo(0);
// /*记录的唯一标识*/
// if( null != updateApplyBeans[0].getPayBatchId() )
// insertStateBean.setPayBatchId(updateApplyBeans[0].getPayBatchId());
//
// //insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
//
// /*状态*/
// if( null != updateApplyBeans[0].getPayState())
// insertStateBean.setPayState(updateApplyBeans[0].getPayState());
//
// //insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
//
// insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
// /*结算类型*/
// insertStateBean.setPayObjectType(updateApplyBeans[0].getPayObjectType());
// /*对象id*/
// insertStateBean.setPayObjectId("0");
// /*更新日期*/
// insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//
// //保存到表中
// UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
// }
// }else{
//// String sql = " pay_batch_id = " + payBatchId;
// String sql = " pay_batch_id = " + payBatchId +" and province_code='"+provinceCode+"'";
//
// UC_TF_CHL_PAY_APPLYBean[] updateApplyBeans = UC_TF_CHL_PAY_APPLYEngine.getBeans( sql , null );
//
// /**1.循环更新数组中每一个表UC_TF_CHL_PAY_APPLYBean -> (状态和时间) */
// if(updateApplyBeans.length>0){
// //定义要插入的BO
// UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
// insertStateBean.isNew();
//
// /*流水号*/
// insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
// /* 批次号*/
// if( Long.valueOf( updateApplyBeans[0].getBillNo()) != null)
// insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[0].getBillNo()));
//
// /*行号*/
// insertStateBean.setLineNo(0);
// /*记录的唯一标识*/
// if( null != updateApplyBeans[0].getPayBatchId() )
// insertStateBean.setPayBatchId(updateApplyBeans[0].getPayBatchId());
//
// //insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
//
// /*状态*/
// insertStateBean.setPayState(appState);
//
// //insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
//
// insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
// /*结算类型*/
// insertStateBean.setPayObjectType(updateApplyBeans[0].getPayObjectType());
// /*对象id*/
// insertStateBean.setPayObjectId("0");
// /*更新日期*/
// insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//
// //保存到表中
// UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
// }
// }
// }
//
// }
//
// }
//
//
// return true;
// }
public boolean updateApply( List<SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem> outPutList,String provinceCode) throws Exception {
//循环由outPutList得到的每条数据
for (int i = 0; i < outPutList.size(); i++){
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem outputItem = outPutList.get( i );
String appState=outputItem.getAPPROVED_STATUS().toString();
//判断是否为终结状态,终结状态不做更新
UC_TF_CHL_PAY_APPLYBean[] beans = UC_TF_CHL_PAY_APPLYEngine.getBeans("bill_no ='"+outputItem.getBILL_NO()+"' and province_code='"+provinceCode+"' order by update_date desc",null);
if(beans.length>0){
String payBatchId = beans[0].getPayBatchId();
if(appState.equals("1")){
String sql = " pay_batch_id = " + payBatchId +" and province_code='"+provinceCode+"'";
UC_TF_CHL_PAY_APPLYBean[] updateApplyBeans = UC_TF_CHL_PAY_APPLYEngine.getBeans( sql , null );
if(updateApplyBeans.length>0){
for(int n = 0; n < updateApplyBeans.length; n++){
int tag = Integer.parseInt(updateApplyBeans[n].getPayState());
//取到要更新的TF_CHL_PAY_APPLY表
if(tag!=10&&tag!=4&&tag!=3&&tag!=2&&tag!=31&&tag!=1){
UC_TF_CHL_PAY_APPLYBean updateApplyBean = updateApplyBeans[ n ];
updateApplyBean.isModified();
//更新时间
updateApplyBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//更新状态
if(outputItem.getAPPROVED_STATUS() != null){
updateApplyBean.setPayState( outputItem.getAPPROVED_STATUS() + "" );
}
//人员id
updateApplyBean.setUpdateStaffId(Constants.UPDATE_STAFF_ID_VALUE);
//总账凭证号 20121204 更新,查询接口不插入总帐凭证号
// updateApplyBean.setVoucherNumber(outputItem.getVOUCHER_NUMBER());
//保存这条记录
UC_TF_CHL_PAY_APPLYEngine.save( updateApplyBean ) ;
//根据支付状态表SERIAL_NO查询支付状态明细表的记录
UCH_TF_CHL_PAY_APPLY_DETAILBean[] applyDetailBeans = UCH_TF_CHL_PAY_APPLY_DETAILEngine.getBeans("SERIAL_NO='" + updateApplyBean.getSerialNo()+"' and province_code='"+provinceCode+"'", null);
//更新支付状态明细表的支付状态和支付信息表状态一致
for(int l=0;l<applyDetailBeans.length;l++ ){
UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetailBean = applyDetailBeans[l];
applyDetailBean.isModified();
applyDetailBean.setPayState(updateApplyBean.getPayState());
UCH_TF_CHL_PAY_APPLY_DETAILEngine.save(applyDetailBean);
}
/**2.插入一批 TF_CHL_PAY_APPLY_STATE 记录,先由BILL_NO查得多条数据,然后由*/
//定义要插入的BO
UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
insertStateBean.isNew();
/*流水号*/
insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
/* 批次号*/
if( Long.valueOf( updateApplyBeans[n].getBillNo()) != null)
insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[n].getBillNo()));
/*行号*/
insertStateBean.setLineNo(updateApplyBeans[n].getLineNo());
/*记录的唯一标识*/
if( null != updateApplyBeans[n].getPayBatchId() )
insertStateBean.setPayBatchId(updateApplyBeans[n].getPayBatchId());
//insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
/*状态*/
if( null != updateApplyBeans[n].getPayState())
insertStateBean.setPayState(updateApplyBeans[n].getPayState());
//insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
/*结算类型*/
insertStateBean.setPayObjectType(updateApplyBeans[n].getPayObjectType());
/*对象id*/
insertStateBean.setPayObjectId(updateApplyBeans[n].getPayObjectId());
/*更新日期*/
insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//保存到表中
UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
}else{
//定义要插入的BO
UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
insertStateBean.isNew();
/*流水号*/
insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
/* 批次号*/
if( Long.valueOf( updateApplyBeans[n].getBillNo()) != null)
insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[n].getBillNo()));
/*行号*/
insertStateBean.setLineNo(updateApplyBeans[n].getLineNo());
/*记录的唯一标识*/
if( null != updateApplyBeans[n].getPayBatchId() )
insertStateBean.setPayBatchId(updateApplyBeans[n].getPayBatchId());
//insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
/*状态*/
if( null != updateApplyBeans[n].getPayState())
insertStateBean.setPayState(outputItem.getAPPROVED_STATUS()+"");
//insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
/*结算类型*/
insertStateBean.setPayObjectType(updateApplyBeans[n].getPayObjectType());
/*对象id*/
insertStateBean.setPayObjectId(updateApplyBeans[n].getPayObjectId());
/*更新日期*/
insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//保存到表中
UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
}
}
}
}else{
String sql = " pay_batch_id = " + payBatchId +" and province_code='"+provinceCode+"'";
UC_TF_CHL_PAY_APPLYBean[] updateApplyBeans = UC_TF_CHL_PAY_APPLYEngine.getBeans( sql , null );
if(updateApplyBeans.length>0){
for(int n = 0; n < updateApplyBeans.length; n++){
int tag = Integer.parseInt(updateApplyBeans[n].getPayState());
if(tag!=10&&tag!=4&&tag!=3&&tag!=2&&tag!=31){
UC_TF_CHL_PAY_APPLYBean updateApplyBean = updateApplyBeans[ n ];
updateApplyBean.isModified();
//更新时间
updateApplyBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//更新状态
if(outputItem.getAPPROVED_STATUS() != null){
updateApplyBean.setPayState( outputItem.getAPPROVED_STATUS() + "" );
}
//人员id
updateApplyBean.setUpdateStaffId(Constants.UPDATE_STAFF_ID_VALUE);
//总账凭证号 20121204 更新,查询接口不插入总帐凭证号
// updateApplyBean.setVoucherNumber(outputItem.getVOUCHER_NUMBER());
//保存这条记录
UC_TF_CHL_PAY_APPLYEngine.save( updateApplyBean ) ;
//根据支付状态表SERIAL_NO查询支付状态明细表的记录
UCH_TF_CHL_PAY_APPLY_DETAILBean[] applyDetailBeans = UCH_TF_CHL_PAY_APPLY_DETAILEngine.getBeans("SERIAL_NO='" + updateApplyBean.getSerialNo()+"' and province_code='"+provinceCode+"'", null);
//更新支付状态明细表的支付状态和支付信息表状态一致
for(int l=0;l<applyDetailBeans.length;l++ ){
UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetailBean = applyDetailBeans[l];
applyDetailBean.isModified();
applyDetailBean.setPayState(updateApplyBean.getPayState());
UCH_TF_CHL_PAY_APPLY_DETAILEngine.save(applyDetailBean);
}
/**2.插入一批 TF_CHL_PAY_APPLY_STATE 记录,先由BILL_NO查得多条数据,然后由*/
//定义要插入的BO
UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
insertStateBean.isNew();
/*流水号*/
insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
/* 批次号*/
if( Long.valueOf( updateApplyBeans[n].getBillNo()) != null)
insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[n].getBillNo()));
/*行号*/
insertStateBean.setLineNo(updateApplyBeans[n].getLineNo());
/*记录的唯一标识*/
if( null != updateApplyBeans[n].getPayBatchId() )
insertStateBean.setPayBatchId(updateApplyBeans[n].getPayBatchId());
//insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
/*状态*/
if( null != updateApplyBeans[n].getPayState())
insertStateBean.setPayState(updateApplyBeans[n].getPayState());
//insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
/*结算类型*/
insertStateBean.setPayObjectType(updateApplyBeans[n].getPayObjectType());
/*对象id*/
insertStateBean.setPayObjectId(updateApplyBeans[n].getPayObjectId());
/*更新日期*/
insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//保存到表中
UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
}else{
//定义要插入的BO
UC_TF_CHL_PAY_APPLY_STATEBean insertStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
insertStateBean.isNew();
/*流水号*/
insertStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
/* 批次号*/
if( Long.valueOf( updateApplyBeans[n].getBillNo()) != null)
insertStateBean.setBillNo(Long.valueOf( updateApplyBeans[n].getBillNo()));
/*行号*/
insertStateBean.setLineNo(updateApplyBeans[n].getLineNo());
/*记录的唯一标识*/
if( null != updateApplyBeans[n].getPayBatchId() )
insertStateBean.setPayBatchId(updateApplyBeans[n].getPayBatchId());
//insertStateBean.setPayMoney(updateApplyBeans[0].getPayMoney());
/*状态*/
if( null != updateApplyBeans[n].getPayState())
insertStateBean.setPayState(outputItem.getAPPROVED_STATUS()+"");
//insertStateBean.setPayStatMoney(updateApplyBeans[0].getPayStatMoney());
insertStateBean.setUpdateDate(CastUtil.getCurrentTimestamp() );
/*结算类型*/
insertStateBean.setPayObjectType(updateApplyBeans[n].getPayObjectType());
/*对象id*/
insertStateBean.setPayObjectId(updateApplyBeans[n].getPayObjectId());
/*更新日期*/
insertStateBean.setUpdateDate(CastUtil.date2timestamp(outputItem.getLAST_UPDATE_DATE()) );
//保存到表中
UC_TF_CHL_PAY_APPLY_STATEEngine.save( insertStateBean );
}
}
}
}
}
}
return true;
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.util.HashMap;
import java.util.List;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem;
import com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvResponse;
public interface IInquiryEASAuditSV {
// /**
// * 获得TF_CHL_PAY_APPLY表的数据
// * @param pay_batch_id
// * @param province_code
// * @param batch_no
// * @return
// * @throws Exception
// */
// public UC_TF_CHL_PAY_APPLYBean[] getAPPLYBeans(String pay_batch_id, String province_code, Long batch_no) throws Exception;
/**
* 当需要分页时在UipSyncRecord插入一条记录,只是当前页的值比上一次多一,其它字段的值不变
* @param outputItem
* @return
* @throws Exception
*/
public boolean insertUipSyncRecord(SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem outputItem , SB_EAS_EAS_InquiryEASAuditInfoSrvResponse resp ,
List<String> contentIdLst , HashMap<String,Long> batchMap,String procinceCode) throws Exception;
/**
* 1. 更新:支付记录表TF_CHL_PAY_APPLY -> 时间和状态
* 2. 插入一条数据到:支付状态变更记录TF_CHL_PAY_APPLY_STATE -> 数据由支付记录表查得和outPutList获得
* @param outputItem
* @return
* @throws Exception
*/
public boolean updateApply( List<SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem> outPutList,String provinceCode) throws Exception;
}
<file_sep>package com.ai.uchintService.common.util;
import java.sql.Connection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD.ROUTING;
import com.ai.cuframe.util.DbUtil;
import com.ai.uip.core.bo.UIP_OPERATE_PENETRATIONBean;
import com.unicom.mss.soa.msgheader.MsgHeader;
public class BucUtil {
/**
* 清帐单资金归集报文头校验
* @param unibssHead
* @return
*/
public static Map<String,Object> qzdcheckHead(Object obj){
cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD unibssHead = (cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD)obj;
boolean flag = true;
String errorInfo="";
Map<String,Object> map = new HashMap<String,Object>();
if(unibssHead.getORIGDOMAIN()==null || unibssHead.getORIGDOMAIN().length()==0){
flag = false;
errorInfo="发起方应用域代码[ORIG_DOMAIN]不能为空";
}else if(unibssHead.getORIGDOMAIN().length()!=4){
flag = false;
errorInfo="发起方应用域代码[ORIG_DOMAIN]长度有误";
}else if(unibssHead.getSERVICENAME()==null || unibssHead.getSERVICENAME().length()==0){
flag = false;
errorInfo="服务名称[SERVICE_NAME]不能为空";
}else if(!"AgentChargeInfoSyncSer".equals(unibssHead.getSERVICENAME())){
flag = false;
errorInfo="服务名称[SERVICE_NAME]有误";
}else if(unibssHead.getOPERATENAME()==null || unibssHead.getOPERATENAME().length()==0){
flag = false;
errorInfo="操作名称[OPERATE_NAME]不能为空";
}else if(!"agentPrePayRechSync".equals(unibssHead.getOPERATENAME()) && !"agentDepositRechSync".equals(unibssHead.getOPERATENAME())){
flag = false;
errorInfo="操作名称[OPERATE_NAME]有误";
}else if(unibssHead.getACTIONCODE()==null || unibssHead.getACTIONCODE().length()==0){
flag = false;
errorInfo="操作动作代码[ACTION_CODE]不能为空";
}else if(!"0".equals(unibssHead.getACTIONCODE()) && !"1".equals(unibssHead.getACTIONCODE())){
flag = false;
errorInfo="操作动作代码[ACTION_CODE]只能填0或者1";
}else if(unibssHead.getACTIONRELATION()==null || unibssHead.getACTIONRELATION().length()==0){
flag = false;
errorInfo="交易关联性[ACTION_RELATION]不能为空";
}else if(!"0".equals(unibssHead.getACTIONRELATION()) && !"1".equals(unibssHead.getACTIONRELATION())){
flag = false;
errorInfo="交易关联性[ACTION_RELATION]只能填0或者1";
}else if(unibssHead.getPROCID()==null || unibssHead.getPROCID().length()==0){
flag = false;
errorInfo="发起方业务流水号[PROC_ID]不能为空";
}else if(unibssHead.getTRANSIDO()==null || unibssHead.getTRANSIDO().length()==0){
flag = false;
errorInfo="服务调用方流水号[TRANS_IDO]不能为空";
}else if(unibssHead.getPROCESSTIME()==null || unibssHead.getPROCESSTIME().length()==0){
flag = false;
errorInfo="服务处理时间[PROCESS_TIME]不能为空";
}else if(unibssHead.getPROCESSTIME().length()!=14){
flag = false;
errorInfo="服务处理时间[PROCESS_TIME]格式有误";
}else if(unibssHead.getSPRESERVE()!=null && (unibssHead.getSPRESERVE().getOSNDUNS() == null || unibssHead.getSPRESERVE().getOSNDUNS().length() == 0)){
flag = false;
errorInfo="发起方代码[OSNDUNS]为空";
}else if(unibssHead.getSPRESERVE()!=null && unibssHead.getSPRESERVE().getOSNDUNS().length() != 4){
flag = false;
errorInfo="发起方代码[OSNDUNS]长度有误";
}else if(unibssHead.getSPRESERVE()!=null && (unibssHead.getSPRESERVE().getHSNDUNS() == null || unibssHead.getSPRESERVE().getHSNDUNS().length() == 0)){
flag = false;
errorInfo="归属方代码[HSNDUNS]为空";
}else if(unibssHead.getSPRESERVE()!=null && unibssHead.getSPRESERVE().getHSNDUNS().length() != 4){
flag = false;
errorInfo="归属方代码[HSNDUNS]长度有误";
}else if(unibssHead.getTESTFLAG()==null || unibssHead.getTESTFLAG().length()==0){
flag = false;
errorInfo="测试标记[TEST_FLAG]不能为空";
}else if(!"0".equals(unibssHead.getTESTFLAG()) && !"1".equals(unibssHead.getTESTFLAG())){
flag = false;
errorInfo="测试标记[TEST_FLAG]只能填写0或者1";
}else if(unibssHead.getMSGSENDER()==null || unibssHead.getMSGSENDER().length()==0){
flag = false;
errorInfo="消息发送方代码[MSG_SENDER]不能为空";
}else if(unibssHead.getMSGSENDER().length()!=4){
flag = false;
errorInfo="消息发送方代码[MSG_SENDER]长度有误";
}else if(unibssHead.getMSGRECEIVER()==null || unibssHead.getMSGRECEIVER().length()==0){
flag = false;
errorInfo="消息接收方代码[MSG_RECEIVER]不能为空";
}else if(unibssHead.getMSGRECEIVER().length()!=4){
flag = false;
errorInfo="消息接收方代码[MSG_RECEIVER]长度有误";
}
map.put(Constants.QZMap_TAG, flag);
map.put(Constants.QZMap_ErrorInfo, errorInfo);
return map;
}
/**
* 清帐单资金归集获取报文头
* @param reqHead
* @param logId
* @return
*/
public static Object getqzdReqHead(Object obj,Long logId){
cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD reqHead = (cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD)obj;
cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD retHead = new cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD();
retHead.setORIGDOMAIN(reqHead.getORIGDOMAIN());
retHead.setSERVICENAME(reqHead.getSERVICENAME());
retHead.setOPERATENAME(reqHead.getOPERATENAME());
retHead.setACTIONCODE("1");
retHead.setACTIONRELATION("0");
retHead.setROUTING(reqHead.getROUTING());
retHead.setPROCID(reqHead.getPROCID());
retHead.setTRANSIDO(reqHead.getTRANSIDO());
retHead.setTRANSIDH(logId.toString());
retHead.setPROCESSTIME(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD.SPRESERVE sp = new cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD.SPRESERVE();
sp.setTRANSIDC(logId.toString());
sp.setCUTOFFDAY(new SimpleDateFormat("yyyyMMdd").format(new Date()));
sp.setOSNDUNS(reqHead.getSPRESERVE().getOSNDUNS());
sp.setHSNDUNS(reqHead.getSPRESERVE().getHSNDUNS());
sp.setCONVID(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
retHead.setSPRESERVE(sp);
retHead.setTESTFLAG(reqHead.getTESTFLAG());
retHead.setMSGSENDER(reqHead.getMSGSENDER());
retHead.setMSGRECEIVER(reqHead.getMSGRECEIVER());
return retHead;
}
/**
* 判断报文头格式是否正确
* @param msgHead
* @return
*/
public static Map<String,Object> confirmHead(MsgHeader msgHead){
boolean temp = true;
List<String> errorList=new ArrayList<String>();
Map<String,Object> map = new HashMap<String,Object>();
if(msgHead.getSOURCE_SYSTEM_ID()==null||msgHead.getSOURCE_SYSTEM_ID().length()==0){
temp = false;
errorList.add("源系统ID[SOURCE_SYSTEM_ID]不能为空");
}
if(msgHead.getSOURCE_SYSTEM_NAME()==null||msgHead.getSOURCE_SYSTEM_NAME().length()==0){
temp = false;
errorList.add("源系统名称[SOURCE_SYSTEM_NAME]不能为空");
}
if(msgHead.getUSER_ID()==null||msgHead.getUSER_ID().length()==0){
temp = false;
errorList.add("用户ID[USER_ID]不能为空");
}
if(msgHead.getUSER_NAME()==null||msgHead.getUSER_NAME().length()==0){
temp = false;
errorList.add("用户名称[USER_NAME]不能为空");
}
map.put(Constants.retMap_TAG, temp);
map.put(Constants.retMap_ERRORList, errorList);
return map;
}
public static String getStringForList(List<String> list){
String retStr="";
if(list!=null&&list.size()>0){
for(int i=0;i<list.size();i++){
retStr = retStr+list.get(i);
}
}
return retStr;
}
public static boolean containsStr(String str,String[] strs){
boolean temp = false;
for(int i=0;i<strs.length;i++){
if(strs[i].equals(str)){
return true;
}
}
return temp;
}
//根据对方的省份取得我们的省份 ,在回调的时候使用
public static String getCfgCodeValue(String codeType,String codeDesc) {
String sql="select code_value from CFG_CODE_TRANS where CODE_DESC='"+codeDesc+"' and code_type='"+codeType+"'";
String codeValue="";
try {
codeValue=DbUtil.queryForString(sql, null);
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
}
return codeValue;
}
//根据我们的省份代码转换成对方的省份代码,发送的时候使用。
public static String getCfgCodeDesc(String codeType,String codeValue) {
String sql="select code_desc from CFG_CODE_TRANS where CODE_VALUE='"+codeValue+"' and code_type='"+codeType+"'";
String codeDesc="";
try {
codeDesc=DbUtil.queryForString(sql, null);
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
}
return codeDesc;
}
// //根据bill_no得到pay_batch_id
// public static String getPayBatchIdForBillNo(String billNo){
// String sql="select pay_batch_id from (select distinct pay_batch_id,update_date from tf_chl_pay_apply where bill_no ='"+billNo+"' order by update_date desc) a";
// String stateSte="";
// try {
// stateSte=DbUtil.queryForString(sql, null);
// } catch (Exception e) {
// System.out.println(e.getMessage());
// }
// return stateSte;
// }
// //根据pay_batch_id得到状态
// public static int getStateForPayBatchId(String payBatchId){
// String stateSte="";
// String sql="select count(0) from tf_chl_pay_apply where pay_batch_id='2134201201170000000646' and pay_state in (10,3,4);";
// try {
// stateSte=DbUtil.queryForString(sql, null);
// } catch (Exception e) {
// System.out.println(e.getMessage());
// }
// if(stateSte !=null&&stateSte.length()>0){
// return Integer.parseInt(stateSte);
// }else{
// return 0;
// }
//
// }
/**
* 根据传入的服务编码,操作编码,接口框架的logId生成B域包头
* @param serviceName
* @param operateName
* @param logId
* @return
*/
public static UNI_BSS_HEAD genUch2BHeader(UNI_BSS_HEAD head,Long logId,String serviceName,String operateName,UIP_OPERATE_PENETRATIONBean ifBeans)
{
UNI_BSS_HEAD header = new UNI_BSS_HEAD();
Date currentTime = new Date();
header.setORIG_DOMAIN("CCNL");
header.setSERVICE_NAME(serviceName);
header.setOPERATE_NAME(operateName);
header.setACTION_CODE("0");
header.setACTION_RELATION("0");
ROUTING routing = new UNI_BSS_HEAD.ROUTING();
routing.setROUTE_TYPE("00");
if(head.getCOM_BUS_INFO().getPROVINCE_CODE().equals("09")){
routing.setROUTE_VALUE(ifBeans.getTargetSystem());
}else{
if(head.getMSG_RECEIVER().equals("PAY")){
routing.setROUTE_VALUE("16");
}else{
routing.setROUTE_VALUE(head.getCOM_BUS_INFO().getPROVINCE_CODE());
}
}
UNI_BSS_HEAD.COM_BUS_INFO comBUSINFO = new UNI_BSS_HEAD.COM_BUS_INFO();
comBUSINFO.setOPER_ID(head.getCOM_BUS_INFO().getOPER_ID());
if(head.getCOM_BUS_INFO().getPROVINCE_CODE()!=null){
comBUSINFO.setPROVINCE_CODE(head.getCOM_BUS_INFO().getPROVINCE_CODE());
}
if(head.getCOM_BUS_INFO().getEPARCHY_CODE()!=null){
comBUSINFO.setEPARCHY_CODE(head.getCOM_BUS_INFO().getEPARCHY_CODE());
}else{
comBUSINFO.setEPARCHY_CODE("");
}
if(head.getCOM_BUS_INFO().getCITY_CODE()!=null){
comBUSINFO.setCITY_CODE(head.getCOM_BUS_INFO().getCITY_CODE());
}else{
comBUSINFO.setCITY_CODE("");
}
comBUSINFO.setOPER_ID("UC0800");
// comBUSINFO.setCHANNEL_ID("");
// comBUSINFO.setCHANNEL_TYPE("2010101");
comBUSINFO.setCHANNEL_ID(head.getCOM_BUS_INFO().getCHANNEL_ID());
comBUSINFO.setCHANNEL_TYPE(head.getCOM_BUS_INFO().getCHANNEL_TYPE());
comBUSINFO.setACCESS_TYPE("01");
if(serviceName.equals("AgencyBankPaymentSer")){
comBUSINFO.setORDER_TYPE("01");
}else{
comBUSINFO.setORDER_TYPE("00");
}
header.setROUTING(routing);
header.setPROC_ID("CCNL_" + serviceName.substring(0,4).toUpperCase() + "_"+ logId.toString());
header.setTRANS_IDO(serviceName.substring(0,4).toUpperCase() + "_" + logId.toString());
header.setTRANS_IDH("");
// header.setRESPONSE(value);
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
header.setPROCESS_TIME(formatter.format(currentTime));
/* 查询操作员信息 */
// String staffNo="CCNL_",provinceCode="09",eparchyCode="000",cityCode="000000",chnlCode="A1000";
header.setCOM_BUS_INFO(comBUSINFO);
UNI_BSS_HEAD.SP_RESERVE spRESERVE = new UNI_BSS_HEAD.SP_RESERVE();
spRESERVE.setTRANS_IDC("CCNL_"+logId.toString());
SimpleDateFormat formatter8 = new SimpleDateFormat("yyyyMMdd");
spRESERVE.setCUTOFFDAY(formatter8.format(currentTime));
spRESERVE.setOSNDUNS("0800");
//可以不填
spRESERVE.setHSNDUNS("0000");
SimpleDateFormat formatter17 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
spRESERVE.setCONV_ID(formatter17.format(currentTime));
header.setSP_RESERVE(spRESERVE);
header.setTEST_FLAG("0");
header.setMSG_SENDER("0800");
header.setMSG_RECEIVER("0000");
return header;
}
/**
* 获取订单id
* @return
*/
public static Long getOrderId(String dateform , String seqname,Connection con) {
String date = CastUtil.getStringDate2(dateform);
String seq = CastUtil.getSequenceNextVal(seqname,con);
String orderId = date + seq;
return Long.valueOf(orderId);
}
/**
* 判断报文头格式是否正确
* @param msgHead
* @return
*/
public static Map<String,Object> woegouconfirmHead(com.unicom.wouchannel.msgheader.MsgHeader msgHead){
boolean temp = true;
List<String> errorList=new ArrayList<String>();
Map<String,Object> map = new HashMap<String,Object>();
if(msgHead.getSOURCESYSTEMID()==null||msgHead.getSOURCESYSTEMID().length()==0){
temp = false;
errorList.add("源系统ID[SOURCE_SYSTEM_ID]不能为空");
}
if(msgHead.getSOURCESYSTEMNAME()==null||msgHead.getSOURCESYSTEMNAME().length()==0){
temp = false;
errorList.add("源系统名称[SOURCE_SYSTEM_NAME]不能为空");
}
if(msgHead.getUSERID()==null||msgHead.getUSERID().length()==0){
temp = false;
errorList.add("用户ID[USER_ID]不能为空");
}
map.put(Constants.retMap_TAG, temp);
map.put(Constants.retMap_ERRORList, errorList);
return map;
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import com.ailk.uchannel.cnapsmdmupdate.param.CNAPSMDMRequestVo;
import com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvInputItem;
public interface IImportCnapsCodeInfoSV {
//增加一条联行号信息
public void addCnapsCode(SB_UC_UC_ImportCnapsCodeInfoSrvInputItem inputItem) throws Exception;
//合并一条联行号信息
public CNAPSMDMRequestVo combinCnapsCode(SB_UC_UC_ImportCnapsCodeInfoSrvInputItem inputItem) throws Exception;
//修改一条联行号信息
public void modifyCnapsCode(SB_UC_UC_ImportCnapsCodeInfoSrvInputItem inputItem) throws Exception;
//查看是否存在省份,城市
public boolean ifTdMdmArea(String province_code ,String province_name) throws Exception;
public boolean ifTdMdmAreaCity(String city_code ,String city_name) throws Exception;
public boolean ifBankCode(String bank_code ,String bank_name) throws Exception;
public boolean ifCnapsCode(String mdm_code ,String bank_code,String cnaps_code) throws Exception;
//修改联行号
public CNAPSMDMRequestVo update(SB_UC_UC_ImportCnapsCodeInfoSrvInputItem item) throws Exception;
//是否存在被合并的MDM_CODE
public boolean ifOld(String mdm_code) throws Exception;
//添加新联行号
public void add(SB_UC_UC_ImportCnapsCodeInfoSrvInputItem item) throws Exception;
//是否存在要增加的联行号的原始信息
public boolean ifZero(String mdm_code) throws Exception;
}
<file_sep>
package com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.unicom.mss.soa.msgheader.MsgHeader;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="MsgHeader" type="{http://soa.mss.unicom.com/MsgHeader}MsgHeader"/>
* <element name="SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection" type="{http://mss.unicom.com/SB_UC_UC_ImportCnapsCodeInfoSrv}SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"msgHeader",
"sbUCUCImportCnapsCodeInfoSrvInputCollection"
})
@XmlRootElement(name = "SB_UC_UC_ImportCnapsCodeInfoSrvRequest")
public class SB_UC_UC_ImportCnapsCodeInfoSrvRequest {
@XmlElement(name = "MsgHeader", required = true)
protected MsgHeader msgHeader;
@XmlElement(name = "SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection", required = true)
protected SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection sbUCUCImportCnapsCodeInfoSrvInputCollection;
/**
* Gets the value of the msgHeader property.
*
* @return
* possible object is
* {@link MsgHeader }
*
*/
public MsgHeader getMsgHeader() {
return msgHeader;
}
/**
* Sets the value of the msgHeader property.
*
* @param value
* allowed object is
* {@link MsgHeader }
*
*/
public void setMsgHeader(MsgHeader value) {
this.msgHeader = value;
}
/**
* Gets the value of the sb_UC_UC_ImportCnapsCodeInfoSrvInputCollection property.
*
* @return
* possible object is
* {@link SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection }
*
*/
public SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection getSB_UC_UC_ImportCnapsCodeInfoSrvInputCollection() {
return sbUCUCImportCnapsCodeInfoSrvInputCollection;
}
/**
* Sets the value of the sb_UC_UC_ImportCnapsCodeInfoSrvInputCollection property.
*
* @param value
* allowed object is
* {@link SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection }
*
*/
public void setSB_UC_UC_ImportCnapsCodeInfoSrvInputCollection(SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection value) {
this.sbUCUCImportCnapsCodeInfoSrvInputCollection = value;
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.IUC_TF_CHL_DEVELOPERValue;
public class UC_TF_CHL_DEVELOPERBean extends DataContainer implements DataContainerInterface,IUC_TF_CHL_DEVELOPERValue{
private static String m_boName = "bo.UC_TF_CHL_DEVELOPER";
public final static String S_GroupAcct = "GROUP_ACCT";
public final static String S_State = "STATE";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_UserPid = "USER_PID";
public final static String S_BatchNo = "BATCH_NO";
public final static String S_CreateStaffId = "CREATE_STAFF_ID";
public final static String S_Remark = "REMARK";
public final static String S_AreaCode = "AREA_CODE";
public final static String S_BssSysCode2 = "BSS_SYS_CODE2";
public final static String S_DevName = "DEV_NAME";
public final static String S_HaveBssCode = "HAVE_BSS_CODE";
public final static String S_LinkmanPhone = "LINKMAN_PHONE";
public final static String S_LinkmanEmail = "LINKMAN_EMAIL";
public final static String S_DevId = "DEV_ID";
public final static String S_DevStaffId = "DEV_STAFF_ID";
public final static String S_LinkmanPostcode = "LINKMAN_POSTCODE";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_BssSysCode = "BSS_SYS_CODE";
public final static String S_CityCode = "CITY_CODE";
public final static String S_BankAcctName = "BANK_ACCT_NAME";
public final static String S_UpdateTime = "UPDATE_TIME";
public final static String S_DevCode = "DEV_CODE";
public final static String S_BankNo = "BANK_NO";
public final static String S_CertType = "CERT_TYPE";
public final static String S_LinkmanAddr = "LINKMAN_ADDR";
public final static String S_PayCommFlag = "PAY_COMM_FLAG";
public final static String S_BankCode = "BANK_CODE";
public final static String S_OptFlag = "OPT_FLAG";
public final static String S_DevTypeId = "DEV_TYPE_ID";
public final static String S_IsAutoCreate = "IS_AUTO_CREATE";
public final static String S_IsSumBonus = "IS_SUM_BONUS";
public final static String S_UpdateStaffId = "UPDATE_STAFF_ID";
public final static String S_SelfChnlId = "SELF_CHNL_ID";
public final static String S_LinkmanName = "LINKMAN_NAME";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UC_TF_CHL_DEVELOPERBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initGroupAcct(String value){
this.initProperty(S_GroupAcct,value);
}
public void setGroupAcct(String value){
this.set(S_GroupAcct,value);
}
public void setGroupAcctNull(){
this.set(S_GroupAcct,null);
}
public String getGroupAcct(){
return DataType.getAsString(this.get(S_GroupAcct));
}
public String getGroupAcctInitialValue(){
return DataType.getAsString(this.getOldObj(S_GroupAcct));
}
public void initState(String value){
this.initProperty(S_State,value);
}
public void setState(String value){
this.set(S_State,value);
}
public void setStateNull(){
this.set(S_State,null);
}
public String getState(){
return DataType.getAsString(this.get(S_State));
}
public String getStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_State));
}
public void initCreateTime(Timestamp value){
this.initProperty(S_CreateTime,value);
}
public void setCreateTime(Timestamp value){
this.set(S_CreateTime,value);
}
public void setCreateTimeNull(){
this.set(S_CreateTime,null);
}
public Timestamp getCreateTime(){
return DataType.getAsDateTime(this.get(S_CreateTime));
}
public Timestamp getCreateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_CreateTime));
}
public void initUserPid(String value){
this.initProperty(S_UserPid,value);
}
public void setUserPid(String value){
this.set(S_UserPid,value);
}
public void setUserPidNull(){
this.set(S_UserPid,null);
}
public String getUserPid(){
return DataType.getAsString(this.get(S_UserPid));
}
public String getUserPidInitialValue(){
return DataType.getAsString(this.getOldObj(S_UserPid));
}
public void initBatchNo(long value){
this.initProperty(S_BatchNo,new Long(value));
}
public void setBatchNo(long value){
this.set(S_BatchNo,new Long(value));
}
public void setBatchNo(Long value){
this.set(S_BatchNo,value);
}
public Long getBatchNoAsLong(){
return (Long )this.get(S_BatchNo);
}
public void setBatchNoNull(){
this.set(S_BatchNo,null);
}
public long getBatchNo(){
return DataType.getAsLong(this.get(S_BatchNo));
}
public long getBatchNoInitialValue(){
return DataType.getAsLong(this.getOldObj(S_BatchNo));
}
public void initCreateStaffId(String value){
this.initProperty(S_CreateStaffId,value);
}
public void setCreateStaffId(String value){
this.set(S_CreateStaffId,value);
}
public void setCreateStaffIdNull(){
this.set(S_CreateStaffId,null);
}
public String getCreateStaffId(){
return DataType.getAsString(this.get(S_CreateStaffId));
}
public String getCreateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_CreateStaffId));
}
public void initRemark(String value){
this.initProperty(S_Remark,value);
}
public void setRemark(String value){
this.set(S_Remark,value);
}
public void setRemarkNull(){
this.set(S_Remark,null);
}
public String getRemark(){
return DataType.getAsString(this.get(S_Remark));
}
public String getRemarkInitialValue(){
return DataType.getAsString(this.getOldObj(S_Remark));
}
public void initAreaCode(String value){
this.initProperty(S_AreaCode,value);
}
public void setAreaCode(String value){
this.set(S_AreaCode,value);
}
public void setAreaCodeNull(){
this.set(S_AreaCode,null);
}
public String getAreaCode(){
return DataType.getAsString(this.get(S_AreaCode));
}
public String getAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AreaCode));
}
public void initBssSysCode2(String value){
this.initProperty(S_BssSysCode2,value);
}
public void setBssSysCode2(String value){
this.set(S_BssSysCode2,value);
}
public void setBssSysCode2Null(){
this.set(S_BssSysCode2,null);
}
public String getBssSysCode2(){
return DataType.getAsString(this.get(S_BssSysCode2));
}
public String getBssSysCode2InitialValue(){
return DataType.getAsString(this.getOldObj(S_BssSysCode2));
}
public void initDevName(String value){
this.initProperty(S_DevName,value);
}
public void setDevName(String value){
this.set(S_DevName,value);
}
public void setDevNameNull(){
this.set(S_DevName,null);
}
public String getDevName(){
return DataType.getAsString(this.get(S_DevName));
}
public String getDevNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_DevName));
}
public void initHaveBssCode(String value){
this.initProperty(S_HaveBssCode,value);
}
public void setHaveBssCode(String value){
this.set(S_HaveBssCode,value);
}
public void setHaveBssCodeNull(){
this.set(S_HaveBssCode,null);
}
public String getHaveBssCode(){
return DataType.getAsString(this.get(S_HaveBssCode));
}
public String getHaveBssCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_HaveBssCode));
}
public void initLinkmanPhone(String value){
this.initProperty(S_LinkmanPhone,value);
}
public void setLinkmanPhone(String value){
this.set(S_LinkmanPhone,value);
}
public void setLinkmanPhoneNull(){
this.set(S_LinkmanPhone,null);
}
public String getLinkmanPhone(){
return DataType.getAsString(this.get(S_LinkmanPhone));
}
public String getLinkmanPhoneInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanPhone));
}
public void initLinkmanEmail(String value){
this.initProperty(S_LinkmanEmail,value);
}
public void setLinkmanEmail(String value){
this.set(S_LinkmanEmail,value);
}
public void setLinkmanEmailNull(){
this.set(S_LinkmanEmail,null);
}
public String getLinkmanEmail(){
return DataType.getAsString(this.get(S_LinkmanEmail));
}
public String getLinkmanEmailInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanEmail));
}
public void initDevId(long value){
this.initProperty(S_DevId,new Long(value));
}
public void setDevId(long value){
this.set(S_DevId,new Long(value));
}
public void setDevId(Long value){
this.set(S_DevId,value);
}
public Long getDevIdAsLong(){
return (Long )this.get(S_DevId);
}
public void setDevIdNull(){
this.set(S_DevId,null);
}
public long getDevId(){
return DataType.getAsLong(this.get(S_DevId));
}
public long getDevIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_DevId));
}
public void initDevStaffId(String value){
this.initProperty(S_DevStaffId,value);
}
public void setDevStaffId(String value){
this.set(S_DevStaffId,value);
}
public void setDevStaffIdNull(){
this.set(S_DevStaffId,null);
}
public String getDevStaffId(){
return DataType.getAsString(this.get(S_DevStaffId));
}
public String getDevStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_DevStaffId));
}
public void initLinkmanPostcode(String value){
this.initProperty(S_LinkmanPostcode,value);
}
public void setLinkmanPostcode(String value){
this.set(S_LinkmanPostcode,value);
}
public void setLinkmanPostcodeNull(){
this.set(S_LinkmanPostcode,null);
}
public String getLinkmanPostcode(){
return DataType.getAsString(this.get(S_LinkmanPostcode));
}
public String getLinkmanPostcodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanPostcode));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initBssSysCode(String value){
this.initProperty(S_BssSysCode,value);
}
public void setBssSysCode(String value){
this.set(S_BssSysCode,value);
}
public void setBssSysCodeNull(){
this.set(S_BssSysCode,null);
}
public String getBssSysCode(){
return DataType.getAsString(this.get(S_BssSysCode));
}
public String getBssSysCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BssSysCode));
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initBankAcctName(String value){
this.initProperty(S_BankAcctName,value);
}
public void setBankAcctName(String value){
this.set(S_BankAcctName,value);
}
public void setBankAcctNameNull(){
this.set(S_BankAcctName,null);
}
public String getBankAcctName(){
return DataType.getAsString(this.get(S_BankAcctName));
}
public String getBankAcctNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankAcctName));
}
public void initUpdateTime(Timestamp value){
this.initProperty(S_UpdateTime,value);
}
public void setUpdateTime(Timestamp value){
this.set(S_UpdateTime,value);
}
public void setUpdateTimeNull(){
this.set(S_UpdateTime,null);
}
public Timestamp getUpdateTime(){
return DataType.getAsDateTime(this.get(S_UpdateTime));
}
public Timestamp getUpdateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_UpdateTime));
}
public void initDevCode(String value){
this.initProperty(S_DevCode,value);
}
public void setDevCode(String value){
this.set(S_DevCode,value);
}
public void setDevCodeNull(){
this.set(S_DevCode,null);
}
public String getDevCode(){
return DataType.getAsString(this.get(S_DevCode));
}
public String getDevCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_DevCode));
}
public void initBankNo(String value){
this.initProperty(S_BankNo,value);
}
public void setBankNo(String value){
this.set(S_BankNo,value);
}
public void setBankNoNull(){
this.set(S_BankNo,null);
}
public String getBankNo(){
return DataType.getAsString(this.get(S_BankNo));
}
public String getBankNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankNo));
}
public void initCertType(String value){
this.initProperty(S_CertType,value);
}
public void setCertType(String value){
this.set(S_CertType,value);
}
public void setCertTypeNull(){
this.set(S_CertType,null);
}
public String getCertType(){
return DataType.getAsString(this.get(S_CertType));
}
public String getCertTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CertType));
}
public void initLinkmanAddr(String value){
this.initProperty(S_LinkmanAddr,value);
}
public void setLinkmanAddr(String value){
this.set(S_LinkmanAddr,value);
}
public void setLinkmanAddrNull(){
this.set(S_LinkmanAddr,null);
}
public String getLinkmanAddr(){
return DataType.getAsString(this.get(S_LinkmanAddr));
}
public String getLinkmanAddrInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanAddr));
}
public void initPayCommFlag(String value){
this.initProperty(S_PayCommFlag,value);
}
public void setPayCommFlag(String value){
this.set(S_PayCommFlag,value);
}
public void setPayCommFlagNull(){
this.set(S_PayCommFlag,null);
}
public String getPayCommFlag(){
return DataType.getAsString(this.get(S_PayCommFlag));
}
public String getPayCommFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayCommFlag));
}
public void initBankCode(String value){
this.initProperty(S_BankCode,value);
}
public void setBankCode(String value){
this.set(S_BankCode,value);
}
public void setBankCodeNull(){
this.set(S_BankCode,null);
}
public String getBankCode(){
return DataType.getAsString(this.get(S_BankCode));
}
public String getBankCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankCode));
}
public void initOptFlag(String value){
this.initProperty(S_OptFlag,value);
}
public void setOptFlag(String value){
this.set(S_OptFlag,value);
}
public void setOptFlagNull(){
this.set(S_OptFlag,null);
}
public String getOptFlag(){
return DataType.getAsString(this.get(S_OptFlag));
}
public String getOptFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_OptFlag));
}
public void initDevTypeId(String value){
this.initProperty(S_DevTypeId,value);
}
public void setDevTypeId(String value){
this.set(S_DevTypeId,value);
}
public void setDevTypeIdNull(){
this.set(S_DevTypeId,null);
}
public String getDevTypeId(){
return DataType.getAsString(this.get(S_DevTypeId));
}
public String getDevTypeIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_DevTypeId));
}
public void initIsAutoCreate(String value){
this.initProperty(S_IsAutoCreate,value);
}
public void setIsAutoCreate(String value){
this.set(S_IsAutoCreate,value);
}
public void setIsAutoCreateNull(){
this.set(S_IsAutoCreate,null);
}
public String getIsAutoCreate(){
return DataType.getAsString(this.get(S_IsAutoCreate));
}
public String getIsAutoCreateInitialValue(){
return DataType.getAsString(this.getOldObj(S_IsAutoCreate));
}
public void initIsSumBonus(String value){
this.initProperty(S_IsSumBonus,value);
}
public void setIsSumBonus(String value){
this.set(S_IsSumBonus,value);
}
public void setIsSumBonusNull(){
this.set(S_IsSumBonus,null);
}
public String getIsSumBonus(){
return DataType.getAsString(this.get(S_IsSumBonus));
}
public String getIsSumBonusInitialValue(){
return DataType.getAsString(this.getOldObj(S_IsSumBonus));
}
public void initUpdateStaffId(String value){
this.initProperty(S_UpdateStaffId,value);
}
public void setUpdateStaffId(String value){
this.set(S_UpdateStaffId,value);
}
public void setUpdateStaffIdNull(){
this.set(S_UpdateStaffId,null);
}
public String getUpdateStaffId(){
return DataType.getAsString(this.get(S_UpdateStaffId));
}
public String getUpdateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateStaffId));
}
public void initSelfChnlId(String value){
this.initProperty(S_SelfChnlId,value);
}
public void setSelfChnlId(String value){
this.set(S_SelfChnlId,value);
}
public void setSelfChnlIdNull(){
this.set(S_SelfChnlId,null);
}
public String getSelfChnlId(){
return DataType.getAsString(this.get(S_SelfChnlId));
}
public String getSelfChnlIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_SelfChnlId));
}
public void initLinkmanName(String value){
this.initProperty(S_LinkmanName,value);
}
public void setLinkmanName(String value){
this.set(S_LinkmanName,value);
}
public void setLinkmanNameNull(){
this.set(S_LinkmanName,null);
}
public String getLinkmanName(){
return DataType.getAsString(this.get(S_LinkmanName));
}
public String getLinkmanNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanName));
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AgencyBankRealPaymentSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AgencyBankRealPaymentSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AgencyBankRealPaymentSchema.xsd
agencyBankCardRealPay,UNI_BSS_BODY,UNI_BSS_BODY
agencyBankCardRealRefund,UNI_BSS_BODY,UNI_BSS_BODY
qryAgencyBankCardRealPayResult,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>
package cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentdepositrechsyncreq;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
*
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SERVICE_NO">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPER_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPER_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="TRADE_TIME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_FEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BUSI_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="2"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderid",
"serviceno",
"provincecode",
"chnlcode",
"chnlname",
"operno",
"opername",
"tradetime",
"payfee",
"busitype",
"para"
})
@XmlRootElement(name = "AGENT_DEPOSIT_RECH_SYNC_REQ")
public class AGENTDEPOSITRECHSYNCREQ {
@XmlElement(name = "ORDER_ID")
protected String orderid;
@XmlElement(name = "SERVICE_NO", required = true)
protected String serviceno;
@XmlElement(name = "PROVINCE_CODE", required = true)
protected String provincecode;
@XmlElement(name = "CHNL_CODE", required = true)
protected String chnlcode;
@XmlElement(name = "CHNL_NAME", required = true)
protected String chnlname;
@XmlElement(name = "OPER_NO")
protected String operno;
@XmlElement(name = "OPER_NAME")
protected String opername;
@XmlElement(name = "TRADE_TIME", required = true)
protected String tradetime;
@XmlElement(name = "PAY_FEE", required = true)
protected String payfee;
@XmlElement(name = "BUSI_TYPE", required = true)
protected String busitype;
@XmlElement(name = "PARA")
protected List<AGENTDEPOSITRECHSYNCREQ.PARA> para;
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDERID() {
return orderid;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDERID(String value) {
this.orderid = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getSERVICENO() {
return serviceno;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSERVICENO(String value) {
this.serviceno = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCECODE() {
return provincecode;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCECODE(String value) {
this.provincecode = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNLCODE() {
return chnlcode;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNLCODE(String value) {
this.chnlcode = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNLNAME() {
return chnlname;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNLNAME(String value) {
this.chnlname = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERNO() {
return operno;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERNO(String value) {
this.operno = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERNAME() {
return opername;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERNAME(String value) {
this.opername = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getTRADETIME() {
return tradetime;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTRADETIME(String value) {
this.tradetime = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAYFEE() {
return payfee;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAYFEE(String value) {
this.payfee = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSITYPE() {
return busitype;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSITYPE(String value) {
this.busitype = value;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AGENTDEPOSITRECHSYNCREQ.PARA }
*
*
*/
public List<AGENTDEPOSITRECHSYNCREQ.PARA> getPARA() {
if (para == null) {
para = new ArrayList<AGENTDEPOSITRECHSYNCREQ.PARA>();
}
return this.para;
}
/**
*
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraid",
"paravalue"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraid;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paravalue;
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARAID() {
return paraid;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARAID(String value) {
this.paraid = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARAVALUE() {
return paravalue;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARAVALUE(String value) {
this.paravalue = value;
}
}
}
<file_sep>
package cn.chinaunicom.ws.agencybankrealpaymentser.unibssbody;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.agencybankrealpaymentser.unibssbody package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.agencybankrealpaymentser.unibssbody
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_REFUND_OUTPUT }
*
*/
public AGENCY_BANK_CARD_REAL_REFUND_OUTPUT createAGENCY_BANK_CARD_REAL_REFUND_OUTPUT() {
return new AGENCY_BANK_CARD_REAL_REFUND_OUTPUT();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_PAY_OUTPUT }
*
*/
public AGENCY_BANK_CARD_REAL_PAY_OUTPUT createAGENCY_BANK_CARD_REAL_PAY_OUTPUT() {
return new AGENCY_BANK_CARD_REAL_PAY_OUTPUT();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_REFUND_INPUT }
*
*/
public AGENCY_BANK_CARD_REAL_REFUND_INPUT createAGENCY_BANK_CARD_REAL_REFUND_INPUT() {
return new AGENCY_BANK_CARD_REAL_REFUND_INPUT();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_PAY_INPUT }
*
*/
public AGENCY_BANK_CARD_REAL_PAY_INPUT createAGENCY_BANK_CARD_REAL_PAY_INPUT() {
return new AGENCY_BANK_CARD_REAL_PAY_INPUT();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_REFUND_OUTPUT.UNI_BSS_BODY }
*
*/
public AGENCY_BANK_CARD_REAL_REFUND_OUTPUT.UNI_BSS_BODY createAGENCY_BANK_CARD_REAL_REFUND_OUTPUTUNI_BSS_BODY() {
return new AGENCY_BANK_CARD_REAL_REFUND_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_PAY_OUTPUT.UNI_BSS_BODY }
*
*/
public AGENCY_BANK_CARD_REAL_PAY_OUTPUT.UNI_BSS_BODY createAGENCY_BANK_CARD_REAL_PAY_OUTPUTUNI_BSS_BODY() {
return new AGENCY_BANK_CARD_REAL_PAY_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT.UNI_BSS_BODY }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT.UNI_BSS_BODY createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUTUNI_BSS_BODY() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_REFUND_INPUT.UNI_BSS_BODY }
*
*/
public AGENCY_BANK_CARD_REAL_REFUND_INPUT.UNI_BSS_BODY createAGENCY_BANK_CARD_REAL_REFUND_INPUTUNI_BSS_BODY() {
return new AGENCY_BANK_CARD_REAL_REFUND_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT.UNI_BSS_BODY }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT.UNI_BSS_BODY createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUTUNI_BSS_BODY() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link AGENCY_BANK_CARD_REAL_PAY_INPUT.UNI_BSS_BODY }
*
*/
public AGENCY_BANK_CARD_REAL_PAY_INPUT.UNI_BSS_BODY createAGENCY_BANK_CARD_REAL_PAY_INPUTUNI_BSS_BODY() {
return new AGENCY_BANK_CARD_REAL_PAY_INPUT.UNI_BSS_BODY();
}
}
<file_sep>package com.ai.uchintService.ejb.VO.ChannelInfo;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import com.ai.uchintService.ejb.VO.GenericVO;
/**
* 渠道变更通知接口请求VO
* @author yougang
*
*/
public class ChannelInfoChgNotifyReqVO extends GenericVO{
protected String operateTYPE;
protected String orderID;
protected String chnlID;
protected String chnlCODE;
protected String chnlNAME;
protected String chnlDESC;
protected String chnlORGID;
protected String state;
protected String stateDESC;
protected String chnlKINDID;
protected String localKINDID;
protected String chnlCLASSID;
protected String chainFLAG;
protected String isRWDCNT;
protected String paySCOPE;
protected String payCHNLCODE;
protected String superCHNLID;
protected String selfCHNLID;
protected String rwdCNTDATE;
protected String liquidationSTARTDATE;
protected String liquidationPAYFLAG;
protected String provinceCODE;
protected String cityCODE;
protected String managerAREACODE;
protected String areaTYPE;
protected String chnlCHAINLEVEL;
protected String chnlLEVEL;
protected String isINPUTSYSTEM;
protected BigInteger systemNUM;
protected String isMINIHALL;
protected String chnlSCOPE;
protected String chnlAREAKINDID;
protected String bankCODE;
protected String bankNO;
protected String bankACCTNAME;
protected String address;
protected String chnlLINKMANNAME;
protected String chnlLINKMANSEX;
protected String chnlEMAIL;
protected String chnlFAX;
protected String chnlADDR;
protected String chnlOFFICEPHONE;
protected String chnlPHONE;
protected String chnlPOSTALCODE;
protected String longitude;
protected String latitude;
protected String managerDEPTID;
protected String managerSTAFFID;
protected String managerEMAIL;
protected String managerPHONE;
protected String resDEPTID;
protected String applyCODE;
protected String batchNO;
protected String remark;
protected String affiliatetime;
protected String startTIME;
protected String endTIME;
protected String createSTAFFID;
protected String createTIME;
protected String updateDEPARTID;
protected String updateSTAFFID;
protected String updateDATE;
protected String isREALLYCHNL;
protected String juriPSPTID;
protected String cimCHANNELID;
protected String debtWARN;
protected String eparchyCODE;
protected String bCITYCODE;
protected String bZONEID;
protected String bTOWNID;
protected String integral;
protected String penalty;
protected BigInteger foulTIME;
protected String erpCODE;
protected String erpAREACODE;
protected String copartnerID;
protected String parentDEPARTID;
protected String manageCHNLID;
protected String ifMANAGECHNL;
protected String chnlKINDFRAME;
protected String chnlLAYER;
protected String chnlCREDIT;
protected String nationalCHNL;
protected String busiPERMISSION;
protected String juriPSPTTYPE;
protected String juriPERSON;
protected String regDATE;
protected String taxNO;
protected String busiLICENCE;
protected List<ChannelInfoChgNotifyReqVO.EXTINFO> extinfo;
protected ChannelInfoChgNotifyReqVO.FUNCLIST funclist;
protected ChannelInfoChgNotifyReqVO.DEVLIST devlist;
protected List<ChannelInfoChgNotifyReqVO.PARA> para;
public void setExtInfo(List<ChannelInfoChgNotifyReqVO.EXTINFO> extinfo) {
this.extinfo = extinfo;
}
public List<ChannelInfoChgNotifyReqVO.EXTINFO> getExtInfo() {
return extinfo;
}
public String getOPERATE_TYPE() {
return operateTYPE;
}
public void setOPERATE_TYPE(String value) {
this.operateTYPE = value;
}
public String getORDER_ID() {
return orderID;
}
public void setORDER_ID(String value) {
this.orderID = value;
}
public String getCHNL_ID() {
return chnlID;
}
public void setCHNL_ID(String value) {
this.chnlID = value;
}
public String getCHNL_CODE() {
return chnlCODE;
}
public void setCHNL_CODE(String value) {
this.chnlCODE = value;
}
/**
* Gets the value of the chnl_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_NAME() {
return chnlNAME;
}
/**
* Sets the value of the chnl_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_NAME(String value) {
this.chnlNAME = value;
}
/**
* Gets the value of the chnl_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_DESC() {
return chnlDESC;
}
/**
* Sets the value of the chnl_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_DESC(String value) {
this.chnlDESC = value;
}
/**
* Gets the value of the chnl_ORG_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ORG_ID() {
return chnlORGID;
}
/**
* Sets the value of the chnl_ORG_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ORG_ID(String value) {
this.chnlORGID = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE(String value) {
this.state = value;
}
/**
* Gets the value of the state_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE_DESC() {
return stateDESC;
}
/**
* Sets the value of the state_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE_DESC(String value) {
this.stateDESC = value;
}
/**
* Gets the value of the chnl_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_KIND_ID() {
return chnlKINDID;
}
/**
* Sets the value of the chnl_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_KIND_ID(String value) {
this.chnlKINDID = value;
}
/**
* Gets the value of the local_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLOCAL_KIND_ID() {
return localKINDID;
}
/**
* Sets the value of the local_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLOCAL_KIND_ID(String value) {
this.localKINDID = value;
}
/**
* Gets the value of the chnl_CLASS_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CLASS_ID() {
return chnlCLASSID;
}
/**
* Sets the value of the chnl_CLASS_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CLASS_ID(String value) {
this.chnlCLASSID = value;
}
/**
* Gets the value of the chain_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHAIN_FLAG() {
return chainFLAG;
}
/**
* Sets the value of the chain_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHAIN_FLAG(String value) {
this.chainFLAG = value;
}
/**
* Gets the value of the is_RWD_CNT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_RWD_CNT() {
return isRWDCNT;
}
/**
* Sets the value of the is_RWD_CNT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_RWD_CNT(String value) {
this.isRWDCNT = value;
}
/**
* Gets the value of the pay_SCOPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_SCOPE() {
return paySCOPE;
}
/**
* Sets the value of the pay_SCOPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_SCOPE(String value) {
this.paySCOPE = value;
}
/**
* Gets the value of the pay_CHNL_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_CHNL_CODE() {
return payCHNLCODE;
}
/**
* Sets the value of the pay_CHNL_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_CHNL_CODE(String value) {
this.payCHNLCODE = value;
}
/**
* Gets the value of the super_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSUPER_CHNL_ID() {
return superCHNLID;
}
/**
* Sets the value of the super_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUPER_CHNL_ID(String value) {
this.superCHNLID = value;
}
/**
* Gets the value of the self_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSELF_CHNL_ID() {
return selfCHNLID;
}
/**
* Sets the value of the self_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSELF_CHNL_ID(String value) {
this.selfCHNLID = value;
}
/**
* Gets the value of the rwd_CNT_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRWD_CNT_DATE() {
return rwdCNTDATE;
}
/**
* Sets the value of the rwd_CNT_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRWD_CNT_DATE(String value) {
this.rwdCNTDATE = value;
}
/**
* Gets the value of the liquidation_START_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLIQUIDATION_START_DATE() {
return liquidationSTARTDATE;
}
/**
* Sets the value of the liquidation_START_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLIQUIDATION_START_DATE(String value) {
this.liquidationSTARTDATE = value;
}
/**
* Gets the value of the liquidation_PAY_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLIQUIDATION_PAY_FLAG() {
return liquidationPAYFLAG;
}
/**
* Sets the value of the liquidation_PAY_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLIQUIDATION_PAY_FLAG(String value) {
this.liquidationPAYFLAG = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the manager_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_AREA_CODE() {
return managerAREACODE;
}
/**
* Sets the value of the manager_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_AREA_CODE(String value) {
this.managerAREACODE = value;
}
/**
* Gets the value of the area_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_TYPE() {
return areaTYPE;
}
/**
* Sets the value of the area_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_TYPE(String value) {
this.areaTYPE = value;
}
/**
* Gets the value of the chnl_CHAIN_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CHAIN_LEVEL() {
return chnlCHAINLEVEL;
}
/**
* Sets the value of the chnl_CHAIN_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CHAIN_LEVEL(String value) {
this.chnlCHAINLEVEL = value;
}
/**
* Gets the value of the chnl_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LEVEL() {
return chnlLEVEL;
}
/**
* Sets the value of the chnl_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LEVEL(String value) {
this.chnlLEVEL = value;
}
/**
* Gets the value of the is_INPUT_SYSTEM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_INPUT_SYSTEM() {
return isINPUTSYSTEM;
}
/**
* Sets the value of the is_INPUT_SYSTEM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_INPUT_SYSTEM(String value) {
this.isINPUTSYSTEM = value;
}
/**
* Gets the value of the system_NUM property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSYSTEM_NUM() {
return systemNUM;
}
/**
* Sets the value of the system_NUM property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSYSTEM_NUM(BigInteger value) {
this.systemNUM = value;
}
/**
* Gets the value of the is_MINI_HALL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_MINI_HALL() {
return isMINIHALL;
}
/**
* Sets the value of the is_MINI_HALL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_MINI_HALL(String value) {
this.isMINIHALL = value;
}
/**
* Gets the value of the chnl_SCOPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_SCOPE() {
return chnlSCOPE;
}
/**
* Sets the value of the chnl_SCOPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_SCOPE(String value) {
this.chnlSCOPE = value;
}
/**
* Gets the value of the chnl_AREA_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_AREA_KIND_ID() {
return chnlAREAKINDID;
}
/**
* Sets the value of the chnl_AREA_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_AREA_KIND_ID(String value) {
this.chnlAREAKINDID = value;
}
/**
* Gets the value of the bank_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_CODE() {
return bankCODE;
}
/**
* Sets the value of the bank_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_CODE(String value) {
this.bankCODE = value;
}
/**
* Gets the value of the bank_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NO() {
return bankNO;
}
/**
* Sets the value of the bank_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NO(String value) {
this.bankNO = value;
}
/**
* Gets the value of the bank_ACCT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCT_NAME() {
return bankACCTNAME;
}
/**
* Sets the value of the bank_ACCT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCT_NAME(String value) {
this.bankACCTNAME = value;
}
/**
* Gets the value of the address property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getADDRESS() {
return address;
}
/**
* Sets the value of the address property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setADDRESS(String value) {
this.address = value;
}
/**
* Gets the value of the chnl_LINKMAN_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LINKMAN_NAME() {
return chnlLINKMANNAME;
}
/**
* Sets the value of the chnl_LINKMAN_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LINKMAN_NAME(String value) {
this.chnlLINKMANNAME = value;
}
/**
* Gets the value of the chnl_LINKMAN_SEX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LINKMAN_SEX() {
return chnlLINKMANSEX;
}
/**
* Sets the value of the chnl_LINKMAN_SEX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LINKMAN_SEX(String value) {
this.chnlLINKMANSEX = value;
}
/**
* Gets the value of the chnl_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_EMAIL() {
return chnlEMAIL;
}
/**
* Sets the value of the chnl_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_EMAIL(String value) {
this.chnlEMAIL = value;
}
/**
* Gets the value of the chnl_FAX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_FAX() {
return chnlFAX;
}
/**
* Sets the value of the chnl_FAX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_FAX(String value) {
this.chnlFAX = value;
}
/**
* Gets the value of the chnl_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ADDR() {
return chnlADDR;
}
/**
* Sets the value of the chnl_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ADDR(String value) {
this.chnlADDR = value;
}
/**
* Gets the value of the chnl_OFFICE_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_OFFICE_PHONE() {
return chnlOFFICEPHONE;
}
/**
* Sets the value of the chnl_OFFICE_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_OFFICE_PHONE(String value) {
this.chnlOFFICEPHONE = value;
}
/**
* Gets the value of the chnl_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_PHONE() {
return chnlPHONE;
}
/**
* Sets the value of the chnl_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_PHONE(String value) {
this.chnlPHONE = value;
}
/**
* Gets the value of the chnl_POSTALCODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_POSTALCODE() {
return chnlPOSTALCODE;
}
/**
* Sets the value of the chnl_POSTALCODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_POSTALCODE(String value) {
this.chnlPOSTALCODE = value;
}
/**
* Gets the value of the longitude property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLONGITUDE() {
return longitude;
}
/**
* Sets the value of the longitude property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLONGITUDE(String value) {
this.longitude = value;
}
/**
* Gets the value of the latitude property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLATITUDE() {
return latitude;
}
/**
* Sets the value of the latitude property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLATITUDE(String value) {
this.latitude = value;
}
/**
* Gets the value of the manager_DEPT_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_DEPT_ID() {
return managerDEPTID;
}
/**
* Sets the value of the manager_DEPT_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_DEPT_ID(String value) {
this.managerDEPTID = value;
}
/**
* Gets the value of the manager_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_STAFF_ID() {
return managerSTAFFID;
}
/**
* Sets the value of the manager_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_STAFF_ID(String value) {
this.managerSTAFFID = value;
}
/**
* Gets the value of the manager_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_EMAIL() {
return managerEMAIL;
}
/**
* Sets the value of the manager_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_EMAIL(String value) {
this.managerEMAIL = value;
}
/**
* Gets the value of the manager_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_PHONE() {
return managerPHONE;
}
/**
* Sets the value of the manager_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_PHONE(String value) {
this.managerPHONE = value;
}
/**
* Gets the value of the res_DEPT_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRES_DEPT_ID() {
return resDEPTID;
}
/**
* Sets the value of the res_DEPT_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRES_DEPT_ID(String value) {
this.resDEPTID = value;
}
/**
* Gets the value of the apply_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAPPLY_CODE() {
return applyCODE;
}
/**
* Sets the value of the apply_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAPPLY_CODE(String value) {
this.applyCODE = value;
}
/**
* Gets the value of the batch_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_NO() {
return batchNO;
}
/**
* Sets the value of the batch_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_NO(String value) {
this.batchNO = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the affiliatetime property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAFFILIATETIME() {
return affiliatetime;
}
/**
* Sets the value of the affiliatetime property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAFFILIATETIME(String value) {
this.affiliatetime = value;
}
/**
* Gets the value of the start_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_TIME() {
return startTIME;
}
/**
* Sets the value of the start_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_TIME(String value) {
this.startTIME = value;
}
/**
* Gets the value of the end_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_TIME() {
return endTIME;
}
/**
* Sets the value of the end_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_TIME(String value) {
this.endTIME = value;
}
/**
* Gets the value of the create_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_ID() {
return createSTAFFID;
}
/**
* Sets the value of the create_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_ID(String value) {
this.createSTAFFID = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the update_DEPART_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_DEPART_ID() {
return updateDEPARTID;
}
/**
* Sets the value of the update_DEPART_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_DEPART_ID(String value) {
this.updateDEPARTID = value;
}
/**
* Gets the value of the update_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_STAFF_ID() {
return updateSTAFFID;
}
/**
* Sets the value of the update_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_STAFF_ID(String value) {
this.updateSTAFFID = value;
}
/**
* Gets the value of the update_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_DATE() {
return updateDATE;
}
/**
* Sets the value of the update_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_DATE(String value) {
this.updateDATE = value;
}
/**
* Gets the value of the is_REALLY_CHNL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_REALLY_CHNL() {
return isREALLYCHNL;
}
/**
* Sets the value of the is_REALLY_CHNL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_REALLY_CHNL(String value) {
this.isREALLYCHNL = value;
}
/**
* Gets the value of the juri_PSPT_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJURI_PSPT_ID() {
return juriPSPTID;
}
/**
* Sets the value of the juri_PSPT_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJURI_PSPT_ID(String value) {
this.juriPSPTID = value;
}
/**
* Gets the value of the cim_CHANNEL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCIM_CHANNEL_ID() {
return cimCHANNELID;
}
/**
* Sets the value of the cim_CHANNEL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCIM_CHANNEL_ID(String value) {
this.cimCHANNELID = value;
}
/**
* Gets the value of the debt_WARN property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEBT_WARN() {
return debtWARN;
}
/**
* Sets the value of the debt_WARN property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEBT_WARN(String value) {
this.debtWARN = value;
}
/**
* Gets the value of the eparchy_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEPARCHY_CODE() {
return eparchyCODE;
}
/**
* Sets the value of the eparchy_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEPARCHY_CODE(String value) {
this.eparchyCODE = value;
}
/**
* Gets the value of the b_CITY_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB_CITY_CODE() {
return bCITYCODE;
}
/**
* Sets the value of the b_CITY_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB_CITY_CODE(String value) {
this.bCITYCODE = value;
}
/**
* Gets the value of the b_ZONEID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB_ZONEID() {
return bZONEID;
}
/**
* Sets the value of the b_ZONEID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB_ZONEID(String value) {
this.bZONEID = value;
}
/**
* Gets the value of the b_TOWNID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB_TOWNID() {
return bTOWNID;
}
/**
* Sets the value of the b_TOWNID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB_TOWNID(String value) {
this.bTOWNID = value;
}
/**
* Gets the value of the integral property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINTEGRAL() {
return integral;
}
/**
* Sets the value of the integral property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINTEGRAL(String value) {
this.integral = value;
}
/**
* Gets the value of the penalty property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPENALTY() {
return penalty;
}
/**
* Sets the value of the penalty property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPENALTY(String value) {
this.penalty = value;
}
/**
* Gets the value of the foul_TIME property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getFOUL_TIME() {
return foulTIME;
}
/**
* Sets the value of the foul_TIME property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setFOUL_TIME(BigInteger value) {
this.foulTIME = value;
}
/**
* Gets the value of the erp_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getERP_CODE() {
return erpCODE;
}
/**
* Sets the value of the erp_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setERP_CODE(String value) {
this.erpCODE = value;
}
/**
* Gets the value of the erp_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getERP_AREA_CODE() {
return erpAREACODE;
}
/**
* Sets the value of the erp_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setERP_AREA_CODE(String value) {
this.erpAREACODE = value;
}
/**
* Gets the value of the copartner_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOPARTNER_ID() {
return copartnerID;
}
/**
* Sets the value of the copartner_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOPARTNER_ID(String value) {
this.copartnerID = value;
}
/**
* Gets the value of the parent_DEPART_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARENT_DEPART_ID() {
return parentDEPARTID;
}
/**
* Sets the value of the parent_DEPART_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARENT_DEPART_ID(String value) {
this.parentDEPARTID = value;
}
/**
* Gets the value of the manage_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGE_CHNL_ID() {
return manageCHNLID;
}
/**
* Sets the value of the manage_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGE_CHNL_ID(String value) {
this.manageCHNLID = value;
}
/**
* Gets the value of the if_MANAGE_CHNL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIF_MANAGE_CHNL() {
return ifMANAGECHNL;
}
/**
* Sets the value of the if_MANAGE_CHNL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIF_MANAGE_CHNL(String value) {
this.ifMANAGECHNL = value;
}
/**
* Gets the value of the chnl_KIND_FRAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_KIND_FRAME() {
return chnlKINDFRAME;
}
/**
* Sets the value of the chnl_KIND_FRAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_KIND_FRAME(String value) {
this.chnlKINDFRAME = value;
}
/**
* Gets the value of the chnl_LAYER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LAYER() {
return chnlLAYER;
}
/**
* Sets the value of the chnl_LAYER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LAYER(String value) {
this.chnlLAYER = value;
}
/**
* Gets the value of the chnl_CREDIT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CREDIT() {
return chnlCREDIT;
}
/**
* Sets the value of the chnl_CREDIT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CREDIT(String value) {
this.chnlCREDIT = value;
}
/**
* Gets the value of the national_CHNL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNATIONAL_CHNL() {
return nationalCHNL;
}
/**
* Sets the value of the national_CHNL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNATIONAL_CHNL(String value) {
this.nationalCHNL = value;
}
/**
* Gets the value of the busi_PERMISSION property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_PERMISSION() {
return busiPERMISSION;
}
/**
* Sets the value of the busi_PERMISSION property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_PERMISSION(String value) {
this.busiPERMISSION = value;
}
/**
* Gets the value of the juri_PSPT_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJURI_PSPT_TYPE() {
return juriPSPTTYPE;
}
/**
* Sets the value of the juri_PSPT_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJURI_PSPT_TYPE(String value) {
this.juriPSPTTYPE = value;
}
/**
* Gets the value of the juri_PERSON property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJURI_PERSON() {
return juriPERSON;
}
/**
* Sets the value of the juri_PERSON property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJURI_PERSON(String value) {
this.juriPERSON = value;
}
/**
* Gets the value of the reg_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREG_DATE() {
return regDATE;
}
/**
* Sets the value of the reg_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREG_DATE(String value) {
this.regDATE = value;
}
/**
* Gets the value of the tax_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAX_NO() {
return taxNO;
}
/**
* Sets the value of the tax_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAX_NO(String value) {
this.taxNO = value;
}
/**
* Gets the value of the busi_LICENCE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_LICENCE() {
return busiLICENCE;
}
/**
* Sets the value of the busi_LICENCE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_LICENCE(String value) {
this.busiLICENCE = value;
}
public List<ChannelInfoChgNotifyReqVO.EXTINFO> getEXTINFO() {
if (extinfo == null) {
extinfo = new ArrayList<ChannelInfoChgNotifyReqVO.EXTINFO>();
}
return this.extinfo;
}
/**
* Gets the value of the funclist property.
*
* @return
* possible object is
* {@link ChannelInfoChgNotifyReqVO.FUNCLIST }
*
*/
public ChannelInfoChgNotifyReqVO.FUNCLIST getFUNCLIST() {
return funclist;
}
/**
* Sets the value of the funclist property.
*
* @param value
* allowed object is
* {@link ChannelInfoChgNotifyReqVO.FUNCLIST }
*
*/
public void setFUNCLIST(ChannelInfoChgNotifyReqVO.FUNCLIST value) {
this.funclist = value;
}
/**
* Gets the value of the devlist property.
*
* @return
* possible object is
* {@link ChannelInfoChgNotifyReqVO.DEVLIST }
*
*/
public ChannelInfoChgNotifyReqVO.DEVLIST getDEVLIST() {
return devlist;
}
/**
* Sets the value of the devlist property.
*
* @param value
* allowed object is
* {@link ChannelInfoChgNotifyReqVO.DEVLIST }
*
*/
public void setDEVLIST(ChannelInfoChgNotifyReqVO.DEVLIST value) {
this.devlist = value;
}
public List<ChannelInfoChgNotifyReqVO.PARA> getPARA() {
if (para == null) {
para = new ArrayList<ChannelInfoChgNotifyReqVO.PARA>();
}
return this.para;
}
public static class DEVLIST extends GenericVO{
protected List<ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO> devinfo;
public List<ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO> getDEVINFO() {
if (devinfo == null) {
devinfo = new ArrayList<ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO>();
}
return this.devinfo;
}
public static class DEVINFO extends GenericVO{
protected ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO chnldevinfo;
protected ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER developer;
public ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO getCHNLDEVINFO() {
return chnldevinfo;
}
public void setCHNLDEVINFO(ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO value) {
this.chnldevinfo = value;
}
/**
* Gets the value of the developer property.
*
* @return
* possible object is
* {@link ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER }
*
*/
public ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER getDEVELOPER() {
return developer;
}
/**
* Sets the value of the developer property.
*
* @param value
* allowed object is
* {@link ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER }
*
*/
public void setDEVELOPER(ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER value) {
this.developer = value;
}
public static class CHNLDEVINFO extends GenericVO{
protected String orderID;
protected String chnlDEVID;
protected String chnlID;
protected String devID;
protected String startTIME;
protected String endTIME;
protected String state;
protected String optFLAG;
protected String remark;
protected String createSTAFFID;
protected String createTIME;
protected String updateSTAFFID;
protected String updateTIME;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_DEV_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_DEV_ID() {
return chnlDEVID;
}
/**
* Sets the value of the chnl_DEV_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_DEV_ID(String value) {
this.chnlDEVID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the dev_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_ID() {
return devID;
}
/**
* Sets the value of the dev_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_ID(String value) {
this.devID = value;
}
/**
* Gets the value of the start_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_TIME() {
return startTIME;
}
/**
* Sets the value of the start_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_TIME(String value) {
this.startTIME = value;
}
/**
* Gets the value of the end_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_TIME() {
return endTIME;
}
/**
* Sets the value of the end_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_TIME(String value) {
this.endTIME = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE(String value) {
this.state = value;
}
/**
* Gets the value of the opt_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPT_FLAG() {
return optFLAG;
}
/**
* Sets the value of the opt_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPT_FLAG(String value) {
this.optFLAG = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the create_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_ID() {
return createSTAFFID;
}
/**
* Sets the value of the create_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_ID(String value) {
this.createSTAFFID = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the update_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_STAFF_ID() {
return updateSTAFFID;
}
/**
* Sets the value of the update_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_STAFF_ID(String value) {
this.updateSTAFFID = value;
}
/**
* Gets the value of the update_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_TIME() {
return updateTIME;
}
/**
* Sets the value of the update_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_TIME(String value) {
this.updateTIME = value;
}
public String getOrderID() {
return orderID;
}
public void setOrderID(String orderID) {
this.orderID = orderID;
}
public String getChnlDEVID() {
return chnlDEVID;
}
public void setChnlDEVID(String chnlDEVID) {
this.chnlDEVID = chnlDEVID;
}
public String getChnlID() {
return chnlID;
}
public void setChnlID(String chnlID) {
this.chnlID = chnlID;
}
public String getDevID() {
return devID;
}
public void setDevID(String devID) {
this.devID = devID;
}
public String getStartTIME() {
return startTIME;
}
public void setStartTIME(String startTIME) {
this.startTIME = startTIME;
}
public String getEndTIME() {
return endTIME;
}
public void setEndTIME(String endTIME) {
this.endTIME = endTIME;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getOptFLAG() {
return optFLAG;
}
public void setOptFLAG(String optFLAG) {
this.optFLAG = optFLAG;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getCreateSTAFFID() {
return createSTAFFID;
}
public void setCreateSTAFFID(String createSTAFFID) {
this.createSTAFFID = createSTAFFID;
}
public String getCreateTIME() {
return createTIME;
}
public void setCreateTIME(String createTIME) {
this.createTIME = createTIME;
}
public String getUpdateSTAFFID() {
return updateSTAFFID;
}
public void setUpdateSTAFFID(String updateSTAFFID) {
this.updateSTAFFID = updateSTAFFID;
}
public String getUpdateTIME() {
return updateTIME;
}
public void setUpdateTIME(String updateTIME) {
this.updateTIME = updateTIME;
}
}
public static class DEVELOPER extends GenericVO{
protected String orderID;
protected String devID;
protected String devCODE;
protected String devTYPEID;
protected String devNAME;
protected String provinceCODE;
protected String cityCODE;
protected String areaCODE;
protected String devSTAFFID;
protected String groupACCT;
protected String certTYPE;
protected String userPID;
protected String payCOMMFLAG;
protected String bankCODE;
protected String bankNO;
protected String bankACCTNAME;
protected String linkmanNAME;
protected String linkmanPHONE;
protected String linkmanEMAIL;
protected String linkmanADDR;
protected String linkmanPOSTCODE;
protected String createSTAFFID;
protected String createTIME;
protected String updateSTAFFID;
protected String updateTIME;
protected String batchNO;
protected String optFLAG;
protected String remark;
protected String haveBSSCODE;
protected String bssSYSCODE;
protected String bssSYSCODE2;
protected String isAUTOCREATE;
protected String selfCHNLID;
protected String isSUMBONUS;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the dev_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_ID() {
return devID;
}
/**
* Sets the value of the dev_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_ID(String value) {
this.devID = value;
}
/**
* Gets the value of the dev_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_CODE() {
return devCODE;
}
/**
* Sets the value of the dev_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_CODE(String value) {
this.devCODE = value;
}
/**
* Gets the value of the dev_TYPE_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_TYPE_ID() {
return devTYPEID;
}
/**
* Sets the value of the dev_TYPE_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_TYPE_ID(String value) {
this.devTYPEID = value;
}
/**
* Gets the value of the dev_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_NAME() {
return devNAME;
}
/**
* Sets the value of the dev_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_NAME(String value) {
this.devNAME = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the area_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_CODE() {
return areaCODE;
}
/**
* Sets the value of the area_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_CODE(String value) {
this.areaCODE = value;
}
/**
* Gets the value of the dev_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_STAFF_ID() {
return devSTAFFID;
}
/**
* Sets the value of the dev_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_STAFF_ID(String value) {
this.devSTAFFID = value;
}
/**
* Gets the value of the group_ACCT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGROUP_ACCT() {
return groupACCT;
}
/**
* Sets the value of the group_ACCT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGROUP_ACCT(String value) {
this.groupACCT = value;
}
/**
* Gets the value of the cert_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCERT_TYPE() {
return certTYPE;
}
/**
* Sets the value of the cert_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCERT_TYPE(String value) {
this.certTYPE = value;
}
/**
* Gets the value of the user_PID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSER_PID() {
return userPID;
}
/**
* Sets the value of the user_PID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSER_PID(String value) {
this.userPID = value;
}
/**
* Gets the value of the pay_COMM_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_COMM_FLAG() {
return payCOMMFLAG;
}
/**
* Sets the value of the pay_COMM_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_COMM_FLAG(String value) {
this.payCOMMFLAG = value;
}
/**
* Gets the value of the bank_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_CODE() {
return bankCODE;
}
/**
* Sets the value of the bank_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_CODE(String value) {
this.bankCODE = value;
}
/**
* Gets the value of the bank_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NO() {
return bankNO;
}
/**
* Sets the value of the bank_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NO(String value) {
this.bankNO = value;
}
/**
* Gets the value of the bank_ACCT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCT_NAME() {
return bankACCTNAME;
}
/**
* Sets the value of the bank_ACCT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCT_NAME(String value) {
this.bankACCTNAME = value;
}
/**
* Gets the value of the linkman_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_NAME() {
return linkmanNAME;
}
/**
* Sets the value of the linkman_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_NAME(String value) {
this.linkmanNAME = value;
}
/**
* Gets the value of the linkman_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_PHONE() {
return linkmanPHONE;
}
/**
* Sets the value of the linkman_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_PHONE(String value) {
this.linkmanPHONE = value;
}
/**
* Gets the value of the linkman_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_EMAIL() {
return linkmanEMAIL;
}
/**
* Sets the value of the linkman_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_EMAIL(String value) {
this.linkmanEMAIL = value;
}
/**
* Gets the value of the linkman_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_ADDR() {
return linkmanADDR;
}
/**
* Sets the value of the linkman_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_ADDR(String value) {
this.linkmanADDR = value;
}
/**
* Gets the value of the linkman_POSTCODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_POSTCODE() {
return linkmanPOSTCODE;
}
/**
* Sets the value of the linkman_POSTCODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_POSTCODE(String value) {
this.linkmanPOSTCODE = value;
}
/**
* Gets the value of the create_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_ID() {
return createSTAFFID;
}
/**
* Sets the value of the create_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_ID(String value) {
this.createSTAFFID = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the update_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_STAFF_ID() {
return updateSTAFFID;
}
/**
* Sets the value of the update_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_STAFF_ID(String value) {
this.updateSTAFFID = value;
}
/**
* Gets the value of the update_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_TIME() {
return updateTIME;
}
/**
* Sets the value of the update_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_TIME(String value) {
this.updateTIME = value;
}
/**
* Gets the value of the batch_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_NO() {
return batchNO;
}
/**
* Sets the value of the batch_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_NO(String value) {
this.batchNO = value;
}
/**
* Gets the value of the opt_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPT_FLAG() {
return optFLAG;
}
/**
* Sets the value of the opt_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPT_FLAG(String value) {
this.optFLAG = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the have_BSS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHAVE_BSS_CODE() {
return haveBSSCODE;
}
/**
* Sets the value of the have_BSS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHAVE_BSS_CODE(String value) {
this.haveBSSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE() {
return bssSYSCODE;
}
/**
* Sets the value of the bss_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE(String value) {
this.bssSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE2() {
return bssSYSCODE2;
}
/**
* Sets the value of the bss_SYS_CODE2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE2(String value) {
this.bssSYSCODE2 = value;
}
/**
* Gets the value of the is_AUTO_CREATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_AUTO_CREATE() {
return isAUTOCREATE;
}
/**
* Sets the value of the is_AUTO_CREATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_AUTO_CREATE(String value) {
this.isAUTOCREATE = value;
}
/**
* Gets the value of the self_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSELF_CHNL_ID() {
return selfCHNLID;
}
/**
* Sets the value of the self_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSELF_CHNL_ID(String value) {
this.selfCHNLID = value;
}
/**
* Gets the value of the is_SUM_BONUS property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_SUM_BONUS() {
return isSUMBONUS;
}
/**
* Sets the value of the is_SUM_BONUS property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_SUM_BONUS(String value) {
this.isSUMBONUS = value;
}
public String getOrderID() {
return orderID;
}
public void setOrderID(String orderID) {
this.orderID = orderID;
}
public String getDevID() {
return devID;
}
public void setDevID(String devID) {
this.devID = devID;
}
public String getDevCODE() {
return devCODE;
}
public void setDevCODE(String devCODE) {
this.devCODE = devCODE;
}
public String getDevTYPEID() {
return devTYPEID;
}
public void setDevTYPEID(String devTYPEID) {
this.devTYPEID = devTYPEID;
}
public String getDevNAME() {
return devNAME;
}
public void setDevNAME(String devNAME) {
this.devNAME = devNAME;
}
public String getProvinceCODE() {
return provinceCODE;
}
public void setProvinceCODE(String provinceCODE) {
this.provinceCODE = provinceCODE;
}
public String getCityCODE() {
return cityCODE;
}
public void setCityCODE(String cityCODE) {
this.cityCODE = cityCODE;
}
public String getAreaCODE() {
return areaCODE;
}
public void setAreaCODE(String areaCODE) {
this.areaCODE = areaCODE;
}
public String getDevSTAFFID() {
return devSTAFFID;
}
public void setDevSTAFFID(String devSTAFFID) {
this.devSTAFFID = devSTAFFID;
}
public String getGroupACCT() {
return groupACCT;
}
public void setGroupACCT(String groupACCT) {
this.groupACCT = groupACCT;
}
public String getCertTYPE() {
return certTYPE;
}
public void setCertTYPE(String certTYPE) {
this.certTYPE = certTYPE;
}
public String getUserPID() {
return userPID;
}
public void setUserPID(String userPID) {
this.userPID = userPID;
}
public String getPayCOMMFLAG() {
return payCOMMFLAG;
}
public void setPayCOMMFLAG(String payCOMMFLAG) {
this.payCOMMFLAG = payCOMMFLAG;
}
public String getBankCODE() {
return bankCODE;
}
public void setBankCODE(String bankCODE) {
this.bankCODE = bankCODE;
}
public String getBankNO() {
return bankNO;
}
public void setBankNO(String bankNO) {
this.bankNO = bankNO;
}
public String getBankACCTNAME() {
return bankACCTNAME;
}
public void setBankACCTNAME(String bankACCTNAME) {
this.bankACCTNAME = bankACCTNAME;
}
public String getLinkmanNAME() {
return linkmanNAME;
}
public void setLinkmanNAME(String linkmanNAME) {
this.linkmanNAME = linkmanNAME;
}
public String getLinkmanPHONE() {
return linkmanPHONE;
}
public void setLinkmanPHONE(String linkmanPHONE) {
this.linkmanPHONE = linkmanPHONE;
}
public String getLinkmanEMAIL() {
return linkmanEMAIL;
}
public void setLinkmanEMAIL(String linkmanEMAIL) {
this.linkmanEMAIL = linkmanEMAIL;
}
public String getLinkmanADDR() {
return linkmanADDR;
}
public void setLinkmanADDR(String linkmanADDR) {
this.linkmanADDR = linkmanADDR;
}
public String getLinkmanPOSTCODE() {
return linkmanPOSTCODE;
}
public void setLinkmanPOSTCODE(String linkmanPOSTCODE) {
this.linkmanPOSTCODE = linkmanPOSTCODE;
}
public String getCreateSTAFFID() {
return createSTAFFID;
}
public void setCreateSTAFFID(String createSTAFFID) {
this.createSTAFFID = createSTAFFID;
}
public String getCreateTIME() {
return createTIME;
}
public void setCreateTIME(String createTIME) {
this.createTIME = createTIME;
}
public String getUpdateSTAFFID() {
return updateSTAFFID;
}
public void setUpdateSTAFFID(String updateSTAFFID) {
this.updateSTAFFID = updateSTAFFID;
}
public String getUpdateTIME() {
return updateTIME;
}
public void setUpdateTIME(String updateTIME) {
this.updateTIME = updateTIME;
}
public String getBatchNO() {
return batchNO;
}
public void setBatchNO(String batchNO) {
this.batchNO = batchNO;
}
public String getOptFLAG() {
return optFLAG;
}
public void setOptFLAG(String optFLAG) {
this.optFLAG = optFLAG;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getHaveBSSCODE() {
return haveBSSCODE;
}
public void setHaveBSSCODE(String haveBSSCODE) {
this.haveBSSCODE = haveBSSCODE;
}
public String getBssSYSCODE() {
return bssSYSCODE;
}
public void setBssSYSCODE(String bssSYSCODE) {
this.bssSYSCODE = bssSYSCODE;
}
public String getBssSYSCODE2() {
return bssSYSCODE2;
}
public void setBssSYSCODE2(String bssSYSCODE2) {
this.bssSYSCODE2 = bssSYSCODE2;
}
public String getIsAUTOCREATE() {
return isAUTOCREATE;
}
public void setIsAUTOCREATE(String isAUTOCREATE) {
this.isAUTOCREATE = isAUTOCREATE;
}
public String getSelfCHNLID() {
return selfCHNLID;
}
public void setSelfCHNLID(String selfCHNLID) {
this.selfCHNLID = selfCHNLID;
}
public String getIsSUMBONUS() {
return isSUMBONUS;
}
public void setIsSUMBONUS(String isSUMBONUS) {
this.isSUMBONUS = isSUMBONUS;
}
}
public ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO getChnldevinfo() {
return chnldevinfo;
}
public void setChnldevinfo(
ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO chnldevinfo) {
this.chnldevinfo = chnldevinfo;
}
public ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER getDeveloper() {
return developer;
}
public void setDeveloper(
ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER developer) {
this.developer = developer;
}
}
public List<ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO> getDevinfo() {
return devinfo;
}
public void setDevinfo(List<ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO> devinfo) {
this.devinfo = devinfo;
}
}
public static class EXTINFO extends GenericVO{
protected String orderID;
protected String chnlID;
protected String deposit;
protected String penalty;
protected String complainRATE;
protected String industryCLASSCODE;
protected String industryMERIT;
protected String essSYSCODE;
protected String bssSYSCODE;
protected String bssSYSCODE2;
protected String saleSYSCODE;
protected String otherSYSCODE;
protected String sysSTAFFID;
protected String haveBSSCODE;
protected String busiFEEISCLEAR;
protected String earnestISCLEAR;
protected String commISCLEAR;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the deposit property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPOSIT() {
return deposit;
}
/**
* Sets the value of the deposit property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPOSIT(String value) {
this.deposit = value;
}
/**
* Gets the value of the penalty property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPENALTY() {
return penalty;
}
/**
* Sets the value of the penalty property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPENALTY(String value) {
this.penalty = value;
}
/**
* Gets the value of the complain_RATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOMPLAIN_RATE() {
return complainRATE;
}
/**
* Sets the value of the complain_RATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOMPLAIN_RATE(String value) {
this.complainRATE = value;
}
/**
* Gets the value of the industry_CLASS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINDUSTRY_CLASS_CODE() {
return industryCLASSCODE;
}
/**
* Sets the value of the industry_CLASS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINDUSTRY_CLASS_CODE(String value) {
this.industryCLASSCODE = value;
}
/**
* Gets the value of the industry_MERIT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINDUSTRY_MERIT() {
return industryMERIT;
}
/**
* Sets the value of the industry_MERIT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINDUSTRY_MERIT(String value) {
this.industryMERIT = value;
}
/**
* Gets the value of the ess_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getESS_SYS_CODE() {
return essSYSCODE;
}
/**
* Sets the value of the ess_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setESS_SYS_CODE(String value) {
this.essSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE() {
return bssSYSCODE;
}
/**
* Sets the value of the bss_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE(String value) {
this.bssSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE2() {
return bssSYSCODE2;
}
/**
* Sets the value of the bss_SYS_CODE2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE2(String value) {
this.bssSYSCODE2 = value;
}
/**
* Gets the value of the sale_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSALE_SYS_CODE() {
return saleSYSCODE;
}
/**
* Sets the value of the sale_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSALE_SYS_CODE(String value) {
this.saleSYSCODE = value;
}
/**
* Gets the value of the other_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOTHER_SYS_CODE() {
return otherSYSCODE;
}
/**
* Sets the value of the other_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOTHER_SYS_CODE(String value) {
this.otherSYSCODE = value;
}
/**
* Gets the value of the sys_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSYS_STAFF_ID() {
return sysSTAFFID;
}
/**
* Sets the value of the sys_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSYS_STAFF_ID(String value) {
this.sysSTAFFID = value;
}
/**
* Gets the value of the have_BSS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHAVE_BSS_CODE() {
return haveBSSCODE;
}
/**
* Sets the value of the have_BSS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHAVE_BSS_CODE(String value) {
this.haveBSSCODE = value;
}
/**
* Gets the value of the busi_FEE_IS_CLEAR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_FEE_IS_CLEAR() {
return busiFEEISCLEAR;
}
/**
* Sets the value of the busi_FEE_IS_CLEAR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_FEE_IS_CLEAR(String value) {
this.busiFEEISCLEAR = value;
}
/**
* Gets the value of the earnest_IS_CLEAR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEARNEST_IS_CLEAR() {
return earnestISCLEAR;
}
/**
* Sets the value of the earnest_IS_CLEAR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEARNEST_IS_CLEAR(String value) {
this.earnestISCLEAR = value;
}
/**
* Gets the value of the comm_IS_CLEAR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOMM_IS_CLEAR() {
return commISCLEAR;
}
/**
* Sets the value of the comm_IS_CLEAR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOMM_IS_CLEAR(String value) {
this.commISCLEAR = value;
}
public String getOrderID() {
return orderID;
}
public void setOrderID(String orderID) {
this.orderID = orderID;
}
public String getChnlID() {
return chnlID;
}
public void setChnlID(String chnlID) {
this.chnlID = chnlID;
}
public String getDeposit() {
return deposit;
}
public void setDeposit(String deposit) {
this.deposit = deposit;
}
public String getPenalty() {
return penalty;
}
public void setPenalty(String penalty) {
this.penalty = penalty;
}
public String getComplainRATE() {
return complainRATE;
}
public void setComplainRATE(String complainRATE) {
this.complainRATE = complainRATE;
}
public String getIndustryCLASSCODE() {
return industryCLASSCODE;
}
public void setIndustryCLASSCODE(String industryCLASSCODE) {
this.industryCLASSCODE = industryCLASSCODE;
}
public String getIndustryMERIT() {
return industryMERIT;
}
public void setIndustryMERIT(String industryMERIT) {
this.industryMERIT = industryMERIT;
}
public String getEssSYSCODE() {
return essSYSCODE;
}
public void setEssSYSCODE(String essSYSCODE) {
this.essSYSCODE = essSYSCODE;
}
public String getBssSYSCODE() {
return bssSYSCODE;
}
public void setBssSYSCODE(String bssSYSCODE) {
this.bssSYSCODE = bssSYSCODE;
}
public String getBssSYSCODE2() {
return bssSYSCODE2;
}
public void setBssSYSCODE2(String bssSYSCODE2) {
this.bssSYSCODE2 = bssSYSCODE2;
}
public String getSaleSYSCODE() {
return saleSYSCODE;
}
public void setSaleSYSCODE(String saleSYSCODE) {
this.saleSYSCODE = saleSYSCODE;
}
public String getOtherSYSCODE() {
return otherSYSCODE;
}
public void setOtherSYSCODE(String otherSYSCODE) {
this.otherSYSCODE = otherSYSCODE;
}
public String getSysSTAFFID() {
return sysSTAFFID;
}
public void setSysSTAFFID(String sysSTAFFID) {
this.sysSTAFFID = sysSTAFFID;
}
public String getHaveBSSCODE() {
return haveBSSCODE;
}
public void setHaveBSSCODE(String haveBSSCODE) {
this.haveBSSCODE = haveBSSCODE;
}
public String getBusiFEEISCLEAR() {
return busiFEEISCLEAR;
}
public void setBusiFEEISCLEAR(String busiFEEISCLEAR) {
this.busiFEEISCLEAR = busiFEEISCLEAR;
}
public String getEarnestISCLEAR() {
return earnestISCLEAR;
}
public void setEarnestISCLEAR(String earnestISCLEAR) {
this.earnestISCLEAR = earnestISCLEAR;
}
public String getCommISCLEAR() {
return commISCLEAR;
}
public void setCommISCLEAR(String commISCLEAR) {
this.commISCLEAR = commISCLEAR;
}
}
public static class FUNCLIST extends GenericVO{
protected List<ChannelInfoChgNotifyReqVO.FUNCLIST.FUNCINFO> funcinfo;
public List<ChannelInfoChgNotifyReqVO.FUNCLIST.FUNCINFO> getFUNCINFO() {
if (funcinfo == null) {
funcinfo = new ArrayList<ChannelInfoChgNotifyReqVO.FUNCLIST.FUNCINFO>();
}
return this.funcinfo;
}
public static class FUNCINFO extends GenericVO{
protected String orderID;
protected String chnlID;
protected String chnlFUNCCTLID;
protected String funcCTLID;
protected String funcTYPE;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the chnl_FUNC_CTL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_FUNC_CTL_ID() {
return chnlFUNCCTLID;
}
/**
* Sets the value of the chnl_FUNC_CTL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_FUNC_CTL_ID(String value) {
this.chnlFUNCCTLID = value;
}
/**
* Gets the value of the func_CTL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFUNC_CTL_ID() {
return funcCTLID;
}
/**
* Sets the value of the func_CTL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFUNC_CTL_ID(String value) {
this.funcCTLID = value;
}
/**
* Gets the value of the func_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFUNC_TYPE() {
return funcTYPE;
}
/**
* Sets the value of the func_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFUNC_TYPE(String value) {
this.funcTYPE = value;
}
public String getOrderID() {
return orderID;
}
public void setOrderID(String orderID) {
this.orderID = orderID;
}
public String getChnlID() {
return chnlID;
}
public void setChnlID(String chnlID) {
this.chnlID = chnlID;
}
public String getChnlFUNCCTLID() {
return chnlFUNCCTLID;
}
public void setChnlFUNCCTLID(String chnlFUNCCTLID) {
this.chnlFUNCCTLID = chnlFUNCCTLID;
}
public String getFuncCTLID() {
return funcCTLID;
}
public void setFuncCTLID(String funcCTLID) {
this.funcCTLID = funcCTLID;
}
public String getFuncTYPE() {
return funcTYPE;
}
public void setFuncTYPE(String funcTYPE) {
this.funcTYPE = funcTYPE;
}
}
}
public static class PARA extends GenericVO{
protected String paraID;
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
public String getOperateTYPE() {
return operateTYPE;
}
public void setOperateTYPE(String operateTYPE) {
this.operateTYPE = operateTYPE;
}
public String getOrderID() {
return orderID;
}
public void setOrderID(String orderID) {
this.orderID = orderID;
}
public String getChnlID() {
return chnlID;
}
public void setChnlID(String chnlID) {
this.chnlID = chnlID;
}
public String getChnlCODE() {
return chnlCODE;
}
public void setChnlCODE(String chnlCODE) {
this.chnlCODE = chnlCODE;
}
public String getChnlNAME() {
return chnlNAME;
}
public void setChnlNAME(String chnlNAME) {
this.chnlNAME = chnlNAME;
}
public String getChnlDESC() {
return chnlDESC;
}
public void setChnlDESC(String chnlDESC) {
this.chnlDESC = chnlDESC;
}
public String getChnlORGID() {
return chnlORGID;
}
public void setChnlORGID(String chnlORGID) {
this.chnlORGID = chnlORGID;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStateDESC() {
return stateDESC;
}
public void setStateDESC(String stateDESC) {
this.stateDESC = stateDESC;
}
public String getChnlKINDID() {
return chnlKINDID;
}
public void setChnlKINDID(String chnlKINDID) {
this.chnlKINDID = chnlKINDID;
}
public String getLocalKINDID() {
return localKINDID;
}
public void setLocalKINDID(String localKINDID) {
this.localKINDID = localKINDID;
}
public String getChnlCLASSID() {
return chnlCLASSID;
}
public void setChnlCLASSID(String chnlCLASSID) {
this.chnlCLASSID = chnlCLASSID;
}
public String getChainFLAG() {
return chainFLAG;
}
public void setChainFLAG(String chainFLAG) {
this.chainFLAG = chainFLAG;
}
public String getIsRWDCNT() {
return isRWDCNT;
}
public void setIsRWDCNT(String isRWDCNT) {
this.isRWDCNT = isRWDCNT;
}
public String getPaySCOPE() {
return paySCOPE;
}
public void setPaySCOPE(String paySCOPE) {
this.paySCOPE = paySCOPE;
}
public String getPayCHNLCODE() {
return payCHNLCODE;
}
public void setPayCHNLCODE(String payCHNLCODE) {
this.payCHNLCODE = payCHNLCODE;
}
public String getSuperCHNLID() {
return superCHNLID;
}
public void setSuperCHNLID(String superCHNLID) {
this.superCHNLID = superCHNLID;
}
public String getSelfCHNLID() {
return selfCHNLID;
}
public void setSelfCHNLID(String selfCHNLID) {
this.selfCHNLID = selfCHNLID;
}
public String getRwdCNTDATE() {
return rwdCNTDATE;
}
public void setRwdCNTDATE(String rwdCNTDATE) {
this.rwdCNTDATE = rwdCNTDATE;
}
public String getLiquidationSTARTDATE() {
return liquidationSTARTDATE;
}
public void setLiquidationSTARTDATE(String liquidationSTARTDATE) {
this.liquidationSTARTDATE = liquidationSTARTDATE;
}
public String getLiquidationPAYFLAG() {
return liquidationPAYFLAG;
}
public void setLiquidationPAYFLAG(String liquidationPAYFLAG) {
this.liquidationPAYFLAG = liquidationPAYFLAG;
}
public String getProvinceCODE() {
return provinceCODE;
}
public void setProvinceCODE(String provinceCODE) {
this.provinceCODE = provinceCODE;
}
public String getCityCODE() {
return cityCODE;
}
public void setCityCODE(String cityCODE) {
this.cityCODE = cityCODE;
}
public String getManagerAREACODE() {
return managerAREACODE;
}
public void setManagerAREACODE(String managerAREACODE) {
this.managerAREACODE = managerAREACODE;
}
public String getAreaTYPE() {
return areaTYPE;
}
public void setAreaTYPE(String areaTYPE) {
this.areaTYPE = areaTYPE;
}
public String getChnlCHAINLEVEL() {
return chnlCHAINLEVEL;
}
public void setChnlCHAINLEVEL(String chnlCHAINLEVEL) {
this.chnlCHAINLEVEL = chnlCHAINLEVEL;
}
public String getChnlLEVEL() {
return chnlLEVEL;
}
public void setChnlLEVEL(String chnlLEVEL) {
this.chnlLEVEL = chnlLEVEL;
}
public String getIsINPUTSYSTEM() {
return isINPUTSYSTEM;
}
public void setIsINPUTSYSTEM(String isINPUTSYSTEM) {
this.isINPUTSYSTEM = isINPUTSYSTEM;
}
public BigInteger getSystemNUM() {
return systemNUM;
}
public void setSystemNUM(BigInteger systemNUM) {
this.systemNUM = systemNUM;
}
public String getIsMINIHALL() {
return isMINIHALL;
}
public void setIsMINIHALL(String isMINIHALL) {
this.isMINIHALL = isMINIHALL;
}
public String getChnlSCOPE() {
return chnlSCOPE;
}
public void setChnlSCOPE(String chnlSCOPE) {
this.chnlSCOPE = chnlSCOPE;
}
public String getChnlAREAKINDID() {
return chnlAREAKINDID;
}
public void setChnlAREAKINDID(String chnlAREAKINDID) {
this.chnlAREAKINDID = chnlAREAKINDID;
}
public String getBankCODE() {
return bankCODE;
}
public void setBankCODE(String bankCODE) {
this.bankCODE = bankCODE;
}
public String getBankNO() {
return bankNO;
}
public void setBankNO(String bankNO) {
this.bankNO = bankNO;
}
public String getBankACCTNAME() {
return bankACCTNAME;
}
public void setBankACCTNAME(String bankACCTNAME) {
this.bankACCTNAME = bankACCTNAME;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getChnlLINKMANNAME() {
return chnlLINKMANNAME;
}
public void setChnlLINKMANNAME(String chnlLINKMANNAME) {
this.chnlLINKMANNAME = chnlLINKMANNAME;
}
public String getChnlLINKMANSEX() {
return chnlLINKMANSEX;
}
public void setChnlLINKMANSEX(String chnlLINKMANSEX) {
this.chnlLINKMANSEX = chnlLINKMANSEX;
}
public String getChnlEMAIL() {
return chnlEMAIL;
}
public void setChnlEMAIL(String chnlEMAIL) {
this.chnlEMAIL = chnlEMAIL;
}
public String getChnlFAX() {
return chnlFAX;
}
public void setChnlFAX(String chnlFAX) {
this.chnlFAX = chnlFAX;
}
public String getChnlADDR() {
return chnlADDR;
}
public void setChnlADDR(String chnlADDR) {
this.chnlADDR = chnlADDR;
}
public String getChnlOFFICEPHONE() {
return chnlOFFICEPHONE;
}
public void setChnlOFFICEPHONE(String chnlOFFICEPHONE) {
this.chnlOFFICEPHONE = chnlOFFICEPHONE;
}
public String getChnlPHONE() {
return chnlPHONE;
}
public void setChnlPHONE(String chnlPHONE) {
this.chnlPHONE = chnlPHONE;
}
public String getChnlPOSTALCODE() {
return chnlPOSTALCODE;
}
public void setChnlPOSTALCODE(String chnlPOSTALCODE) {
this.chnlPOSTALCODE = chnlPOSTALCODE;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getManagerDEPTID() {
return managerDEPTID;
}
public void setManagerDEPTID(String managerDEPTID) {
this.managerDEPTID = managerDEPTID;
}
public String getManagerSTAFFID() {
return managerSTAFFID;
}
public void setManagerSTAFFID(String managerSTAFFID) {
this.managerSTAFFID = managerSTAFFID;
}
public String getManagerEMAIL() {
return managerEMAIL;
}
public void setManagerEMAIL(String managerEMAIL) {
this.managerEMAIL = managerEMAIL;
}
public String getManagerPHONE() {
return managerPHONE;
}
public void setManagerPHONE(String managerPHONE) {
this.managerPHONE = managerPHONE;
}
public String getResDEPTID() {
return resDEPTID;
}
public void setResDEPTID(String resDEPTID) {
this.resDEPTID = resDEPTID;
}
public String getApplyCODE() {
return applyCODE;
}
public void setApplyCODE(String applyCODE) {
this.applyCODE = applyCODE;
}
public String getBatchNO() {
return batchNO;
}
public void setBatchNO(String batchNO) {
this.batchNO = batchNO;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getAffiliatetime() {
return affiliatetime;
}
public void setAffiliatetime(String affiliatetime) {
this.affiliatetime = affiliatetime;
}
public String getStartTIME() {
return startTIME;
}
public void setStartTIME(String startTIME) {
this.startTIME = startTIME;
}
public String getEndTIME() {
return endTIME;
}
public void setEndTIME(String endTIME) {
this.endTIME = endTIME;
}
public String getCreateSTAFFID() {
return createSTAFFID;
}
public void setCreateSTAFFID(String createSTAFFID) {
this.createSTAFFID = createSTAFFID;
}
public String getCreateTIME() {
return createTIME;
}
public void setCreateTIME(String createTIME) {
this.createTIME = createTIME;
}
public String getUpdateDEPARTID() {
return updateDEPARTID;
}
public void setUpdateDEPARTID(String updateDEPARTID) {
this.updateDEPARTID = updateDEPARTID;
}
public String getUpdateSTAFFID() {
return updateSTAFFID;
}
public void setUpdateSTAFFID(String updateSTAFFID) {
this.updateSTAFFID = updateSTAFFID;
}
public String getUpdateDATE() {
return updateDATE;
}
public void setUpdateDATE(String updateDATE) {
this.updateDATE = updateDATE;
}
public String getIsREALLYCHNL() {
return isREALLYCHNL;
}
public void setIsREALLYCHNL(String isREALLYCHNL) {
this.isREALLYCHNL = isREALLYCHNL;
}
public String getJuriPSPTID() {
return juriPSPTID;
}
public void setJuriPSPTID(String juriPSPTID) {
this.juriPSPTID = juriPSPTID;
}
public String getCimCHANNELID() {
return cimCHANNELID;
}
public void setCimCHANNELID(String cimCHANNELID) {
this.cimCHANNELID = cimCHANNELID;
}
public String getDebtWARN() {
return debtWARN;
}
public void setDebtWARN(String debtWARN) {
this.debtWARN = debtWARN;
}
public String getEparchyCODE() {
return eparchyCODE;
}
public void setEparchyCODE(String eparchyCODE) {
this.eparchyCODE = eparchyCODE;
}
public String getBCITYCODE() {
return bCITYCODE;
}
public void setBCITYCODE(String bcitycode) {
bCITYCODE = bcitycode;
}
public String getBZONEID() {
return bZONEID;
}
public void setBZONEID(String bzoneid) {
bZONEID = bzoneid;
}
public String getBTOWNID() {
return bTOWNID;
}
public void setBTOWNID(String btownid) {
bTOWNID = btownid;
}
public String getIntegral() {
return integral;
}
public void setIntegral(String integral) {
this.integral = integral;
}
public String getPenalty() {
return penalty;
}
public void setPenalty(String penalty) {
this.penalty = penalty;
}
public BigInteger getFoulTIME() {
return foulTIME;
}
public void setFoulTIME(BigInteger foulTIME) {
this.foulTIME = foulTIME;
}
public String getErpCODE() {
return erpCODE;
}
public void setErpCODE(String erpCODE) {
this.erpCODE = erpCODE;
}
public String getErpAREACODE() {
return erpAREACODE;
}
public void setErpAREACODE(String erpAREACODE) {
this.erpAREACODE = erpAREACODE;
}
public String getCopartnerID() {
return copartnerID;
}
public void setCopartnerID(String copartnerID) {
this.copartnerID = copartnerID;
}
public String getParentDEPARTID() {
return parentDEPARTID;
}
public void setParentDEPARTID(String parentDEPARTID) {
this.parentDEPARTID = parentDEPARTID;
}
public String getManageCHNLID() {
return manageCHNLID;
}
public void setManageCHNLID(String manageCHNLID) {
this.manageCHNLID = manageCHNLID;
}
public String getIfMANAGECHNL() {
return ifMANAGECHNL;
}
public void setIfMANAGECHNL(String ifMANAGECHNL) {
this.ifMANAGECHNL = ifMANAGECHNL;
}
public String getChnlKINDFRAME() {
return chnlKINDFRAME;
}
public void setChnlKINDFRAME(String chnlKINDFRAME) {
this.chnlKINDFRAME = chnlKINDFRAME;
}
public String getChnlLAYER() {
return chnlLAYER;
}
public void setChnlLAYER(String chnlLAYER) {
this.chnlLAYER = chnlLAYER;
}
public String getChnlCREDIT() {
return chnlCREDIT;
}
public void setChnlCREDIT(String chnlCREDIT) {
this.chnlCREDIT = chnlCREDIT;
}
public String getNationalCHNL() {
return nationalCHNL;
}
public void setNationalCHNL(String nationalCHNL) {
this.nationalCHNL = nationalCHNL;
}
public String getBusiPERMISSION() {
return busiPERMISSION;
}
public void setBusiPERMISSION(String busiPERMISSION) {
this.busiPERMISSION = busiPERMISSION;
}
public String getJuriPSPTTYPE() {
return juriPSPTTYPE;
}
public void setJuriPSPTTYPE(String juriPSPTTYPE) {
this.juriPSPTTYPE = juriPSPTTYPE;
}
public String getJuriPERSON() {
return juriPERSON;
}
public void setJuriPERSON(String juriPERSON) {
this.juriPERSON = juriPERSON;
}
public String getRegDATE() {
return regDATE;
}
public void setRegDATE(String regDATE) {
this.regDATE = regDATE;
}
public String getTaxNO() {
return taxNO;
}
public void setTaxNO(String taxNO) {
this.taxNO = taxNO;
}
public String getBusiLICENCE() {
return busiLICENCE;
}
public void setBusiLICENCE(String busiLICENCE) {
this.busiLICENCE = busiLICENCE;
}
public List<ChannelInfoChgNotifyReqVO.EXTINFO> getExtinfo() {
return extinfo;
}
public void setExtinfo(List<ChannelInfoChgNotifyReqVO.EXTINFO> extinfo) {
this.extinfo = extinfo;
}
public ChannelInfoChgNotifyReqVO.FUNCLIST getFunclist() {
return funclist;
}
public void setFunclist(ChannelInfoChgNotifyReqVO.FUNCLIST funclist) {
this.funclist = funclist;
}
public ChannelInfoChgNotifyReqVO.DEVLIST getDevlist() {
return devlist;
}
public void setDevlist(ChannelInfoChgNotifyReqVO.DEVLIST devlist) {
this.devlist = devlist;
}
public List<ChannelInfoChgNotifyReqVO.PARA> getPara() {
return para;
}
public void setPara(List<ChannelInfoChgNotifyReqVO.PARA> para) {
this.para = para;
}
}
<file_sep>
package cn.chinaunicom.ws.ordser.unibssbody.ordersubreq;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PROVINCE_ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPERATION_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="2"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SEND_TYPE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="NOTE_BATCHNO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="NOTE_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="NOTE_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="NOTE_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SUB_ORDERSUB_REQ" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SUB_PROVINCE_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SUB_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_INFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FEE_MODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_TYPE_MODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_TYPE_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPERATE_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OLDFEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DERATE_FEE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DERATE_REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_PAY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_TAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_TAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_TAX" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="TOTAL_FEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CANCLE_TOTAL_FEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_INFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SUB_PROVINCE_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="2"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_MONEY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHECK_BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_ORG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_NUM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHECK_CARD_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHECK_LIMIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CUST_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_TYPE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="256"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTACT_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="500"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"provinceORDERID",
"orderID",
"operationTYPE",
"sendTYPECODE",
"noteBATCHNO",
"noteNO",
"noteTYPE",
"noteFLAG",
"subORDERSUBREQ",
"totalFEE",
"cancleTOTALFEE",
"payINFO",
"para"
})
@XmlRootElement(name = "ORDERSUB_REQ")
public class ORDERSUB_REQ {
@XmlElement(name = "PROVINCE_ORDER_ID", required = true)
protected String provinceORDERID;
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "OPERATION_TYPE", required = true)
protected String operationTYPE;
@XmlElement(name = "SEND_TYPE_CODE")
protected String sendTYPECODE;
@XmlElement(name = "NOTE_BATCHNO")
protected String noteBATCHNO;
@XmlElement(name = "NOTE_NO")
protected String noteNO;
@XmlElement(name = "NOTE_TYPE", required = true)
protected String noteTYPE;
@XmlElement(name = "NOTE_FLAG")
protected String noteFLAG;
@XmlElement(name = "SUB_ORDERSUB_REQ")
protected List<ORDERSUB_REQ.SUB_ORDERSUB_REQ> subORDERSUBREQ;
@XmlElement(name = "TOTAL_FEE", required = true)
protected BigInteger totalFEE;
@XmlElement(name = "CANCLE_TOTAL_FEE", required = true)
protected BigInteger cancleTOTALFEE;
@XmlElement(name = "PAY_INFO")
protected List<ORDERSUB_REQ.PAY_INFO> payINFO;
@XmlElement(name = "PARA")
protected List<ORDERSUB_REQ.PARA> para;
/**
* Gets the value of the province_ORDER_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_ORDER_ID() {
return provinceORDERID;
}
/**
* Sets the value of the province_ORDER_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_ORDER_ID(String value) {
this.provinceORDERID = value;
}
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the operation_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATION_TYPE() {
return operationTYPE;
}
/**
* Sets the value of the operation_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATION_TYPE(String value) {
this.operationTYPE = value;
}
/**
* Gets the value of the send_TYPE_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSEND_TYPE_CODE() {
return sendTYPECODE;
}
/**
* Sets the value of the send_TYPE_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSEND_TYPE_CODE(String value) {
this.sendTYPECODE = value;
}
/**
* Gets the value of the note_BATCHNO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNOTE_BATCHNO() {
return noteBATCHNO;
}
/**
* Sets the value of the note_BATCHNO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNOTE_BATCHNO(String value) {
this.noteBATCHNO = value;
}
/**
* Gets the value of the note_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNOTE_NO() {
return noteNO;
}
/**
* Sets the value of the note_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNOTE_NO(String value) {
this.noteNO = value;
}
/**
* Gets the value of the note_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNOTE_TYPE() {
return noteTYPE;
}
/**
* Sets the value of the note_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNOTE_TYPE(String value) {
this.noteTYPE = value;
}
/**
* Gets the value of the note_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNOTE_FLAG() {
return noteFLAG;
}
/**
* Sets the value of the note_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNOTE_FLAG(String value) {
this.noteFLAG = value;
}
/**
* Gets the value of the subORDERSUBREQ property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the subORDERSUBREQ property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSUB_ORDERSUB_REQ().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ORDERSUB_REQ.SUB_ORDERSUB_REQ }
*
*
*/
public List<ORDERSUB_REQ.SUB_ORDERSUB_REQ> getSUB_ORDERSUB_REQ() {
if (subORDERSUBREQ == null) {
subORDERSUBREQ = new ArrayList<ORDERSUB_REQ.SUB_ORDERSUB_REQ>();
}
return this.subORDERSUBREQ;
}
/**
* Gets the value of the total_FEE property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getTOTAL_FEE() {
return totalFEE;
}
/**
* Sets the value of the total_FEE property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setTOTAL_FEE(BigInteger value) {
this.totalFEE = value;
}
/**
* Gets the value of the cancle_TOTAL_FEE property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getCANCLE_TOTAL_FEE() {
return cancleTOTALFEE;
}
/**
* Sets the value of the cancle_TOTAL_FEE property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setCANCLE_TOTAL_FEE(BigInteger value) {
this.cancleTOTALFEE = value;
}
/**
* Gets the value of the payINFO property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the payINFO property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPAY_INFO().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ORDERSUB_REQ.PAY_INFO }
*
*
*/
public List<ORDERSUB_REQ.PAY_INFO> getPAY_INFO() {
if (payINFO == null) {
payINFO = new ArrayList<ORDERSUB_REQ.PAY_INFO>();
}
return this.payINFO;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ORDERSUB_REQ.PARA }
*
*
*/
public List<ORDERSUB_REQ.PARA> getPARA() {
if (para == null) {
para = new ArrayList<ORDERSUB_REQ.PARA>();
}
return this.para;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraID",
"paraVALUE"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraID;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SUB_PROVINCE_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="2"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_MONEY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHECK_BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_ORG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_NUM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHECK_CARD_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHECK_LIMIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CUST_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_TYPE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="256"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTACT_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="500"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"subPROVINCEORDERID",
"payTYPE",
"payMONEY",
"checkBANKCODE",
"payORG",
"payNUM",
"checkCARDNAME",
"checkLIMIT",
"custNAME",
"certTYPECODE",
"certCODE",
"certADDR",
"contactPHONE",
"remark"
})
public static class PAY_INFO {
@XmlElement(name = "SUB_PROVINCE_ORDER_ID")
protected String subPROVINCEORDERID;
@XmlElement(name = "PAY_TYPE", required = true)
protected String payTYPE;
@XmlElement(name = "PAY_MONEY")
protected BigInteger payMONEY;
@XmlElement(name = "CHECK_BANK_CODE")
protected String checkBANKCODE;
@XmlElement(name = "PAY_ORG")
protected String payORG;
@XmlElement(name = "PAY_NUM")
protected String payNUM;
@XmlElement(name = "CHECK_CARD_NAME")
protected String checkCARDNAME;
@XmlElement(name = "CHECK_LIMIT")
protected BigInteger checkLIMIT;
@XmlElement(name = "CUST_NAME")
protected String custNAME;
@XmlElement(name = "CERT_TYPE_CODE")
protected String certTYPECODE;
@XmlElement(name = "CERT_CODE")
protected String certCODE;
@XmlElement(name = "CERT_ADDR")
protected String certADDR;
@XmlElement(name = "CONTACT_PHONE")
protected String contactPHONE;
@XmlElement(name = "REMARK")
protected String remark;
/**
* Gets the value of the sub_PROVINCE_ORDER_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSUB_PROVINCE_ORDER_ID() {
return subPROVINCEORDERID;
}
/**
* Sets the value of the sub_PROVINCE_ORDER_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUB_PROVINCE_ORDER_ID(String value) {
this.subPROVINCEORDERID = value;
}
/**
* Gets the value of the pay_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_TYPE() {
return payTYPE;
}
/**
* Sets the value of the pay_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_TYPE(String value) {
this.payTYPE = value;
}
/**
* Gets the value of the pay_MONEY property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getPAY_MONEY() {
return payMONEY;
}
/**
* Sets the value of the pay_MONEY property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setPAY_MONEY(BigInteger value) {
this.payMONEY = value;
}
/**
* Gets the value of the check_BANK_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHECK_BANK_CODE() {
return checkBANKCODE;
}
/**
* Sets the value of the check_BANK_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHECK_BANK_CODE(String value) {
this.checkBANKCODE = value;
}
/**
* Gets the value of the pay_ORG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_ORG() {
return payORG;
}
/**
* Sets the value of the pay_ORG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_ORG(String value) {
this.payORG = value;
}
/**
* Gets the value of the pay_NUM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_NUM() {
return payNUM;
}
/**
* Sets the value of the pay_NUM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_NUM(String value) {
this.payNUM = value;
}
/**
* Gets the value of the check_CARD_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHECK_CARD_NAME() {
return checkCARDNAME;
}
/**
* Sets the value of the check_CARD_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHECK_CARD_NAME(String value) {
this.checkCARDNAME = value;
}
/**
* Gets the value of the check_LIMIT property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getCHECK_LIMIT() {
return checkLIMIT;
}
/**
* Sets the value of the check_LIMIT property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setCHECK_LIMIT(BigInteger value) {
this.checkLIMIT = value;
}
/**
* Gets the value of the cust_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCUST_NAME() {
return custNAME;
}
/**
* Sets the value of the cust_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCUST_NAME(String value) {
this.custNAME = value;
}
/**
* Gets the value of the cert_TYPE_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCERT_TYPE_CODE() {
return certTYPECODE;
}
/**
* Sets the value of the cert_TYPE_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCERT_TYPE_CODE(String value) {
this.certTYPECODE = value;
}
/**
* Gets the value of the cert_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCERT_CODE() {
return certCODE;
}
/**
* Sets the value of the cert_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCERT_CODE(String value) {
this.certCODE = value;
}
/**
* Gets the value of the cert_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCERT_ADDR() {
return certADDR;
}
/**
* Sets the value of the cert_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCERT_ADDR(String value) {
this.certADDR = value;
}
/**
* Gets the value of the contact_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTACT_PHONE() {
return contactPHONE;
}
/**
* Sets the value of the contact_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTACT_PHONE(String value) {
this.contactPHONE = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SUB_PROVINCE_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SUB_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_INFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FEE_MODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_TYPE_MODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_TYPE_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPERATE_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OLDFEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DERATE_FEE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DERATE_REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_PAY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_TAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_TAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_TAX" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"subPROVINCEORDERID",
"subORDERID",
"feeINFO"
})
public static class SUB_ORDERSUB_REQ {
@XmlElement(name = "SUB_PROVINCE_ORDER_ID")
protected String subPROVINCEORDERID;
@XmlElement(name = "SUB_ORDER_ID")
protected String subORDERID;
@XmlElement(name = "FEE_INFO")
protected List<ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO> feeINFO;
/**
* Gets the value of the sub_PROVINCE_ORDER_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSUB_PROVINCE_ORDER_ID() {
return subPROVINCEORDERID;
}
/**
* Sets the value of the sub_PROVINCE_ORDER_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUB_PROVINCE_ORDER_ID(String value) {
this.subPROVINCEORDERID = value;
}
/**
* Gets the value of the sub_ORDER_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSUB_ORDER_ID() {
return subORDERID;
}
/**
* Sets the value of the sub_ORDER_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUB_ORDER_ID(String value) {
this.subORDERID = value;
}
/**
* Gets the value of the feeINFO property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the feeINFO property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFEE_INFO().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO }
*
*
*/
public List<ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO> getFEE_INFO() {
if (feeINFO == null) {
feeINFO = new ArrayList<ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO>();
}
return this.feeINFO;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FEE_MODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_TYPE_MODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE_TYPE_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPERATE_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OLDFEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DERATE_FEE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DERATE_REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FEE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="11"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_PAY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_TAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_TAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CALCULATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_TAX" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"feeMODE",
"feeTYPEMODE",
"feeTYPENAME",
"operateTYPE",
"oldfee",
"derateFEE",
"derateREMARK",
"fee",
"isPAY",
"payTAG",
"calculateTAG",
"calculateID",
"calculateDATE",
"calculateSTAFFID",
"isTAX",
"payID",
"payDATE"
})
public static class FEE_INFO {
@XmlElement(name = "FEE_MODE", required = true)
protected String feeMODE;
@XmlElement(name = "FEE_TYPE_MODE", required = true)
protected String feeTYPEMODE;
@XmlElement(name = "FEE_TYPE_NAME", required = true)
protected String feeTYPENAME;
@XmlElement(name = "OPERATE_TYPE", required = true)
protected String operateTYPE;
@XmlElement(name = "OLDFEE", required = true)
protected BigInteger oldfee;
@XmlElement(name = "DERATE_FEE")
protected BigInteger derateFEE;
@XmlElement(name = "DERATE_REMARK")
protected String derateREMARK;
@XmlElement(name = "FEE")
protected BigInteger fee;
@XmlElement(name = "IS_PAY")
protected String isPAY;
@XmlElement(name = "PAY_TAG")
protected String payTAG;
@XmlElement(name = "CALCULATE_TAG")
protected String calculateTAG;
@XmlElement(name = "CALCULATE_ID")
protected String calculateID;
@XmlElement(name = "CALCULATE_DATE")
protected String calculateDATE;
@XmlElement(name = "CALCULATE_STAFF_ID")
protected String calculateSTAFFID;
@XmlElement(name = "IS_TAX")
protected String isTAX;
@XmlElement(name = "PAY_ID")
protected String payID;
@XmlElement(name = "PAY_DATE")
protected String payDATE;
/**
* Gets the value of the fee_MODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFEE_MODE() {
return feeMODE;
}
/**
* Sets the value of the fee_MODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFEE_MODE(String value) {
this.feeMODE = value;
}
/**
* Gets the value of the fee_TYPE_MODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFEE_TYPE_MODE() {
return feeTYPEMODE;
}
/**
* Sets the value of the fee_TYPE_MODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFEE_TYPE_MODE(String value) {
this.feeTYPEMODE = value;
}
/**
* Gets the value of the fee_TYPE_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFEE_TYPE_NAME() {
return feeTYPENAME;
}
/**
* Sets the value of the fee_TYPE_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFEE_TYPE_NAME(String value) {
this.feeTYPENAME = value;
}
/**
* Gets the value of the operate_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATE_TYPE() {
return operateTYPE;
}
/**
* Sets the value of the operate_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATE_TYPE(String value) {
this.operateTYPE = value;
}
/**
* Gets the value of the oldfee property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getOLDFEE() {
return oldfee;
}
/**
* Sets the value of the oldfee property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setOLDFEE(BigInteger value) {
this.oldfee = value;
}
/**
* Gets the value of the derate_FEE property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getDERATE_FEE() {
return derateFEE;
}
/**
* Sets the value of the derate_FEE property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setDERATE_FEE(BigInteger value) {
this.derateFEE = value;
}
/**
* Gets the value of the derate_REMARK property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDERATE_REMARK() {
return derateREMARK;
}
/**
* Sets the value of the derate_REMARK property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDERATE_REMARK(String value) {
this.derateREMARK = value;
}
/**
* Gets the value of the fee property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getFEE() {
return fee;
}
/**
* Sets the value of the fee property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setFEE(BigInteger value) {
this.fee = value;
}
/**
* Gets the value of the is_PAY property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_PAY() {
return isPAY;
}
/**
* Sets the value of the is_PAY property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_PAY(String value) {
this.isPAY = value;
}
/**
* Gets the value of the pay_TAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_TAG() {
return payTAG;
}
/**
* Sets the value of the pay_TAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_TAG(String value) {
this.payTAG = value;
}
/**
* Gets the value of the calculate_TAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCALCULATE_TAG() {
return calculateTAG;
}
/**
* Sets the value of the calculate_TAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCALCULATE_TAG(String value) {
this.calculateTAG = value;
}
/**
* Gets the value of the calculate_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCALCULATE_ID() {
return calculateID;
}
/**
* Sets the value of the calculate_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCALCULATE_ID(String value) {
this.calculateID = value;
}
/**
* Gets the value of the calculate_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCALCULATE_DATE() {
return calculateDATE;
}
/**
* Sets the value of the calculate_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCALCULATE_DATE(String value) {
this.calculateDATE = value;
}
/**
* Gets the value of the calculate_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCALCULATE_STAFF_ID() {
return calculateSTAFFID;
}
/**
* Sets the value of the calculate_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCALCULATE_STAFF_ID(String value) {
this.calculateSTAFFID = value;
}
/**
* Gets the value of the is_TAX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_TAX() {
return isTAX;
}
/**
* Sets the value of the is_TAX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_TAX(String value) {
this.isTAX = value;
}
/**
* Gets the value of the pay_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_ID() {
return payID;
}
/**
* Sets the value of the pay_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_ID(String value) {
this.payID = value;
}
/**
* Gets the value of the pay_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_DATE() {
return payDATE;
}
/**
* Sets the value of the pay_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_DATE(String value) {
this.payDATE = value;
}
}
}
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.wzhReal;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IQZWZHSrvDataSV;
import com.ai.uchintService.common.bo.TF_QZ_WZH_DETAILBean;
import com.ai.uchintService.httpServer.servlet.ReceiveHttpServlet;
import com.ai.uint.util.UIFException;
public class ReceiveHttpSrvQZWZH extends ReceiveHttpServlet {
@Override
protected void doData(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
try
{
logger.info("ReceiveHttpSrvQZWZH doData begin ...");
//print request
printRequest(req);
String requestUri = req.getRequestURI();
logger.info("requestUri:"+requestUri);
String operateName = requestUri.substring(requestUri.lastIndexOf("/")+1);
logger.info("operateName:"+operateName);
//日志记录
requestId = null;
logId = null;
insertLog(req, operateName, requestUri);
//调用业务实现
String respStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
respStr+="<root>";
try
{
saveData(req);
respStr+="<cod>TDPS0000</cod>";
}
catch(UIFException e)
{
e.printStackTrace();
respStr+="<cod>TDPS6006</cod>";
respStr = "<msg>保存数据出错:"+e.getMessage()+"</msg>";
}
respStr+="</root>";
//返回响应
PrintWriter printWriter = null;
try {
resp.setContentType("text/html;charset=utf-8");
printWriter = resp.getWriter();
printWriter.write(respStr);
printWriter.flush();
} catch (Exception e) {
logger.info("重大异常,responseSuccess报错!");
} finally {
printWriter.close();
}
//日志修改
updateLog(respStr);
//close resource
logger.info("ReceiveHttpSrvQZWZH doData end ...");
}
catch(UIFException e)
{
throw new ServletException(e);
}
}
private void saveData(HttpServletRequest req) throws UIFException
{
try
{
TF_QZ_WZH_DETAILBean bean = new TF_QZ_WZH_DETAILBean();
if (req.getParameter("PRI_KEY") != null && !req.getParameter("PRI_KEY").equals(""))
{
if (req.getParameter("PRI_KEY").length() > 20) throw new UIFException("PRI_KEY字段["+req.getParameter("PRI_KEY")+"]长度为"+req.getParameter("PRI_KEY").length()+",规范长度20");
bean.setPriKey(req.getParameter("PRI_KEY"));
}
else
{
throw new UIFException("PRI_KEY字段为空");
}
if (req.getParameter("Reserved1") != null && !req.getParameter("Reserved1").equals(""))
{
if (req.getParameter("Reserved1").length() > 20) throw new UIFException("Reserved1字段["+req.getParameter("Reserved1")+"]长度为"+req.getParameter("Reserved1").length()+",规范长度20");
bean.setReserved1(req.getParameter("Reserved1"));
}
if (req.getParameter("cust_no") != null && !req.getParameter("cust_no").equals(""))
{
if (req.getParameter("cust_no").length() > 16) throw new UIFException("cust_no字段["+req.getParameter("cust_no")+"]长度为"+req.getParameter("cust_no").length()+",规范长度16");
bean.setCustNo(req.getParameter("cust_no"));
}
if (req.getParameter("cust_name") != null && !req.getParameter("cust_name").equals(""))
{
if (req.getParameter("cust_name").length() > 100) throw new UIFException("cust_name字段["+req.getParameter("cust_name")+"]长度为"+req.getParameter("cust_name").length()+",规范长度100");
bean.setCustName(req.getParameter("cust_name"));
}
if (req.getParameter("user_name") != null && !req.getParameter("user_name").equals(""))
{
if (req.getParameter("user_name").length() > 100) throw new UIFException("user_name字段["+req.getParameter("user_name")+"]长度为"+req.getParameter("user_name").length()+",规范长度100");
bean.setUserName(req.getParameter("user_name"));
}
else
{
throw new UIFException("user_name字段为空");
}
if (req.getParameter("user_no") != null && !req.getParameter("user_no").equals(""))
{
if (req.getParameter("user_no").length() > 16) throw new UIFException("user_no字段["+req.getParameter("user_no")+"]长度为"+req.getParameter("user_no").length()+",规范长度16");
bean.setUserNo(req.getParameter("user_no"));
}
else
{
throw new UIFException("user_no字段为空");
}
if (req.getParameter("chnl_no") != null && !req.getParameter("chnl_no").equals(""))
{
if (req.getParameter("chnl_no").length() > 7) throw new UIFException("chnl_no字段["+req.getParameter("chnl_no")+"]长度为"+req.getParameter("chnl_no").length()+",规范长度7");
bean.setChnlCode(req.getParameter("chnl_no"));
}
else
{
throw new UIFException("chnl_no字段为空");
}
if (req.getParameter("acc_no") != null && !req.getParameter("acc_no").equals(""))
{
if (req.getParameter("acc_no").length() > 19) throw new UIFException("acc_no字段["+req.getParameter("acc_no")+"]长度为"+req.getParameter("acc_no").length()+",规范长度19");
bean.setAccNo(req.getParameter("acc_no"));
}
else
{
throw new UIFException("acc_no字段为空");
}
if (req.getParameter("acc_type") != null && !req.getParameter("acc_type").equals(""))
{
if (req.getParameter("acc_type").length() > 3) throw new UIFException("acc_type字段["+req.getParameter("acc_type")+"]长度为"+req.getParameter("acc_type").length()+",规范长度3");
if (!req.getParameter("acc_type").equals("001") && !req.getParameter("acc_type").equals("002")) throw new UIFException("acc_type字段["+req.getParameter("acc_type")+"]取值错误");
bean.setAccType(req.getParameter("acc_type"));
}
else
{
throw new UIFException("acc_type字段为空");
}
if (req.getParameter("merch_no") != null && !req.getParameter("merch_no").equals(""))
{
if (req.getParameter("merch_no").length() > 32) throw new UIFException("merch_no字段["+req.getParameter("merch_no")+"]长度为"+req.getParameter("merch_no").length()+",规范长度32");
bean.setMerchNo(req.getParameter("merch_no"));
}
else
{
throw new UIFException("merch_no字段为空");
}
if (req.getParameter("tran_sn") != null && !req.getParameter("tran_sn").equals(""))
{
if (req.getParameter("tran_sn").length() > 50) throw new UIFException("tran_sn字段["+req.getParameter("tran_sn")+"]长度为"+req.getParameter("tran_sn").length()+",规范长度50");
bean.setTranSn(req.getParameter("tran_sn"));
}
else
{
throw new UIFException("tran_sn字段为空");
}
if (req.getParameter("tran_rn") != null && !req.getParameter("tran_rn").equals(""))
{
if (req.getParameter("tran_rn").length() > 20) throw new UIFException("tran_rn字段["+req.getParameter("tran_rn")+"]长度为"+req.getParameter("tran_rn").length()+",规范长度20");
bean.setTranRn(req.getParameter("tran_rn"));
}
else
{
throw new UIFException("tran_rn字段为空");
}
if (req.getParameter("tran_tim") != null && !req.getParameter("tran_tim").equals(""))
{
if (req.getParameter("tran_tim").length() > 15) throw new UIFException("tran_tim字段["+req.getParameter("tran_tim")+"]长度为"+req.getParameter("tran_tim").length()+",规范长度15");
bean.setTradeDatetime(req.getParameter("tran_tim"));
}
else
{
throw new UIFException("tran_tim字段为空");
}
if ( (req.getParameter("dbt_amt") == null || req.getParameter("dbt_amt").equals(""))
&& (req.getParameter("crd_amt") == null || req.getParameter("crd_amt").equals("")) )
{
throw new UIFException("dbt_amt和crd_amt字段全部为空");
}
if ( (req.getParameter("dbt_amt") != null && !req.getParameter("dbt_amt").equals(""))
&& (req.getParameter("crd_amt") != null && !req.getParameter("crd_amt").equals("")) )
{
throw new UIFException("dbt_amt和crd_amt字段全部非空");
}
if (req.getParameter("dbt_amt") != null && !req.getParameter("dbt_amt").equals("")) bean.setDbtAmt(Float.valueOf((String)req.getParameter("dbt_amt")));
if (req.getParameter("crd_amt") != null && !req.getParameter("crd_amt").equals("")) bean.setCrdAmt(Float.valueOf((String)req.getParameter("crd_amt")));
if (req.getParameter("acc_blc") != null && !req.getParameter("acc_blc").equals(""))
{
bean.setAccBlc(Float.valueOf((String)req.getParameter("acc_blc")));
}
else
{
throw new UIFException("acc_blc字段为空");
}
if (req.getParameter("tran_type") != null && !req.getParameter("tran_type").equals(""))
{
if (req.getParameter("tran_type").length() > 2) throw new UIFException("tran_type字段["+req.getParameter("tran_type")+"]长度为"+req.getParameter("tran_type").length()+",规范长度2");
if (!req.getParameter("tran_type").equals("01") && !req.getParameter("tran_type").equals("02")
&& !req.getParameter("tran_type").equals("15") && !req.getParameter("tran_type").equals("21")
&& !req.getParameter("tran_type").equals("36")) throw new UIFException("tran_type字段["+req.getParameter("tran_type")+"]取值错误");
bean.setTranType(req.getParameter("tran_type"));
}
else
{
throw new UIFException("tran_type字段为空");
}
if (req.getParameter("tran_rmk") != null && !req.getParameter("tran_rmk").equals(""))
{
if (req.getParameter("tran_rmk").length() > 100) throw new UIFException("tran_rmk字段["+req.getParameter("tran_rmk")+"]长度为"+req.getParameter("tran_type").length()+",规范长度100");
bean.setTranRmk(req.getParameter("tran_rmk"));
}
else
{
throw new UIFException("tran_rmk字段为空");
}
logger.info("bean.getChnlCode():"+bean.getChnlCode());
logger.info("bean.getChnlCode().substring(0, 2):"+bean.getChnlCode().substring(0, 2));
CenterFactory.pushCenterInfo(com.ai.uchintService.common.util.Constants.DATASOURCE_CENTER, "qingzhang"+bean.getChnlCode().substring(0, 2));
// CenterFactory.pushCenterInfo(com.ai.uchintService.common.util.Constants.DATASOURCE_CENTER, "01");
IQZWZHSrvDataSV sv = (IQZWZHSrvDataSV)ServiceFactory.getService(IQZWZHSrvDataSV.class);
sv.save(bean);
}
catch(AIException e)
{
e.printStackTrace();
throw new UIFException(e);
}
catch(NumberFormatException e)
{
e.printStackTrace();
throw new UIFException(e);
}
catch(Exception e)
{
e.printStackTrace();
throw new UIFException(e);
}
}
}
<file_sep>
package cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="OPERATE_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="40"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_DESC" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="300"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ORG_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STATE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STATE_DESC" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_KIND_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LOCAL_KIND_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_CLASS_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHAIN_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_RWD_CNT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_SCOPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_CHNL_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SUPER_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SELF_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="RWD_CNT_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LIQUIDATION_START_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LIQUIDATION_PAY_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_AREA_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AREA_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_CHAIN_LEVEL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_LEVEL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_INPUT_SYSTEM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SYSTEM_NUM" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_MINI_HALL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_SCOPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_AREA_KIND_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_ACCT_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ADDRESS" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_LINKMAN_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_LINKMAN_SEX" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_EMAIL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_FAX" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_OFFICE_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_POSTALCODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LONGITUDE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LATITUDE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_DEPT_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_EMAIL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="RES_DEPT_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="APPLY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="64"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BATCH_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AFFILIATETIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="START_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="END_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_DEPART_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_REALLY_CHNL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="JURI_PSPT_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CIM_CHANNEL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEBT_WARN" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EPARCHY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="B_CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="B_ZONEID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="B_TOWNID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="INTEGRAL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PENALTY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FOUL_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
* <totalDigits value="4"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ERP_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ERP_AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="COPARTNER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARENT_DEPART_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGE_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IF_MANAGE_CHNL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_KIND_FRAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="300"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_LAYER" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_CREDIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="NATIONAL_CHNL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BUSI_PERMISSION" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="JURI_PSPT_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="3"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="JURI_PERSON" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REG_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="TAX_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BUSI_LICENCE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EXTINFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEPOSIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PENALTY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="COMPLAIN_RATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="INDUSTRY_CLASS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="INDUSTRY_MERIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ESS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4000"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4000"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SALE_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OTHER_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SYS_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="HAVE_BSS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BUSI_FEE_IS_CLEAR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EARNEST_IS_CLEAR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="COMM_IS_CLEAR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="FUNCLIST">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FUNCINFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_FUNC_CTL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FUNC_CTL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FUNC_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="DEVLIST">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="DEVINFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CHNLDEVINFO">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="START_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="END_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="DEVELOPER">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_TYPE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="GROUP_ACCT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USER_PID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_COMM_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_ACCT_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_EMAIL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_POSTCODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BATCH_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="HAVE_BSS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_AUTO_CREATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SELF_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_SUM_BONUS" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"operateTYPE",
"orderID",
"chnlID",
"chnlCODE",
"chnlNAME",
"chnlDESC",
"chnlORGID",
"state",
"stateDESC",
"chnlKINDID",
"localKINDID",
"chnlCLASSID",
"chainFLAG",
"isRWDCNT",
"paySCOPE",
"payCHNLCODE",
"superCHNLID",
"selfCHNLID",
"rwdCNTDATE",
"liquidationSTARTDATE",
"liquidationPAYFLAG",
"provinceCODE",
"cityCODE",
"managerAREACODE",
"areaTYPE",
"chnlCHAINLEVEL",
"chnlLEVEL",
"isINPUTSYSTEM",
"systemNUM",
"isMINIHALL",
"chnlSCOPE",
"chnlAREAKINDID",
"bankCODE",
"bankNO",
"bankACCTNAME",
"address",
"chnlLINKMANNAME",
"chnlLINKMANSEX",
"chnlEMAIL",
"chnlFAX",
"chnlADDR",
"chnlOFFICEPHONE",
"chnlPHONE",
"chnlPOSTALCODE",
"longitude",
"latitude",
"managerDEPTID",
"managerSTAFFID",
"managerEMAIL",
"managerPHONE",
"resDEPTID",
"applyCODE",
"batchNO",
"remark",
"affiliatetime",
"startTIME",
"endTIME",
"createSTAFFID",
"createTIME",
"updateDEPARTID",
"updateSTAFFID",
"updateDATE",
"isREALLYCHNL",
"juriPSPTID",
"cimCHANNELID",
"debtWARN",
"eparchyCODE",
"bCITYCODE",
"bZONEID",
"bTOWNID",
"integral",
"penalty",
"foulTIME",
"erpCODE",
"erpAREACODE",
"copartnerID",
"parentDEPARTID",
"manageCHNLID",
"ifMANAGECHNL",
"chnlKINDFRAME",
"chnlLAYER",
"chnlCREDIT",
"nationalCHNL",
"busiPERMISSION",
"juriPSPTTYPE",
"juriPERSON",
"regDATE",
"taxNO",
"busiLICENCE",
"extinfo",
"funclist",
"devlist",
"para"
})
@XmlRootElement(name = "CHANNEL_INFO_CHG_NOTIFY_REQ")
public class CHANNEL_INFO_CHG_NOTIFY_REQ {
@XmlElement(name = "OPERATE_TYPE", required = true)
protected String operateTYPE;
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "CHNL_ID", required = true)
protected String chnlID;
@XmlElement(name = "CHNL_CODE", required = true)
protected String chnlCODE;
@XmlElement(name = "CHNL_NAME", required = true)
protected String chnlNAME;
@XmlElement(name = "CHNL_DESC")
protected String chnlDESC;
@XmlElement(name = "CHNL_ORG_ID")
protected String chnlORGID;
@XmlElement(name = "STATE", required = true)
protected String state;
@XmlElement(name = "STATE_DESC")
protected String stateDESC;
@XmlElement(name = "CHNL_KIND_ID", required = true)
protected String chnlKINDID;
@XmlElement(name = "LOCAL_KIND_ID")
protected String localKINDID;
@XmlElement(name = "CHNL_CLASS_ID")
protected String chnlCLASSID;
@XmlElement(name = "CHAIN_FLAG")
protected String chainFLAG;
@XmlElement(name = "IS_RWD_CNT")
protected String isRWDCNT;
@XmlElement(name = "PAY_SCOPE")
protected String paySCOPE;
@XmlElement(name = "PAY_CHNL_CODE")
protected String payCHNLCODE;
@XmlElement(name = "SUPER_CHNL_ID")
protected String superCHNLID;
@XmlElement(name = "SELF_CHNL_ID")
protected String selfCHNLID;
@XmlElement(name = "RWD_CNT_DATE")
protected String rwdCNTDATE;
@XmlElement(name = "LIQUIDATION_START_DATE")
protected String liquidationSTARTDATE;
@XmlElement(name = "LIQUIDATION_PAY_FLAG")
protected String liquidationPAYFLAG;
@XmlElement(name = "PROVINCE_CODE")
protected String provinceCODE;
@XmlElement(name = "CITY_CODE")
protected String cityCODE;
@XmlElement(name = "MANAGER_AREA_CODE", required = true)
protected String managerAREACODE;
@XmlElement(name = "AREA_TYPE")
protected String areaTYPE;
@XmlElement(name = "CHNL_CHAIN_LEVEL")
protected String chnlCHAINLEVEL;
@XmlElement(name = "CHNL_LEVEL")
protected String chnlLEVEL;
@XmlElement(name = "IS_INPUT_SYSTEM")
protected String isINPUTSYSTEM;
@XmlElement(name = "SYSTEM_NUM")
protected BigInteger systemNUM;
@XmlElement(name = "IS_MINI_HALL")
protected String isMINIHALL;
@XmlElement(name = "CHNL_SCOPE")
protected String chnlSCOPE;
@XmlElement(name = "CHNL_AREA_KIND_ID")
protected String chnlAREAKINDID;
@XmlElement(name = "BANK_CODE")
protected String bankCODE;
@XmlElement(name = "BANK_NO")
protected String bankNO;
@XmlElement(name = "BANK_ACCT_NAME")
protected String bankACCTNAME;
@XmlElement(name = "ADDRESS")
protected String address;
@XmlElement(name = "CHNL_LINKMAN_NAME")
protected String chnlLINKMANNAME;
@XmlElement(name = "CHNL_LINKMAN_SEX")
protected String chnlLINKMANSEX;
@XmlElement(name = "CHNL_EMAIL")
protected String chnlEMAIL;
@XmlElement(name = "CHNL_FAX")
protected String chnlFAX;
@XmlElement(name = "CHNL_ADDR")
protected String chnlADDR;
@XmlElement(name = "CHNL_OFFICE_PHONE")
protected String chnlOFFICEPHONE;
@XmlElement(name = "CHNL_PHONE")
protected String chnlPHONE;
@XmlElement(name = "CHNL_POSTALCODE")
protected String chnlPOSTALCODE;
@XmlElement(name = "LONGITUDE")
protected String longitude;
@XmlElement(name = "LATITUDE")
protected String latitude;
@XmlElement(name = "MANAGER_DEPT_ID", required = true)
protected String managerDEPTID;
@XmlElement(name = "MANAGER_STAFF_ID")
protected String managerSTAFFID;
@XmlElement(name = "MANAGER_EMAIL")
protected String managerEMAIL;
@XmlElement(name = "MANAGER_PHONE")
protected String managerPHONE;
@XmlElement(name = "RES_DEPT_ID")
protected String resDEPTID;
@XmlElement(name = "APPLY_CODE")
protected String applyCODE;
@XmlElement(name = "BATCH_NO")
protected String batchNO;
@XmlElement(name = "REMARK")
protected String remark;
@XmlElement(name = "AFFILIATETIME")
protected String affiliatetime;
@XmlElement(name = "START_TIME")
protected String startTIME;
@XmlElement(name = "END_TIME")
protected String endTIME;
@XmlElement(name = "CREATE_STAFF_ID")
protected String createSTAFFID;
@XmlElement(name = "CREATE_TIME")
protected String createTIME;
@XmlElement(name = "UPDATE_DEPART_ID")
protected String updateDEPARTID;
@XmlElement(name = "UPDATE_STAFF_ID")
protected String updateSTAFFID;
@XmlElement(name = "UPDATE_DATE")
protected String updateDATE;
@XmlElement(name = "IS_REALLY_CHNL")
protected String isREALLYCHNL;
@XmlElement(name = "JURI_PSPT_ID")
protected String juriPSPTID;
@XmlElement(name = "CIM_CHANNEL_ID")
protected String cimCHANNELID;
@XmlElement(name = "DEBT_WARN")
protected String debtWARN;
@XmlElement(name = "EPARCHY_CODE")
protected String eparchyCODE;
@XmlElement(name = "B_CITY_CODE")
protected String bCITYCODE;
@XmlElement(name = "B_ZONEID")
protected String bZONEID;
@XmlElement(name = "B_TOWNID")
protected String bTOWNID;
@XmlElement(name = "INTEGRAL")
protected String integral;
@XmlElement(name = "PENALTY")
protected String penalty;
@XmlElement(name = "FOUL_TIME")
protected BigInteger foulTIME;
@XmlElement(name = "ERP_CODE")
protected String erpCODE;
@XmlElement(name = "ERP_AREA_CODE")
protected String erpAREACODE;
@XmlElement(name = "COPARTNER_ID")
protected String copartnerID;
@XmlElement(name = "PARENT_DEPART_ID")
protected String parentDEPARTID;
@XmlElement(name = "MANAGE_CHNL_ID")
protected String manageCHNLID;
@XmlElement(name = "IF_MANAGE_CHNL")
protected String ifMANAGECHNL;
@XmlElement(name = "CHNL_KIND_FRAME")
protected String chnlKINDFRAME;
@XmlElement(name = "CHNL_LAYER")
protected String chnlLAYER;
@XmlElement(name = "CHNL_CREDIT")
protected String chnlCREDIT;
@XmlElement(name = "NATIONAL_CHNL")
protected String nationalCHNL;
@XmlElement(name = "BUSI_PERMISSION")
protected String busiPERMISSION;
@XmlElement(name = "JURI_PSPT_TYPE")
protected String juriPSPTTYPE;
@XmlElement(name = "JURI_PERSON")
protected String juriPERSON;
@XmlElement(name = "REG_DATE")
protected String regDATE;
@XmlElement(name = "TAX_NO")
protected String taxNO;
@XmlElement(name = "BUSI_LICENCE")
protected String busiLICENCE;
@XmlElement(name = "EXTINFO")
protected List<CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO> extinfo;
@XmlElement(name = "FUNCLIST", required = true)
protected CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST funclist;
@XmlElement(name = "DEVLIST", required = true)
protected CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST devlist;
@XmlElement(name = "PARA")
protected List<CHANNEL_INFO_CHG_NOTIFY_REQ.PARA> para;
/**
* Gets the value of the operate_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATE_TYPE() {
return operateTYPE;
}
/**
* Sets the value of the operate_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATE_TYPE(String value) {
this.operateTYPE = value;
}
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the chnl_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CODE() {
return chnlCODE;
}
/**
* Sets the value of the chnl_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CODE(String value) {
this.chnlCODE = value;
}
/**
* Gets the value of the chnl_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_NAME() {
return chnlNAME;
}
/**
* Sets the value of the chnl_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_NAME(String value) {
this.chnlNAME = value;
}
/**
* Gets the value of the chnl_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_DESC() {
return chnlDESC;
}
/**
* Sets the value of the chnl_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_DESC(String value) {
this.chnlDESC = value;
}
/**
* Gets the value of the chnl_ORG_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ORG_ID() {
return chnlORGID;
}
/**
* Sets the value of the chnl_ORG_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ORG_ID(String value) {
this.chnlORGID = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE(String value) {
this.state = value;
}
/**
* Gets the value of the state_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE_DESC() {
return stateDESC;
}
/**
* Sets the value of the state_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE_DESC(String value) {
this.stateDESC = value;
}
/**
* Gets the value of the chnl_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_KIND_ID() {
return chnlKINDID;
}
/**
* Sets the value of the chnl_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_KIND_ID(String value) {
this.chnlKINDID = value;
}
/**
* Gets the value of the local_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLOCAL_KIND_ID() {
return localKINDID;
}
/**
* Sets the value of the local_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLOCAL_KIND_ID(String value) {
this.localKINDID = value;
}
/**
* Gets the value of the chnl_CLASS_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CLASS_ID() {
return chnlCLASSID;
}
/**
* Sets the value of the chnl_CLASS_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CLASS_ID(String value) {
this.chnlCLASSID = value;
}
/**
* Gets the value of the chain_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHAIN_FLAG() {
return chainFLAG;
}
/**
* Sets the value of the chain_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHAIN_FLAG(String value) {
this.chainFLAG = value;
}
/**
* Gets the value of the is_RWD_CNT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_RWD_CNT() {
return isRWDCNT;
}
/**
* Sets the value of the is_RWD_CNT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_RWD_CNT(String value) {
this.isRWDCNT = value;
}
/**
* Gets the value of the pay_SCOPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_SCOPE() {
return paySCOPE;
}
/**
* Sets the value of the pay_SCOPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_SCOPE(String value) {
this.paySCOPE = value;
}
/**
* Gets the value of the pay_CHNL_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_CHNL_CODE() {
return payCHNLCODE;
}
/**
* Sets the value of the pay_CHNL_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_CHNL_CODE(String value) {
this.payCHNLCODE = value;
}
/**
* Gets the value of the super_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSUPER_CHNL_ID() {
return superCHNLID;
}
/**
* Sets the value of the super_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSUPER_CHNL_ID(String value) {
this.superCHNLID = value;
}
/**
* Gets the value of the self_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSELF_CHNL_ID() {
return selfCHNLID;
}
/**
* Sets the value of the self_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSELF_CHNL_ID(String value) {
this.selfCHNLID = value;
}
/**
* Gets the value of the rwd_CNT_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRWD_CNT_DATE() {
return rwdCNTDATE;
}
/**
* Sets the value of the rwd_CNT_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRWD_CNT_DATE(String value) {
this.rwdCNTDATE = value;
}
/**
* Gets the value of the liquidation_START_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLIQUIDATION_START_DATE() {
return liquidationSTARTDATE;
}
/**
* Sets the value of the liquidation_START_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLIQUIDATION_START_DATE(String value) {
this.liquidationSTARTDATE = value;
}
/**
* Gets the value of the liquidation_PAY_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLIQUIDATION_PAY_FLAG() {
return liquidationPAYFLAG;
}
/**
* Sets the value of the liquidation_PAY_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLIQUIDATION_PAY_FLAG(String value) {
this.liquidationPAYFLAG = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the manager_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_AREA_CODE() {
return managerAREACODE;
}
/**
* Sets the value of the manager_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_AREA_CODE(String value) {
this.managerAREACODE = value;
}
/**
* Gets the value of the area_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_TYPE() {
return areaTYPE;
}
/**
* Sets the value of the area_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_TYPE(String value) {
this.areaTYPE = value;
}
/**
* Gets the value of the chnl_CHAIN_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CHAIN_LEVEL() {
return chnlCHAINLEVEL;
}
/**
* Sets the value of the chnl_CHAIN_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CHAIN_LEVEL(String value) {
this.chnlCHAINLEVEL = value;
}
/**
* Gets the value of the chnl_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LEVEL() {
return chnlLEVEL;
}
/**
* Sets the value of the chnl_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LEVEL(String value) {
this.chnlLEVEL = value;
}
/**
* Gets the value of the is_INPUT_SYSTEM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_INPUT_SYSTEM() {
return isINPUTSYSTEM;
}
/**
* Sets the value of the is_INPUT_SYSTEM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_INPUT_SYSTEM(String value) {
this.isINPUTSYSTEM = value;
}
/**
* Gets the value of the system_NUM property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSYSTEM_NUM() {
return systemNUM;
}
/**
* Sets the value of the system_NUM property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSYSTEM_NUM(BigInteger value) {
this.systemNUM = value;
}
/**
* Gets the value of the is_MINI_HALL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_MINI_HALL() {
return isMINIHALL;
}
/**
* Sets the value of the is_MINI_HALL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_MINI_HALL(String value) {
this.isMINIHALL = value;
}
/**
* Gets the value of the chnl_SCOPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_SCOPE() {
return chnlSCOPE;
}
/**
* Sets the value of the chnl_SCOPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_SCOPE(String value) {
this.chnlSCOPE = value;
}
/**
* Gets the value of the chnl_AREA_KIND_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_AREA_KIND_ID() {
return chnlAREAKINDID;
}
/**
* Sets the value of the chnl_AREA_KIND_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_AREA_KIND_ID(String value) {
this.chnlAREAKINDID = value;
}
/**
* Gets the value of the bank_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_CODE() {
return bankCODE;
}
/**
* Sets the value of the bank_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_CODE(String value) {
this.bankCODE = value;
}
/**
* Gets the value of the bank_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NO() {
return bankNO;
}
/**
* Sets the value of the bank_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NO(String value) {
this.bankNO = value;
}
/**
* Gets the value of the bank_ACCT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCT_NAME() {
return bankACCTNAME;
}
/**
* Sets the value of the bank_ACCT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCT_NAME(String value) {
this.bankACCTNAME = value;
}
/**
* Gets the value of the address property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getADDRESS() {
return address;
}
/**
* Sets the value of the address property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setADDRESS(String value) {
this.address = value;
}
/**
* Gets the value of the chnl_LINKMAN_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LINKMAN_NAME() {
return chnlLINKMANNAME;
}
/**
* Sets the value of the chnl_LINKMAN_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LINKMAN_NAME(String value) {
this.chnlLINKMANNAME = value;
}
/**
* Gets the value of the chnl_LINKMAN_SEX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LINKMAN_SEX() {
return chnlLINKMANSEX;
}
/**
* Sets the value of the chnl_LINKMAN_SEX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LINKMAN_SEX(String value) {
this.chnlLINKMANSEX = value;
}
/**
* Gets the value of the chnl_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_EMAIL() {
return chnlEMAIL;
}
/**
* Sets the value of the chnl_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_EMAIL(String value) {
this.chnlEMAIL = value;
}
/**
* Gets the value of the chnl_FAX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_FAX() {
return chnlFAX;
}
/**
* Sets the value of the chnl_FAX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_FAX(String value) {
this.chnlFAX = value;
}
/**
* Gets the value of the chnl_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ADDR() {
return chnlADDR;
}
/**
* Sets the value of the chnl_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ADDR(String value) {
this.chnlADDR = value;
}
/**
* Gets the value of the chnl_OFFICE_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_OFFICE_PHONE() {
return chnlOFFICEPHONE;
}
/**
* Sets the value of the chnl_OFFICE_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_OFFICE_PHONE(String value) {
this.chnlOFFICEPHONE = value;
}
/**
* Gets the value of the chnl_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_PHONE() {
return chnlPHONE;
}
/**
* Sets the value of the chnl_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_PHONE(String value) {
this.chnlPHONE = value;
}
/**
* Gets the value of the chnl_POSTALCODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_POSTALCODE() {
return chnlPOSTALCODE;
}
/**
* Sets the value of the chnl_POSTALCODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_POSTALCODE(String value) {
this.chnlPOSTALCODE = value;
}
/**
* Gets the value of the longitude property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLONGITUDE() {
return longitude;
}
/**
* Sets the value of the longitude property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLONGITUDE(String value) {
this.longitude = value;
}
/**
* Gets the value of the latitude property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLATITUDE() {
return latitude;
}
/**
* Sets the value of the latitude property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLATITUDE(String value) {
this.latitude = value;
}
/**
* Gets the value of the manager_DEPT_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_DEPT_ID() {
return managerDEPTID;
}
/**
* Sets the value of the manager_DEPT_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_DEPT_ID(String value) {
this.managerDEPTID = value;
}
/**
* Gets the value of the manager_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_STAFF_ID() {
return managerSTAFFID;
}
/**
* Sets the value of the manager_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_STAFF_ID(String value) {
this.managerSTAFFID = value;
}
/**
* Gets the value of the manager_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_EMAIL() {
return managerEMAIL;
}
/**
* Sets the value of the manager_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_EMAIL(String value) {
this.managerEMAIL = value;
}
/**
* Gets the value of the manager_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_PHONE() {
return managerPHONE;
}
/**
* Sets the value of the manager_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_PHONE(String value) {
this.managerPHONE = value;
}
/**
* Gets the value of the res_DEPT_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRES_DEPT_ID() {
return resDEPTID;
}
/**
* Sets the value of the res_DEPT_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRES_DEPT_ID(String value) {
this.resDEPTID = value;
}
/**
* Gets the value of the apply_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAPPLY_CODE() {
return applyCODE;
}
/**
* Sets the value of the apply_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAPPLY_CODE(String value) {
this.applyCODE = value;
}
/**
* Gets the value of the batch_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_NO() {
return batchNO;
}
/**
* Sets the value of the batch_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_NO(String value) {
this.batchNO = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the affiliatetime property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAFFILIATETIME() {
return affiliatetime;
}
/**
* Sets the value of the affiliatetime property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAFFILIATETIME(String value) {
this.affiliatetime = value;
}
/**
* Gets the value of the start_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_TIME() {
return startTIME;
}
/**
* Sets the value of the start_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_TIME(String value) {
this.startTIME = value;
}
/**
* Gets the value of the end_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_TIME() {
return endTIME;
}
/**
* Sets the value of the end_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_TIME(String value) {
this.endTIME = value;
}
/**
* Gets the value of the create_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_ID() {
return createSTAFFID;
}
/**
* Sets the value of the create_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_ID(String value) {
this.createSTAFFID = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the update_DEPART_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_DEPART_ID() {
return updateDEPARTID;
}
/**
* Sets the value of the update_DEPART_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_DEPART_ID(String value) {
this.updateDEPARTID = value;
}
/**
* Gets the value of the update_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_STAFF_ID() {
return updateSTAFFID;
}
/**
* Sets the value of the update_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_STAFF_ID(String value) {
this.updateSTAFFID = value;
}
/**
* Gets the value of the update_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_DATE() {
return updateDATE;
}
/**
* Sets the value of the update_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_DATE(String value) {
this.updateDATE = value;
}
/**
* Gets the value of the is_REALLY_CHNL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_REALLY_CHNL() {
return isREALLYCHNL;
}
/**
* Sets the value of the is_REALLY_CHNL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_REALLY_CHNL(String value) {
this.isREALLYCHNL = value;
}
/**
* Gets the value of the juri_PSPT_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJURI_PSPT_ID() {
return juriPSPTID;
}
/**
* Sets the value of the juri_PSPT_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJURI_PSPT_ID(String value) {
this.juriPSPTID = value;
}
/**
* Gets the value of the cim_CHANNEL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCIM_CHANNEL_ID() {
return cimCHANNELID;
}
/**
* Sets the value of the cim_CHANNEL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCIM_CHANNEL_ID(String value) {
this.cimCHANNELID = value;
}
/**
* Gets the value of the debt_WARN property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEBT_WARN() {
return debtWARN;
}
/**
* Sets the value of the debt_WARN property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEBT_WARN(String value) {
this.debtWARN = value;
}
/**
* Gets the value of the eparchy_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEPARCHY_CODE() {
return eparchyCODE;
}
/**
* Sets the value of the eparchy_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEPARCHY_CODE(String value) {
this.eparchyCODE = value;
}
/**
* Gets the value of the b_CITY_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB_CITY_CODE() {
return bCITYCODE;
}
/**
* Sets the value of the b_CITY_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB_CITY_CODE(String value) {
this.bCITYCODE = value;
}
/**
* Gets the value of the b_ZONEID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB_ZONEID() {
return bZONEID;
}
/**
* Sets the value of the b_ZONEID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB_ZONEID(String value) {
this.bZONEID = value;
}
/**
* Gets the value of the b_TOWNID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB_TOWNID() {
return bTOWNID;
}
/**
* Sets the value of the b_TOWNID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB_TOWNID(String value) {
this.bTOWNID = value;
}
/**
* Gets the value of the integral property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINTEGRAL() {
return integral;
}
/**
* Sets the value of the integral property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINTEGRAL(String value) {
this.integral = value;
}
/**
* Gets the value of the penalty property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPENALTY() {
return penalty;
}
/**
* Sets the value of the penalty property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPENALTY(String value) {
this.penalty = value;
}
/**
* Gets the value of the foul_TIME property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getFOUL_TIME() {
return foulTIME;
}
/**
* Sets the value of the foul_TIME property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setFOUL_TIME(BigInteger value) {
this.foulTIME = value;
}
/**
* Gets the value of the erp_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getERP_CODE() {
return erpCODE;
}
/**
* Sets the value of the erp_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setERP_CODE(String value) {
this.erpCODE = value;
}
/**
* Gets the value of the erp_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getERP_AREA_CODE() {
return erpAREACODE;
}
/**
* Sets the value of the erp_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setERP_AREA_CODE(String value) {
this.erpAREACODE = value;
}
/**
* Gets the value of the copartner_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOPARTNER_ID() {
return copartnerID;
}
/**
* Sets the value of the copartner_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOPARTNER_ID(String value) {
this.copartnerID = value;
}
/**
* Gets the value of the parent_DEPART_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARENT_DEPART_ID() {
return parentDEPARTID;
}
/**
* Sets the value of the parent_DEPART_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARENT_DEPART_ID(String value) {
this.parentDEPARTID = value;
}
/**
* Gets the value of the manage_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGE_CHNL_ID() {
return manageCHNLID;
}
/**
* Sets the value of the manage_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGE_CHNL_ID(String value) {
this.manageCHNLID = value;
}
/**
* Gets the value of the if_MANAGE_CHNL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIF_MANAGE_CHNL() {
return ifMANAGECHNL;
}
/**
* Sets the value of the if_MANAGE_CHNL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIF_MANAGE_CHNL(String value) {
this.ifMANAGECHNL = value;
}
/**
* Gets the value of the chnl_KIND_FRAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_KIND_FRAME() {
return chnlKINDFRAME;
}
/**
* Sets the value of the chnl_KIND_FRAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_KIND_FRAME(String value) {
this.chnlKINDFRAME = value;
}
/**
* Gets the value of the chnl_LAYER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_LAYER() {
return chnlLAYER;
}
/**
* Sets the value of the chnl_LAYER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_LAYER(String value) {
this.chnlLAYER = value;
}
/**
* Gets the value of the chnl_CREDIT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CREDIT() {
return chnlCREDIT;
}
/**
* Sets the value of the chnl_CREDIT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CREDIT(String value) {
this.chnlCREDIT = value;
}
/**
* Gets the value of the national_CHNL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNATIONAL_CHNL() {
return nationalCHNL;
}
/**
* Sets the value of the national_CHNL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNATIONAL_CHNL(String value) {
this.nationalCHNL = value;
}
/**
* Gets the value of the busi_PERMISSION property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_PERMISSION() {
return busiPERMISSION;
}
/**
* Sets the value of the busi_PERMISSION property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_PERMISSION(String value) {
this.busiPERMISSION = value;
}
/**
* Gets the value of the juri_PSPT_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJURI_PSPT_TYPE() {
return juriPSPTTYPE;
}
/**
* Sets the value of the juri_PSPT_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJURI_PSPT_TYPE(String value) {
this.juriPSPTTYPE = value;
}
/**
* Gets the value of the juri_PERSON property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJURI_PERSON() {
return juriPERSON;
}
/**
* Sets the value of the juri_PERSON property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJURI_PERSON(String value) {
this.juriPERSON = value;
}
/**
* Gets the value of the reg_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREG_DATE() {
return regDATE;
}
/**
* Sets the value of the reg_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREG_DATE(String value) {
this.regDATE = value;
}
/**
* Gets the value of the tax_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAX_NO() {
return taxNO;
}
/**
* Sets the value of the tax_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAX_NO(String value) {
this.taxNO = value;
}
/**
* Gets the value of the busi_LICENCE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_LICENCE() {
return busiLICENCE;
}
/**
* Sets the value of the busi_LICENCE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_LICENCE(String value) {
this.busiLICENCE = value;
}
/**
* Gets the value of the extinfo property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the extinfo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEXTINFO().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO }
*
*
*/
public List<CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO> getEXTINFO() {
if (extinfo == null) {
extinfo = new ArrayList<CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO>();
}
return this.extinfo;
}
/**
* CXF生成时没有set方法,这是后来添加的
* add by yougang
* @param value
*/
public void setEXTINFO(List<CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO> value) {
this.extinfo = value;
}
/**
* Gets the value of the funclist property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST getFUNCLIST() {
return funclist;
}
/**
* Sets the value of the funclist property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST }
*
*/
public void setFUNCLIST(CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST value) {
this.funclist = value;
}
/**
* Gets the value of the devlist property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST getDEVLIST() {
return devlist;
}
/**
* Sets the value of the devlist property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST }
*
*/
public void setDEVLIST(CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST value) {
this.devlist = value;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.PARA }
*
*
*/
public List<CHANNEL_INFO_CHG_NOTIFY_REQ.PARA> getPARA() {
if (para == null) {
para = new ArrayList<CHANNEL_INFO_CHG_NOTIFY_REQ.PARA>();
}
return this.para;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="DEVINFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CHNLDEVINFO">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="START_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="END_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="DEVELOPER">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_TYPE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="GROUP_ACCT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USER_PID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_COMM_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_ACCT_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_EMAIL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_POSTCODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BATCH_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="HAVE_BSS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_AUTO_CREATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SELF_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_SUM_BONUS" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"devinfo"
})
public static class DEVLIST {
@XmlElement(name = "DEVINFO")
protected List<CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO> devinfo;
/**
* Gets the value of the devinfo property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the devinfo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDEVINFO().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO }
*
*
*/
public List<CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO> getDEVINFO() {
if (devinfo == null) {
devinfo = new ArrayList<CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO>();
}
return this.devinfo;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CHNLDEVINFO">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="START_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="END_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="DEVELOPER">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_TYPE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="GROUP_ACCT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USER_PID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_COMM_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_ACCT_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_EMAIL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_POSTCODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BATCH_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="HAVE_BSS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_AUTO_CREATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SELF_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_SUM_BONUS" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"chnldevinfo",
"developer"
})
public static class DEVINFO {
@XmlElement(name = "CHNLDEVINFO", required = true)
protected CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO chnldevinfo;
@XmlElement(name = "DEVELOPER", required = true)
protected CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER developer;
/**
* Gets the value of the chnldevinfo property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO getCHNLDEVINFO() {
return chnldevinfo;
}
/**
* Sets the value of the chnldevinfo property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO }
*
*/
public void setCHNLDEVINFO(CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO value) {
this.chnldevinfo = value;
}
/**
* Gets the value of the developer property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER getDEVELOPER() {
return developer;
}
/**
* Sets the value of the developer property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER }
*
*/
public void setDEVELOPER(CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER value) {
this.developer = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="START_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="END_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderID",
"chnlDEVID",
"chnlID",
"devID",
"startTIME",
"endTIME",
"state",
"optFLAG",
"remark",
"createSTAFFID",
"createTIME",
"updateSTAFFID",
"updateTIME"
})
public static class CHNLDEVINFO {
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "CHNL_DEV_ID", required = true)
protected String chnlDEVID;
@XmlElement(name = "CHNL_ID", required = true)
protected String chnlID;
@XmlElement(name = "DEV_ID")
protected String devID;
@XmlElement(name = "START_TIME")
protected String startTIME;
@XmlElement(name = "END_TIME")
protected String endTIME;
@XmlElement(name = "STATE")
protected String state;
@XmlElement(name = "OPT_FLAG")
protected String optFLAG;
@XmlElement(name = "REMARK")
protected String remark;
@XmlElement(name = "CREATE_STAFF_ID")
protected String createSTAFFID;
@XmlElement(name = "CREATE_TIME")
protected String createTIME;
@XmlElement(name = "UPDATE_STAFF_ID")
protected String updateSTAFFID;
@XmlElement(name = "UPDATE_TIME")
protected String updateTIME;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_DEV_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_DEV_ID() {
return chnlDEVID;
}
/**
* Sets the value of the chnl_DEV_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_DEV_ID(String value) {
this.chnlDEVID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the dev_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_ID() {
return devID;
}
/**
* Sets the value of the dev_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_ID(String value) {
this.devID = value;
}
/**
* Gets the value of the start_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_TIME() {
return startTIME;
}
/**
* Sets the value of the start_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_TIME(String value) {
this.startTIME = value;
}
/**
* Gets the value of the end_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_TIME() {
return endTIME;
}
/**
* Sets the value of the end_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_TIME(String value) {
this.endTIME = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTATE() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTATE(String value) {
this.state = value;
}
/**
* Gets the value of the opt_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPT_FLAG() {
return optFLAG;
}
/**
* Sets the value of the opt_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPT_FLAG(String value) {
this.optFLAG = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the create_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_ID() {
return createSTAFFID;
}
/**
* Sets the value of the create_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_ID(String value) {
this.createSTAFFID = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the update_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_STAFF_ID() {
return updateSTAFFID;
}
/**
* Sets the value of the update_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_STAFF_ID(String value) {
this.updateSTAFFID = value;
}
/**
* Gets the value of the update_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_TIME() {
return updateTIME;
}
/**
* Sets the value of the update_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_TIME(String value) {
this.updateTIME = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_TYPE_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PROVINCE_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CITY_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="AREA_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEV_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="GROUP_ACCT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CERT_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USER_PID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_COMM_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BANK_ACCT_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_PHONE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_EMAIL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="LINKMAN_POSTCODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CREATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="UPDATE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="14"/>
* <minLength value="14"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BATCH_NO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OPT_FLAG" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="HAVE_BSS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_AUTO_CREATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SELF_CHNL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IS_SUM_BONUS" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderID",
"devID",
"devCODE",
"devTYPEID",
"devNAME",
"provinceCODE",
"cityCODE",
"areaCODE",
"devSTAFFID",
"groupACCT",
"certTYPE",
"userPID",
"payCOMMFLAG",
"bankCODE",
"bankNO",
"bankACCTNAME",
"linkmanNAME",
"linkmanPHONE",
"linkmanEMAIL",
"linkmanADDR",
"linkmanPOSTCODE",
"createSTAFFID",
"createTIME",
"updateSTAFFID",
"updateTIME",
"batchNO",
"optFLAG",
"remark",
"haveBSSCODE",
"bssSYSCODE",
"bssSYSCODE2",
"isAUTOCREATE",
"selfCHNLID",
"isSUMBONUS"
})
public static class DEVELOPER {
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "DEV_ID", required = true)
protected String devID;
@XmlElement(name = "DEV_CODE", required = true)
protected String devCODE;
@XmlElement(name = "DEV_TYPE_ID")
protected String devTYPEID;
@XmlElement(name = "DEV_NAME", required = true)
protected String devNAME;
@XmlElement(name = "PROVINCE_CODE")
protected String provinceCODE;
@XmlElement(name = "CITY_CODE")
protected String cityCODE;
@XmlElement(name = "AREA_CODE")
protected String areaCODE;
@XmlElement(name = "DEV_STAFF_ID")
protected String devSTAFFID;
@XmlElement(name = "GROUP_ACCT")
protected String groupACCT;
@XmlElement(name = "CERT_TYPE")
protected String certTYPE;
@XmlElement(name = "USER_PID", required = true)
protected String userPID;
@XmlElement(name = "PAY_COMM_FLAG")
protected String payCOMMFLAG;
@XmlElement(name = "BANK_CODE")
protected String bankCODE;
@XmlElement(name = "BANK_NO")
protected String bankNO;
@XmlElement(name = "BANK_ACCT_NAME")
protected String bankACCTNAME;
@XmlElement(name = "LINKMAN_NAME")
protected String linkmanNAME;
@XmlElement(name = "LINKMAN_PHONE")
protected String linkmanPHONE;
@XmlElement(name = "LINKMAN_EMAIL")
protected String linkmanEMAIL;
@XmlElement(name = "LINKMAN_ADDR")
protected String linkmanADDR;
@XmlElement(name = "LINKMAN_POSTCODE")
protected String linkmanPOSTCODE;
@XmlElement(name = "CREATE_STAFF_ID")
protected String createSTAFFID;
@XmlElement(name = "CREATE_TIME")
protected String createTIME;
@XmlElement(name = "UPDATE_STAFF_ID")
protected String updateSTAFFID;
@XmlElement(name = "UPDATE_TIME")
protected String updateTIME;
@XmlElement(name = "BATCH_NO")
protected String batchNO;
@XmlElement(name = "OPT_FLAG")
protected String optFLAG;
@XmlElement(name = "REMARK")
protected String remark;
@XmlElement(name = "HAVE_BSS_CODE")
protected String haveBSSCODE;
@XmlElement(name = "BSS_SYS_CODE")
protected String bssSYSCODE;
@XmlElement(name = "BSS_SYS_CODE2")
protected String bssSYSCODE2;
@XmlElement(name = "IS_AUTO_CREATE")
protected String isAUTOCREATE;
@XmlElement(name = "SELF_CHNL_ID")
protected String selfCHNLID;
@XmlElement(name = "IS_SUM_BONUS")
protected String isSUMBONUS;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the dev_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_ID() {
return devID;
}
/**
* Sets the value of the dev_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_ID(String value) {
this.devID = value;
}
/**
* Gets the value of the dev_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_CODE() {
return devCODE;
}
/**
* Sets the value of the dev_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_CODE(String value) {
this.devCODE = value;
}
/**
* Gets the value of the dev_TYPE_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_TYPE_ID() {
return devTYPEID;
}
/**
* Sets the value of the dev_TYPE_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_TYPE_ID(String value) {
this.devTYPEID = value;
}
/**
* Gets the value of the dev_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_NAME() {
return devNAME;
}
/**
* Sets the value of the dev_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_NAME(String value) {
this.devNAME = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the area_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_CODE() {
return areaCODE;
}
/**
* Sets the value of the area_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_CODE(String value) {
this.areaCODE = value;
}
/**
* Gets the value of the dev_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEV_STAFF_ID() {
return devSTAFFID;
}
/**
* Sets the value of the dev_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEV_STAFF_ID(String value) {
this.devSTAFFID = value;
}
/**
* Gets the value of the group_ACCT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGROUP_ACCT() {
return groupACCT;
}
/**
* Sets the value of the group_ACCT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGROUP_ACCT(String value) {
this.groupACCT = value;
}
/**
* Gets the value of the cert_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCERT_TYPE() {
return certTYPE;
}
/**
* Sets the value of the cert_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCERT_TYPE(String value) {
this.certTYPE = value;
}
/**
* Gets the value of the user_PID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSER_PID() {
return userPID;
}
/**
* Sets the value of the user_PID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSER_PID(String value) {
this.userPID = value;
}
/**
* Gets the value of the pay_COMM_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_COMM_FLAG() {
return payCOMMFLAG;
}
/**
* Sets the value of the pay_COMM_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_COMM_FLAG(String value) {
this.payCOMMFLAG = value;
}
/**
* Gets the value of the bank_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_CODE() {
return bankCODE;
}
/**
* Sets the value of the bank_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_CODE(String value) {
this.bankCODE = value;
}
/**
* Gets the value of the bank_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NO() {
return bankNO;
}
/**
* Sets the value of the bank_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NO(String value) {
this.bankNO = value;
}
/**
* Gets the value of the bank_ACCT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCT_NAME() {
return bankACCTNAME;
}
/**
* Sets the value of the bank_ACCT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCT_NAME(String value) {
this.bankACCTNAME = value;
}
/**
* Gets the value of the linkman_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_NAME() {
return linkmanNAME;
}
/**
* Sets the value of the linkman_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_NAME(String value) {
this.linkmanNAME = value;
}
/**
* Gets the value of the linkman_PHONE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_PHONE() {
return linkmanPHONE;
}
/**
* Sets the value of the linkman_PHONE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_PHONE(String value) {
this.linkmanPHONE = value;
}
/**
* Gets the value of the linkman_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_EMAIL() {
return linkmanEMAIL;
}
/**
* Sets the value of the linkman_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_EMAIL(String value) {
this.linkmanEMAIL = value;
}
/**
* Gets the value of the linkman_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_ADDR() {
return linkmanADDR;
}
/**
* Sets the value of the linkman_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_ADDR(String value) {
this.linkmanADDR = value;
}
/**
* Gets the value of the linkman_POSTCODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINKMAN_POSTCODE() {
return linkmanPOSTCODE;
}
/**
* Sets the value of the linkman_POSTCODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINKMAN_POSTCODE(String value) {
this.linkmanPOSTCODE = value;
}
/**
* Gets the value of the create_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_STAFF_ID() {
return createSTAFFID;
}
/**
* Sets the value of the create_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_STAFF_ID(String value) {
this.createSTAFFID = value;
}
/**
* Gets the value of the create_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCREATE_TIME() {
return createTIME;
}
/**
* Sets the value of the create_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCREATE_TIME(String value) {
this.createTIME = value;
}
/**
* Gets the value of the update_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_STAFF_ID() {
return updateSTAFFID;
}
/**
* Sets the value of the update_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_STAFF_ID(String value) {
this.updateSTAFFID = value;
}
/**
* Gets the value of the update_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPDATE_TIME() {
return updateTIME;
}
/**
* Sets the value of the update_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPDATE_TIME(String value) {
this.updateTIME = value;
}
/**
* Gets the value of the batch_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_NO() {
return batchNO;
}
/**
* Sets the value of the batch_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_NO(String value) {
this.batchNO = value;
}
/**
* Gets the value of the opt_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPT_FLAG() {
return optFLAG;
}
/**
* Sets the value of the opt_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPT_FLAG(String value) {
this.optFLAG = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the have_BSS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHAVE_BSS_CODE() {
return haveBSSCODE;
}
/**
* Sets the value of the have_BSS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHAVE_BSS_CODE(String value) {
this.haveBSSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE() {
return bssSYSCODE;
}
/**
* Sets the value of the bss_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE(String value) {
this.bssSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE2() {
return bssSYSCODE2;
}
/**
* Sets the value of the bss_SYS_CODE2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE2(String value) {
this.bssSYSCODE2 = value;
}
/**
* Gets the value of the is_AUTO_CREATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_AUTO_CREATE() {
return isAUTOCREATE;
}
/**
* Sets the value of the is_AUTO_CREATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_AUTO_CREATE(String value) {
this.isAUTOCREATE = value;
}
/**
* Gets the value of the self_CHNL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSELF_CHNL_ID() {
return selfCHNLID;
}
/**
* Sets the value of the self_CHNL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSELF_CHNL_ID(String value) {
this.selfCHNLID = value;
}
/**
* Gets the value of the is_SUM_BONUS property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIS_SUM_BONUS() {
return isSUMBONUS;
}
/**
* Sets the value of the is_SUM_BONUS property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIS_SUM_BONUS(String value) {
this.isSUMBONUS = value;
}
}
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="10"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEPOSIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PENALTY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="COMPLAIN_RATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="INDUSTRY_CLASS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="INDUSTRY_MERIT" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ESS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4000"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BSS_SYS_CODE2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="4000"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SALE_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="OTHER_SYS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SYS_STAFF_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="HAVE_BSS_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BUSI_FEE_IS_CLEAR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EARNEST_IS_CLEAR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="COMM_IS_CLEAR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderID",
"chnlID",
"deposit",
"penalty",
"complainRATE",
"industryCLASSCODE",
"industryMERIT",
"essSYSCODE",
"bssSYSCODE",
"bssSYSCODE2",
"saleSYSCODE",
"otherSYSCODE",
"sysSTAFFID",
"haveBSSCODE",
"busiFEEISCLEAR",
"earnestISCLEAR",
"commISCLEAR"
})
public static class EXTINFO {
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "CHNL_ID", required = true)
protected String chnlID;
@XmlElement(name = "DEPOSIT")
protected String deposit;
@XmlElement(name = "PENALTY")
protected String penalty;
@XmlElement(name = "COMPLAIN_RATE")
protected String complainRATE;
@XmlElement(name = "INDUSTRY_CLASS_CODE")
protected String industryCLASSCODE;
@XmlElement(name = "INDUSTRY_MERIT")
protected String industryMERIT;
@XmlElement(name = "ESS_SYS_CODE")
protected String essSYSCODE;
@XmlElement(name = "BSS_SYS_CODE")
protected String bssSYSCODE;
@XmlElement(name = "BSS_SYS_CODE2")
protected String bssSYSCODE2;
@XmlElement(name = "SALE_SYS_CODE")
protected String saleSYSCODE;
@XmlElement(name = "OTHER_SYS_CODE")
protected String otherSYSCODE;
@XmlElement(name = "SYS_STAFF_ID")
protected String sysSTAFFID;
@XmlElement(name = "HAVE_BSS_CODE")
protected String haveBSSCODE;
@XmlElement(name = "BUSI_FEE_IS_CLEAR")
protected String busiFEEISCLEAR;
@XmlElement(name = "EARNEST_IS_CLEAR")
protected String earnestISCLEAR;
@XmlElement(name = "COMM_IS_CLEAR")
protected String commISCLEAR;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the deposit property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPOSIT() {
return deposit;
}
/**
* Sets the value of the deposit property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPOSIT(String value) {
this.deposit = value;
}
/**
* Gets the value of the penalty property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPENALTY() {
return penalty;
}
/**
* Sets the value of the penalty property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPENALTY(String value) {
this.penalty = value;
}
/**
* Gets the value of the complain_RATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOMPLAIN_RATE() {
return complainRATE;
}
/**
* Sets the value of the complain_RATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOMPLAIN_RATE(String value) {
this.complainRATE = value;
}
/**
* Gets the value of the industry_CLASS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINDUSTRY_CLASS_CODE() {
return industryCLASSCODE;
}
/**
* Sets the value of the industry_CLASS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINDUSTRY_CLASS_CODE(String value) {
this.industryCLASSCODE = value;
}
/**
* Gets the value of the industry_MERIT property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINDUSTRY_MERIT() {
return industryMERIT;
}
/**
* Sets the value of the industry_MERIT property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINDUSTRY_MERIT(String value) {
this.industryMERIT = value;
}
/**
* Gets the value of the ess_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getESS_SYS_CODE() {
return essSYSCODE;
}
/**
* Sets the value of the ess_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setESS_SYS_CODE(String value) {
this.essSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE() {
return bssSYSCODE;
}
/**
* Sets the value of the bss_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE(String value) {
this.bssSYSCODE = value;
}
/**
* Gets the value of the bss_SYS_CODE2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBSS_SYS_CODE2() {
return bssSYSCODE2;
}
/**
* Sets the value of the bss_SYS_CODE2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBSS_SYS_CODE2(String value) {
this.bssSYSCODE2 = value;
}
/**
* Gets the value of the sale_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSALE_SYS_CODE() {
return saleSYSCODE;
}
/**
* Sets the value of the sale_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSALE_SYS_CODE(String value) {
this.saleSYSCODE = value;
}
/**
* Gets the value of the other_SYS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOTHER_SYS_CODE() {
return otherSYSCODE;
}
/**
* Sets the value of the other_SYS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOTHER_SYS_CODE(String value) {
this.otherSYSCODE = value;
}
/**
* Gets the value of the sys_STAFF_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSYS_STAFF_ID() {
return sysSTAFFID;
}
/**
* Sets the value of the sys_STAFF_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSYS_STAFF_ID(String value) {
this.sysSTAFFID = value;
}
/**
* Gets the value of the have_BSS_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHAVE_BSS_CODE() {
return haveBSSCODE;
}
/**
* Sets the value of the have_BSS_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHAVE_BSS_CODE(String value) {
this.haveBSSCODE = value;
}
/**
* Gets the value of the busi_FEE_IS_CLEAR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_FEE_IS_CLEAR() {
return busiFEEISCLEAR;
}
/**
* Sets the value of the busi_FEE_IS_CLEAR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_FEE_IS_CLEAR(String value) {
this.busiFEEISCLEAR = value;
}
/**
* Gets the value of the earnest_IS_CLEAR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEARNEST_IS_CLEAR() {
return earnestISCLEAR;
}
/**
* Sets the value of the earnest_IS_CLEAR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEARNEST_IS_CLEAR(String value) {
this.earnestISCLEAR = value;
}
/**
* Gets the value of the comm_IS_CLEAR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOMM_IS_CLEAR() {
return commISCLEAR;
}
/**
* Sets the value of the comm_IS_CLEAR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOMM_IS_CLEAR(String value) {
this.commISCLEAR = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FUNCINFO" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_FUNC_CTL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FUNC_CTL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FUNC_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"funcinfo"
})
public static class FUNCLIST {
@XmlElement(name = "FUNCINFO")
protected List<CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST.FUNCINFO> funcinfo;
/**
* Gets the value of the funcinfo property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the funcinfo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFUNCINFO().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST.FUNCINFO }
*
*
*/
public List<CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST.FUNCINFO> getFUNCINFO() {
if (funcinfo == null) {
funcinfo = new ArrayList<CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST.FUNCINFO>();
}
return this.funcinfo;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ORDER_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_FUNC_CTL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FUNC_CTL_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="FUNC_TYPE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="16"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderID",
"chnlID",
"chnlFUNCCTLID",
"funcCTLID",
"funcTYPE"
})
public static class FUNCINFO {
@XmlElement(name = "ORDER_ID", required = true)
protected String orderID;
@XmlElement(name = "CHNL_ID", required = true)
protected String chnlID;
@XmlElement(name = "CHNL_FUNC_CTL_ID")
protected String chnlFUNCCTLID;
@XmlElement(name = "FUNC_CTL_ID")
protected String funcCTLID;
@XmlElement(name = "FUNC_TYPE")
protected String funcTYPE;
/**
* Gets the value of the order_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORDER_ID() {
return orderID;
}
/**
* Sets the value of the order_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORDER_ID(String value) {
this.orderID = value;
}
/**
* Gets the value of the chnl_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_ID() {
return chnlID;
}
/**
* Sets the value of the chnl_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_ID(String value) {
this.chnlID = value;
}
/**
* Gets the value of the chnl_FUNC_CTL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_FUNC_CTL_ID() {
return chnlFUNCCTLID;
}
/**
* Sets the value of the chnl_FUNC_CTL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_FUNC_CTL_ID(String value) {
this.chnlFUNCCTLID = value;
}
/**
* Gets the value of the func_CTL_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFUNC_CTL_ID() {
return funcCTLID;
}
/**
* Sets the value of the func_CTL_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFUNC_CTL_ID(String value) {
this.funcCTLID = value;
}
/**
* Gets the value of the func_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFUNC_TYPE() {
return funcTYPE;
}
/**
* Sets the value of the func_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFUNC_TYPE(String value) {
this.funcTYPE = value;
}
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraID",
"paraVALUE"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraID;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>
package com.unicom.mss.sb_eas_eas_importamountinfosrv;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AMOUNT_LINE_INFOItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AMOUNT_LINE_INFOItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BATCH_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="HEADER_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="LINE_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BILL_NO" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="COST_CENTER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BUSI_SUB_TYPE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="CONTRACT_NUMBER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="VENDOR_NUMBER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="VENDOR_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="INI_PAY_AMOUNT" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="PAYER_BANK_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BANK_ACCOUNT_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BANK_ACCOUNT_NUM" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="SEGMENT3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PROPAY_NO" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="SEGMENT5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_6" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_7" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_8" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_9" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_10" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_11" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_12" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_13" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_14" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_15" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AMOUNT_LINE_INFOItem", propOrder = {
"priKEY",
"batchID",
"headerID",
"lineID",
"billNO",
"costCENTER",
"busiSUBTYPE",
"contractNUMBER",
"vendorNUMBER",
"vendorNAME",
"iniPAYAMOUNT",
"payerBANKNAME",
"bankACCOUNTNAME",
"bankACCOUNTNUM",
"segment3",
"propayNO",
"segment5",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5",
"reserved6",
"reserved7",
"reserved8",
"reserved9",
"reserved10",
"reserved11",
"reserved12",
"reserved13",
"reserved14",
"reserved15"
})
public class AMOUNT_LINE_INFOItem {
@XmlElement(name = "PRI_KEY", required = true, nillable = true)
protected String priKEY;
@XmlElement(name = "BATCH_ID", required = true, nillable = true)
protected String batchID;
@XmlElement(name = "HEADER_ID", required = true, nillable = true)
protected String headerID;
@XmlElement(name = "LINE_ID", required = true, nillable = true)
protected String lineID;
@XmlElement(name = "BILL_NO", required = true, nillable = true)
protected String billNO;
@XmlElement(name = "COST_CENTER", required = true, nillable = true)
protected String costCENTER;
@XmlElement(name = "BUSI_SUB_TYPE", required = true, nillable = true)
protected String busiSUBTYPE;
@XmlElement(name = "CONTRACT_NUMBER", required = true, nillable = true)
protected String contractNUMBER;
@XmlElement(name = "VENDOR_NUMBER", required = true, nillable = true)
protected String vendorNUMBER;
@XmlElement(name = "VENDOR_NAME", required = true, nillable = true)
protected String vendorNAME;
@XmlElement(name = "INI_PAY_AMOUNT", required = true, nillable = true)
protected BigDecimal iniPAYAMOUNT;
@XmlElement(name = "PAYER_BANK_NAME", required = true, nillable = true)
protected String payerBANKNAME;
@XmlElement(name = "BANK_ACCOUNT_NAME", required = true, nillable = true)
protected String bankACCOUNTNAME;
@XmlElement(name = "BANK_ACCOUNT_NUM", required = true, nillable = true)
protected String bankACCOUNTNUM;
@XmlElement(name = "SEGMENT3", required = true, nillable = true)
protected String segment3;
@XmlElement(name = "PROPAY_NO", required = true, nillable = true)
protected String propayNO;
@XmlElement(name = "SEGMENT5", required = true, nillable = true)
protected String segment5;
@XmlElement(name = "RESERVED_1", required = true, nillable = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true, nillable = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true, nillable = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true, nillable = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true, nillable = true)
protected String reserved5;
@XmlElement(name = "RESERVED_6", required = true, nillable = true)
protected String reserved6;
@XmlElement(name = "RESERVED_7", required = true, nillable = true)
protected String reserved7;
@XmlElement(name = "RESERVED_8", required = true, nillable = true)
protected String reserved8;
@XmlElement(name = "RESERVED_9", required = true, nillable = true)
protected String reserved9;
@XmlElement(name = "RESERVED_10", required = true, nillable = true)
protected String reserved10;
@XmlElement(name = "RESERVED_11", required = true, nillable = true)
protected String reserved11;
@XmlElement(name = "RESERVED_12", required = true, nillable = true)
protected String reserved12;
@XmlElement(name = "RESERVED_13", required = true, nillable = true)
protected String reserved13;
@XmlElement(name = "RESERVED_14", required = true, nillable = true)
protected String reserved14;
@XmlElement(name = "RESERVED_15", required = true, nillable = true)
protected String reserved15;
/**
* Gets the value of the pri_KEY property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRI_KEY() {
return priKEY;
}
/**
* Sets the value of the pri_KEY property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRI_KEY(String value) {
this.priKEY = value;
}
/**
* Gets the value of the batch_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_ID() {
return batchID;
}
/**
* Sets the value of the batch_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_ID(String value) {
this.batchID = value;
}
/**
* Gets the value of the header_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHEADER_ID() {
return headerID;
}
/**
* Sets the value of the header_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHEADER_ID(String value) {
this.headerID = value;
}
/**
* Gets the value of the line_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINE_ID() {
return lineID;
}
/**
* Sets the value of the line_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINE_ID(String value) {
this.lineID = value;
}
/**
* Gets the value of the bill_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBILL_NO() {
return billNO;
}
/**
* Sets the value of the bill_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBILL_NO(String value) {
this.billNO = value;
}
/**
* Gets the value of the cost_CENTER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCOST_CENTER() {
return costCENTER;
}
/**
* Sets the value of the cost_CENTER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCOST_CENTER(String value) {
this.costCENTER = value;
}
/**
* Gets the value of the busi_SUB_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBUSI_SUB_TYPE() {
return busiSUBTYPE;
}
/**
* Sets the value of the busi_SUB_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBUSI_SUB_TYPE(String value) {
this.busiSUBTYPE = value;
}
/**
* Gets the value of the contract_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTRACT_NUMBER() {
return contractNUMBER;
}
/**
* Sets the value of the contract_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTRACT_NUMBER(String value) {
this.contractNUMBER = value;
}
/**
* Gets the value of the vendor_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVENDOR_NUMBER() {
return vendorNUMBER;
}
/**
* Sets the value of the vendor_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVENDOR_NUMBER(String value) {
this.vendorNUMBER = value;
}
/**
* Gets the value of the vendor_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVENDOR_NAME() {
return vendorNAME;
}
/**
* Sets the value of the vendor_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVENDOR_NAME(String value) {
this.vendorNAME = value;
}
/**
* Gets the value of the ini_PAY_AMOUNT property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getINI_PAY_AMOUNT() {
return iniPAYAMOUNT;
}
/**
* Sets the value of the ini_PAY_AMOUNT property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setINI_PAY_AMOUNT(BigDecimal value) {
this.iniPAYAMOUNT = value;
}
/**
* Gets the value of the payer_BANK_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAYER_BANK_NAME() {
return payerBANKNAME;
}
/**
* Sets the value of the payer_BANK_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAYER_BANK_NAME(String value) {
this.payerBANKNAME = value;
}
/**
* Gets the value of the bank_ACCOUNT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCOUNT_NAME() {
return bankACCOUNTNAME;
}
/**
* Sets the value of the bank_ACCOUNT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCOUNT_NAME(String value) {
this.bankACCOUNTNAME = value;
}
/**
* Gets the value of the bank_ACCOUNT_NUM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCOUNT_NUM() {
return bankACCOUNTNUM;
}
/**
* Sets the value of the bank_ACCOUNT_NUM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCOUNT_NUM(String value) {
this.bankACCOUNTNUM = value;
}
/**
* Gets the value of the segment3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSEGMENT3() {
return segment3;
}
/**
* Sets the value of the segment3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSEGMENT3(String value) {
this.segment3 = value;
}
/**
* Gets the value of the propay_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROPAY_NO() {
return propayNO;
}
/**
* Sets the value of the propay_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROPAY_NO(String value) {
this.propayNO = value;
}
/**
* Gets the value of the segment5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSEGMENT5() {
return segment5;
}
/**
* Sets the value of the segment5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSEGMENT5(String value) {
this.segment5 = value;
}
/**
* Gets the value of the reserved_1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_1() {
return reserved1;
}
/**
* Sets the value of the reserved_1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_1(String value) {
this.reserved1 = value;
}
/**
* Gets the value of the reserved_2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_2() {
return reserved2;
}
/**
* Sets the value of the reserved_2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_2(String value) {
this.reserved2 = value;
}
/**
* Gets the value of the reserved_3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_3() {
return reserved3;
}
/**
* Sets the value of the reserved_3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_3(String value) {
this.reserved3 = value;
}
/**
* Gets the value of the reserved_4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_4() {
return reserved4;
}
/**
* Sets the value of the reserved_4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_4(String value) {
this.reserved4 = value;
}
/**
* Gets the value of the reserved_5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_5() {
return reserved5;
}
/**
* Sets the value of the reserved_5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_5(String value) {
this.reserved5 = value;
}
/**
* Gets the value of the reserved_6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_6() {
return reserved6;
}
/**
* Sets the value of the reserved_6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_6(String value) {
this.reserved6 = value;
}
/**
* Gets the value of the reserved_7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_7() {
return reserved7;
}
/**
* Sets the value of the reserved_7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_7(String value) {
this.reserved7 = value;
}
/**
* Gets the value of the reserved_8 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_8() {
return reserved8;
}
/**
* Sets the value of the reserved_8 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_8(String value) {
this.reserved8 = value;
}
/**
* Gets the value of the reserved_9 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_9() {
return reserved9;
}
/**
* Sets the value of the reserved_9 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_9(String value) {
this.reserved9 = value;
}
/**
* Gets the value of the reserved_10 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_10() {
return reserved10;
}
/**
* Sets the value of the reserved_10 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_10(String value) {
this.reserved10 = value;
}
/**
* Gets the value of the reserved_11 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_11() {
return reserved11;
}
/**
* Sets the value of the reserved_11 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_11(String value) {
this.reserved11 = value;
}
/**
* Gets the value of the reserved_12 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_12() {
return reserved12;
}
/**
* Sets the value of the reserved_12 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_12(String value) {
this.reserved12 = value;
}
/**
* Gets the value of the reserved_13 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_13() {
return reserved13;
}
/**
* Sets the value of the reserved_13 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_13(String value) {
this.reserved13 = value;
}
/**
* Gets the value of the reserved_14 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_14() {
return reserved14;
}
/**
* Sets the value of the reserved_14 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_14(String value) {
this.reserved14 = value;
}
/**
* Gets the value of the reserved_15 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_15() {
return reserved15;
}
/**
* Sets the value of the reserved_15 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_15(String value) {
this.reserved15 = value;
}
}
<file_sep>package com.ai.uchintService.client.bsdmChnlFile;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdom.Element;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IDownBsdmChnlFileBusiSV;
import com.ai.uint.ftp.interfaces.IDownFileSV;
import com.ai.uint.ftp.util.FtpConfFileUtil;
import com.ai.uint.util.UIFException;
import com.ai.uint.daemonTimer.util.Constants;
import com.ai.uint.ejb.util.CommonUtil;
import com.ai.uint.paramsMang.util.ParamsMang;
import com.ai.uip.core.bo.UipFtpDefBean;
import com.ai.uip.core.util.FtpUtil;
import com.ailk.uchannel.datasyncfile.interfaces.IDataSyncFileRemoteSV;
import com.ailk.uchannel.datasyncfile.param.DatafileRequestVo;
import com.ailk.uchannel.datasyncfile.param.DatafileResponseVo;
import com.ailk.uchannel.datasyncfile.param.DatafileVO;
public class DownBsdmChnlFileSVImpl implements IDownFileSV {
private String downLoadNo;
private String timerCode;
private String logId;
private String ejbSvDef;
private String chnlWebFtpDef;
private String fileType;
private String provinceCode;
private static final Log logger = LogFactory.getLog(DownBsdmChnlFileSVImpl.class);
public DownBsdmChnlFileSVImpl() {
}
private IDownBsdmChnlFileBusiSV getService() {
return (IDownBsdmChnlFileBusiSV)ServiceFactory.getService(IDownBsdmChnlFileBusiSV.class);
}
@Override
public Map<String, Object> preProcess(List<String> fileNameList) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
CenterFactory.pushCenterInfo(com.ai.uchintService.common.util.Constants.DATASOURCE_CENTER, "01");
return getService().preProcess(fileNameList, logId);
} catch(Exception e) {
e.printStackTrace();
resultMap.clear();
resultMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "设置多数据中心错误:"+e.getMessage());
return resultMap;
}
}
@Override
public Map<String, Object> process(List<String> fileNameList) {
Map<String, Object> resultMap = new HashMap<String, Object>();
if (fileNameList == null || fileNameList.size() == 0) {
resultMap.clear();
resultMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "传入待处理文件个数为0");
return resultMap;
}
//上传到渠道前台,调用渠道前台处理
try {
UipFtpDefBean putFtpDefBean = ParamsMang.getUipFtpDef(chnlWebFtpDef);
if (putFtpDefBean == null) throw new Exception("没有配置ftp_code为"+chnlWebFtpDef+"的数据");
//放到前台的主机上
//ftp://tstsdm01:cgdjcccgdlgehahhhj@172.16.17.32/data/tstsdm01/uploadfile
String putFtpStr = "ftp://"+putFtpDefBean.getUserId()+":"+putFtpDefBean.getUserPwd()+"@"+putFtpDefBean.getHostAddr()+putFtpDefBean.getHostDir();
logger.info("putFtpStr:"+putFtpStr);
//传入渠道前台的采纳数
String[] putFilePaths = new String[2];
for(int i=0;i<fileNameList.size();i++) {
if (!FtpUtil.uploadFile(putFtpStr, fileNameList.get(i))) {
throw new Exception("上传文件失败");
}
String putFilePath = putFtpDefBean.getInitDir()+File.separator + putFtpDefBean.getHostDir()+File.separator + fileNameList.get(i).substring(fileNameList.get(i).lastIndexOf(File.separator)+1);
logger.info("putFilePath:"+putFilePath);
putFilePaths[i] = putFilePath;
}
//调用前台ejb服务
IDataSyncFileRemoteSV ejbProcesser = (IDataSyncFileRemoteSV)CommonUtil.getEjbsv(ejbSvDef);
DatafileRequestVo reqVo = new DatafileRequestVo();
DatafileVO dataFileVo = new DatafileVO();
dataFileVo.setFilePaths(putFilePaths);
dataFileVo.setFileType(fileType);
logger.info("fileType:"+fileType);
logger.info("putFilePaths.length:"+putFilePaths.length);
for(int ti=0;ti<putFilePaths.length;ti++) {
logger.info(putFilePaths[ti]);
}
reqVo.setProvinceCode(provinceCode);
reqVo.setPrecheckNO("0");
reqVo.setDatafileVO(dataFileVo);
if (ejbProcesser != null) {
DatafileResponseVo respVo = ejbProcesser.execute(reqVo);
if (respVo == null || !respVo.getResultCode().equals(DatafileResponseVo.SUCCESS)) {
throw new Exception("前台服务返回结果失败:"+respVo.getResultDesc());
}
} else {
throw new Exception("无法获取前台服务");
}
} catch(Exception e) {
e.printStackTrace();
resultMap.clear();
resultMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "处理错误:"+e.getMessage());
return resultMap;
}
resultMap.clear();
resultMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "处理完成");
resultMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, null);
return resultMap;
}
@Override
public List<List<String>> getDownloadFiles(List<String> fileNameList) {
try {
CenterFactory.pushCenterInfo(com.ai.uchintService.common.util.Constants.DATASOURCE_CENTER, "01");
return getService().getDownloadFiles(fileNameList,timerCode);
} catch(Exception e){
e.printStackTrace();
return new ArrayList<List<String>>();
}
}
@Override
public void init(String timerCode, String downLoadNo, String logId) throws UIFException{
this.downLoadNo = downLoadNo;
this.timerCode = timerCode;
this.logId = logId;
Element element = FtpConfFileUtil.getDownLoadConfElement(downLoadNo);
if (element != null) {
//加载配置
if (element.getChild("ejbSvDef") != null) {
ejbSvDef = element.getChild("ejbSvDef").getValue().trim();
}
if (element.getChild("chnlWebFtpDef") != null) {
chnlWebFtpDef = element.getChild("chnlWebFtpDef").getValue().trim();
}
if (element.getChild("fileType") != null) {
fileType = element.getChild("fileType").getValue().trim();
}
if (element.getChild("provinceCode") != null) {
provinceCode = element.getChild("provinceCode").getValue().trim();
}
} else {
throw new UIFException("downLoadNo["+downLoadNo+"]未配置");
}
}
public static void main(String argv[]) {
try {
Pattern pattern = Pattern.compile("BSDM_(CHNL|DEPR)_(\\d{8})_(\\d{3})_[AB].(TXT|txt)",Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher("BSDM_CHNL_20130410_001_A.TXT");
if (matcher.matches()) {
logger.info("true");
} else {
logger.info("false");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface ITF_QZ_JY_WEValue extends DataStructInterface{
public final static String S_OrderStatus = "ORDER_STATUS";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_OrderTime = "ORDER_TIME";
public final static String S_Reserved2 = "RESERVED2";
public final static String S_Reserved1 = "RESERVED1";
public final static String S_ShopId = "SHOP_ID";
public final static String S_LocalFlag = "LOCAL_FLAG";
public final static String S_PaidFee = "PAID_FEE";
public final static String S_PayTime = "PAY_TIME";
public final static String S_ProxyShopName = "PROXY_SHOP_NAME";
public final static String S_ReturnId = "RETURN_ID";
public final static String S_GdsList = "GDS_LIST";
public final static String S_OrderId = "ORDER_ID";
public final static String S_PayType = "PAY_TYPE";
public final static String S_ProxyShopId = "PROXY_SHOP_ID";
public final static String S_ShopName = "SHOP_NAME";
public final static String S_ReturnList = "RETURN_LIST";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public String getOrderStatus();
public Timestamp getCreateTime();
public String getChnlCode();
public String getOrderTime();
public String getReserved2();
public String getReserved1();
public String getShopId();
public String getLocalFlag();
public String getPaidFee();
public String getPayTime();
public String getProxyShopName();
public String getReturnId();
public String getGdsList();
public String getOrderId();
public String getPayType();
public String getProxyShopId();
public String getShopName();
public String getReturnList();
public String getProvinceCode();
public void setOrderStatus(String value);
public void setCreateTime(Timestamp value);
public void setChnlCode(String value);
public void setOrderTime(String value);
public void setReserved2(String value);
public void setReserved1(String value);
public void setShopId(String value);
public void setLocalFlag(String value);
public void setPaidFee(String value);
public void setPayTime(String value);
public void setProxyShopName(String value);
public void setReturnId(String value);
public void setGdsList(String value);
public void setOrderId(String value);
public void setPayType(String value);
public void setProxyShopId(String value);
public void setShopName(String value);
public void setReturnList(String value);
public void setProvinceCode(String value);
}
<file_sep>package com.ai.uchintService.ejb.VO.precheckResult;
import java.io.Serializable;
import java.util.List;
import cn.chinaunicom.ws.precheckresultser.unibssbody.precheckresultreq.PRECHECK_RESULT_REQ;
public class PrecheckResultReqVO implements Serializable {
private static final long serialVersionUID = 1L;
protected String operID;
protected String precheckNO;
protected String resultCODE;
protected String resultDESC;
protected List<PRECHECK_RESULT_REQ.PARA> para;
public static class PARA {
protected String paraID;
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
public String getPrecheckNO() {
return precheckNO;
}
public void setPrecheckNO(String precheckNO) {
this.precheckNO = precheckNO;
}
public String getResultCODE() {
return resultCODE;
}
public void setResultCODE(String resultCODE) {
this.resultCODE = resultCODE;
}
public String getResultDESC() {
return resultDESC;
}
public void setResultDESC(String resultDESC) {
this.resultDESC = resultDESC;
}
public List<PRECHECK_RESULT_REQ.PARA> getPara() {
return para;
}
public void setPara(List<PRECHECK_RESULT_REQ.PARA> para) {
this.para = para;
}
public String getOperID() {
return operID;
}
public void setOperID(String operID) {
this.operID = operID;
}
}
<file_sep>package cn.chinaunicom.ws.agencysignqueryser;
import java.util.logging.Logger;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV;
@javax.jws.WebService(serviceName = "AgencySignQuerySerService",
portName = "AgencySignQuerySerPort",
targetNamespace = "http://ws.chinaunicom.cn/AgencySignQuerySer",
//wsdlLocation = "classpath:wsdl/AgencySignQuerySer/AgencySignQuerySer.wsdl",
endpointInterface = "cn.chinaunicom.ws.agencysignqueryser.AgencySignQuerySer")
public class AgencySignQuerySerImpl implements AgencySignQuerySer {
private static final Logger LOG = Logger
.getLogger(AgencySignQuerySerImpl.class.getName());
@Override
public AgencyQueryByAgreementResponse agencyQueryByAgreementTade(
AgencyQueryByAgreementRequest parameters) {
LOG.info("Executing operation process");
System.out.println(parameters);
try {
IPenetrationIfProcessorSRV penetrationIfProcessorSRV = (IPenetrationIfProcessorSRV) ServiceFactory
.getService("com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV");
Object obj = penetrationIfProcessorSRV.ifMsgProcessorForService(
Constants.Agent.AGENCY_SIGN_QUERY_SER, parameters);
return (AgencyQueryByAgreementResponse) obj;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv;
import java.util.HashMap;
import java.util.logging.Logger;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.recif.IRecIfProcessorSRV;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-10-10T11:20:17.944+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "SB_UC_UC_ImportCnapsCodeInfoSrv",
portName = "SB_UC_UC_ImportCnapsCodeInfoSrvPort",
targetNamespace = "http://mss.unicom.com/SB_UC_UC_ImportCnapsCodeInfoSrv",
// wsdlLocation = "file:/F:/pro/uip(qudao)/wsdl/SB_UC_UC_ImportCnapsCodeInfoSrv/SB_UC_UC_ImportCnapsCodeInfoSrv.wsdl",
wsdlLocation = "classpath:wsdl/SB_UC_UC_ImportCnapsCodeInfoSrv/SB_UC_UC_ImportCnapsCodeInfoSrv.wsdl",
endpointInterface = "com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SBUCUCImportCnapsCodeInfoSrv")
public class SBUCUCImportCnapsCodeInfoSrvImpl implements SBUCUCImportCnapsCodeInfoSrv {
private static final Logger LOG = Logger.getLogger(SBUCUCImportCnapsCodeInfoSrvImpl.class.getName());
/* (non-Javadoc)
* @see com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SBUCUCImportCnapsCodeInfoSrv#process(com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvRequest payload )*
*/
public com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvResponse process(SB_UC_UC_ImportCnapsCodeInfoSrvRequest payload) {
LOG.info("Executing operation process");
System.out.println(payload);
try {
IRecIfProcessorSRV recIfProcessorSRV=(IRecIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.SB_UC_UC_ImportCnapsCodeInfoSrv, payload);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv.SB_UC_UC_ImportCnapsCodeInfoSrvResponse _return = (SB_UC_UC_ImportCnapsCodeInfoSrvResponse)map.get(Constants.MapResult.MAP_RESULTOBJ);
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.ftpFile.timer;
import java.sql.Time;
import com.ai.uip.core.bo.UipOperateBean;
/**
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Nov 1, 2011
*/
public class ErpTimer {
public static void main(String[] args) throws Exception{
TimerUtil timer = new TimerUtil();
UipOperateBean oper1 = new UipOperateBean();
oper1.setSubjectId(101);
UipOperateBean oper2 = new UipOperateBean();
oper2.setSubjectId(102);
timer.schedule(1000*3, "com.ai.uchintService.ftpFile.timer.Job1", "test1",oper1,"2011-12-20 22:45:00",1);
timer.schedule(1000*5, "com.ai.uchintService.ftpFile.timer.Job2", "test2",oper2,"2011-12-20 22:44:20",1);
}
}
class Job1 {
public void test1(UipOperateBean oper,String month) {
System.out.println("-------"+month+"--------");
System.out.println("Job1--------"+new Time(System.currentTimeMillis())+" "+oper.getSubjectId());
}
}
class Job2 {
public void test2(UipOperateBean oper,String month) {
System.out.println("-------"+month+"--------");
System.out.println("Job2==="+new Time(System.currentTimeMillis())+" "+oper.getSubjectId());
}
}<file_sep>package com.ai.uchintService.ejb.paramImpl.chnlRelChnlChgResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.uint.ejb.interfaces.IEjbSrvBusiServiceSV;
import com.ai.uint.ejb.util.CommonUtil;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ejb.vo.CommonEjbSVRequestVO;
import com.ailk.uchannel.service.relchnlchgresult.param.TfRelChnlChgResultRequestVo;
import com.ailk.uchannel.service.relchnlchgresult.param.TfRelChnlChgResultResponseVo;
public class ChnlRelChnlChgResultImpl implements IEjbSrvBusiServiceSV {
private static final Log logger = LogFactory.getLog(ChnlRelChnlChgResultImpl.class);
@Override
public Map execute(List<Object> inputParamList) {
Map retMap = new HashMap();
if (inputParamList == null || inputParamList.size() != 1) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "入参错误");
}
try {
CommonEjbSVRequestVO requestVO = (CommonEjbSVRequestVO)inputParamList.get(0);
TfRelChnlChgResultRequestVo inputVO = (TfRelChnlChgResultRequestVo)requestVO.getInputBusiParam();
//调用系统,B-接口
retMap.put(Constants.SrvReceiveMap.SYSTEM_ID, "9102");
//业务流水
retMap.put(Constants.SrvReceiveMap.SERVICE_NO, inputVO.getOrderId());
//业务编码
retMap.put(Constants.SrvReceiveMap.BUSI_DATA_ID, inputVO.getResultCode());
//请求数据条数
retMap.put(Constants.SrvReceiveMap.REQ_DATA_CNT, 1);
//UCHL订单数据同步回单服务请求,调用UCHL前台ejb服务
try {
com.ailk.uchannel.service.relchnlchgresult.interfaces.IChnlRelChnlChgResultRemoteSV ejbProcessor = (com.ailk.uchannel.service.relchnlchgresult.interfaces.IChnlRelChnlChgResultRemoteSV)CommonUtil.getEjbsv(requestVO.getEjbSVProviderCode());
if (ejbProcessor != null) {
TfRelChnlChgResultResponseVo outputBusiParam = ejbProcessor.execute(inputVO);
logger.info("outputBusiParam:"+outputBusiParam);
if (outputBusiParam == null) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "调用EJB服务(" + requestVO.getEjbSVProviderCode() +")返回参数为空.");
//处理成功条数
retMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 0);
//处理失败条数
retMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 1);
} else {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "调用EJB服务(" + requestVO.getEjbSVProviderCode() +")成功.");
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, outputBusiParam);
//处理成功条数
retMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 1);
//处理失败条数
retMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 0);
}
} else {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "lookup EJB服务(" + requestVO.getEjbSVProviderCode() + ")为空");
//处理成功条数
retMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 0);
//处理失败条数
retMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 1);
}
} catch(Exception el) {
el.printStackTrace();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "调用EJB服务(" + requestVO.getEjbSVProviderCode() + ")失败:["+el.getMessage()+"]");
//处理成功条数
retMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 0);
//处理失败条数
retMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 1);
}
} catch(Exception e) {
e.printStackTrace();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "转换参数失败:["+e.getMessage()+"]");
//处理成功条数
retMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 0);
//处理失败条数
retMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 1);
}
return retMap;
}
@Override
public Object getOkObject() {
//UCHL订单数据同步回单服务请求,调用UCHL前台ejb服务
TfRelChnlChgResultResponseVo outputBusiParam = new TfRelChnlChgResultResponseVo();
outputBusiParam.setResultCode(TfRelChnlChgResultResponseVo.SUCCESS);
outputBusiParam.setResultDesc("异步调用成功");
return outputBusiParam;
}
}
<file_sep>
package com.ai.uchintService.ejb.VO.DeparementInfo;
import java.util.ArrayList;
import java.util.List;
import com.ai.uchintService.ejb.VO.GenericVO;
public class DeparementInfoPrecheckRspVO extends GenericVO{
protected String respCODE;
protected String respDESC;
protected String departCODE;
protected List<DeparementInfoPrecheckRspVO.PARA> para;
/**
* Gets the value of the resp_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESP_CODE() {
return respCODE;
}
/**
* Sets the value of the resp_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESP_CODE(String value) {
this.respCODE = value;
}
/**
* Gets the value of the resp_DESC property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESP_DESC() {
return respDESC;
}
/**
* Sets the value of the resp_DESC property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESP_DESC(String value) {
this.respDESC = value;
}
/**
* Gets the value of the depart_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_CODE() {
return departCODE;
}
/**
* Sets the value of the depart_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_CODE(String value) {
this.departCODE = value;
}
public List<DeparementInfoPrecheckRspVO.PARA> getPARA() {
if (para == null) {
para = new ArrayList<DeparementInfoPrecheckRspVO.PARA>();
}
return this.para;
}
public static class PARA {
protected String paraID;
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>package com.ai.uchintService.ejb.paramImpl.precheckResult;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.ai.uchintService.ejb.VO.precheckResult.PrecheckResultReqVO;
import com.ai.uchintService.ejb.VO.precheckResult.PrecheckResultRspVO;
import com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote;
import com.ai.uint.ejb.vo.PrechekRequestVO;
import com.ai.uint.ejb.vo.PrecheckResponseVO;
/**
* @user: Administrator
* @author: 游刚
* @version:1.0
* @created:Apr 28, 2012
*/
public class PrecheckResultParamImplTst {
public static void main(String[] args) {
/*
System.out.println("===========ejb===========");
UipEjbSVRemote ejbSer = (UipEjbSVRemote)EjbJndiUtil.lookup();
RequestVO inputParam = new RequestVO();
inputParam.setSubjectId(2210);
inputParam.setProvinceCode("36");
PrecheckResultReqVO prrVo = new PrecheckResultReqVO();
prrVo.setPrecheckNO("111");
prrVo.setResultCODE("0000");
prrVo.setResultDESC("预判成功!!!");
inputParam.setInputBusiParam(prrVo);
ResponseVO out = ejbSer.process(inputParam);
System.out.println("out.getRespCode():===="+out.getRespCode());
System.out.println("out.getRespDesc()===="+out.getRespDesc());
PrecheckResultRspVO rspVo = (PrecheckResultRspVO)out.getOutputBusiParam();
System.out.println(rspVo.getRespCODE());
System.out.println(rspVo.getRespDESC());
*/
System.out.println("about to create initialcontext!");
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://localhost:7001");
try
{
String ejbName = "UipEjbSVBean#com.ai.uip.ejb.interfaces.UipEjbSVRemote";
Context ctx = new InitialContext(env);
System.out.println("Got initial context … yeah");
UipUchlEjbSVRemote ejbProcessor = (UipUchlEjbSVRemote) ctx.lookup(ejbName);
ejbProcessor.refreshConfParam();
PrechekRequestVO inputParam = new PrechekRequestVO();
inputParam.setSubjectId(2210);
inputParam.setProvinceCode("36");
PrecheckResultReqVO prrVo = new PrecheckResultReqVO();
prrVo.setPrecheckNO("111");
prrVo.setResultCODE("0000");
prrVo.setResultDESC("预判成功!!!");
inputParam.setInputBusiParam(prrVo);
PrecheckResponseVO out = ejbProcessor.process(inputParam);
System.out.println("out.getRespCode():===="+out.getRespCode());
System.out.println("out.getRespDesc()===="+out.getRespDesc());
PrecheckResultRspVO rspVo = (PrecheckResultRspVO)out.getOutputBusiParam();
System.out.println(rspVo.getRespCODE());
System.out.println(rspVo.getRespDESC());
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.print("end");
}
}
<file_sep>package com.ai.uchintService.ftpFile;
import java.util.HashMap;
import java.util.Map;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IInquiryUCInputVATMatchInfoSV;
import com.ai.uint.daemonTimer.interfaces.ITimerProcessSV;
import com.ai.uint.daemonTimer.util.Constants;
public class RMSReduceTime implements ITimerProcessSV{
@Override
public Map process(String arg0, String arg1, String arg2) {
Map retMap = new HashMap();
String param = arg1;
if (param == null || "".equals(param) ) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, "入参:["+arg1+"]格式错误:subject_id");
return retMap;
}
try {
int intParam = Integer.parseInt(param);
CenterFactory.pushCenterInfo("qudao", "01");
getServie().insertRecord(intParam, "0", 0, "09", "04");
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, "ok");
} catch (Exception e) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, "ERROR:"+e.getMessage());
return retMap;
}
return retMap;
}
public static void main(String[] args) {
RMSReduceTime timer = new RMSReduceTime();
timer.process("", "153", "");
}
private static IInquiryUCInputVATMatchInfoSV getServie() {
return (IInquiryUCInputVATMatchInfoSV)ServiceFactory.getService(IInquiryUCInputVATMatchInfoSV.class);
}
}
<file_sep>
package cn.chinaunicom.ws.channelinfoprecheckser.unibssbody;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.channelinfoprecheckrsp.CHANNEL_INFO_PRECHECK_RSP;
import cn.chinaunicom.ws.unibssattached.UNI_BSS_ATTACHED;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/unibssHead}UNI_BSS_HEAD"/>
* <element name="UNI_BSS_BODY" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/ChannelInfoPreCheckSer/unibssBody/channelInfoPreCheckRsp}CHANNEL_INFO_PRECHECK_RSP"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element ref="{http://ws.chinaunicom.cn/unibssAttached}UNI_BSS_ATTACHED" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"uniBSSHEAD",
"uniBSSBODY",
"uniBSSATTACHED"
})
@XmlRootElement(name = "CHANNEL_INFO_PRECHECK_OUTPUT")
public class CHANNEL_INFO_PRECHECK_OUTPUT {
@XmlElement(name = "UNI_BSS_HEAD", namespace = "http://ws.chinaunicom.cn/unibssHead", required = true)
protected UNI_BSS_HEAD uniBSSHEAD;
@XmlElement(name = "UNI_BSS_BODY")
protected CHANNEL_INFO_PRECHECK_OUTPUT.UNI_BSS_BODY uniBSSBODY;
@XmlElement(name = "UNI_BSS_ATTACHED", namespace = "http://ws.chinaunicom.cn/unibssAttached")
protected UNI_BSS_ATTACHED uniBSSATTACHED;
/**
* Gets the value of the uni_BSS_HEAD property.
*
* @return
* possible object is
* {@link UNI_BSS_HEAD }
*
*/
public UNI_BSS_HEAD getUNI_BSS_HEAD() {
return uniBSSHEAD;
}
/**
* Sets the value of the uni_BSS_HEAD property.
*
* @param value
* allowed object is
* {@link UNI_BSS_HEAD }
*
*/
public void setUNI_BSS_HEAD(UNI_BSS_HEAD value) {
this.uniBSSHEAD = value;
}
/**
* Gets the value of the uni_BSS_BODY property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_PRECHECK_OUTPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_PRECHECK_OUTPUT.UNI_BSS_BODY getUNI_BSS_BODY() {
return uniBSSBODY;
}
/**
* Sets the value of the uni_BSS_BODY property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_PRECHECK_OUTPUT.UNI_BSS_BODY }
*
*/
public void setUNI_BSS_BODY(CHANNEL_INFO_PRECHECK_OUTPUT.UNI_BSS_BODY value) {
this.uniBSSBODY = value;
}
/**
* Gets the value of the uni_BSS_ATTACHED property.
*
* @return
* possible object is
* {@link UNI_BSS_ATTACHED }
*
*/
public UNI_BSS_ATTACHED getUNI_BSS_ATTACHED() {
return uniBSSATTACHED;
}
/**
* Sets the value of the uni_BSS_ATTACHED property.
*
* @param value
* allowed object is
* {@link UNI_BSS_ATTACHED }
*
*/
public void setUNI_BSS_ATTACHED(UNI_BSS_ATTACHED value) {
this.uniBSSATTACHED = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/ChannelInfoPreCheckSer/unibssBody/channelInfoPreCheckRsp}CHANNEL_INFO_PRECHECK_RSP"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"channelINFOPRECHECKRSP"
})
public static class UNI_BSS_BODY {
@XmlElement(name = "CHANNEL_INFO_PRECHECK_RSP", namespace = "http://ws.chinaunicom.cn/ChannelInfoPreCheckSer/unibssBody/channelInfoPreCheckRsp", required = true)
protected CHANNEL_INFO_PRECHECK_RSP channelINFOPRECHECKRSP;
/**
* Gets the value of the channel_INFO_PRECHECK_RSP property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_PRECHECK_RSP }
*
*/
public CHANNEL_INFO_PRECHECK_RSP getCHANNEL_INFO_PRECHECK_RSP() {
return channelINFOPRECHECKRSP;
}
/**
* Sets the value of the channel_INFO_PRECHECK_RSP property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_PRECHECK_RSP }
*
*/
public void setCHANNEL_INFO_PRECHECK_RSP(CHANNEL_INFO_PRECHECK_RSP value) {
this.channelINFOPRECHECKRSP = value;
}
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrvIN;
import com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrvOUT;
public interface IInquiryChannelInfoSrv {
public InquiryChannelInfoSrvOUT inquiryChannelInfo(InquiryChannelInfoSrvIN inputItem) throws Exception;
}
<file_sep>package com.ai.uchintService.ftpFile.agent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IAgentStateSyncFullSV;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IPublishIfBase;
import com.ai.uip.platform.vo.PublishIfCfgVo;
public class agentStateSync implements IPublishIfBase{
private static final Log logger = LogFactory.getLog(agentStateSync.class);
@Override
public HashMap<String, Object> pubIfParamGen(List<String> contentIdLst,
PublishIfCfgVo ifVo, Long logId, String syncType,
HashMap<String, Long> batchMap) {
HashMap<String, Object> obj = new HashMap<String,Object>();
logger.info("==============开始生成发送的数据(代理商全量对账)================");
String fileName="";
try {
obj.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
obj.put(Constants.MapResult.MAP_RESULTMSG, "同步处理成功");
for (int i=0; i<contentIdLst.size(); i++){
String provinceCode =contentIdLst.get(i);
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER, "99");
fileName =getServie() .getLockFileForProvince(ifVo, provinceCode);
}
obj.put(Constants.MapResult.MAP_RESULTOBJ, fileName);
}catch(Exception e){
obj.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
obj.put(Constants.MapResult.MAP_RESULTMSG, "生成数据错误"+e.getMessage());
obj.put(Constants.MapResult.MAP_RESULTOBJ, null);
return obj;
}
return obj;
}
private static IAgentStateSyncFullSV getServie() {
return (IAgentStateSyncFullSV)ServiceFactory.getService(IAgentStateSyncFullSV.class);
}
@Override
public boolean pubIfRetErrorMax(String contentId) {
// TODO Auto-generated method stub
return false;
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg,
PublishIfCfgVo ifVo, Long logId, List<String> contentIdLst,
HashMap<String, Long> batchMap) {
// TODO Auto-generated method stub
return null;
}
@Override
public HashMap<String, Object> pubIfServiceAdapter(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
// TODO Auto-generated method stub
return null;
}
@Override
public HashMap<String, Object> pubIfServiceContinue(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
// TODO Auto-generated method stub
return null;
}
public static void main(String[] ags ){
PublishIfCfgVo vo =new PublishIfCfgVo();
agentStateSync aa=new agentStateSync();
List ll = new ArrayList<String>();
ll.add("36");
UipOperateBean operBean;
try {
operBean = new UipOperateBean();
operBean.setFileBackupPath("d:\\qudao");
vo.setOperBean(operBean);
aa.pubIfParamGen(ll, vo, null, null, null);
} catch (AIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
<file_sep>
package com.unicom.mss.sb_eip_eip_importpartnerinfosrv;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PARTNER_FILE_INFO complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PARTNER_FILE_INFO">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARTNER_FILE_INFOItem" type="{http://mss.unicom.com/SB_EIP_EIP_ImportPartnerInfoSrv}PARTNER_FILE_INFOItem" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PARTNER_FILE_INFO", propOrder = {
"partnerFILEINFOItem"
})
public class PARTNER_FILE_INFO {
@XmlElement(name = "PARTNER_FILE_INFOItem")
protected List<PARTNER_FILE_INFOItem> partnerFILEINFOItem;
/**
* Gets the value of the partnerFILEINFOItem property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the partnerFILEINFOItem property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARTNER_FILE_INFOItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PARTNER_FILE_INFOItem }
*
*
*/
public List<PARTNER_FILE_INFOItem> getPARTNER_FILE_INFOItem() {
if (partnerFILEINFOItem == null) {
partnerFILEINFOItem = new ArrayList<PARTNER_FILE_INFOItem>();
}
return this.partnerFILEINFOItem;
}
}
<file_sep>package com.ai.uchintService.ejb.paramImpl.demo;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.multicenter.ICenterInfo;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uchintService.ejb.VO.precheckResult.PrecheckResultReqVO;
import com.ai.uchintService.ejb.srv.impl.UipUchlChnlPrecheckTaskFinshSVBean;
import com.ai.uchintService.ejb.srv.interfaces.UipUchlChannelReceiveSVRemote;
import com.ai.uchintService.ejb.srv.interfaces.UipUchlChnlPrecheckTaskFinshSVRemote;
import com.ai.uchintService.ejb.srv.interfaces.UipUchlWaitPrevActionSVRemote;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.core.bo.UipSyncRecordEngine;
import com.ai.bsdmService.ejb.srv.interfaces.UipBsdmChnlPrecheckTaskFinshSVRemote;
import com.ai.bsdmService.ejb.srv.interfaces.UipBsdmEjbSVRemote;
import com.ai.uint.ejb.util.CommonUtil;
import com.ai.uint.ejb.vo.CommonEjbSVRequestVO;
import com.ai.uint.ejb.vo.CommonEjbSVResponseVO;
import com.ai.uint.ejb.vo.PassEjbSVRequestVO;
import com.ai.uint.ejb.vo.PassEjbSVResponseVO;
import com.ai.uint.ejb.vo.PrechekRequestVO;
import com.ai.uint.ejb.vo.PrecheckResponseVO;
import com.ailk.bsdm.channelreceive.param.ChannelReceiveInputVo;
import com.ailk.bsdm.channelreceive.param.ChannelReceiveOutputVo;
import com.ailk.bsdm.channelupdate.param.ChannelInfoVo;
import com.ailk.bsdm.channelupdate.param.ChannelUpdateInputVo;
import com.ailk.bsdm.channelupdate.param.ChannelUpdateOutputVo;
import com.ailk.bsdm.chnlprechecktaskfinish.param.ChnlPrecheckTaskFinshInputVo;
import com.ailk.bsdm.chnlprechecktaskfinish.param.ChnlPrecheckTaskFinshOutputVo;
import com.ailk.uchannel.datasyncarea.interfaces.IDataSyncAreaRemoteSV;
import com.ailk.uchannel.datasyncarea.param.TdMAreaRequestVo;
import com.ailk.uchannel.datasyncarea.param.TdMAreaResponseVo;
import com.ailk.uchannel.service.relchnlchgresult.param.TfRelChnlChgResultRequestVo;
import com.ailk.uchannel.service.relchnlchgresult.param.TfRelChnlChgResultResponseVo;
import com.ailk.uchannel.service.waitprevaction.param.TfWaitPrevActionRequestVo;
import com.ailk.uchannel.service.waitprevaction.param.TfWaitPrevActionResponseVo;
public class DemoTst {
private static void callBesChnlInfoChgCancelNotify() throws Exception {
//CHNL_INFO_CHG_CANCEL_NOTIFY
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
env.put("java.naming.provider.url","sparkHTTP://192.168.3.11:14836");
env.put("com.bes.jndi.spark.checktime","30000");
Context ctx = new InitialContext(env);
System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbb");
com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote ejbProcessor = (com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote)ctx.lookup("UipUchlEjbSVBean#com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote");
System.out.println("cccccccccccccccccccc");
PassEjbSVRequestVO passInputVo = new PassEjbSVRequestVO();
passInputVo.setEjbSVProviderCode("CHNL_INFO_CHG_CANCEL_NOTIFY");
com.ailk.bsdm.chnlprechecktaskfinish.param.ChnlPrecheckTaskFinshInputVo inputVo = new com.ailk.bsdm.chnlprechecktaskfinish.param.ChnlPrecheckTaskFinshInputVo();
inputVo.setActionCode("R");
inputVo.setSourceOrderId("201205080404129");
passInputVo.setInputBusiParam(inputVo);
for (int i=1;i<10;i++) {
PassEjbSVResponseVO outVo = ejbProcessor.passEjbSV(passInputVo);
System.out.println("dddddddddddddddddd");
System.out.println("getRespCode:"+outVo.getRespCode());
System.out.println("getRespDesc:"+outVo.getRespDesc());
//com.ailk.bsdm.chnlprechecktaskfinish.param.ChnlPrecheckTaskFinshOutputVo outBusi = (com.ailk.bsdm.chnlprechecktaskfinish.param.ChnlPrecheckTaskFinshOutputVo)outVo.getOutputBusiParam();
//System.out.println(outBusi.getResultCode());
//System.out.println(outBusi.getResultDesc());
}
} catch(Exception e) {
System.out.println("Exception.....................");
e.printStackTrace();
}
}
private static void callChnlInfoChng() throws Exception {
try {
ChannelReceiveInputVo inputVo = null;
String sql = "select req_param from uip_ejb_request_data where request_id = 209026";
ServiceManager.getSession().startTransaction();
Connection conn = ServiceManager.getSession().getConnection();
PreparedStatement ptmt = null;
ResultSet rs = null;
ptmt = conn.prepareStatement(sql);
rs = ptmt.executeQuery();
while (rs.next()) {
Blob blob = rs.getBlob(1);
if (blob != null) {
InputStream inStream = blob.getBinaryStream();
long nLen = blob.length();
int nSize = (int) nLen;
byte[] data = new byte[nSize];
inStream.read(data);
inStream.close();
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
inputVo = (ChannelReceiveInputVo)in.readObject();
}
}
ServiceManager.getSession().rollbackTransaction();
if (rs != null) rs.close();
if (ptmt != null) ptmt.close();
if (inputVo == null) throw new Exception("inputVo == null");
System.out.println("get inputVo end ...");
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
env.put("java.naming.provider.url","sparkHTTP://192.168.3.11:14836");
env.put("com.bes.jndi.spark.checktime","30000");
Context ctx = new InitialContext(env);
System.out.println("new InitialContext end ...");
com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote ejbProcessor = (com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote)ctx.lookup("UipUchlEjbSVBean#com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote");
System.out.println("lookup ejb end ...");
PassEjbSVRequestVO passInputVo = new PassEjbSVRequestVO();
passInputVo.setEjbSVProviderCode("CHNL_INFO_CHG_NOTIFY");
for (int i=1;i<=10000;i++) {
inputVo.setChnlId("TC"+i);
passInputVo.setInputBusiParam(inputVo);
System.out.println("第"+i+"次调用...");
PassEjbSVResponseVO outVo = ejbProcessor.passEjbSV(passInputVo);
System.out.println("call service end ...");
System.out.println("getRespCode:"+outVo.getRespCode());
System.out.println("getRespDesc:"+outVo.getRespDesc());
ChannelReceiveOutputVo busiOutputVo = (ChannelReceiveOutputVo)outVo.getOutputBusiParam();
System.out.println(busiOutputVo.getResultCode());
System.out.println(busiOutputVo.getResultDesc());
}
} catch(Exception e) {
e.printStackTrace();
}
}
private static void chnlInfoChngNotiy() throws Exception {
try {
ChannelReceiveInputVo inputVo = new ChannelReceiveInputVo();
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://localhost:7001");
Context ctx = new InitialContext(env);
System.out.println("new InitialContext end ...");
com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote ejbProcessor = (com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote)ctx.lookup("UipUchlEjbSVBean#com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote");
System.out.println("lookup ejb end ...");
PassEjbSVRequestVO passInputVo = new PassEjbSVRequestVO();
passInputVo.setEjbSVProviderCode("CHNL_INFO_CHG_NOTIFY");
inputVo.setChnlId("TC");
passInputVo.setInputBusiParam(inputVo);
PassEjbSVResponseVO outVo = ejbProcessor.passEjbSV(passInputVo);
System.out.println("call service end ...");
System.out.println("getRespCode:"+outVo.getRespCode());
System.out.println("getRespDesc:"+outVo.getRespDesc());
ChannelReceiveOutputVo busiOutputVo = (ChannelReceiveOutputVo)outVo.getOutputBusiParam();
System.out.println(busiOutputVo.getResultCode());
System.out.println(busiOutputVo.getResultDesc());
} catch(Exception e) {
e.printStackTrace();
}
}
private static void chnlInfoChng() throws Exception {
try {
com.ailk.bsdm.channelupdate.param.ChannelUpdateInputVo inputVo = new com.ailk.bsdm.channelupdate.param.ChannelUpdateInputVo();
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://localhost:7001");
Context ctx = new InitialContext(env);
System.out.println("new InitialContext end ...");
com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote ejbProcessor = (com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote)ctx.lookup("UipUchlEjbSVBean#com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote");
System.out.println("lookup ejb end ...");
PassEjbSVRequestVO passInputVo = new PassEjbSVRequestVO();
passInputVo.setEjbSVProviderCode("CHNL_INFO_CHG");
inputVo.setSourceOrderId("TC");
passInputVo.setInputBusiParam(inputVo);
PassEjbSVResponseVO outVo = ejbProcessor.passEjbSV(passInputVo);
System.out.println("call service end ...");
System.out.println("getRespCode:"+outVo.getRespCode());
System.out.println("getRespDesc:"+outVo.getRespDesc());
ChannelUpdateOutputVo busiOutputVo = (ChannelUpdateOutputVo)outVo.getOutputBusiParam();
System.out.println(busiOutputVo.getResultCode());
System.out.println(busiOutputVo.getResultDesc());
} catch(Exception e) {
e.printStackTrace();
}
}
private static void areaInfoSync() throws Exception {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
env.put("java.naming.provider.url","sparkHTTP://10.1.251.176:14712");
Context ctx = new InitialContext(env);
System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbb");
//调用前台EJB服务
TdMAreaRequestVo reqVo = new TdMAreaRequestVo();
/*
IDataSyncAreaRemoteSV ejbProcessor = (IDataSyncAreaRemoteSV)ctx.lookup("DataSyncAreaRemoteSVImpl#com.ailk.uchannel.datasyncarea.interfaces.IDataSyncAreaRemoteSV");
*/
IDataSyncAreaRemoteSV ejbProcessor = (IDataSyncAreaRemoteSV)CommonUtil.getEjbsv("AREA_INFO_SYNC");
System.out.println("ccccccccccccccccccccccccccccccccc");
TdMAreaResponseVo respVo = ejbProcessor.execute(reqVo);
System.out.println("ddddddddddddddddddddddddddddd");
System.out.println(respVo.getResultDesc());
System.out.println(respVo.getResultDesc());
} catch(Exception e) {
System.out.println("Exception.....................");
e.printStackTrace();
}
}
private static void callBesPrecheckNotifyMsg() throws Exception {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
env.put("java.naming.provider.url","sparkHTTP://172.16.58.3:16312");
Context ctx = new InitialContext(env);
System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbb");
com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote ejbProcessor = (com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote)ctx.lookup("UipUchlEjbSVBean#com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote");
System.out.println("ccccccccccccccccccccccccccccccccc");
PrechekRequestVO inputParam = new PrechekRequestVO();
int subjectId = 2210;
inputParam.setSubjectId(subjectId);
inputParam.setProvinceCode("09");
PrecheckResultReqVO precheckResultReqVO = new PrecheckResultReqVO();
precheckResultReqVO.setOperID("000");
precheckResultReqVO.setPrecheckNO("99999999");
precheckResultReqVO.setResultCODE("0000");
inputParam.setInputBusiParam(precheckResultReqVO);
PrecheckResponseVO outParam = ejbProcessor.process(inputParam);
System.out.println(outParam.getRespCode());
System.out.println(outParam.getRespDesc());
} catch(Exception e) {
System.out.println("Exception.....................");
e.printStackTrace();
}
}
private static void centerDb() throws Exception {
try {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
System.out.println("change to 01");
String sql = "select record_id$seq.nextval from dual";
String seq = DbUtil.queryForString(sql, null);
System.out.println("seq:"+seq);
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
System.out.println("change to 99");
seq = DbUtil.queryForString(sql, null);
System.out.println("seq:"+seq);
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
System.out.println("change to 01");
ServiceManager.getSession().startTransaction();
UipSyncRecordBean bean = new UipSyncRecordBean();
bean.setRecordId(12345678);
bean.setSubjectId(90);
bean.setMonth("201203");
bean.setProvinceCode("99");
bean.setContentKind("00");
bean.setContentId("99999999");
bean.isNew();
UipSyncRecordEngine.save(bean);
ServiceManager.getSession().commitTransaction();
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
System.out.println("change to 99");
ServiceManager.getSession().startTransaction();
bean = new UipSyncRecordBean();
bean.setRecordId(12345678);
bean.setSubjectId(90);
bean.setMonth("201203");
bean.setProvinceCode("99");
bean.setContentKind("00");
bean.setContentId("99999999");
bean.isNew();
UipSyncRecordEngine.save(bean);
ServiceManager.getSession().commitTransaction();
} catch(Exception e) {
e.printStackTrace();
}
}
private static void waitPrevAction() throws Exception {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://localhost:7001");
//env.put("java.naming.factory.initial","com.tongweb.naming.SerialInitContextFactory");
//env.put("java.naming.provider.url","10.1.25.163:5100");
//env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
//env.put("java.naming.provider.url","sparkHTTP://10.1.251.176:53773");
Context ctx = new InitialContext(env);
System.out.println("new InitialContext ok ....");
UipUchlWaitPrevActionSVRemote ejbProcessor = (UipUchlWaitPrevActionSVRemote)ctx.lookup("UipUchlWaitPrevActionSVBean#com.ai.uchintService.ejb.srv.interfaces.UipUchlWaitPrevActionSVRemote");
System.out.println("lookup ok...ejbProcessor-->"+ejbProcessor);
CommonEjbSVRequestVO requestVO = new CommonEjbSVRequestVO();
requestVO.setEjbSVProviderCode(CommonEjbSVRequestVO.EJB_SV_PROVIDER_CODE_WAIT_PREV_ACTION);
TfWaitPrevActionRequestVo busiRequestVO = new TfWaitPrevActionRequestVo();
busiRequestVO.setOrderId("9089");
busiRequestVO.setBusiCode(TfWaitPrevActionRequestVo.YES);
busiRequestVO.setBusiDesc("this is fool");
requestVO.setInputBusiParam(busiRequestVO);
CommonEjbSVResponseVO responseVO = ejbProcessor.process(requestVO);
System.out.println(responseVO.getRespCode());
System.out.println(responseVO.getRespDesc());
if (responseVO.getOutputBusiParam() != null) {
System.out.println(((TfWaitPrevActionResponseVo)responseVO.getOutputBusiParam()).getResultCode());
System.out.println(((TfWaitPrevActionResponseVo)responseVO.getOutputBusiParam()).getResultDesc());
} else {
System.out.println("responseVO.getOutputBusiParam == null");
}
} catch(Exception e) {
e.printStackTrace();
}
}
private static void channelReceive() throws Exception {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://localhost:7001");
//env.put("java.naming.factory.initial","com.tongweb.naming.SerialInitContextFactory");
//env.put("java.naming.provider.url","10.1.25.163:5100");
//env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
//env.put("java.naming.provider.url","sparkHTTP://10.1.251.176:53773");
Context ctx = new InitialContext(env);
System.out.println("new InitialContext ok ....");
UipUchlChannelReceiveSVRemote ejbProcessor = (UipUchlChannelReceiveSVRemote)ctx.lookup("UipUchlChannelReceiveSVBean#com.ai.uchintService.ejb.srv.interfaces.UipUchlChannelReceiveSVRemote");
System.out.println("lookup ok...ejbProcessor-->"+ejbProcessor);
CommonEjbSVRequestVO requestVO = new CommonEjbSVRequestVO();
requestVO.setEjbSVProviderCode(CommonEjbSVRequestVO.EJB_SV_PROVIDER_CODE_CHANNEL_RECEIVE);
ChannelReceiveInputVo busiRequestVO = new ChannelReceiveInputVo();
busiRequestVO.setOrderId("9089");
requestVO.setInputBusiParam(busiRequestVO);
CommonEjbSVResponseVO responseVO = ejbProcessor.process(requestVO);
System.out.println(responseVO.getRespCode());
System.out.println(responseVO.getRespDesc());
if (responseVO.getOutputBusiParam() != null) {
System.out.println(((ChannelReceiveOutputVo)responseVO.getOutputBusiParam()).getResultCode());
System.out.println(((ChannelReceiveOutputVo)responseVO.getOutputBusiParam()).getResultDesc());
} else {
System.out.println("responseVO.getOutputBusiParam == null");
}
} catch(Exception e) {
e.printStackTrace();
}
}
private static void bsdmChnlPrecheckTaskFinsh() throws Exception {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://localhost:7001");
//env.put("java.naming.factory.initial","com.tongweb.naming.SerialInitContextFactory");
//env.put("java.naming.provider.url","10.1.25.163:5100");
//env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
//env.put("java.naming.provider.url","sparkHTTP://10.1.251.176:53773");
Context ctx = new InitialContext(env);
System.out.println("new InitialContext ok ....");
UipUchlChnlPrecheckTaskFinshSVRemote ejbProcessor = (UipUchlChnlPrecheckTaskFinshSVRemote)ctx.lookup("UipUchlChnlPrecheckTaskFinshSVBean#com.ai.uchintService.ejb.srv.interfaces.UipUchlChnlPrecheckTaskFinshSVRemote");
System.out.println("lookup ok...ejbProcessor-->"+ejbProcessor);
CommonEjbSVRequestVO requestVO = new CommonEjbSVRequestVO();
requestVO.setEjbSVProviderCode(CommonEjbSVRequestVO.EJB_SV_PROVIDER_CODE_CHNL_PRECHECK_TASK_FINSH);
ChnlPrecheckTaskFinshInputVo busiRequestVO = new ChnlPrecheckTaskFinshInputVo();
busiRequestVO.setSourceOrderId("9089");
busiRequestVO.setActionCode(ChnlPrecheckTaskFinshInputVo.ACTION_REPRECHECK);
requestVO.setInputBusiParam(busiRequestVO);
CommonEjbSVResponseVO responseVO = ejbProcessor.process(requestVO);
System.out.println(responseVO.getRespCode());
System.out.println(responseVO.getRespDesc());
System.out.println(((ChnlPrecheckTaskFinshOutputVo)responseVO.getOutputBusiParam()).getResultCode());
System.out.println(((ChnlPrecheckTaskFinshOutputVo)responseVO.getOutputBusiParam()).getResultDesc());
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] argv) {
System.out.println("begin");
try
{
//callBesChnlInfoChgCancelNotify();
//callBesPrecheckNotifyMsg();
//callChnlInfoChng();
//chnlInfoChng();
chnlInfoChngNotiy();
//centerDb();
//areaInfoSync();
//waitPrevAction();
//channelReceive();
//bsdmChnlPrecheckTaskFinsh();
}
catch(Exception e)
{
System.out.println("catch Excetion .........");
e.printStackTrace();
}
System.out.println("end");
}
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.util;
import com.ai.uchintService.ftpFile.qingzhang.vo.QZReqHeaderVO;
import com.ai.uchintService.ftpFile.qingzhang.vo.QZRespBodyVO;
import com.ai.uchintService.ftpFile.qingzhang.vo.QZRespHeaderVO;
public class QZFileUtil {
public static QZReqHeaderVO getReqHeader(String str)
{
if (str == null) return null;
QZReqHeaderVO headerVO = new QZReqHeaderVO();
headerVO.setSerialNumber(str.substring(0, 4));
headerVO.setVersionInfo(str.substring(4, 9));
headerVO.setFileCreateTime(str.substring(9, 23));
headerVO.setSystemNo(str.substring(23, 27));
headerVO.setRecordBeginTime(str.substring(27, 41));
headerVO.setRecordEndTime(str.substring(41, 55));
headerVO.setRowCount(Integer.valueOf(str.substring(55, 65)));
headerVO.print();
return headerVO;
}
private static String leftFill(String str,int len,String fillChar)
{
String retStr = str;
if (retStr.length()>=len)
{
retStr = retStr.substring(0, len);
}
else
{
for(int i=0,j=(10-retStr.length());i<j;i++)
{
retStr = fillChar+retStr;
}
}
return retStr;
}
private static String rightFill(String str,int len,String fillChar)
{
String retStr = str;
if (retStr.length()>=len)
{
retStr = retStr.substring(0, len);
}
else
{
for(int i=0,j=(10-retStr.length());i<j;i++)
{
retStr = retStr+fillChar;
}
}
return retStr;
}
public static String getReqHeader(QZReqHeaderVO headerVO)
{
if (headerVO == null) return null;
return headerVO.getSerialNumber()+headerVO.getVersionInfo()+headerVO.getFileCreateTime()
+headerVO.getSystemNo()+headerVO.getRecordBeginTime()+headerVO.getRecordEndTime()
+leftFill(String.valueOf(headerVO.getRowCount()),10,"0");
}
public static String getRespHeader(QZRespHeaderVO header)
{
if (header == null) return null;
return header.getSerialNumber()+header.getVersionInfo()+header.getFileCreateTime()
+header.getSystemNo()
+leftFill(String.valueOf(header.getRowCount()),10,"0")
+leftFill(String.valueOf(header.getSuccessRowCount()),10,"0");
}
public static String getRespBody(QZRespBodyVO body)
{
if (body == null) return null;
return body.getRecordSequenceID()+"\t"+body.getServiceNo()+"\t"+body.getResultCode()+"\t"+body.getResultComments();
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import java.sql.Timestamp;
import com.ai.appframe2.common.DataStructInterface;
public interface IUC_TD_MDM_BANK_HISValue extends DataStructInterface{
public final static String S_InHisTime = "IN_HIS_TIME";
public final static String S_State = "STATE";
public final static String S_BankCode = "BANK_CODE";
public final static String S_BankName = "BANK_NAME";
public Timestamp getInHisTime();
public String getState();
public String getBankCode();
public String getBankName();
public void setInHisTime(Timestamp value);
public void setState(String value);
public void setBankCode(String value);
public void setBankName(String value);
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IUC_TF_CHL_AGENT_ROLE_INFOValue;
public class UC_TF_CHL_AGENT_ROLE_INFOBean extends DataContainer implements DataContainerInterface,IUC_TF_CHL_AGENT_ROLE_INFOValue{
private static String m_boName = "bo.UC_TF_CHL_AGENT_ROLE_INFO";
public final static String S_RegRegionCode = "REG_REGION_CODE";
public final static String S_RegProvCode = "REG_PROV_CODE";
public final static String S_AgentRoleId = "AGENT_ROLE_ID";
public final static String S_AgentDetailType = "AGENT_DETAIL_TYPE";
public final static String S_Remark = "REMARK";
public final static String S_AgentRoleType = "AGENT_ROLE_TYPE";
public final static String S_AgentId = "AGENT_ID";
public final static String S_OrigSysCode = "ORIG_SYS_CODE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UC_TF_CHL_AGENT_ROLE_INFOBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
//�����������������ҵ���������
throw new AIException("Cannot reset ObjectType");
}
public void initRegRegionCode(String value){
this.initProperty(S_RegRegionCode,value);
}
public void setRegRegionCode(String value){
this.set(S_RegRegionCode,value);
}
public void setRegRegionCodeNull(){
this.set(S_RegRegionCode,null);
}
public String getRegRegionCode(){
return DataType.getAsString(this.get(S_RegRegionCode));
}
public String getRegRegionCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_RegRegionCode));
}
public void initRegProvCode(String value){
this.initProperty(S_RegProvCode,value);
}
public void setRegProvCode(String value){
this.set(S_RegProvCode,value);
}
public void setRegProvCodeNull(){
this.set(S_RegProvCode,null);
}
public String getRegProvCode(){
return DataType.getAsString(this.get(S_RegProvCode));
}
public String getRegProvCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_RegProvCode));
}
public void initAgentRoleId(long value){
this.initProperty(S_AgentRoleId,new Long(value));
}
public void setAgentRoleId(long value){
this.set(S_AgentRoleId,new Long(value));
}
public void setAgentRoleIdNull(){
this.set(S_AgentRoleId,null);
}
public long getAgentRoleId(){
return DataType.getAsLong(this.get(S_AgentRoleId));
}
public long getAgentRoleIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_AgentRoleId));
}
public void initAgentDetailType(String value){
this.initProperty(S_AgentDetailType,value);
}
public void setAgentDetailType(String value){
this.set(S_AgentDetailType,value);
}
public void setAgentDetailTypeNull(){
this.set(S_AgentDetailType,null);
}
public String getAgentDetailType(){
return DataType.getAsString(this.get(S_AgentDetailType));
}
public String getAgentDetailTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentDetailType));
}
public void initRemark(String value){
this.initProperty(S_Remark,value);
}
public void setRemark(String value){
this.set(S_Remark,value);
}
public void setRemarkNull(){
this.set(S_Remark,null);
}
public String getRemark(){
return DataType.getAsString(this.get(S_Remark));
}
public String getRemarkInitialValue(){
return DataType.getAsString(this.getOldObj(S_Remark));
}
public void initAgentRoleType(String value){
this.initProperty(S_AgentRoleType,value);
}
public void setAgentRoleType(String value){
this.set(S_AgentRoleType,value);
}
public void setAgentRoleTypeNull(){
this.set(S_AgentRoleType,null);
}
public String getAgentRoleType(){
return DataType.getAsString(this.get(S_AgentRoleType));
}
public String getAgentRoleTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentRoleType));
}
public void initAgentId(long value){
this.initProperty(S_AgentId,new Long(value));
}
public void setAgentId(long value){
this.set(S_AgentId,new Long(value));
}
public void setAgentIdNull(){
this.set(S_AgentId,null);
}
public long getAgentId(){
return DataType.getAsLong(this.get(S_AgentId));
}
public long getAgentIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_AgentId));
}
public void initOrigSysCode(String value){
this.initProperty(S_OrigSysCode,value);
}
public void setOrigSysCode(String value){
this.set(S_OrigSysCode,value);
}
public void setOrigSysCodeNull(){
this.set(S_OrigSysCode,null);
}
public String getOrigSysCode(){
return DataType.getAsString(this.get(S_OrigSysCode));
}
public String getOrigSysCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrigSysCode));
}
}
<file_sep>package com.ai.uchintService.ejb.srv.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import com.ai.uchintService.ejb.srv.interfaces.UipUchlAppleAuthReceiveSVRemote;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ejb.util.UipEjbSrvUtil;
import com.ai.uint.ejb.vo.CommonEjbSVRequestVO;
import com.ai.uint.ejb.vo.CommonEjbSVResponseVO;
@Stateless(mappedName = "UipUchlAppleAuthReceiveSVBean")
@Remote(UipUchlAppleAuthReceiveSVRemote.class)
@TransactionManagement(TransactionManagementType.BEAN)
public class UipUchlAppleAuthReceiveSVBean implements
UipUchlAppleAuthReceiveSVRemote {
private static final String IMPL_CLASS = "com.ai.uchintService.ejb.paramImpl.appleAuthReceive.AppleAuthReceiveImpl";
@Override
public CommonEjbSVResponseVO process(CommonEjbSVRequestVO requestVO) {
CommonEjbSVResponseVO respVO = new CommonEjbSVResponseVO();
List<Object> inputParams = new ArrayList<Object>();
inputParams.add(requestVO);
Map resultMap = UipEjbSrvUtil.process(inputParams, IMPL_CLASS, requestVO.getEjbSVProviderCode(), UipEjbSrvUtil.SAVE_LOG_TYPE_A);
if (resultMap == null) {
respVO.setRespCode(CommonEjbSVResponseVO.RESP_CODE_FAIL);
respVO.setRespDesc("服务接口返回参数为NULL");
} else {
if (resultMap.get(Constants.ResultMap.ResultKey.RESULT_CODE) == null) {
respVO.setRespCode(CommonEjbSVResponseVO.RESP_CODE_FAIL);
respVO.setRespDesc("服务接口返回RESULT_CODE参数为NULL");
} else {
if (resultMap.get(Constants.ResultMap.ResultKey.RESULT_CODE).equals(Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS)) {
respVO.setRespCode(CommonEjbSVResponseVO.RESP_CODE_SUCCESS);
respVO.setRespDesc("调用成功");
respVO.setOutputBusiParam(resultMap.get(Constants.ResultMap.ResultKey.RESULT_OBJ));
} else {
respVO.setRespCode(CommonEjbSVResponseVO.RESP_CODE_FAIL);
respVO.setRespDesc((String)resultMap.get(Constants.ResultMap.ResultKey.RESULT_MSG));
}
}
}
return respVO;
}
}
<file_sep>package com.ai.uchintService.ftpFile;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.busi.service.interfaces.IFtpFileUploadSV;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.util.MaxIdUtil;
/**
* 文件接口公共类
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Mar 19, 2012
*/
public class FtpFileCommon {
private static final Log logger = LogFactory.getLog(ERPPublishFileWithholding.class);
/**
* 将文件相关信息入库
* @param obj
*/
public static synchronized void saveFileInfo(Map map) {
try {
/* 1.插入文件表 */
long fileId = Long.parseLong(MaxIdUtil.getSequenceNextVal("INT_FILE_ID"));
long num1 = getService().insertFileRecord(map, fileId);
logger.info("=============== "+map.get("province_code_erp")+" 插入INT_FILE_RECORD表===================");
//预提或应付
if (map.get("data_type").toString().equals("1") || map.get("data_type").toString().equals("2")) {
if (num1 ==1) {
fileUploadContinue(map);
}
}
/* 2.插入文件明细表 */
if (!map.get("file_status").equals(Constants.FILE_STATE_UNDO)) {
logger.info("=============== "+map.get("province_code")+" 插入INT_FILE_DETAIL表===================");
List<String> conList = (List<String>)map.get("contentList");
for (int i = 1; i <= conList.size() ; i++) {
String detail_sql = "insert into INT_FILE_DETAIL (FILE_ID,LINE_NUM,CONTENT,INSERT_TIME) values " +
"("+fileId+","+i+",'"+conList.get(i-1)+"',sysdate)";
int num2 = DbUtil.exeSQL(detail_sql, null);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取最后一行
* @param str
* @return
*/
public static String handlerArray(String str) {
String[] array = str.split("\n");
if (array!=null && array.length>0) {
return array[array.length-1];
}
return null;
}
/**
* 文件上传后续操作
* @param map
* @param map_area
*/
@SuppressWarnings("unchecked")
public static void fileUploadContinue(Map map) {
try {
/* 1.查询当前账期当前数据类型当前省份共有多少个地市有文件需要上传 */
String int_sql = "select distinct erp_area_code from int_erp_temp_result where acct_month='"+map.get("acct_cycle")+"'" +
" and data_type="+map.get("data_type")+" and erp_area_code like '"+map.get("province_code_erp").toString().substring(0,4)+"%'";
List<Map<String,Object>> intResultList = DbUtil.query(int_sql, null);
/* 2.查询当前账期当前数据类型当前省份已经上传多少个地市文件*/
// String file_sql = "select * from int_file_record where file_id in ( "+
// "select max(file_id) file_id from ( "+
// "select * from int_file_record where acct_month='"+map.get("acct_cycle")+
// "' and province_code='"+map.get("province_code")+"' and data_type='"+map.get("data_type")+"' "+
// "order by file_name desc,insert_time desc ) "+
// "group by file_name "+
// ")";
String sql = "select min(send_count) from int_file_record where acct_month='"+map.get("acct_cycle")+"" +
"' and province_code='"+map.get("province_code")+"' and data_type='"+map.get("data_type")+"'";
String sendCount = DbUtil.queryForString(sql, null);
sendCount = sendCount.equals("") ? "1" : DbUtil.queryForString(sql, null);//第一次上传取1,重复上传就取最大值
String file_sql = "select * from int_file_record where acct_month='"+map.get("acct_cycle")+
"' and province_code='"+map.get("province_code")+"' and data_type='"+map.get("data_type")+"' "+
" and send_count="+sendCount+" order by file_name desc,insert_time desc ";
List<Map<String,Object>> fileResultList = DbUtil.query(file_sql, null);
//上传的文件数
int fileCount = 0;
//状态为失败的文件数
int failFileCount = 0;
if (fileResultList !=null && fileResultList.size()>0) {
for(int i=0;i<fileResultList.size();i++) {
if (!fileResultList.get(i).get("file_status").toString().equals(Constants.FILE_STATE_UNDO)) {
++fileCount;
}
if (fileResultList.get(i).get("file_status").toString().equals(Constants.FILE_STATE_FAIL)) {
++failFileCount;
}
}
}
/* 3.当前账期当前数据类型是否每个地市文件都已处理 */
boolean isAllDo = false;
if (intResultList != null) {
//if (intResultList.size() == fileCount || (intResultList.size()-1) == fileCount){
if (intResultList.size() == fileCount){
isAllDo = true;
}
}
if(isAllDo) {
Thread.sleep(60000); //处理到最后一个地市时线程等待60秒(因为各地市之间是独立的,为保证其它地市能处理完成)
//-----------------处理线程不同步 start-------------------
fileResultList = DbUtil.query(file_sql, null);
failFileCount = 0;
if (fileResultList !=null && fileResultList.size()>0) {
for(int i=0;i<fileResultList.size();i++) {
if (fileResultList.get(i).get("file_status").toString().equals(Constants.FILE_STATE_FAIL)) {
++failFileCount;
}
}
}
//-----------------处理线程不同步 end-------------------
int finish_flag = 3; //上传成功
if (failFileCount>2) {
finish_flag = 4; //上传失败
}
/* 4.根据文件上传情况,回写状态 */
String feedback_sql = "update TF_COMM_CONFIRM_INT set finish_flag = "+finish_flag+"," +
" up_file_time=sysdate where cycle_month='"+map.get("acct_cycle")+"' and operation = '"+map.get("data_type")+"' " +
"and province_code='"+map.get("province_code")+"' and finish_flag=1";
DbUtil.exeSQL(feedback_sql, null);
logger.info("=============== "+map.get("province_code_erp")+" 插入TF_COMM_CONFIRM_INT表===================");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static IFtpFileUploadSV getService() {
return (IFtpFileUploadSV)ServiceFactory.getService(IFtpFileUploadSV.class);
}
public static void main(String[] args) {
String sql = "select max(send_count) from int_file_record where acct_month='201204' and province_code='36' and data_type='2'";
String str = DbUtil.queryForString(sql, null);
str = str.equals("") ? "1" : DbUtil.queryForString(sql, null);
System.out.println("="+str);
}
}
<file_sep>
package cn.chinaunicom.ws.ordser.unibssbody.ordstatqryrsp;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.ordser.unibssbody.ordstatqryrsp package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.ordser.unibssbody.ordstatqryrsp
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ORD_STAT_QRY_RSP }
*
*/
public ORD_STAT_QRY_RSP createORD_STAT_QRY_RSP() {
return new ORD_STAT_QRY_RSP();
}
/**
* Create an instance of {@link ORD_STAT_QRY_RSP.RESPONSE }
*
*/
public ORD_STAT_QRY_RSP.RESPONSE createORD_STAT_QRY_RSPRESPONSE() {
return new ORD_STAT_QRY_RSP.RESPONSE();
}
/**
* Create an instance of {@link ORD_STAT_QRY_RSP.RESPONSE.ORDER_INFO }
*
*/
public ORD_STAT_QRY_RSP.RESPONSE.ORDER_INFO createORD_STAT_QRY_RSPRESPONSEORDER_INFO() {
return new ORD_STAT_QRY_RSP.RESPONSE.ORDER_INFO();
}
/**
* Create an instance of {@link ORD_STAT_QRY_RSP.RESPONSE.PARA }
*
*/
public ORD_STAT_QRY_RSP.RESPONSE.PARA createORD_STAT_QRY_RSPRESPONSEPARA() {
return new ORD_STAT_QRY_RSP.RESPONSE.PARA();
}
}
<file_sep>
package cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser.unibssbody.agencysendcardpayrefundnotifyreq;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CHNL_CODE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_NAME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_REFUND_FLAG">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ACCOUNT_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="2"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ORG_PROVINCE_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="ORG_ORDER_ID" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="30"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="TRADE_TIME" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PAY_FEE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="11"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"chnlCODE",
"chnlNAME",
"payREFUNDFLAG",
"accountTYPE",
"orgPROVINCEORDERID",
"orgORDERID",
"tradeTIME",
"payFEE",
"para"
})
@XmlRootElement(name = "AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_REQ")
public class AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_REQ {
@XmlElement(name = "CHNL_CODE", required = true)
protected String chnlCODE;
@XmlElement(name = "CHNL_NAME")
protected String chnlNAME;
@XmlElement(name = "PAY_REFUND_FLAG", required = true)
protected String payREFUNDFLAG;
@XmlElement(name = "ACCOUNT_TYPE", required = true)
protected String accountTYPE;
@XmlElement(name = "ORG_PROVINCE_ORDER_ID")
protected String orgPROVINCEORDERID;
@XmlElement(name = "ORG_ORDER_ID")
protected String orgORDERID;
@XmlElement(name = "TRADE_TIME")
protected String tradeTIME;
@XmlElement(name = "PAY_FEE", required = true)
protected String payFEE;
@XmlElement(name = "PARA")
protected List<AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_REQ.PARA> para;
/**
* Gets the value of the chnl_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CODE() {
return chnlCODE;
}
/**
* Sets the value of the chnl_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CODE(String value) {
this.chnlCODE = value;
}
/**
* Gets the value of the chnl_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_NAME() {
return chnlNAME;
}
/**
* Sets the value of the chnl_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_NAME(String value) {
this.chnlNAME = value;
}
/**
* Gets the value of the pay_REFUND_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_REFUND_FLAG() {
return payREFUNDFLAG;
}
/**
* Sets the value of the pay_REFUND_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_REFUND_FLAG(String value) {
this.payREFUNDFLAG = value;
}
/**
* Gets the value of the account_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getACCOUNT_TYPE() {
return accountTYPE;
}
/**
* Sets the value of the account_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setACCOUNT_TYPE(String value) {
this.accountTYPE = value;
}
/**
* Gets the value of the org_PROVINCE_ORDER_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORG_PROVINCE_ORDER_ID() {
return orgPROVINCEORDERID;
}
/**
* Sets the value of the org_PROVINCE_ORDER_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORG_PROVINCE_ORDER_ID(String value) {
this.orgPROVINCEORDERID = value;
}
/**
* Gets the value of the org_ORDER_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getORG_ORDER_ID() {
return orgORDERID;
}
/**
* Sets the value of the org_ORDER_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setORG_ORDER_ID(String value) {
this.orgORDERID = value;
}
/**
* Gets the value of the trade_TIME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTRADE_TIME() {
return tradeTIME;
}
/**
* Sets the value of the trade_TIME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTRADE_TIME(String value) {
this.tradeTIME = value;
}
/**
* Gets the value of the pay_FEE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_FEE() {
return payFEE;
}
/**
* Sets the value of the pay_FEE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_FEE(String value) {
this.payFEE = value;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_REQ.PARA }
*
*
*/
public List<AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_REQ.PARA> getPARA() {
if (para == null) {
para = new ArrayList<AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_REQ.PARA>();
}
return this.para;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraID",
"paraVALUE"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraID;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>package com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2011-11-18T10:25:54.515+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_InquiryEASAuditInfoSrv", name = "SB_EAS_EAS_InquiryEASAuditInfoSrv")
@XmlSeeAlso({ObjectFactory.class, com.unicom.mss.soa.msgheader.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SBEASEASInquiryEASAuditInfoSrv {
@WebResult(name = "SB_EAS_EAS_InquiryEASAuditInfoSrvResponse", targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_InquiryEASAuditInfoSrv", partName = "payload")
@WebMethod(action = "process")
public SB_EAS_EAS_InquiryEASAuditInfoSrvResponse process(
@WebParam(partName = "payload", name = "SB_EAS_EAS_InquiryEASAuditInfoSrvRequest", targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_InquiryEASAuditInfoSrv")
SB_EAS_EAS_InquiryEASAuditInfoSrvRequest payload
);
}
<file_sep>
package com.unicom.wouchannel.importagentinfosrv;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ErrorCOLLECTION complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ErrorCOLLECTION">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="errorMSGCONTENT" type="{http://wouchannel.unicom.com/ImportAgentInfoSrv}ErrorMSGCONTENT" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ErrorCOLLECTION", propOrder = {
"errorMSGCONTENT"
})
public class ErrorCOLLECTION {
@XmlElement(nillable = true)
protected List<ErrorMSGCONTENT> errorMSGCONTENT;
/**
* Gets the value of the errorMSGCONTENT property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the errorMSGCONTENT property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getErrorMSGCONTENT().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ErrorMSGCONTENT }
*
*
*/
public List<ErrorMSGCONTENT> getErrorMSGCONTENT() {
if (errorMSGCONTENT == null) {
errorMSGCONTENT = new ArrayList<ErrorMSGCONTENT>();
}
return this.errorMSGCONTENT;
}
public void setErrorMSGCONTENT(List<ErrorMSGCONTENT> value) {
this.errorMSGCONTENT = value;
}
}
<file_sep>
package com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _SB_UC_UC_ImportPaymentResultInfoSrvRequest_QNAME = new QName("http://mss.unicom.com/SB_UC_UC_ImportPaymentResultInfoSrv", "SB_UC_UC_ImportPaymentResultInfoSrvRequest");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link SB_UC_UC_ImportPaymentResultInfoSrvRequest }
*
*/
public SB_UC_UC_ImportPaymentResultInfoSrvRequest createSB_UC_UC_ImportPaymentResultInfoSrvRequest() {
return new SB_UC_UC_ImportPaymentResultInfoSrvRequest();
}
/**
* Create an instance of {@link SB_UC_UC_ImportPaymentResultInfoSrvResponse }
*
*/
public SB_UC_UC_ImportPaymentResultInfoSrvResponse createSB_UC_UC_ImportPaymentResultInfoSrvResponse() {
return new SB_UC_UC_ImportPaymentResultInfoSrvResponse();
}
/**
* Create an instance of {@link ErrorCollection }
*
*/
public ErrorCollection createErrorCollection() {
return new ErrorCollection();
}
/**
* Create an instance of {@link ResponseCollection }
*
*/
public ResponseCollection createResponseCollection() {
return new ResponseCollection();
}
/**
* Create an instance of {@link ErrorItem }
*
*/
public ErrorItem createErrorItem() {
return new ErrorItem();
}
/**
* Create an instance of {@link SB_UC_UC_ImportPaymentResultInfoSrvInputCollection }
*
*/
public SB_UC_UC_ImportPaymentResultInfoSrvInputCollection createSB_UC_UC_ImportPaymentResultInfoSrvInputCollection() {
return new SB_UC_UC_ImportPaymentResultInfoSrvInputCollection();
}
/**
* Create an instance of {@link PAYMENT_LINE_INFOItem }
*
*/
public PAYMENT_LINE_INFOItem createPAYMENT_LINE_INFOItem() {
return new PAYMENT_LINE_INFOItem();
}
/**
* Create an instance of {@link SB_UC_UC_ImportPaymentResultInfoSrvInputItem }
*
*/
public SB_UC_UC_ImportPaymentResultInfoSrvInputItem createSB_UC_UC_ImportPaymentResultInfoSrvInputItem() {
return new SB_UC_UC_ImportPaymentResultInfoSrvInputItem();
}
/**
* Create an instance of {@link PAYMENT_LINE_INFOCollection }
*
*/
public PAYMENT_LINE_INFOCollection createPAYMENT_LINE_INFOCollection() {
return new PAYMENT_LINE_INFOCollection();
}
/**
* Create an instance of {@link ResponseItem }
*
*/
public ResponseItem createResponseItem() {
return new ResponseItem();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SB_UC_UC_ImportPaymentResultInfoSrvRequest }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://mss.unicom.com/SB_UC_UC_ImportPaymentResultInfoSrv", name = "SB_UC_UC_ImportPaymentResultInfoSrvRequest")
public JAXBElement<SB_UC_UC_ImportPaymentResultInfoSrvRequest> createSB_UC_UC_ImportPaymentResultInfoSrvRequest(SB_UC_UC_ImportPaymentResultInfoSrvRequest value) {
return new JAXBElement<SB_UC_UC_ImportPaymentResultInfoSrvRequest>(_SB_UC_UC_ImportPaymentResultInfoSrvRequest_QNAME, SB_UC_UC_ImportPaymentResultInfoSrvRequest.class, null, value);
}
}
<file_sep>
package com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ErrorOutputItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ErrorOutputItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ENTITY_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ERROR_MESSAGE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RECORD_NUMBER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BATCH_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ErrorOutputItem", propOrder = {
"entityNAME",
"priKEY",
"errorMESSAGE",
"recordNUMBER",
"batchID"
})
public class ErrorOutputItem {
@XmlElement(name = "ENTITY_NAME", required = true, nillable = true)
protected String entityNAME;
@XmlElement(name = "PRI_KEY", required = true, nillable = true)
protected String priKEY;
@XmlElement(name = "ERROR_MESSAGE", required = true, nillable = true)
protected String errorMESSAGE;
@XmlElement(name = "RECORD_NUMBER", required = true, nillable = true)
protected String recordNUMBER;
@XmlElement(name = "BATCH_ID", required = true, nillable = true)
protected String batchID;
/**
* Gets the value of the entity_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getENTITY_NAME() {
return entityNAME;
}
/**
* Sets the value of the entity_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setENTITY_NAME(String value) {
this.entityNAME = value;
}
/**
* Gets the value of the pri_KEY property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRI_KEY() {
return priKEY;
}
/**
* Sets the value of the pri_KEY property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRI_KEY(String value) {
this.priKEY = value;
}
/**
* Gets the value of the error_MESSAGE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getERROR_MESSAGE() {
return errorMESSAGE;
}
/**
* Sets the value of the error_MESSAGE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setERROR_MESSAGE(String value) {
this.errorMESSAGE = value;
}
/**
* Gets the value of the record_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRECORD_NUMBER() {
return recordNUMBER;
}
/**
* Sets the value of the record_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRECORD_NUMBER(String value) {
this.recordNUMBER = value;
}
/**
* Gets the value of the batch_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_ID() {
return batchID;
}
/**
* Sets the value of the batch_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_ID(String value) {
this.batchID = value;
}
}
<file_sep>
package com.unicom.mss.sb_pps_pps_importchannelstatusinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>SB_PPS_PPS_ImportChannelStatusInfoSrvInputItem complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="SB_PPS_PPS_ImportChannelStatusInfoSrvInputItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PARTNER_MDM_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="FROZEM_TYPE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_6" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_7" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_8" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_9" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_10" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_11" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_12" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_13" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_14" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_15" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SB_PPS_PPS_ImportChannelStatusInfoSrvInputItem", propOrder = {
"prikey",
"partnermdmcode",
"frozemtype",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5",
"reserved6",
"reserved7",
"reserved8",
"reserved9",
"reserved10",
"reserved11",
"reserved12",
"reserved13",
"reserved14",
"reserved15"
})
public class SBPPSPPSImportChannelStatusInfoSrvInputItem {
@XmlElement(name = "PRI_KEY", required = true, nillable = true)
protected String prikey;
@XmlElement(name = "PARTNER_MDM_CODE", required = true, nillable = true)
protected String partnermdmcode;
@XmlElement(name = "FROZEM_TYPE", required = true, nillable = true)
protected String frozemtype;
@XmlElement(name = "RESERVED_1", required = true, nillable = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true, nillable = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true, nillable = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true, nillable = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true, nillable = true)
protected String reserved5;
@XmlElement(name = "RESERVED_6", required = true, nillable = true)
protected String reserved6;
@XmlElement(name = "RESERVED_7", required = true, nillable = true)
protected String reserved7;
@XmlElement(name = "RESERVED_8", required = true, nillable = true)
protected String reserved8;
@XmlElement(name = "RESERVED_9", required = true, nillable = true)
protected String reserved9;
@XmlElement(name = "RESERVED_10", required = true, nillable = true)
protected String reserved10;
@XmlElement(name = "RESERVED_11", required = true, nillable = true)
protected String reserved11;
@XmlElement(name = "RESERVED_12", required = true, nillable = true)
protected String reserved12;
@XmlElement(name = "RESERVED_13", required = true, nillable = true)
protected String reserved13;
@XmlElement(name = "RESERVED_14", required = true, nillable = true)
protected String reserved14;
@XmlElement(name = "RESERVED_15", required = true, nillable = true)
protected String reserved15;
/**
* 获取prikey属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRIKEY() {
return prikey;
}
/**
* 设置prikey属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRIKEY(String value) {
this.prikey = value;
}
/**
* 获取partnermdmcode属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARTNERMDMCODE() {
return partnermdmcode;
}
/**
* 设置partnermdmcode属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARTNERMDMCODE(String value) {
this.partnermdmcode = value;
}
/**
* 获取frozemtype属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getFROZEMTYPE() {
return frozemtype;
}
/**
* 设置frozemtype属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFROZEMTYPE(String value) {
this.frozemtype = value;
}
/**
* 获取reserved1属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED1() {
return reserved1;
}
/**
* 设置reserved1属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED1(String value) {
this.reserved1 = value;
}
/**
* 获取reserved2属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED2() {
return reserved2;
}
/**
* 设置reserved2属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED2(String value) {
this.reserved2 = value;
}
/**
* 获取reserved3属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED3() {
return reserved3;
}
/**
* 设置reserved3属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED3(String value) {
this.reserved3 = value;
}
/**
* 获取reserved4属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED4() {
return reserved4;
}
/**
* 设置reserved4属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED4(String value) {
this.reserved4 = value;
}
/**
* 获取reserved5属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED5() {
return reserved5;
}
/**
* 设置reserved5属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED5(String value) {
this.reserved5 = value;
}
/**
* 获取reserved6属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED6() {
return reserved6;
}
/**
* 设置reserved6属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED6(String value) {
this.reserved6 = value;
}
/**
* 获取reserved7属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED7() {
return reserved7;
}
/**
* 设置reserved7属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED7(String value) {
this.reserved7 = value;
}
/**
* 获取reserved8属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED8() {
return reserved8;
}
/**
* 设置reserved8属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED8(String value) {
this.reserved8 = value;
}
/**
* 获取reserved9属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED9() {
return reserved9;
}
/**
* 设置reserved9属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED9(String value) {
this.reserved9 = value;
}
/**
* 获取reserved10属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED10() {
return reserved10;
}
/**
* 设置reserved10属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED10(String value) {
this.reserved10 = value;
}
/**
* 获取reserved11属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED11() {
return reserved11;
}
/**
* 设置reserved11属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED11(String value) {
this.reserved11 = value;
}
/**
* 获取reserved12属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED12() {
return reserved12;
}
/**
* 设置reserved12属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED12(String value) {
this.reserved12 = value;
}
/**
* 获取reserved13属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED13() {
return reserved13;
}
/**
* 设置reserved13属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED13(String value) {
this.reserved13 = value;
}
/**
* 获取reserved14属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED14() {
return reserved14;
}
/**
* 设置reserved14属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED14(String value) {
this.reserved14 = value;
}
/**
* 获取reserved15属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED15() {
return reserved15;
}
/**
* 设置reserved15属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED15(String value) {
this.reserved15 = value;
}
}
<file_sep>
package cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_INPUT }
*
*/
public CHANNEL_INFO_CHG_INPUT createCHANNEL_INFO_CHG_INPUT() {
return new CHANNEL_INFO_CHG_INPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_NOTIFY_INPUT }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_INPUT createCHANNEL_INFO_CHG_NOTIFY_INPUT() {
return new CHANNEL_INFO_CHG_NOTIFY_INPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT }
*
*/
public CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT createCHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT() {
return new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_OUTPUT }
*
*/
public CHANNEL_INFO_CHG_OUTPUT createCHANNEL_INFO_CHG_OUTPUT() {
return new CHANNEL_INFO_CHG_OUTPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_NOTIFY_OUTPUT }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_OUTPUT createCHANNEL_INFO_CHG_NOTIFY_OUTPUT() {
return new CHANNEL_INFO_CHG_NOTIFY_OUTPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT }
*
*/
public CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT createCHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT() {
return new CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT }
*
*/
public CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT createCHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT() {
return new CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT }
*
*/
public CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT createCHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT() {
return new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY createCHANNEL_INFO_CHG_INPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_NOTIFY_INPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_INPUT.UNI_BSS_BODY createCHANNEL_INFO_CHG_NOTIFY_INPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_CHG_NOTIFY_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT.UNI_BSS_BODY createCHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_OUTPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_OUTPUT.UNI_BSS_BODY createCHANNEL_INFO_CHG_OUTPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_CHG_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_NOTIFY_OUTPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_NOTIFY_OUTPUT.UNI_BSS_BODY createCHANNEL_INFO_CHG_NOTIFY_OUTPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_CHG_NOTIFY_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT.UNI_BSS_BODY createCHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT.UNI_BSS_BODY createCHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT.UNI_BSS_BODY createCHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUTUNI_BSS_BODY() {
return new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT.UNI_BSS_BODY();
}
}
<file_sep>package com.ai.uchintService.server.importPartnerInfo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.busi.service.interfaces.IImportPartnerInfoSV;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.ErrorCollection;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.ErrorItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.PARTNER_BANK_INFOItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.PARTNER_CONTACT_INFO;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.PARTNER_CONTACT_INFOItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.PARTNER_FILE_INFOItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.PARTNER_ROLE_INFOItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.ResponseCollection;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.ResponseItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvInputItem;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvRequest;
import com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvResponse;
import com.unicom.mss.soa.msgheader.MsgHeader;
public class ImportPartnerInfoAction implements IRecIfBase{
private static final Log logger = LogFactory.getLog(ImportPartnerInfoAction.class);
@Override
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
SB_EIP_EIP_ImportPartnerInfoSrvResponse rspObj = new SB_EIP_EIP_ImportPartnerInfoSrvResponse();
HashMap<String, Object> map = new HashMap<String, Object>();
ErrorCollection errorCol = new ErrorCollection();
List<ErrorItem> errorList = new ArrayList<ErrorItem>();
ResponseCollection respCol = new ResponseCollection();
List<ResponseItem> respList = new ArrayList<ResponseItem>();
ErrorItem errorItem = null;
ResponseItem respItem = null;
String result_desc = "";
/*
* 1-1
* 将参数obj转成request,然后取出实体数组
* 如果数据量大于500条,则返回错误信息
*/
SB_EIP_EIP_ImportPartnerInfoSrvRequest req = (SB_EIP_EIP_ImportPartnerInfoSrvRequest)ifMsg;
List<SB_EIP_EIP_ImportPartnerInfoSrvInputItem> inputItemList = req.getSB_EIP_EIP_ImportPartnerInfoSrvInputCollection().getSB_EIP_EIP_ImportPartnerInfoSrvInputItem();
if(inputItemList!=null&&inputItemList.size()>500){
rspObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
rspObj.setINSTANCE_ID(new BigDecimal(0));
rspObj.setSERVICE_MESSAGE("数据超过500条");
map.put("resultCode", Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put("resultMsg", "数据超过500条");
map.put("retObj", rspObj);
return map;
}
/*
* 2-1
* 校验消息头,成功则解析消息体,失败则返回错误信息
*/
MsgHeader partnerInfoHeader = req.getMsgHeader();
Map<String,Object> retMap = BucUtil.confirmHead(partnerInfoHeader);
if(new Boolean(retMap.get(Constants.retMap_TAG).toString())){
/*
* 2-2校验消息体
*/
for(int i =0;i<inputItemList.size();i++){
SB_EIP_EIP_ImportPartnerInfoSrvInputItem inputItem = inputItemList.get(i);
Map<String, Object> retmap = confirmBean(inputItem);
if (new Boolean(retmap.get(Constants.retMap_TAG).toString())) {
// 体信息校验成功
// 判断操作类型
// //转换省分编码
// String province_code = DbUtil.queryForString("SELECT area_code FROM int_ou_code where m_area_code='"+inputItem.getPROVINCE_NAME()+"' ", null);
// inputItem.setPROVINCE_NAME(province_code);
String province_code = DbUtil.queryForString("select code_value from cfg_code_trans where code_comments like '%"+inputItem.getPROVINCE_NAME()+"%' and code_type = 'SOA_AREA'", null);
logger.info("query province_code:"+"select code_value from cfg_code_trans where code_comments like '%"+inputItem.getPROVINCE_NAME()+"%' and code_type = 'SOA_AREA'");
System.out.println("query province_code:"+"select code_value from cfg_code_trans where code_comments like '%"+inputItem.getPROVINCE_NAME()+"%' and code_type = 'SOA_AREA'");
inputItem.setPROVINCE_NAME(province_code);
//1 新建
if (inputItem.getOPERATE_TYPE().intValue()==1) {
try {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
if (getService().isExist(inputItem.getPARTNER_MDM_CODE())) {
/*
// 已经存在代理商信息 直接放入错误列表
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("此代理商已经存在");
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
*/
//修改
getService().updatePartner(inputItem);
} else {
// CenterFactory.pushCenterInfo(
// Constants.DATASOURCE_CENTER, "99");
if(inputItem.getPARENT_CODE()!=null&&inputItem.getPARENT_CODE().length()>0){
if(getService().isExist(inputItem.getPARENT_CODE())){
getService().addPartner(inputItem);
respItem = new ResponseItem();
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
respList.add(respItem);
}else{
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("此代理商父代理商不存在");
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
}
}else{
getService().addPartner(inputItem);
respItem = new ResponseItem();
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
respList.add(respItem);
}
}
} catch (Exception e) {
e.printStackTrace();
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("处理失败:"+e.getMessage());
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
}
} else if (inputItem.getOPERATE_TYPE().intValue()==2) {
try {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
if (getService().isExist(inputItem.getPARTNER_MDM_CODE())) {
if(inputItem.getPARENT_CODE()!=null&&inputItem.getPARENT_CODE().length()>0){
if(getService().isExist(inputItem.getPARENT_CODE())){
getService().updatePartner(inputItem);
// 修改成功,返回结果
respItem = new ResponseItem();
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
respList.add(respItem);
}else{
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("此代理商父代理商不存在");
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
}
}else{
getService().updatePartner(inputItem);
// 修改成功,返回结果
respItem = new ResponseItem();
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
respList.add(respItem);
}
} else {
//marked by zhangfan
//如果不存在则插入,因为存在运营商转代理商的情况
// errorItem = new ErrorItem();
// errorItem.setERROR_MESSAGE("该代理商信息不存在");
// errorItem.setBATCH_ID(inputItem.getBATCH_ID());
// errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
// errorItem.setPRI_KEY(inputItem.getPRI_KEY());
// errorItem.setENTITY_NAME("PARTNER");
// errorList.add(errorItem);
if(inputItem.getPARENT_CODE()!=null&&inputItem.getPARENT_CODE().length()>0){
if(getService().isExist(inputItem.getPARENT_CODE())){
getService().addPartner(inputItem);
respItem = new ResponseItem();
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
respList.add(respItem);
}else{
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("此代理商父代理商不存在");
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
}
}else{
getService().addPartner(inputItem);
respItem = new ResponseItem();
respItem.setBATCH_ID(inputItem.getBATCH_ID());
respItem.setPRI_KEY(inputItem.getPRI_KEY());
respItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
respList.add(respItem);
}
}
} catch (Exception e) {
e.printStackTrace();
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("处理失败:"+e.getMessage());
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
}
}else{
errorItem = new ErrorItem();
errorItem.setERROR_MESSAGE("没有该操作类型:"+inputItem.getOPERATE_TYPE());
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setENTITY_NAME("PARTNER");
errorList.add(errorItem);
}
}else{
// 体信息错误,返回错误信息
// 放入错误列表
errorItem = new ErrorItem();
errorItem.setENTITY_NAME("PARTNER");
errorItem.setBATCH_ID(inputItem.getBATCH_ID());
errorItem.setPRI_KEY(inputItem.getPRI_KEY());
errorItem.setPARTNER_MDM_CODE(inputItem.getPARTNER_MDM_CODE());
errorItem.setERROR_MESSAGE(BucUtil
.getStringForList((List<String>) retmap
.get(Constants.retMap_ERRORList)));
errorList.add(errorItem);
}
}
}else{
for (int i = 0; i < inputItemList.size(); i++) {
errorItem = new ErrorItem();
errorItem.setENTITY_NAME("PARTNER");
errorItem.setBATCH_ID(inputItemList.get(i).getBATCH_ID());
errorItem.setPRI_KEY(inputItemList.get(i).getPRI_KEY());
errorItem.setPARTNER_MDM_CODE(inputItemList.get(i)
.getPARTNER_MDM_CODE());
// errorItem.setERROR_MESSAGE("头信息错误");
errorItem.setERROR_MESSAGE(BucUtil
.getStringForList((List<String>) retMap
.get(Constants.retMap_ERRORList)));
errorList.add(errorItem);
}
errorCol.setErrorItem(errorList);
rspObj.setErrorCollection(errorCol);
// repObj.setResponseCollection(respCol);
rspObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
rspObj.setSERVICE_MESSAGE("头信息格式错误");
rspObj.setINSTANCE_ID(new BigDecimal(0));
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
map.put(Constants.MapResult.MAP_RESULTMSG, "处理失败");
map.put(Constants.MapResult.MAP_RESULTOBJ, rspObj);
return map;
}
if (errorList.size()==0) {
rspObj.setSERVICE_MESSAGE("处理成功");
rspObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_TRUE);
respCol.setResponseItem(respList);
result_desc = "处理成功";
}else {
//没有全错
if(errorList.size()!=inputItemList.size()){
respCol.setResponseItem(respList);
}
errorCol.setErrorItem(errorList);
rspObj.setSERVICE_MESSAGE("处理失败");
rspObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
result_desc = "处理结果:"+respList.size()+"条成功,"+errorList.size()+"条失败";
}
rspObj.setINSTANCE_ID(new BigDecimal(0));
rspObj.setErrorCollection(errorCol);
rspObj.setResponseCollection(respCol);
if(errorList.size()>0){
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
}else{
map.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_SUCCESSFUL);
}
map.put(Constants.MapResult.MAP_RESULTMSG, result_desc);
map.put(Constants.MapResult.MAP_RESULTOBJ, rspObj);
return map;
}
@Override
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
return null;
}
private Map<String, Object> confirmBean(
SB_EIP_EIP_ImportPartnerInfoSrvInputItem item) {
boolean temp = true;
List<String> errorList = new ArrayList();
Map<String, Object> map = new HashMap<String, Object>();
if(item.getPARTNER_ROLE_INFO()!=null){
if(item.getPARTNER_ROLE_INFO().getPARTNER_ROLE_INFOItem()!=null){
boolean isAgent = false;
for(int i =0;i<item.getPARTNER_ROLE_INFO().getPARTNER_ROLE_INFOItem().size();i++){
if(item.getPARTNER_ROLE_INFO().getPARTNER_ROLE_INFOItem().get(i).getPARTNER_ROLE_TYPE().intValue()==3){
isAgent = true;
}
}
if(!isAgent){
temp = false;
errorList.add("非代理商信息,渠道不予保存");
map.put(Constants.retMap_TAG, temp);
map.put(Constants.retMap_ERRORList, errorList);
return map;
}
}
}
if (item.getPRI_KEY() == null || item.getPRI_KEY().length() == 0) {
temp = false;
errorList.add("PRI_KEY不能为空");
}
if (item.getPRI_KEY()!=null && item.getPRI_KEY().length()>60) {
temp = false;
errorList.add("PRI_KEY大于60位");
}
if (item.getBATCH_ID() == null || item.getBATCH_ID().length() == 0) {
temp = false;
errorList.add("BATCH_ID不能为空");
}
if (item.getBATCH_ID()!= null && item.getBATCH_ID().length()>60) {
temp = false;
errorList.add("BATCH_ID 大于60位");
}
if (item.getOPERATE_TYPE() == null) {
temp = false;
errorList.add("OPERATE_TYPE不能为空");
}
if ((item.getOPERATE_TYPE() != null && item.getOPERATE_TYPE().intValue()!=1)&&(item.getOPERATE_TYPE() != null && item.getOPERATE_TYPE().intValue()!=2)) {
temp = false;
errorList.add("OPERATE_TYPE数据不合法");
}
if (item.getPARTNER_ID() == null) {
temp = false;
errorList.add("PARTNER_ID不能为空");
}
if (item.getPARTNER_MDM_CODE() == null || item.getPARTNER_MDM_CODE().length() == 0) {
temp = false;
errorList.add("PARTNER_MDM_CODE不能为空");
}
if (item.getPARTNER_MDM_CODE()!= null && item.getPARTNER_MDM_CODE().length()>20) {
temp = false;
errorList.add("PARTNER_MDM_CODE大于20位");
}
if (item.getPARTNER_TYPE() == null ) {
temp = false;
errorList.add("PARTNER_TYPE不能为空");
}
if(item.getPARTNER_NAME() == null || item.getPARTNER_NAME().length() == 0){
temp = false;
errorList.add("PARTNER_NAME不能为空");
}
if (item.getPARTNER_NAME() != null && item.getPARTNER_NAME().length()>255){
temp = false;
errorList.add("PARTNER_NAME大于255位");
}
if (item.getTAX_TYPE() == null || item.getTAX_TYPE().length() == 0) {
temp = false;
errorList.add("TAX_TYPE不能为空");
}
if (item.getTAX_TYPE()!= null && item.getTAX_TYPE().length()>2) {
temp = false;
errorList.add("TAX_TYPE大于2位");
}else{
if(item.getTAX_TYPE().equals("1")||item.getTAX_TYPE().equals("2")){
if (item.getTAX_CODE() == null || item.getTAX_CODE().length() == 0) {
temp = false;
errorList.add("TAX_CODE不能为空");
}
if (item.getTAX_CODE()!= null && item.getTAX_CODE().length()>30) {
temp = false;
errorList.add("TAX_CODE大于30位");
}
}
}
if (item.getSTATUS() == null ) {
temp = false;
errorList.add("STATUS不能为空");
}else{
if(item.getSTATUS().intValue() > 2){
temp = false;
errorList.add("STATUS值非法");
}
}
if (item.getCREATION_BY() == null ) {
temp = false;
errorList.add("CREATION_BY不能为空");
}
if (item.getCREATE_DATE() == null ) {
temp = false;
errorList.add("CREATE_DATE不能为空");
}
if (item.getLAST_UPDATE_BY() == null ) {
temp = false;
errorList.add("LAST_UPDATE_BY不能为空");
}
if (item.getLAST_UPDATE_DATE() == null ) {
temp = false;
errorList.add("LAST_UPDATE_DATE不能为空");
}
if (item.getPARTNER_ROLE_INFO()== null ) {
temp = false;
errorList.add("PARTNER_ROLE_INFO不能为空");
}
if (item.getPARTNER_ROLE_INFO()!= null ) {
List<PARTNER_ROLE_INFOItem> list = item.getPARTNER_ROLE_INFO().getPARTNER_ROLE_INFOItem();
if(list!=null&&list.size()>0){
for(int i =0;i<list.size();i++){
PARTNER_ROLE_INFOItem roleInfoItem = list.get(i);
if(roleInfoItem.getPRI_KEY()==null||roleInfoItem.getPRI_KEY().length()==0){
temp = false;
errorList.add("角色 PRI_KEY 不能为空");
}
if(roleInfoItem.getPRI_KEY()!=null&&roleInfoItem.getPRI_KEY().length()>60){
temp = false;
errorList.add("角色 PRI_KEY 长度大于60");
}
if(roleInfoItem.getBATCH_ID()==null||roleInfoItem.getBATCH_ID().length()==0){
temp = false;
errorList.add("角色 BATCH_ID 不能为空");
}
if(roleInfoItem.getBATCH_ID()!=null&&roleInfoItem.getBATCH_ID().length()>60){
temp = false;
errorList.add("角色 BATCH_ID 长度大于60");
}
if(roleInfoItem.getPARTNER_ROLE_ID()==null){
temp = false;
errorList.add("角色 PARTNER_ROLE_ID 不能为空");
}
if(roleInfoItem.getPARTNER_ID()==null){
temp = false;
errorList.add("角色 PARTNER_ID 不能为空");
}
if(roleInfoItem.getCHANGE_TYPE()==null){
temp = false;
errorList.add("角色 CHANGE_TYPE 不能为空");
}
if(roleInfoItem.getPARTNER_ROLE_TYPE()==null){
temp = false;
errorList.add("角色 PARTNER_ROLE_TYPE 不能为空");
}
if(roleInfoItem.getREG_PROV_CODE()==null||roleInfoItem.getREG_PROV_CODE().length()==0){
temp = false;
errorList.add("角色 REG_PROV_CODE 不能为空");
}
if(roleInfoItem.getREG_PROV_CODE()!=null&&roleInfoItem.getREG_PROV_CODE().length()>2){
temp = false;
errorList.add("角色 REG_PROV_CODE 长度大于2");
}
}
}else{
temp = false;
errorList.add("PARTNER_ROLE_INFOItem不能为空");
}
}
if (item.getPARTNER_BANK_INFO()!= null ) {
List<PARTNER_BANK_INFOItem> list = item.getPARTNER_BANK_INFO().getPARTNER_BANK_INFOItem();
if(list!=null&&list.size()>0){
for(int i =0;i<list.size();i++){
PARTNER_BANK_INFOItem bankInfoItem = list.get(i);
if(bankInfoItem.getPRI_KEY()==null||bankInfoItem.getPRI_KEY().length()==0){
temp = false;
errorList.add("银行账号 PRI_KEY 不能为空");
}
if(bankInfoItem.getPRI_KEY()!=null&&bankInfoItem.getPRI_KEY().length()>60){
temp = false;
errorList.add("银行账号 PRI_KEY 长度大于60");
}
if(bankInfoItem.getBATCH_ID()==null||bankInfoItem.getBATCH_ID().length()==0){
temp = false;
errorList.add("银行账号 BATCH_ID 不能为空");
}
if(bankInfoItem.getBATCH_ID()!=null&&bankInfoItem.getBATCH_ID().length()>60){
temp = false;
errorList.add("银行账号 BATCH_ID 长度大于60");
}
if(bankInfoItem.getPARTNER_BANK_ID()==null){
temp = false;
errorList.add("银行账号 PARTNER_BANK_ID 不能为空");
}
if(bankInfoItem.getPARTNER_ID()==null){
temp = false;
errorList.add("银行账号 PARTNER_ID 不能为空");
}
if(bankInfoItem.getACCOUNT_NUMBER()==null){
temp = false;
errorList.add("银行账号 ACCOUNT_NUMBER 不能为空");
}
if(bankInfoItem.getACCOUNT_NAME()==null){
temp = false;
errorList.add("银行账号 ACCOUNT_NAME 不能为空");
}
if(bankInfoItem.getBANK_NAME()==null){
temp = false;
errorList.add("银行账号 BANK_NAME 不能为空");
}
if(bankInfoItem.getBANK_BRANCH_NAME()==null){
temp = false;
errorList.add("银行账号 BANK_BRANCH_NAME 不能为空");
}
}
}
}
if((item.getPARTNER_TYPE().equals("1")) && (item.getLEGAL_REPRESENTATIVE()==null||item.getLEGAL_REPRESENTATIVE().length()==0)){
/*
temp = false;
errorList.add("渠道侧需要 LEGAL_REPRESENTATIVE不能为空");
*/
}
if(item.getLEGAL_REPRESENTATIVE()!=null&&item.getLEGAL_REPRESENTATIVE().length()>100){
temp = false;
errorList.add("LEGAL_REPRESENTATIVE大于100位");
}
if((item.getPARTNER_TYPE().equals("1")) && (item.getLICENSE_CODE()==null||item.getLICENSE_CODE().length()==0)){
/*
temp = false;
errorList.add("渠道侧需要 LICENSE_CODE不能为空");
*/
}
if(item.getLICENSE_CODE()!=null&&item.getLICENSE_CODE().length()>30){
temp = false;
errorList.add("LICENSE_CODE大于30位");
}
if(item.getENROLL_FUND()==null){
/*
temp = false;
errorList.add("渠道侧需要 ENROLL_FUND不能为空");
*/
}
if((item.getPARTNER_TYPE().equals("1")) && (item.getPHONE_NUMBER()==null||item.getPHONE_NUMBER().length()==0)){
/*
temp = false;
errorList.add("渠道侧需要 PHONE_NUMBER 不能为空");
*/
}
if(item.getPHONE_NUMBER()!=null&&item.getPHONE_NUMBER().length()>60){
temp = false;
errorList.add("PHONE_NUMBER 大于60位");
}
if((item.getPARTNER_TYPE().equals("1")) && (item.getREG_ADDRESS()==null||item.getREG_ADDRESS().length()==0)){
/*
temp = false;
errorList.add("渠道侧需要 REG_ADDRESS 不能为空");
*/
}
if(item.getREG_ADDRESS()!=null&&item.getREG_ADDRESS().length()>500){
temp = false;
errorList.add("REG_ADDRESS 大于500位");
}
if(item.getPROVINCE_NAME()==null||item.getPROVINCE_NAME().length()==0){
temp = false;
errorList.add("渠道侧需要 PROVINCE_NAME 不能为空");
}
/*
if(item.getPROVINCE_NAME()!=null&&item.getPROVINCE_NAME().length()>2){
temp = false;
errorList.add("PROVINCE_NAME 大于2位");
}
*/
// if(item.getCITY_NAME()==null||item.getCITY_NAME().length()==0){
// temp = false;
// errorList.add("渠道侧需要 CITY_NAME 不能为空");
// }
// if(item.getCITY_NAME()!=null&&item.getCITY_NAME().length()>100){
// temp = false;
// errorList.add("CITY_NAME 大于100位");
// }
if(item.getPARTNER_CONTACT_INFO()==null){
temp = false;
errorList.add("渠道侧需要 PARTNER_CONTACT_INFO不能为空");
if(item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem()==null||item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().size()==0){
temp = false;
errorList.add("渠道侧需要 PARTNER_CONTACT_INFOItem不能为空");
}else{
if(item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getRELATION_NAME()==null||item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getRELATION_NAME().length()==0){
temp = false;
errorList.add("渠道侧需要 PARTNER_CONTACT_INFOItem RELATION_NAME 不能为空");
}
if(item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getRELATION_NAME()!=null&&item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getRELATION_NAME().length()>60){
temp = false;
errorList.add("PARTNER_CONTACT_INFOItem RELATION_NAME 大于60位");
}
if(item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getTELEPHONE()==null&&item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getMOBILE()==null){
temp = false;
errorList.add("渠道侧需要 PARTNER_CONTACT_INFOItem TELEPHONE和MOBILE 不能同时为空");
}
if(item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getTELEPHONE()!=null&&item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getTELEPHONE().length()>60){
temp = false;
errorList.add("PARTNER_CONTACT_INFOItem TELEPHONE 大于60位");
}
if(item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getMOBILE()!=null&&item.getPARTNER_CONTACT_INFO().getPARTNER_CONTACT_INFOItem().get(0).getMOBILE().length()>60){
temp = false;
errorList.add("PARTNER_CONTACT_INFOItem MOBILE 大于60位");
}
}
}
//System.out.println("这是字节的输出"+item.getBANK_NAME().getBytes().length);
if (item.getPARTNER_FILE_INFO() != null ) {
List<PARTNER_FILE_INFOItem> list = item.getPARTNER_FILE_INFO().getPARTNER_FILE_INFOItem();
if(list!=null&&list.size()>0){
for(int i =0;i<list.size();i++){
PARTNER_FILE_INFOItem fileInfoItem = list.get(i);
if(fileInfoItem.getPRI_KEY()==null||fileInfoItem.getPRI_KEY().length()==0){
temp = false;
errorList.add("文件 PRI_KEY 不能为空");
}
if(fileInfoItem.getPRI_KEY()!=null&&fileInfoItem.getPRI_KEY().length()>60){
temp = false;
errorList.add("文件 PRI_KEY 长度大于60");
}
if(fileInfoItem.getBATCH_ID()==null||fileInfoItem.getBATCH_ID().length()==0){
temp = false;
errorList.add("文件 BATCH_ID 不能为空");
}
if(fileInfoItem.getBATCH_ID()!=null&&fileInfoItem.getBATCH_ID().length()>60){
temp = false;
errorList.add("文件 BATCH_ID 长度大于60");
}
if(fileInfoItem.getPARTNER_ID()==null){
temp = false;
errorList.add("文件 PARTNER_ID 不能为空");
}
if(fileInfoItem.getCERT_TYPE()==null){
temp = false;
errorList.add("文件 CERT_TYPE 不能为空");
}
if(fileInfoItem.getFILE_ADDRESS()==null){
temp = false;
errorList.add("文件 FILE_ADDRESS 不能为空");
}
}
}
}
map.put(Constants.retMap_TAG, temp);
map.put(Constants.retMap_ERRORList, errorList);
return map;
}
public IImportPartnerInfoSV getService() {
return (IImportPartnerInfoSV) ServiceFactory
.getService(IImportPartnerInfoSV.class);
}
public static void main(String[] args){
ImportPartnerInfoAction action = new ImportPartnerInfoAction();
SB_EIP_EIP_ImportPartnerInfoSrvInputItem item = new SB_EIP_EIP_ImportPartnerInfoSrvInputItem();
try {
CenterFactory.pushCenterInfo(
Constants.DATASOURCE_CENTER, "99");
// String agentId = MaxIdUtil.getSequenceNextVal2("tf_chl_agent$key_seq");
// System.out.println(agentId);
// item.setPARTNER_MDM_CODE("123456789");
// item.setCITY_NAME("111308");
// item.setPARTNER_NAME("zzzzsszz");
// item.setPARTNER_TYPE(new BigDecimal(1));
// item.setREG_ADDRESS("aaaaaaaaaaaa");
// item.setPROVINCE_NAME("13");
// item.setSTATUS(new BigDecimal(1));
// PARTNER_CONTACT_INFO cinfo = new PARTNER_CONTACT_INFO();
// PARTNER_CONTACT_INFOItem citem = new PARTNER_CONTACT_INFOItem();
// citem.setADDRESS("bbbbb");
// citem.setMOBILE("1231231");
// List list = new ArrayList();
// list.add(citem);
// cinfo.setPartnerCONTACTINFOItem(list);
// item.setPARTNER_CONTACT_INFO(cinfo);
// action.getService().addPartner(item);
// action.getService().getSequence("tf_chl_agent$key_seq");
} catch (Exception e) {
e.printStackTrace();
}
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package com.unicom.wouchannel.inquiryagentauditinfosrv;
import java.util.HashMap;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.recif.IRecIfProcessorSRV;
import com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvOUT;
/**
* This class was generated by Apache CXF 2.3.5
* 2014-07-15T16:44:40.785+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "InquiryAgentAuditInfoSrvService",
portName = "InquiryAgentAuditInfoSrvPort",
targetNamespace = "http://wouchannel.unicom.com/InquiryAgentAuditInfoSrv",
// wsdlLocation = "file:/D:/src/workspace/uip-uc_dev/wsdl/InquiryAgentAuditInfoSrv/inquiryAgentAuditInfoSrv.wsdl",
wsdlLocation = "classpath:wsdl/InquiryAgentAuditInfoSrv/inquiryAgentAuditInfoSrv.wsdl",
endpointInterface = "com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrv")
public class InquiryAgentAuditInfoSrvImpl implements InquiryAgentAuditInfoSrv {
private static final Logger LOG = Logger.getLogger(InquiryAgentAuditInfoSrvImpl.class.getName());
/* (non-Javadoc)
* @see com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrv#process(com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvIN payload )*
*/
public com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvOUT process(InquiryAgentAuditInfoSrvIN payload) {
LOG.info("Executing operation process");
System.out.println(payload);
try {
IRecIfProcessorSRV recIfProcessorSRV = (IRecIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.WO_UC_InquiryAgentAuditInfoSrvOUT, payload);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
InquiryAgentAuditInfoSrvOUT _return = (InquiryAgentAuditInfoSrvOUT)map.get(Constants.MapResult.MAP_RESULTOBJ);
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>
package com.unicom.wouchannel.qryagentwoegomargininfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* <pre>
* <complexType name="qryAgentWOEGOMarginInfoSrvIn">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="INMSGCONTENT" type="{http://wouchannel.unicom.com/QryAgentWOEGOMarginInfoSrv}qryAgentWOEGOMarginInfoSrvINMSGCONTENT" minOccurs="0"/>
* <element name="MSGHEADER" type="{http://wouchannel.unicom.com/QryAgentWOEGOMarginInfoSrv}msgheader" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "qryAgentWOEGOMarginInfoSrvIn", propOrder = {
"inmsgcontent",
"msgheader"
})
public class QryAgentWOEGOMarginInfoSrvIn {
@XmlElement(name = "INMSGCONTENT")
protected QryAgentWOEGOMarginInfoSrvINMSGCONTENT inmsgcontent;
@XmlElement(name = "MSGHEADER")
protected Msgheader msgheader;
/**
*
* @return
* possible object is
* {@link QryAgentWOEGOMarginInfoSrvINMSGCONTENT }
*
*/
public QryAgentWOEGOMarginInfoSrvINMSGCONTENT getINMSGCONTENT() {
return inmsgcontent;
}
/**
*
* @param value
* allowed object is
* {@link QryAgentWOEGOMarginInfoSrvINMSGCONTENT }
*
*/
public void setINMSGCONTENT(QryAgentWOEGOMarginInfoSrvINMSGCONTENT value) {
this.inmsgcontent = value;
}
/**
*
* @return
* possible object is
* {@link Msgheader }
*
*/
public Msgheader getMSGHEADER() {
return msgheader;
}
/**
*
* @param value
* allowed object is
* {@link Msgheader }
*
*/
public void setMSGHEADER(Msgheader value) {
this.msgheader = value;
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.agencypaytadeser;
import java.util.logging.Logger;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-07-01T10:39:34.383+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "AgencyPayTadeSer",
portName = "AgencyPayTadeSerHttpEndpoint",
targetNamespace = "http://ws.chinaunicom.cn/AgencyPayTadeSer/",
// wsdlLocation = "file:/D:/workspace/workspace_yaxin/uip_invoice/wsdl/AgencyPayTadeSer/META-INF/AgencyPayTadeSer.wsdl",
endpointInterface = "cn.chinaunicom.ws.agencypaytadeser.AgencyPayTadeSerPortType")
public class AgencyPayTadeSerPortTypeImpl implements AgencyPayTadeSerPortType {
private static final Logger LOG = Logger.getLogger(AgencyPayTadeSerPortTypeImpl.class.getName());
/* (non-Javadoc)
* @see cn.chinaunicom.ws.agencypaytadeser.AgencyPayTadeSerPortType#agencySignCallTade(cn.chinaunicom.ws.agencypaytadeser.body.AGENCY_SIGN_CALL_TADE_INPUT parameters )*
*/
public cn.chinaunicom.ws.agencypaytadeser.body.AGENCY_SIGN_CALL_TADE_OUTPUT agencySignCallTade(cn.chinaunicom.ws.agencypaytadeser.body.AGENCY_SIGN_CALL_TADE_INPUT parameters) {
LOG.info("Executing operation agencySignCallTade");
System.out.println(parameters);
try {
IPenetrationIfProcessorSRV penetrationIfProcessorSRV= (IPenetrationIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV");
Object obj = penetrationIfProcessorSRV.ifMsgProcessorForService(Constants.Agent.AGENCY_SIGN_CALL_TADE, parameters);
return (cn.chinaunicom.ws.agencypaytadeser.body.AGENCY_SIGN_CALL_TADE_OUTPUT)obj;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.ftpFile;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import com.ai.appframe2.common.ServiceManager;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.common.bo.TD_M_AREABean;
import com.ai.uchintService.common.bo.TD_M_AREAEngine;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uchintService.ftpFile.timer.TimerUtil;
import com.ai.uip.core.bo.UipAccessSystemBean;
import com.ai.uip.core.bo.UipAccessSystemEngine;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.core.bo.UipSubsBean;
import com.ai.uip.core.bo.UipSubsEngine;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.core.bo.UipSyncRecordEngine;
import com.ai.uip.core.util.MaxIdUtil;
import com.ai.uip.platform.IReleaseTimerBase;
/**
* ERP文件接口:预提-查询订阅表生成发布记录
*
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Aug 26, 2011
*/
public class ERPReleaseTimerWithholding implements IReleaseTimerBase {
public void releaseRecord(UipOperateBean uipOperateBean) {
try {
TimerUtil timer = new TimerUtil();
//时间间隔
long interval = 1;
//最后期限
String endTime = "";
String sql1 = "select param_value from uc_query_time where query_name='ERP_NEXT_TIMER_Withholding'";
String sql2 = "select param_value from uc_query_time where query_name='ERP_END_TIME_Withholding'";
String timerStr = DbUtil.queryForString(sql1, null);
endTime = DbUtil.queryForString(sql2, null);
if (timerStr==null || timerStr.equals("")) {
return;
//throw new Exception("参数未配置");
}
if (endTime==null || endTime.equals("")) {
return;
//throw new Exception("参数未配置");
}
String newDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date(System.currentTimeMillis()));
for(String str:timerStr.split("\\*")){
interval =interval*Long.parseLong(str);
}
//String acctMonth = CastUtil.getAcct(1);
timer.schedule(interval, "com.ai.uchintService.ftpFile.ERPReleaseTimerWithholding",
"timer",uipOperateBean,newDate+" "+endTime,1);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public void timer(UipOperateBean uipOperateBean,String province_code,long dataType,String chlAreaCode) {
try {
String acctMonth = CastUtil.getAcct((int)dataType);
//佣金计算的数据已生成
if (acctMonth!=null && !acctMonth.equals("")) {
//开启事务
ServiceManager.getSession().startTransaction();
createFileByArea(uipOperateBean,acctMonth,province_code,dataType,chlAreaCode);
//提交事务
ServiceManager.getSession().commitTransaction();
}
} catch (Exception e) {
try {
ServiceManager.getSession().rollbackTransaction();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
/**
* 根据地域生成文件
*/
public void createFileByArea(UipOperateBean uipOperateBean,String acctMonth,
String province_code,long dataType,String chlAreaCode) {
boolean flag = true;
try {
//获取当前主题当前省份的订阅记录
UipSubsBean uipSubsBeans[] = UipSubsEngine.getBeans("SUBJECT_ID = '"+uipOperateBean.getSubjectId()+
"' and OPERATE_ID = " + uipOperateBean.getOperateId()+" and DATA_SCOPE='"+province_code+"' " ,null);
for (int i = 0; i < uipSubsBeans.length; i++) {
UipSyncRecordBean recordBean = new UipSyncRecordBean();
long recordId = Long.parseLong(MaxIdUtil.getSequenceNextVal("record_id"));
recordBean.setRecordId(recordId);
recordBean.setSubjectId(Constants.ERPFtpFileSubjectId.SUBJECT_ID_WITHHOLDING);
recordBean.setMonth(acctMonth);
recordBean.setProvinceCode(uipSubsBeans[i].getDataScope());
recordBean.setCityCode(uipSubsBeans[i].getCityCode());
recordBean.setContentKind("04");
recordBean.setContentId("0");
recordBean.setBatchNo(0);
recordBean.setSyncType("1");
recordBean.setInsertTime(new Timestamp(new Date().getTime()));
recordBean.setState("00");
recordBean.setLockStatus(0);
recordBean.isNew();
UipSyncRecordEngine.save(recordBean);
}
} catch (Exception e) {
flag = false;
e.printStackTrace();
} finally {
if (flag) {
//更新int_erp_data_create表当前账期当前主题当前省份的数据为已处理
String sql = "update int_erp_data_create set flag=1 where acct_month='"+acctMonth
+"' and data_type="+dataType+" and province_code='"+chlAreaCode+"'";
DbUtil.exeSQL(sql, null);
}
}
}
/**
* 添加订阅表信息,逻辑:
* 根据各省份,地市,插入数据
*/
public void addSubs() {
try {
//各省份信息
TD_M_AREABean[] area_province = TD_M_AREAEngine.getBeans("parent_area_code = '09'", new HashMap());
for (int i = 0; i < area_province.length; i++) {
String province_code = area_province[i].getAreaCode();
//地市信息
TD_M_AREABean[] area_city = TD_M_AREAEngine.getBeans("parent_area_code = " + province_code,new HashMap());
//通过省份编码找system select * from uip_access_system where province_code='19'
UipAccessSystemBean[] systemBean = UipAccessSystemEngine.getBeans("province_code='"+province_code+"'", new HashMap());
for (int j = 0; j < area_city.length; j++) {
//往订阅表中插入数据
UipSubsBean subsBean = new UipSubsBean();
subsBean.setOperateId(1000);
subsBean.setSubjectId(100);
if (systemBean!=null && systemBean.length>0) {
subsBean.setSystemId(systemBean[0].getSystemId());
} else {
subsBean.setSystemId(310);
}
subsBean.setSubsTime(new Timestamp(System.currentTimeMillis()));
subsBean.setSubsStatus(0);
subsBean.setFilePath("ftp://zhanggy2:unix3333@10.1.247.2/unibss/devusers/zhanggy2/ftpFile/11");
subsBean.setDataScope(area_province[i].getAreaCode());
subsBean.setCityCode(area_city[j].getAreaCode());
subsBean.setSubsId(Long.parseLong(MaxIdUtil.getSequenceNextVal("record_id")));
UipSubsEngine.save(subsBean);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.util.List;
import com.ai.uchintService.common.bo.UC_TF_CHL_CHANNELBean;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvInputItem;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvResponse;
import com.unicom.mss.soa.msgheader.MsgHeader;
public interface IPaymentResultInfoSV {
public boolean updatePamentRecord(SB_UC_UC_ImportPaymentResultInfoSrvInputItem s ,MsgHeader paymetResultInfoHead) throws Exception;
public SB_UC_UC_ImportPaymentResultInfoSrvResponse importPaymentResultInfo(List<SB_UC_UC_ImportPaymentResultInfoSrvInputItem> paymetResultInfoList,MsgHeader paymetResultInfoHead );
public boolean changeAreaCode(String areaCode) throws Exception;
public UC_TF_CHL_CHANNELBean getChlbean(String ChnlCode) throws Exception;
public boolean compareVoucherNumber(SB_UC_UC_ImportPaymentResultInfoSrvInputItem paymetResultInfoItem);
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IUC_TF_CHL_PAY_APPLYValue extends DataStructInterface{
public final static String S_PayObjectType = "PAY_OBJECT_TYPE";
public final static String S_PayObjectId = "PAY_OBJECT_ID";
public final static String S_DeptType = "DEPT_TYPE";
public final static String S_UpdateRemark = "UPDATE_REMARK";
public final static String S_UpdateDate = "UPDATE_DATE";
public final static String S_PayRemark = "PAY_REMARK";
public final static String S_PayState = "PAY_STATE";
public final static String S_PayDepartId = "PAY_DEPART_ID";
public final static String S_UpdateDepartId = "UPDATE_DEPART_ID";
public final static String S_BillNo = "BILL_NO";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_CityCode = "CITY_CODE";
public final static String S_BankAcctName = "BANK_ACCT_NAME";
public final static String S_PayStatMoney = "PAY_STAT_MONEY";
public final static String S_PayStaffId = "PAY_STAFF_ID";
public final static String S_BankNo = "BANK_NO";
public final static String S_PayBatchId = "PAY_BATCH_ID";
public final static String S_BankCode = "BANK_CODE";
public final static String S_SerialNo = "SERIAL_NO";
public final static String S_PayDate = "PAY_DATE";
public final static String S_TaxRate = "TAX_RATE";
public final static String S_PayMoney = "PAY_MONEY";
public final static String S_UpdateStaffId = "UPDATE_STAFF_ID";
public final static String S_LineNo = "LINE_NO";
public final static String S_VoucherNumber = "VOUCHER_NUMBER";
public final static String S_HasPayed = "HAS_PAYED";
public String getPayObjectType();
public String getPayObjectId();
public String getDeptType();
public String getUpdateRemark();
public Timestamp getUpdateDate();
public String getPayRemark();
public String getPayState();
public String getPayDepartId();
public String getUpdateDepartId();
public Long getBillNoAsLong();
public long getBillNo();
public String getProvinceCode();
public String getCityCode();
public String getBankAcctName();
public Double getPayStatMoneyAsDouble();
public double getPayStatMoney();
public String getPayStaffId();
public String getBankNo();
public String getPayBatchId();
public String getBankCode();
public Long getSerialNoAsLong();
public long getSerialNo();
public Timestamp getPayDate();
public Integer getTaxRateAsInteger();
public int getTaxRate();
public Double getPayMoneyAsDouble();
public double getPayMoney();
public String getUpdateStaffId();
public Integer getLineNoAsInteger();
public int getLineNo();
public String getVoucherNumber();
public void setPayObjectType(String value);
public void setPayObjectId(String value);
public void setDeptType(String value);
public void setUpdateRemark(String value);
public void setUpdateDate(Timestamp value);
public void setPayRemark(String value);
public void setPayState(String value);
public void setPayDepartId(String value);
public void setUpdateDepartId(String value);
public void setBillNo(Long value);
public void setBillNo(long value);
public void setProvinceCode(String value);
public void setCityCode(String value);
public void setBankAcctName(String value);
public void setPayStatMoney(Double value);
public void setPayStatMoney(double value);
public void setPayStaffId(String value);
public void setBankNo(String value);
public void setPayBatchId(String value);
public void setBankCode(String value);
public void setSerialNo(Long value);
public void setSerialNo(long value);
public void setPayDate(Timestamp value);
public void setTaxRate(Integer value);
public void setTaxRate(int value);
public void setPayMoney(Double value);
public void setPayMoney(double value);
public void setUpdateStaffId(String value);
public void setLineNo(Integer value);
public void setLineNo(int value);
public void setVoucherNumber(String value);
public Integer getHasPayedAsInteger();
public int getHasPayed();
public void setHasPayed(Integer value);
public void setHasPayed(int value);
}
<file_sep>
package com.unicom.wouchannel.qryagentwoegomargininfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* <pre>
* <complexType name="qryAgentWOEGOMarginInfoSrvINMSGCONTENT">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CITY_CODE" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="PROVINCE_CODE" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="reserved1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="reserved2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="reserved3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="reserved4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="reserved5" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="UC_CHNL_ID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "qryAgentWOEGOMarginInfoSrvINMSGCONTENT", propOrder = {
"citycode",
"prikey",
"provincecode",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5",
"ucchnlid"
})
public class QryAgentWOEGOMarginInfoSrvINMSGCONTENT {
@XmlElement(name = "CITY_CODE")
protected String citycode;
@XmlElement(name = "PRI_KEY")
protected String prikey;
@XmlElement(name = "PROVINCE_CODE")
protected String provincecode;
protected String reserved1;
protected String reserved2;
protected String reserved3;
protected String reserved4;
protected String reserved5;
@XmlElement(name = "UC_CHNL_ID")
protected String ucchnlid;
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITYCODE() {
return citycode;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITYCODE(String value) {
this.citycode = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRIKEY() {
return prikey;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRIKEY(String value) {
this.prikey = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCECODE() {
return provincecode;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCECODE(String value) {
this.provincecode = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getReserved1() {
return reserved1;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReserved1(String value) {
this.reserved1 = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getReserved2() {
return reserved2;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReserved2(String value) {
this.reserved2 = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getReserved3() {
return reserved3;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReserved3(String value) {
this.reserved3 = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getReserved4() {
return reserved4;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReserved4(String value) {
this.reserved4 = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getReserved5() {
return reserved5;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReserved5(String value) {
this.reserved5 = value;
}
/**
*
* @return
* possible object is
* {@link String }
*
*/
public String getUCCHNLID() {
return ucchnlid;
}
/**
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUCCHNLID(String value) {
this.ucchnlid = value;
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IInquiryUCInputVATMatchInfoSV;
import com.ai.uchintService.common.bo.INT_OU_CODEBean;
import com.ai.uchintService.common.bo.INT_OU_CODEEngine;
import com.ai.uchintService.common.bo.TF_CHL_INVOICE_PACKAGEBean;
import com.ai.uchintService.common.bo.TF_CHL_INVOICE_PACKAGEEngine;
import com.ai.uchintService.common.bo.UCH_TF_CHL_INVOICEBean;
import com.ai.uchintService.common.bo.UCH_TF_CHL_INVOICEEngine;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.core.bo.UipSyncRecordEngine;
import com.unicom.mss.sb_uc_uc_inquiryucinputvatmatchinfosrv.SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection;
import com.unicom.mss.sb_uc_uc_inquiryucinputvatmatchinfosrv.SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem;
public class InquiryUCInputVATMatchInfoSVImpl implements IInquiryUCInputVATMatchInfoSV{
@Override
public SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection getInvoiceByNumber(
String invoiceNo, String invoiceCode, String provinceCode)
throws Exception {
SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection outPutCol = new SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection();
String sqlProvinceCode = BucUtil.getCfgCodeValue(Constants.CFG_CODE_TRANS_SOA_AREA, provinceCode);
//设置sql
String sql = "INVOICE_NO = '"+invoiceNo+"' AND INVOICE_CODE = '"+invoiceCode+"' AND PROVINCE_CODE = '"+sqlProvinceCode+"'";
UCH_TF_CHL_INVOICEBean invoiceBeans[] = UCH_TF_CHL_INVOICEEngine.getBeans(sql, null);
System.out.println(sql);
if(!(invoiceBeans==null || invoiceBeans.length==0)){
for(int i=0;i<invoiceBeans.length;i++){
if(invoiceBeans[i]!=null){
SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem outPutItem = new SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem();
//省份代码
outPutItem.setPROVINCE_CODE(provinceCode);
//发票批号
outPutItem.setINVOICE_BATCH(invoiceBeans[i].getInvoiceBatch());
//发票代码
outPutItem.setINVOICE_CODE(invoiceBeans[i].getInvoiceCode());
//发票号码
outPutItem.setINVOICE_NO(invoiceBeans[i].getInvoiceNo());
//匹配状态
outPutItem.setMATCHING_STATUS(new BigDecimal(invoiceBeans[i].getInvoiceStatus()));
//支付批号
outPutItem.setPAY_BATCH(invoiceBeans[i].getInvoiceId());
//凭证号
outPutItem.setVOUCHER_NUMBER(invoiceBeans[i].getVoucherNo());
//总账日期
outPutItem.setACCOUNTING_DATE(invoiceBeans[i].getAccountingDate());
//最后更新日期
outPutItem.setLAST_UPDATE_DATE(invoiceBeans[i].getLastUpdateDate());
//封装返回值
outPutCol.getSB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem().add(outPutItem);
}
}
}else{
throw new Exception("未找到发票号码为 "+invoiceNo+" 的发票");
}
return outPutCol;
}
@Override
public SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection getInvoiceByDate(
String MprovinceCode,Date startUpdateDate, Date endUpdateDate, String provinceCode,
int pageSize, int currentPage, int totalRecord) throws Exception {
SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection outPutCol = new SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputCollection();
SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem outPutItem = new SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem();
// String sqlProvinceCode = BucUtil.getCfgCodeValue(Constants.CFG_CODE_TRANS_SOA_AREA, provinceCode);
//将日期类型转换成字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
String sqlStartDate = sdf.format(startUpdateDate);
String sqlEndDate = sdf.format(endUpdateDate);
//根据参数确定初始序号和结束序号
int startNum = pageSize*(currentPage-1);
int endNum = pageSize*currentPage;
//如果最后一页 结束序号为总条数
if(endNum>totalRecord){
endNum = totalRecord;
}
String sql = "select * from (select rownum rownum_, INVOICE_BATCH, INVOICE_CODE, INVOICE_NO, Invoice_Status, Voucher_No, ACCOUNTING_DATE, LAST_UPDATE_DATE, INVOICE_ID from tf_chl_invoice" +
" where UPDATE_DATE >= to_date('"+ sqlStartDate +"','yyyymmddhh24miss') and UPDATE_DATE <= to_date('"+ sqlEndDate +"','yyyymmddhh24miss') and PROVINCE_CODE = '"+provinceCode+"') where rownum_ > "+ startNum +" and rownum_ <= "+ endNum ;
Connection conn = null;
PreparedStatement ptmt = null;
// 创建resultset
ResultSet rset = null;
System.out.println(sql);
try{
conn = getConnection();
// 赋予实例
ptmt = conn.prepareStatement(sql);
rset = ptmt.executeQuery();
while(rset.next()){
System.out.println("aaaaaaaa");
//省份代码
outPutItem.setPROVINCE_CODE(MprovinceCode);
//发票批号
outPutItem.setINVOICE_BATCH(rset.getString("INVOICE_BATCH"));
//发票代码
outPutItem.setINVOICE_CODE(rset.getString("INVOICE_CODE"));
//发票号码
outPutItem.setINVOICE_NO(rset.getString("INVOICE_NO"));
//匹配状态
outPutItem.setMATCHING_STATUS(new BigDecimal(rset.getInt("INVOICE_STATUS")));
//支付批号
outPutItem.setPAY_BATCH(rset.getString("INVOICE_ID"));
//凭证号
outPutItem.setVOUCHER_NUMBER(rset.getString("VOUCHER_NO"));
//总账日期
outPutItem.setACCOUNTING_DATE(rset.getTimestamp("ACCOUNTING_DATE"));
//最后更新日期
outPutItem.setLAST_UPDATE_DATE(rset.getTimestamp("LAST_UPDATE_DATE"));
//封装返回值
outPutCol.getSB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem().add(outPutItem);
}
}catch(Exception e){
e.printStackTrace();
}finally{
try {
rset.close();
ptmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return outPutCol;
}
public Connection getConnection() throws SQLException {
Connection conn = ServiceManager.getSession().getConnection();
return conn;
}
@Override
public int getTotalRecord(Date startUpdateDate, Date endUpdateDate,String provinceCode)
throws Exception {
//将日期类型转换成字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
String sqlStartDate = sdf.format(startUpdateDate);
String sqlEndDate = sdf.format(endUpdateDate);
String sql = " UPDATE_DATE >= to_date('"+ sqlStartDate +"','yyyymmddhh24miss') and UPDATE_DATE <= to_date('"+ sqlEndDate +"','yyyymmddhh24miss') and province_code='"+provinceCode+"'";
int totalRecord = UCH_TF_CHL_INVOICEEngine.getBeansCount(sql, null);
System.out.println("总记录数="+totalRecord);
return totalRecord;
}
public INT_OU_CODEBean getINT_OU_CODEBean(String provinceCode) throws Exception{
return INT_OU_CODEEngine.getBean(provinceCode);
}
@Override
public TF_CHL_INVOICE_PACKAGEBean mateInvoiceByDate(INT_OU_CODEBean ouBean ,String provinceCode,String endDateStr) throws Exception {
TF_CHL_INVOICE_PACKAGEBean _bean = new TF_CHL_INVOICE_PACKAGEBean();
_bean.isNew();
_bean.setProvinceCode(provinceCode);
_bean.setOrgId(Long.valueOf(ouBean.getOrgId()));
_bean.setOrgName(ouBean.getOrgName());
_bean.setSetOfBooksId(ouBean.getSetOfBooksId());
_bean.setSetOfBooksName(ouBean.getSetOfBooksName());
_bean.setAttribute1(ouBean.getAttribute1());
Connection conn = null;
PreparedStatement ptmt = null;
ResultSet rset = null;
String countSql = "select sum(pure_amount) pure_amount,sum(tax_amount) tax_amount,sum(total_amount) total_amount,count(0) NUM from tf_chl_invoice where province_code='"+provinceCode+"' and update_date<=to_date('"+endDateStr+"','yyyyMMddhh24Miss')";
conn = getConnection();
ptmt = conn.prepareStatement(countSql);
rset = ptmt.executeQuery();
if(rset.next()){
if(rset.getInt("NUM")>0){
_bean.setSumPureAmount(rset.getFloat("pure_amount"));
_bean.setSumTaxAmount(rset.getFloat("tax_amount"));
_bean.setSumTotalAmount(rset.getFloat("total_amount"));
_bean.setTotalInvoice(rset.getInt("NUM"));
}else{
return null;
}
}
//1:按时间段和状态取发票信息,按照代理商分组
String agentListSql = "select vendor_num from tf_chl_invoice where invoice_status='0' and province_code ='"+provinceCode+"' and update_date<=to_date('"+endDateStr+"','yyyyMMddhh24Miss') group by vendor_num";
List agentList = getStringForSql(conn,agentListSql);
//2.遍历代理商做发票匹配
//--获取代理商下全部未占用发票金额
int num=0;
for(int i=0;i<agentList.size();i++){
String invoiceMoneySql = "select nvl(sum(pure_amount-used_amount),0) from tf_chl_invoice where invoice_status in (0,1,2) and province_code ='"+provinceCode+"' and vendor_num='"+agentList.get(i)+"' and update_date<=to_date('"+endDateStr+"','yyyyMMddhh24Miss')";
String invoiceMoney = getStringForSql(conn,invoiceMoneySql).get(0);
//取所有应付金额
String payMoneySql = "select (";
payMoneySql+="select nvl(sum(ts.amount),0) from tf_chl_channel tc,tf_chl_settle ts where tc.chnl_code=ts.pay_object_id and tc.agent_id is not null and ts.pay_object_type='01'and tc.agent_id='"+agentList.get(i)+"'";
payMoneySql+=")+(";
payMoneySql+="select nvl(sum(ts.amount),0) from tf_chl_channel tc,tf_chl_settle ts where tc.chnl_code=ts.agent_chnl_id and tc.agent_id is not null and ts.pay_object_type='02'and tc.agent_id='"+agentList.get(i)+"'";
payMoneySql+=")-(";
payMoneySql+="select nvl(sum(ta.pay_stat_money),0) from tf_chl_channel tc,tf_chl_pay_apply ta where tc.chnl_code=ta.pay_object_id and tc.agent_id is not null and ta.pay_object_type='01'and tc.agent_id='"+agentList.get(i)+"' and pay_state!='31'";
payMoneySql+=")-(";
payMoneySql+="select nvl(sum(ta.pay_stat_money),0) from tf_chl_channel tc,tf_chl_pay_apply ta where tc.chnl_code=ta.PAY_DEPART_ID and tc.agent_id is not null and ta.pay_object_type='02'and tc.agent_id='"+agentList.get(i)+"' and pay_state!='31'";
payMoneySql+=") from dual";
String payMoney=getStringForSql(conn,payMoneySql).get(0);
if(Double.parseDouble(payMoney)>=Double.parseDouble(invoiceMoney)){
//匹配成功
String sql="update tf_chl_invoice set invoice_status='4', update_date=sysdate where invoice_status='0' and vendor_num='"+agentList.get(i)+"' and province_code ='"+provinceCode+"' and update_date<=to_date('"+endDateStr+"','yyyyMMddhh24Miss')";
sqlSubmit(conn,sql);
num++;
}else{
//匹配失败
String sql="update tf_chl_invoice set invoice_status='-1', update_date=sysdate where invoice_status='0' and vendor_num='"+agentList.get(i)+"' and province_code ='"+provinceCode+"' and update_date<=to_date('"+endDateStr+"','yyyyMMddhh24Miss')";
sqlSubmit(conn,sql);
}
}
if(1>0){
return _bean;
}
return null;
}
public List<String> getStringForSql(Connection conn,String sql) throws SQLException{
List<String> list = new ArrayList<String>();
// Connection conn = null;
PreparedStatement ptmt = null;
ResultSet rset = null;
// conn = getConnection();
ptmt = conn.prepareStatement(sql);
rset = ptmt.executeQuery();
while(rset.next()){
list.add(rset.getString(1));
}
if(rset!=null){
rset.close();
}
if(ptmt!=null){
ptmt.close();
}
return list;
}
public void sqlSubmit(Connection conn,String sqlsub) throws SQLException{
// Connection conn = null;
PreparedStatement ptmt = null;
// 创建resultset
ResultSet rset = null;
// conn = getConnection();
ptmt = conn.prepareStatement(sqlsub);
ptmt.execute();
if(ptmt!=null){
ptmt.close();
}
}
@Override
public String getInvoicePackage(TF_CHL_INVOICE_PACKAGEBean bean,String endDateStr) throws Exception {
TF_CHL_INVOICE_PACKAGEBean _bean = new TF_CHL_INVOICE_PACKAGEBean();
String packateId = CastUtil.getSequenceNextValbyAllName(Constants.T_CHL_INVOICE_PACKAGE$ID) ;
_bean.isNew();
_bean.setPackageId(packateId);
// _bean.setAcctMonth(value);
_bean.setProvinceCode(bean.getProvinceCode());
_bean.setOrgName(bean.getOrgName());
_bean.setSetOfBooksId(bean.getSetOfBooksId());
_bean.setSumPureAmount(bean.getSumPureAmount());
_bean.setSumTaxAmount(bean.getSumTaxAmount());
_bean.setSumTotalAmount(bean.getSumTotalAmount());
_bean.setVoucherNo(bean.getVoucherNo());
// _bean.setAccountingDate(CastUtil.getCurrentTimestamp());
_bean.setStatus("0");
_bean.setInsertTime(CastUtil.getCurrentTimestamp());
_bean.setLastUpdateTime(CastUtil.getCurrentTimestamp());
TF_CHL_INVOICE_PACKAGEEngine.save(_bean);
String sql = "update tf_chl_invoice set invoice_status='6', update_date=sysdate where invoice_status='4' and province_code ='"+bean.getProvinceCode()+"' and update_date<=to_date('"+endDateStr+"','yyyyMMddhh24Miss')";;
Connection conn = null;
conn = getConnection();
sqlSubmit(conn,sql);
return packateId;
}
@Override
public boolean insertRecord(int subjectId, String contentId,
int batchNo,String procinceCode,String contentKind) throws Exception {
UipSyncRecordBean recordBean = new UipSyncRecordBean();
recordBean.isNew();
recordBean.setRecordId( Long.valueOf( CastUtil.getSequenceNextValbyAllName(Constants.RECORD_ID$SEQ ) ));
recordBean.setSubjectId( subjectId );
recordBean.setMonth( CastUtil.getAccMonth());
recordBean.setProvinceCode( procinceCode);
recordBean.setContentKind(contentKind);
recordBean.setContentId( contentId);
recordBean.setBatchNo( batchNo );
recordBean.setInsertTime( CastUtil.getCurrentTimestamp() );
recordBean.setState("00");
recordBean.setLockStatus( 0 );
UipSyncRecordEngine.save( recordBean );
return false;
}
}
<file_sep>package com.ai.uip.core.util;
/**
* 加密解密工具
*
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Aug 26, 2011
*/
public class EncryptUtil {
/**
* 解密
* @param passwd
* @return
*/
public static String getDecrypt(String passwd) {
int key[] = {
<KEY> };
int key_len = 8;
StringBuffer msg = new StringBuffer();
int len = passwd.length() / 2;
int iTmp, i;
for (i = 0; i < len; i++) {
iTmp = (passwd.charAt(i * 2) - 'a') << 4;
iTmp |= passwd.charAt(i * 2 + 1) - 'a';
msg.append((char) (iTmp ^ key[i % key_len]));
}
return msg.toString();
}
/**
* 加密
* @param passwd
* @return
*/
public static String getEncrypt(String passwd) {
StringBuffer msg = new StringBuffer();
String aa = null;
int key_len = 8;
int iTmp = 0;
int key[] = {
0x4A, <KEY> 0x43, 0x44 };
for (int i = 0; i < passwd.length(); i++) {
iTmp = (int) passwd.charAt(i) ^ key[i % key_len];
msg.append((char) (((iTmp >> 4) & 0x0f) + 'a'));
msg.append((char) ((iTmp & 0x0f) + 'a'));
}
return msg.toString();
}
public static void main(String[] args) {
String password = "<PASSWORD>";
String jiami = EncryptUtil.getEncrypt(password);
String jiemi = EncryptUtil.getDecrypt("cgdjcccgdlgdhhhaho");
System.out.println(jiami);
System.out.println(jiemi);
}
}
<file_sep>
package cn.chinaunicom.ws.areainfoprecheckser.unibssbody.areainfoprecheckreq;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.areainfoprecheckser.unibssbody.areainfoprecheckreq package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.areainfoprecheckser.unibssbody.areainfoprecheckreq
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link AREA_INFO_PRECHECK_REQ }
*
*/
public AREA_INFO_PRECHECK_REQ createAREA_INFO_PRECHECK_REQ() {
return new AREA_INFO_PRECHECK_REQ();
}
/**
* Create an instance of {@link AREA_INFO_PRECHECK_REQ.AREA_INFO_OLD }
*
*/
public AREA_INFO_PRECHECK_REQ.AREA_INFO_OLD createAREA_INFO_PRECHECK_REQAREA_INFO_OLD() {
return new AREA_INFO_PRECHECK_REQ.AREA_INFO_OLD();
}
/**
* Create an instance of {@link AREA_INFO_PRECHECK_REQ.AREA_INFO_NEW }
*
*/
public AREA_INFO_PRECHECK_REQ.AREA_INFO_NEW createAREA_INFO_PRECHECK_REQAREA_INFO_NEW() {
return new AREA_INFO_PRECHECK_REQ.AREA_INFO_NEW();
}
/**
* Create an instance of {@link AREA_INFO_PRECHECK_REQ.PARA }
*
*/
public AREA_INFO_PRECHECK_REQ.PARA createAREA_INFO_PRECHECK_REQPARA() {
return new AREA_INFO_PRECHECK_REQ.PARA();
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.Timestamp;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IUC_TD_MDM_CNAPS_HISValue;
public class UC_TD_MDM_CNAPS_HISBean extends DataContainer implements DataContainerInterface,IUC_TD_MDM_CNAPS_HISValue{
private static String m_boName = "bo.UC_TD_MDM_CNAPS_HIS";
public final static String S_InHisTime = "IN_HIS_TIME";
public final static String S_BranchName = "BRANCH_NAME";
public final static String S_MdmCode = "MDM_CODE";
public final static String S_State = "STATE";
public final static String S_CityCode = "CITY_CODE";
public final static String S_ExpDate = "EXP_DATE";
public final static String S_BankCode = "BANK_CODE";
public final static String S_ValidateDate = "VALIDATE_DATE";
public final static String S_IsCnaps = "IS_CNAPS";
public final static String S_CnapsCode = "CNAPS_CODE";
public final static String S_ExMdmCode = "EX_MDM_CODE";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UC_TD_MDM_CNAPS_HISBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�������������������ҵ���������");
}
public void initInHisTime(Timestamp value){
this.initProperty(S_InHisTime,value);
}
public void setInHisTime(Timestamp value){
this.set(S_InHisTime,value);
}
public void setInHisTimeNull(){
this.set(S_InHisTime,null);
}
public Timestamp getInHisTime(){
return DataType.getAsDateTime(this.get(S_InHisTime));
}
public Timestamp getInHisTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_InHisTime));
}
public void initBranchName(String value){
this.initProperty(S_BranchName,value);
}
public void setBranchName(String value){
this.set(S_BranchName,value);
}
public void setBranchNameNull(){
this.set(S_BranchName,null);
}
public String getBranchName(){
return DataType.getAsString(this.get(S_BranchName));
}
public String getBranchNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_BranchName));
}
public void initMdmCode(String value){
this.initProperty(S_MdmCode,value);
}
public void setMdmCode(String value){
this.set(S_MdmCode,value);
}
public void setMdmCodeNull(){
this.set(S_MdmCode,null);
}
public String getMdmCode(){
return DataType.getAsString(this.get(S_MdmCode));
}
public String getMdmCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_MdmCode));
}
public void initState(String value){
this.initProperty(S_State,value);
}
public void setState(String value){
this.set(S_State,value);
}
public void setStateNull(){
this.set(S_State,null);
}
public String getState(){
return DataType.getAsString(this.get(S_State));
}
public String getStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_State));
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initExpDate(String value){
this.initProperty(S_ExpDate,value);
}
public void setExpDate(String value){
this.set(S_ExpDate,value);
}
public void setExpDateNull(){
this.set(S_ExpDate,null);
}
public String getExpDate(){
return DataType.getAsString(this.get(S_ExpDate));
}
public String getExpDateInitialValue(){
return DataType.getAsString(this.getOldObj(S_ExpDate));
}
public void initBankCode(String value){
this.initProperty(S_BankCode,value);
}
public void setBankCode(String value){
this.set(S_BankCode,value);
}
public void setBankCodeNull(){
this.set(S_BankCode,null);
}
public String getBankCode(){
return DataType.getAsString(this.get(S_BankCode));
}
public String getBankCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankCode));
}
public void initValidateDate(String value){
this.initProperty(S_ValidateDate,value);
}
public void setValidateDate(String value){
this.set(S_ValidateDate,value);
}
public void setValidateDateNull(){
this.set(S_ValidateDate,null);
}
public String getValidateDate(){
return DataType.getAsString(this.get(S_ValidateDate));
}
public String getValidateDateInitialValue(){
return DataType.getAsString(this.getOldObj(S_ValidateDate));
}
public void initIsCnaps(String value){
this.initProperty(S_IsCnaps,value);
}
public void setIsCnaps(String value){
this.set(S_IsCnaps,value);
}
public void setIsCnapsNull(){
this.set(S_IsCnaps,null);
}
public String getIsCnaps(){
return DataType.getAsString(this.get(S_IsCnaps));
}
public String getIsCnapsInitialValue(){
return DataType.getAsString(this.getOldObj(S_IsCnaps));
}
public void initCnapsCode(String value){
this.initProperty(S_CnapsCode,value);
}
public void setCnapsCode(String value){
this.set(S_CnapsCode,value);
}
public void setCnapsCodeNull(){
this.set(S_CnapsCode,null);
}
public String getCnapsCode(){
return DataType.getAsString(this.get(S_CnapsCode));
}
public String getCnapsCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CnapsCode));
}
public void initExMdmCode(String value){
this.initProperty(S_ExMdmCode,value);
}
public void setExMdmCode(String value){
this.set(S_ExMdmCode,value);
}
public void setExMdmCodeNull(){
this.set(S_ExMdmCode,null);
}
public String getExMdmCode(){
return DataType.getAsString(this.get(S_ExMdmCode));
}
public String getExMdmCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ExMdmCode));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
}
<file_sep>
package com.unicom.mss.sb_eas_eas_importamountinfosrv;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for SB_EAS_EAS_ImportAmountInfoSrvInputCollection complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SB_EAS_EAS_ImportAmountInfoSrvInputCollection">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SB_EAS_EAS_ImportAmountInfoSrvInputItem" type="{http://mss.unicom.com/SB_EAS_EAS_ImportAmountInfoSrv}SB_EAS_EAS_ImportAmountInfoSrvInputItem" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SB_EAS_EAS_ImportAmountInfoSrvInputCollection", propOrder = {
"sbEASEASImportAmountInfoSrvInputItem"
})
public class SB_EAS_EAS_ImportAmountInfoSrvInputCollection {
@XmlElement(name = "SB_EAS_EAS_ImportAmountInfoSrvInputItem")
protected List<SB_EAS_EAS_ImportAmountInfoSrvInputItem> sbEASEASImportAmountInfoSrvInputItem;
/**
* Gets the value of the sbEASEASImportAmountInfoSrvInputItem property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the sbEASEASImportAmountInfoSrvInputItem property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSB_EAS_EAS_ImportAmountInfoSrvInputItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SB_EAS_EAS_ImportAmountInfoSrvInputItem }
*
*
*/
public List<SB_EAS_EAS_ImportAmountInfoSrvInputItem> getSB_EAS_EAS_ImportAmountInfoSrvInputItem() {
if (sbEASEASImportAmountInfoSrvInputItem == null) {
sbEASEASImportAmountInfoSrvInputItem = new ArrayList<SB_EAS_EAS_ImportAmountInfoSrvInputItem>();
}
return this.sbEASEASImportAmountInfoSrvInputItem;
}
public void setSB_EAS_EAS_ImportAmountInfoSrvInputItem(
List<SB_EAS_EAS_ImportAmountInfoSrvInputItem> List) {
this.sbEASEASImportAmountInfoSrvInputItem=List;
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_QZ_YPDKValue;
import com.ai.uip.core.ivalues.*;
public class TF_QZ_YPDKBean extends DataContainer implements DataContainerInterface,ITF_QZ_YPDKValue{
private static String m_boName = "bo.TF_QZ_YPDK";
public final static String S_OrgOrderId = "ORG_ORDER_ID";
public final static String S_CityCode = "CITY_CODE";
public final static String S_TradeDatetime = "TRADE_DATETIME";
public final static String S_SerialNumber = "SERIAL_NUMBER";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_EquipmentType = "EQUIPMENT_TYPE";
public final static String S_EquipmentPrice = "EQUIPMENT_PRICE";
public final static String S_ChannelName = "CHANNEL_NAME";
public final static String S_EparchyCode = "EPARCHY_CODE";
public final static String S_OrgProvinceOrderId = "ORG_PROVINCE_ORDER_ID";
public final static String S_OrderId = "ORDER_ID";
public final static String S_Imei = "IMEI";
public final static String S_PayFee = "PAY_FEE";
public final static String S_ContractEquipmentPrice = "CONTRACT_EQUIPMENT_PRICE";
public final static String S_TradeType = "TRADE_TYPE";
public final static String S_ProvinceOrderId = "PROVINCE_ORDER_ID";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_QZ_YPDKBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�������������������ҵ���������");
}
public void initOrgOrderId(String value){
this.initProperty(S_OrgOrderId,value);
}
public void setOrgOrderId(String value){
this.set(S_OrgOrderId,value);
}
public void setOrgOrderIdNull(){
this.set(S_OrgOrderId,null);
}
public String getOrgOrderId(){
return DataType.getAsString(this.get(S_OrgOrderId));
}
public String getOrgOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrgOrderId));
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initTradeDatetime(String value){
this.initProperty(S_TradeDatetime,value);
}
public void setTradeDatetime(String value){
this.set(S_TradeDatetime,value);
}
public void setTradeDatetimeNull(){
this.set(S_TradeDatetime,null);
}
public String getTradeDatetime(){
return DataType.getAsString(this.get(S_TradeDatetime));
}
public String getTradeDatetimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeDatetime));
}
public void initSerialNumber(String value){
this.initProperty(S_SerialNumber,value);
}
public void setSerialNumber(String value){
this.set(S_SerialNumber,value);
}
public void setSerialNumberNull(){
this.set(S_SerialNumber,null);
}
public String getSerialNumber(){
return DataType.getAsString(this.get(S_SerialNumber));
}
public String getSerialNumberInitialValue(){
return DataType.getAsString(this.getOldObj(S_SerialNumber));
}
public void initCreateTime(Timestamp value){
this.initProperty(S_CreateTime,value);
}
public void setCreateTime(Timestamp value){
this.set(S_CreateTime,value);
}
public void setCreateTimeNull(){
this.set(S_CreateTime,null);
}
public Timestamp getCreateTime(){
return DataType.getAsDateTime(this.get(S_CreateTime));
}
public Timestamp getCreateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_CreateTime));
}
public void initChnlCode(String value){
this.initProperty(S_ChnlCode,value);
}
public void setChnlCode(String value){
this.set(S_ChnlCode,value);
}
public void setChnlCodeNull(){
this.set(S_ChnlCode,null);
}
public String getChnlCode(){
return DataType.getAsString(this.get(S_ChnlCode));
}
public String getChnlCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlCode));
}
public void initEquipmentType(String value){
this.initProperty(S_EquipmentType,value);
}
public void setEquipmentType(String value){
this.set(S_EquipmentType,value);
}
public void setEquipmentTypeNull(){
this.set(S_EquipmentType,null);
}
public String getEquipmentType(){
return DataType.getAsString(this.get(S_EquipmentType));
}
public String getEquipmentTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_EquipmentType));
}
public void initEquipmentPrice(String value){
this.initProperty(S_EquipmentPrice,value);
}
public void setEquipmentPrice(String value){
this.set(S_EquipmentPrice,value);
}
public void setEquipmentPriceNull(){
this.set(S_EquipmentPrice,null);
}
public String getEquipmentPrice(){
return DataType.getAsString(this.get(S_EquipmentPrice));
}
public String getEquipmentPriceInitialValue(){
return DataType.getAsString(this.getOldObj(S_EquipmentPrice));
}
public void initChannelName(String value){
this.initProperty(S_ChannelName,value);
}
public void setChannelName(String value){
this.set(S_ChannelName,value);
}
public void setChannelNameNull(){
this.set(S_ChannelName,null);
}
public String getChannelName(){
return DataType.getAsString(this.get(S_ChannelName));
}
public String getChannelNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChannelName));
}
public void initEparchyCode(String value){
this.initProperty(S_EparchyCode,value);
}
public void setEparchyCode(String value){
this.set(S_EparchyCode,value);
}
public void setEparchyCodeNull(){
this.set(S_EparchyCode,null);
}
public String getEparchyCode(){
return DataType.getAsString(this.get(S_EparchyCode));
}
public String getEparchyCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_EparchyCode));
}
public void initOrgProvinceOrderId(String value){
this.initProperty(S_OrgProvinceOrderId,value);
}
public void setOrgProvinceOrderId(String value){
this.set(S_OrgProvinceOrderId,value);
}
public void setOrgProvinceOrderIdNull(){
this.set(S_OrgProvinceOrderId,null);
}
public String getOrgProvinceOrderId(){
return DataType.getAsString(this.get(S_OrgProvinceOrderId));
}
public String getOrgProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrgProvinceOrderId));
}
public void initOrderId(String value){
this.initProperty(S_OrderId,value);
}
public void setOrderId(String value){
this.set(S_OrderId,value);
}
public void setOrderIdNull(){
this.set(S_OrderId,null);
}
public String getOrderId(){
return DataType.getAsString(this.get(S_OrderId));
}
public String getOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrderId));
}
public void initImei(String value){
this.initProperty(S_Imei,value);
}
public void setImei(String value){
this.set(S_Imei,value);
}
public void setImeiNull(){
this.set(S_Imei,null);
}
public String getImei(){
return DataType.getAsString(this.get(S_Imei));
}
public String getImeiInitialValue(){
return DataType.getAsString(this.getOldObj(S_Imei));
}
public void initPayFee(long value){
this.initProperty(S_PayFee,new Long(value));
}
public void setPayFee(long value){
this.set(S_PayFee,new Long(value));
}
public void setPayFee(Long value){
this.set(S_PayFee,value);
}
public Long getPayFeeAsLong(){
return (Long )this.get(S_PayFee);
}
public void setPayFeeNull(){
this.set(S_PayFee,null);
}
public long getPayFee(){
return DataType.getAsLong(this.get(S_PayFee));
}
public long getPayFeeInitialValue(){
return DataType.getAsLong(this.getOldObj(S_PayFee));
}
public void initContractEquipmentPrice(String value){
this.initProperty(S_ContractEquipmentPrice,value);
}
public void setContractEquipmentPrice(String value){
this.set(S_ContractEquipmentPrice,value);
}
public void setContractEquipmentPriceNull(){
this.set(S_ContractEquipmentPrice,null);
}
public String getContractEquipmentPrice(){
return DataType.getAsString(this.get(S_ContractEquipmentPrice));
}
public String getContractEquipmentPriceInitialValue(){
return DataType.getAsString(this.getOldObj(S_ContractEquipmentPrice));
}
public void initTradeType(String value){
this.initProperty(S_TradeType,value);
}
public void setTradeType(String value){
this.set(S_TradeType,value);
}
public void setTradeTypeNull(){
this.set(S_TradeType,null);
}
public String getTradeType(){
return DataType.getAsString(this.get(S_TradeType));
}
public String getTradeTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeType));
}
public void initProvinceOrderId(String value){
this.initProperty(S_ProvinceOrderId,value);
}
public void setProvinceOrderId(String value){
this.set(S_ProvinceOrderId,value);
}
public void setProvinceOrderIdNull(){
this.set(S_ProvinceOrderId,null);
}
public String getProvinceOrderId(){
return DataType.getAsString(this.get(S_ProvinceOrderId));
}
public String getProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceOrderId));
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AreaInfoSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AreaInfoSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AreaInfoSchema.xsd
areaInfo,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AgentChargeInfoSyncSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AgentChargeInfoSyncSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AgentChargeInfoSyncSchema.xsd
agentPrePayRechSync,UNI_BSS_BODY,UNI_BSS_BODY
agentDepositRechSync,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.ftpFile.rms.uc0401;
import java.util.HashMap;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IRmsUC0401FileBusiSV;
import com.ai.uint.ftp.interfaces.IGenerateFileSV;
import com.ai.uint.paramsMang.vo.PublishCfgVo;
public class RmsUC0401FileInfoImpl implements IGenerateFileSV {
@Override
public HashMap<String, Object> generateFile(String fileLogID, PublishCfgVo pubCfgVO) {
HashMap<String, Object> resultMap = new HashMap<String, Object>();
try
{
CenterFactory.pushCenterInfo(com.ai.uchintService.common.util.Constants.DATASOURCE_CENTER, "01");
IRmsUC0401FileBusiSV impl = (IRmsUC0401FileBusiSV)ServiceFactory.getService(IRmsUC0401FileBusiSV.class);
return impl.generateFile(fileLogID, pubCfgVO);
}
catch(Exception e)
{
e.printStackTrace();
resultMap.put(com.ai.uint.ejb.util.Constants.ResultMap.ResultKey.RESULT_CODE, com.ai.uint.ejb.util.Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
resultMap.put(com.ai.uint.ejb.util.Constants.ResultMap.ResultKey.RESULT_MSG, "生成文件失败:"+e.getMessage());
}
return resultMap;
}
}
<file_sep>package com.ai.uip.platform.penetration.interfaces;
/**
* 透传服务
* @author homax
*
*/
public interface IPenetrationIfProcessorSRV {
public Object ifMsgProcessorForService(String ifCode, Object ifMsg);
}
<file_sep>
package cn.chinaunicom.ws.agencypaytadeser.body;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.agencypaytadeser.body package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.agencypaytadeser.body
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link AGENCY_SIGN_CALL_TADE_INPUT }
*
*/
public AGENCY_SIGN_CALL_TADE_INPUT createAGENCY_SIGN_CALL_TADE_INPUT() {
return new AGENCY_SIGN_CALL_TADE_INPUT();
}
/**
* Create an instance of {@link AGENCY_SIGN_CALL_TADE_OUTPUT }
*
*/
public AGENCY_SIGN_CALL_TADE_OUTPUT createAGENCY_SIGN_CALL_TADE_OUTPUT() {
return new AGENCY_SIGN_CALL_TADE_OUTPUT();
}
/**
* Create an instance of {@link AGENCY_SIGN_CALL_TADE_INPUT.BODY }
*
*/
public AGENCY_SIGN_CALL_TADE_INPUT.BODY createAGENCY_SIGN_CALL_TADE_INPUTBODY() {
return new AGENCY_SIGN_CALL_TADE_INPUT.BODY();
}
/**
* Create an instance of {@link AGENCY_SIGN_CALL_TADE_OUTPUT.BODY }
*
*/
public AGENCY_SIGN_CALL_TADE_OUTPUT.BODY createAGENCY_SIGN_CALL_TADE_OUTPUTBODY() {
return new AGENCY_SIGN_CALL_TADE_OUTPUT.BODY();
}
}
<file_sep>package com.ai.uip.core.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IUipSubsValue extends DataStructInterface{
public final static String S_SystemId = "SYSTEM_ID";
public final static String S_CityCode = "CITY_CODE";
public final static String S_RedoNum = "REDO_NUM";
public final static String S_RedoPeriod = "REDO_PERIOD";
public final static String S_DataScope = "DATA_SCOPE";
public final static String S_SubjectId = "SUBJECT_ID";
public final static String S_SubsTime = "SUBS_TIME";
public final static String S_SubsStatus = "SUBS_STATUS";
public final static String S_FileName = "FILE_NAME";
public final static String S_SubsId = "SUBS_ID";
public final static String S_OperateId = "OPERATE_ID";
public final static String S_InactiveDate = "INACTIVE_DATE";
public final static String S_SyncTimeFormat = "SYNC_TIME_FORMAT";
public final static String S_RecFilePostfix = "REC_FILE_POSTFIX";
public final static String S_ActiveDate = "ACTIVE_DATE";
public final static String S_SubsPath = "SUBS_PATH";
public final static String S_ReceUrl = "RECE_URL";
public final static String S_FilePath = "FILE_PATH";
public final static String S_FileBackupPath = "FILE_BACKUP_PATH";
public Long getSystemIdAsLong();
public long getSystemId();
public String getCityCode();
public Integer getRedoNumAsInteger();
public int getRedoNum();
public Long getRedoPeriodAsLong();
public long getRedoPeriod();
public String getDataScope();
public Integer getSubjectIdAsInteger();
public int getSubjectId();
public Timestamp getSubsTime();
public Integer getSubsStatusAsInteger();
public int getSubsStatus();
public String getFileName();
public Long getSubsIdAsLong();
public long getSubsId();
public Long getOperateIdAsLong();
public long getOperateId();
public Timestamp getInactiveDate();
public String getSyncTimeFormat();
public String getRecFilePostfix();
public Timestamp getActiveDate();
public String getSubsPath();
public String getReceUrl();
public String getFilePath();
public String getFileBackupPath();
public void setSystemId(Long value);
public void setSystemId(long value);
public void setCityCode(String value);
public void setRedoNum(Integer value);
public void setRedoNum(int value);
public void setRedoPeriod(Long value);
public void setRedoPeriod(long value);
public void setDataScope(String value);
public void setSubjectId(Integer value);
public void setSubjectId(int value);
public void setSubsTime(Timestamp value);
public void setSubsStatus(Integer value);
public void setSubsStatus(int value);
public void setFileName(String value);
public void setSubsId(Long value);
public void setSubsId(long value);
public void setOperateId(Long value);
public void setOperateId(long value);
public void setInactiveDate(Timestamp value);
public void setSyncTimeFormat(String value);
public void setRecFilePostfix(String value);
public void setActiveDate(Timestamp value);
public void setSubsPath(String value);
public void setReceUrl(String value);
public void setFilePath(String value);
public void setFileBackupPath(String value);
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface ITF_CHL_PAYMENT_RESULTValue extends DataStructInterface{
public final static String S_CityCode = "CITY_CODE";
public final static String S_ResultCode = "RESULT_CODE";
public final static String S_ProvMerchantId = "PROV_MERCHANT_ID";
public final static String S_FileDate = "FILE_DATE";
public final static String S_PaymentRfee = "PAYMENT_RFEE";
public final static String S_PaymentTime = "PAYMENT_TIME";
public final static String S_ChnlId = "CHNL_ID";
public final static String S_AccountType = "ACCOUNT_TYPE";
public final static String S_EparchyCode = "EPARCHY_CODE";
public final static String S_OperateTime = "OPERATE_TIME";
public final static String S_PaymentResult = "PAYMENT_RESULT";
public final static String S_ContractNumber = "CONTRACT_NUMBER";
public final static String S_TradeTime = "TRADE_TIME";
public final static String S_PaymentFfee = "PAYMENT_FFEE";
public final static String S_PayMode = "PAY_MODE";
public final static String S_AcctId = "ACCT_ID";
public final static String S_OperateStaffId = "OPERATE_STAFF_ID";
public final static String S_PayTradeId = "PAY_TRADE_ID";
public final static String S_ProcessTime = "PROCESS_TIME";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_BankCardPaymentId = "BANK_CARD_PAYMENT_ID";
public final static String S_BankCatdType = "BANK_CATD_TYPE";
public String getCityCode();
public String getResultCode();
public String getProvMerchantId();
public String getFileDate();
public String getPaymentRfee();
public Timestamp getPaymentTime();
public String getChnlId();
public String getAccountType();
public String getEparchyCode();
public Timestamp getOperateTime();
public String getPaymentResult();
public String getContractNumber();
public Timestamp getTradeTime();
public String getPaymentFfee();
public String getPayMode();
public String getAcctId();
public String getOperateStaffId();
public String getPayTradeId();
public Timestamp getProcessTime();
public String getProvinceCode();
public String getBankCardPaymentId();
public String getBankCatdType();
public void setCityCode(String value);
public void setResultCode(String value);
public void setProvMerchantId(String value);
public void setFileDate(String value);
public void setPaymentRfee(String value);
public void setPaymentTime(Timestamp value);
public void setChnlId(String value);
public void setAccountType(String value);
public void setEparchyCode(String value);
public void setOperateTime(Timestamp value);
public void setPaymentResult(String value);
public void setContractNumber(String value);
public void setTradeTime(Timestamp value);
public void setPaymentFfee(String value);
public void setPayMode(String value);
public void setAcctId(String value);
public void setOperateStaffId(String value);
public void setPayTradeId(String value);
public void setProcessTime(Timestamp value);
public void setProvinceCode(String value);
public void setBankCardPaymentId(String value);
public void setBankCatdType(String value);
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,StaffInfoSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,StaffInfoSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,StaffInfoSchema.xsd
staffInfo,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>
package cn.chinaunicom.ws.agencybankrealpaymentser.unibssbody.qryagencybankcardrealpayresultrsp;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.agencybankrealpaymentser.unibssbody.qryagencybankcardrealpayresultrsp package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.agencybankrealpaymentser.unibssbody.qryagencybankcardrealpayresultrsp
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSPRESP_INFO() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO.TRADE_INFO }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO.TRADE_INFO createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSPRESP_INFOTRADE_INFO() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO.TRADE_INFO();
}
/**
* Create an instance of {@link QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO.TRADE_INFO.PARA }
*
*/
public QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO.TRADE_INFO.PARA createQRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSPRESP_INFOTRADE_INFOPARA() {
return new QRY_AGENCY_BANK_CARD_REAL_PAY_RESULT_RSP.RESP_INFO.TRADE_INFO.PARA();
}
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IINT_CLIENT_MAPValue;
public class INT_CLIENT_MAPBean extends DataContainer implements DataContainerInterface,IINT_CLIENT_MAPValue{
private static String m_boName = "bo.INT_CLIENT_MAP";
public final static String S_ChlClientCode = "CHL_CLIENT_CODE";
public final static String S_ErpClientCode = "ERP_CLIENT_CODE";
public final static String S_Comments = "COMMENTS";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public INT_CLIENT_MAPBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initChlClientCode(String value){
this.initProperty(S_ChlClientCode,value);
}
public void setChlClientCode(String value){
this.set(S_ChlClientCode,value);
}
public void setChlClientCodeNull(){
this.set(S_ChlClientCode,null);
}
public String getChlClientCode(){
return DataType.getAsString(this.get(S_ChlClientCode));
}
public String getChlClientCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlClientCode));
}
public void initErpClientCode(String value){
this.initProperty(S_ErpClientCode,value);
}
public void setErpClientCode(String value){
this.set(S_ErpClientCode,value);
}
public void setErpClientCodeNull(){
this.set(S_ErpClientCode,null);
}
public String getErpClientCode(){
return DataType.getAsString(this.get(S_ErpClientCode));
}
public String getErpClientCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpClientCode));
}
public void initComments(String value){
this.initProperty(S_Comments,value);
}
public void setComments(String value){
this.set(S_Comments,value);
}
public void setCommentsNull(){
this.set(S_Comments,null);
}
public String getComments(){
return DataType.getAsString(this.get(S_Comments));
}
public String getCommentsInitialValue(){
return DataType.getAsString(this.getOldObj(S_Comments));
}
}
<file_sep>package cn.chinaunicom.ws.areainfoser;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-10-26T15:31:29.395+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://ws.chinaunicom.cn/AreaInfoSer/", name = "AreaInfoSer")
@XmlSeeAlso({cn.chinaunicom.ws.areainfoser.unibssbody.areainforeq.ObjectFactory.class, cn.chinaunicom.ws.unibsshead.ObjectFactory.class, cn.chinaunicom.ws.areainfoser.unibssbody.ObjectFactory.class, cn.chinaunicom.ws.areainfoser.unibssbody.areainforsp.ObjectFactory.class, cn.chinaunicom.ws.unibssattached.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface AreaInfoSer {
@WebResult(name = "AREA_INFO_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/AreaInfoSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/AreaInfoSer/areaInfo/")
public cn.chinaunicom.ws.areainfoser.unibssbody.AREA_INFO_OUTPUT areaInfo(
@WebParam(partName = "parameters", name = "AREA_INFO_INPUT", targetNamespace = "http://ws.chinaunicom.cn/AreaInfoSer/unibssBody")
cn.chinaunicom.ws.areainfoser.unibssbody.AREA_INFO_INPUT parameters
);
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_QZ_WZH_DETAILValue;
import com.ai.uip.core.ivalues.*;
public class TF_QZ_WZH_DETAILBean extends DataContainer implements DataContainerInterface,ITF_QZ_WZH_DETAILValue{
private static String m_boName = "bo.TF_QZ_WZH_DETAIL";
public final static String S_TradeDatetime = "TRADE_DATETIME";
public final static String S_AccType = "ACC_TYPE";
public final static String S_AccNo = "ACC_NO";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_TranSn = "TRAN_SN";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_CustNo = "CUST_NO";
public final static String S_TranRmk = "TRAN_RMK";
public final static String S_Reserved1 = "RESERVED1";
public final static String S_TranType = "TRAN_TYPE";
public final static String S_PriKey = "PRI_KEY";
public final static String S_CustName = "CUST_NAME";
public final static String S_MerchNo = "MERCH_NO";
public final static String S_UserNo = "USER_NO";
public final static String S_CrdAmt = "CRD_AMT";
public final static String S_UserName = "USER_NAME";
public final static String S_AccBlc = "ACC_BLC";
public final static String S_DbtAmt = "DBT_AMT";
public final static String S_TranRn = "TRAN_RN";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_QZ_WZH_DETAILBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�������������������ҵ���������");
}
public void initTradeDatetime(String value){
this.initProperty(S_TradeDatetime,value);
}
public void setTradeDatetime(String value){
this.set(S_TradeDatetime,value);
}
public void setTradeDatetimeNull(){
this.set(S_TradeDatetime,null);
}
public String getTradeDatetime(){
return DataType.getAsString(this.get(S_TradeDatetime));
}
public String getTradeDatetimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeDatetime));
}
public void initAccType(String value){
this.initProperty(S_AccType,value);
}
public void setAccType(String value){
this.set(S_AccType,value);
}
public void setAccTypeNull(){
this.set(S_AccType,null);
}
public String getAccType(){
return DataType.getAsString(this.get(S_AccType));
}
public String getAccTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AccType));
}
public void initAccNo(String value){
this.initProperty(S_AccNo,value);
}
public void setAccNo(String value){
this.set(S_AccNo,value);
}
public void setAccNoNull(){
this.set(S_AccNo,null);
}
public String getAccNo(){
return DataType.getAsString(this.get(S_AccNo));
}
public String getAccNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_AccNo));
}
public void initCreateTime(Timestamp value){
this.initProperty(S_CreateTime,value);
}
public void setCreateTime(Timestamp value){
this.set(S_CreateTime,value);
}
public void setCreateTimeNull(){
this.set(S_CreateTime,null);
}
public Timestamp getCreateTime(){
return DataType.getAsDateTime(this.get(S_CreateTime));
}
public Timestamp getCreateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_CreateTime));
}
public void initTranSn(String value){
this.initProperty(S_TranSn,value);
}
public void setTranSn(String value){
this.set(S_TranSn,value);
}
public void setTranSnNull(){
this.set(S_TranSn,null);
}
public String getTranSn(){
return DataType.getAsString(this.get(S_TranSn));
}
public String getTranSnInitialValue(){
return DataType.getAsString(this.getOldObj(S_TranSn));
}
public void initChnlCode(String value){
this.initProperty(S_ChnlCode,value);
}
public void setChnlCode(String value){
this.set(S_ChnlCode,value);
}
public void setChnlCodeNull(){
this.set(S_ChnlCode,null);
}
public String getChnlCode(){
return DataType.getAsString(this.get(S_ChnlCode));
}
public String getChnlCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlCode));
}
public void initCustNo(String value){
this.initProperty(S_CustNo,value);
}
public void setCustNo(String value){
this.set(S_CustNo,value);
}
public void setCustNoNull(){
this.set(S_CustNo,null);
}
public String getCustNo(){
return DataType.getAsString(this.get(S_CustNo));
}
public String getCustNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_CustNo));
}
public void initTranRmk(String value){
this.initProperty(S_TranRmk,value);
}
public void setTranRmk(String value){
this.set(S_TranRmk,value);
}
public void setTranRmkNull(){
this.set(S_TranRmk,null);
}
public String getTranRmk(){
return DataType.getAsString(this.get(S_TranRmk));
}
public String getTranRmkInitialValue(){
return DataType.getAsString(this.getOldObj(S_TranRmk));
}
public void initReserved1(String value){
this.initProperty(S_Reserved1,value);
}
public void setReserved1(String value){
this.set(S_Reserved1,value);
}
public void setReserved1Null(){
this.set(S_Reserved1,null);
}
public String getReserved1(){
return DataType.getAsString(this.get(S_Reserved1));
}
public String getReserved1InitialValue(){
return DataType.getAsString(this.getOldObj(S_Reserved1));
}
public void initTranType(String value){
this.initProperty(S_TranType,value);
}
public void setTranType(String value){
this.set(S_TranType,value);
}
public void setTranTypeNull(){
this.set(S_TranType,null);
}
public String getTranType(){
return DataType.getAsString(this.get(S_TranType));
}
public String getTranTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TranType));
}
public void initPriKey(String value){
this.initProperty(S_PriKey,value);
}
public void setPriKey(String value){
this.set(S_PriKey,value);
}
public void setPriKeyNull(){
this.set(S_PriKey,null);
}
public String getPriKey(){
return DataType.getAsString(this.get(S_PriKey));
}
public String getPriKeyInitialValue(){
return DataType.getAsString(this.getOldObj(S_PriKey));
}
public void initCustName(String value){
this.initProperty(S_CustName,value);
}
public void setCustName(String value){
this.set(S_CustName,value);
}
public void setCustNameNull(){
this.set(S_CustName,null);
}
public String getCustName(){
return DataType.getAsString(this.get(S_CustName));
}
public String getCustNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_CustName));
}
public void initMerchNo(String value){
this.initProperty(S_MerchNo,value);
}
public void setMerchNo(String value){
this.set(S_MerchNo,value);
}
public void setMerchNoNull(){
this.set(S_MerchNo,null);
}
public String getMerchNo(){
return DataType.getAsString(this.get(S_MerchNo));
}
public String getMerchNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_MerchNo));
}
public void initUserNo(String value){
this.initProperty(S_UserNo,value);
}
public void setUserNo(String value){
this.set(S_UserNo,value);
}
public void setUserNoNull(){
this.set(S_UserNo,null);
}
public String getUserNo(){
return DataType.getAsString(this.get(S_UserNo));
}
public String getUserNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_UserNo));
}
public void initCrdAmt(float value){
this.initProperty(S_CrdAmt,new Float(value));
}
public void setCrdAmt(float value){
this.set(S_CrdAmt,new Float(value));
}
public void setCrdAmt(Float value){
this.set(S_CrdAmt,value);
}
public Float getCrdAmtAsFloat(){
return (Float )this.get(S_CrdAmt);
}
public void setCrdAmtNull(){
this.set(S_CrdAmt,null);
}
public float getCrdAmt(){
return DataType.getAsFloat(this.get(S_CrdAmt));
}
public float getCrdAmtInitialValue(){
return DataType.getAsFloat(this.getOldObj(S_CrdAmt));
}
public void initUserName(String value){
this.initProperty(S_UserName,value);
}
public void setUserName(String value){
this.set(S_UserName,value);
}
public void setUserNameNull(){
this.set(S_UserName,null);
}
public String getUserName(){
return DataType.getAsString(this.get(S_UserName));
}
public String getUserNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_UserName));
}
public void initAccBlc(float value){
this.initProperty(S_AccBlc,new Float(value));
}
public void setAccBlc(float value){
this.set(S_AccBlc,new Float(value));
}
public void setAccBlc(Float value){
this.set(S_AccBlc,value);
}
public Float getAccBlcAsFloat(){
return (Float )this.get(S_AccBlc);
}
public void setAccBlcNull(){
this.set(S_AccBlc,null);
}
public float getAccBlc(){
return DataType.getAsFloat(this.get(S_AccBlc));
}
public float getAccBlcInitialValue(){
return DataType.getAsFloat(this.getOldObj(S_AccBlc));
}
public void initDbtAmt(float value){
this.initProperty(S_DbtAmt,new Float(value));
}
public void setDbtAmt(float value){
this.set(S_DbtAmt,new Float(value));
}
public void setDbtAmt(Float value){
this.set(S_DbtAmt,value);
}
public Float getDbtAmtAsFloat(){
return (Float )this.get(S_DbtAmt);
}
public void setDbtAmtNull(){
this.set(S_DbtAmt,null);
}
public float getDbtAmt(){
return DataType.getAsFloat(this.get(S_DbtAmt));
}
public float getDbtAmtInitialValue(){
return DataType.getAsFloat(this.getOldObj(S_DbtAmt));
}
public void initTranRn(String value){
this.initProperty(S_TranRn,value);
}
public void setTranRn(String value){
this.set(S_TranRn,value);
}
public void setTranRnNull(){
this.set(S_TranRn,null);
}
public String getTranRn(){
return DataType.getAsString(this.get(S_TranRn));
}
public String getTranRnInitialValue(){
return DataType.getAsString(this.getOldObj(S_TranRn));
}
}
<file_sep>package com.ai.uchintService.server.agentchargeinfosyncser;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssattached.UNIBSSATTACHED;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCINPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCOUTPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCOUTPUT.UNIBSSBODY;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentprepayrechsyncreq.AGENTPREPAYRECHSYNCREQ;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentprepayrechsyncrsp.AGENTPREPAYRECHSYNCRSP;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD.RESPONSE;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IAgentChargeInfoSyncSrv;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
public class AgentChargeInfoSyncAction implements IRecIfBase {
public static final Log log = LogFactory.getLog(AgentChargeInfoSyncAction.class);
@SuppressWarnings("unused")
@Override
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
HashMap<String, Object> obj = new HashMap<String, Object>();
AGENTPREPAYRECHSYNCOUTPUT output = new AGENTPREPAYRECHSYNCOUTPUT();
UNIBSSHEAD head = new UNIBSSHEAD();
cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCOUTPUT.UNIBSSBODY body = new UNIBSSBODY();
UNIBSSATTACHED attached = new UNIBSSATTACHED();
UNIBSSHEAD reqHead = ((AGENTPREPAYRECHSYNCINPUT)ifMsg).getUNIBSSHEAD();
cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY reqBody = ((AGENTPREPAYRECHSYNCINPUT)ifMsg).getUNIBSSBODY();
UNIBSSATTACHED reqAttached = ((AGENTPREPAYRECHSYNCINPUT)ifMsg).getUNIBSSATTACHED();
Map<String,Object> map = BucUtil.qzdcheckHead(reqHead);
try{
if (new Boolean(map.get(Constants.QZMap_TAG).toString())) {
Map<String,Object> bodymap = checkBody(reqBody);
if(new Boolean(bodymap.get(Constants.QZMap_TAG).toString())){
String province_code = reqBody.getAGENTPREPAYRECHSYNCREQ().getPROVINCECODE();
System.out.println("=======================province_code:"+province_code+"==========================");
System.out.println("=======================datasource:"+"qingzhang"+province_code+"==========================");
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"qingzhang"+province_code);
// CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
if(!getService().importPrePayInfo((AGENTPREPAYRECHSYNCINPUT)ifMsg)){
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0111);
rsp.setRSPTYPE("1");
rsp.setRSPDESC("数据入库失败");
head.setRESPONSE(rsp);
AGENTPREPAYRECHSYNCRSP rsq = new AGENTPREPAYRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0111);
rsq.setRESPDESC("数据入库失败");
body.setAGENTPREPAYRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "数据入库失败");
obj.put("retObj", output);
}else{
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0000);
rsp.setRSPTYPE("0");
rsp.setRSPDESC("数据同步成功");
head.setRESPONSE(rsp);
AGENTPREPAYRECHSYNCRSP rsq = new AGENTPREPAYRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0000);
rsq.setRESPDESC("数据同步成功");
body.setAGENTPREPAYRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_SUCCESSFUL);// 给接口框架返回的代码
obj.put("resultMsg", "数据同步成功");
obj.put("retObj", output);
}
}else{
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0106);
rsp.setRSPTYPE("1");
rsp.setRSPDESC((String)bodymap.get(Constants.QZMap_ErrorInfo));
head.setRESPONSE(rsp);
AGENTPREPAYRECHSYNCRSP rsq = new AGENTPREPAYRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0106);
rsq.setRESPDESC((String)bodymap.get(Constants.QZMap_ErrorInfo));
body.setAGENTPREPAYRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "报文体信息不正确");
obj.put("retObj", output);
}
}else{
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0105);
rsp.setRSPTYPE("1");
rsp.setRSPDESC((String)map.get(Constants.QZMap_ErrorInfo));
head.setRESPONSE(rsp);
AGENTPREPAYRECHSYNCRSP rsq = new AGENTPREPAYRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0105);
rsq.setRESPDESC((String)map.get(Constants.QZMap_ErrorInfo));
body.setAGENTPREPAYRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "报文头信息不正确");
obj.put("retObj", output);
}
}catch(Exception e){
e.printStackTrace();
}
return obj;
}
private Map<String,Object> checkBody(
cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY reqBody) {
boolean flag = true;
String errorInfo="";
Map<String,Object> map = new HashMap<String,Object>();
AGENTPREPAYRECHSYNCREQ req = reqBody.getAGENTPREPAYRECHSYNCREQ();
if(req.getPROVINCEORDERID()==null || req.getPROVINCEORDERID().length()==0){
flag = false;
errorInfo="省份交易流水号[PROVINCE_ORDER_ID]不能为空";
}else if(req.getTRADETIME()==null || req.getTRADETIME().length()==0){
flag = false;
errorInfo="交易时间[TRADE_DATETIME]不能为空";
}else if(req.getTRADETYPE()==null || req.getTRADETYPE().length()==0){
flag = false;
errorInfo="交易类型[TRADE_TYPE]不能为空";
}else if(req.getTRADETYPE().length()!=2){
flag = false;
errorInfo="交易类型[TRADE_TYPE]长度有误";
}else if(req.getPAYMODE()==null || req.getPAYMODE().length()==0){
flag = false;
errorInfo="类型[PAY_MODE]不能为空";
}else if(req.getPAYMODE().length()!=2){
flag = false;
errorInfo="类型参数[PAY_MODE]长度有误";
}else if(req.getPROVINCECODE()==null || req.getPROVINCECODE().length()==0){
flag = false;
errorInfo="省份编码[PROVINCE_CODE]不能为空";
}else if(req.getEPARCHYCODE()==null || req.getEPARCHYCODE().length()==0){
flag = false;
errorInfo="地市编码[EPARCHY_CODE]不能为空";
}else if(req.getCHNLCODE()==null || req.getCHNLCODE().length()==0){
flag = false;
errorInfo="渠道编码[CHNL_CODE]不能为空";
}else if(req.getCHNLCODE().length()!=7){
flag = false;
errorInfo="渠道编码[CHNL_CODE]长度有误";
}else if(!req.getCHNLCODE().substring(0, 2).equals(req.getPROVINCECODE())){
flag = false;
errorInfo="渠道编码与省份编码[CHNL_CODE][PROVINCE_CODE]不配对";
}else if(req.getCHNLNAME()==null || req.getCHNLNAME().length()==0){
flag = false;
errorInfo="渠道名称[CHNL_NAME]不能为空";
}else if(req.getACCOUNTID()==null || req.getACCOUNTID().length()==0){
flag = false;
errorInfo="账户ID[ACCOUNT_ID]不能为空";
}else if(req.getPAYFEE()==null || req.getPAYFEE().length()==0){
flag = false;
errorInfo="交易金额[PAY_FEE]不能为空";
}else if( (req.getPAYMODE().equals("99")) && (req.getPAYFEEMODE()==null || req.getPAYFEEMODE().length()==0) ){
flag = false;
errorInfo="支付类型[PAY_FEE_MODE]不能为空";
}
map.put(Constants.QZMap_TAG, flag);
map.put(Constants.QZMap_ErrorInfo, errorInfo);
return map;
}
private IAgentChargeInfoSyncSrv getService(){
return (IAgentChargeInfoSyncSrv)ServiceFactory.getService(IAgentChargeInfoSyncSrv.class);
}
@Override
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
return null;
}
}
<file_sep>package com.ai.uip.core.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uip.core.ivalues.IUIP_SERVICE_PENETRATIONValue;
public class UIP_SERVICE_PENETRATIONBean extends DataContainer implements DataContainerInterface,IUIP_SERVICE_PENETRATIONValue{
private static String m_boName = "com.ai.uip.core.bo.UIP_SERVICE_PENETRATION";
public final static String S_ServicePath = "SERVICE_PATH";
public final static String S_ServiceDesc = "SERVICE_DESC";
public final static String S_ServiceImplClass = "SERVICE_IMPL_CLASS";
public final static String S_ServiceStatus = "SERVICE_STATUS";
public final static String S_ServiceName = "SERVICE_NAME";
public final static String S_ServiceId = "SERVICE_ID";
public final static String S_ServiceCode = "SERVICE_CODE";
public final static String S_NameSpace = "NAME_SPACE";
public final static String S_ServiceDomain = "SERVICE_DOMAIN";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UIP_SERVICE_PENETRATIONBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initServicePath(String value){
this.initProperty(S_ServicePath,value);
}
public void setServicePath(String value){
this.set(S_ServicePath,value);
}
public void setServicePathNull(){
this.set(S_ServicePath,null);
}
public String getServicePath(){
return DataType.getAsString(this.get(S_ServicePath));
}
public String getServicePathInitialValue(){
return DataType.getAsString(this.getOldObj(S_ServicePath));
}
public void initServiceDesc(String value){
this.initProperty(S_ServiceDesc,value);
}
public void setServiceDesc(String value){
this.set(S_ServiceDesc,value);
}
public void setServiceDescNull(){
this.set(S_ServiceDesc,null);
}
public String getServiceDesc(){
return DataType.getAsString(this.get(S_ServiceDesc));
}
public String getServiceDescInitialValue(){
return DataType.getAsString(this.getOldObj(S_ServiceDesc));
}
public void initServiceImplClass(String value){
this.initProperty(S_ServiceImplClass,value);
}
public void setServiceImplClass(String value){
this.set(S_ServiceImplClass,value);
}
public void setServiceImplClassNull(){
this.set(S_ServiceImplClass,null);
}
public String getServiceImplClass(){
return DataType.getAsString(this.get(S_ServiceImplClass));
}
public String getServiceImplClassInitialValue(){
return DataType.getAsString(this.getOldObj(S_ServiceImplClass));
}
public void initServiceStatus(int value){
this.initProperty(S_ServiceStatus,new Integer(value));
}
public void setServiceStatus(int value){
this.set(S_ServiceStatus,new Integer(value));
}
public void setServiceStatus(Integer value){
this.set(S_ServiceStatus,value);
}
public Integer getServiceStatusAsInteger(){
return (Integer )this.get(S_ServiceStatus);
}
public void setServiceStatusNull(){
this.set(S_ServiceStatus,null);
}
public int getServiceStatus(){
return DataType.getAsInt(this.get(S_ServiceStatus));
}
public int getServiceStatusInitialValue(){
return DataType.getAsInt(this.getOldObj(S_ServiceStatus));
}
public void initServiceName(String value){
this.initProperty(S_ServiceName,value);
}
public void setServiceName(String value){
this.set(S_ServiceName,value);
}
public void setServiceNameNull(){
this.set(S_ServiceName,null);
}
public String getServiceName(){
return DataType.getAsString(this.get(S_ServiceName));
}
public String getServiceNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ServiceName));
}
public void initServiceId(long value){
this.initProperty(S_ServiceId,new Long(value));
}
public void setServiceId(long value){
this.set(S_ServiceId,new Long(value));
}
public void setServiceId(Long value){
this.set(S_ServiceId,value);
}
public Long getServiceIdAsLong(){
return (Long )this.get(S_ServiceId);
}
public void setServiceIdNull(){
this.set(S_ServiceId,null);
}
public long getServiceId(){
return DataType.getAsLong(this.get(S_ServiceId));
}
public long getServiceIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_ServiceId));
}
public void initServiceCode(String value){
this.initProperty(S_ServiceCode,value);
}
public void setServiceCode(String value){
this.set(S_ServiceCode,value);
}
public void setServiceCodeNull(){
this.set(S_ServiceCode,null);
}
public String getServiceCode(){
return DataType.getAsString(this.get(S_ServiceCode));
}
public String getServiceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ServiceCode));
}
public void initNameSpace(String value){
this.initProperty(S_NameSpace,value);
}
public void setNameSpace(String value){
this.set(S_NameSpace,value);
}
public void setNameSpaceNull(){
this.set(S_NameSpace,null);
}
public String getNameSpace(){
return DataType.getAsString(this.get(S_NameSpace));
}
public String getNameSpaceInitialValue(){
return DataType.getAsString(this.getOldObj(S_NameSpace));
}
public void initServiceDomain(int value){
this.initProperty(S_ServiceDomain,new Integer(value));
}
public void setServiceDomain(int value){
this.set(S_ServiceDomain,new Integer(value));
}
public void setServiceDomain(Integer value){
this.set(S_ServiceDomain,value);
}
public Integer getServiceDomainAsInteger(){
return (Integer )this.get(S_ServiceDomain);
}
public void setServiceDomainNull(){
this.set(S_ServiceDomain,null);
}
public int getServiceDomain(){
return DataType.getAsInt(this.get(S_ServiceDomain));
}
public int getServiceDomainInitialValue(){
return DataType.getAsInt(this.getOldObj(S_ServiceDomain));
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.Timestamp;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.ITF_CHL_PAYMENT_RESULTValue;
public class TF_CHL_PAYMENT_RESULTBean extends DataContainer implements DataContainerInterface,ITF_CHL_PAYMENT_RESULTValue{
private static String m_boName = "bo.TF_CHL_PAYMENT_RESULT";
public final static String S_CityCode = "CITY_CODE";
public final static String S_ResultCode = "RESULT_CODE";
public final static String S_ProvMerchantId = "PROV_MERCHANT_ID";
public final static String S_FileDate = "FILE_DATE";
public final static String S_PaymentRfee = "PAYMENT_RFEE";
public final static String S_PaymentTime = "PAYMENT_TIME";
public final static String S_ChnlId = "CHNL_ID";
public final static String S_AccountType = "ACCOUNT_TYPE";
public final static String S_EparchyCode = "EPARCHY_CODE";
public final static String S_OperateTime = "OPERATE_TIME";
public final static String S_PaymentResult = "PAYMENT_RESULT";
public final static String S_ContractNumber = "CONTRACT_NUMBER";
public final static String S_TradeTime = "TRADE_TIME";
public final static String S_PaymentFfee = "PAYMENT_FFEE";
public final static String S_PayMode = "PAY_MODE";
public final static String S_AcctId = "ACCT_ID";
public final static String S_OperateStaffId = "OPERATE_STAFF_ID";
public final static String S_PayTradeId = "PAY_TRADE_ID";
public final static String S_ProcessTime = "PROCESS_TIME";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_BankCardPaymentId = "BANK_CARD_PAYMENT_ID";
public final static String S_BankCatdType = "BANK_CATD_TYPE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_CHL_PAYMENT_RESULTBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
//�����������������ҵ���������
throw new AIException("Cannot reset ObjectType");
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initResultCode(String value){
this.initProperty(S_ResultCode,value);
}
public void setResultCode(String value){
this.set(S_ResultCode,value);
}
public void setResultCodeNull(){
this.set(S_ResultCode,null);
}
public String getResultCode(){
return DataType.getAsString(this.get(S_ResultCode));
}
public String getResultCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ResultCode));
}
public void initProvMerchantId(String value){
this.initProperty(S_ProvMerchantId,value);
}
public void setProvMerchantId(String value){
this.set(S_ProvMerchantId,value);
}
public void setProvMerchantIdNull(){
this.set(S_ProvMerchantId,null);
}
public String getProvMerchantId(){
return DataType.getAsString(this.get(S_ProvMerchantId));
}
public String getProvMerchantIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvMerchantId));
}
public void initFileDate(String value){
this.initProperty(S_FileDate,value);
}
public void setFileDate(String value){
this.set(S_FileDate,value);
}
public void setFileDateNull(){
this.set(S_FileDate,null);
}
public String getFileDate(){
return DataType.getAsString(this.get(S_FileDate));
}
public String getFileDateInitialValue(){
return DataType.getAsString(this.getOldObj(S_FileDate));
}
public void initPaymentRfee(String value){
this.initProperty(S_PaymentRfee,value);
}
public void setPaymentRfee(String value){
this.set(S_PaymentRfee,value);
}
public void setPaymentRfeeNull(){
this.set(S_PaymentRfee,null);
}
public String getPaymentRfee(){
return DataType.getAsString(this.get(S_PaymentRfee));
}
public String getPaymentRfeeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PaymentRfee));
}
public void initPaymentTime(Timestamp value){
this.initProperty(S_PaymentTime,value);
}
public void setPaymentTime(Timestamp value){
this.set(S_PaymentTime,value);
}
public void setPaymentTimeNull(){
this.set(S_PaymentTime,null);
}
public Timestamp getPaymentTime(){
return DataType.getAsDateTime(this.get(S_PaymentTime));
}
public Timestamp getPaymentTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_PaymentTime));
}
public void initChnlId(String value){
this.initProperty(S_ChnlId,value);
}
public void setChnlId(String value){
this.set(S_ChnlId,value);
}
public void setChnlIdNull(){
this.set(S_ChnlId,null);
}
public String getChnlId(){
return DataType.getAsString(this.get(S_ChnlId));
}
public String getChnlIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlId));
}
public void initAccountType(String value){
this.initProperty(S_AccountType,value);
}
public void setAccountType(String value){
this.set(S_AccountType,value);
}
public void setAccountTypeNull(){
this.set(S_AccountType,null);
}
public String getAccountType(){
return DataType.getAsString(this.get(S_AccountType));
}
public String getAccountTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AccountType));
}
public void initEparchyCode(String value){
this.initProperty(S_EparchyCode,value);
}
public void setEparchyCode(String value){
this.set(S_EparchyCode,value);
}
public void setEparchyCodeNull(){
this.set(S_EparchyCode,null);
}
public String getEparchyCode(){
return DataType.getAsString(this.get(S_EparchyCode));
}
public String getEparchyCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_EparchyCode));
}
public void initOperateTime(Timestamp value){
this.initProperty(S_OperateTime,value);
}
public void setOperateTime(Timestamp value){
this.set(S_OperateTime,value);
}
public void setOperateTimeNull(){
this.set(S_OperateTime,null);
}
public Timestamp getOperateTime(){
return DataType.getAsDateTime(this.get(S_OperateTime));
}
public Timestamp getOperateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_OperateTime));
}
public void initPaymentResult(String value){
this.initProperty(S_PaymentResult,value);
}
public void setPaymentResult(String value){
this.set(S_PaymentResult,value);
}
public void setPaymentResultNull(){
this.set(S_PaymentResult,null);
}
public String getPaymentResult(){
return DataType.getAsString(this.get(S_PaymentResult));
}
public String getPaymentResultInitialValue(){
return DataType.getAsString(this.getOldObj(S_PaymentResult));
}
public void initContractNumber(String value){
this.initProperty(S_ContractNumber,value);
}
public void setContractNumber(String value){
this.set(S_ContractNumber,value);
}
public void setContractNumberNull(){
this.set(S_ContractNumber,null);
}
public String getContractNumber(){
return DataType.getAsString(this.get(S_ContractNumber));
}
public String getContractNumberInitialValue(){
return DataType.getAsString(this.getOldObj(S_ContractNumber));
}
public void initTradeTime(Timestamp value){
this.initProperty(S_TradeTime,value);
}
public void setTradeTime(Timestamp value){
this.set(S_TradeTime,value);
}
public void setTradeTimeNull(){
this.set(S_TradeTime,null);
}
public Timestamp getTradeTime(){
return DataType.getAsDateTime(this.get(S_TradeTime));
}
public Timestamp getTradeTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_TradeTime));
}
public void initPaymentFfee(String value){
this.initProperty(S_PaymentFfee,value);
}
public void setPaymentFfee(String value){
this.set(S_PaymentFfee,value);
}
public void setPaymentFfeeNull(){
this.set(S_PaymentFfee,null);
}
public String getPaymentFfee(){
return DataType.getAsString(this.get(S_PaymentFfee));
}
public String getPaymentFfeeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PaymentFfee));
}
public void initPayMode(String value){
this.initProperty(S_PayMode,value);
}
public void setPayMode(String value){
this.set(S_PayMode,value);
}
public void setPayModeNull(){
this.set(S_PayMode,null);
}
public String getPayMode(){
return DataType.getAsString(this.get(S_PayMode));
}
public String getPayModeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayMode));
}
public void initAcctId(String value){
this.initProperty(S_AcctId,value);
}
public void setAcctId(String value){
this.set(S_AcctId,value);
}
public void setAcctIdNull(){
this.set(S_AcctId,null);
}
public String getAcctId(){
return DataType.getAsString(this.get(S_AcctId));
}
public String getAcctIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_AcctId));
}
public void initOperateStaffId(String value){
this.initProperty(S_OperateStaffId,value);
}
public void setOperateStaffId(String value){
this.set(S_OperateStaffId,value);
}
public void setOperateStaffIdNull(){
this.set(S_OperateStaffId,null);
}
public String getOperateStaffId(){
return DataType.getAsString(this.get(S_OperateStaffId));
}
public String getOperateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OperateStaffId));
}
public void initPayTradeId(String value){
this.initProperty(S_PayTradeId,value);
}
public void setPayTradeId(String value){
this.set(S_PayTradeId,value);
}
public void setPayTradeIdNull(){
this.set(S_PayTradeId,null);
}
public String getPayTradeId(){
return DataType.getAsString(this.get(S_PayTradeId));
}
public String getPayTradeIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayTradeId));
}
public void initProcessTime(Timestamp value){
this.initProperty(S_ProcessTime,value);
}
public void setProcessTime(Timestamp value){
this.set(S_ProcessTime,value);
}
public void setProcessTimeNull(){
this.set(S_ProcessTime,null);
}
public Timestamp getProcessTime(){
return DataType.getAsDateTime(this.get(S_ProcessTime));
}
public Timestamp getProcessTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_ProcessTime));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initBankCardPaymentId(String value){
this.initProperty(S_BankCardPaymentId,value);
}
public void setBankCardPaymentId(String value){
this.set(S_BankCardPaymentId,value);
}
public void setBankCardPaymentIdNull(){
this.set(S_BankCardPaymentId,null);
}
public String getBankCardPaymentId(){
return DataType.getAsString(this.get(S_BankCardPaymentId));
}
public String getBankCardPaymentIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankCardPaymentId));
}
public void initBankCatdType(String value){
this.initProperty(S_BankCatdType,value);
}
public void setBankCatdType(String value){
this.set(S_BankCatdType,value);
}
public void setBankCatdTypeNull(){
this.set(S_BankCatdType,null);
}
public String getBankCatdType(){
return DataType.getAsString(this.get(S_BankCatdType));
}
public String getBankCatdTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankCatdType));
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AgencyBankPaymentSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AgencyBankPaymentSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AgencyBankPaymentSchema.xsd
agencySignContractTrade,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IInquiryAgentAuditInfoSrv;
import com.ai.uchintService.common.bo.TF_CHL_AGENT_AGREEMENT_RELBean;
import com.ai.uchintService.common.bo.TF_CHL_AGENT_AGREEMENT_RELEngine;
import com.ai.uchintService.common.bo.TF_CHL_AGENT_OPERATION_LOGBean;
import com.ai.uchintService.common.bo.TF_CHL_AGENT_OPERATION_LOGEngine;
import com.ai.uchintService.common.bo.TF_CHL_AGENT_OPERATION_LOGHISBean;
import com.ai.uchintService.common.bo.TF_CHL_AGENT_OPERATION_LOGHISEngine;
import com.ai.uchintService.common.util.Constants;
import com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvINMSGCONTENT;
import com.unicom.wouchannel.inquiryagentauditinfosrv.ResponseMSGCONTENT;
public class InquiryAgentAuditInfoSrvImpl implements IInquiryAgentAuditInfoSrv {
Connection conn = null;
Statement stm = null;
ResultSet rs = null;
public ResponseMSGCONTENT inquiryAgentAuditInfo(
InquiryAgentAuditInfoSrvINMSGCONTENT inputItem) throws Exception {
ResponseMSGCONTENT resMsg = null;
TF_CHL_AGENT_OPERATION_LOGBean[] agentopelogbeans = null;
TF_CHL_AGENT_OPERATION_LOGBean agentopelog = null;
TF_CHL_AGENT_OPERATION_LOGHISBean[] agentopeloghisbeans = null;
TF_CHL_AGENT_OPERATION_LOGHISBean agentopeloghis = null;
TF_CHL_AGENT_AGREEMENT_RELBean[] agentAgreements = null;
/*
* agentopelogbeans = TF_CHL_AGENT_OPERATION_LOGEngine.getBeans(
* "AGENT_ID='" + inputItem.getUCAGENTCODE() + "'", null);
*/
agentopeloghisbeans = TF_CHL_AGENT_OPERATION_LOGHISEngine
.getBeans(
"AGENT_ID='"
+ inputItem.getUCAGENTCODE()
+ "'and update_time is not null order by update_time desc",
null);
if (agentopeloghisbeans != null && agentopeloghisbeans.length > 0) {
agentopeloghis = agentopeloghisbeans[0];
String retStr = Constants.WOEGSTATUS_01;
agentAgreements = TF_CHL_AGENT_AGREEMENT_RELEngine.getBeans(
"AGENT_ID='" + inputItem.getUCAGENTCODE()
+ "'and is_main_sign = '9'", null);
if (agentAgreements != null && agentAgreements.length > 0) {
retStr = Constants.WOEGSTATUS_02;
//一个异网代理商仅对应一个渠道编码,采用下面方式;后续如果存在连锁渠道, 即一个渠道对应多个代理商的时候,需要改代码
String sql = "select ta.chnl_id from"
+ " tf_chl_agreement_rel ta where "
+ "exists (select 1 from tf_chl_agent_agreement_rel tb "
+ "where ta.agree_id = tb.agree_id and tb.agent_id = '"
+ inputItem.getUCAGENTCODE() + "' )and ta.state =1";
rs = getRes(sql);
if (rs.next()) {
resMsg = new ResponseMSGCONTENT();
resMsg.setUCAGENTCODE(String.valueOf(agentopeloghis
.getAgentId()));
resMsg.setAPPROVALSTATUS(retStr);
resMsg.setUCCHNLID(rs.getString(1));
} else {
resMsg = new ResponseMSGCONTENT();
resMsg.setUCAGENTCODE(String.valueOf(agentopeloghis
.getAgentId()));
resMsg.setAPPROVALSTATUS(retStr);
}
} else {
resMsg = new ResponseMSGCONTENT();
resMsg.setUCAGENTCODE(String.valueOf(agentopeloghis
.getAgentId()));
resMsg.setAPPROVALSTATUS(retStr);
}
} else {
agentopelogbeans = TF_CHL_AGENT_OPERATION_LOGEngine.getBeans(
"AGENT_ID='" + inputItem.getUCAGENTCODE() + "'", null);
if (agentopelogbeans != null && agentopelogbeans.length > 0) {
agentopelog = agentopelogbeans[0];
resMsg = new ResponseMSGCONTENT();
resMsg.setUCAGENTCODE(String.valueOf(agentopelog.getAgentId()));
resMsg.setAPPROVALSTATUS(Constants.WOEGSTATUS_00);
} else {
closeConn();
return null;
}
}
/*
* if (agentopelogbeans != null && agentopelogbeans.length > 0) {
* agentopelog = agentopelogbeans[0]; resMsg = new ResponseMSGCONTENT();
* resMsg.setUCAGENTCODE(String.valueOf(agentopelog.getAgentId()));
* resMsg.setAPPROVALSTATUS(agentopelog.getState()); } else { //
* 在订单日志表表未查到,要到 订单日志历史表查(0,1 在订单日志表, 2,3 在订单日志历史表)
*
*
* if (agentopeloghisbeans != null && agentopeloghisbeans.length > 0) {
* agentopeloghis = agentopeloghisbeans[0]; resMsg = new
* ResponseMSGCONTENT();
* resMsg.setUCAGENTCODE(String.valueOf(agentopeloghis .getAgentId()));
* resMsg.setAPPROVALSTATUS(agentopeloghis.getState()); } }
*/
closeConn();
return resMsg;
}
public ResultSet getRes(String sql) throws Exception {
ResultSet retRs = null;
conn = ServiceManager.getSession().getConnection();
stm = conn.createStatement();
retRs = stm.executeQuery(sql);
return retRs;
}
public void closeConn(){
try{
if(rs != null){
rs.close();
}
if(stm != null){
stm.close();
}
if(conn != null){
conn.close();
}
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(rs != null){
rs.close();
}
if(stm != null){
stm.close();
}
if(conn != null){
conn.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.uchintService.busi.service.interfaces.IFrameSV;
import com.ai.uchintService.common.util.Constants;
/**
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Nov 1, 2011
*/
public class FrameSVImpl implements IFrameSV{
@Override
public void selectdB() {
try {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"11");
Connection conn = getConnection();
PreparedStatement ps = conn.prepareStatement("select * from uip_subs");
ResultSet rs = ps.executeQuery();
while(rs.next()) {
System.out.println(rs.getString(1));
}
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
private Connection getConnection() throws SQLException {
return ServiceManager.getSession().getConnection();
}
}
<file_sep>package com.ai.uchintService.penetration.agent;
import java.util.HashMap;
import com.ai.uchintService.common.util.Constants;
import com.ai.uchintService.common.util.StringUtil;
import com.ai.uip.core.bo.UIP_OPERATE_PENETRATIONBean;
import com.ai.uip.platform.penetration.IPenetrationIfBase;
public class AgencySignQianTade implements IPenetrationIfBase{
@Override
public HashMap<String, Object> pubIfParamGen(Object ifMsg, Long logId,
UIP_OPERATE_PENETRATIONBean ifBean) {
HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
retMap.put(Constants.MapResult.MAP_RESULTMSG, "ok");
cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_INPUT req = (cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_INPUT)ifMsg;
cn.chinaunicom.ws.agencypayser.head.HEAD head = req.getHEAD();
if(StringUtil.isBlank(head.getSERVICENAME())){
head.setSERVICENAME("AgencyPaySer");
}
if(StringUtil.isBlank(head.getOPERATENAME())){
head.setOPERATENAME("agencySignQianTade");
}
if(StringUtil.isBlank(head.getINTERVER())){
head.setINTERVER("");
}
if(StringUtil.isBlank(head.getTRANSCODE())){
head.setTRANSCODE("2020214");
}
if(StringUtil.isBlank(head.getTRANSIDH())){
head.setTRANSIDH("");
}
if(StringUtil.isBlank(head.getMERCNO())){
head.setMERCNO("0");
}
if(StringUtil.isBlank(head.getRSPCODE())){
head.setRSPCODE("");
}
if(StringUtil.isBlank(head.getRSPDESC())){
head.setRSPDESC("");
}
if(StringUtil.isBlank(head.getSAFEFLAG())){
head.setTRANSCODE("00");
}
if(StringUtil.isBlank(head.getMAC())){
head.setMAC("");
}
req.setHEAD(head);
retMap.put(Constants.MapResult.MAP_RESULTOBJ, req);
return retMap;
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg, Long logId) {
return null;
}
}
<file_sep>package com.ai.uchintService.ftpFile;
import java.io.File;
import java.io.FileWriter;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.cuframe.core.exception.SystemException;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.busi.service.interfaces.IFtpFileUploadSV;
import com.ai.uchintService.common.bo.INT_AREA_CODEBean;
import com.ai.uchintService.common.bo.INT_AREA_CODEEngine;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.util.MaxIdUtil;
import com.ai.uip.platform.IPublishIfBase;
import com.ai.uip.platform.vo.PublishIfCfgVo;
/**
* ERP文件接口:应付-生成文件
*
* @author: yougang
* @version:1.0
* @created:Aug 24, 2011
*/
public class ERPPublishFilePayable implements IPublishIfBase{
private static final Log logger = LogFactory.getLog(ERPPublishFilePayable.class);
//全局变量,存放文件名、文件内容
private Map<String,Object> map = new Hashtable<String,Object>();
/**
* 生成发送的数据
*/
public HashMap<String, Object> pubIfParamGen(List<String> contentIdLst,
PublishIfCfgVo ifVo, Long logId, String syncType,
HashMap<String, Long> batchMap) {
HashMap<String, Object> obj = new HashMap<String,Object>();
logger.info("==============开始生成发送的数据(应付)================");
String outFileName = "";
try {
/* 0 设置成功返回的标识和描述 */
obj.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
obj.put(Constants.MapResult.MAP_RESULTMSG, "同步处理成功");
/* 1 循环生成文件 */
for (int i=0; i<contentIdLst.size(); i++)
{
outFileName = createLocalFile(contentIdLst.get(i),ifVo);
if (outFileName == null || outFileName.equals(Constants.FILE_STATE_UNDO)) {
return null;
}
obj.put(Constants.MapResult.MAP_RESULTOBJ, outFileName);
}
/* 2 返回发送数据 */
return obj;
} catch (Exception e) {
e.printStackTrace();
//清除obj数据、设置错误代码和描述、返回
obj.clear();
obj.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
obj.put(Constants.MapResult.MAP_RESULTMSG, "生成数据错误"+e.getMessage());
obj.put(Constants.MapResult.MAP_RESULTOBJ, null);
return obj;
} finally {
if (outFileName != null) {
String file_status = "";
if (outFileName.equals(Constants.FILE_STATE_UNDO)) {
file_status = Constants.FILE_STATE_UNDO;
} else {
file_status = Constants.FILE_STATE_FAIL;
}
map.put("file_status", file_status);
FtpFileCommon.saveFileInfo(map);
//FtpFileCommon.fileUploadContinue(map);
}
}
}
/**
* 生成本地文本文件,并返回完整文件路径名
*/
private synchronized String createLocalFile(String contentId,PublishIfCfgVo ifVo) throws Exception
{
//文件内容集合
List<String> contentList = new ArrayList<String>();
//金额总和
double totalMoney = 0;
//清空map
map.clear();
try {
//文件名称
String filename = "";
//公司编码
String companyCode = "";
//生成时间
String createdate = new SimpleDateFormat("yyMM").format(new Date()).toString();
String nowDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();
//地域映射表
INT_AREA_CODEBean[] areaBeans = null;
//判断渠道地市字段不为空
if (ifVo.getSubsBean().getCityCode() !=null && !ifVo.getSubsBean().getCityCode().equals("")) {
areaBeans = INT_AREA_CODEEngine.getBeans(" ERP_AREA_CODE="+ifVo.getSubsBean().getCityCode(),null);
if (areaBeans == null || areaBeans.length==0) return null;
companyCode = areaBeans[0].getErpCompanyCode();
} else {
throw new SystemException("UIP_SUBS表中的CITY_CODE字段不能为空!");
}
//渠道省份编码
String chl_province_code = "";
if (areaBeans[0].getErpAreaLevel()!=null && areaBeans[0].getErpAreaLevel().equals("30")) {
chl_province_code = areaBeans[0].getChlPaAreaCode();
} else if (areaBeans[0].getErpAreaLevel()!=null && areaBeans[0].getErpAreaLevel().equals("20")) {
chl_province_code = areaBeans[0].getChlAreaCode();
} else if (areaBeans[0].getErpAreaLevel()!=null && areaBeans[0].getErpAreaLevel().equals("10")) {
chl_province_code = areaBeans[0].getChlAreaCode();
}
//文件名=公司代码+生成时间+业务代码,如AAAYYMMBBBB.txt
filename+=companyCode+createdate+Constants.ERPFtpBCodeType.BCODE_PAYABLE+".txt";
logger.info("filename:"+filename);
File outFile = new File(ifVo.getOperBean().getFileBackupPath()+File.separator+filename);
FileWriter fw = new FileWriter(outFile);
//上传文件的内容
String fileContent = "";
//获取账期
String acct_cycle = CastUtil.getAcct(2);
if (acct_cycle==null || acct_cycle.equals("")) {
logger.info("===============查询账期表返回null===================");
throw new Exception("账期不合法或指定账期内没有数据!");
}
String sql = "select "+
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,nvl(sum(a.total_menoey),0) total_money ,a.subject"+
" from INT_ERP_TEMP_RESULT a "+
" where a.erp_area_code = '"+areaBeans[0].getErpAreaCode()+
"' and a.erp_area_level = '"+areaBeans[0].getErpAreaLevel()+"' and data_type=2 and ACCT_MONTH='"+acct_cycle+"' "+
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,a.subject";
List<Map<String,Object>> resultList = DbUtil.query(sql, null);
if (resultList !=null && resultList.size()>0) {
for(int i=0;i<resultList.size();i++) {
String lineContent = "";
//公司代码
fileContent += companyCode+",";
//成本中心
fileContent += resultList.get(i).get("cost_cen")+",";
String sql_conver = "select a.conver_code from INT_CONVER_RELATION a "+
" where a.data_type = '"+resultList.get(i).get("data_type")+"' and a.tele_type = '"+resultList.get(i).get("erp_tele_type")+"' "+
" and a.trade_code = '"+resultList.get(i).get("trade_code")+"' and a.client_code = '"+resultList.get(i).get("erp_client_code")+"' and subject='"+resultList.get(i).get("subject")+"'";
//中间码
fileContent += DbUtil.queryForString(sql_conver, null)+",";
//金额
//金额
String money = resultList.get(i).get("total_money")+"";
fileContent += money+",";
if (money != null) {
totalMoney += Double.parseDouble(money);
}
//客户单位代码
fileContent += ",";
//会计日期
fileContent += nowDate+",";
//创建日期
fileContent += nowDate+",";
//币种
fileContent += ",";
//汇率
fileContent += ",";
//说明
fileContent += ",";
fileContent += "\n";
lineContent = FtpFileCommon.handlerArray(fileContent);
contentList.add(lineContent);
}
//设置map内容
map.put("data_type", 2);
map.put("province_code_erp", areaBeans[0].getErpAreaCode());
map.put("province_code", chl_province_code);
map.put("city_code", areaBeans[0].getChlAreaCode());
map.put("totalMoney", new DecimalFormat("0.00").format(totalMoney));
map.put("creatTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"");
map.put("acct_cycle", acct_cycle);
map.put("filename", filename);
map.put("contentList", contentList);
} else {
//设置map内容
map.put("data_type", 2);
map.put("province_code_erp", areaBeans[0].getErpAreaCode());
map.put("province_code", chl_province_code);
map.put("city_code", areaBeans[0].getChlAreaCode());
map.put("totalMoney", new DecimalFormat("0.00").format(totalMoney));
map.put("creatTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"");
map.put("acct_cycle", acct_cycle);
map.put("filename", filename);
map.put("contentList", contentList);
logger.info("=====中间结果表中没有符合要求的数据:resultList为空 ======");
return Constants.FILE_STATE_UNDO;
}
fw.write(fileContent);
fw.flush();
fw.close();
return outFile.getAbsolutePath();
} catch (Exception e) {
e.printStackTrace();
logger.info("生成文件报错.");
return null;
}
}
public HashMap<String, Object> pubIfServiceAdapter(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
return null;
}
/**
* 文件成功上传,后续操作
*/
@SuppressWarnings("unchecked")
public HashMap<String, Object> pubIfServiceContinue(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
try {
getService().updateFileRecord(ifMsg);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public boolean pubIfRetErrorMax(String contentId) {
// TODO Auto-generated method stub
return false;
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg,
PublishIfCfgVo ifVo, Long logId, List<String> contentIdLst,
HashMap<String, Long> batchMap) {
// TODO Auto-generated method stub
return null;
}
public IFtpFileUploadSV getService() {
return (IFtpFileUploadSV)ServiceFactory.getService(IFtpFileUploadSV.class);
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AgentSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AgentSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AgentSchema.xsd
qryAgentMargin,UNI_BSS_BODY,UNI_BSS_BODY
qryAgencyTradeHistory,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.ejb.srv.interfaces;
import com.ai.uint.ejb.vo.CommonEjbSVRequestVO;
import com.ai.uint.ejb.vo.CommonEjbSVResponseVO;
public interface UipUchlChannelReceiveSVRemote {
public CommonEjbSVResponseVO process(CommonEjbSVRequestVO requestVO);
}
<file_sep>@javax.xml.bind.annotation.XmlSchema(namespace = "http://soa.mss.unicom.com/MsgHeader", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.unicom.mss.soa.msgheader;
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
public interface IUC_TF_CHL_AGENT_ROLE_INFOValue extends DataStructInterface{
public final static String S_RegRegionCode = "REG_REGION_CODE";
public final static String S_RegProvCode = "REG_PROV_CODE";
public final static String S_AgentRoleId = "AGENT_ROLE_ID";
public final static String S_AgentDetailType = "AGENT_DETAIL_TYPE";
public final static String S_Remark = "REMARK";
public final static String S_AgentRoleType = "AGENT_ROLE_TYPE";
public final static String S_AgentId = "AGENT_ID";
public final static String S_OrigSysCode = "ORIG_SYS_CODE";
public String getRegRegionCode();
public String getRegProvCode();
public long getAgentRoleId();
public String getAgentDetailType();
public String getRemark();
public String getAgentRoleType();
public long getAgentId();
public String getOrigSysCode();
public void setRegRegionCode(String value);
public void setRegProvCode(String value);
public void setAgentRoleId(long value);
public void setAgentDetailType(String value);
public void setRemark(String value);
public void setAgentRoleType(String value);
public void setAgentId(long value);
public void setOrigSysCode(String value);
}
<file_sep>
package cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.channelinfoprecheckreq;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.channelinfoprecheckreq package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.channelinfoprecheckser.unibssbody.channelinfoprecheckreq
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ }
*
*/
public CHANNEL_INFO_PRECHECK_REQ createCHANNEL_INFO_PRECHECK_REQ() {
return new CHANNEL_INFO_PRECHECK_REQ();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW createCHANNEL_INFO_PRECHECK_REQCHANNEL_INFO_NEW() {
return new CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW.DEVLIST }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW.DEVLIST createCHANNEL_INFO_PRECHECK_REQCHANNEL_INFO_NEWDEVLIST() {
return new CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW.DEVLIST();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD createCHANNEL_INFO_PRECHECK_REQCHANNEL_INFO_OLD() {
return new CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD.DEVLIST }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD.DEVLIST createCHANNEL_INFO_PRECHECK_REQCHANNEL_INFO_OLDDEVLIST() {
return new CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD.DEVLIST();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.PARA }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.PARA createCHANNEL_INFO_PRECHECK_REQPARA() {
return new CHANNEL_INFO_PRECHECK_REQ.PARA();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW.DEVLIST.DEVELOPER }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW.DEVLIST.DEVELOPER createCHANNEL_INFO_PRECHECK_REQCHANNEL_INFO_NEWDEVLISTDEVELOPER() {
return new CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_NEW.DEVLIST.DEVELOPER();
}
/**
* Create an instance of {@link CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD.DEVLIST.DEVELOPER }
*
*/
public CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD.DEVLIST.DEVELOPER createCHANNEL_INFO_PRECHECK_REQCHANNEL_INFO_OLDDEVLISTDEVELOPER() {
return new CHANNEL_INFO_PRECHECK_REQ.CHANNEL_INFO_OLD.DEVLIST.DEVELOPER();
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
public interface ItestSV {
public UC_TF_CHL_PAY_APPLYBean[] test() throws Exception;
public String getRecordId();
}
<file_sep>package cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-05-27T10:34:32.893+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://ws.chinaunicom.cn/AgencyBankRealPaymentRefundNotifySer/", name = "AgencyBankRealPaymentRefundNotifySer")
@XmlSeeAlso({cn.chinaunicom.ws.unibsshead.ObjectFactory.class, cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser.unibssbody.ObjectFactory.class, cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser.unibssbody.agencysendcardpayrefundnotifyrsp.ObjectFactory.class, cn.chinaunicom.ws.unibssattached.ObjectFactory.class, cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser.unibssbody.agencysendcardpayrefundnotifyreq.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface AgencyBankRealPaymentRefundNotifySer {
@WebResult(name = "AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/AgencyBankRealPaymentRefundNotifySer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/AgencyBankRealPaymentRefundNotifySer/agencySendCardPayRefundNotify/")
public cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser.unibssbody.AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_OUTPUT agencySendCardPayRefundNotify(
@WebParam(partName = "parameters", name = "AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_INPUT", targetNamespace = "http://ws.chinaunicom.cn/AgencyBankRealPaymentRefundNotifySer/unibssBody")
cn.chinaunicom.ws.agencybankrealpaymentrefundnotifyser.unibssbody.AGENCY_SEND_CARD_PAY_REFUND_NOTIFY_INPUT parameters
);
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import com.unicom.wouchannel.importagentinfosrv.ImportAgentInfoSrvINMSGCONTENT;
import com.unicom.wouchannel.importagentinfosrv.ResponseMSGCONTENT;
public interface IImportAgentInfoSrv {
/**
* 沃易购传过来的代理商编号是否存在
* true:存在
* false:不存在
* @param agentcode
* @return
*/
public boolean ifAgentcode(String agentcode) throws Exception;
/**
* 代理商信息入库
*/
public ResponseMSGCONTENT importAgentInfo(ImportAgentInfoSrvINMSGCONTENT inputItem) throws Exception;
}
<file_sep><?xml version="1.0" encoding="GBK"?>
<project name="uip" default="package ear" basedir=".">
<property name="src.dir" value="./src" />
<property name="src_api.dir" value="./src_api" />
<property name="src_uch-int.dir" value="./src_uch-int" />
<property name="uch-intservice.dir" value="./uch-intservice" />
<property name="config.dir" value="./config" />
<property name="config_uch-int.dir" value="./config_uch-int" />
<property name="jsp.dir" value="./html" />
<property name="target.dir" value="./target" />
<property name="lib.dir" value="./lib" />
<property name="app_version" value="1.0" />
<property name="app_name" value="uch-int" />
<property name="app_company" value="AsiaInfo-Linkage Ltd" />
<property name="ear_libname" value="lib"/>
<property name="jdk_path" value="C:\bea\jdk160_05"/>
<property name="app_ejbServiceServerName" value="uchlint-ejbserver"/>
<property name="app_bsdmintEjbServiceClientName" value="uchlint-ejbclient-bsdmint"/>
<property name="app_uchlEjbServiceClientName" value="uchlint-ejbclient-uchl"/>
<property name="uip_ejbServiceClientParamsName" value="uip-ejbclient-params"/>
<property name="wsdl.dir" value="./wsdl" />
<!--temp dirs-->
<property name="target.classes.dir" value="${target.dir}/temp.classes" />
<property name="target.web.dir" value="${target.dir}/temp.web" />
<property name="target.release.dir" value="${target.dir}/temp.release" />
<property name="target.lib.dir" location="${target.dir}/${ear_libname}"/>
<!--build date-->
<tstamp>
<format property="day" pattern="yyyyMMdd" />
<format property="time" pattern="HHmmss" />
<format property="dt" pattern="yyyyMMddHHmmssSSS" />
</tstamp>
<property name="releaseVersion" value="${app_version}" />
<!--classpath-->
<path id="project.class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- manifest.classpath -->
<pathconvert property="manifest.classpath" pathsep=" ">
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*" to="lib/*" />
</chainedmapper>
</mapper>
<path>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
</pathconvert>
<!--readme-->
<target name="readme">
<echo message="build ear package for project" />
</target>
<!-- clean the release target dir -->
<target name="clean" depends="readme" description="removes build artifacts">
<echo message="begin clean the release target dir..." />
<mkdir dir="${target.dir}" />
<delete includeemptydirs="true">
<fileset dir="${target.dir}">
<include name="**/*" />
</fileset>
</delete>
<echo message="end clean the release target dir..." />
</target>
<!--mk dir-->
<target name="mkdirs" depends="clean">
<echo message="begin create temp dirs" />
<mkdir dir="${target.dir}" />
<mkdir dir="${target.classes.dir}" />
<mkdir dir="${target.web.dir}" />
<mkdir dir="${target.release.dir}" />
<mkdir dir="${target.lib.dir}" />
<echo message="end create temp dirs" />
</target>
<!--compile all the java sources -->
<target name="javac" depends="mkdirs">
<echo message="compile all the java sources..." />
<javac srcdir="${src.dir}:${src_api.dir}:${src_uch-int.dir}:${uch-intservice.dir}" destdir="${target.classes.dir}" source="1.6" target="1.6" debug="true" nowarn="yes" fork="true" memoryMaximumSize="1024m" encoding="UTF-8">
<classpath refid="project.class.path" />
<compilerarg value="-Xlint:unchecked -Xlint:deprecation" />
</javac>
<echo message="compiled successful..." />
</target>
<!--copy config to classes-->
<target name="copy config to classes" depends="javac">
<echo message="begin copy /config to target/temp.classes ..." />
<copy todir="${target.classes.dir}" includeemptydirs="false">
<fileset dir="${config.dir}" />
</copy>
<echo message="end copy /config to target/temp.classes..." />
<echo message="begin copy /config_uch-int to target/temp.classes ..." />
<copy todir="${target.classes.dir}" includeemptydirs="false">
<fileset dir="${config_uch-int.dir}" />
</copy>
<echo message="end copy /config_uch-int to target/temp.classes..." />
</target>
<!--package ejb-->
<target name="package ejb" depends="copy config to classes">
<echo message="begin package ejb..." />
<!--package service ejb-->
<jar jarfile="${target.release.dir}/${app_ejbServiceServerName}.jar">
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${app_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Specification-remark" value="ejb jar for service" />
<attribute name="Implementation-Title" value="${app_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section>
</manifest>
<fileset dir="${target.classes.dir}">
<include name="com/ai/uip/ejb/impl/UipUchlEjbSVBean.*"/>
<include name="com/ai/uip/ejb/interfaces/UipUchlEjbSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelCreateWfSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelUpdateSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlLiquidationTaskFinishSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlPrecheckTaskFinshSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlOrderSyncResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlRelChnlChgResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlWaitPrevActionSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlPreValidateResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelParamReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlAppleAuthReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelCreateWfSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelReceiveSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelUpdateSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlLiquidationTaskFinishSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlPrecheckTaskFinshSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlOrderSyncResultSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlRelChnlChgResultSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlWaitPrevActionSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlPreValidateResultSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelParamReceiveSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlAppleAuthReceiveSVBean.*"/>
</fileset>
</jar>
<!--package client ejb-->
<jar jarfile="${target.dir}/${app_bsdmintEjbServiceClientName}.jar">
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${app_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Specification-remark" value="ejb jar for client" />
<attribute name="Implementation-Title" value="${app_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section>
</manifest>
<fileset dir="${target.classes.dir}">
<include name="com/ai/uip/ejb/interfaces/UipUchlEjbSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlOrderSyncResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlRelChnlChgResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlWaitPrevActionSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlPreValidateResultSVRemote.*"/>
</fileset>
</jar>
<jar jarfile="${target.dir}/${app_uchlEjbServiceClientName}.jar">
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${app_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Specification-remark" value="ejb jar for client" />
<attribute name="Implementation-Title" value="${app_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section>
</manifest>
<fileset dir="${target.classes.dir}">
<include name="com/ai/uip/ejb/interfaces/UipUchlEjbSVRemote.*"/>
<include name="com/ai/uchintService/ejb/VO/precheckResult/**/*" />
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelCreateWfSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelUpdateSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlLiquidationTaskFinishSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlPrecheckTaskFinshSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelParamReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlAppleAuthReceiveSVRemote.*"/>
</fileset>
</jar>
<!-- delete ejb class -->
<echo message="begin delete ejb class ..." />
<delete includeemptydirs="false">
<fileset dir="${target.classes.dir}">
<include name="com/ai/uip/ejb/impl/UipUchlEjbSVBean.*"/>
<include name="com/ai/uip/ejb/interfaces/UipUchlEjbSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelCreateWfSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelUpdateSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlLiquidationTaskFinishSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlPrecheckTaskFinshSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlOrderSyncResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChnlRelChnlChgResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlWaitPrevActionSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlPreValidateResultSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/interfaces/UipUchlChannelParamReceiveSVRemote.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelCreateWfSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelReceiveSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelUpdateSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlLiquidationTaskFinishSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlPrecheckTaskFinshSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlOrderSyncResultSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChnlRelChnlChgResultSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlWaitPrevActionSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlPreValidateResultSVBean.*"/>
<include name="com/ai/uchintService/ejb/srv/impl/UipUchlChannelParamReceiveSVBean.*"/>
</fileset>
</delete>
<echo message="end delete ejb class ..." />
<copy todir="${target.dir}" flatten="true">
<fileset dir="${lib.dir}" >
<include name="${uip_ejbServiceClientParamsName}.jar" />
</fileset>
</copy>
<echo message="end package ejb..." />
</target>
<!--package jar-->
<target name="package jar" depends="package ejb">
<echo message="begin package jar.."/>
<jar destfile="${target.release.dir}/${app_name}-${releaseVersion}.jar" basedir="${target.classes.dir}">
<fileset dir="${target.classes.dir}">
<include name="**/*" />
</fileset>
<!-- manifest -->
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${bsdmService_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Implementation-Title" value="${bsdmService_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section>
</manifest >
</jar>
</target>
<!--package war-->
<target name="package war" depends="package jar">
<echo message="begin create temp web dirs" />
<mkdir dir="${target.web.dir}/WEB-INF" />
<mkdir dir="${target.web.dir}/WEB-INF/classes" />
<mkdir dir="${target.web.dir}/WEB-INF/classes/wsdl" />
<mkdir dir="${target.web.dir}/WEB-INF/lib" />
<echo message="end create temp web dirs" />
<echo message="start copy html to web..." />
<copy todir="${target.web.dir}">
<fileset dir="${jsp.dir}">
<include name="META-INF/MANIFEST.MF" />
<include name="index.jsp" />
<include name="testServer.jsp" />
</fileset>
</copy>
<copy todir="${target.web.dir}/WEB-INF">
<fileset dir="${jsp.dir}/WEB-INF">
<include name="web.xml" />
<include name="weblogic.xml" />
</fileset>
</copy>
<copy todir="${target.web.dir}/WEB-INF/classes/wsdl">
<fileset dir="${wsdl.dir}">
<exclude name="*svn.*" />
<exclude name="binding.xml" />
<exclude name="w2j.bat" />
</fileset>
</copy>
<!--
<mkdir dir="${target.web.dir}/wsdl" />
<copy todir="${target.web.dir}/wsdl">
<fileset dir="${wsdl.dir}">
<exclude name="*svn.*" />
<exclude name="binding.xml" />
<exclude name="w2j.bat" />
</fileset>
</copy>
-->
<echo message="end copy html to web..." />
<echo message="start packaging ${app_name}.war..." />
<jar jarfile="${target.release.dir}/${app_name}.war">
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${app_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Implementation-Title" value="${app_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section >
</manifest >
<fileset dir="${target.web.dir}">
<include name="**/*" />
</fileset>
</jar>
<echo message="end packaged ${app_name}.war..." />
</target>
<!--copy classes and libs to temp.lib-->
<target name="copy libs to lib" depends="package war">
<echo message="copy libs to temp.lib..." />
<copy todir="${target.lib.dir}" flatten="true">
<fileset dir="${lib.dir}">
<!--
<include name="**/*.jar" />
-->
<exclude name="${uip_ejbServiceClientParamsName}.jar"/>
</fileset>
<fileset dir="${target.release.dir}">
<include name="${app_name}-${releaseVersion}.jar" />
</fileset>
</copy>
<echo message="end copy libs to temp.lib..." />
<echo message="copy libs to web.lib..." />
<copy todir="${target.web.dir}/WEB-INF/lib" flatten="true">
<fileset dir="${lib.dir}">
<!--
<include name="**/*.jar" />
-->
<exclude name="${uip_ejbServiceClientParamsName}.jar"/>
<exclude name="**/vbjorb.jar"/>
<exclude name="**/vbsec.jar"/>
<exclude name="**/mail.jar"/>
<exclude name="**/twns.jar"/>
</fileset>
<fileset dir="${target.release.dir}">
<include name="${app_name}-${releaseVersion}.jar" />
</fileset>
</copy>
<echo message="end copy libs to web.lib..." />
</target>
<!--package web war-->
<target name="package web war" depends="copy libs to lib">
<echo message="start packaging web ${app_name}.war..." />
<jar jarfile="${target.dir}/${app_name}.war">
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${app_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Implementation-Title" value="${app_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section >
</manifest >
<fileset dir="${target.web.dir}">
<include name="**/*" />
</fileset>
</jar>
<echo message="end packaged web ${app_name}.war..." />
</target>
<!--package ear-->
<target name="package ear" depends="copy libs to lib,package ejb,package war,package web war">
<echo message="start packaging ${app_name}.ear..." />
<ear earfile="${target.dir}/${app_name}.ear" appxml="${jsp.dir}/META-INF/application.xml">
<manifest>
<attribute name="Built-By" value="AILK-CU" />
<section name="${app_name}">
<attribute name="Specification-Title" value="${app_name}" />
<attribute name="Specification-Version" value="${app_version}" />
<attribute name="Specification-Vendor" value="${app_company}" />
<attribute name="Specification-Date" value="${dt}" />
<attribute name="Implementation-Title" value="${app_name}" />
<attribute name="Implementation-Version" value="${app_version}" />
<attribute name="Implementation-Vendor" value="${app_company}" />
</section >
</manifest >
<fileset dir="${target.dir}">
<include name="${ear_libname}/**/*" />
</fileset>
<fileset dir="${target.release.dir}">
<include name="${app_name}.war" />
<include name="${app_ejbServiceServerName}.jar" />
</fileset>
<!--
<fileset dir="${jsp.dir}">
<include name="META-INF/bes-application.xml" />
</fileset>
-->
</ear>
<!--
<echo message="start clean temp dirs and temp files..." />
<delete includeemptydirs="true">
<fileset dir="${target.classes.dir}" />
<fileset dir="${target.web.dir}" />
<fileset dir="${target.release.dir}" />
<fileset dir="${target.lib.dir}" />
<fileset dir="${target.dir}">
<include name="${app_ejbServiceName}.jar" />
</fileset>
</delete>
<echo message="cleaned temp dirs and temp files successful..." />
-->
<echo message="end packaged ${app_name}.ear..." />
</target>
</project>
<file_sep>package com.ai.uchintService.penetration.woego;
import java.util.HashMap;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UIP_OPERATE_PENETRATIONBean;
import com.ai.uip.platform.penetration.IPenetrationIfBase;
public class QryAgentWOEGOMarginInfo implements IPenetrationIfBase{
@Override
public HashMap<String, Object> pubIfParamGen(Object ifMsg, Long logId,
UIP_OPERATE_PENETRATIONBean ifBean) {
HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
retMap.put(Constants.MapResult.MAP_RESULTMSG, "ok");
com.unicom.wouchannel.qryagentwoegomargininfosrv.QryAgentWOEGOMarginInfoSrvIn req = (com.unicom.wouchannel.qryagentwoegomargininfosrv.QryAgentWOEGOMarginInfoSrvIn)ifMsg;
retMap.put(Constants.MapResult.MAP_RESULTOBJ, req);
return retMap;
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg, Long logId) {
return null;
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AgencyBankRealPaymentRefundNotifySchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AgencyBankRealPaymentRefundNotifySchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AgencyBankRealPaymentRefundNotifySchema.xsd
agencySendCardPayRefundNotify,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.ejb.paramImpl.bsdmchannel;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_NOTIFY_INPUT;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_NOTIFY_OUTPUT;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyrsp.CHANNEL_INFO_CHG_NOTIFY_RSP;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD.ROUTING;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgNotifyReqVO;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgNotifyRspVO;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgNotifyReqVO.DEVLIST;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgNotifyReqVO.EXTINFO;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgNotifyReqVO.FUNCLIST;
import com.ai.uint.ejb.interfaces.IUipParamImplForSendSV;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ejb.util.ResultMsg;
import com.ai.uint.paramsMang.vo.PublishCfgVo;
/**
* @user: 渠道变更通知
* @author: yougang
* @version:1.0
* @created:Apr 28, 2012
*/
public class ChannelInfoChgNotifyParamImpl implements IUipParamImplForSendSV{
private static final Log logger = LogFactory.getLog(ChannelInfoChgNotifyParamImpl.class);
private ChannelInfoChgNotifyReqVO reqVO;
private ChannelInfoChgNotifyRspVO rspVO;
public ChannelInfoChgNotifyParamImpl(){
rspVO = new ChannelInfoChgNotifyRspVO();
logger.info("实例化ChannelInfoChgNotifyRspVO 成功");
}
@Override
public Map<String, Object> getRecordData(Object inputParam) {
logger.info("调用方法getRecordData()......");
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
if (inputParam instanceof ChannelInfoChgNotifyReqVO) {
reqVO = (ChannelInfoChgNotifyReqVO)inputParam;
} else {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG,"类型匹配错误:"+inputParam.getClass().getName());
return retMap;
}
//检查入参:inputParam是否为空
boolean flag = true;
String resultMsg = "";
if (reqVO.getOPERATE_TYPE() == null) {
resultMsg += " 操作类型不能为空[operateTYPE]!";
flag = false;
}
if (reqVO.getORDER_ID() == null ) {
resultMsg += " 订单流水不能为空[orderID]!";
flag = false;
}
if (reqVO.getCHNL_ID() == null ) {
resultMsg += " 渠道ID不能为空[chnlID]!";
flag = false;
}
if (reqVO.getCHNL_CODE() == null ) {
resultMsg += " 渠道编码不能为空[chnlCODE]!";
flag = false;
}
if (reqVO.getCHNL_NAME() == null ) {
resultMsg += " 渠道名称不能为空[chnlNAME]!";
flag = false;
}
if (reqVO.getSTATE() == null ) {
resultMsg += " 状态不能为空[state]!";
flag = false;
}
if (reqVO.getCHNL_KIND_ID() == null ) {
resultMsg += " 渠道类型不能为空[chnlKINDID]!";
flag = false;
}
if (reqVO.getMANAGER_AREA_CODE() == null ) {
resultMsg += " 渠道归属区域不能为空[managerAREACODE]!";
flag = false;
}
if (reqVO.getMANAGER_DEPT_ID() == null ) {
resultMsg += " 渠道ID不能为空[managerDEPTID]!";
flag = false;
}
if (!flag) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG,resultMsg);
return retMap;
}
List<String> retContentId = new ArrayList<String>();
retContentId.add(reqVO.getORDER_ID());
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ,retContentId);
return retMap;
}
@Override
public Map<String, Object> getReqMsg(List<String> contentList,
Map<String, Long> detailMap, Long sendID, PublishCfgVo cfgVo) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
CHANNEL_INFO_CHG_NOTIFY_INPUT input = new CHANNEL_INFO_CHG_NOTIFY_INPUT();
UNI_BSS_HEAD uniBssHead = new UNI_BSS_HEAD();
//拼写报文头
uniBssHead.setORIG_DOMAIN("118");
uniBssHead.setSERVICE_NAME("BSdmChannelInfoSer");
uniBssHead.setOPERATE_NAME("channelInfoChgNotify");
uniBssHead.setACTION_CODE("0");
uniBssHead.setACTION_RELATION("0");
ROUTING routing = new UNI_BSS_HEAD.ROUTING();
routing.setROUTE_TYPE("00");
routing.setROUTE_VALUE("09");
uniBssHead.setROUTING(routing);
uniBssHead.setPROC_ID(""+sendID);
uniBssHead.setTRANS_IDO(""+sendID);
uniBssHead.setPROCESS_TIME(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
UNI_BSS_HEAD.COM_BUS_INFO comBUSINFO = new UNI_BSS_HEAD.COM_BUS_INFO();
comBUSINFO.setOPER_ID("UCHL");
comBUSINFO.setPROVINCE_CODE("09");
comBUSINFO.setCHANNEL_ID("A1000");
comBUSINFO.setACCESS_TYPE("01");
comBUSINFO.setORDER_TYPE("01");
comBUSINFO.setCHANNEL_TYPE("2010101");
uniBssHead.setCOM_BUS_INFO(comBUSINFO);
UNI_BSS_HEAD.SP_RESERVE spRESERVE = new UNI_BSS_HEAD.SP_RESERVE();
spRESERVE.setTRANS_IDC(""+sendID);
SimpleDateFormat formatter8 = new SimpleDateFormat("yyyy-MM-dd");
spRESERVE.setCUTOFFDAY(formatter8.format(new Date(System.currentTimeMillis())));
spRESERVE.setOSNDUNS("0700");
//可以不填
spRESERVE.setHSNDUNS("0000");
SimpleDateFormat formatter17 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
spRESERVE.setCONV_ID(formatter17.format(new Date(System.currentTimeMillis())));
uniBssHead.setSP_RESERVE(spRESERVE);
uniBssHead.setTEST_FLAG("0");
uniBssHead.setMSG_SENDER("0700");
uniBssHead.setMSG_RECEIVER("0000");
//需要生成HEAD
input.setUNI_BSS_HEAD(uniBssHead);
CHANNEL_INFO_CHG_NOTIFY_INPUT.UNI_BSS_BODY uniBssBody = new CHANNEL_INFO_CHG_NOTIFY_INPUT.UNI_BSS_BODY();
CHANNEL_INFO_CHG_NOTIFY_REQ retreq = new CHANNEL_INFO_CHG_NOTIFY_REQ();
for(int i=0;i<contentList.size();i++) {
//遍历content
//在reqVO查找对应的记录
if (reqVO.getORDER_ID().equals(contentList.get(i))) {
retreq.setOPERATE_TYPE(reqVO.getOPERATE_TYPE());
retreq.setORDER_ID(reqVO.getORDER_ID());
retreq.setCHNL_ID(reqVO.getCHNL_ID());
retreq.setCHNL_CODE(reqVO.getCHNL_CODE());
retreq.setCHNL_NAME(reqVO.getCHNL_NAME());
retreq.setCHNL_DESC(reqVO.getCHNL_DESC());
retreq.setCHNL_ORG_ID(reqVO.getCHNL_ORG_ID());
retreq.setSTATE(reqVO.getSTATE());
retreq.setSTATE_DESC(reqVO.getSTATE_DESC());
retreq.setCHNL_KIND_ID(reqVO.getCHNL_KIND_ID());
retreq.setLOCAL_KIND_ID(reqVO.getLOCAL_KIND_ID());
retreq.setCHNL_CLASS_ID(reqVO.getCHNL_CLASS_ID());
retreq.setCHAIN_FLAG(reqVO.getCHAIN_FLAG());
retreq.setIS_RWD_CNT(reqVO.getIS_RWD_CNT());
retreq.setPAY_SCOPE(reqVO.getPAY_SCOPE());
retreq.setPAY_CHNL_CODE(reqVO.getPAY_CHNL_CODE());
retreq.setSUPER_CHNL_ID(reqVO.getSUPER_CHNL_ID());
retreq.setSELF_CHNL_ID(reqVO.getSELF_CHNL_ID());
retreq.setRWD_CNT_DATE(reqVO.getRWD_CNT_DATE());
retreq.setLIQUIDATION_START_DATE(reqVO.getLIQUIDATION_START_DATE());
retreq.setLIQUIDATION_PAY_FLAG(reqVO.getLIQUIDATION_PAY_FLAG());
retreq.setPROVINCE_CODE(reqVO.getPROVINCE_CODE());
retreq.setCITY_CODE(reqVO.getCITY_CODE());
retreq.setMANAGER_AREA_CODE(reqVO.getMANAGER_AREA_CODE());
retreq.setAREA_TYPE(reqVO.getAREA_TYPE());
retreq.setCHNL_LEVEL(reqVO.getCHNL_LEVEL());
retreq.setCHNL_CHAIN_LEVEL(reqVO.getCHNL_CHAIN_LEVEL());
retreq.setIS_INPUT_SYSTEM(reqVO.getIS_INPUT_SYSTEM());
retreq.setSYSTEM_NUM(reqVO.getSYSTEM_NUM());
retreq.setIS_MINI_HALL(reqVO.getIS_MINI_HALL());
retreq.setCHNL_SCOPE(reqVO.getCHNL_SCOPE());
retreq.setCHNL_AREA_KIND_ID(reqVO.getCHNL_AREA_KIND_ID());
retreq.setBANK_CODE(reqVO.getBANK_CODE());
retreq.setBANK_NO(reqVO.getBANK_NO());
retreq.setBANK_ACCT_NAME(reqVO.getBANK_ACCT_NAME());
retreq.setADDRESS(reqVO.getADDRESS());
retreq.setCHNL_LINKMAN_NAME(reqVO.getCHNL_LINKMAN_NAME());
retreq.setCHNL_LINKMAN_SEX(reqVO.getCHNL_LINKMAN_SEX());
retreq.setCHNL_EMAIL(reqVO.getCHNL_EMAIL());
retreq.setCHNL_FAX(reqVO.getCHNL_FAX());
retreq.setCHNL_ADDR(reqVO.getCHNL_ADDR());
retreq.setCHNL_OFFICE_PHONE(reqVO.getCHNL_OFFICE_PHONE());
retreq.setCHNL_PHONE(reqVO.getCHNL_PHONE());
retreq.setCHNL_POSTALCODE(reqVO.getCHNL_POSTALCODE());
retreq.setLONGITUDE(reqVO.getLONGITUDE());
retreq.setLATITUDE(reqVO.getLATITUDE());
retreq.setMANAGER_DEPT_ID(reqVO.getMANAGER_DEPT_ID());
retreq.setMANAGER_STAFF_ID(reqVO.getMANAGER_STAFF_ID());
retreq.setMANAGER_EMAIL(reqVO.getMANAGER_EMAIL());
retreq.setMANAGER_PHONE(reqVO.getMANAGER_PHONE());
retreq.setRES_DEPT_ID(reqVO.getRES_DEPT_ID());
retreq.setAPPLY_CODE(reqVO.getAPPLY_CODE());
retreq.setBATCH_NO(reqVO.getBATCH_NO());
retreq.setREMARK(reqVO.getREMARK());
retreq.setAFFILIATETIME(reqVO.getAFFILIATETIME());
retreq.setSTART_TIME(reqVO.getSTART_TIME());
retreq.setEND_TIME(reqVO.getEND_TIME());
retreq.setCREATE_STAFF_ID(reqVO.getCREATE_STAFF_ID());
retreq.setCREATE_TIME(reqVO.getCREATE_TIME());
retreq.setUPDATE_DATE(reqVO.getUPDATE_DATE());
retreq.setUPDATE_DEPART_ID(reqVO.getUPDATE_DEPART_ID());
retreq.setUPDATE_STAFF_ID(reqVO.getUPDATE_STAFF_ID());
retreq.setIS_REALLY_CHNL(reqVO.getIS_REALLY_CHNL());
retreq.setJURI_PSPT_ID(reqVO.getJURI_PSPT_ID());
retreq.setCIM_CHANNEL_ID(reqVO.getCIM_CHANNEL_ID());
retreq.setDEBT_WARN(reqVO.getDEBT_WARN());
retreq.setEPARCHY_CODE(reqVO.getEPARCHY_CODE());
retreq.setB_CITY_CODE(reqVO.getB_CITY_CODE());
retreq.setB_ZONEID(reqVO.getB_ZONEID());
retreq.setINTEGRAL(reqVO.getINTEGRAL());
retreq.setPENALTY(reqVO.getPENALTY());
retreq.setFOUL_TIME(reqVO.getFOUL_TIME());
retreq.setERP_CODE(reqVO.getERP_CODE());
retreq.setCOPARTNER_ID(reqVO.getCOPARTNER_ID());
retreq.setPARENT_DEPART_ID(reqVO.getPARENT_DEPART_ID());
retreq.setMANAGE_CHNL_ID(reqVO.getMANAGE_CHNL_ID());
retreq.setIF_MANAGE_CHNL(reqVO.getIF_MANAGE_CHNL());
retreq.setCHNL_KIND_FRAME(reqVO.getCHNL_KIND_FRAME());
retreq.setCHNL_LAYER(reqVO.getCHNL_LAYER());
retreq.setCHNL_CREDIT(reqVO.getCHNL_CREDIT());
retreq.setNATIONAL_CHNL(reqVO.getNATIONAL_CHNL());
retreq.setBUSI_PERMISSION(reqVO.getBUSI_PERMISSION());
retreq.setJURI_PSPT_TYPE(reqVO.getJURI_PSPT_TYPE());
retreq.setJURI_PERSON(reqVO.getJURI_PERSON());
retreq.setREG_DATE(reqVO.getREG_DATE());
retreq.setTAX_NO(reqVO.getTAX_NO());
retreq.setBUSI_LICENCE(reqVO.getBUSI_LICENCE());
// try {
// BeanUtils.copyProperties(retreq, reqVO);
// } catch (IllegalAccessException e1) {
// e1.printStackTrace();
// } catch (InvocationTargetException e1) {
// e1.printStackTrace();
// }
//前台传递的发展人信息
DEVLIST devList= reqVO.getDEVLIST();
//报文里的发展人信息
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST devList2 =
new cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST();
//把devList的值赋给devList2
if (devList.getDEVINFO() !=null) {
List<ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO> devInfoList = devList.getDEVINFO();
for(ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO devInfo :devInfoList) {
//VO内容
ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO cdInfo = devInfo.getCHNLDEVINFO();
ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.DEVELOPER dl = devInfo.getDEVELOPER();
//INPUT内容
CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO cdInfo2 = new CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO();
CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER dl2 = new CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER();
try {
BeanUtils.copyProperties(cdInfo2, cdInfo);
BeanUtils.copyProperties(dl2, dl);
CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO inputDevInfo = new CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO();
inputDevInfo.setCHNLDEVINFO(cdInfo2);
inputDevInfo.setDEVELOPER(dl2);
devList2.getDEVINFO().add(inputDevInfo);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
retreq.setDEVLIST(devList2);
//前台传递的扩展信息
List<EXTINFO> extInfoList= reqVO.getEXTINFO();
//报文里的扩展信息
List<cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO> extInfoList2 =
new ArrayList<cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO>();
//把extInfoList的值赋给extInfoList2
if (extInfoList != null) {
for(EXTINFO extInfo :extInfoList) {
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO
extInfo2 = new cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.EXTINFO();
try {
BeanUtils.copyProperties(extInfo2,extInfo);
extInfoList2.add(extInfo2);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
retreq.setEXTINFO(extInfoList2);
//前台传递的职能表信息
FUNCLIST fun= reqVO.getFUNCLIST();
//报文里的职能表信息
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST fun2 =
new cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST();
//把fun的值赋给fun2
if (fun.getFUNCINFO() !=null) {
List<ChannelInfoChgNotifyReqVO.FUNCLIST.FUNCINFO> funList = fun.getFUNCINFO();
for(ChannelInfoChgNotifyReqVO.FUNCLIST.FUNCINFO funInfo :funList) {
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST.FUNCINFO
funInfo2 = new cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.FUNCLIST.FUNCINFO();
try {
BeanUtils.copyProperties(funInfo2, funInfo);
fun2.getFUNCINFO().add(funInfo2);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
retreq.setFUNCLIST(fun2);
//目前只有一条记录
break;
}
}
uniBssBody.setCHANNEL_INFO_CHG_NOTIFY_REQ(retreq);
input.setUNI_BSS_BODY(uniBssBody);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, input);
return retMap;
}
@Override
public void setSubsInfo(List<String> contentList, PublishCfgVo cfgVo) {
//同步接口不需要实现此方法
return;
}
@Override
public Map<String, Object> handleRespMsg(List<String> contentList,
PublishCfgVo cfgVo, Object respObject, String resultDesc) {
Map<String, Object> retMap = new HashMap<String, Object>();
List<ResultMsg> retList = new ArrayList<ResultMsg>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
if (respObject == null) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
} else {
//解析报文
String strResultCode = Constants.StateDef.FAIL;
String strResultDesc = "";
CHANNEL_INFO_CHG_NOTIFY_OUTPUT output = (CHANNEL_INFO_CHG_NOTIFY_OUTPUT)respObject;
UNI_BSS_HEAD uniBSSHEAD = output.getUNI_BSS_HEAD();
if (uniBSSHEAD == null)
{
//包头为空,返回错误
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "对端返回UNI_BSS_HEAD为空";
}
else
{
UNI_BSS_HEAD.RESPONSE response = uniBSSHEAD.getRESPONSE();
if (response == null)
{
//包头RESPONSE节点为空,返回错误
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "对端返回UNI_BSS_HEAD的RESPONSE节点为空";
}
else
{
if (response.getRSP_CODE() == null)
{
//包头错误
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "对端返回UNI_BSS_HEAD的RESPONSE的RSP_CODE节点为空";
}
else
{
if (response.getRSP_CODE().equals("0000"))
{
//传输正确且业务成功
strResultCode = Constants.StateDef.SUCCESS;
strResultDesc = "处理成功";
}
else if (response.getRSP_CODE().equals("9999"))
{
//传输正确而业务错误,需要查询UNI_BSS_BODY节点
CHANNEL_INFO_CHG_NOTIFY_OUTPUT.UNI_BSS_BODY uniBSSBODY = output.getUNI_BSS_BODY();
if (uniBSSBODY == null)
{
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,对端返回UNI_BSS_BODY节点为空";
}
else
{
CHANNEL_INFO_CHG_NOTIFY_RSP channelResultRsp = uniBSSBODY.getCHANNEL_INFO_CHG_NOTIFY_RSP();
if (channelResultRsp == null)
{
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,对端返回UNI_BSS_BODY节点的CHANNEL_INFO_CHG_NOTIFY_RSP节点为空";
}
else
{
if (channelResultRsp.getRESP_CODE() == null)
{
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,对端返回UNI_BSS_BODY节点的CHANNEL_INFO_CHG_NOTIFY_RSP节点的RESP_CODE节点为空";
}
else
{
String bodyRespDesc = "";
if (channelResultRsp.getRESP_DESC() != null) bodyRespDesc = channelResultRsp.getRESP_DESC();
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,错误代码:"+channelResultRsp.getRESP_CODE()+",错误描述:"+bodyRespDesc;
}
}
}
}
else
{
//传输错误
String rspDesc = "";
if (response.getRSP_DESC() != null) rspDesc = response.getRSP_DESC();
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "传输错误,错误代码:"+response.getRSP_CODE()+",错误描述:"+rspDesc;
}
}
}
}
//返回框架报文解析信息
for (int i=0;i<contentList.size();i++) {
ResultMsg resultMsg = new ResultMsg();
resultMsg.setContentId(contentList.get(i));
resultMsg.setResultCode(strResultCode);
resultMsg.setResultDesc(strResultDesc);
retList.add(resultMsg);
}
//记录报文解析信息
rspVO.setRESP_CODE(strResultCode);
rspVO.setRESP_DESC(strResultDesc);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, retList);
}
return retMap;
}
@Override
public Map<String, Object> getOutParam() {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, rspVO);
return retMap;
}
public static void main(String[] args) throws Exception{
System.out.println("=================第一个测试=========================");
//测试赋值发展人信息
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST devList2 =
new cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgnotifyreq.CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST();
CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO cdInfo2 = new CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.CHNLDEVINFO();
CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER dl2 = new CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO.DEVELOPER();
cdInfo2.setCHNL_ID("123");
cdInfo2.setEND_TIME("2012-02-10");
dl2.setAREA_CODE("120303");
CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO inputDevInfo = new CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO();
inputDevInfo.setCHNLDEVINFO(cdInfo2);
inputDevInfo.setDEVELOPER(dl2);
//以下操作没问题
devList2.getDEVINFO().add(inputDevInfo);
for(CHANNEL_INFO_CHG_NOTIFY_REQ.DEVLIST.DEVINFO dev:devList2.getDEVINFO()) {
System.out.println(dev.getCHNLDEVINFO().getCHNL_ID());
System.out.println(dev.getDEVELOPER().getAREA_CODE());
}
System.out.println("=================第二个测试=========================");
ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO cdInfo =
new ChannelInfoChgNotifyReqVO.DEVLIST.DEVINFO.CHNLDEVINFO();
cdInfo.setCREATE_STAFF_ID("001");
cdInfo.setREMARK("测试。。。");
BeanUtils.copyProperties(cdInfo2, cdInfo);
System.out.println(cdInfo2.getCREATE_STAFF_ID());
System.out.println(cdInfo2.getREMARK());
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.Timestamp;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.ITF_QZ_PREPAY_ORD_DTLValue;
public class TF_QZ_PREPAY_ORD_DTLBean extends DataContainer implements DataContainerInterface,ITF_QZ_PREPAY_ORD_DTLValue{
private static String m_boName = "bo.TF_QZ_PREPAY_ORD_DTL";
public final static String S_TradeDatetime = "TRADE_DATETIME";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_InsertTime = "INSERT_TIME";
public final static String S_OrgProvinceOrderId = "ORG_PROVINCE_ORDER_ID";
public final static String S_OperNo = "OPER_NO";
public final static String S_PayFee = "PAY_FEE";
public final static String S_PayNum = "PAY_NUM";
public final static String S_TradeType = "TRADE_TYPE";
public final static String S_OperName = "OPER_NAME";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_BusyType = "BUSY_TYPE";
public final static String S_OperDepartId = "OPER_DEPART_ID";
public final static String S_ChnlName = "CHNL_NAME";
public final static String S_ProvinceOrderId = "PROVINCE_ORDER_ID";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_QZ_PREPAY_ORD_DTLBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
//�������������������ҵ���������
throw new AIException("Cannot reset ObjectType");
}
public void initTradeDatetime(String value){
this.initProperty(S_TradeDatetime,value);
}
public void setTradeDatetime(String value){
this.set(S_TradeDatetime,value);
}
public void setTradeDatetimeNull(){
this.set(S_TradeDatetime,null);
}
public String getTradeDatetime(){
return DataType.getAsString(this.get(S_TradeDatetime));
}
public String getTradeDatetimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeDatetime));
}
public void initChnlCode(String value){
this.initProperty(S_ChnlCode,value);
}
public void setChnlCode(String value){
this.set(S_ChnlCode,value);
}
public void setChnlCodeNull(){
this.set(S_ChnlCode,null);
}
public String getChnlCode(){
return DataType.getAsString(this.get(S_ChnlCode));
}
public String getChnlCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlCode));
}
public void initInsertTime(Timestamp value){
this.initProperty(S_InsertTime,value);
}
public void setInsertTime(Timestamp value){
this.set(S_InsertTime,value);
}
public void setInsertTimeNull(){
this.set(S_InsertTime,null);
}
public Timestamp getInsertTime(){
return DataType.getAsDateTime(this.get(S_InsertTime));
}
public Timestamp getInsertTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_InsertTime));
}
public void initOrgProvinceOrderId(String value){
this.initProperty(S_OrgProvinceOrderId,value);
}
public void setOrgProvinceOrderId(String value){
this.set(S_OrgProvinceOrderId,value);
}
public void setOrgProvinceOrderIdNull(){
this.set(S_OrgProvinceOrderId,null);
}
public String getOrgProvinceOrderId(){
return DataType.getAsString(this.get(S_OrgProvinceOrderId));
}
public String getOrgProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrgProvinceOrderId));
}
public void initOperNo(String value){
this.initProperty(S_OperNo,value);
}
public void setOperNo(String value){
this.set(S_OperNo,value);
}
public void setOperNoNull(){
this.set(S_OperNo,null);
}
public String getOperNo(){
return DataType.getAsString(this.get(S_OperNo));
}
public String getOperNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_OperNo));
}
public void initPayFee(String value){
this.initProperty(S_PayFee,value);
}
public void setPayFee(String value){
this.set(S_PayFee,value);
}
public void setPayFeeNull(){
this.set(S_PayFee,null);
}
public String getPayFee(){
return DataType.getAsString(this.get(S_PayFee));
}
public String getPayFeeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayFee));
}
public void initPayNum(String value){
this.initProperty(S_PayNum,value);
}
public void setPayNum(String value){
this.set(S_PayNum,value);
}
public void setPayNumNull(){
this.set(S_PayNum,null);
}
public String getPayNum(){
return DataType.getAsString(this.get(S_PayNum));
}
public String getPayNumInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayNum));
}
public void initTradeType(String value){
this.initProperty(S_TradeType,value);
}
public void setTradeType(String value){
this.set(S_TradeType,value);
}
public void setTradeTypeNull(){
this.set(S_TradeType,null);
}
public String getTradeType(){
return DataType.getAsString(this.get(S_TradeType));
}
public String getTradeTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeType));
}
public void initOperName(String value){
this.initProperty(S_OperName,value);
}
public void setOperName(String value){
this.set(S_OperName,value);
}
public void setOperNameNull(){
this.set(S_OperName,null);
}
public String getOperName(){
return DataType.getAsString(this.get(S_OperName));
}
public String getOperNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_OperName));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initBusyType(String value){
this.initProperty(S_BusyType,value);
}
public void setBusyType(String value){
this.set(S_BusyType,value);
}
public void setBusyTypeNull(){
this.set(S_BusyType,null);
}
public String getBusyType(){
return DataType.getAsString(this.get(S_BusyType));
}
public String getBusyTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BusyType));
}
public void initOperDepartId(String value){
this.initProperty(S_OperDepartId,value);
}
public void setOperDepartId(String value){
this.set(S_OperDepartId,value);
}
public void setOperDepartIdNull(){
this.set(S_OperDepartId,null);
}
public String getOperDepartId(){
return DataType.getAsString(this.get(S_OperDepartId));
}
public String getOperDepartIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OperDepartId));
}
public void initChnlName(String value){
this.initProperty(S_ChnlName,value);
}
public void setChnlName(String value){
this.set(S_ChnlName,value);
}
public void setChnlNameNull(){
this.set(S_ChnlName,null);
}
public String getChnlName(){
return DataType.getAsString(this.get(S_ChnlName));
}
public String getChnlNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlName));
}
public void initProvinceOrderId(String value){
this.initProperty(S_ProvinceOrderId,value);
}
public void setProvinceOrderId(String value){
this.set(S_ProvinceOrderId,value);
}
public void setProvinceOrderIdNull(){
this.set(S_ProvinceOrderId,null);
}
public String getProvinceOrderId(){
return DataType.getAsString(this.get(S_ProvinceOrderId));
}
public String getProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceOrderId));
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.SQLException;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IEssFileColumnDefSV;
import com.ai.uint.ftp.util.ColumnCheckRule;
import com.ai.uint.ftp.util.FileSaveUtil;
public class EssFileColumnDefSVImpl implements IEssFileColumnDefSV {
private static final Log logger = LogFactory.getLog(EssFileColumnDefSVImpl.class);
public void getColumnDef(String tableName, Map<String,ColumnCheckRule> columnDefMap) throws SQLException {
logger.info("ServiceManager.getSession().getConnection():"+ServiceManager.getSession().getConnection());
FileSaveUtil.getColumnDef(tableName, columnDefMap, ServiceManager.getSession().getConnection());
}
}
<file_sep>
package com.unicom.mss.sb_eip_eip_importpartnerinfosrv;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.unicom.mss.sb_eip_eip_importpartnerinfosrv package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.unicom.mss.sb_eip_eip_importpartnerinfosrv
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link SB_EIP_EIP_ImportPartnerInfoSrvResponse }
*
*/
public SB_EIP_EIP_ImportPartnerInfoSrvResponse createSB_EIP_EIP_ImportPartnerInfoSrvResponse() {
return new SB_EIP_EIP_ImportPartnerInfoSrvResponse();
}
/**
* Create an instance of {@link ErrorCollection }
*
*/
public ErrorCollection createErrorCollection() {
return new ErrorCollection();
}
/**
* Create an instance of {@link ResponseCollection }
*
*/
public ResponseCollection createResponseCollection() {
return new ResponseCollection();
}
/**
* Create an instance of {@link SB_EIP_EIP_ImportPartnerInfoSrvRequest }
*
*/
public SB_EIP_EIP_ImportPartnerInfoSrvRequest createSB_EIP_EIP_ImportPartnerInfoSrvRequest() {
return new SB_EIP_EIP_ImportPartnerInfoSrvRequest();
}
/**
* Create an instance of {@link SB_EIP_EIP_ImportPartnerInfoSrvInputCollection }
*
*/
public SB_EIP_EIP_ImportPartnerInfoSrvInputCollection createSB_EIP_EIP_ImportPartnerInfoSrvInputCollection() {
return new SB_EIP_EIP_ImportPartnerInfoSrvInputCollection();
}
/**
* Create an instance of {@link VENDOR_PROVINCE_INFOItem }
*
*/
public VENDOR_PROVINCE_INFOItem createVENDOR_PROVINCE_INFOItem() {
return new VENDOR_PROVINCE_INFOItem();
}
/**
* Create an instance of {@link PARTNER_BANK_INFO }
*
*/
public PARTNER_BANK_INFO createPARTNER_BANK_INFO() {
return new PARTNER_BANK_INFO();
}
/**
* Create an instance of {@link PARTNER_ROLE_INFO }
*
*/
public PARTNER_ROLE_INFO createPARTNER_ROLE_INFO() {
return new PARTNER_ROLE_INFO();
}
/**
* Create an instance of {@link PARTNER_FILE_INFO }
*
*/
public PARTNER_FILE_INFO createPARTNER_FILE_INFO() {
return new PARTNER_FILE_INFO();
}
/**
* Create an instance of {@link PARTNER_CERT_INFOItem }
*
*/
public PARTNER_CERT_INFOItem createPARTNER_CERT_INFOItem() {
return new PARTNER_CERT_INFOItem();
}
/**
* Create an instance of {@link VENDOR_PROVINCE_INFO }
*
*/
public VENDOR_PROVINCE_INFO createVENDOR_PROVINCE_INFO() {
return new VENDOR_PROVINCE_INFO();
}
/**
* Create an instance of {@link SB_EIP_EIP_ImportPartnerInfoSrvInputItem }
*
*/
public SB_EIP_EIP_ImportPartnerInfoSrvInputItem createSB_EIP_EIP_ImportPartnerInfoSrvInputItem() {
return new SB_EIP_EIP_ImportPartnerInfoSrvInputItem();
}
/**
* Create an instance of {@link ErrorItem }
*
*/
public ErrorItem createErrorItem() {
return new ErrorItem();
}
/**
* Create an instance of {@link PARTNER_FILE_INFOItem }
*
*/
public PARTNER_FILE_INFOItem createPARTNER_FILE_INFOItem() {
return new PARTNER_FILE_INFOItem();
}
/**
* Create an instance of {@link PARTNER_CERT_INFO }
*
*/
public PARTNER_CERT_INFO createPARTNER_CERT_INFO() {
return new PARTNER_CERT_INFO();
}
/**
* Create an instance of {@link PARTNER_CONTACT_INFO }
*
*/
public PARTNER_CONTACT_INFO createPARTNER_CONTACT_INFO() {
return new PARTNER_CONTACT_INFO();
}
/**
* Create an instance of {@link ResponseItem }
*
*/
public ResponseItem createResponseItem() {
return new ResponseItem();
}
/**
* Create an instance of {@link PARTNER_BANK_INFOItem }
*
*/
public PARTNER_BANK_INFOItem createPARTNER_BANK_INFOItem() {
return new PARTNER_BANK_INFOItem();
}
/**
* Create an instance of {@link PARTNER_ROLE_INFOItem }
*
*/
public PARTNER_ROLE_INFOItem createPARTNER_ROLE_INFOItem() {
return new PARTNER_ROLE_INFOItem();
}
/**
* Create an instance of {@link PARTNER_CONTACT_INFOItem }
*
*/
public PARTNER_CONTACT_INFOItem createPARTNER_CONTACT_INFOItem() {
return new PARTNER_CONTACT_INFOItem();
}
}
<file_sep>
package com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _SB_EAS_EAS_InquiryEASAuditInfoSrvRequest_QNAME = new QName("http://mss.unicom.com/SB_EAS_EAS_InquiryEASAuditInfoSrv", "SB_EAS_EAS_InquiryEASAuditInfoSrvRequest");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link SB_EAS_EAS_InquiryEASAuditInfoSrvResponse }
*
*/
public SB_EAS_EAS_InquiryEASAuditInfoSrvResponse createSB_EAS_EAS_InquiryEASAuditInfoSrvResponse() {
return new SB_EAS_EAS_InquiryEASAuditInfoSrvResponse();
}
/**
* Create an instance of {@link SB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection }
*
*/
public SB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection createSB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection() {
return new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection();
}
/**
* Create an instance of {@link SB_EAS_EAS_InquiryEASAuditInfoSrvRequest }
*
*/
public SB_EAS_EAS_InquiryEASAuditInfoSrvRequest createSB_EAS_EAS_InquiryEASAuditInfoSrvRequest() {
return new SB_EAS_EAS_InquiryEASAuditInfoSrvRequest();
}
/**
* Create an instance of {@link SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem }
*
*/
public SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem createSB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem() {
return new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SB_EAS_EAS_InquiryEASAuditInfoSrvRequest }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://mss.unicom.com/SB_EAS_EAS_InquiryEASAuditInfoSrv", name = "SB_EAS_EAS_InquiryEASAuditInfoSrvRequest")
public JAXBElement<SB_EAS_EAS_InquiryEASAuditInfoSrvRequest> createSB_EAS_EAS_InquiryEASAuditInfoSrvRequest(SB_EAS_EAS_InquiryEASAuditInfoSrvRequest value) {
return new JAXBElement<SB_EAS_EAS_InquiryEASAuditInfoSrvRequest>(_SB_EAS_EAS_InquiryEASAuditInfoSrvRequest_QNAME, SB_EAS_EAS_InquiryEASAuditInfoSrvRequest.class, null, value);
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,DepartmentInfoPrecheckSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,DepartmentInfoPrecheckSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,DepartmentInfoPrecheckSchema.xsd
departmentInfoPrecheck,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IINT_ERP_TEMP_RESULTValue extends DataStructInterface{
public final static String S_Subject = "SUBJECT";
public final static String S_ErpClientCode = "ERP_CLIENT_CODE";
public final static String S_TradeCode = "TRADE_CODE";
public final static String S_ErpTeleType = "ERP_TELE_TYPE";
public final static String S_UpdateDate = "UPDATE_DATE";
public final static String S_ErpAreaLevel = "ERP_AREA_LEVEL";
public final static String S_ErpAreaCode = "ERP_AREA_CODE";
public final static String S_TotalMenoey = "TOTAL_MENOEY";
public final static String S_DataType = "DATA_TYPE";
public final static String S_CostCen = "COST_CEN";
public String getSubject();
public String getErpClientCode();
public String getTradeCode();
public String getErpTeleType();
public Timestamp getUpdateDate();
public String getErpAreaLevel();
public String getErpAreaCode();
public Float getTotalMenoeyAsFloat();
public float getTotalMenoey();
public String getDataType();
public String getCostCen();
public void setSubject(String value);
public void setErpClientCode(String value);
public void setTradeCode(String value);
public void setErpTeleType(String value);
public void setUpdateDate(Timestamp value);
public void setErpAreaLevel(String value);
public void setErpAreaCode(String value);
public void setTotalMenoey(Float value);
public void setTotalMenoey(float value);
public void setDataType(String value);
public void setCostCen(String value);
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import com.ai.appframe2.bo.DataContainerFactory;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.util.criteria.Criteria;
import com.ai.uchintService.common.ivalues.IINT_ERP_TEMP_RESULTValue;
public class INT_ERP_TEMP_RESULTEngine {
public static INT_ERP_TEMP_RESULTBean[] getBeans(DataContainerInterface dc) throws
Exception {
Map ps = dc.getProperties();
StringBuffer buffer = new StringBuffer();
Map pList = new HashMap();
for (java.util.Iterator cc = ps.entrySet().iterator(); cc.hasNext(); ) {
Map.Entry e = (Map.Entry) cc.next();
if(buffer.length() >0)
buffer.append(" and ");
buffer.append(e.getKey().toString() + " = :p_" + e.getKey().toString());
pList.put("p_" + e.getKey().toString(),e.getValue());
}
Connection conn = ServiceManager.getSession().getConnection();
try {
return getBeans(buffer.toString(), pList);
}finally{
if (conn != null)
conn.close();
}
}
public static INT_ERP_TEMP_RESULTBean getBean(String _Subject,String _ErpClientCode,String _TradeCode,String _ErpTeleType,String _ErpAreaCode,String _CostCen) throws Exception{
/**new create*/
String condition = "SUBJECT = :S_SUBJECT and ERP_CLIENT_CODE = :S_ERP_CLIENT_CODE and TRADE_CODE = :S_TRADE_CODE and ERP_TELE_TYPE = :S_ERP_TELE_TYPE and ERP_AREA_CODE = :S_ERP_AREA_CODE and COST_CEN = :S_COST_CEN";
Map map = new HashMap();
map.put("S_SUBJECT",_Subject);
map.put("S_ERP_CLIENT_CODE",_ErpClientCode);
map.put("S_TRADE_CODE",_TradeCode);
map.put("S_ERP_TELE_TYPE",_ErpTeleType);
map.put("S_ERP_AREA_CODE",_ErpAreaCode);
map.put("S_COST_CEN",_CostCen);
;
INT_ERP_TEMP_RESULTBean[] beans = getBeans(condition,map);
if(beans!=null && beans.length==1)
return beans[0];
else if(beans!=null && beans.length>1){
throw new Exception("[����]�������ѯ����һ�����ϼ�¼");
}else{
INT_ERP_TEMP_RESULTBean bean = new INT_ERP_TEMP_RESULTBean();
bean.setSubject(_Subject);
bean.setErpClientCode(_ErpClientCode);
bean.setTradeCode(_TradeCode);
bean.setErpTeleType(_ErpTeleType);
bean.setErpAreaCode(_ErpAreaCode);
bean.setCostCen(_CostCen);
return bean;
}
}
public static INT_ERP_TEMP_RESULTBean[] getBeans(Criteria sql) throws Exception{
return getBeans(sql,-1,-1,false);
}
public static INT_ERP_TEMP_RESULTBean[] getBeans(Criteria sql,int startNum,int endNum,boolean isShowFK) throws Exception{
String[] cols = null;
String condition = "";
if(sql != null){
cols = (String[])sql.getSelectColumns().toArray(new String[0]);
condition = sql.toString();
}
return (INT_ERP_TEMP_RESULTBean[])getBeans(cols,condition,sql.getParameters(),startNum,endNum,isShowFK);
}
public static INT_ERP_TEMP_RESULTBean[] getBeans(String condition,Map parameter) throws Exception{
return getBeans(null,condition,parameter,-1,-1,false);
}
public static INT_ERP_TEMP_RESULTBean[] getBeans(String[] cols,String condition,Map parameter,
int startNum,int endNum,boolean isShowFK) throws Exception{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
return (INT_ERP_TEMP_RESULTBean[])ServiceManager.getDataStore().retrieve(conn,INT_ERP_TEMP_RESULTBean.class,INT_ERP_TEMP_RESULTBean.getObjectTypeStatic(),cols,condition,parameter,startNum,endNum,isShowFK,false,null);
}catch(Exception e){
throw e;
}finally{
if (conn != null)
conn.close();
}
}
public static INT_ERP_TEMP_RESULTBean[] getBeans(String[] cols,String condition,Map parameter,
int startNum,int endNum,boolean isShowFK,String[] extendBOAttrs) throws Exception{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
return (INT_ERP_TEMP_RESULTBean[])ServiceManager.getDataStore().retrieve(conn,INT_ERP_TEMP_RESULTBean.class,INT_ERP_TEMP_RESULTBean.getObjectTypeStatic(),cols,condition,parameter,startNum,endNum,isShowFK,false,extendBOAttrs);
}catch(Exception e){
throw e;
}finally{
if (conn != null)
conn.close();
}
}
public static int getBeansCount(String condition,Map parameter) throws Exception{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
return ServiceManager.getDataStore().retrieveCount(conn,INT_ERP_TEMP_RESULTBean.getObjectTypeStatic(),condition,parameter,null);
}catch(Exception e){
throw e;
}finally{
if (conn != null)
conn.close();
}
}
public static int getBeansCount(String condition,Map parameter,String[] extendBOAttrs) throws Exception{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
return ServiceManager.getDataStore().retrieveCount(conn,INT_ERP_TEMP_RESULTBean.getObjectTypeStatic(),condition,parameter,extendBOAttrs);
}catch(Exception e){
throw e;
}finally{
if (conn != null)
conn.close();
}
}
public static void save( INT_ERP_TEMP_RESULTBean aBean) throws Exception
{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
ServiceManager.getDataStore().save(conn,aBean);
}catch(Exception e){
throw e;
}finally{
conn.close();
}
}
public static void save( INT_ERP_TEMP_RESULTBean[] aBeans) throws Exception{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
ServiceManager.getDataStore().save(conn,aBeans);
}catch(Exception e){
throw e;
}finally{
if (conn != null)
conn.close();
}
}
public static void saveBatch( INT_ERP_TEMP_RESULTBean[] aBeans) throws Exception{
Connection conn = null;
try {
conn = ServiceManager.getSession().getConnection();
ServiceManager.getDataStore().saveBatch(conn,aBeans);
}catch(Exception e){
throw e;
}finally{
if (conn != null)
conn.close();
}
}
public static INT_ERP_TEMP_RESULTBean[] getBeansFromQueryBO(String soureBO,Map parameter) throws Exception{
Connection conn = null;
ResultSet resultset = null;
try {
conn = ServiceManager.getSession().getConnection();
String sql = ServiceManager.getObjectTypeFactory().getInstance(soureBO).getMapingEnty();
resultset =ServiceManager.getDataStore().retrieve(conn,sql,parameter);
return (INT_ERP_TEMP_RESULTBean[])ServiceManager.getDataStore().crateDtaContainerFromResultSet(INT_ERP_TEMP_RESULTBean.class,INT_ERP_TEMP_RESULTBean.getObjectTypeStatic(),resultset,null,true);
}catch(Exception e){
throw e;
}finally{
if(resultset!=null)resultset.close();
if (conn != null)
conn.close();
}
}
public static INT_ERP_TEMP_RESULTBean[] getBeansFromSql(String sql,Map parameter) throws Exception{
Connection conn = null;
ResultSet resultset = null;
try {
conn = ServiceManager.getSession().getConnection();
resultset =ServiceManager.getDataStore().retrieve(conn,sql,parameter);
return (INT_ERP_TEMP_RESULTBean[])ServiceManager.getDataStore().crateDtaContainerFromResultSet(INT_ERP_TEMP_RESULTBean.class,INT_ERP_TEMP_RESULTBean.getObjectTypeStatic(),resultset,null,true);
}catch(Exception e){
throw e;
}finally{
if(resultset!=null)resultset.close();
if (conn != null)
conn.close();
}
}
public static java.math.BigDecimal getNewId() throws Exception{
return ServiceManager.getIdGenerator().getNewId(INT_ERP_TEMP_RESULTBean.getObjectTypeStatic());
}
/*
public static java.sql.Timestamp getSysDate() throws Exception{
return ServiceManager.getIdGenerator().getSysDate(INT_ERP_TEMP_RESULTBean.getObjectTypeStatic());
}
*/
public static INT_ERP_TEMP_RESULTBean wrap(DataContainerInterface source,Map colMatch,boolean canModify){
try{
return (INT_ERP_TEMP_RESULTBean)DataContainerFactory.wrap(source,INT_ERP_TEMP_RESULTBean.class,colMatch,canModify);
}catch(Exception e){
if(e.getCause()!=null)
throw new RuntimeException(e.getCause());
else
throw new RuntimeException(e);
}
}
public static INT_ERP_TEMP_RESULTBean copy(DataContainerInterface source,Map colMatch,boolean canModify){
try {
INT_ERP_TEMP_RESULTBean result = new INT_ERP_TEMP_RESULTBean();
DataContainerFactory.copy(source, result, colMatch);
return result;
}
catch (AIException ex) {
if(ex.getCause()!=null)
throw new RuntimeException(ex.getCause());
else
throw new RuntimeException(ex);
}
}
public static INT_ERP_TEMP_RESULTBean transfer(IINT_ERP_TEMP_RESULTValue value) {
if(value==null)
return null;
try {
if(value instanceof INT_ERP_TEMP_RESULTBean){
return (INT_ERP_TEMP_RESULTBean)value;
}
INT_ERP_TEMP_RESULTBean newBean = new INT_ERP_TEMP_RESULTBean();
DataContainerFactory.transfer(value ,newBean);
return newBean;
}catch (Exception ex) {
if(ex.getCause()!=null)
throw new RuntimeException(ex.getCause());
else
throw new RuntimeException(ex);
}
}
public static INT_ERP_TEMP_RESULTBean[] transfer(IINT_ERP_TEMP_RESULTValue[] value) {
if(value==null || value.length==0)
return null;
try {
if(value instanceof INT_ERP_TEMP_RESULTBean[]){
return (INT_ERP_TEMP_RESULTBean[])value;
}
INT_ERP_TEMP_RESULTBean[] newBeans = new INT_ERP_TEMP_RESULTBean[value.length];
for(int i=0;i<newBeans.length;i++){
newBeans[i] = new INT_ERP_TEMP_RESULTBean();
DataContainerFactory.transfer(value[i] ,newBeans[i]);
}
return newBeans;
}catch (Exception ex) {
if(ex.getCause()!=null)
throw new RuntimeException(ex.getCause());
else
throw new RuntimeException(ex);
}
}
public static void save(IINT_ERP_TEMP_RESULTValue aValue) throws Exception
{
save(transfer(aValue));
}
public static void save( IINT_ERP_TEMP_RESULTValue[] aValues) throws Exception{
save(transfer(aValues));
}
public static void saveBatch( IINT_ERP_TEMP_RESULTValue[] aValues) throws Exception{
saveBatch(transfer(aValues));
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IPaymentResultInfoSV;
import com.ai.uchintService.busi.service.interfaces.ItestSV;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYEngine;
import com.ai.uip.core.bo.UipSubjectBean;
import com.ai.uip.core.bo.UipSubjectEngine;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvInputItem;
import com.unicom.mss.soa.msgheader.MsgHeader;
public class testSVImpl implements ItestSV{
@Override
public UC_TF_CHL_PAY_APPLYBean[] test() throws Exception {
// TODO Auto-generated method stub
return UC_TF_CHL_PAY_APPLYEngine.getBeans(" PAY_STATE not in(10,21) order by pay_batch_id",null);
}
@Override
public String getRecordId() {
String sql = "select record_id$SEQ.nextval ss from dual";
Connection conn = null;
PreparedStatement ptmt = null;
// 创建resultset
ResultSet rset = null;
// 创建collection
String num="";
try {
conn = getConnection();
// 赋予实例
ptmt = conn.prepareStatement(sql);
rset = ptmt.executeQuery();
if (rset.next()) {
num =rset.getString("ss").toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return num;
}
public Connection getConnection() throws SQLException {
Connection conn = ServiceManager.getSession().getConnection();
return conn;
}
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.wzh;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IQZWZHFileBusiSV;
import com.ai.uint.daemonTimer.daemon.UipDaemonTimerThread;
import com.ai.uint.daemonTimer.util.Constants;
import com.ai.uint.ftp.impl.GenerateFileTimerSVImpl;
import com.ai.uint.ftp.vo.GenerateFileInfoVO;
import com.ai.uint.paramsMang.vo.PublishCfgVo;
import com.ai.uint.sysMang.util.UipPlatformUtil;
import com.ai.uint.util.UIFException;
public class GenerateQZWZHFileTimerSVImpl extends GenerateFileTimerSVImpl {
private static int rowMax = 100000;
private static IQZWZHFileBusiSV busiSV = (IQZWZHFileBusiSV)ServiceFactory.getService(IQZWZHFileBusiSV.class);
private void generateFile(PublishCfgVo pubCfgVO) throws UIFException
{
try {
//查询模板路径,先查找主题_对端系统.xml,再查找主题.xml
String xmlTemplatePath = UipPlatformUtil.getConfFilePath()+File.separator+"xmlTemplate";
String confFileName = xmlTemplatePath + File.separator + pubCfgVO.getSubjectBean().getSubjectId() + "_" + pubCfgVO.getAccessSystemBean().getSystemId() + ".tmpl";
logger.info("confFileName:"+confFileName);
if (!new File(confFileName).exists()) {
confFileName = xmlTemplatePath + File.separator + pubCfgVO.getSubjectBean().getSubjectId() + ".tmpl";
logger.info("confFileName:"+confFileName);
if (!new File(confFileName).exists()) {
throw new UIFException("模板文件:"+confFileName+"不存在");
}
}
//query row count
int rowCnt = busiSV.getRowCount();
int fetchRows = 0;
String fileCreateTime = "";
while(fetchRows < rowCnt)
{
//创建文件日志记录
String fileLogID = addFileLogRecord(pubCfgVO);
if (fileLogID == null) throw new UIFException("生成uip_file_log失败");
//为继承ftpfile函数
pubCfgMap.put(fileLogID, pubCfgVO);
//组装文件信息
GenerateFileInfoVO generateFileInfoVO = busiSV.getGenerateFileInfoVO(fileLogID, pubCfgVO);
String tmpFileName = generateFileInfoVO.getFileName();
logger.info("tmpFileName:"+tmpFileName);
if (fetchRows == 0){
fileCreateTime = tmpFileName.substring(10, 22);
}
else
{
tmpFileName = tmpFileName.substring(0,10) + fileCreateTime + tmpFileName.substring(22);
}
logger.info("fileCreateTime:"+fileCreateTime);
logger.info("tmpFileName:"+tmpFileName);
//生成文件名称
String outFileName = pubCfgVO.getOperBean().getFileBackupPath() + File.separator + tmpFileName;
logger.info("outFileName:"+outFileName);
Map paraMap = new HashMap();
paraMap.put("STARTROW", String.valueOf(fetchRows+1));
int fileRowCount = 0;
if ((fetchRows+rowMax) >= rowCnt)
{
fileRowCount = rowCnt-fetchRows;
fetchRows = rowCnt;
}
else
{
fileRowCount = rowMax;
fetchRows = fetchRows+rowMax;
}
paraMap.put("ENDROW", String.valueOf(fetchRows));
paraMap.put("FILECREATETIME", fileCreateTime+"00");
paraMap.put("USERCOUNT", String.valueOf(fileRowCount));
busiSV.generateFile(generateFileInfoVO, confFileName, outFileName, paraMap);
generateFileInfoVO.setFileName(outFileName);
//更新文件日志记录
updateFileLogState(fileLogID,"20");
//ftp file
ftpFile(generateFileInfoVO, generateFileInfoVO.getFileName());
//Thread.sleep(1000*60*2);
}
} catch(Exception e) {
e.printStackTrace();
throw new UIFException(e);
}
}
@Override
public Map process(String timerCode, String inputParams, String logId) {
Map retMap = new HashMap();
//解释入参,主题和订购系统用逗号分割,多个用空格分割
logger.info("inputParams:"+inputParams);
//校验参数
List<PublishCfgVo> pubCfgList = null;
try {
pubCfgList = checkSubsParams(inputParams);
if (pubCfgList == null || pubCfgList.size() == 0) throw new UIFException("输入参数为空");
} catch(UIFException e) {
e.printStackTrace();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "校验参数失败:"+e.getMessage());
return retMap;
}
successCnt = 0;
failCnt = 0;
for(int paramIndex=0;paramIndex<pubCfgList.size();paramIndex++) {
PublishCfgVo pubCfgVo = pubCfgList.get(paramIndex);
//生成文件
try
{
CenterFactory.pushCenterInfo(com.ai.uchintService.common.util.Constants.DATASOURCE_CENTER, "01");
generateFile(pubCfgList.get(paramIndex));
}
catch(UIFException e)
{
e.printStackTrace();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "运行失败:"+e.getMessage());
return retMap;
}
catch(Exception e)
{
e.printStackTrace();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "运行失败:"+e.getMessage());
return retMap;
}
}
//关闭线程池
logger.info("pool shutdown");
fileThreadPool.shutdown();
//返回成功
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "配置"+pubCfgList.size()+",成功"+successCnt+"失败"+failCnt);
return retMap;
}
public static void main(String argv[])
{
try
{
//running
UipDaemonTimerThread timerThread = new UipDaemonTimerThread("qz_wzh",
"com.ai.uchintService.ftpFile.qingzhang.GenerateQZWZHFileTimerSVImpl",
"9200,142,ftpput_qz_wzh");
timerThread.start();
}
catch(Exception e)
{
}
}
}
<file_sep>
package cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssattached.UNIBSSATTACHED;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentprepayrechsyncreq.AGENTPREPAYRECHSYNCREQ;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD;
/**
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/unibssHead}UNI_BSS_HEAD"/>
* <element name="UNI_BSS_BODY">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/unibssBody/agentPrePayRechSyncReq}AGENT_PRE_PAY_RECH_SYNC_REQ"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element ref="{http://ws.chinaunicom.cn/unibssAttached}UNI_BSS_ATTACHED"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"unibsshead",
"unibssbody",
"unibssattached"
})
@XmlRootElement(name = "AGENT_PRE_PAY_RECH_SYNC_INPUT")
public class AGENTPREPAYRECHSYNCINPUT {
@XmlElement(name = "UNI_BSS_HEAD", namespace = "http://ws.chinaunicom.cn/unibssHead", required = true)
protected UNIBSSHEAD unibsshead;
@XmlElement(name = "UNI_BSS_BODY", required = true)
protected AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY unibssbody;
@XmlElement(name = "UNI_BSS_ATTACHED", namespace = "http://ws.chinaunicom.cn/unibssAttached", required = true)
protected UNIBSSATTACHED unibssattached;
/**
*
* @return
* possible object is
* {@link UNIBSSHEAD }
*
*/
public UNIBSSHEAD getUNIBSSHEAD() {
return unibsshead;
}
/**
*
* @param value
* allowed object is
* {@link UNIBSSHEAD }
*
*/
public void setUNIBSSHEAD(UNIBSSHEAD value) {
this.unibsshead = value;
}
/**
*
* @return
* possible object is
* {@link AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY }
*
*/
public AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY getUNIBSSBODY() {
return unibssbody;
}
/**
*
* @param value
* allowed object is
* {@link AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY }
*
*/
public void setUNIBSSBODY(AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY value) {
this.unibssbody = value;
}
/**
* ��ȡunibssattached���Ե�ֵ��
*
* @return
* possible object is
* {@link UNIBSSATTACHED }
*
*/
public UNIBSSATTACHED getUNIBSSATTACHED() {
return unibssattached;
}
/**
*
* @param value
* allowed object is
* {@link UNIBSSATTACHED }
*
*/
public void setUNIBSSATTACHED(UNIBSSATTACHED value) {
this.unibssattached = value;
}
/**
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/unibssBody/agentPrePayRechSyncReq}AGENT_PRE_PAY_RECH_SYNC_REQ"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"agentprepayrechsyncreq"
})
public static class UNIBSSBODY {
@XmlElement(name = "AGENT_PRE_PAY_RECH_SYNC_REQ", namespace = "http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/unibssBody/agentPrePayRechSyncReq", required = true)
protected AGENTPREPAYRECHSYNCREQ agentprepayrechsyncreq;
/**
*
* @return
* possible object is
* {@link AGENTPREPAYRECHSYNCREQ }
*
*/
public AGENTPREPAYRECHSYNCREQ getAGENTPREPAYRECHSYNCREQ() {
return agentprepayrechsyncreq;
}
/**
*
* @param value
* allowed object is
* {@link AGENTPREPAYRECHSYNCREQ }
*
*/
public void setAGENTPREPAYRECHSYNCREQ(AGENTPREPAYRECHSYNCREQ value) {
this.agentprepayrechsyncreq = value;
}
}
}
<file_sep>package com.ai.uip.platform.penetration;
import java.util.HashMap;
import com.ai.uip.core.bo.UIP_OPERATE_PENETRATIONBean;
/**
* webservice 透传服务
* @author homax
*
*/
public interface IPenetrationIfBase {
/**
* 参数封装方法
* @param ifCode
* @param ifMsg
* @return
*/
public HashMap<String, Object> pubIfParamGen(Object ifMsg,Long logId,UIP_OPERATE_PENETRATIONBean ifBean);
/**
* 返回参数封装方法
* @param ifCode
* @param ifMsg
* @return
*/
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg,Long logId);
}
<file_sep>
package com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.unicom.mss.sb_uc_uc_importcnapscodeinfosrv
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link SB_UC_UC_ImportCnapsCodeInfoSrvResponse }
*
*/
public SB_UC_UC_ImportCnapsCodeInfoSrvResponse createSB_UC_UC_ImportCnapsCodeInfoSrvResponse() {
return new SB_UC_UC_ImportCnapsCodeInfoSrvResponse();
}
/**
* Create an instance of {@link ErrorOutputCollection }
*
*/
public ErrorOutputCollection createErrorOutputCollection() {
return new ErrorOutputCollection();
}
/**
* Create an instance of {@link ResponseOutputCollection }
*
*/
public ResponseOutputCollection createResponseOutputCollection() {
return new ResponseOutputCollection();
}
/**
* Create an instance of {@link SB_UC_UC_ImportCnapsCodeInfoSrvRequest }
*
*/
public SB_UC_UC_ImportCnapsCodeInfoSrvRequest createSB_UC_UC_ImportCnapsCodeInfoSrvRequest() {
return new SB_UC_UC_ImportCnapsCodeInfoSrvRequest();
}
/**
* Create an instance of {@link SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection }
*
*/
public SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection createSB_UC_UC_ImportCnapsCodeInfoSrvInputCollection() {
return new SB_UC_UC_ImportCnapsCodeInfoSrvInputCollection();
}
/**
* Create an instance of {@link ResponseOutputItem }
*
*/
public ResponseOutputItem createResponseOutputItem() {
return new ResponseOutputItem();
}
/**
* Create an instance of {@link ErrorOutputItem }
*
*/
public ErrorOutputItem createErrorOutputItem() {
return new ErrorOutputItem();
}
/**
* Create an instance of {@link SB_UC_UC_ImportCnapsCodeInfoSrvInputItem }
*
*/
public SB_UC_UC_ImportCnapsCodeInfoSrvInputItem createSB_UC_UC_ImportCnapsCodeInfoSrvInputItem() {
return new SB_UC_UC_ImportCnapsCodeInfoSrvInputItem();
}
}
<file_sep>package com.ai.uchintService.common.timer;
import java.util.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServlet;
import com.ai.uip.core.util.UipCacheUtil;
import com.ai.uip.timer.UipTimer;
public class ServletPaymentResultIniter extends HttpServlet{
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Logger LOG = Logger.getLogger(ServletPaymentResultIniter.class.getName());
private PaymentResultInfoTimer paymentResultInfoTimer = null;
public void init(ServletConfig servletConfig) {
try {
// 导入接口定时器启动
paymentResultInfoTimer = new PaymentResultInfoTimer();
paymentResultInfoTimer.startUp();
} catch (Exception e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
//定时器销毁
public void destroy() {
super.destroy();
if(paymentResultInfoTimer!=null){
paymentResultInfoTimer.cancel();
LOG.info("定时器销毁");
}
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.sql.SQLException;
import java.util.Map;
public interface IJFProcedureCall {
public Map<String,String> callJFProcedure(String sql,String param) throws SQLException;
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.vo;
import java.text.SimpleDateFormat;
import java.util.Date;
public class QZRespHeaderVO {
private String serialNumber;
private String versionInfo;
private String fileCreateTime;
private String systemNo;
private Integer rowCount;
private Integer successRowCount;
public QZRespHeaderVO()
{
this.serialNumber = "0000";
this.versionInfo = "00000";
this.fileCreateTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
this.systemNo = "0800";
this.rowCount = 0;
}
public QZRespHeaderVO(QZReqHeaderVO reqHeaderVO)
{
this.serialNumber = reqHeaderVO.getSerialNumber();
this.versionInfo = reqHeaderVO.getVersionInfo();
this.fileCreateTime = reqHeaderVO.getFileCreateTime();
this.systemNo = "0800";
this.rowCount = reqHeaderVO.getRowCount();
}
public void setSerialNumber(String serialNumber)
{
this.serialNumber = serialNumber;
}
public String getSerialNumber()
{
return this.serialNumber;
}
public void setVersionInfo(String versionInfo)
{
this.versionInfo = versionInfo;
}
public String getVersionInfo()
{
return this.versionInfo;
}
public void setFileCreateTime(String fileCreateTime)
{
this.fileCreateTime = fileCreateTime;
}
public String getFileCreateTime()
{
return this.fileCreateTime;
}
public void setSystemNo(String systemNo)
{
this.systemNo = systemNo;
}
public String getSystemNo()
{
return this.systemNo;
}
public void setRowCount(Integer rowCount)
{
this.rowCount = rowCount;
}
public Integer getRowCount()
{
return this.rowCount;
}
public void setSuccessRowCount(Integer successRowCount)
{
this.successRowCount = successRowCount;
}
public Integer getSuccessRowCount()
{
return this.successRowCount;
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,OrdSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,OrdSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,OrdSchema.xsd
ordStatQry,UNI_BSS_BODY,UNI_BSS_BODY
orderSub,UNI_BSS_BODY,UNI_BSS_BODY
orderCHGCHK,UNI_BSS_BODY,UNI_BSS_BODY
orderChk,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,DepartmentInfoSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,DepartmentInfoSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,DepartmentInfoSchema.xsd
departmentInfo,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.server.woinquiryAgentAuditInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IInquiryAgentAuditInfoSrv;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
import com.unicom.wouchannel.inquiryagentauditinfosrv.ErrorCOLLECTION;
import com.unicom.wouchannel.inquiryagentauditinfosrv.ErrorMSGCONTENT;
import com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvIN;
import com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvINMSGCONTENT;
import com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvOUT;
import com.unicom.wouchannel.inquiryagentauditinfosrv.ResponseMSGCONTENT;
import com.unicom.wouchannel.inquiryagentauditinfosrv.ResponseCOLLECTION;
import com.unicom.wouchannel.msgheader.MsgHeader;
public class InquiryAgentAuditInfoAction implements IRecIfBase {
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
return null;
}
private IInquiryAgentAuditInfoSrv getSevice() {
return (IInquiryAgentAuditInfoSrv) ServiceFactory
.getService(IInquiryAgentAuditInfoSrv.class);
}
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
InquiryAgentAuditInfoSrvOUT repObj = new InquiryAgentAuditInfoSrvOUT();
ErrorCOLLECTION errorCol = new ErrorCOLLECTION();
List<ErrorMSGCONTENT> errorList = new ArrayList<ErrorMSGCONTENT>();
ResponseCOLLECTION respCol = new ResponseCOLLECTION();
List<ResponseMSGCONTENT> respList = new ArrayList();
ErrorMSGCONTENT errorMSGCONTENT = null;
ResponseMSGCONTENT responseMSGCONTENT = null;
List<InquiryAgentAuditInfoSrvINMSGCONTENT> inquiryAgentAuditInfoList = ((InquiryAgentAuditInfoSrvIN) ifMsg)
.getInquiryAgentAuditInfoSrvINCOLLECTION()
.getInquiryAgentAuditInfoSrvINMSGCONTENT();
MsgHeader inquiryAgentAuditInfoHead = ((InquiryAgentAuditInfoSrvIN) ifMsg)
.getMsgHeader();
// 报文头校验
Map<String, Object> retMap = BucUtil
.woegouconfirmHead(inquiryAgentAuditInfoHead);
if (new Boolean(retMap.get(Constants.retMap_TAG).toString())) {
// 报文体超过500条判断
if (inquiryAgentAuditInfoList.size() > 500) {
errorMSGCONTENT = new ErrorMSGCONTENT();
errorList.add(errorMSGCONTENT);
errorCol.setErrorMSGCONTENT(errorList);
repObj.setRSPCODE(Constants.WOEGOU_RSPCODE_1100);
repObj.setERRORCOLLECTION(errorCol);
HashMap<String, Object> obj = new HashMap<String, Object>();
obj.put("resultCode", Constants.MapResultCode.CODE_OTHER_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "请求报文体超过限制");
obj.put("retObj", repObj);
return obj;
} else {
try {
// 统一事物操作
repObj = inquiryAgentAuditInfo(inquiryAgentAuditInfoList,
inquiryAgentAuditInfoHead);
} catch (Exception e1) {
for (int i = 0; i < inquiryAgentAuditInfoList.size(); i++) {
errorMSGCONTENT = new ErrorMSGCONTENT();
errorMSGCONTENT
.setUCAGENTCODE(inquiryAgentAuditInfoList
.get(i).getUCAGENTCODE());
errorMSGCONTENT.setERRORMESSAGE("数据库异常");
errorList.add(errorMSGCONTENT);
}
errorCol.setErrorMSGCONTENT(errorList);
repObj.setRSPCODE(Constants.WOEGOU_RSPCODE_1102);
repObj.setERRORCOLLECTION(errorCol);
HashMap<String, Object> obj = new HashMap<String, Object>();
obj.put("resultCode",
Constants.MapResultCode.CODE_OTHER_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "数据库异常");
obj.put("retObj", repObj);
return obj;
}
}
} else {
errorMSGCONTENT = new ErrorMSGCONTENT();
errorList.add(errorMSGCONTENT);
errorCol.setErrorMSGCONTENT(errorList);
repObj.setRSPCODE(Constants.WOEGOU_RSPCODE_1004);
repObj.setERRORCOLLECTION(errorCol);
HashMap<String, Object> obj = new HashMap<String, Object>();
obj.put("resultCode", Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "报文头信息不正确");
obj.put("retObj", repObj);
return obj;
}
HashMap<String, Object> obj = new HashMap<String, Object>();
if (errorList != null && errorList.size() > 0) {
// repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
obj.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_FORMAT_ERROR);
obj.put(Constants.MapResult.MAP_RESULTMSG, "处理失败");
obj.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
} else {
// repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_TRUE);
obj.put(Constants.MapResult.MAP_RESULTCODE,
Constants.MapResultCode.CODE_SUCCESSFUL);
obj.put(Constants.MapResult.MAP_RESULTMSG, "同步处理成功");
obj.put(Constants.MapResult.MAP_RESULTOBJ, repObj);
}
return obj;
}
public InquiryAgentAuditInfoSrvOUT inquiryAgentAuditInfo(
List<InquiryAgentAuditInfoSrvINMSGCONTENT> inquiryAgentAuditInfoList,
MsgHeader msgHead) throws Exception {
InquiryAgentAuditInfoSrvOUT repObj = new InquiryAgentAuditInfoSrvOUT();
ErrorMSGCONTENT erorMSGCONTENT = null;
List<ErrorMSGCONTENT> erorMSGCONTENTLi = new ArrayList();
ErrorCOLLECTION errorCol = new ErrorCOLLECTION();
ResponseMSGCONTENT responseMSGCONTENT = null;
List<ResponseMSGCONTENT> responseMSGCONTENTLi = new ArrayList();
ResponseCOLLECTION respCol = new ResponseCOLLECTION();
InquiryAgentAuditInfoSrvINMSGCONTENT inquiryAgentAuditInfo = null;
String RSPCode = Constants.WOEGOU_RSPCODE_1001;
for (int i = 0; i < inquiryAgentAuditInfoList.size(); i++) {
// 验证请求报文体
Map<String, Object> retMap2 = confirmReqBody(inquiryAgentAuditInfoList
.get(i));
if (new Boolean(retMap2.get(Constants.retMap_TAG).toString())) {
inquiryAgentAuditInfo = inquiryAgentAuditInfoList.get(i);
// 代理商信息入库,返回 uc_agrent_id
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER, "99");
responseMSGCONTENT = getService().inquiryAgentAuditInfo(
inquiryAgentAuditInfo);
if (responseMSGCONTENT == null) {
erorMSGCONTENT = new ErrorMSGCONTENT();
erorMSGCONTENT.setUCAGENTCODE(inquiryAgentAuditInfoList
.get(i).getUCAGENTCODE());
erorMSGCONTENT.setERRORMESSAGE(Constants.WOEGOU_RSPCODE_1103+"UC_AGENT_CODE在渠道系统中无记录");
erorMSGCONTENTLi.add(erorMSGCONTENT);
errorCol.setErrorMSGCONTENT(erorMSGCONTENTLi);
//RSPCode = Constants.WOEGOU_RSPCODE_1103;
// repObj.setRSPCODE(RSPCode);
repObj.setERRORCOLLECTION(errorCol);
} else {
responseMSGCONTENTLi.add(responseMSGCONTENT);
respCol.setResponseMSGCONTENT(responseMSGCONTENTLi);
RSPCode = Constants.WOEGOU_RSPCODE_0000;
// repObj.setRSPCODE(RSPCode);
repObj.setRESPONSECOLLECTION(respCol);
}
}
// 返回报文体验证结果
else {
erorMSGCONTENT = new ErrorMSGCONTENT();
erorMSGCONTENT.setUCAGENTCODE(inquiryAgentAuditInfoList.get(i)
.getUCAGENTCODE());
erorMSGCONTENT.setERRORMESSAGE(Constants.WOEGOU_RSPCODE_1001+BucUtil
.getStringForList((List<String>) retMap2
.get(Constants.retMap_ERRORList)));
erorMSGCONTENTLi.add(erorMSGCONTENT);
errorCol.setErrorMSGCONTENT(erorMSGCONTENTLi);
respCol.setResponseMSGCONTENT(responseMSGCONTENTLi);
String serviceMessage = "";
List<String> errorList2 = (List<String>) retMap2
.get(Constants.retMap_ERRORList);
for (int j = 0; j < errorList2.size(); j++) {
serviceMessage += errorList2.get(j) + "|";
}
if (serviceMessage.length() > 1) {
serviceMessage = serviceMessage.substring(0,
serviceMessage.length() - 1);
}
// RSPCode = Constants.WOEGOU_RSPCODE_1001;
// repObj.setRSPCODE(RSPCode);
repObj.setERRORCOLLECTION(errorCol);
}
/*
* if(errorItemList.size()<=0){ //全部处理成功 repObj.setINSTANCE_ID(new
* BigDecimal(0));
* repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_TRUE);
* repObj.setSERVICE_MESSAGE("1"); }else
* if(errorItemList.size()>0&&responseItemList.size()>0){ //部分处理成功
* ResponseCollection responseCollection = new ResponseCollection();
* responseCollection.setResponseItem(responseItemList);
* ErrorCollection errorcol= new ErrorCollection();
* errorcol.setErrorItem(errorItemList);
* repObj.setErrorCollection(errorcol);
* repObj.setResponseCollection(responseCollection);
* repObj.setINSTANCE_ID(new BigDecimal(0));
* repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
* repObj.setSERVICE_MESSAGE("2"); }else
* if(responseItemList.size()<=0){ //全部处理失败 ErrorCollection
* errorcol= new ErrorCollection();
* errorcol.setErrorItem(errorItemList);
* repObj.setErrorCollection(errorcol); repObj.setINSTANCE_ID(new
* BigDecimal(0));
* repObj.setSERVICE_FLAG(Constants.SERVICE_FLAG_FALSE);
* repObj.setSERVICE_MESSAGE("0"); }
*/
}
repObj.setRSPCODE(RSPCode);
return repObj;
}
public Map<String, Object> confirmReqBody(
InquiryAgentAuditInfoSrvINMSGCONTENT bean) {
System.out.println("测试判断");
boolean temp = true;
List<String> errorList = new ArrayList();
Map<String, Object> map = new HashMap<String, Object>();
if (bean.getPRIKEY() == null || bean.getPRIKEY().length() == 0) {
temp = false;
errorList.add("PRI_KEY不能为空;");
} else {
if (bean.getPRIKEY().length() != 20) {
temp = false;
errorList.add("PRI_KEY长度不是20位;");
}
}
if (bean.getUCAGENTCODE() == null
|| bean.getUCAGENTCODE().length() == 0) {
temp = false;
errorList.add("AGENT_CODE不能为空;");
} else {
if (CastUtil.isNumber(bean.getUCAGENTCODE(), 15) == 1) {
temp = false;
errorList.add("AGENT_CODE长度大于15位;");
} else if (CastUtil.isNumber(bean.getUCAGENTCODE(), 15) == 2) {
temp = false;
errorList.add("AGENT_CODE含有非数字;");
}
}
if (bean.getPROVINCECODE() == null
|| bean.getPROVINCECODE().length() == 0) {
temp = false;
errorList.add("PROVINCE_CODE不能为空;");
} else if (Integer.parseInt(bean.getPROVINCECODE()) < 9
|| Integer.parseInt(bean.getPROVINCECODE()) > 97) {
temp = false;
errorList.add("PROVINCE_CODE数据没有在指定的省份编码范围内;");
}
if (bean.getCITYCODE() == null || bean.getCITYCODE().length() == 0) {
temp = false;
errorList.add("CITY_CODE不能为空;");
} else if (Integer.parseInt(bean.getCITYCODE()) < 0
|| Integer.parseInt(bean.getCITYCODE()) > 996) {
temp = false;
errorList.add("CITY_CODE数据没有在指定的地市编码范围内;");
}
map.put(Constants.retMap_TAG, temp);
map.put(Constants.retMap_ERRORList, errorList);
return map;
}
public IInquiryAgentAuditInfoSrv getService() {
return (IInquiryAgentAuditInfoSrv) ServiceFactory
.getService(IInquiryAgentAuditInfoSrv.class);
}
}
<file_sep># UIP_PRODUCT
UIP_PRODUCT
<file_sep>package com.ai.uchintService.timer;
import java.util.Date;
import java.util.HashMap;
import java.util.Timer;
import com.ai.appframe2.common.ServiceManager;
import com.ai.cuframe.core.exception.SystemException;
import com.ai.cuframe.util.StringUtil;
import com.ai.uchintService.common.bo.UC_DEFAULT_PARAMBean;
import com.ai.uchintService.common.bo.UC_DEFAULT_PARAMEngine;
import com.ai.uchintService.common.bo.UC_QUERY_TIMEBean;
import com.ai.uchintService.common.bo.UC_QUERY_TIMEEngine;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.core.bo.UipOperateEngine;
import com.ai.uip.core.util.ManagerUtil;
import com.ai.uip.core.util.SysDateUtil;
import com.ai.uip.platform.util.PlatformUtil;
import com.ai.uip.ws.comm.Constants;
import org.apache.log4j.Logger;
/**
* 定时器模块
* 该模块主要负责定时发布类接口的触发任务.
* 当有定时数据需要发布时,该模块需要负责往发布记录表中拖入一条未处理的发布记录。
* 如主数据管理系统与总部CRM系统每天晚上23点全量同步组织机构信息的对账接口,
* 定时器模块需要负责在23点前往发布记录表中插入一条未处理的发布记录。
*/
public class QueryStatusTimer {
private static Logger log = Logger.getLogger(QueryStatusTimer.class);
public QueryStatusTimer(){
UC_DEFAULT_PARAMBean[] paramBeans;
String timeNum;
String instId="";
int timeSpace=0;
int areaSpace=0;
// UC_QUERY_TIMEBean queryBean;
try {
ServiceManager.getSession().startTransaction();
//获取查询间隔
//instId = ManagerUtil.getPropCfgManager().getProp("router.inst_id");
instId = String.valueOf(ManagerUtil.getPropCfgManager().getInstId());
timeNum = ManagerUtil.getPropCfgManager().getProp("query.time");
//获取发送间隔和每批发送省份个数
timeSpace = Integer.parseInt(ManagerUtil.getPropCfgManager().getProp("query_time_space"));
areaSpace = Integer.parseInt(ManagerUtil.getPropCfgManager().getProp("query_area_space"));
//获取上次执行时间以及要发送的省份
paramBeans = UC_DEFAULT_PARAMEngine.getBeans("param_name='area_code'",null);
// queryBean = UC_QUERY_TIMEEngine.getBean("queryStatus");
} catch (Exception e) {
e.printStackTrace();
throw new SystemException("主数据定时器模块查询接口数据报错.. "+e);
}
// log.info("ReleaseTimer获取接口个数---"+uipOperateBeanArray.length+"==");
/**2.创建定时器 **/
Timer timer ;
QueryStatusTimerTask task;
//判断时候配置省份数据,没有配置则不起东定时器
if(paramBeans!=null&¶mBeans.length>0&&instId.equals("59")){
//启动定时器
task=new QueryStatusTimerTask();
task.setParamBeans(paramBeans);
task.setAreaSpace(areaSpace);
task.setSleepTime(timeSpace*60*1000);
timer = new Timer();
timer.schedule(task,new Date(),getTimeNum(timeNum));
}
}
public int getTimeNum(String timeNum){
if(timeNum==null||timeNum.equals("")){
timeNum="120";
}
return 60*1000*Integer.parseInt(timeNum);
}
public static void main(String ags[]){
QueryStatusTimer queryStatusTimer = new QueryStatusTimer();
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_QZ_PRE_PAY_RECH_SYNCValue;
import com.ai.uip.core.ivalues.*;
public class TF_QZ_PRE_PAY_RECH_SYNCBean extends DataContainer implements DataContainerInterface,ITF_QZ_PRE_PAY_RECH_SYNCValue{
private static String m_boName = "bo.TF_QZ_PRE_PAY_RECH_SYNC";
public final static String S_OrgOrderId = "ORG_ORDER_ID";
public final static String S_PayFeeMode = "PAY_FEE_MODE";
public final static String S_TradeDatetime = "TRADE_DATETIME";
public final static String S_AccountId = "ACCOUNT_ID";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_InsertTime = "INSERT_TIME";
public final static String S_ConnectType = "CONNECT_TYPE";
public final static String S_EparchyCode = "EPARCHY_CODE";
public final static String S_ContractNumber = "CONTRACT_NUMBER";
public final static String S_OrgProvinceOrderId = "ORG_PROVINCE_ORDER_ID";
public final static String S_OrderId = "ORDER_ID";
public final static String S_PayMode = "PAY_MODE";
public final static String S_PayFee = "PAY_FEE";
public final static String S_TradeType = "TRADE_TYPE";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_ProvinceOrderId = "PROVINCE_ORDER_ID";
public final static String S_ChnlName = "CHNL_NAME";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e);
}
}
public TF_QZ_PRE_PAY_RECH_SYNCBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("");
}
public void initOrgOrderId(String value){
this.initProperty(S_OrgOrderId,value);
}
public void setOrgOrderId(String value){
this.set(S_OrgOrderId,value);
}
public void setOrgOrderIdNull(){
this.set(S_OrgOrderId,null);
}
public String getOrgOrderId(){
return DataType.getAsString(this.get(S_OrgOrderId));
}
public String getOrgOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrgOrderId));
}
public void initPayFeeMode(String value){
this.initProperty(S_PayFeeMode,value);
}
public void setPayFeeMode(String value){
this.set(S_PayFeeMode,value);
}
public void setPayFeeModeNull(){
this.set(S_PayFeeMode,null);
}
public String getPayFeeMode(){
return DataType.getAsString(this.get(S_PayFeeMode));
}
public String getPayFeeModeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayFeeMode));
}
public void initTradeDatetime(String value){
this.initProperty(S_TradeDatetime,value);
}
public void setTradeDatetime(String value){
this.set(S_TradeDatetime,value);
}
public void setTradeDatetimeNull(){
this.set(S_TradeDatetime,null);
}
public String getTradeDatetime(){
return DataType.getAsString(this.get(S_TradeDatetime));
}
public String getTradeDatetimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeDatetime));
}
public void initAccountId(String value){
this.initProperty(S_AccountId,value);
}
public void setAccountId(String value){
this.set(S_AccountId,value);
}
public void setAccountIdNull(){
this.set(S_AccountId,null);
}
public String getAccountId(){
return DataType.getAsString(this.get(S_AccountId));
}
public String getAccountIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_AccountId));
}
public void initChnlCode(String value){
this.initProperty(S_ChnlCode,value);
}
public void setChnlCode(String value){
this.set(S_ChnlCode,value);
}
public void setChnlCodeNull(){
this.set(S_ChnlCode,null);
}
public String getChnlCode(){
return DataType.getAsString(this.get(S_ChnlCode));
}
public String getChnlCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlCode));
}
public void initInsertTime(Timestamp value){
this.initProperty(S_InsertTime,value);
}
public void setInsertTime(Timestamp value){
this.set(S_InsertTime,value);
}
public void setInsertTimeNull(){
this.set(S_InsertTime,null);
}
public Timestamp getInsertTime(){
return DataType.getAsDateTime(this.get(S_InsertTime));
}
public Timestamp getInsertTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_InsertTime));
}
public void initConnectType(String value){
this.initProperty(S_ConnectType,value);
}
public void setConnectType(String value){
this.set(S_ConnectType,value);
}
public void setConnectTypeNull(){
this.set(S_ConnectType,null);
}
public String getConnectType(){
return DataType.getAsString(this.get(S_ConnectType));
}
public String getConnectTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ConnectType));
}
public void initEparchyCode(String value){
this.initProperty(S_EparchyCode,value);
}
public void setEparchyCode(String value){
this.set(S_EparchyCode,value);
}
public void setEparchyCodeNull(){
this.set(S_EparchyCode,null);
}
public String getEparchyCode(){
return DataType.getAsString(this.get(S_EparchyCode));
}
public String getEparchyCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_EparchyCode));
}
public void initContractNumber(String value){
this.initProperty(S_ContractNumber,value);
}
public void setContractNumber(String value){
this.set(S_ContractNumber,value);
}
public void setContractNumberNull(){
this.set(S_ContractNumber,null);
}
public String getContractNumber(){
return DataType.getAsString(this.get(S_ContractNumber));
}
public String getContractNumberInitialValue(){
return DataType.getAsString(this.getOldObj(S_ContractNumber));
}
public void initOrgProvinceOrderId(String value){
this.initProperty(S_OrgProvinceOrderId,value);
}
public void setOrgProvinceOrderId(String value){
this.set(S_OrgProvinceOrderId,value);
}
public void setOrgProvinceOrderIdNull(){
this.set(S_OrgProvinceOrderId,null);
}
public String getOrgProvinceOrderId(){
return DataType.getAsString(this.get(S_OrgProvinceOrderId));
}
public String getOrgProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrgProvinceOrderId));
}
public void initOrderId(String value){
this.initProperty(S_OrderId,value);
}
public void setOrderId(String value){
this.set(S_OrderId,value);
}
public void setOrderIdNull(){
this.set(S_OrderId,null);
}
public String getOrderId(){
return DataType.getAsString(this.get(S_OrderId));
}
public String getOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrderId));
}
public void initPayMode(String value){
this.initProperty(S_PayMode,value);
}
public void setPayMode(String value){
this.set(S_PayMode,value);
}
public void setPayModeNull(){
this.set(S_PayMode,null);
}
public String getPayMode(){
return DataType.getAsString(this.get(S_PayMode));
}
public String getPayModeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayMode));
}
public void initPayFee(String value){
this.initProperty(S_PayFee,value);
}
public void setPayFee(String value){
this.set(S_PayFee,value);
}
public void setPayFeeNull(){
this.set(S_PayFee,null);
}
public String getPayFee(){
return DataType.getAsString(this.get(S_PayFee));
}
public String getPayFeeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayFee));
}
public void initTradeType(String value){
this.initProperty(S_TradeType,value);
}
public void setTradeType(String value){
this.set(S_TradeType,value);
}
public void setTradeTypeNull(){
this.set(S_TradeType,null);
}
public String getTradeType(){
return DataType.getAsString(this.get(S_TradeType));
}
public String getTradeTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeType));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initProvinceOrderId(String value){
this.initProperty(S_ProvinceOrderId,value);
}
public void setProvinceOrderId(String value){
this.set(S_ProvinceOrderId,value);
}
public void setProvinceOrderIdNull(){
this.set(S_ProvinceOrderId,null);
}
public String getProvinceOrderId(){
return DataType.getAsString(this.get(S_ProvinceOrderId));
}
public String getProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceOrderId));
}
public void initChnlName(String value){
this.initProperty(S_ChnlName,value);
}
public void setChnlName(String value){
this.set(S_ChnlName,value);
}
public void setChnlNameNull(){
this.set(S_ChnlName,null);
}
public String getChnlName(){
return DataType.getAsString(this.get(S_ChnlName));
}
public String getChnlNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlName));
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import com.ai.uip.platform.vo.PublishIfCfgVo;
public interface IRMSReduceEstiSV {
String getLockFile(PublishIfCfgVo ifVo,String dataType,String interfaceCode) throws Exception;
String getMD5File(PublishIfCfgVo ifVo,String interfaceCode) throws Exception;
}
<file_sep>package com.ai.demo.client;
import javax.xml.namespace.QName;
public class BatOrdSerClient {
private static final QName PORT_NAME
= new QName("http://ws.chinaunicom.cn/BatOrdSer/", "BatOrdSerPort");
/**
* @param args
*/
public static void main(String[] args) {
//Service service = Service.create(BatOrdSer_Service.SERVICE);
// // Endpoint Address
// //String endpointAddress = "http://localhost:7001/axis1/services/BatOrdSerSOAP";
// String endpointAddress = "http://10.1.25.204:8080/axis2/services/BatOrdSer";
//
// // Add a port to the Service
// service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
//
// BatOrdSer bos=service.getPort(BatOrdSer.class);
//
// BATCH_RESULT_INPUT input=new BATCH_RESULT_INPUT();
// UNI_BSS_HEAD head=new UNI_BSS_HEAD();
// head.setACTIONCODE("1");
// head.setACTIONRELATION("1");
// head.setMSGSENDER("1");
// head.setMSGRECEIVER("fromrequest");
// head.setOPERATENAME("1");
// head.setORIGDOMAIN("1");
// head.setPROCESSTIME("11");
// head.setPROCID("1");
// head.setSERVICENAME("1");
// head.setTESTFLAG("1");
// head.setTRANSIDH("1");
// head.setTRANSIDO("1");
// head.setROUTING(new UNIBSSHEAD.ROUTING());
// head.getROUTING().setROUTETYPE("11");
// head.getROUTING().setROUTEVALUE("11");
// head.setCOMBUSINFO(new UNIBSSHEAD.COMBUSINFO());
// head.getCOMBUSINFO().setCHANNELID("1");
// head.getCOMBUSINFO().setCHANNELTYPE("1");
// head.getCOMBUSINFO().setCITYCODE("1");
// head.getCOMBUSINFO().setEPARCHYCODE("1");
// head.getCOMBUSINFO().setOPERID("1");
// head.getCOMBUSINFO().setORDERTYPE("1");
// head.getCOMBUSINFO().setPROVINCECODE("1");
// input.setUNIBSSHEAD(head);
//
// cn.chinaunicom.ws.batordser.unibssbody.BATCHRESULTINPUT.UNIBSSBODY body=new cn.chinaunicom.ws.batordser.unibssbody.BATCHRESULTINPUT.UNIBSSBODY();
// body.setBATCHRESULTREQ(new BATCHRESULTREQ());
// input.setUNIBSSBODY(body);
// cn.chinaunicom.ws.batordser.unibssbody.BATCHRESULTOUTPUT ou=bos.batchResult(input);
// System.out.println(ou);
}
}
<file_sep>package com.ai.uchintService.server.agentdepositrechsyncser;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssattached.UNIBSSATTACHED;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCINPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCOUTPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentdepositrechsyncreq.AGENTDEPOSITRECHSYNCREQ;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentdepositrechsyncrsp.AGENTDEPOSITRECHSYNCRSP;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD.RESPONSE;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IAgentDepositRechSyncSrv;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
public class AgentDepositRechSyncAction implements IRecIfBase {
public static final Log log = LogFactory.getLog(AgentDepositRechSyncAction.class);
@SuppressWarnings("unused")
@Override
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
HashMap<String, Object> obj = new HashMap<String, Object>();
AGENTDEPOSITRECHSYNCOUTPUT output = new AGENTDEPOSITRECHSYNCOUTPUT();
UNIBSSHEAD head = new UNIBSSHEAD();
cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY body = new cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY();
UNIBSSATTACHED attached = new UNIBSSATTACHED();
UNIBSSHEAD reqHead = ((AGENTDEPOSITRECHSYNCINPUT)ifMsg).getUNIBSSHEAD();
cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCINPUT.UNIBSSBODY reqBody = ((AGENTDEPOSITRECHSYNCINPUT)ifMsg).getUNIBSSBODY();
UNIBSSATTACHED reqAttached = ((AGENTDEPOSITRECHSYNCINPUT)ifMsg).getUNIBSSATTACHED();
Map<String,Object> map = BucUtil.qzdcheckHead(reqHead);
try{
if (new Boolean(map.get(Constants.QZMap_TAG).toString())) {
Map<String,Object> bodymap = checkBody(reqBody);
if(new Boolean(bodymap.get(Constants.QZMap_TAG).toString())){
String province_code = reqBody.getAGENTDEPOSITRECHSYNCREQ().getPROVINCECODE();
System.out.println("=======================province_code:"+province_code+"==========================");
System.out.println("=======================datasource:"+"qingzhang"+province_code+"==========================");
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"qingzhang"+province_code);
// CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"01");
if(!getService().importDepositRechSyncInfo((AGENTDEPOSITRECHSYNCINPUT)ifMsg)){
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0111);
rsp.setRSPTYPE("1");
rsp.setRSPDESC("数据入库失败");
head.setRESPONSE(rsp);
AGENTDEPOSITRECHSYNCRSP rsq = new AGENTDEPOSITRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0111);
rsq.setRESPDESC("数据入库失败");
body.setAGENTDEPOSITRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "数据入库失败");
obj.put("retObj", output);
}else{
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0000);
rsp.setRSPTYPE("0");
rsp.setRSPDESC("数据同步成功");
head.setRESPONSE(rsp);
AGENTDEPOSITRECHSYNCRSP rsq = new AGENTDEPOSITRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0000);
rsq.setRESPDESC("数据同步成功");
body.setAGENTDEPOSITRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_SUCCESSFUL);// 给接口框架返回的代码
obj.put("resultMsg", "数据同步成功");
obj.put("retObj", output);
}
}else{
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0106);
rsp.setRSPTYPE("1");
rsp.setRSPDESC((String)bodymap.get(Constants.QZMap_ErrorInfo));
head.setRESPONSE(rsp);
AGENTDEPOSITRECHSYNCRSP rsq = new AGENTDEPOSITRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0106);
rsq.setRESPDESC((String)bodymap.get(Constants.QZMap_ErrorInfo));
body.setAGENTDEPOSITRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "报文体信息不正确");
obj.put("retObj", output);
}
}else{
head = (UNIBSSHEAD) BucUtil.getqzdReqHead(reqHead,logId);
RESPONSE rsp = new RESPONSE();
rsp.setRSPCODE(Constants.AgentChargeInfoSyncCode.CODE0105);
rsp.setRSPTYPE("1");
rsp.setRSPDESC((String)map.get(Constants.QZMap_ErrorInfo));
head.setRESPONSE(rsp);
AGENTDEPOSITRECHSYNCRSP rsq = new AGENTDEPOSITRECHSYNCRSP();
rsq.setRESPCODE(Constants.AgentChargeInfoSyncCode.CODE0105);
rsq.setRESPDESC((String)map.get(Constants.QZMap_ErrorInfo));
body.setAGENTDEPOSITRECHSYNCRSP(rsq);
output.setUNIBSSATTACHED(attached);
output.setUNIBSSBODY(body);
output.setUNIBSSHEAD(head);
obj.clear();
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", "报文头信息不正确");
obj.put("retObj", output);
}
}catch(Exception e){
e.printStackTrace();
}
return obj;
}
private Map<String,Object> checkBody(
cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCINPUT.UNIBSSBODY reqBody) {
boolean flag = true;
String errorInfo="";
Map<String,Object> map = new HashMap<String,Object>();
AGENTDEPOSITRECHSYNCREQ req = reqBody.getAGENTDEPOSITRECHSYNCREQ();
if(req.getSERVICENO()==null || req.getSERVICENO().length()==0){
flag = false;
errorInfo="省份交易流水号[SERVICE_NO]不能为空";
}else if(req.getPROVINCECODE()==null || req.getPROVINCECODE().length()==0){
flag = false;
errorInfo="省份编码[PROVINCE_CODE]不能为空";
}else if(req.getCHNLCODE()==null || req.getCHNLCODE().length()==0){
flag = false;
errorInfo="渠道编码[CHNL_CODE]不能为空";
}else if(req.getCHNLCODE().length()!=7){
flag = false;
errorInfo="渠道编码[CHNL_CODE]长度有误";
}else if(!req.getCHNLCODE().substring(0, 2).equals(req.getPROVINCECODE())){
flag = false;
errorInfo="渠道编码[CHNL_CODE]与省份编码[PROVINCE_CODE]不配对";
}else if(req.getCHNLNAME()==null || req.getCHNLNAME().length()==0){
flag = false;
errorInfo="渠道名称[CHNL_NAME]不能为空";
}else if(req.getTRADETIME()==null || req.getTRADETIME().length()==0){
flag = false;
errorInfo="交易时间[TRADE_TIME]不能为空";
}else if(req.getPAYFEE()==null || req.getPAYFEE().length()==0){
flag = false;
errorInfo="交易金额[PAY_FEE]不能为空";
}else if(req.getBUSITYPE()==null || req.getBUSITYPE().length()==0){
flag = false;
errorInfo="业务类型[BUSI_TYPE]不能为空";
}
map.put(Constants.QZMap_TAG, flag);
map.put(Constants.QZMap_ErrorInfo, errorInfo);
return map;
}
private IAgentDepositRechSyncSrv getService(){
return (IAgentDepositRechSyncSrv)ServiceFactory.getService(IAgentDepositRechSyncSrv.class);
}
@Override
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
return null;
}
}
<file_sep>
package com.ai.uchintService.ejb.VO.DeparementInfo;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import com.ai.uchintService.ejb.VO.GenericVO;
public class DepartmentInfoReqVo extends GenericVO{
protected String operateTYPE;
protected String departCODE;
protected String departNAME;
protected String departDISPLAYNAME;
protected String adminDEPARTCODE;
protected String departKINDTYPE;
protected String departLEVEL;
protected String departFRAME;
protected String validflag;
protected String provinceCODE;
protected String eparchyCODE;
protected String cityCODE;
protected String parentDEPARTCODE;
protected BigInteger orderNO;
protected String tel;
protected String addr;
protected String zipCODE;
protected String startDATE;
protected String endDATE;
protected String remark;
protected List<DepartmentInfoReqVo.PARA> para;
/**
* Gets the value of the operate_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATE_TYPE() {
return operateTYPE;
}
/**
* Sets the value of the operate_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATE_TYPE(String value) {
this.operateTYPE = value;
}
/**
* Gets the value of the depart_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_CODE() {
return departCODE;
}
/**
* Sets the value of the depart_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_CODE(String value) {
this.departCODE = value;
}
/**
* Gets the value of the depart_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_NAME() {
return departNAME;
}
/**
* Sets the value of the depart_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_NAME(String value) {
this.departNAME = value;
}
/**
* Gets the value of the depart_DISPLAY_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_DISPLAY_NAME() {
return departDISPLAYNAME;
}
/**
* Sets the value of the depart_DISPLAY_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_DISPLAY_NAME(String value) {
this.departDISPLAYNAME = value;
}
/**
* Gets the value of the admin_DEPART_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getADMIN_DEPART_CODE() {
return adminDEPARTCODE;
}
/**
* Sets the value of the admin_DEPART_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setADMIN_DEPART_CODE(String value) {
this.adminDEPARTCODE = value;
}
/**
* Gets the value of the depart_KIND_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_KIND_TYPE() {
return departKINDTYPE;
}
/**
* Sets the value of the depart_KIND_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_KIND_TYPE(String value) {
this.departKINDTYPE = value;
}
/**
* Gets the value of the depart_LEVEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_LEVEL() {
return departLEVEL;
}
/**
* Sets the value of the depart_LEVEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_LEVEL(String value) {
this.departLEVEL = value;
}
/**
* Gets the value of the depart_FRAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_FRAME() {
return departFRAME;
}
/**
* Sets the value of the depart_FRAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_FRAME(String value) {
this.departFRAME = value;
}
/**
* Gets the value of the validflag property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVALIDFLAG() {
return validflag;
}
/**
* Sets the value of the validflag property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVALIDFLAG(String value) {
this.validflag = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the eparchy_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEPARCHY_CODE() {
return eparchyCODE;
}
/**
* Sets the value of the eparchy_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEPARCHY_CODE(String value) {
this.eparchyCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the parent_DEPART_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARENT_DEPART_CODE() {
return parentDEPARTCODE;
}
/**
* Sets the value of the parent_DEPART_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARENT_DEPART_CODE(String value) {
this.parentDEPARTCODE = value;
}
/**
* Gets the value of the order_NO property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getORDER_NO() {
return orderNO;
}
/**
* Sets the value of the order_NO property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setORDER_NO(BigInteger value) {
this.orderNO = value;
}
/**
* Gets the value of the tel property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTEL() {
return tel;
}
/**
* Sets the value of the tel property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTEL(String value) {
this.tel = value;
}
/**
* Gets the value of the addr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getADDR() {
return addr;
}
/**
* Sets the value of the addr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setADDR(String value) {
this.addr = value;
}
/**
* Gets the value of the zip_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getZIP_CODE() {
return zipCODE;
}
/**
* Sets the value of the zip_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setZIP_CODE(String value) {
this.zipCODE = value;
}
/**
* Gets the value of the start_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_DATE() {
return startDATE;
}
/**
* Sets the value of the start_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_DATE(String value) {
this.startDATE = value;
}
/**
* Gets the value of the end_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_DATE() {
return endDATE;
}
/**
* Sets the value of the end_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_DATE(String value) {
this.endDATE = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
public List<DepartmentInfoReqVo.PARA> getPARA() {
if (para == null) {
para = new ArrayList<DepartmentInfoReqVo.PARA>();
}
return this.para;
}
public static class PARA {
protected String paraID;
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IINT_COSTCEN_CHL_MANAGERValue;
public class INT_COSTCEN_CHL_MANAGERBean extends DataContainer implements DataContainerInterface,IINT_COSTCEN_CHL_MANAGERValue{
private static String m_boName = "bo.INT_COSTCEN_CHL_MANAGER";
public final static String S_RpovinceCode = "RPOVINCE_CODE";
public final static String S_CityCode = "CITY_CODE";
public final static String S_CostName = "COST_NAME";
public final static String S_Comments = "COMMENTS";
public final static String S_DepartCode = "DEPART_CODE";
public final static String S_CostCode = "COST_CODE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public INT_COSTCEN_CHL_MANAGERBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initRpovinceCode(String value){
this.initProperty(S_RpovinceCode,value);
}
public void setRpovinceCode(String value){
this.set(S_RpovinceCode,value);
}
public void setRpovinceCodeNull(){
this.set(S_RpovinceCode,null);
}
public String getRpovinceCode(){
return DataType.getAsString(this.get(S_RpovinceCode));
}
public String getRpovinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_RpovinceCode));
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initCostName(String value){
this.initProperty(S_CostName,value);
}
public void setCostName(String value){
this.set(S_CostName,value);
}
public void setCostNameNull(){
this.set(S_CostName,null);
}
public String getCostName(){
return DataType.getAsString(this.get(S_CostName));
}
public String getCostNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_CostName));
}
public void initComments(String value){
this.initProperty(S_Comments,value);
}
public void setComments(String value){
this.set(S_Comments,value);
}
public void setCommentsNull(){
this.set(S_Comments,null);
}
public String getComments(){
return DataType.getAsString(this.get(S_Comments));
}
public String getCommentsInitialValue(){
return DataType.getAsString(this.getOldObj(S_Comments));
}
public void initDepartCode(String value){
this.initProperty(S_DepartCode,value);
}
public void setDepartCode(String value){
this.set(S_DepartCode,value);
}
public void setDepartCodeNull(){
this.set(S_DepartCode,null);
}
public String getDepartCode(){
return DataType.getAsString(this.get(S_DepartCode));
}
public String getDepartCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_DepartCode));
}
public void initCostCode(String value){
this.initProperty(S_CostCode,value);
}
public void setCostCode(String value){
this.set(S_CostCode,value);
}
public void setCostCodeNull(){
this.set(S_CostCode,null);
}
public String getCostCode(){
return DataType.getAsString(this.get(S_CostCode));
}
public String getCostCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CostCode));
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.Timestamp;
import java.util.Date;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCINPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentprepayrechsyncreq.AGENTPREPAYRECHSYNCREQ;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IAgentChargeInfoSyncSrv;
import com.ai.uchintService.common.bo.TF_QZ_PRE_PAY_RECH_SYNCBean;
import com.ai.uchintService.common.bo.TF_QZ_PRE_PAY_RECH_SYNCEngine;
public class AgentChargeInfoSyncSrvImpl implements IAgentChargeInfoSyncSrv {
@Override
public boolean importPrePayInfo(AGENTPREPAYRECHSYNCINPUT input) {
boolean flag = false;
try {
System.out.println("===============================url:====="+ServiceManager.getSession().getConnection().getMetaData().getURL()+"====================");
System.out.println("===============================username:====="+ServiceManager.getSession().getConnection().getMetaData().getUserName()+"====================");
UNIBSSBODY body = input.getUNIBSSBODY();
AGENTPREPAYRECHSYNCREQ req = body.getAGENTPREPAYRECHSYNCREQ();
TF_QZ_PRE_PAY_RECH_SYNCBean bean = new TF_QZ_PRE_PAY_RECH_SYNCBean();
bean.setOrderId(req.getORDERID());
bean.setProvinceOrderId(req.getPROVINCEORDERID());
bean.setConnectType(req.getCONNECTTYPE());
bean.setTradeType(req.getTRADETYPE());
bean.setTradeDatetime(req.getTRADETIME());
bean.setPayMode(req.getPAYMODE());
bean.setOrgProvinceOrderId(req.getORGPROVINCEORDERID());
bean.setOrgOrderId(req.getORGORDERID());
bean.setChnlCode(req.getCHNLCODE());
bean.setChnlName(req.getCHNLNAME());
bean.setProvinceCode(req.getPROVINCECODE());
bean.setEparchyCode(req.getEPARCHYCODE());
bean.setAccountId(req.getACCOUNTID());
bean.setContractNumber(req.getCONTRACTNUMBER());
bean.setPayFee(req.getPAYFEE());
bean.setPayFeeMode(req.getPAYFEEMODE());
bean.setInsertTime(new Timestamp(new Date().getTime()));
TF_QZ_PRE_PAY_RECH_SYNCEngine.save(bean);
flag = true;
} catch (AIException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return flag;
}
}
<file_sep>package com.ai.uchintService.server.importCnapsCodeInfo;
import java.util.ArrayList;
import java.util.List;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uint.ejb.util.CommonUtil;
import com.ai.uint.ejb.util.UipEjbRequestUtil;
import com.ai.uint.ejb.util.UipEjbClientLogUtil;
import com.ai.uip.core.bo.UipSyncDateailBean;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.platform.send.SendThread;
import com.ai.uip.platform.send.interfaces.IPublishLockerSV;
import com.ai.uip.platform.util.PlatformUtil;
import com.ai.uip.platform.vo.PublishIfCfgVo;
import com.ailk.uchannel.cnapsmdmupdate.interfaces.ICNAPSMDMRemoteSV;
import com.ailk.uchannel.cnapsmdmupdate.param.CNAPSMDMRequestVo;
import com.ailk.uchannel.cnapsmdmupdate.param.CNAPSMDMResponseVo;
import com.ailk.uchannel.datasyncarea.interfaces.IDataSyncAreaRemoteSV;
/**
*
* @author homax
*
*/
public class CnapsCodeThreadForEjb extends Thread{
private String operateCode;
private String ejbClassName;
private String ejbSvCode;
private long systemId;
private String serviceNo;
private String busiDataId;
private int reqDataCnt;
private CNAPSMDMRequestVo requestVo;
public CnapsCodeThreadForEjb(String operateCode,String ejbClassName,String ejbSvCode,long systemId, String serviceNo,String busiDataId,int reqDataCnt,CNAPSMDMRequestVo requestVo){
this.operateCode=operateCode;
this.ejbClassName=ejbClassName;
this.ejbSvCode=ejbSvCode;
this.systemId = systemId;
this.serviceNo = serviceNo;
this.busiDataId = busiDataId;
this.reqDataCnt = reqDataCnt;
this.requestVo = requestVo;
}
@Override
public void run() {
//insert Request
try {
Long requestId = UipEjbRequestUtil.addRequest(requestVo, true);
Long logId = UipEjbClientLogUtil.insertRecord(ejbSvCode, requestId, systemId, null, serviceNo, serviceNo, reqDataCnt, true);
//区域数据同步ejb服务
ICNAPSMDMRemoteSV ejbProcessor = (ICNAPSMDMRemoteSV) CommonUtil.getEjbsv(ejbSvCode);
CNAPSMDMResponseVo respVo = ejbProcessor.execute(requestVo);
System.out.print("1");
if(respVo!=null){
UipEjbRequestUtil.updateRespJsonParam(requestId, respVo, true);
String errorCode ="09";
if(respVo.getResultCode().equals(respVo.SUCCESS)){
errorCode ="02";
}else if(respVo.getResultCode().equals(respVo.FAILURE)){
errorCode ="04";
}
UipEjbClientLogUtil.updateRecord(logId, errorCode, respVo.getResultCode(),respVo.getResultDesc(), 0, 0, true);
}else{
System.out.println("调用前台EJB返回对象:RESP_CODE 为空");
UipEjbClientLogUtil.updateRecord(logId, "99", "99","调用前台EJB返回对象:RESP_CODE 为空", 0, 0, true);
}
} catch (Exception e) {
System.out.println("调用ejb异常!!!");
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.vo;
public class QZRespBodyVO {
//流水号,格式为时间戳+序列号:YYYYMMDDHHMMSSxxxx,其中xxxx为序列号,从0001开始,排满9999后重新循环
private String recordSequenceID;
//省分流水号
private String serviceNo;
//结果标识 1:错误
private String resultCode;
//结果描述
private String resultComments;
public void setRecordSequenceID(String recordSequenceID)
{
this.recordSequenceID = recordSequenceID;
}
public String getRecordSequenceID()
{
return this.recordSequenceID;
}
public void setServiceNo(String serviceNo)
{
this.serviceNo = serviceNo;
}
public String getServiceNo()
{
return this.serviceNo;
}
public void setResultCode(String resultCode)
{
this.resultCode = resultCode;
}
public String getResultCode()
{
return this.resultCode;
}
public void setResultComments(String resultComments)
{
this.resultComments = resultComments;
}
public String getResultComments()
{
return this.resultComments;
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.util.List;
import com.ai.appframe2.common.AIException;
import com.ai.uchintService.common.bo.UCH_TF_CHL_PAY_APPLY_DETAILBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_CHANNELBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_DEVELOPERBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.ErrorItem;
import com.unicom.mss.sb_eas_eas_importamountinfosrv.SB_EAS_EAS_ImportAmountInfoSrvInputItem;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvInputItem;
import com.unicom.mss.soa.msgheader.MsgHeader;
public interface IImportAmountInfoSV {
public UC_TF_CHL_PAY_APPLYBean[] getPayBeans(String pay_batch_id,String province_code) throws Exception;
public UC_TF_CHL_CHANNELBean getChlbean(String ChnlId) throws Exception;
public UC_TF_CHL_DEVELOPERBean getDeveloperBean(String payObjectId) throws Exception;
public boolean updatePayInfoForbatchIdAndLineNo(List<ErrorItem> errorList,String provinceCode) throws Exception;
public boolean updatePayInfoForbatchIdAndLineNoFailStatus(String payBatchId,String provinceCode) throws Exception;
public UCH_TF_CHL_PAY_APPLY_DETAILBean[] getApplyDetailbean(Long serialNo,String provinceCode) throws Exception;
public String getSegMent5(String vendorNumber) throws Exception;
// public int getCountByPayBatchId(String pay_batch_id);
}
<file_sep>package cn.chinaunicom.ws.agentser;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-05-24T11:01:50.122+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://ws.chinaunicom.cn/AgentSer/", name = "AgentSer")
@XmlSeeAlso({cn.chinaunicom.ws.unibsshead.ObjectFactory.class, cn.chinaunicom.ws.agentser.unibssbody.qryagentmarginreq.ObjectFactory.class, cn.chinaunicom.ws.agentser.unibssbody.qryagencytradehistoryrsp.ObjectFactory.class, cn.chinaunicom.ws.agentser.unibssbody.qryagencytradehistoryreq.ObjectFactory.class, cn.chinaunicom.ws.unibssattached.ObjectFactory.class, cn.chinaunicom.ws.agentser.unibssbody.ObjectFactory.class, cn.chinaunicom.ws.agentser.unibssbody.qryagentmarginrsp.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface AgentSer {
@WebResult(name = "QRY_AGENCY_TRADE_HISTORY_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/AgentSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/AgentSer/qryAgencyTradeHistory/")
public cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT qryAgencyTradeHistory(
@WebParam(partName = "parameters", name = "QRY_AGENCY_TRADE_HISTORY_INPUT", targetNamespace = "http://ws.chinaunicom.cn/AgentSer/unibssBody")
cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_INPUT parameters
);
@WebResult(name = "QRY_AGENT_MARGIN_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/AgentSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/AgentSer/qryAgentMargin/")
public cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT qryAgentMargin(
@WebParam(partName = "parameters", name = "QRY_AGENT_MARGIN_INPUT", targetNamespace = "http://ws.chinaunicom.cn/AgentSer/unibssBody")
cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_INPUT parameters
);
}
<file_sep>
package com.unicom.mss.sb_eip_eip_importpartnerinfosrv;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PARTNER_CONTACT_INFOItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PARTNER_CONTACT_INFOItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BATCH_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="CONTACT_ID" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="PARTNER_ID" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="RELATION_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="TELEPHONE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="MOBILE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="FAX_NUMBER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="E_MAIL" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ADDRESS" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="POST_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_6" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_7" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_8" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_9" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_10" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_11" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_12" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_13" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_14" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_15" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PARTNER_CONTACT_INFOItem", propOrder = {
"priKEY",
"batchID",
"contactID",
"partnerID",
"relationNAME",
"telephone",
"mobile",
"faxNUMBER",
"eMAIL",
"address",
"postCODE",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5",
"reserved6",
"reserved7",
"reserved8",
"reserved9",
"reserved10",
"reserved11",
"reserved12",
"reserved13",
"reserved14",
"reserved15"
})
public class PARTNER_CONTACT_INFOItem {
@XmlElement(name = "PRI_KEY", required = true, nillable = true)
protected String priKEY;
@XmlElement(name = "BATCH_ID", required = true, nillable = true)
protected String batchID;
@XmlElement(name = "CONTACT_ID", required = true, nillable = true)
protected BigDecimal contactID;
@XmlElement(name = "PARTNER_ID", required = true, nillable = true)
protected BigDecimal partnerID;
@XmlElement(name = "RELATION_NAME", required = true, nillable = true)
protected String relationNAME;
@XmlElement(name = "TELEPHONE", required = true, nillable = true)
protected String telephone;
@XmlElement(name = "MOBILE", required = true, nillable = true)
protected String mobile;
@XmlElement(name = "FAX_NUMBER", required = true, nillable = true)
protected String faxNUMBER;
@XmlElement(name = "E_MAIL", required = true, nillable = true)
protected String eMAIL;
@XmlElement(name = "ADDRESS", required = true, nillable = true)
protected String address;
@XmlElement(name = "POST_CODE", required = true, nillable = true)
protected String postCODE;
@XmlElement(name = "RESERVED_1", required = true, nillable = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true, nillable = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true, nillable = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true, nillable = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true, nillable = true)
protected String reserved5;
@XmlElement(name = "RESERVED_6", required = true, nillable = true)
protected String reserved6;
@XmlElement(name = "RESERVED_7", required = true, nillable = true)
protected String reserved7;
@XmlElement(name = "RESERVED_8", required = true, nillable = true)
protected String reserved8;
@XmlElement(name = "RESERVED_9", required = true, nillable = true)
protected String reserved9;
@XmlElement(name = "RESERVED_10", required = true, nillable = true)
protected String reserved10;
@XmlElement(name = "RESERVED_11", required = true, nillable = true)
protected String reserved11;
@XmlElement(name = "RESERVED_12", required = true, nillable = true)
protected String reserved12;
@XmlElement(name = "RESERVED_13", required = true, nillable = true)
protected String reserved13;
@XmlElement(name = "RESERVED_14", required = true, nillable = true)
protected String reserved14;
@XmlElement(name = "RESERVED_15", required = true, nillable = true)
protected String reserved15;
/**
* Gets the value of the pri_KEY property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRI_KEY() {
return priKEY;
}
/**
* Sets the value of the pri_KEY property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRI_KEY(String value) {
this.priKEY = value;
}
/**
* Gets the value of the batch_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_ID() {
return batchID;
}
/**
* Sets the value of the batch_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_ID(String value) {
this.batchID = value;
}
/**
* Gets the value of the contact_ID property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getCONTACT_ID() {
return contactID;
}
/**
* Sets the value of the contact_ID property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setCONTACT_ID(BigDecimal value) {
this.contactID = value;
}
/**
* Gets the value of the partner_ID property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getPARTNER_ID() {
return partnerID;
}
/**
* Sets the value of the partner_ID property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setPARTNER_ID(BigDecimal value) {
this.partnerID = value;
}
/**
* Gets the value of the relation_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRELATION_NAME() {
return relationNAME;
}
/**
* Sets the value of the relation_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRELATION_NAME(String value) {
this.relationNAME = value;
}
/**
* Gets the value of the telephone property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTELEPHONE() {
return telephone;
}
/**
* Sets the value of the telephone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTELEPHONE(String value) {
this.telephone = value;
}
/**
* Gets the value of the mobile property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMOBILE() {
return mobile;
}
/**
* Sets the value of the mobile property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMOBILE(String value) {
this.mobile = value;
}
/**
* Gets the value of the fax_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFAX_NUMBER() {
return faxNUMBER;
}
/**
* Sets the value of the fax_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFAX_NUMBER(String value) {
this.faxNUMBER = value;
}
/**
* Gets the value of the e_MAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getE_MAIL() {
return eMAIL;
}
/**
* Sets the value of the e_MAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setE_MAIL(String value) {
this.eMAIL = value;
}
/**
* Gets the value of the address property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getADDRESS() {
return address;
}
/**
* Sets the value of the address property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setADDRESS(String value) {
this.address = value;
}
/**
* Gets the value of the post_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPOST_CODE() {
return postCODE;
}
/**
* Sets the value of the post_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPOST_CODE(String value) {
this.postCODE = value;
}
/**
* Gets the value of the reserved_1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_1() {
return reserved1;
}
/**
* Sets the value of the reserved_1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_1(String value) {
this.reserved1 = value;
}
/**
* Gets the value of the reserved_2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_2() {
return reserved2;
}
/**
* Sets the value of the reserved_2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_2(String value) {
this.reserved2 = value;
}
/**
* Gets the value of the reserved_3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_3() {
return reserved3;
}
/**
* Sets the value of the reserved_3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_3(String value) {
this.reserved3 = value;
}
/**
* Gets the value of the reserved_4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_4() {
return reserved4;
}
/**
* Sets the value of the reserved_4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_4(String value) {
this.reserved4 = value;
}
/**
* Gets the value of the reserved_5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_5() {
return reserved5;
}
/**
* Sets the value of the reserved_5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_5(String value) {
this.reserved5 = value;
}
/**
* Gets the value of the reserved_6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_6() {
return reserved6;
}
/**
* Sets the value of the reserved_6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_6(String value) {
this.reserved6 = value;
}
/**
* Gets the value of the reserved_7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_7() {
return reserved7;
}
/**
* Sets the value of the reserved_7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_7(String value) {
this.reserved7 = value;
}
/**
* Gets the value of the reserved_8 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_8() {
return reserved8;
}
/**
* Sets the value of the reserved_8 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_8(String value) {
this.reserved8 = value;
}
/**
* Gets the value of the reserved_9 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_9() {
return reserved9;
}
/**
* Sets the value of the reserved_9 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_9(String value) {
this.reserved9 = value;
}
/**
* Gets the value of the reserved_10 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_10() {
return reserved10;
}
/**
* Sets the value of the reserved_10 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_10(String value) {
this.reserved10 = value;
}
/**
* Gets the value of the reserved_11 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_11() {
return reserved11;
}
/**
* Sets the value of the reserved_11 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_11(String value) {
this.reserved11 = value;
}
/**
* Gets the value of the reserved_12 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_12() {
return reserved12;
}
/**
* Sets the value of the reserved_12 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_12(String value) {
this.reserved12 = value;
}
/**
* Gets the value of the reserved_13 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_13() {
return reserved13;
}
/**
* Sets the value of the reserved_13 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_13(String value) {
this.reserved13 = value;
}
/**
* Gets the value of the reserved_14 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_14() {
return reserved14;
}
/**
* Sets the value of the reserved_14 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_14(String value) {
this.reserved14 = value;
}
/**
* Gets the value of the reserved_15 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_15() {
return reserved15;
}
/**
* Sets the value of the reserved_15 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_15(String value) {
this.reserved15 = value;
}
}
<file_sep>package com.ai.uchintService.ejb.paramImpl.precheckResult;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import javax.naming.Context;
import javax.naming.InitialContext;
import cn.chinaunicom.ws.precheckresultser.unibssbody.PRECHECK_RESULT_INPUT;
import cn.chinaunicom.ws.precheckresultser.unibssbody.PRECHECK_RESULT_OUTPUT;
import cn.chinaunicom.ws.precheckresultser.unibssbody.precheckresultreq.PRECHECK_RESULT_REQ;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
import com.ai.uchintService.ejb.VO.precheckResult.PrecheckResultReqVO;
import com.ai.uchintService.ejb.VO.precheckResult.PrecheckResultRspVO;
import com.ai.uint.ejb.interfaces.IUipParamImplForSendSV;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ejb.util.ResultMsg;
import com.ai.uint.ejb.vo.PassEjbSVRequestVO;
import com.ai.uint.ejb.vo.PassEjbSVResponseVO;
import com.ai.uint.paramsMang.vo.PublishCfgVo;
/*
* 预判结果通知服务
*/
public class PrecheckResultRspImpl implements IUipParamImplForSendSV{
private PrecheckResultReqVO reqVO;
private Map<String,List<String>> contentIdSubs;
// private Map<String,List<PrecheckRespMsg>> outputContentId;
public PrecheckResultRspImpl(){
contentIdSubs = new HashMap<String, List<String>>();
}
@Override
public Map<String, Object> getRecordData(Object inputParam) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
if (inputParam instanceof PrecheckResultReqVO) {
reqVO = (PrecheckResultReqVO)inputParam;
} else {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG,"类型匹配错误:"+inputParam.getClass().getName());
return retMap;
}
List<String> retContentId = new ArrayList<String>();
retContentId.add(reqVO.getPrecheckNO());
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ,retContentId);
return retMap;
}
@Override
public Map<String, Object> getReqMsg(List<String> contentList,
Map<String, Long> detailMap, Long sendID, PublishCfgVo cfgVo) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
PRECHECK_RESULT_INPUT presultinput = new PRECHECK_RESULT_INPUT();
UNI_BSS_HEAD uniBssHead = new UNI_BSS_HEAD();
presultinput.setUNI_BSS_HEAD(uniBssHead);
PRECHECK_RESULT_INPUT.UNI_BSS_BODY uniBssBody = new PRECHECK_RESULT_INPUT.UNI_BSS_BODY();
PRECHECK_RESULT_REQ retreq = new PRECHECK_RESULT_REQ();
String retStr = "";
for(int i=0;i<contentList.size();i++) {
if (retStr.equals("")) {
retStr = contentList.get(i);
} else {
retStr = retStr + ","+contentList.get(i);
}
}
retreq.setPRECHECK_NO(retStr);
uniBssBody.setPRECHECK_RESULT_REQ(retreq);
presultinput.setUNI_BSS_BODY(uniBssBody);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, presultinput);
return retMap;
}
@Override
public void setSubsInfo(List<String> contentList, PublishCfgVo cfgVo) {
for (int i=0;i<contentList.size();i++) {
List<String> tmpList = contentIdSubs.get(contentList.get(i));
if (tmpList == null) {
tmpList = new ArrayList<String>();
tmpList.add(cfgVo.getAccessSystemBean().getSystemId()+","+cfgVo.getAccessSystemBean().getSystemName());
} else {
tmpList.add(cfgVo.getAccessSystemBean().getSystemId()+","+cfgVo.getAccessSystemBean().getSystemName());
}
contentIdSubs.put(contentList.get(i), tmpList);
}
}
@Override
public Map<String, Object> handleRespMsg(List<String> contentList,
PublishCfgVo cfgVo, Object respObject, String resultDesc) {
Map<String, Object> retMap = new HashMap<String, Object>();
List<ResultMsg> retList = new ArrayList<ResultMsg>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
if (respObject == null) {
System.out.println("handleRespMsg:"+resultDesc);
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
} else {
PRECHECK_RESULT_OUTPUT output = (PRECHECK_RESULT_OUTPUT)respObject;
String respCode = output.getUNI_BSS_BODY().getPRECHECK_RESULT_RSP().getRESP_CODE();
String respDesc = output.getUNI_BSS_BODY().getPRECHECK_RESULT_RSP().getRESP_DESC();
if (!respCode.equals("0000")) {
for (int i=0;i<contentList.size();i++) {
ResultMsg resultMsg = new ResultMsg();
resultMsg.setContentId(contentList.get(i));
resultMsg.setResultCode(Constants.StateDef.FAIL);
resultMsg.setResultDesc(respCode+":"+output.getUNI_BSS_BODY().getPRECHECK_RESULT_RSP().getRESP_DESC());
retList.add(resultMsg);
}
} else {
for (int i=0;i<contentList.size();i++) {
//返回框架处理结果
// PrecheckRespMsg preMsg = new PrecheckRespMsg();
// preMsg.setSystemName(cfgVo.getAccessSystemBean().getSystemIp()+","+cfgVo.getAccessSystemBean().getSystemName());
ResultMsg resultMsg = new ResultMsg();
resultMsg.setContentId(contentList.get(i));
if (respDesc.indexOf(contentList.get(i)) != -1) {
resultMsg.setResultCode(Constants.StateDef.FAIL);
resultMsg.setResultDesc(cfgVo.getAccessSystemBean().getSystemName()+":"+Constants.StateDef.FAIL);
// preMsg.setSystemName(cfgVo.getAccessSystemBean().getSystemName());
// preMsg.setRetCode(Constants.StateDef.FAIL);
} else {
resultMsg.setResultCode(Constants.StateDef.FAIL);
resultMsg.setResultDesc(cfgVo.getAccessSystemBean().getSystemName()+":未返回处理字段");
// preMsg.setSystemName(cfgVo.getAccessSystemBean().getSystemName());
// preMsg.setRetCode(Constants.StateDef.FAIL+":未返回处理字段");
}
retList.add(resultMsg);
//记录处理结果
// List<PrecheckRespMsg> preList = outputContentId.get(contentList.get(i));
// if (preList == null) {
// preList = new ArrayList<PrecheckRespMsg>();
// }
// preList.add(preMsg);
// outputContentId.put(contentList.get(i), preList);
}
}
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, retList);
}
return retMap;
}
@Override
public Map<String, Object> getOutParam() {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
PrecheckResultRspVO retVo = new PrecheckResultRspVO();
retVo.setRespCODE(Constants.ResultMap.ResultKey.RESULT_CODE);
retVo.setRespDESC(Constants.ResultMap.ResultKey.RESULT_MSG);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, retVo);
return retMap;
}
public static void main(String[] argv) {
System.out.println("begin");
try
{
Hashtable env = new Hashtable();
//env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
//env.put("java.naming.provider.url","t3://10.1.25.223:7001");
//env.put("java.naming.factory.initial","com.tongweb.naming.SerialInitContextFactory");
//env.put("java.naming.provider.url","10.1.251.176:9202");
env.put("java.naming.factory.initial","com.bes.jndi.CtxFactory");
env.put("java.naming.provider.url","sparkHTTP://10.1.251.176:14719");
Context ctx = new InitialContext(env);
System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbb");
//com.ailk.uchannel.prevalidatearea.interfaces.IPreValidateAreaRemoteSV ejbProcessor = (com.ailk.uchannel.prevalidatearea.interfaces.IPreValidateAreaRemoteSV)ctx.lookup("PreValidateAreaRemoteSVImpl#com.ailk.uchannel.prevalidatearea.interfaces.IPreValidateAreaRemoteSV");
/*
com.ailk.bsdm.channelreceive.interfaces.ChannelReceiveSVRemote ejbProcessor = (com.ailk.bsdm.channelreceive.interfaces.ChannelReceiveSVRemote)ctx.lookup("ChannelReceiveSVRBean#com.ailk.bsdm.channelreceive.interfaces.ChannelReceiveSVRemote");
System.out.println("ccccccccccccccccccccccccccccccccc");
com.ailk.bsdm.channelreceive.param.ChannelReceiveInputVo inputVo = new com.ailk.bsdm.channelreceive.param.ChannelReceiveInputVo();
ejbProcessor.excute(inputVo);
System.out.println("ddddddddddddddd");
PassEjbSVRequestVO passInputVo = new PassEjbSVRequestVO();
passInputVo.setEjbSVProviderCode("CHNL_INFO_CHG_CANCEL_NOTIFY");
//passInputVo.setInputBusiParam(new String("zzzz"));
System.out.println("生成数据 开始:" + new Date());
*/
com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote ejbProcessor = (com.ai.uip.ejb.interfaces.UipUchlEjbSVRemote)ctx.lookup("UipEjbSVBean#com.ai.uip.ejb.interfaces.UipEjbSVRemote");
System.out.println("cccccccccccccccccccc");
PassEjbSVRequestVO passInputVo = new PassEjbSVRequestVO();
passInputVo.setEjbSVProviderCode("CHNL_INFO_CHG_NOTIFY");
com.ailk.bsdm.channelreceive.param.ChannelReceiveInputVo inputVo = new com.ailk.bsdm.channelreceive.param.ChannelReceiveInputVo();
inputVo.setOrderId("201205080404129");
inputVo.setChnlId("09b023m");
passInputVo.setInputBusiParam(inputVo);
PassEjbSVResponseVO outVo = ejbProcessor.passEjbSV(passInputVo);
System.out.println("dddddddddddddddddd");
com.ailk.bsdm.channelreceive.param.ChannelReceiveOutputVo outBusi = (com.ailk.bsdm.channelreceive.param.ChannelReceiveOutputVo)outVo.getOutputBusiParam();
System.out.println(outBusi.getResultCode());
System.out.println(outBusi.getResultDesc());
}
catch(Exception e)
{
System.out.println("catch Excetion .........");
e.printStackTrace();
}
System.out.println("end");
}
}
<file_sep>/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.agentser;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import cn.chinaunicom.ws.agentser.unibssbody.qryagencytradehistoryrsp.QRY_AGENCY_TRADE_HISTORY_RSP;
import cn.chinaunicom.ws.agentser.unibssbody.qryagentmarginrsp.QRY_AGENT_MARGIN_RSP;
import cn.chinaunicom.ws.agentser.unibssbody.qryagentmarginrsp.QRY_AGENT_MARGIN_RSP.QRY_AGENT_MARGIN_INFO;
import cn.chinaunicom.ws.agentser.unibssbody.qryagentmarginrsp.QRY_AGENT_MARGIN_RSP.QRY_AGENT_MARGIN_INFO.ACCT_INFO;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD.COM_BUS_INFO;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD.ROUTING;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD.SP_RESERVE;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV;
/**
* This class was generated by Apache CXF 2.3.5 2013-05-24T11:01:50.057+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(serviceName = "AgentSer", portName = "AgentSerSOAP", targetNamespace = "http://ws.chinaunicom.cn/AgentSer/", endpointInterface = "cn.chinaunicom.ws.agentser.AgentSer")
public class AgentSerImpl implements AgentSer {
private static final Logger LOG = Logger.getLogger(AgentSerImpl.class
.getName());
/*
* (non-Javadoc)
*
* @see cn.chinaunicom.ws.agentser.AgentSer#qryAgencyTradeHistory(cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_INPUT
* parameters )*
*/
public cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT qryAgencyTradeHistory(
cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_INPUT parameters) {
LOG.info("Executing operation qryAgencyTradeHistory");
System.out.println(parameters);
try {
// UNI_BSS_HEAD head = new UNI_BSS_HEAD();
// head.setORIG_DOMAIN("发起方应用域代码,参见应用域编码表"); // CCNL
// head.setSERVICE_NAME("服务名称");
// head.setOPERATE_NAME("操作名称");
// head.setACTION_CODE("操作动作代码,0:请求,1:应答");// 0
// head.setACTION_RELATION("0");
//
// ROUTING rount = new ROUTING();
// rount.setROUTE_TYPE("路由信息");
// rount.setROUTE_VALUE("路由类型,参见路由类型编码,如按手机号码路由等");
// head.setROUTING(rount);
// head.setPROC_ID("发起方业务流水号,发起方填写的业务流水号,一个业务流程中所有服务调用使用同一个业务流水号。");
// // head.setTRANS_IDO("服务调用方流水号,在发起方唯一标识一个服务的流水号,系统内唯一。调用方最长不超过28位,最后两位保留给总部平台扩展使用。");
// head.setPROCESS_TIME("YYYYMMDDHHMISS");
// COM_BUS_INFO conInfo = new COM_BUS_INFO();
// conInfo.setOPER_ID("操作员ID");
// conInfo.setPROVINCE_CODE("省份代码");
// conInfo.setEPARCHY_CODE("地市编码");
// conInfo.setORDER_TYPE("00:直接提交01:预提交");
// conInfo.setACCESS_TYPE("01");
// SP_RESERVE spr = new SP_RESERVE();
// spr.setTRANS_IDC("总部流水号");
// spr.setCUTOFFDAY("逻辑交易日");
// spr.setOSNDUNS("发起方代码");
// spr.setHSNDUNS("归属方代码");
// spr.setCONV_ID("最后的17位为总部平台的处理时间,YYYYMMDDHHMISSsss精确到毫秒");
//
// head.setTEST_FLAG("0");
// head.setMSG_SENDER("");
// head.setMSG_RECEIVER("");
// cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT _return = new cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT();
// cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT.UNI_BSS_BODY body = new cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT.UNI_BSS_BODY();
// QRY_AGENCY_TRADE_HISTORY_RSP rsp1 = new QRY_AGENCY_TRADE_HISTORY_RSP();
// rsp1.setRESP_DESC("ok");
// rsp1.setRESP_CODE("0000");
// List<QRY_AGENCY_TRADE_HISTORY_RSP.RESP_INFO> list = new ArrayList<QRY_AGENCY_TRADE_HISTORY_RSP.RESP_INFO>();
// QRY_AGENCY_TRADE_HISTORY_RSP.RESP_INFO info1 = new QRY_AGENCY_TRADE_HISTORY_RSP.RESP_INFO();
// info1.setORDER_ID("11111");
// info1.setPAY_RESULT("aaaaaaaaaaa");
// info1.setPROVINCE_ORDER_ID("2222222222");
// info1.setCONNECT_TYPE("05");
// info1.setTRADE_TIME("20130529");
// info1.setTRADE_DATETIME("20130529101111");
// info1.setTRADE_TYPE("0");
// info1.setPAY_MODE("02");
// info1.setRESULT_INFO("bbbbbbbb");
// info1.setPAY_RESULT("0000");
// info1.setRESULT_INFO("扣款成功");
// QRY_AGENCY_TRADE_HISTORY_RSP.RESP_INFO.TRADE_INFO tradeINFO = new QRY_AGENCY_TRADE_HISTORY_RSP.RESP_INFO.TRADE_INFO();
// tradeINFO.setACCOUNT_ID("1001");
// tradeINFO.setCHNL_CODE(parameters.getUNI_BSS_BODY()
// .getQRY_AGENCY_TRADE_HISTORY_REQ().getCHNL_CODE());
// tradeINFO.setCHNL_NAME("09a0243");
// tradeINFO.setCITY_CODE("000");
// tradeINFO.setCONTRACT_NUMBER("321");
// tradeINFO.setACCOUNT_TYPE("01");
// tradeINFO.setEPARCHY_CODE("360");
// tradeINFO.setORG_ORDER_ID("1233333");
// tradeINFO.setORG_TRADE_TIME("20130529");
// tradeINFO.setORG_PROVINCE_ORDER_ID("1234321");
// tradeINFO.setPAY_FEE("2000");
// tradeINFO.setPROV_MERCHANT_ID("123");
// tradeINFO.setPAY_FEE_MODE("17");
// info1.setTRADE_INFO(tradeINFO);
// list.add(info1);
// rsp1.setRespINFO(list);
// body.setQRY_AGENCY_TRADE_HISTORY_RSP(rsp1);
// _return.setUNI_BSS_HEAD(parameters.getUNI_BSS_HEAD());
// _return.setUNI_BSS_BODY(body);
// return _return;
IPenetrationIfProcessorSRV penetrationIfProcessorSRV=
(IPenetrationIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV");
Object obj =
penetrationIfProcessorSRV.ifMsgProcessorForService(Constants.Agent.TRADE_HISTORY_INFO,
parameters);
return
(cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENCY_TRADE_HISTORY_OUTPUT)obj;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/*
* (non-Javadoc)
*
* @see cn.chinaunicom.ws.agentser.AgentSer#qryAgentMargin(cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_INPUT
* parameters )*
*/
public cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT qryAgentMargin(
cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_INPUT parameters) {
LOG.info("Executing operation qryAgentMargin");
System.out.println(parameters);
try {
// UNI_BSS_HEAD head = new UNI_BSS_HEAD();
// head.setORIG_DOMAIN("发起方应用域代码,参见应用域编码表"); // CCNL
// head.setSERVICE_NAME("服务名称");
// head.setOPERATE_NAME("操作名称");
// head.setACTION_CODE("操作动作代码,0:请求,1:应答");// 0
// head.setACTION_RELATION("0");
//
// ROUTING rount = new ROUTING();
// rount.setROUTE_TYPE("路由信息");
// rount.setROUTE_VALUE("路由类型,参见路由类型编码,如按手机号码路由等");
// head.setROUTING(rount);
// head.setPROC_ID("发起方业务流水号,发起方填写的业务流水号,一个业务流程中所有服务调用使用同一个业务流水号。");
// // head.setTRANS_IDO("服务调用方流水号,在发起方唯一标识一个服务的流水号,系统内唯一。调用方最长不超过28位,最后两位保留给总部平台扩展使用。");
// head.setPROCESS_TIME("YYYYMMDDHHMISS");
// COM_BUS_INFO conInfo = new COM_BUS_INFO();
// conInfo.setOPER_ID("操作员ID");
// conInfo.setPROVINCE_CODE("省份代码");
// conInfo.setEPARCHY_CODE("地市编码");
// conInfo.setORDER_TYPE("00:直接提交01:预提交");
// conInfo.setACCESS_TYPE("01");
// SP_RESERVE spr = new SP_RESERVE();
// spr.setTRANS_IDC("总部流水号");
// spr.setCUTOFFDAY("逻辑交易日");
// spr.setOSNDUNS("发起方代码");
// spr.setHSNDUNS("归属方代码");
// spr.setCONV_ID("最后的17位为总部平台的处理时间,YYYYMMDDHHMISSsss精确到毫秒");
//
// head.setTEST_FLAG("0");
// head.setMSG_SENDER("");
// head.setMSG_RECEIVER("");
// cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT _return = new cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT();
// cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT.UNI_BSS_BODY body = new cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT.UNI_BSS_BODY();
// QRY_AGENT_MARGIN_RSP rsp1 = new QRY_AGENT_MARGIN_RSP();
// rsp1.setRESP_DESC("ok");
// rsp1.setRESP_CODE("0000");
// QRY_AGENT_MARGIN_INFO info1 = new QRY_AGENT_MARGIN_INFO();
// info1.setAGENT_ID(parameters.getUNI_BSS_BODY()
// .getQRY_AGENT_MARGIN_REQ().getAGENT_ID());
// info1.setAGENT_AVAILABLE_CREDIT_VALUE(new BigInteger("3000"));
// ACCT_INFO ai1 = new ACCT_INFO();
// ACCT_INFO ai2 = new ACCT_INFO();
// ai1.setACCT_ID("1001");
// ai2.setACCT_ID("1002");
// ai1.setPAY_NAME("test1");
// ai2.setPAY_NAME("test2");
// ai1.setACCOUNT_TYPE("01");
// ai2.setACCOUNT_TYPE("03");
// ai1.setACCT_STATE("0");
// ai2.setACCT_STATE("0");
// ai1.setPREPAY_ACCT_FLAG("0");
// ai2.setPREPAY_ACCT_FLAG("1");
// ai1.setACCT_BALANCE(new BigInteger("2000"));
// ai2.setACCT_BALANCE(new BigInteger("1000"));
// List<ACCT_INFO> aa = new ArrayList<ACCT_INFO>();
// aa.add(ai1);
// aa.add(ai2);
// info1.setAcctINFO(aa);
// rsp1.setQRY_AGENT_MARGIN_INFO(info1);
// body.setQRY_AGENT_MARGIN_RSP(rsp1);
// _return.setUNI_BSS_HEAD(parameters.getUNI_BSS_HEAD());
// _return.setUNI_BSS_BODY(body);
// return _return;
IPenetrationIfProcessorSRV penetrationIfProcessorSRV=
(IPenetrationIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV");
Object obj =
penetrationIfProcessorSRV.ifMsgProcessorForService(Constants.Agent.ACCT_INFO,
parameters);
return
(cn.chinaunicom.ws.agentser.unibssbody.QRY_AGENT_MARGIN_OUTPUT)obj;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.ftpFile.agent;
import java.util.HashMap;
import java.util.Map;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IInquiryUCInputVATMatchInfoSV;
import com.ai.uint.daemonTimer.interfaces.ITimerProcessSV;
import com.ai.uint.daemonTimer.util.Constants;
public class agentTime implements ITimerProcessSV{
@Override
public Map process(String arg0, String arg1, String arg2) {
Map retMap = new HashMap();
String params[] = arg1.split(",");
if (params == null ) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, "入参:["+arg1+"]格式错误:省份,省份");
return retMap;
}
try {
for(int i=0;i<params.length;i++){
CenterFactory.pushCenterInfo("qudao", "01");
getServie().insertRecord(98, params[i], 0, params[i], "04");
}
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, "ok");
} catch (Exception e) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, "ERROR:"+e.getMessage());
return retMap;
}
return retMap;
}
private static IInquiryUCInputVATMatchInfoSV getServie() {
return (IInquiryUCInputVATMatchInfoSV)ServiceFactory.getService(IInquiryUCInputVATMatchInfoSV.class);
}
public static void main(String[] ags){
agentTime aa = new agentTime();
aa.process("", "36,31,37", "");
}
}
<file_sep>
package com.unicom.wouchannel.inquiryagentauditinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ResponseMSGCONTENT complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ResponseMSGCONTENT">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="UC_AGENT_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="APPROVAL_STATUS" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="UC_AGREE_NO" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="UC_AGREE_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="UC_CHNL_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseMSGCONTENT", propOrder = {
"ucagentcode",
"approvalstatus",
"ucagreeno",
"ucagreename",
"ucchnlid"
})
public class ResponseMSGCONTENT {
@XmlElement(name = "UC_AGENT_CODE", required = true)
protected String ucagentcode;
@XmlElement(name = "APPROVAL_STATUS", required = true)
protected String approvalstatus;
@XmlElement(name = "UC_AGREE_NO", required = true)
protected String ucagreeno;
@XmlElement(name = "UC_AGREE_NAME", required = true)
protected String ucagreename;
@XmlElement(name = "UC_CHNL_ID", required = true)
protected String ucchnlid;
/**
* Gets the value of the ucagentcode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUCAGENTCODE() {
return ucagentcode;
}
/**
* Sets the value of the ucagentcode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUCAGENTCODE(String value) {
this.ucagentcode = value;
}
/**
* Gets the value of the approvalstatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAPPROVALSTATUS() {
return approvalstatus;
}
/**
* Sets the value of the approvalstatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAPPROVALSTATUS(String value) {
this.approvalstatus = value;
}
/**
* Gets the value of the ucagreeno property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUCAGREENO() {
return ucagreeno;
}
/**
* Sets the value of the ucagreeno property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUCAGREENO(String value) {
this.ucagreeno = value;
}
/**
* Gets the value of the ucagreename property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUCAGREENAME() {
return ucagreename;
}
/**
* Sets the value of the ucagreename property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUCAGREENAME(String value) {
this.ucagreename = value;
}
/**
* Gets the value of the ucchnlid property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUCCHNLID() {
return ucchnlid;
}
/**
* Sets the value of the ucchnlid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUCCHNLID(String value) {
this.ucchnlid = value;
}
}
<file_sep>
package cn.chinaunicom.ws.ordser.unibssbody.ordersubreq;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.ordser.unibssbody.ordersubreq package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.ordser.unibssbody.ordersubreq
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ORDERSUB_REQ }
*
*/
public ORDERSUB_REQ createORDERSUB_REQ() {
return new ORDERSUB_REQ();
}
/**
* Create an instance of {@link ORDERSUB_REQ.SUB_ORDERSUB_REQ }
*
*/
public ORDERSUB_REQ.SUB_ORDERSUB_REQ createORDERSUB_REQSUB_ORDERSUB_REQ() {
return new ORDERSUB_REQ.SUB_ORDERSUB_REQ();
}
/**
* Create an instance of {@link ORDERSUB_REQ.PAY_INFO }
*
*/
public ORDERSUB_REQ.PAY_INFO createORDERSUB_REQPAY_INFO() {
return new ORDERSUB_REQ.PAY_INFO();
}
/**
* Create an instance of {@link ORDERSUB_REQ.PARA }
*
*/
public ORDERSUB_REQ.PARA createORDERSUB_REQPARA() {
return new ORDERSUB_REQ.PARA();
}
/**
* Create an instance of {@link ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO }
*
*/
public ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO createORDERSUB_REQSUB_ORDERSUB_REQFEE_INFO() {
return new ORDERSUB_REQ.SUB_ORDERSUB_REQ.FEE_INFO();
}
}
<file_sep>package com.ai.uchintService.client.test;
import java.util.TimerTask;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.busi.service.interfaces.ItestSV;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.core.util.MaxIdUtil;
import com.ai.uip.platform.service.interfaces.IUipSyncRecordSV;
/**
* @user: Administrator
* @author: yougang
* @version:1.0
* @created:Oct 27, 2011
*/
public class RecordBeanTimer extends TimerTask{
@Override
public void run() {
try {
System.out.println("===============开始执行插入record=====================");
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"11");
String recordId=getSevice().getRecordId();
//long recordId = Long.parseLong(MaxIdUtil.getSequenceNextVal("record_id"));
String sql = "insert into uip_sync_record (RECORD_ID, SUBJECT_ID, MONTH, PROVINCE_CODE, CITY_CODE, " +
"COUNTY_CODE, CONTENT_KIND, CONTENT_ID, BATCH_NO, SYNC_CONTENT, SYNC_TYPE, SYNC_TIME, INSERT_TIME, " +
"STATE, STATE_TIME, LOCK_STATUS)values ("+recordId+", 503, '201109', '11', '', '', '04', '36', 1, '', '1', " +
"to_date('09-10-2011 15:34:53', 'dd-mm-yyyy hh24:mi:ss'), to_date('15-09-2011 10:23:24', 'dd-mm-yyyy hh24:mi:ss'), " +
"'00', to_date('22-10-2011 10:37:35', 'dd-mm-yyyy hh24:mi:ss'), 0)";
int num = DbUtil.exeSQL(sql, null);
System.out.println("===========分中心成功==========");
} catch (Exception e) {
e.printStackTrace();
}
}
private static ItestSV getSevice() {
return (ItestSV) ServiceFactory.getService(ItestSV.class);
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,ChannelInfoPreCheckSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,ChannelInfoPreCheckSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,ChannelInfoPreCheckSchema.xsd
channelInfoPreCheck,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.IUC_TF_CHL_PAY_APPLYValue;
public class UC_TF_CHL_PAY_APPLYBean extends DataContainer implements DataContainerInterface,IUC_TF_CHL_PAY_APPLYValue{
private static String m_boName = "bo.UC_TF_CHL_PAY_APPLY";
public final static String S_PayObjectType = "PAY_OBJECT_TYPE";
public final static String S_PayObjectId = "PAY_OBJECT_ID";
public final static String S_DeptType = "DEPT_TYPE";
public final static String S_UpdateRemark = "UPDATE_REMARK";
public final static String S_UpdateDate = "UPDATE_DATE";
public final static String S_PayRemark = "PAY_REMARK";
public final static String S_PayState = "PAY_STATE";
public final static String S_PayDepartId = "PAY_DEPART_ID";
public final static String S_UpdateDepartId = "UPDATE_DEPART_ID";
public final static String S_BillNo = "BILL_NO";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_CityCode = "CITY_CODE";
public final static String S_BankAcctName = "BANK_ACCT_NAME";
public final static String S_PayStatMoney = "PAY_STAT_MONEY";
public final static String S_PayStaffId = "PAY_STAFF_ID";
public final static String S_BankNo = "BANK_NO";
public final static String S_PayBatchId = "PAY_BATCH_ID";
public final static String S_BankCode = "BANK_CODE";
public final static String S_SerialNo = "SERIAL_NO";
public final static String S_PayDate = "PAY_DATE";
public final static String S_TaxRate = "TAX_RATE";
public final static String S_PayMoney = "PAY_MONEY";
public final static String S_UpdateStaffId = "UPDATE_STAFF_ID";
public final static String S_LineNo = "LINE_NO";
public final static String S_VoucherNumber = "VOUCHER_NUMBER";
public final static String S_HasPayed = "HAS_PAYED";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UC_TF_CHL_PAY_APPLYBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("此种数据容器不能重置业务对象类型");
}
public void initPayObjectType(String value){
this.initProperty(S_PayObjectType,value);
}
public void setPayObjectType(String value){
this.set(S_PayObjectType,value);
}
public void setPayObjectTypeNull(){
this.set(S_PayObjectType,null);
}
public String getPayObjectType(){
return DataType.getAsString(this.get(S_PayObjectType));
}
public String getPayObjectTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayObjectType));
}
public void initPayObjectId(String value){
this.initProperty(S_PayObjectId,value);
}
public void setPayObjectId(String value){
this.set(S_PayObjectId,value);
}
public void setPayObjectIdNull(){
this.set(S_PayObjectId,null);
}
public String getPayObjectId(){
return DataType.getAsString(this.get(S_PayObjectId));
}
public String getPayObjectIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayObjectId));
}
public void initDeptType(String value){
this.initProperty(S_DeptType,value);
}
public void setDeptType(String value){
this.set(S_DeptType,value);
}
public void setDeptTypeNull(){
this.set(S_DeptType,null);
}
public String getDeptType(){
return DataType.getAsString(this.get(S_DeptType));
}
public String getDeptTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_DeptType));
}
public void initUpdateRemark(String value){
this.initProperty(S_UpdateRemark,value);
}
public void setUpdateRemark(String value){
this.set(S_UpdateRemark,value);
}
public void setUpdateRemarkNull(){
this.set(S_UpdateRemark,null);
}
public String getUpdateRemark(){
return DataType.getAsString(this.get(S_UpdateRemark));
}
public String getUpdateRemarkInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateRemark));
}
public void initUpdateDate(Timestamp value){
this.initProperty(S_UpdateDate,value);
}
public void setUpdateDate(Timestamp value){
this.set(S_UpdateDate,value);
}
public void setUpdateDateNull(){
this.set(S_UpdateDate,null);
}
public Timestamp getUpdateDate(){
return DataType.getAsDateTime(this.get(S_UpdateDate));
}
public Timestamp getUpdateDateInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_UpdateDate));
}
public void initPayRemark(String value){
this.initProperty(S_PayRemark,value);
}
public void setPayRemark(String value){
this.set(S_PayRemark,value);
}
public void setPayRemarkNull(){
this.set(S_PayRemark,null);
}
public String getPayRemark(){
return DataType.getAsString(this.get(S_PayRemark));
}
public String getPayRemarkInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayRemark));
}
public void initPayState(String value){
this.initProperty(S_PayState,value);
}
public void setPayState(String value){
this.set(S_PayState,value);
}
public void setPayStateNull(){
this.set(S_PayState,null);
}
public String getPayState(){
return DataType.getAsString(this.get(S_PayState));
}
public String getPayStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayState));
}
public void initPayDepartId(String value){
this.initProperty(S_PayDepartId,value);
}
public void setPayDepartId(String value){
this.set(S_PayDepartId,value);
}
public void setPayDepartIdNull(){
this.set(S_PayDepartId,null);
}
public String getPayDepartId(){
return DataType.getAsString(this.get(S_PayDepartId));
}
public String getPayDepartIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayDepartId));
}
public void initUpdateDepartId(String value){
this.initProperty(S_UpdateDepartId,value);
}
public void setUpdateDepartId(String value){
this.set(S_UpdateDepartId,value);
}
public void setUpdateDepartIdNull(){
this.set(S_UpdateDepartId,null);
}
public String getUpdateDepartId(){
return DataType.getAsString(this.get(S_UpdateDepartId));
}
public String getUpdateDepartIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateDepartId));
}
public void initBillNo(long value){
this.initProperty(S_BillNo,new Long(value));
}
public void setBillNo(long value){
this.set(S_BillNo,new Long(value));
}
public void setBillNo(Long value){
this.set(S_BillNo,value);
}
public Long getBillNoAsLong(){
return (Long )this.get(S_BillNo);
}
public void setBillNoNull(){
this.set(S_BillNo,null);
}
public long getBillNo(){
return DataType.getAsLong(this.get(S_BillNo));
}
public long getBillNoInitialValue(){
return DataType.getAsLong(this.getOldObj(S_BillNo));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initBankAcctName(String value){
this.initProperty(S_BankAcctName,value);
}
public void setBankAcctName(String value){
this.set(S_BankAcctName,value);
}
public void setBankAcctNameNull(){
this.set(S_BankAcctName,null);
}
public String getBankAcctName(){
return DataType.getAsString(this.get(S_BankAcctName));
}
public String getBankAcctNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankAcctName));
}
public void initPayStatMoney(double value){
this.initProperty(S_PayStatMoney,new Double(value));
}
public void setPayStatMoney(double value){
this.set(S_PayStatMoney,new Double(value));
}
public void setPayStatMoney(Double value){
this.set(S_PayStatMoney,value);
}
public Double getPayStatMoneyAsDouble(){
return (Double )this.get(S_PayStatMoney);
}
public void setPayStatMoneyNull(){
this.set(S_PayStatMoney,null);
}
public double getPayStatMoney(){
return DataType.getAsDouble(this.get(S_PayStatMoney));
}
public double getPayStatMoneyInitialValue(){
return DataType.getAsDouble(this.getOldObj(S_PayStatMoney));
}
public void initPayStaffId(String value){
this.initProperty(S_PayStaffId,value);
}
public void setPayStaffId(String value){
this.set(S_PayStaffId,value);
}
public void setPayStaffIdNull(){
this.set(S_PayStaffId,null);
}
public String getPayStaffId(){
return DataType.getAsString(this.get(S_PayStaffId));
}
public String getPayStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayStaffId));
}
public void initBankNo(String value){
this.initProperty(S_BankNo,value);
}
public void setBankNo(String value){
this.set(S_BankNo,value);
}
public void setBankNoNull(){
this.set(S_BankNo,null);
}
public String getBankNo(){
return DataType.getAsString(this.get(S_BankNo));
}
public String getBankNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankNo));
}
public void initPayBatchId(String value){
this.initProperty(S_PayBatchId,value);
}
public void setPayBatchId(String value){
this.set(S_PayBatchId,value);
}
public void setPayBatchIdNull(){
this.set(S_PayBatchId,null);
}
public String getPayBatchId(){
return DataType.getAsString(this.get(S_PayBatchId));
}
public String getPayBatchIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayBatchId));
}
public void initBankCode(String value){
this.initProperty(S_BankCode,value);
}
public void setBankCode(String value){
this.set(S_BankCode,value);
}
public void setBankCodeNull(){
this.set(S_BankCode,null);
}
public String getBankCode(){
return DataType.getAsString(this.get(S_BankCode));
}
public String getBankCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankCode));
}
public void initSerialNo(long value){
this.initProperty(S_SerialNo,new Long(value));
}
public void setSerialNo(long value){
this.set(S_SerialNo,new Long(value));
}
public void setSerialNo(Long value){
this.set(S_SerialNo,value);
}
public Long getSerialNoAsLong(){
return (Long )this.get(S_SerialNo);
}
public void setSerialNoNull(){
this.set(S_SerialNo,null);
}
public long getSerialNo(){
return DataType.getAsLong(this.get(S_SerialNo));
}
public long getSerialNoInitialValue(){
return DataType.getAsLong(this.getOldObj(S_SerialNo));
}
public void initPayDate(Timestamp value){
this.initProperty(S_PayDate,value);
}
public void setPayDate(Timestamp value){
this.set(S_PayDate,value);
}
public void setPayDateNull(){
this.set(S_PayDate,null);
}
public Timestamp getPayDate(){
return DataType.getAsDateTime(this.get(S_PayDate));
}
public Timestamp getPayDateInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_PayDate));
}
public void initTaxRate(int value){
this.initProperty(S_TaxRate,new Integer(value));
}
public void setTaxRate(int value){
this.set(S_TaxRate,new Integer(value));
}
public void setTaxRate(Integer value){
this.set(S_TaxRate,value);
}
public Integer getTaxRateAsInteger(){
return (Integer )this.get(S_TaxRate);
}
public void setTaxRateNull(){
this.set(S_TaxRate,null);
}
public int getTaxRate(){
return DataType.getAsInt(this.get(S_TaxRate));
}
public int getTaxRateInitialValue(){
return DataType.getAsInt(this.getOldObj(S_TaxRate));
}
public void initPayMoney(double value){
this.initProperty(S_PayMoney,new Double(value));
}
public void setPayMoney(double value){
this.set(S_PayMoney,new Double(value));
}
public void setPayMoney(Double value){
this.set(S_PayMoney,value);
}
public Double getPayMoneyAsDouble(){
return (Double )this.get(S_PayMoney);
}
public void setPayMoneyNull(){
this.set(S_PayMoney,null);
}
public double getPayMoney(){
return DataType.getAsDouble(this.get(S_PayMoney));
}
public double getPayMoneyInitialValue(){
return DataType.getAsDouble(this.getOldObj(S_PayMoney));
}
public void initUpdateStaffId(String value){
this.initProperty(S_UpdateStaffId,value);
}
public void setUpdateStaffId(String value){
this.set(S_UpdateStaffId,value);
}
public void setUpdateStaffIdNull(){
this.set(S_UpdateStaffId,null);
}
public String getUpdateStaffId(){
return DataType.getAsString(this.get(S_UpdateStaffId));
}
public String getUpdateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateStaffId));
}
public void initLineNo(int value){
this.initProperty(S_LineNo,new Integer(value));
}
public void setLineNo(int value){
this.set(S_LineNo,new Integer(value));
}
public void setLineNo(Integer value){
this.set(S_LineNo,value);
}
public Integer getLineNoAsInteger(){
return (Integer )this.get(S_LineNo);
}
public void setLineNoNull(){
this.set(S_LineNo,null);
}
public int getLineNo(){
return DataType.getAsInt(this.get(S_LineNo));
}
public int getLineNoInitialValue(){
return DataType.getAsInt(this.getOldObj(S_LineNo));
}
public void initVoucherNumber(String value){
this.initProperty(S_VoucherNumber,value);
}
public void setVoucherNumber(String value){
this.set(S_VoucherNumber,value);
}
public void setVoucherNumberNull(){
this.set(S_VoucherNumber,null);
}
public String getVoucherNumber(){
return DataType.getAsString(this.get(S_VoucherNumber));
}
public String getVoucherNumberInitialValue(){
return DataType.getAsString(this.getOldObj(S_VoucherNumber));
}
public void initHasPayed(int value){
this.initProperty(S_HasPayed,new Integer(value));
}
public void setHasPayed(int value){
this.set(S_HasPayed,new Integer(value));
}
public void setHasPayed(Integer value){
this.set(S_HasPayed,value);
}
public Integer getHasPayedAsInteger(){
return (Integer )this.get(S_HasPayed);
}
public void setHasPayedNull(){
this.set(S_HasPayed,null);
}
public int getHasPayed(){
return DataType.getAsInt(this.get(S_HasPayed));
}
public int getHasPayedInitialValue(){
return DataType.getAsInt(this.getOldObj(S_HasPayed));
}
}
<file_sep>
package com.unicom.mss.sb_pps_pps_importchannelstatusinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>ErrorItem complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="ErrorItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ENTITY_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ERROR_MESSAGE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RECORD_NUMBER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ErrorItem", propOrder = {
"entityname",
"prikey",
"errormessage",
"recordnumber",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5"
})
public class ErrorItem {
@XmlElement(name = "ENTITY_NAME", required = true, nillable = true)
protected String entityname;
@XmlElement(name = "PRI_KEY", required = true, nillable = true)
protected String prikey;
@XmlElement(name = "ERROR_MESSAGE", required = true, nillable = true)
protected String errormessage;
@XmlElement(name = "RECORD_NUMBER", required = true, nillable = true)
protected String recordnumber;
@XmlElement(name = "RESERVED_1", required = true, nillable = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true, nillable = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true, nillable = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true, nillable = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true, nillable = true)
protected String reserved5;
/**
* 获取entityname属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getENTITYNAME() {
return entityname;
}
/**
* 设置entityname属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setENTITYNAME(String value) {
this.entityname = value;
}
/**
* 获取prikey属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRIKEY() {
return prikey;
}
/**
* 设置prikey属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRIKEY(String value) {
this.prikey = value;
}
/**
* 获取errormessage属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getERRORMESSAGE() {
return errormessage;
}
/**
* 设置errormessage属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setERRORMESSAGE(String value) {
this.errormessage = value;
}
/**
* 获取recordnumber属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRECORDNUMBER() {
return recordnumber;
}
/**
* 设置recordnumber属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRECORDNUMBER(String value) {
this.recordnumber = value;
}
/**
* 获取reserved1属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED1() {
return reserved1;
}
/**
* 设置reserved1属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED1(String value) {
this.reserved1 = value;
}
/**
* 获取reserved2属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED2() {
return reserved2;
}
/**
* 设置reserved2属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED2(String value) {
this.reserved2 = value;
}
/**
* 获取reserved3属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED3() {
return reserved3;
}
/**
* 设置reserved3属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED3(String value) {
this.reserved3 = value;
}
/**
* 获取reserved4属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED4() {
return reserved4;
}
/**
* 设置reserved4属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED4(String value) {
this.reserved4 = value;
}
/**
* 获取reserved5属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED5() {
return reserved5;
}
/**
* 设置reserved5属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED5(String value) {
this.reserved5 = value;
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_QZ_DEPOSIT_RECH_SYNCValue;
import com.ai.uip.core.ivalues.*;
public class TF_QZ_DEPOSIT_RECH_SYNCBean extends DataContainer implements DataContainerInterface,ITF_QZ_DEPOSIT_RECH_SYNCValue{
private static String m_boName = "bo.TF_QZ_DEPOSIT_RECH_SYNC";
public final static String S_OrderId = "ORDER_ID";
public final static String S_OperNo = "OPER_NO";
public final static String S_TradeDatetime = "TRADE_DATETIME";
public final static String S_PayFee = "PAY_FEE";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_InsertTime = "INSERT_TIME";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_OperName = "OPER_NAME";
public final static String S_BusyType = "BUSY_TYPE";
public final static String S_ProvinceOrderId = "PROVINCE_ORDER_ID";
public final static String S_ChnlName = "CHNL_NAME";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_QZ_DEPOSIT_RECH_SYNCBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�������������������ҵ���������");
}
public void initOrderId(String value){
this.initProperty(S_OrderId,value);
}
public void setOrderId(String value){
this.set(S_OrderId,value);
}
public void setOrderIdNull(){
this.set(S_OrderId,null);
}
public String getOrderId(){
return DataType.getAsString(this.get(S_OrderId));
}
public String getOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrderId));
}
public void initOperNo(String value){
this.initProperty(S_OperNo,value);
}
public void setOperNo(String value){
this.set(S_OperNo,value);
}
public void setOperNoNull(){
this.set(S_OperNo,null);
}
public String getOperNo(){
return DataType.getAsString(this.get(S_OperNo));
}
public String getOperNoInitialValue(){
return DataType.getAsString(this.getOldObj(S_OperNo));
}
public void initTradeDatetime(String value){
this.initProperty(S_TradeDatetime,value);
}
public void setTradeDatetime(String value){
this.set(S_TradeDatetime,value);
}
public void setTradeDatetimeNull(){
this.set(S_TradeDatetime,null);
}
public String getTradeDatetime(){
return DataType.getAsString(this.get(S_TradeDatetime));
}
public String getTradeDatetimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeDatetime));
}
public void initPayFee(String value){
this.initProperty(S_PayFee,value);
}
public void setPayFee(String value){
this.set(S_PayFee,value);
}
public void setPayFeeNull(){
this.set(S_PayFee,null);
}
public String getPayFee(){
return DataType.getAsString(this.get(S_PayFee));
}
public String getPayFeeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayFee));
}
public void initChnlCode(String value){
this.initProperty(S_ChnlCode,value);
}
public void setChnlCode(String value){
this.set(S_ChnlCode,value);
}
public void setChnlCodeNull(){
this.set(S_ChnlCode,null);
}
public String getChnlCode(){
return DataType.getAsString(this.get(S_ChnlCode));
}
public String getChnlCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlCode));
}
public void initInsertTime(Timestamp value){
this.initProperty(S_InsertTime,value);
}
public void setInsertTime(Timestamp value){
this.set(S_InsertTime,value);
}
public void setInsertTimeNull(){
this.set(S_InsertTime,null);
}
public Timestamp getInsertTime(){
return DataType.getAsDateTime(this.get(S_InsertTime));
}
public Timestamp getInsertTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_InsertTime));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initOperName(String value){
this.initProperty(S_OperName,value);
}
public void setOperName(String value){
this.set(S_OperName,value);
}
public void setOperNameNull(){
this.set(S_OperName,null);
}
public String getOperName(){
return DataType.getAsString(this.get(S_OperName));
}
public String getOperNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_OperName));
}
public void initBusyType(String value){
this.initProperty(S_BusyType,value);
}
public void setBusyType(String value){
this.set(S_BusyType,value);
}
public void setBusyTypeNull(){
this.set(S_BusyType,null);
}
public String getBusyType(){
return DataType.getAsString(this.get(S_BusyType));
}
public String getBusyTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BusyType));
}
public void initProvinceOrderId(String value){
this.initProperty(S_ProvinceOrderId,value);
}
public void setProvinceOrderId(String value){
this.set(S_ProvinceOrderId,value);
}
public void setProvinceOrderIdNull(){
this.set(S_ProvinceOrderId,null);
}
public String getProvinceOrderId(){
return DataType.getAsString(this.get(S_ProvinceOrderId));
}
public String getProvinceOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceOrderId));
}
public void initChnlName(String value){
this.initProperty(S_ChnlName,value);
}
public void setChnlName(String value){
this.set(S_ChnlName,value);
}
public void setChnlNameNull(){
this.set(S_ChnlName,null);
}
public String getChnlName(){
return DataType.getAsString(this.get(S_ChnlName));
}
public String getChnlNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlName));
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.bsdmchannelinfoser;
import java.sql.Timestamp;
import java.util.Hashtable;
import java.util.Map;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfoprecheckmsgnotifyreq.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfoprecheckmsgnotifyrsp.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_RSP;
import cn.chinaunicom.ws.unibssattached.UNI_BSS_ATTACHED;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.bo.UIP_WS_SRV_RECEIVE_LOGBean;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoPrecheckMsgNotifyReqVO;
import com.ai.uchintService.ejb.impl.GenSdm2BHeaderImpl;
import com.ai.uchintService.ejb.impl.UipWsReceiveLogSVImpl;
import com.ai.uchintService.ejb.interfaces.IUipWsReceiveLogSV;
import com.ai.uip.core.util.ManagerUtil;
import com.ai.uint.ejb.util.CommonUtil;
import com.ai.uip.platform.util.Bean2XmlUtil;
import com.ailk.uchannel.prevalidateresult.interfaces.IPreValidateResultRemoteSV;
import com.ailk.uchannel.prevalidateresult.param.TfTaskInfoOrderVO;
import com.ailk.uchannel.prevalidateresult.param.TfTaskInfoRequestVo;
import com.ailk.uchannel.prevalidateresult.param.TfTaskInfoResponseVo;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-05-02T11:24:33.442+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "BSdmChannelInfoSer",
portName = "BSdmChannelInfoSerSOAP",
targetNamespace = "http://ws.chinaunicom.cn/BSdmChannelInfoSer/",
// wsdlLocation = "file:/G:/SrcWorkSpace/uip_develement/wsdl/BSdmChannelInfoSer/BSdmChannelInfoSer.wsdl",
endpointInterface = "cn.chinaunicom.ws.bsdmchannelinfoser.BSdmChannelInfoSer")
public class BSdmChannelInfoSerImpl implements BSdmChannelInfoSer {
private static final Logger LOG = Logger.getLogger(BSdmChannelInfoSerImpl.class.getName());
/* (non-Javadoc)
* 渠道信息预判结果通知
*/
public CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT channelInfoPrecheckMsgNotify(CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT parameters) {
LOG.info("Executing operation channelInfoPrecheckMsgNotify");
System.out.println(parameters);
try {
// ChannelInfoPrecheckMsgNotifyReqVO reqVO = new ChannelInfoPrecheckMsgNotifyReqVO();
CHANNEL_INFO_PRECHECK_MSG_NOTIFY_RSP rspVO = new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_RSP();
CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT _return = new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT();
CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT.UNI_BSS_BODY uniBssBody= new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT.UNI_BSS_BODY();
UNI_BSS_ATTACHED head = new UNI_BSS_ATTACHED();
/** EJB返回数据进行报文组装 **/
IUipWsReceiveLogSV uiplog = (IUipWsReceiveLogSV) ServiceFactory.getService(IUipWsReceiveLogSV.class);
UIP_WS_SRV_RECEIVE_LOGBean startbean = new UIP_WS_SRV_RECEIVE_LOGBean();
long logId = UipWsReceiveLogSVImpl.getLogId();
startbean.setLogId(logId);
startbean.setServiceCode("BSdmChannelInfoSer");
startbean.setOperateCode("channelInfoPrecheckMsgNotify");
startbean.setExeInst(ManagerUtil.getPropCfgManager().getInstId());
long startTime = System.currentTimeMillis();
startbean.setStartTime(new Timestamp(startTime));
startbean.setState("00");
String reqXml = Bean2XmlUtil.bean2XxmlForRespone("cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT",parameters);
startbean.setReqXmlMsg(reqXml);
uiplog.save(startbean);
//前面为EJB实现类,后面为EJB接口
IPreValidateResultRemoteSV ejbProcessor = (IPreValidateResultRemoteSV) CommonUtil.getEjbsv("channelInfoPrecheckMsgNotify");
TfTaskInfoRequestVo tftaskvo = new TfTaskInfoRequestVo();
tftaskvo = (TfTaskInfoRequestVo) getTfTaskInfoOrderSVO(
null, //String taskInfoId,
parameters.getUNI_BSS_BODY().getCHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ().getORDER_ID(), //String orderId,
null, //String workflowId,
null, //String taskId,
parameters.getUNI_BSS_BODY().getCHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ().getRESP_CODE(), //String resultCode,
parameters.getUNI_BSS_BODY().getCHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ().getRESP_DESC(), //String resultDesc,
null, //Timestamp createTime,
null //String createStaffId
);
TfTaskInfoResponseVo respVO = ejbProcessor.execute(tftaskvo);
if(respVO.getResultCode() == null){
System.out.println("调用前台EJB返回对象:RESP_CODE 为空");
rspVO.setRESP_CODE("0000");
rspVO.setRESP_DESC("模拟成功");
}
else{
rspVO.setRESP_CODE(respVO.getResultCode().equals("1") ? "0000":"8888");
rspVO.setRESP_DESC(respVO.getResultDesc());
System.out.println("getRESP_CODE==============="+respVO.getResultCode());
System.out.println("getRESP_DESC==============="+respVO.getResultDesc());
}
//组装报文头公共方法GenSdm2BHeaderImpl.genSdm2BHeader
head.setMEDIA_INFO("");
_return.setUNI_BSS_ATTACHED(head);
uniBssBody.setCHANNEL_INFO_PRECHECK_MSG_NOTIFY_RSP(rspVO);
_return.setUNI_BSS_HEAD(GenSdm2BHeaderImpl.genSdm2BHeader(parameters.getUNI_BSS_HEAD(),logId, "0", rspVO.getRESP_CODE(),rspVO.getRESP_DESC()));
_return.setUNI_BSS_BODY(uniBssBody);
//更新UIP_WS_SRV_RECEIVE_LOG表
UIP_WS_SRV_RECEIVE_LOGBean endbean = ((IUipWsReceiveLogSV) ServiceFactory.getService(IUipWsReceiveLogSV.class)).getBean(logId);
//结束时间
long endTime = System.currentTimeMillis();
endbean.setEndTime(new Timestamp(endTime));
endbean.setReqDataCnt(1);
String resultCode = rspVO.getRESP_CODE();
System.out.println("执行到此处11111111111111resultCode="+resultCode);
//成功
if (resultCode.equals("0000")) {
endbean.setState("02");
endbean.setSuccessDataCng(1);
endbean.setFailDataCng(0);
System.out.println("执行到此处if通过");
//失败
}
else if (resultCode.equals("8888")){
endbean.setState("04");
endbean.setSuccessDataCng(0);
endbean.setFailDataCng(1);
System.out.println("执行到此处else if通过");
}
else{
System.out.println("resultCode==========="+resultCode);
}
System.out.println("执行到此处22222222222222222222222222222222222222222222222222222");
String respXml = Bean2XmlUtil.bean2XxmlForRespone("cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_OUTPUT", _return);
endbean.setUseTime(endTime-startTime);
endbean.setResultDesc(rspVO.getRESP_DESC());
endbean.setRespXmlMsg(respXml);
//set需要更新的字段...
getService().update(endbean);
System.out.println("执行完成,状态endbean.state="+endbean.getState());
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/* (non-Javadoc)
* @see cn.chinaunicom.ws.bsdmchannelinfoser.BSdmChannelInfoSer#channelInfoChg(cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_INPUT parameters )*
*/
public cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_OUTPUT channelInfoChg(cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_INPUT parameters) {
LOG.info("Executing operation channelInfoChg");
System.out.println(parameters);
try {
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_OUTPUT _return = null;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/*
* 渠道信息修改变更通知
*/
public cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT channelInfoChgCancelNotify(cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT parameters) {
LOG.info("Executing operation channelInfoChgCancelNotify");
System.out.println(parameters);
try {
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT _return = null;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
/* (non-Javadoc)
* @see cn.chinaunicom.ws.bsdmchannelinfoser.BSdmChannelInfoSer#channelInfoChgNotify(cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_NOTIFY_INPUT parameters )*
*/
public cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_NOTIFY_OUTPUT channelInfoChgNotify(cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_NOTIFY_INPUT parameters) {
LOG.info("Executing operation channelInfoChgNotify");
System.out.println(parameters);
try {
cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_NOTIFY_OUTPUT _return = null;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
public static ChannelInfoPrecheckMsgNotifyReqVO CopyPoJo(CHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ parameters){
ChannelInfoPrecheckMsgNotifyReqVO rVo = new ChannelInfoPrecheckMsgNotifyReqVO();
rVo.setCHNL_CODE(parameters.getCHNL_CODE());
rVo.setRESP_CODE(parameters.getRESP_CODE());
rVo.setRESP_DESC(parameters.getRESP_DESC());
return rVo;
}
public static Object getTfTaskInfoOrderSVO (String taskInfoId,String orderId,String workflowId,
String taskId,String resultCode,String resultDesc,Timestamp createTime,String createStaffId){
TfTaskInfoRequestVo reqVo = new TfTaskInfoRequestVo();
TfTaskInfoOrderVO to = new TfTaskInfoOrderVO();
to.setOrderId(orderId);
to.setCreateStaffId(createStaffId);
to.setCreateTime(createTime);
to.setResultCode(resultCode);
to.setResultDesc(resultDesc);
reqVo.setTfTaskInfoOrderVO(to);
return reqVo;
}
public IUipWsReceiveLogSV getService() {
return (IUipWsReceiveLogSV)ServiceFactory.getService(IUipWsReceiveLogSV.class);
}
public static void main(String[] args) {
ChannelInfoPrecheckMsgNotifyReqVO reqVO = new ChannelInfoPrecheckMsgNotifyReqVO();
CHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ req = new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ();
req.setCHNL_CODE("1");
req.setRESP_CODE("RETURN_CODE");
req.setRESP_DESC("RETURN_INFO");
reqVO = CopyPoJo(req);
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url","t3://10.1.25.145:7001");
//
//前面为EJB实现类,后面为EJB接口
String ejbName = "PreValidateResultSVImpl#com.ailk.uchannel.ejb.remote.interfaces.IPreValidateResultSV";
Context context;
try {
}
catch (Exception e) {
e.printStackTrace();
}
CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT parameters = new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT();
CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT.UNI_BSS_BODY body = new CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT.UNI_BSS_BODY();
body.setCHANNEL_INFO_PRECHECK_MSG_NOTIFY_REQ(req);
parameters.setUNI_BSS_BODY(body);
IUipWsReceiveLogSV uiplog = (IUipWsReceiveLogSV) ServiceFactory.getService(IUipWsReceiveLogSV.class);
System.out.println("11111111111111111111111111111111111111111111111111");
//往日志中加入记录 记录日志ID,服务编码,操作编码,执行实例,开始时间,请求报文,状态(00)。
UIP_WS_SRV_RECEIVE_LOGBean logBean;
System.out.println("2222222222222222222222222222222222222222222222222222");
try {
logBean = new UIP_WS_SRV_RECEIVE_LOGBean();
System.out.println("23333333333333333333333333332");
long logId = UipWsReceiveLogSVImpl.getLogId();
logBean.setLogId(logId);
logBean.setServiceCode("BSdmChannelInfoSer");
logBean.setOperateCode("channelInfoPrecheckMsgNotify");
logBean.setExeInst(ManagerUtil.getPropCfgManager().getInstId());
//开始时间
long startTime = System.currentTimeMillis();
logBean.setStartTime(new Timestamp(startTime));
logBean.setState("00");
uiplog.save(logBean);
System.out.println("logBean:============="+logBean);
System.out.println("uiplog:==========="+uiplog);
} catch (Exception e) {
System.out.println("报错");
e.printStackTrace();
}
String reqXml = Bean2XmlUtil.bean2XxmlForRespone("cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_PRECHECK_MSG_NOTIFY_INPUT",parameters);
System.out.println(reqXml);
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IUC_QUERY_TIMEValue extends DataStructInterface{
public final static String S_QueryName = "QUERY_NAME";
public final static String S_Comments = "COMMENTS";
public final static String S_ParamValue = "PARAM_VALUE";
public String getQueryName();
public String getComments();
public String getParamValue();
public void setQueryName(String value);
public void setComments(String value);
public void setParamValue(String value);
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.vo.PublishIfCfgVo;
public interface IAgentStateSyncFullSV {
public String getLockFile(PublishIfCfgVo ifVo,String provinceCode) throws SQLException,IOException;
public String getLockFileForProvince(PublishIfCfgVo ifVo,String provinceCode) throws SQLException,IOException;
/**
* 将回盘文件中的记录保存到库表中
* @param ifBean 接口bean
* @param list 记录集合
* @param resFileName ftp文件名
* @throws Exception
* @author zhangfan
*/
public HashMap<String, Object> saveBackFile(UipOperateBean ifBean,List<String> list, String resFileName) throws Exception;
}
<file_sep>package com.unicom.mss.sb_uc_uc_inquiryucinputvatmatchinfosrv;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-02-22T10:42:01.826+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://mss.unicom.com/SB_UC_UC_InquiryUCInputVATMatchInfoSrv", name = "SB_UC_UC_InquiryUCInputVATMatchInfoSrv")
@XmlSeeAlso({ObjectFactory.class, com.unicom.mss.soa.msgheader.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SBUCUCInquiryUCInputVATMatchInfoSrv {
@WebResult(name = "SB_UC_UC_InquiryUCInputVATMatchInfoSrvResponse", targetNamespace = "http://mss.unicom.com/SB_UC_UC_InquiryUCInputVATMatchInfoSrv", partName = "payload")
@WebMethod(action = "process")
public SB_UC_UC_InquiryUCInputVATMatchInfoSrvResponse process(
@WebParam(partName = "payload", name = "SB_UC_UC_InquiryUCInputVATMatchInfoSrvRequest", targetNamespace = "http://mss.unicom.com/SB_UC_UC_InquiryUCInputVATMatchInfoSrv")
SB_UC_UC_InquiryUCInputVATMatchInfoSrvRequest payload
);
}
<file_sep>package cn.chinaunicom.ws.precheckresultser;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2012-04-20T11:25:48.497+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://ws.chinaunicom.cn/PrecheckResultSer/", name = "PrecheckResultSer")
@XmlSeeAlso({cn.chinaunicom.ws.precheckresultser.unibssbody.ObjectFactory.class, cn.chinaunicom.ws.unibsshead.ObjectFactory.class, cn.chinaunicom.ws.unibssattached.ObjectFactory.class, cn.chinaunicom.ws.precheckresultser.unibssbody.precheckresultrsp.ObjectFactory.class, cn.chinaunicom.ws.precheckresultser.unibssbody.precheckresultreq.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface PrecheckResultSer {
@WebResult(name = "PRECHECK_RESULT_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/PrecheckResultSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/PrecheckResultSer/precheckResult/")
public cn.chinaunicom.ws.precheckresultser.unibssbody.PRECHECK_RESULT_OUTPUT precheckResult(
@WebParam(partName = "parameters", name = "PRECHECK_RESULT_INPUT", targetNamespace = "http://ws.chinaunicom.cn/PrecheckResultSer/unibssBody")
cn.chinaunicom.ws.precheckresultser.unibssbody.PRECHECK_RESULT_INPUT parameters
);
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IINT_AREA_CODE_AGENTValue;
public class INT_AREA_CODE_AGENTBean extends DataContainer implements DataContainerInterface,IINT_AREA_CODE_AGENTValue{
private static String m_boName = "bo.INT_AREA_CODE_AGENT";
public final static String S_ChlAreaCode = "CHL_AREA_CODE";
public final static String S_Comments = "COMMENTS";
public final static String S_ErpAreaLevel = "ERP_AREA_LEVEL";
public final static String S_ChlAreaLevel = "CHL_AREA_LEVEL";
public final static String S_ErpAreaCode = "ERP_AREA_CODE";
public final static String S_ErpAreaName = "ERP_AREA_NAME";
public final static String S_ChlAreaName = "CHL_AREA_NAME";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public INT_AREA_CODE_AGENTBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initChlAreaCode(String value){
this.initProperty(S_ChlAreaCode,value);
}
public void setChlAreaCode(String value){
this.set(S_ChlAreaCode,value);
}
public void setChlAreaCodeNull(){
this.set(S_ChlAreaCode,null);
}
public String getChlAreaCode(){
return DataType.getAsString(this.get(S_ChlAreaCode));
}
public String getChlAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlAreaCode));
}
public void initComments(String value){
this.initProperty(S_Comments,value);
}
public void setComments(String value){
this.set(S_Comments,value);
}
public void setCommentsNull(){
this.set(S_Comments,null);
}
public String getComments(){
return DataType.getAsString(this.get(S_Comments));
}
public String getCommentsInitialValue(){
return DataType.getAsString(this.getOldObj(S_Comments));
}
public void initErpAreaLevel(String value){
this.initProperty(S_ErpAreaLevel,value);
}
public void setErpAreaLevel(String value){
this.set(S_ErpAreaLevel,value);
}
public void setErpAreaLevelNull(){
this.set(S_ErpAreaLevel,null);
}
public String getErpAreaLevel(){
return DataType.getAsString(this.get(S_ErpAreaLevel));
}
public String getErpAreaLevelInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpAreaLevel));
}
public void initChlAreaLevel(String value){
this.initProperty(S_ChlAreaLevel,value);
}
public void setChlAreaLevel(String value){
this.set(S_ChlAreaLevel,value);
}
public void setChlAreaLevelNull(){
this.set(S_ChlAreaLevel,null);
}
public String getChlAreaLevel(){
return DataType.getAsString(this.get(S_ChlAreaLevel));
}
public String getChlAreaLevelInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlAreaLevel));
}
public void initErpAreaCode(String value){
this.initProperty(S_ErpAreaCode,value);
}
public void setErpAreaCode(String value){
this.set(S_ErpAreaCode,value);
}
public void setErpAreaCodeNull(){
this.set(S_ErpAreaCode,null);
}
public String getErpAreaCode(){
return DataType.getAsString(this.get(S_ErpAreaCode));
}
public String getErpAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpAreaCode));
}
public void initErpAreaName(String value){
this.initProperty(S_ErpAreaName,value);
}
public void setErpAreaName(String value){
this.set(S_ErpAreaName,value);
}
public void setErpAreaNameNull(){
this.set(S_ErpAreaName,null);
}
public String getErpAreaName(){
return DataType.getAsString(this.get(S_ErpAreaName));
}
public String getErpAreaNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpAreaName));
}
public void initChlAreaName(String value){
this.initProperty(S_ChlAreaName,value);
}
public void setChlAreaName(String value){
this.set(S_ChlAreaName,value);
}
public void setChlAreaNameNull(){
this.set(S_ChlAreaName,null);
}
public String getChlAreaName(){
return DataType.getAsString(this.get(S_ChlAreaName));
}
public String getChlAreaNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlAreaName));
}
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IINT_REDUCE_BUSI_PARAValue;
public class INT_REDUCE_BUSI_PARABean extends DataContainer implements DataContainerInterface,IINT_REDUCE_BUSI_PARAValue{
private static String m_boName = "bo.INT_REDUCE_BUSI_PARA";
public final static String S_InterfaceId = "INTERFACE_ID";
public final static String S_Comments = "COMMENTS";
public final static String S_TagCode = "TAG_CODE";
public final static String S_NetTypeCode = "NET_TYPE_CODE";
public final static String S_IncomeTypeCode = "INCOME_TYPE_CODE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public INT_REDUCE_BUSI_PARABean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
//�������������������ҵ���������
throw new AIException("Cannot reset ObjectType");
}
public void initInterfaceId(String value){
this.initProperty(S_InterfaceId,value);
}
public void setInterfaceId(String value){
this.set(S_InterfaceId,value);
}
public void setInterfaceIdNull(){
this.set(S_InterfaceId,null);
}
public String getInterfaceId(){
return DataType.getAsString(this.get(S_InterfaceId));
}
public String getInterfaceIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_InterfaceId));
}
public void initComments(String value){
this.initProperty(S_Comments,value);
}
public void setComments(String value){
this.set(S_Comments,value);
}
public void setCommentsNull(){
this.set(S_Comments,null);
}
public String getComments(){
return DataType.getAsString(this.get(S_Comments));
}
public String getCommentsInitialValue(){
return DataType.getAsString(this.getOldObj(S_Comments));
}
public void initTagCode(String value){
this.initProperty(S_TagCode,value);
}
public void setTagCode(String value){
this.set(S_TagCode,value);
}
public void setTagCodeNull(){
this.set(S_TagCode,null);
}
public String getTagCode(){
return DataType.getAsString(this.get(S_TagCode));
}
public String getTagCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TagCode));
}
public void initNetTypeCode(String value){
this.initProperty(S_NetTypeCode,value);
}
public void setNetTypeCode(String value){
this.set(S_NetTypeCode,value);
}
public void setNetTypeCodeNull(){
this.set(S_NetTypeCode,null);
}
public String getNetTypeCode(){
return DataType.getAsString(this.get(S_NetTypeCode));
}
public String getNetTypeCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_NetTypeCode));
}
public void initIncomeTypeCode(String value){
this.initProperty(S_IncomeTypeCode,value);
}
public void setIncomeTypeCode(String value){
this.set(S_IncomeTypeCode,value);
}
public void setIncomeTypeCodeNull(){
this.set(S_IncomeTypeCode,null);
}
public String getIncomeTypeCode(){
return DataType.getAsString(this.get(S_IncomeTypeCode));
}
public String getIncomeTypeCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_IncomeTypeCode));
}
}
<file_sep>
package com.unicom.mss.sb_eas_eas_importamountinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ResponseItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ResponseItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="REQUEST_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="LINE_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BILL_NO" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BATCH_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseItem", propOrder = {
"requestID",
"priKEY",
"lineID",
"billNO",
"batchID",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5"
})
public class ResponseItem {
@XmlElement(name = "REQUEST_ID", required = true)
protected String requestID;
@XmlElement(name = "PRI_KEY", required = true)
protected String priKEY;
@XmlElement(name = "LINE_ID", required = true)
protected String lineID;
@XmlElement(name = "BILL_NO", required = true)
protected String billNO;
@XmlElement(name = "BATCH_ID", required = true)
protected String batchID;
@XmlElement(name = "RESERVED_1", required = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true)
protected String reserved5;
/**
* Gets the value of the request_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREQUEST_ID() {
return requestID;
}
/**
* Sets the value of the request_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREQUEST_ID(String value) {
this.requestID = value;
}
/**
* Gets the value of the pri_KEY property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRI_KEY() {
return priKEY;
}
/**
* Sets the value of the pri_KEY property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRI_KEY(String value) {
this.priKEY = value;
}
/**
* Gets the value of the line_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLINE_ID() {
return lineID;
}
/**
* Sets the value of the line_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLINE_ID(String value) {
this.lineID = value;
}
/**
* Gets the value of the bill_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBILL_NO() {
return billNO;
}
/**
* Sets the value of the bill_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBILL_NO(String value) {
this.billNO = value;
}
/**
* Gets the value of the batch_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_ID() {
return batchID;
}
/**
* Sets the value of the batch_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_ID(String value) {
this.batchID = value;
}
/**
* Gets the value of the reserved_1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_1() {
return reserved1;
}
/**
* Sets the value of the reserved_1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_1(String value) {
this.reserved1 = value;
}
/**
* Gets the value of the reserved_2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_2() {
return reserved2;
}
/**
* Sets the value of the reserved_2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_2(String value) {
this.reserved2 = value;
}
/**
* Gets the value of the reserved_3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_3() {
return reserved3;
}
/**
* Sets the value of the reserved_3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_3(String value) {
this.reserved3 = value;
}
/**
* Gets the value of the reserved_4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_4() {
return reserved4;
}
/**
* Sets the value of the reserved_4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_4(String value) {
this.reserved4 = value;
}
/**
* Gets the value of the reserved_5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_5() {
return reserved5;
}
/**
* Sets the value of the reserved_5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_5(String value) {
this.reserved5 = value;
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IINT_AREA_CODE_AGENTValue extends DataStructInterface{
public final static String S_ChlAreaCode = "CHL_AREA_CODE";
public final static String S_Comments = "COMMENTS";
public final static String S_ErpAreaLevel = "ERP_AREA_LEVEL";
public final static String S_ChlAreaLevel = "CHL_AREA_LEVEL";
public final static String S_ErpAreaCode = "ERP_AREA_CODE";
public final static String S_ErpAreaName = "ERP_AREA_NAME";
public final static String S_ChlAreaName = "CHL_AREA_NAME";
public String getChlAreaCode();
public String getComments();
public String getErpAreaLevel();
public String getChlAreaLevel();
public String getErpAreaCode();
public String getErpAreaName();
public String getChlAreaName();
public void setChlAreaCode(String value);
public void setComments(String value);
public void setErpAreaLevel(String value);
public void setChlAreaLevel(String value);
public void setErpAreaCode(String value);
public void setErpAreaName(String value);
public void setChlAreaName(String value);
}
<file_sep>
package com.unicom.mss.sb_eip_eip_importpartnerinfosrv;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PARTNER_BANK_INFO complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PARTNER_BANK_INFO">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARTNER_BANK_INFOItem" type="{http://mss.unicom.com/SB_EIP_EIP_ImportPartnerInfoSrv}PARTNER_BANK_INFOItem" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PARTNER_BANK_INFO", propOrder = {
"partnerBANKINFOItem"
})
public class PARTNER_BANK_INFO {
@XmlElement(name = "PARTNER_BANK_INFOItem")
protected List<PARTNER_BANK_INFOItem> partnerBANKINFOItem;
/**
* Gets the value of the partnerBANKINFOItem property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the partnerBANKINFOItem property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARTNER_BANK_INFOItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PARTNER_BANK_INFOItem }
*
*
*/
public List<PARTNER_BANK_INFOItem> getPARTNER_BANK_INFOItem() {
if (partnerBANKINFOItem == null) {
partnerBANKINFOItem = new ArrayList<PARTNER_BANK_INFOItem>();
}
return this.partnerBANKINFOItem;
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IInquiryChannelInfoSrv;
import com.ai.uchintService.common.util.Constants;
import com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrvIN;
import com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrvOUT;
import com.unicom.ecip.inquirychannelinfosrv.Outmsgcontent;
public class InquiryChannelInfoSrvImpl implements IInquiryChannelInfoSrv {
private static final Log logger = LogFactory
.getLog(InquiryChannelInfoSrvImpl.class);
@Override
public InquiryChannelInfoSrvOUT inquiryChannelInfo(
InquiryChannelInfoSrvIN inputItem) throws Exception {
InquiryChannelInfoSrvOUT out = new InquiryChannelInfoSrvOUT();
List<String> infolist = new ArrayList<String>();
String authorize_code = inputItem.getAUTHORIZECODE();
String sql = "SELECT " +
"(CASE " +
"WHEN t.state = 10 AND t.chnl_kind_id LIKE '201%' " +
"THEN t.chnl_name||'_@'||t.chnl_addr_detail_total||'_@'||t1.gb_authorization_code||'_@00' " +
"WHEN t.state = 10 AND (t.chnl_kind_id LIKE '203%' OR t.chnl_kind_id LIKE '204%') " +
"THEN t.chnl_name||'_@'||t.chnl_url||'_@'||t1.gb_authorization_code||'_@00' " +
"ELSE '_@_@_@02' " +
"END) " +
"from tf_chl_channel t,tf_chl_authorization_code t1 " +
"WHERE " +
"t.chnl_id=t1.chnl_id " +
"AND " +
"t1.authorization_state = '1' " +
"AND " +
"t1.gb_authorization_code = '"+authorize_code+"'";
infolist = query(sql);
if(infolist!=null && infolist.size()>0){
String info = infolist.get(0);
logger.info("[查询结果:]"+info);
String[] infos = info.split("_@",-1);
if(infos[3]!=null){
if(infos[3].equals(Constants.CHANNEL_INFO_00)){
Outmsgcontent outMSGContent = new Outmsgcontent();
outMSGContent.setAUTHORIZECODE(authorize_code);
outMSGContent.setCHANNELSTATUS(infos[3]);
outMSGContent.setCHANNELNAME(infos[0]);
outMSGContent.setCHANNELADDRESS(infos[1]);
out.setOutMSGContent(outMSGContent);
out.setRSPCODE(Constants.CHANNEL_INFO_0000);
}else if(infos[3].equals(Constants.CHANNEL_INFO_01)){
Outmsgcontent outMSGContent = new Outmsgcontent();
outMSGContent.setAUTHORIZECODE(authorize_code);
outMSGContent.setCHANNELSTATUS(infos[3]);
out.setOutMSGContent(outMSGContent);
out.setRSPCODE(Constants.CHANNEL_INFO_0000);
}else if(infos[3].equals(Constants.CHANNEL_INFO_02)){
Outmsgcontent outMSGContent = new Outmsgcontent();
outMSGContent.setAUTHORIZECODE(authorize_code);
outMSGContent.setCHANNELSTATUS(infos[3]);
out.setOutMSGContent(outMSGContent);
out.setRSPCODE(Constants.CHANNEL_INFO_0000);
}else{
Outmsgcontent outMSGContent = new Outmsgcontent();
outMSGContent.setAUTHORIZECODE(authorize_code);
outMSGContent.setCHANNELSTATUS(infos[3]);
out.setOutMSGContent(outMSGContent);
out.setRSPCODE(Constants.CHANNEL_INFO_0000);
}
}else{
throw new Exception("查询的数据异常:"+info);
}
}else{
Outmsgcontent outMSGContent = new Outmsgcontent();
outMSGContent.setAUTHORIZECODE(authorize_code);
outMSGContent.setCHANNELSTATUS(Constants.CHANNEL_INFO_02);
out.setOutMSGContent(outMSGContent);
out.setRSPCODE(Constants.CHANNEL_INFO_0000);
}
return out;
}
private List<String> query(String sql) throws Exception{
Connection conn = null;
PreparedStatement preStm = null;
ResultSet rs = null;
List<String> list = null;
logger.info("[执行sql:]"+sql);
try{
conn = ServiceManager.getSession().getConnection();
preStm = conn.prepareStatement(sql);
rs = preStm.executeQuery();
list = new ArrayList<String>();
while (rs.next()) {
String info = rs.getString(1);
list.add(info);
}
}catch(SQLException e){
e.printStackTrace();
throw new SQLException();
}finally{
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(preStm!=null){
try {
preStm.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(conn!=null){
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return list;
}
}
<file_sep>package com.ai.uchintService.server.agentchargeinfosyncser;
import com.ai.appframe2.subtable.function.ISubTableFunction;
public class AgentChargeInfoSyncSubTable implements ISubTableFunction {
@Override
public String convert(Object arg0) throws Exception {
String dateStr = (String)arg0;
String month = dateStr.substring(0,6);
return month;
}
}
<file_sep>package com.ai.uchintService.server.ecipinquirychannelinfo;
import java.util.HashMap;
import com.ai.appframe2.multicenter.CenterFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.busi.service.interfaces.IInquiryChannelInfoSrv;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IRecIfBase;
import com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrvIN;
import com.unicom.ecip.inquirychannelinfosrv.InquiryChannelInfoSrvOUT;
public class InquiryChannelInfoAction implements IRecIfBase {
@Override
public HashMap<String, Object> recIfProcessor(Object ifMsg,
UipOperateBean ifBean, Long logId) {
InquiryChannelInfoSrvOUT retObj = null;
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
CenterFactory.pushCenterInfo(Constants.DATASOURCE_CENTER,"99");
retObj = (InquiryChannelInfoSrvOUT)getService().inquiryChannelInfo((InquiryChannelInfoSrvIN)ifMsg);
} catch (Exception e) {
retObj = new InquiryChannelInfoSrvOUT();
retObj.setRSPCODE(Constants.CHANNEL_INFO_9999);
retObj.setOutMSGContent(null);
obj.put("resultCode",Constants.MapResultCode.CODE_FORMAT_ERROR);// 给接口框架返回的代码
obj.put("resultMsg", e.getMessage());
obj.put("retObj", retObj);
e.printStackTrace();
return obj;
}
obj.put(Constants.MapResult.MAP_RESULTCODE,Constants.MapResultCode.CODE_SUCCESSFUL);
obj.put(Constants.MapResult.MAP_RESULTMSG, "查询渠道信息成功");
obj.put(Constants.MapResult.MAP_RESULTOBJ, retObj);
return obj;
}
private IInquiryChannelInfoSrv getService() {
return (IInquiryChannelInfoSrv) ServiceFactory
.getService(IInquiryChannelInfoSrv.class);
}
@Override
public HashMap<String, Object> recIfRetMsgGen(Object ifMsg,
UipOperateBean ifBean, Long logId) {
// TODO Auto-generated method stub
return null;
}
}
<file_sep>
package cn.chinaunicom.ws.ordser.unibssbody;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.ordser.unibssbody package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.ordser.unibssbody
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ORDERCHG_INPUT }
*
*/
public ORDERCHG_INPUT createORDERCHG_INPUT() {
return new ORDERCHG_INPUT();
}
/**
* Create an instance of {@link ORDERSUB_INPUT }
*
*/
public ORDERSUB_INPUT createORDERSUB_INPUT() {
return new ORDERSUB_INPUT();
}
/**
* Create an instance of {@link ORDERCHG_OUTPUT }
*
*/
public ORDERCHG_OUTPUT createORDERCHG_OUTPUT() {
return new ORDERCHG_OUTPUT();
}
/**
* Create an instance of {@link ORDERSUB_OUTPUT }
*
*/
public ORDERSUB_OUTPUT createORDERSUB_OUTPUT() {
return new ORDERSUB_OUTPUT();
}
/**
* Create an instance of {@link ORDER_CHK_OUTPUT }
*
*/
public ORDER_CHK_OUTPUT createORDER_CHK_OUTPUT() {
return new ORDER_CHK_OUTPUT();
}
/**
* Create an instance of {@link ORD_STAT_QRY_OUTPUT }
*
*/
public ORD_STAT_QRY_OUTPUT createORD_STAT_QRY_OUTPUT() {
return new ORD_STAT_QRY_OUTPUT();
}
/**
* Create an instance of {@link ORD_STAT_QRY_INPUT }
*
*/
public ORD_STAT_QRY_INPUT createORD_STAT_QRY_INPUT() {
return new ORD_STAT_QRY_INPUT();
}
/**
* Create an instance of {@link ORDER_CHK_INPUT }
*
*/
public ORDER_CHK_INPUT createORDER_CHK_INPUT() {
return new ORDER_CHK_INPUT();
}
/**
* Create an instance of {@link ORDERCHG_INPUT.UNI_BSS_BODY }
*
*/
public ORDERCHG_INPUT.UNI_BSS_BODY createORDERCHG_INPUTUNI_BSS_BODY() {
return new ORDERCHG_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORDERSUB_INPUT.UNI_BSS_BODY }
*
*/
public ORDERSUB_INPUT.UNI_BSS_BODY createORDERSUB_INPUTUNI_BSS_BODY() {
return new ORDERSUB_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORDERCHG_OUTPUT.UNI_BSS_BODY }
*
*/
public ORDERCHG_OUTPUT.UNI_BSS_BODY createORDERCHG_OUTPUTUNI_BSS_BODY() {
return new ORDERCHG_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORDERSUB_OUTPUT.UNI_BSS_BODY }
*
*/
public ORDERSUB_OUTPUT.UNI_BSS_BODY createORDERSUB_OUTPUTUNI_BSS_BODY() {
return new ORDERSUB_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORDER_CHK_OUTPUT.UNI_BSS_BODY }
*
*/
public ORDER_CHK_OUTPUT.UNI_BSS_BODY createORDER_CHK_OUTPUTUNI_BSS_BODY() {
return new ORDER_CHK_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORD_STAT_QRY_OUTPUT.UNI_BSS_BODY }
*
*/
public ORD_STAT_QRY_OUTPUT.UNI_BSS_BODY createORD_STAT_QRY_OUTPUTUNI_BSS_BODY() {
return new ORD_STAT_QRY_OUTPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORD_STAT_QRY_INPUT.UNI_BSS_BODY }
*
*/
public ORD_STAT_QRY_INPUT.UNI_BSS_BODY createORD_STAT_QRY_INPUTUNI_BSS_BODY() {
return new ORD_STAT_QRY_INPUT.UNI_BSS_BODY();
}
/**
* Create an instance of {@link ORDER_CHK_INPUT.UNI_BSS_BODY }
*
*/
public ORDER_CHK_INPUT.UNI_BSS_BODY createORDER_CHK_INPUTUNI_BSS_BODY() {
return new ORDER_CHK_INPUT.UNI_BSS_BODY();
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.ai.uchintService.common.util.BucUtil;
import com.ai.uchintService.common.util.Constants;
/**
* This class was generated by Apache CXF 2.3.5
* 2011-11-18T10:25:54.406+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "SB_EAS_EAS_InquiryEASAuditInfoSrv",
portName = "SB_EAS_EAS_InquiryEASAuditInfoSrvPort",
targetNamespace = "http://mss.unicom.com/SB_EAS_EAS_InquiryEASAuditInfoSrv",
// wsdlLocation = "file:/D:/data/mywork/uip_UCH_INT/wsdl/SB_EAS_EAS_InquiryEASAuditInfoSrv/SB_EAS_EAS_InquiryEASAuditInfoSrv.wsdl",
endpointInterface = "com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SBEASEASInquiryEASAuditInfoSrv")
public class SBEASEASInquiryEASAuditInfoSrvImpl implements SBEASEASInquiryEASAuditInfoSrv {
private static final Logger LOG = Logger.getLogger(SBEASEASInquiryEASAuditInfoSrvImpl.class.getName());
/* (non-Javadoc)
* @see com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SBEASEASInquiryEASAuditInfoSrv#process(com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvRequest payload )*
*/
public com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvResponse process(SB_EAS_EAS_InquiryEASAuditInfoSrvRequest payload) {
LOG.info("Executing operation process");
System.out.println(payload);
try {
com.unicom.mss.sb_eas_eas_inquiryeasauditinfosrv.SB_EAS_EAS_InquiryEASAuditInfoSrvResponse _return = new SB_EAS_EAS_InquiryEASAuditInfoSrvResponse();
_return.setCURRENT_PAGE(BigDecimal.valueOf(1));
_return.setINSTANCE_ID(BigDecimal.valueOf(1111111));
_return.setPAGE_SIZE(BigDecimal.valueOf(200));
_return.setSERVICE_MESSAGE("111");
_return.setSERVICE_FLAG("TRUE");
_return.setTOTAL_PAGE(BigDecimal.valueOf(1));
_return.setTOTAL_RECORD(BigDecimal.valueOf(1000));
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection cc= new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection();
List<SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem> list =new ArrayList<SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem>();
// for(int i=0;i<5;i++){
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem aa = new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
aa.setAPPROVED_STATUS(BigDecimal.valueOf(1));
aa.setBILL_NO("1603");
aa.setLAST_UPDATE_DATE(new Date());
aa.setEAS_RECEIPT_NUMBER("3333");
// String proviceCode2 = BucUtil.getCfgCodeDesc( Constants.CFG_CODE_TRANS_SOA_AREA,"11");
aa.setPROVINCE_CODE("33");
// aa.setAPPROVED_STATUS(value)
list.add(aa);
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem aa2 = new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
aa2.setAPPROVED_STATUS(BigDecimal.valueOf(1));
aa2.setBILL_NO("1602");
aa2.setLAST_UPDATE_DATE(new Date());
aa2.setEAS_RECEIPT_NUMBER("3333");
aa2.setPROVINCE_CODE("33");
list.add(aa2);
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem aa3 = new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
aa3.setAPPROVED_STATUS(BigDecimal.valueOf(1));
aa3.setBILL_NO("1601");
aa3.setLAST_UPDATE_DATE(new Date());
aa3.setEAS_RECEIPT_NUMBER("3333");
aa3.setPROVINCE_CODE("33");
list.add(aa3);
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem aa4 = new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
aa4.setAPPROVED_STATUS(BigDecimal.valueOf(2));
aa4.setBILL_NO("1584");
aa4.setLAST_UPDATE_DATE(new Date());
aa4.setEAS_RECEIPT_NUMBER("3333");
aa4.setPROVINCE_CODE("33");
list.add(aa4);
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem aa5 = new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
aa5.setAPPROVED_STATUS(BigDecimal.valueOf(2));
aa5.setBILL_NO("1583");
aa5.setLAST_UPDATE_DATE(new Date());
aa5.setEAS_RECEIPT_NUMBER("3333");
aa5.setPROVINCE_CODE("33");
list.add(aa5);
SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem aa6 = new SB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem();
aa6.setAPPROVED_STATUS(BigDecimal.valueOf(2));
aa6.setBILL_NO("1582");
aa6.setLAST_UPDATE_DATE(new Date());
aa6.setEAS_RECEIPT_NUMBER("3333");
aa6.setPROVINCE_CODE("33");
list.add(aa6);
// }
cc.setSB_EAS_EAS_InquiryEASAuditInfoSrvOutputItem(list);
_return.setSB_EAS_EAS_InquiryEASAuditInfoSrvOutputCollection(cc);
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>
package com.unicom.wouchannel.inquiryagentauditinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for InquiryAgentAuditInfoSrvOUT complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="InquiryAgentAuditInfoSrvOUT">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RSPCODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ERRORCOLLECTION" type="{http://wouchannel.unicom.com/InquiryAgentAuditInfoSrv}ErrorCOLLECTION"/>
* <element name="RESPONSECOLLECTION" type="{http://wouchannel.unicom.com/InquiryAgentAuditInfoSrv}ResponseCOLLECTION"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InquiryAgentAuditInfoSrvOUT", propOrder = {
"rspcode",
"errorcollection",
"responsecollection"
})
public class InquiryAgentAuditInfoSrvOUT {
@XmlElement(name = "RSPCODE", required = true)
protected String rspcode;
@XmlElement(name = "ERRORCOLLECTION", required = true)
protected ErrorCOLLECTION errorcollection;
@XmlElement(name = "RESPONSECOLLECTION", required = true)
protected ResponseCOLLECTION responsecollection;
/**
* Gets the value of the rspcode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRSPCODE() {
return rspcode;
}
/**
* Sets the value of the rspcode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRSPCODE(String value) {
this.rspcode = value;
}
/**
* Gets the value of the errorcollection property.
*
* @return
* possible object is
* {@link ErrorCOLLECTION }
*
*/
public ErrorCOLLECTION getERRORCOLLECTION() {
return errorcollection;
}
/**
* Sets the value of the errorcollection property.
*
* @param value
* allowed object is
* {@link ErrorCOLLECTION }
*
*/
public void setERRORCOLLECTION(ErrorCOLLECTION value) {
this.errorcollection = value;
}
/**
* Gets the value of the responsecollection property.
*
* @return
* possible object is
* {@link ResponseCOLLECTION }
*
*/
public ResponseCOLLECTION getRESPONSECOLLECTION() {
return responsecollection;
}
/**
* Sets the value of the responsecollection property.
*
* @param value
* allowed object is
* {@link ResponseCOLLECTION }
*
*/
public void setRESPONSECOLLECTION(ResponseCOLLECTION value) {
this.responsecollection = value;
}
}
<file_sep>package com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2011-11-18T10:22:44.859+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://mss.unicom.com/SB_UC_UC_ImportPaymentResultInfoSrv", name = "SB_UC_UC_ImportPaymentResultInfoSrv")
@XmlSeeAlso({ObjectFactory.class, com.unicom.mss.soa.msgheader.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SBUCUCImportPaymentResultInfoSrv {
@WebResult(name = "SB_UC_UC_ImportPaymentResultInfoSrvResponse", targetNamespace = "http://mss.unicom.com/SB_UC_UC_ImportPaymentResultInfoSrv", partName = "payload")
@WebMethod(action = "process")
public SB_UC_UC_ImportPaymentResultInfoSrvResponse process(
@WebParam(partName = "payload", name = "SB_UC_UC_ImportPaymentResultInfoSrvRequest", targetNamespace = "http://mss.unicom.com/SB_UC_UC_ImportPaymentResultInfoSrv")
SB_UC_UC_ImportPaymentResultInfoSrvRequest payload
);
}
<file_sep>
package com.unicom.mss.sb_eas_eas_importamountinfosrv;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for SB_EAS_EAS_ImportAmountInfoSrvInputItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SB_EAS_EAS_ImportAmountInfoSrvInputItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PRI_KEY" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BATCH_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="HEADER_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="SOURCE_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PROVINCE_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="CITY_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BUSI_TYPE" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="INI_TOTAL_AMOUNT" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="CURRENCY_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PAY_TYPE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BILL_NO" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="OPERATE_TYPE" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="PAYER_EMAIL" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="TOTAL_LINE_QTY" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_6" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_7" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_8" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_9" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_10" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_11" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_12" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_13" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_14" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_15" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="AMOUNT_LINE_INFO" type="{http://mss.unicom.com/SB_EAS_EAS_ImportAmountInfoSrv}AMOUNT_LINE_INFOCollection"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SB_EAS_EAS_ImportAmountInfoSrvInputItem", propOrder = {
"priKEY",
"batchID",
"headerID",
"sourceNAME",
"provinceCODE",
"cityCODE",
"busiTYPE",
"iniTOTALAMOUNT",
"currencyCODE",
"payTYPE",
"billNO",
"operateTYPE",
"payerEMAIL",
"totalLINEQTY",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5",
"reserved6",
"reserved7",
"reserved8",
"reserved9",
"reserved10",
"reserved11",
"reserved12",
"reserved13",
"reserved14",
"reserved15",
"amountLINEINFO"
})
public class SB_EAS_EAS_ImportAmountInfoSrvInputItem {
@XmlElement(name = "PRI_KEY", required = true, nillable = true)
protected String priKEY;
@XmlElement(name = "BATCH_ID", required = true, nillable = true)
protected String batchID;
@XmlElement(name = "HEADER_ID", required = true, nillable = true)
protected String headerID;
@XmlElement(name = "SOURCE_NAME", required = true, nillable = true)
protected String sourceNAME;
@XmlElement(name = "PROVINCE_CODE", required = true, nillable = true)
protected String provinceCODE;
@XmlElement(name = "CITY_CODE", required = true, nillable = true)
protected String cityCODE;
@XmlElement(name = "BUSI_TYPE", required = true, nillable = true)
protected BigDecimal busiTYPE;
@XmlElement(name = "INI_TOTAL_AMOUNT", required = true, nillable = true)
protected BigDecimal iniTOTALAMOUNT;
@XmlElement(name = "CURRENCY_CODE", required = true, nillable = true)
protected String currencyCODE;
@XmlElement(name = "PAY_TYPE", required = true, nillable = true)
protected String payTYPE;
@XmlElement(name = "BILL_NO", required = true, nillable = true)
protected String billNO;
@XmlElement(name = "OPERATE_TYPE", required = true, nillable = true)
protected BigDecimal operateTYPE;
@XmlElement(name = "PAYER_EMAIL", required = true, nillable = true)
protected String payerEMAIL;
@XmlElement(name = "TOTAL_LINE_QTY", required = true, nillable = true)
protected BigDecimal totalLINEQTY;
@XmlElement(name = "RESERVED_1", required = true, nillable = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true, nillable = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true, nillable = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true, nillable = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true, nillable = true)
protected String reserved5;
@XmlElement(name = "RESERVED_6", required = true, nillable = true)
protected String reserved6;
@XmlElement(name = "RESERVED_7", required = true, nillable = true)
protected String reserved7;
@XmlElement(name = "RESERVED_8", required = true, nillable = true)
protected String reserved8;
@XmlElement(name = "RESERVED_9", required = true, nillable = true)
protected String reserved9;
@XmlElement(name = "RESERVED_10", required = true, nillable = true)
protected String reserved10;
@XmlElement(name = "RESERVED_11", required = true, nillable = true)
protected String reserved11;
@XmlElement(name = "RESERVED_12", required = true, nillable = true)
protected String reserved12;
@XmlElement(name = "RESERVED_13", required = true, nillable = true)
protected String reserved13;
@XmlElement(name = "RESERVED_14", required = true, nillable = true)
protected String reserved14;
@XmlElement(name = "RESERVED_15", required = true, nillable = true)
protected String reserved15;
@XmlElement(name = "AMOUNT_LINE_INFO", required = true, nillable = true)
protected AMOUNT_LINE_INFOCollection amountLINEINFO;
/**
* Gets the value of the pri_KEY property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPRI_KEY() {
return priKEY;
}
/**
* Sets the value of the pri_KEY property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPRI_KEY(String value) {
this.priKEY = value;
}
/**
* Gets the value of the batch_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_ID() {
return batchID;
}
/**
* Sets the value of the batch_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_ID(String value) {
this.batchID = value;
}
/**
* Gets the value of the header_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHEADER_ID() {
return headerID;
}
/**
* Sets the value of the header_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHEADER_ID(String value) {
this.headerID = value;
}
/**
* Gets the value of the source_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSOURCE_NAME() {
return sourceNAME;
}
/**
* Sets the value of the source_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSOURCE_NAME(String value) {
this.sourceNAME = value;
}
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the city_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCITY_CODE() {
return cityCODE;
}
/**
* Sets the value of the city_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCITY_CODE(String value) {
this.cityCODE = value;
}
/**
* Gets the value of the busi_TYPE property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getBUSI_TYPE() {
return busiTYPE;
}
/**
* Sets the value of the busi_TYPE property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setBUSI_TYPE(BigDecimal value) {
this.busiTYPE = value;
}
/**
* Gets the value of the ini_TOTAL_AMOUNT property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getINI_TOTAL_AMOUNT() {
return iniTOTALAMOUNT;
}
/**
* Sets the value of the ini_TOTAL_AMOUNT property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setINI_TOTAL_AMOUNT(BigDecimal value) {
this.iniTOTALAMOUNT = value;
}
/**
* Gets the value of the currency_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCURRENCY_CODE() {
return currencyCODE;
}
/**
* Sets the value of the currency_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCURRENCY_CODE(String value) {
this.currencyCODE = value;
}
/**
* Gets the value of the pay_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_TYPE() {
return payTYPE;
}
/**
* Sets the value of the pay_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_TYPE(String value) {
this.payTYPE = value;
}
/**
* Gets the value of the bill_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBILL_NO() {
return billNO;
}
/**
* Sets the value of the bill_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBILL_NO(String value) {
this.billNO = value;
}
/**
* Gets the value of the operate_TYPE property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getOPERATE_TYPE() {
return operateTYPE;
}
/**
* Sets the value of the operate_TYPE property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setOPERATE_TYPE(BigDecimal value) {
this.operateTYPE = value;
}
/**
* Gets the value of the payer_EMAIL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAYER_EMAIL() {
return payerEMAIL;
}
/**
* Sets the value of the payer_EMAIL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAYER_EMAIL(String value) {
this.payerEMAIL = value;
}
/**
* Gets the value of the total_LINE_QTY property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getTOTAL_LINE_QTY() {
return totalLINEQTY;
}
/**
* Sets the value of the total_LINE_QTY property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTOTAL_LINE_QTY(BigDecimal value) {
this.totalLINEQTY = value;
}
/**
* Gets the value of the reserved_1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_1() {
return reserved1;
}
/**
* Sets the value of the reserved_1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_1(String value) {
this.reserved1 = value;
}
/**
* Gets the value of the reserved_2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_2() {
return reserved2;
}
/**
* Sets the value of the reserved_2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_2(String value) {
this.reserved2 = value;
}
/**
* Gets the value of the reserved_3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_3() {
return reserved3;
}
/**
* Sets the value of the reserved_3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_3(String value) {
this.reserved3 = value;
}
/**
* Gets the value of the reserved_4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_4() {
return reserved4;
}
/**
* Sets the value of the reserved_4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_4(String value) {
this.reserved4 = value;
}
/**
* Gets the value of the reserved_5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_5() {
return reserved5;
}
/**
* Sets the value of the reserved_5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_5(String value) {
this.reserved5 = value;
}
/**
* Gets the value of the reserved_6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_6() {
return reserved6;
}
/**
* Sets the value of the reserved_6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_6(String value) {
this.reserved6 = value;
}
/**
* Gets the value of the reserved_7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_7() {
return reserved7;
}
/**
* Sets the value of the reserved_7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_7(String value) {
this.reserved7 = value;
}
/**
* Gets the value of the reserved_8 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_8() {
return reserved8;
}
/**
* Sets the value of the reserved_8 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_8(String value) {
this.reserved8 = value;
}
/**
* Gets the value of the reserved_9 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_9() {
return reserved9;
}
/**
* Sets the value of the reserved_9 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_9(String value) {
this.reserved9 = value;
}
/**
* Gets the value of the reserved_10 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_10() {
return reserved10;
}
/**
* Sets the value of the reserved_10 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_10(String value) {
this.reserved10 = value;
}
/**
* Gets the value of the reserved_11 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_11() {
return reserved11;
}
/**
* Sets the value of the reserved_11 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_11(String value) {
this.reserved11 = value;
}
/**
* Gets the value of the reserved_12 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_12() {
return reserved12;
}
/**
* Sets the value of the reserved_12 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_12(String value) {
this.reserved12 = value;
}
/**
* Gets the value of the reserved_13 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_13() {
return reserved13;
}
/**
* Sets the value of the reserved_13 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_13(String value) {
this.reserved13 = value;
}
/**
* Gets the value of the reserved_14 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_14() {
return reserved14;
}
/**
* Sets the value of the reserved_14 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_14(String value) {
this.reserved14 = value;
}
/**
* Gets the value of the reserved_15 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_15() {
return reserved15;
}
/**
* Sets the value of the reserved_15 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_15(String value) {
this.reserved15 = value;
}
/**
* Gets the value of the amount_LINE_INFO property.
*
* @return
* possible object is
* {@link AMOUNT_LINE_INFOCollection }
*
*/
public AMOUNT_LINE_INFOCollection getAMOUNT_LINE_INFO() {
return amountLINEINFO;
}
/**
* Sets the value of the amount_LINE_INFO property.
*
* @param value
* allowed object is
* {@link AMOUNT_LINE_INFOCollection }
*
*/
public void setAMOUNT_LINE_INFO(AMOUNT_LINE_INFOCollection value) {
this.amountLINEINFO = value;
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package com.unicom.mss.sb_uc_uc_importcontractinfosrv;
import java.util.HashMap;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.recif.IRecIfProcessorSRV;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvResponse;
/**
* This class was generated by Apache CXF 2.3.5
* 2011-11-15T12:37:42.296+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "SB_UC_UC_ImportContractInfoSrv",
portName = "SB_UC_UC_ImportContractInfoSrvPort",
targetNamespace = "http://mss.unicom.com/SB_UC_UC_ImportContractInfoSrv",
wsdlLocation = "classpath:wsdl/SB_UC_UC_ImportContractInfoSrv/SB_UC_UC_ImportContractInfoSrv.wsdl",
// wsdlLocation = "file:/home/tstchit1/domains/BSSTRN_BD1CHUIP1/nodes/BD1CHUIP1_NA/instances/CUBSS_BD1CHUIP1/deployments/apps/ucint/wsdl/ImportContractInfoSrv/SB_UC_UC_ImportContractInfoSrv.wsdl",
// wsdlLocation = "file:/unibss/users/pachuip1/domains/CUBSS_BD1CHUIP1/nodes/BD1CHUIP1_NA1/instances/BD1CHUIP1_NA1I1/deployments/apps/ucint/wsdl/ImportContractInfoSrv/SB_UC_UC_ImportContractInfoSrv.wsdl",
// wsdlLocation = "file:/unibss/users/pachuip1/domains/CUBSS_BD1CHUIP1/nodes/BD1CHUIP1_NA2/instances/BD1CHUIP1_NA2I1/deployments/apps/ucint1/wsdl/ImportContractInfoSrv/SB_UC_UC_ImportContractInfoSrv.wsdl",
endpointInterface = "com.unicom.mss.sb_uc_uc_importcontractinfosrv.SBUCUCImportContractInfoSrv")
public class SBUCUCImportContractInfoSrvImpl implements SBUCUCImportContractInfoSrv {
private static final Logger LOG = Logger.getLogger(SBUCUCImportContractInfoSrvImpl.class.getName());
/* (non-Javadoc)
* @see com.unicom.mss.sb_uc_uc_importcontractinfosrv.SBUCUCImportContractInfoSrv#process(com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvRequest payload )*
*/
public com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvResponse process(SB_UC_UC_ImportContractInfoSrvRequest payload) {
LOG.info("Executing operation process");
System.out.println(payload);
try {
IRecIfProcessorSRV recIfProcessorSRV = (IRecIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.SB_UC_UC_ImportContracInfoSrv, payload);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
com.unicom.mss.sb_uc_uc_importcontractinfosrv.SB_UC_UC_ImportContractInfoSrvResponse _return = (SB_UC_UC_ImportContractInfoSrvResponse)map.get(Constants.MapResult.MAP_RESULTOBJ);;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_CHL_AGENT_OPERATION_LOGValue;
public class TF_CHL_AGENT_OPERATION_LOGBean extends DataContainer implements DataContainerInterface,ITF_CHL_AGENT_OPERATION_LOGValue{
private static String m_boName = "bo.TF_CHL_AGENT_OPERATION_LOG";
public final static String S_State = "STATE";
public final static String S_OrderId = "ORDER_ID";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_CreateStaffId = "CREATE_STAFF_ID";
public final static String S_BusiOper = "BUSI_OPER";
public final static String S_UpdateTime = "UPDATE_TIME";
public final static String S_AgentId = "AGENT_ID";
public final static String S_UpdateStaffId = "UPDATE_STAFF_ID";
public final static String S_Rmk = "RMK";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_CHL_AGENT_OPERATION_LOGBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
//此种数据容器不能重置业务对象类型
throw new AIException("Cannot reset ObjectType");
}
public void initState(String value){
this.initProperty(S_State,value);
}
public void setState(String value){
this.set(S_State,value);
}
public void setStateNull(){
this.set(S_State,null);
}
public String getState(){
return DataType.getAsString(this.get(S_State));
}
public String getStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_State));
}
public void initOrderId(long value){
this.initProperty(S_OrderId,new Long(value));
}
public void setOrderId(long value){
this.set(S_OrderId,new Long(value));
}
public void setOrderIdNull(){
this.set(S_OrderId,null);
}
public long getOrderId(){
return DataType.getAsLong(this.get(S_OrderId));
}
public long getOrderIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_OrderId));
}
public void initCreateTime(Timestamp value){
this.initProperty(S_CreateTime,value);
}
public void setCreateTime(Timestamp value){
this.set(S_CreateTime,value);
}
public void setCreateTimeNull(){
this.set(S_CreateTime,null);
}
public Timestamp getCreateTime(){
return DataType.getAsDateTime(this.get(S_CreateTime));
}
public Timestamp getCreateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_CreateTime));
}
public void initCreateStaffId(String value){
this.initProperty(S_CreateStaffId,value);
}
public void setCreateStaffId(String value){
this.set(S_CreateStaffId,value);
}
public void setCreateStaffIdNull(){
this.set(S_CreateStaffId,null);
}
public String getCreateStaffId(){
return DataType.getAsString(this.get(S_CreateStaffId));
}
public String getCreateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_CreateStaffId));
}
public void initBusiOper(String value){
this.initProperty(S_BusiOper,value);
}
public void setBusiOper(String value){
this.set(S_BusiOper,value);
}
public void setBusiOperNull(){
this.set(S_BusiOper,null);
}
public String getBusiOper(){
return DataType.getAsString(this.get(S_BusiOper));
}
public String getBusiOperInitialValue(){
return DataType.getAsString(this.getOldObj(S_BusiOper));
}
public void initUpdateTime(Timestamp value){
this.initProperty(S_UpdateTime,value);
}
public void setUpdateTime(Timestamp value){
this.set(S_UpdateTime,value);
}
public void setUpdateTimeNull(){
this.set(S_UpdateTime,null);
}
public Timestamp getUpdateTime(){
return DataType.getAsDateTime(this.get(S_UpdateTime));
}
public Timestamp getUpdateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_UpdateTime));
}
public void initAgentId(long value){
this.initProperty(S_AgentId,new Long(value));
}
public void setAgentId(long value){
this.set(S_AgentId,new Long(value));
}
public void setAgentIdNull(){
this.set(S_AgentId,null);
}
public long getAgentId(){
return DataType.getAsLong(this.get(S_AgentId));
}
public long getAgentIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_AgentId));
}
public void initUpdateStaffId(String value){
this.initProperty(S_UpdateStaffId,value);
}
public void setUpdateStaffId(String value){
this.set(S_UpdateStaffId,value);
}
public void setUpdateStaffIdNull(){
this.set(S_UpdateStaffId,null);
}
public String getUpdateStaffId(){
return DataType.getAsString(this.get(S_UpdateStaffId));
}
public String getUpdateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateStaffId));
}
public void initRmk(String value){
this.initProperty(S_Rmk,value);
}
public void setRmk(String value){
this.set(S_Rmk,value);
}
public void setRmkNull(){
this.set(S_Rmk,null);
}
public String getRmk(){
return DataType.getAsString(this.get(S_Rmk));
}
public String getRmkInitialValue(){
return DataType.getAsString(this.getOldObj(S_Rmk));
}
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.util;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import com.ai.uint.util.UIFException;
public class QZDataBusiUtil {
public static void initMethod(Class clazz, Map<String, Method> getValueMethodMap)
{
Field[] fields = clazz.getFields();
if (fields != null && fields.length > 0)
{
for(Field field:fields)
{
if (field.getName() != null)
{
Method[] methods = clazz.getMethods();
if (methods != null && methods.length > 0)
{
for(Method method:methods)
{
if (method.getName().equals("get"+field.getName().substring(0, 1).toUpperCase()+field.getName().substring(1)))
{
getValueMethodMap.put(field.getName(), method);
break;
}
}
}
}
}
}
}
public static String checkData(Object vo, Map<String, Method> getValueMethodMap) throws UIFException
{
Field[] fields = vo.getClass().getFields();
if (fields != null && fields.length > 0)
{
for(Field field:fields)
{
if (getValueMethodMap.containsKey(field.getName()))
{
String value = null;
try
{
value = (String)getValueMethodMap.get(field.getName()).invoke(vo);
}
catch(IllegalAccessException e)
{
e.printStackTrace();
throw new UIFException("字段["+field.getName()+"]取值失败:"+e.getMessage());
}
catch(IllegalArgumentException e)
{
e.printStackTrace();
throw new UIFException("字段["+field.getName()+"]取值失败:"+e.getMessage());
}
catch(InvocationTargetException e)
{
e.printStackTrace();
throw new UIFException("字段["+field.getName()+"]取值失败:"+e.getMessage());
}
ColumnDefAnnotation columnDefAnnotation = field.getAnnotation(ColumnDefAnnotation.class);
if (columnDefAnnotation != null)
{
if(columnDefAnnotation.isMust().toUpperCase().equals("Y"))
{
if (value == null || value.equals("")) return columnDefAnnotation.columnName()+"字段为空";
}
if(columnDefAnnotation.columnLength() > 0)
{
if (value != null && value.length() > columnDefAnnotation.columnLength())
return columnDefAnnotation.columnName()+"字段["+value+"]长度超过"+columnDefAnnotation.columnLength();
}
if(columnDefAnnotation.defaultValue() != null && !columnDefAnnotation.defaultValue().equals(""))
{
String[] defaultValues = columnDefAnnotation.defaultValue().split(",");
boolean isDefault = false;
if(defaultValues != null && defaultValues.length >0)
{
for(String defaultValue:defaultValues)
{
if(defaultValue.equals(value))
{
isDefault = true;
break;
}
}
}
if(!isDefault) return columnDefAnnotation.columnName()+"字段["+value+"]取值错误";
}
}
else
{
throw new UIFException("无Field["+field.getName()+"]对应的注解");
}
}
else
{
throw new UIFException("无Field["+field.getName()+"]对应的get方法");
}
}
}
else
{
throw new UIFException("Field为空");
}
return "";
}
}
<file_sep>package com.ai.uip.core.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IUipServiceHttpValue extends DataStructInterface{
public final static String S_HttpBody = "HTTP_BODY";
public final static String S_Connecttimeout = "CONNECTTIMEOUT";
public final static String S_ServiceDesc = "SERVICE_DESC";
public final static String S_Readtimeout = "READTIMEOUT";
public final static String S_HttpHeader = "HTTP_HEADER";
public final static String S_ServiceUrl = "SERVICE_URL";
public final static String S_Status = "STATUS";
public final static String S_ServiceName = "SERVICE_NAME";
public final static String S_ServiceId = "SERVICE_ID";
public String getHttpBody();
public Long getConnecttimeoutAsLong();
public long getConnecttimeout();
public String getServiceDesc();
public Long getReadtimeoutAsLong();
public long getReadtimeout();
public String getHttpHeader();
public String getServiceUrl();
public Integer getStatusAsInteger();
public int getStatus();
public String getServiceName();
public Long getServiceIdAsLong();
public long getServiceId();
public void setHttpBody(String value);
public void setConnecttimeout(Long value);
public void setConnecttimeout(long value);
public void setServiceDesc(String value);
public void setReadtimeout(Long value);
public void setReadtimeout(long value);
public void setHttpHeader(String value);
public void setServiceUrl(String value);
public void setStatus(Integer value);
public void setStatus(int value);
public void setServiceName(String value);
public void setServiceId(Long value);
public void setServiceId(long value);
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IINT_AREA_CODEValue;
public class INT_AREA_CODEBean extends DataContainer implements DataContainerInterface,IINT_AREA_CODEValue{
private static String m_boName = "bo.INT_AREA_CODE";
public final static String S_ChlAreaCode = "CHL_AREA_CODE";
public final static String S_ErpPaAreaCode = "ERP_PA_AREA_CODE";
public final static String S_TradeCode = "TRADE_CODE";
public final static String S_ErpAreaLevel = "ERP_AREA_LEVEL";
public final static String S_ChlAreaLevel = "CHL_AREA_LEVEL";
public final static String S_RelationFlag = "RELATION_FLAG";
public final static String S_ChlPaAreaCode = "CHL_PA_AREA_CODE";
public final static String S_ErpAreaCode = "ERP_AREA_CODE";
public final static String S_ErpAreaName = "ERP_AREA_NAME";
public final static String S_ChlAreaName = "CHL_AREA_NAME";
public final static String S_ErpCompanyCode = "ERP_COMPANY_CODE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public INT_AREA_CODEBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initChlAreaCode(String value){
this.initProperty(S_ChlAreaCode,value);
}
public void setChlAreaCode(String value){
this.set(S_ChlAreaCode,value);
}
public void setChlAreaCodeNull(){
this.set(S_ChlAreaCode,null);
}
public String getChlAreaCode(){
return DataType.getAsString(this.get(S_ChlAreaCode));
}
public String getChlAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlAreaCode));
}
public void initErpPaAreaCode(String value){
this.initProperty(S_ErpPaAreaCode,value);
}
public void setErpPaAreaCode(String value){
this.set(S_ErpPaAreaCode,value);
}
public void setErpPaAreaCodeNull(){
this.set(S_ErpPaAreaCode,null);
}
public String getErpPaAreaCode(){
return DataType.getAsString(this.get(S_ErpPaAreaCode));
}
public String getErpPaAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpPaAreaCode));
}
public void initTradeCode(String value){
this.initProperty(S_TradeCode,value);
}
public void setTradeCode(String value){
this.set(S_TradeCode,value);
}
public void setTradeCodeNull(){
this.set(S_TradeCode,null);
}
public String getTradeCode(){
return DataType.getAsString(this.get(S_TradeCode));
}
public String getTradeCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TradeCode));
}
public void initErpAreaLevel(String value){
this.initProperty(S_ErpAreaLevel,value);
}
public void setErpAreaLevel(String value){
this.set(S_ErpAreaLevel,value);
}
public void setErpAreaLevelNull(){
this.set(S_ErpAreaLevel,null);
}
public String getErpAreaLevel(){
return DataType.getAsString(this.get(S_ErpAreaLevel));
}
public String getErpAreaLevelInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpAreaLevel));
}
public void initChlAreaLevel(String value){
this.initProperty(S_ChlAreaLevel,value);
}
public void setChlAreaLevel(String value){
this.set(S_ChlAreaLevel,value);
}
public void setChlAreaLevelNull(){
this.set(S_ChlAreaLevel,null);
}
public String getChlAreaLevel(){
return DataType.getAsString(this.get(S_ChlAreaLevel));
}
public String getChlAreaLevelInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlAreaLevel));
}
public void initRelationFlag(String value){
this.initProperty(S_RelationFlag,value);
}
public void setRelationFlag(String value){
this.set(S_RelationFlag,value);
}
public void setRelationFlagNull(){
this.set(S_RelationFlag,null);
}
public String getRelationFlag(){
return DataType.getAsString(this.get(S_RelationFlag));
}
public String getRelationFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_RelationFlag));
}
public void initChlPaAreaCode(String value){
this.initProperty(S_ChlPaAreaCode,value);
}
public void setChlPaAreaCode(String value){
this.set(S_ChlPaAreaCode,value);
}
public void setChlPaAreaCodeNull(){
this.set(S_ChlPaAreaCode,null);
}
public String getChlPaAreaCode(){
return DataType.getAsString(this.get(S_ChlPaAreaCode));
}
public String getChlPaAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlPaAreaCode));
}
public void initErpAreaCode(String value){
this.initProperty(S_ErpAreaCode,value);
}
public void setErpAreaCode(String value){
this.set(S_ErpAreaCode,value);
}
public void setErpAreaCodeNull(){
this.set(S_ErpAreaCode,null);
}
public String getErpAreaCode(){
return DataType.getAsString(this.get(S_ErpAreaCode));
}
public String getErpAreaCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpAreaCode));
}
public void initErpAreaName(String value){
this.initProperty(S_ErpAreaName,value);
}
public void setErpAreaName(String value){
this.set(S_ErpAreaName,value);
}
public void setErpAreaNameNull(){
this.set(S_ErpAreaName,null);
}
public String getErpAreaName(){
return DataType.getAsString(this.get(S_ErpAreaName));
}
public String getErpAreaNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpAreaName));
}
public void initChlAreaName(String value){
this.initProperty(S_ChlAreaName,value);
}
public void setChlAreaName(String value){
this.set(S_ChlAreaName,value);
}
public void setChlAreaNameNull(){
this.set(S_ChlAreaName,null);
}
public String getChlAreaName(){
return DataType.getAsString(this.get(S_ChlAreaName));
}
public String getChlAreaNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlAreaName));
}
public void initErpCompanyCode(String value){
this.initProperty(S_ErpCompanyCode,value);
}
public void setErpCompanyCode(String value){
this.set(S_ErpCompanyCode,value);
}
public void setErpCompanyCodeNull(){
this.set(S_ErpCompanyCode,null);
}
public String getErpCompanyCode(){
return DataType.getAsString(this.get(S_ErpCompanyCode));
}
public String getErpCompanyCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpCompanyCode));
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_CHL_AGENT_ORDERValue;
public class TF_CHL_AGENT_ORDERBean extends DataContainer implements DataContainerInterface,ITF_CHL_AGENT_ORDERValue{
private static String m_boName = "bo.TF_CHL_AGENT_ORDER";
public final static String S_AgentNameEn = "AGENT_NAME_EN";
public final static String S_ManagerAreaName = "MANAGER_AREA_NAME";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_ParentAgentId = "PARENT_AGENT_ID";
public final static String S_LicenseCodeEnd = "LICENSE_CODE_END";
public final static String S_Remark = "REMARK";
public final static String S_LicenseCodeStart = "LICENSE_CODE_START";
public final static String S_FaxNumber = "FAX_NUMBER";
public final static String S_LinkmanPhone = "LINKMAN_PHONE";
public final static String S_ChnlFunds = "CHNL_FUNDS";
public final static String S_AgentType = "AGENT_TYPE";
public final static String S_JuriPerson = "JURI_PERSON";
public final static String S_UpdateDepartId = "UPDATE_DEPART_ID";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_CanModifyFlag = "CAN_MODIFY_FLAG";
public final static String S_AgentName = "AGENT_NAME";
public final static String S_EnrollDate = "ENROLL_DATE";
public final static String S_UpdateTime = "UPDATE_TIME";
public final static String S_AttachmenFlag = "ATTACHMEN_FLAG";
public final static String S_ProvinceName = "PROVINCE_NAME";
public final static String S_OrderId = "ORDER_ID";
public final static String S_PostCode = "POST_CODE";
public final static String S_BussTypeCode = "BUSS_TYPE_CODE";
public final static String S_IsListed = "IS_LISTED";
public final static String S_TaxpayerType = "TAXPAYER_TYPE";
public final static String S_UpdateStaffId = "UPDATE_STAFF_ID";
public final static String S_LinkmanName = "LINKMAN_NAME";
public final static String S_OrgcodeStartDate = "ORGCODE_START_DATE";
public final static String S_CardTypeCode = "CARD_TYPE_CODE";
public final static String S_State = "STATE";
public final static String S_EnrollCode = "ENROLL_CODE";
public final static String S_CreateStaffId = "CREATE_STAFF_ID";
public final static String S_UnitAddr = "UNIT_ADDR";
public final static String S_CorpAlias = "CORP_ALIAS";
public final static String S_BussScope = "BUSS_SCOPE";
public final static String S_OrganizationCode = "ORGANIZATION_CODE";
public final static String S_CompanyTel = "COMPANY_TEL";
public final static String S_AdminOrg = "ADMIN_ORG";
public final static String S_BusiLicence = "BUSI_LICENCE";
public final static String S_OrgTypeCode = "ORG_TYPE_CODE";
public final static String S_WygAgentId = "WYG_AGENT_ID";
public final static String S_AgentFlag = "AGENT_FLAG";
public final static String S_RegAddress = "REG_ADDRESS";
public final static String S_CorpPortal = "CORP_PORTAL";
public final static String S_CityCode = "CITY_CODE";
public final static String S_CurrencyTypeCode = "CURRENCY_TYPE_CODE";
public final static String S_CreateDepartId = "CREATE_DEPART_ID";
public final static String S_AllAgentNames = "ALL_AGENT_NAMES";
public final static String S_UnitRealname = "UNIT_REALNAME";
public final static String S_TaxpayerNationalId = "TAXPAYER_NATIONAL_ID";
public final static String S_CityName = "CITY_NAME";
public final static String S_EnrollType = "ENROLL_TYPE";
public final static String S_AgentId = "AGENT_ID";
public final static String S_AgentCode = "AGENT_CODE";
public final static String S_OrgcodeEndDate = "ORGCODE_END_DATE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_CHL_AGENT_ORDERBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
//�������������������ҵ���������
throw new AIException("Cannot reset ObjectType");
}
public void initAgentNameEn(String value){
this.initProperty(S_AgentNameEn,value);
}
public void setAgentNameEn(String value){
this.set(S_AgentNameEn,value);
}
public void setAgentNameEnNull(){
this.set(S_AgentNameEn,null);
}
public String getAgentNameEn(){
return DataType.getAsString(this.get(S_AgentNameEn));
}
public String getAgentNameEnInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentNameEn));
}
public void initManagerAreaName(String value){
this.initProperty(S_ManagerAreaName,value);
}
public void setManagerAreaName(String value){
this.set(S_ManagerAreaName,value);
}
public void setManagerAreaNameNull(){
this.set(S_ManagerAreaName,null);
}
public String getManagerAreaName(){
return DataType.getAsString(this.get(S_ManagerAreaName));
}
public String getManagerAreaNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ManagerAreaName));
}
public void initCreateTime(Timestamp value){
this.initProperty(S_CreateTime,value);
}
public void setCreateTime(Timestamp value){
this.set(S_CreateTime,value);
}
public void setCreateTimeNull(){
this.set(S_CreateTime,null);
}
public Timestamp getCreateTime(){
return DataType.getAsDateTime(this.get(S_CreateTime));
}
public Timestamp getCreateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_CreateTime));
}
public void initParentAgentId(String value){
this.initProperty(S_ParentAgentId,value);
}
public void setParentAgentId(String value){
this.set(S_ParentAgentId,value);
}
public void setParentAgentIdNull(){
this.set(S_ParentAgentId,null);
}
public String getParentAgentId(){
return DataType.getAsString(this.get(S_ParentAgentId));
}
public String getParentAgentIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ParentAgentId));
}
public void initLicenseCodeEnd(Timestamp value){
this.initProperty(S_LicenseCodeEnd,value);
}
public void setLicenseCodeEnd(Timestamp value){
this.set(S_LicenseCodeEnd,value);
}
public void setLicenseCodeEndNull(){
this.set(S_LicenseCodeEnd,null);
}
public Timestamp getLicenseCodeEnd(){
return DataType.getAsDateTime(this.get(S_LicenseCodeEnd));
}
public Timestamp getLicenseCodeEndInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_LicenseCodeEnd));
}
public void initRemark(String value){
this.initProperty(S_Remark,value);
}
public void setRemark(String value){
this.set(S_Remark,value);
}
public void setRemarkNull(){
this.set(S_Remark,null);
}
public String getRemark(){
return DataType.getAsString(this.get(S_Remark));
}
public String getRemarkInitialValue(){
return DataType.getAsString(this.getOldObj(S_Remark));
}
public void initLicenseCodeStart(Timestamp value){
this.initProperty(S_LicenseCodeStart,value);
}
public void setLicenseCodeStart(Timestamp value){
this.set(S_LicenseCodeStart,value);
}
public void setLicenseCodeStartNull(){
this.set(S_LicenseCodeStart,null);
}
public Timestamp getLicenseCodeStart(){
return DataType.getAsDateTime(this.get(S_LicenseCodeStart));
}
public Timestamp getLicenseCodeStartInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_LicenseCodeStart));
}
public void initFaxNumber(String value){
this.initProperty(S_FaxNumber,value);
}
public void setFaxNumber(String value){
this.set(S_FaxNumber,value);
}
public void setFaxNumberNull(){
this.set(S_FaxNumber,null);
}
public String getFaxNumber(){
return DataType.getAsString(this.get(S_FaxNumber));
}
public String getFaxNumberInitialValue(){
return DataType.getAsString(this.getOldObj(S_FaxNumber));
}
public void initLinkmanPhone(String value){
this.initProperty(S_LinkmanPhone,value);
}
public void setLinkmanPhone(String value){
this.set(S_LinkmanPhone,value);
}
public void setLinkmanPhoneNull(){
this.set(S_LinkmanPhone,null);
}
public String getLinkmanPhone(){
return DataType.getAsString(this.get(S_LinkmanPhone));
}
public String getLinkmanPhoneInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanPhone));
}
public void initChnlFunds(String value){
this.initProperty(S_ChnlFunds,value);
}
public void setChnlFunds(String value){
this.set(S_ChnlFunds,value);
}
public void setChnlFundsNull(){
this.set(S_ChnlFunds,null);
}
public String getChnlFunds(){
return DataType.getAsString(this.get(S_ChnlFunds));
}
public String getChnlFundsInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlFunds));
}
public void initAgentType(String value){
this.initProperty(S_AgentType,value);
}
public void setAgentType(String value){
this.set(S_AgentType,value);
}
public void setAgentTypeNull(){
this.set(S_AgentType,null);
}
public String getAgentType(){
return DataType.getAsString(this.get(S_AgentType));
}
public String getAgentTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentType));
}
public void initJuriPerson(String value){
this.initProperty(S_JuriPerson,value);
}
public void setJuriPerson(String value){
this.set(S_JuriPerson,value);
}
public void setJuriPersonNull(){
this.set(S_JuriPerson,null);
}
public String getJuriPerson(){
return DataType.getAsString(this.get(S_JuriPerson));
}
public String getJuriPersonInitialValue(){
return DataType.getAsString(this.getOldObj(S_JuriPerson));
}
public void initUpdateDepartId(String value){
this.initProperty(S_UpdateDepartId,value);
}
public void setUpdateDepartId(String value){
this.set(S_UpdateDepartId,value);
}
public void setUpdateDepartIdNull(){
this.set(S_UpdateDepartId,null);
}
public String getUpdateDepartId(){
return DataType.getAsString(this.get(S_UpdateDepartId));
}
public String getUpdateDepartIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateDepartId));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
public void initCanModifyFlag(String value){
this.initProperty(S_CanModifyFlag,value);
}
public void setCanModifyFlag(String value){
this.set(S_CanModifyFlag,value);
}
public void setCanModifyFlagNull(){
this.set(S_CanModifyFlag,null);
}
public String getCanModifyFlag(){
return DataType.getAsString(this.get(S_CanModifyFlag));
}
public String getCanModifyFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_CanModifyFlag));
}
public void initAgentName(String value){
this.initProperty(S_AgentName,value);
}
public void setAgentName(String value){
this.set(S_AgentName,value);
}
public void setAgentNameNull(){
this.set(S_AgentName,null);
}
public String getAgentName(){
return DataType.getAsString(this.get(S_AgentName));
}
public String getAgentNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentName));
}
public void initEnrollDate(Timestamp value){
this.initProperty(S_EnrollDate,value);
}
public void setEnrollDate(Timestamp value){
this.set(S_EnrollDate,value);
}
public void setEnrollDateNull(){
this.set(S_EnrollDate,null);
}
public Timestamp getEnrollDate(){
return DataType.getAsDateTime(this.get(S_EnrollDate));
}
public Timestamp getEnrollDateInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_EnrollDate));
}
public void initUpdateTime(Timestamp value){
this.initProperty(S_UpdateTime,value);
}
public void setUpdateTime(Timestamp value){
this.set(S_UpdateTime,value);
}
public void setUpdateTimeNull(){
this.set(S_UpdateTime,null);
}
public Timestamp getUpdateTime(){
return DataType.getAsDateTime(this.get(S_UpdateTime));
}
public Timestamp getUpdateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_UpdateTime));
}
public void initAttachmenFlag(String value){
this.initProperty(S_AttachmenFlag,value);
}
public void setAttachmenFlag(String value){
this.set(S_AttachmenFlag,value);
}
public void setAttachmenFlagNull(){
this.set(S_AttachmenFlag,null);
}
public String getAttachmenFlag(){
return DataType.getAsString(this.get(S_AttachmenFlag));
}
public String getAttachmenFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_AttachmenFlag));
}
public void initProvinceName(String value){
this.initProperty(S_ProvinceName,value);
}
public void setProvinceName(String value){
this.set(S_ProvinceName,value);
}
public void setProvinceNameNull(){
this.set(S_ProvinceName,null);
}
public String getProvinceName(){
return DataType.getAsString(this.get(S_ProvinceName));
}
public String getProvinceNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceName));
}
public void initOrderId(long value){
this.initProperty(S_OrderId,new Long(value));
}
public void setOrderId(long value){
this.set(S_OrderId,new Long(value));
}
public void setOrderIdNull(){
this.set(S_OrderId,null);
}
public long getOrderId(){
return DataType.getAsLong(this.get(S_OrderId));
}
public long getOrderIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_OrderId));
}
public void initPostCode(String value){
this.initProperty(S_PostCode,value);
}
public void setPostCode(String value){
this.set(S_PostCode,value);
}
public void setPostCodeNull(){
this.set(S_PostCode,null);
}
public String getPostCode(){
return DataType.getAsString(this.get(S_PostCode));
}
public String getPostCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PostCode));
}
public void initBussTypeCode(String value){
this.initProperty(S_BussTypeCode,value);
}
public void setBussTypeCode(String value){
this.set(S_BussTypeCode,value);
}
public void setBussTypeCodeNull(){
this.set(S_BussTypeCode,null);
}
public String getBussTypeCode(){
return DataType.getAsString(this.get(S_BussTypeCode));
}
public String getBussTypeCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BussTypeCode));
}
public void initIsListed(String value){
this.initProperty(S_IsListed,value);
}
public void setIsListed(String value){
this.set(S_IsListed,value);
}
public void setIsListedNull(){
this.set(S_IsListed,null);
}
public String getIsListed(){
return DataType.getAsString(this.get(S_IsListed));
}
public String getIsListedInitialValue(){
return DataType.getAsString(this.getOldObj(S_IsListed));
}
public void initTaxpayerType(String value){
this.initProperty(S_TaxpayerType,value);
}
public void setTaxpayerType(String value){
this.set(S_TaxpayerType,value);
}
public void setTaxpayerTypeNull(){
this.set(S_TaxpayerType,null);
}
public String getTaxpayerType(){
return DataType.getAsString(this.get(S_TaxpayerType));
}
public String getTaxpayerTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_TaxpayerType));
}
public void initUpdateStaffId(String value){
this.initProperty(S_UpdateStaffId,value);
}
public void setUpdateStaffId(String value){
this.set(S_UpdateStaffId,value);
}
public void setUpdateStaffIdNull(){
this.set(S_UpdateStaffId,null);
}
public String getUpdateStaffId(){
return DataType.getAsString(this.get(S_UpdateStaffId));
}
public String getUpdateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_UpdateStaffId));
}
public void initLinkmanName(String value){
this.initProperty(S_LinkmanName,value);
}
public void setLinkmanName(String value){
this.set(S_LinkmanName,value);
}
public void setLinkmanNameNull(){
this.set(S_LinkmanName,null);
}
public String getLinkmanName(){
return DataType.getAsString(this.get(S_LinkmanName));
}
public String getLinkmanNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_LinkmanName));
}
public void initOrgcodeStartDate(Timestamp value){
this.initProperty(S_OrgcodeStartDate,value);
}
public void setOrgcodeStartDate(Timestamp value){
this.set(S_OrgcodeStartDate,value);
}
public void setOrgcodeStartDateNull(){
this.set(S_OrgcodeStartDate,null);
}
public Timestamp getOrgcodeStartDate(){
return DataType.getAsDateTime(this.get(S_OrgcodeStartDate));
}
public Timestamp getOrgcodeStartDateInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_OrgcodeStartDate));
}
public void initCardTypeCode(long value){
this.initProperty(S_CardTypeCode,new Long(value));
}
public void setCardTypeCode(long value){
this.set(S_CardTypeCode,new Long(value));
}
public void setCardTypeCodeNull(){
this.set(S_CardTypeCode,null);
}
public long getCardTypeCode(){
return DataType.getAsLong(this.get(S_CardTypeCode));
}
public long getCardTypeCodeInitialValue(){
return DataType.getAsLong(this.getOldObj(S_CardTypeCode));
}
public void initState(String value){
this.initProperty(S_State,value);
}
public void setState(String value){
this.set(S_State,value);
}
public void setStateNull(){
this.set(S_State,null);
}
public String getState(){
return DataType.getAsString(this.get(S_State));
}
public String getStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_State));
}
public void initEnrollCode(String value){
this.initProperty(S_EnrollCode,value);
}
public void setEnrollCode(String value){
this.set(S_EnrollCode,value);
}
public void setEnrollCodeNull(){
this.set(S_EnrollCode,null);
}
public String getEnrollCode(){
return DataType.getAsString(this.get(S_EnrollCode));
}
public String getEnrollCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_EnrollCode));
}
public void initCreateStaffId(String value){
this.initProperty(S_CreateStaffId,value);
}
public void setCreateStaffId(String value){
this.set(S_CreateStaffId,value);
}
public void setCreateStaffIdNull(){
this.set(S_CreateStaffId,null);
}
public String getCreateStaffId(){
return DataType.getAsString(this.get(S_CreateStaffId));
}
public String getCreateStaffIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_CreateStaffId));
}
public void initUnitAddr(String value){
this.initProperty(S_UnitAddr,value);
}
public void setUnitAddr(String value){
this.set(S_UnitAddr,value);
}
public void setUnitAddrNull(){
this.set(S_UnitAddr,null);
}
public String getUnitAddr(){
return DataType.getAsString(this.get(S_UnitAddr));
}
public String getUnitAddrInitialValue(){
return DataType.getAsString(this.getOldObj(S_UnitAddr));
}
public void initCorpAlias(String value){
this.initProperty(S_CorpAlias,value);
}
public void setCorpAlias(String value){
this.set(S_CorpAlias,value);
}
public void setCorpAliasNull(){
this.set(S_CorpAlias,null);
}
public String getCorpAlias(){
return DataType.getAsString(this.get(S_CorpAlias));
}
public String getCorpAliasInitialValue(){
return DataType.getAsString(this.getOldObj(S_CorpAlias));
}
public void initBussScope(String value){
this.initProperty(S_BussScope,value);
}
public void setBussScope(String value){
this.set(S_BussScope,value);
}
public void setBussScopeNull(){
this.set(S_BussScope,null);
}
public String getBussScope(){
return DataType.getAsString(this.get(S_BussScope));
}
public String getBussScopeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BussScope));
}
public void initOrganizationCode(String value){
this.initProperty(S_OrganizationCode,value);
}
public void setOrganizationCode(String value){
this.set(S_OrganizationCode,value);
}
public void setOrganizationCodeNull(){
this.set(S_OrganizationCode,null);
}
public String getOrganizationCode(){
return DataType.getAsString(this.get(S_OrganizationCode));
}
public String getOrganizationCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrganizationCode));
}
public void initCompanyTel(String value){
this.initProperty(S_CompanyTel,value);
}
public void setCompanyTel(String value){
this.set(S_CompanyTel,value);
}
public void setCompanyTelNull(){
this.set(S_CompanyTel,null);
}
public String getCompanyTel(){
return DataType.getAsString(this.get(S_CompanyTel));
}
public String getCompanyTelInitialValue(){
return DataType.getAsString(this.getOldObj(S_CompanyTel));
}
public void initAdminOrg(String value){
this.initProperty(S_AdminOrg,value);
}
public void setAdminOrg(String value){
this.set(S_AdminOrg,value);
}
public void setAdminOrgNull(){
this.set(S_AdminOrg,null);
}
public String getAdminOrg(){
return DataType.getAsString(this.get(S_AdminOrg));
}
public String getAdminOrgInitialValue(){
return DataType.getAsString(this.getOldObj(S_AdminOrg));
}
public void initBusiLicence(String value){
this.initProperty(S_BusiLicence,value);
}
public void setBusiLicence(String value){
this.set(S_BusiLicence,value);
}
public void setBusiLicenceNull(){
this.set(S_BusiLicence,null);
}
public String getBusiLicence(){
return DataType.getAsString(this.get(S_BusiLicence));
}
public String getBusiLicenceInitialValue(){
return DataType.getAsString(this.getOldObj(S_BusiLicence));
}
public void initOrgTypeCode(String value){
this.initProperty(S_OrgTypeCode,value);
}
public void setOrgTypeCode(String value){
this.set(S_OrgTypeCode,value);
}
public void setOrgTypeCodeNull(){
this.set(S_OrgTypeCode,null);
}
public String getOrgTypeCode(){
return DataType.getAsString(this.get(S_OrgTypeCode));
}
public String getOrgTypeCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrgTypeCode));
}
public void initWygAgentId(long value){
this.initProperty(S_WygAgentId,new Long(value));
}
public void setWygAgentId(long value){
this.set(S_WygAgentId,new Long(value));
}
public void setWygAgentIdNull(){
this.set(S_WygAgentId,null);
}
public long getWygAgentId(){
return DataType.getAsLong(this.get(S_WygAgentId));
}
public long getWygAgentIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_WygAgentId));
}
public void initAgentFlag(String value){
this.initProperty(S_AgentFlag,value);
}
public void setAgentFlag(String value){
this.set(S_AgentFlag,value);
}
public void setAgentFlagNull(){
this.set(S_AgentFlag,null);
}
public String getAgentFlag(){
return DataType.getAsString(this.get(S_AgentFlag));
}
public String getAgentFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentFlag));
}
public void initRegAddress(String value){
this.initProperty(S_RegAddress,value);
}
public void setRegAddress(String value){
this.set(S_RegAddress,value);
}
public void setRegAddressNull(){
this.set(S_RegAddress,null);
}
public String getRegAddress(){
return DataType.getAsString(this.get(S_RegAddress));
}
public String getRegAddressInitialValue(){
return DataType.getAsString(this.getOldObj(S_RegAddress));
}
public void initCorpPortal(String value){
this.initProperty(S_CorpPortal,value);
}
public void setCorpPortal(String value){
this.set(S_CorpPortal,value);
}
public void setCorpPortalNull(){
this.set(S_CorpPortal,null);
}
public String getCorpPortal(){
return DataType.getAsString(this.get(S_CorpPortal));
}
public String getCorpPortalInitialValue(){
return DataType.getAsString(this.getOldObj(S_CorpPortal));
}
public void initCityCode(String value){
this.initProperty(S_CityCode,value);
}
public void setCityCode(String value){
this.set(S_CityCode,value);
}
public void setCityCodeNull(){
this.set(S_CityCode,null);
}
public String getCityCode(){
return DataType.getAsString(this.get(S_CityCode));
}
public String getCityCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityCode));
}
public void initCurrencyTypeCode(String value){
this.initProperty(S_CurrencyTypeCode,value);
}
public void setCurrencyTypeCode(String value){
this.set(S_CurrencyTypeCode,value);
}
public void setCurrencyTypeCodeNull(){
this.set(S_CurrencyTypeCode,null);
}
public String getCurrencyTypeCode(){
return DataType.getAsString(this.get(S_CurrencyTypeCode));
}
public String getCurrencyTypeCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_CurrencyTypeCode));
}
public void initCreateDepartId(String value){
this.initProperty(S_CreateDepartId,value);
}
public void setCreateDepartId(String value){
this.set(S_CreateDepartId,value);
}
public void setCreateDepartIdNull(){
this.set(S_CreateDepartId,null);
}
public String getCreateDepartId(){
return DataType.getAsString(this.get(S_CreateDepartId));
}
public String getCreateDepartIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_CreateDepartId));
}
public void initAllAgentNames(String value){
this.initProperty(S_AllAgentNames,value);
}
public void setAllAgentNames(String value){
this.set(S_AllAgentNames,value);
}
public void setAllAgentNamesNull(){
this.set(S_AllAgentNames,null);
}
public String getAllAgentNames(){
return DataType.getAsString(this.get(S_AllAgentNames));
}
public String getAllAgentNamesInitialValue(){
return DataType.getAsString(this.getOldObj(S_AllAgentNames));
}
public void initUnitRealname(String value){
this.initProperty(S_UnitRealname,value);
}
public void setUnitRealname(String value){
this.set(S_UnitRealname,value);
}
public void setUnitRealnameNull(){
this.set(S_UnitRealname,null);
}
public String getUnitRealname(){
return DataType.getAsString(this.get(S_UnitRealname));
}
public String getUnitRealnameInitialValue(){
return DataType.getAsString(this.getOldObj(S_UnitRealname));
}
public void initTaxpayerNationalId(String value){
this.initProperty(S_TaxpayerNationalId,value);
}
public void setTaxpayerNationalId(String value){
this.set(S_TaxpayerNationalId,value);
}
public void setTaxpayerNationalIdNull(){
this.set(S_TaxpayerNationalId,null);
}
public String getTaxpayerNationalId(){
return DataType.getAsString(this.get(S_TaxpayerNationalId));
}
public String getTaxpayerNationalIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_TaxpayerNationalId));
}
public void initCityName(String value){
this.initProperty(S_CityName,value);
}
public void setCityName(String value){
this.set(S_CityName,value);
}
public void setCityNameNull(){
this.set(S_CityName,null);
}
public String getCityName(){
return DataType.getAsString(this.get(S_CityName));
}
public String getCityNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_CityName));
}
public void initEnrollType(String value){
this.initProperty(S_EnrollType,value);
}
public void setEnrollType(String value){
this.set(S_EnrollType,value);
}
public void setEnrollTypeNull(){
this.set(S_EnrollType,null);
}
public String getEnrollType(){
return DataType.getAsString(this.get(S_EnrollType));
}
public String getEnrollTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_EnrollType));
}
public void initAgentId(long value){
this.initProperty(S_AgentId,new Long(value));
}
public void setAgentId(long value){
this.set(S_AgentId,new Long(value));
}
public void setAgentIdNull(){
this.set(S_AgentId,null);
}
public long getAgentId(){
return DataType.getAsLong(this.get(S_AgentId));
}
public long getAgentIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_AgentId));
}
public void initAgentCode(String value){
this.initProperty(S_AgentCode,value);
}
public void setAgentCode(String value){
this.set(S_AgentCode,value);
}
public void setAgentCodeNull(){
this.set(S_AgentCode,null);
}
public String getAgentCode(){
return DataType.getAsString(this.get(S_AgentCode));
}
public String getAgentCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentCode));
}
public void initOrgcodeEndDate(Timestamp value){
this.initProperty(S_OrgcodeEndDate,value);
}
public void setOrgcodeEndDate(Timestamp value){
this.set(S_OrgcodeEndDate,value);
}
public void setOrgcodeEndDateNull(){
this.set(S_OrgcodeEndDate,null);
}
public Timestamp getOrgcodeEndDate(){
return DataType.getAsDateTime(this.get(S_OrgcodeEndDate));
}
public Timestamp getOrgcodeEndDateInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_OrgcodeEndDate));
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IINT_REDUCE_SUBJECT_PARAValue extends DataStructInterface{
public final static String S_TagCode = "TAG_CODE";
public final static String S_Remark = "REMARK";
public final static String S_TagCodeName = "TAG_CODE_NAME";
public String getTagCode();
public String getRemark();
public String getTagCodeName();
public void setTagCode(String value);
public void setRemark(String value);
public void setTagCodeName(String value);
}
<file_sep>
package com.unicom.ecip.inquirychannelinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "outmsgcontent", propOrder = {
"authorizecode",
"channeladdress",
"channelname",
"channelstatus",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5"
})
public class Outmsgcontent {
@XmlElement(name = "AUTHORIZE_CODE")
protected String authorizecode;
@XmlElement(name = "CHANNEL_ADDRESS")
protected String channeladdress;
@XmlElement(name = "CHANNEL_NAME")
protected String channelname;
@XmlElement(name = "CHANNEL_STATUS")
protected String channelstatus;
@XmlElement(name = "RESERVED_1")
protected String reserved1;
@XmlElement(name = "RESERVED_2")
protected String reserved2;
@XmlElement(name = "RESERVED_3")
protected String reserved3;
@XmlElement(name = "RESERVED_4")
protected String reserved4;
@XmlElement(name = "RESERVED_5")
protected String reserved5;
public String getAUTHORIZECODE() {
return authorizecode;
}
public void setAUTHORIZECODE(String value) {
this.authorizecode = value;
}
public String getCHANNELADDRESS() {
return channeladdress;
}
public void setCHANNELADDRESS(String value) {
this.channeladdress = value;
}
public String getCHANNELNAME() {
return channelname;
}
public void setCHANNELNAME(String value) {
this.channelname = value;
}
public String getCHANNELSTATUS() {
return channelstatus;
}
public void setCHANNELSTATUS(String value) {
this.channelstatus = value;
}
public String getRESERVED1() {
return reserved1;
}
public void setRESERVED1(String value) {
this.reserved1 = value;
}
public String getRESERVED2() {
return reserved2;
}
public void setRESERVED2(String value) {
this.reserved2 = value;
}
public String getRESERVED3() {
return reserved3;
}
public void setRESERVED3(String value) {
this.reserved3 = value;
}
public String getRESERVED4() {
return reserved4;
}
public void setRESERVED4(String value) {
this.reserved4 = value;
}
public String getRESERVED5() {
return reserved5;
}
public void setRESERVED5(String value) {
this.reserved5 = value;
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.util.HashMap;
import java.util.Map;
import com.ai.uint.ftp.vo.GenerateFileInfoVO;
import com.ai.uint.paramsMang.vo.PublishCfgVo;
public interface IQZWZHFileBusiSV {
public int getRowCount() throws Exception;
public GenerateFileInfoVO getGenerateFileInfoVO(String fileLogID, PublishCfgVo pubCfgVO) throws Exception;
public void generateFile(GenerateFileInfoVO vo,String confFileName, String outFileName, Map paraMap) throws Exception;
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,PrecheckResultSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,PrecheckResultSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,PrecheckResultSchema.xsd
precheckResult,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.ejb.VO.AreaInfo;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import com.ai.uchintService.ejb.VO.GenericVO;
public class AreaInfoPrecheckReqVO extends GenericVO{
private static final long serialVersionUID = 1L;
protected String precheckNO;
protected String operateTYPE;
protected String areaCODE;
protected String batchNO;
protected AreaInfoPrecheckReqVO.AREA_INFO_OLD areaINFOOLD;
protected AreaInfoPrecheckReqVO.AREA_INFO_NEW areaINFONEW;
protected List<AreaInfoPrecheckReqVO.PARA> para;
public List<AreaInfoPrecheckReqVO.PARA> getPARA() {
if (para == null) {
para = new ArrayList<AreaInfoPrecheckReqVO.PARA>();
}
return this.para;
}
public static class AREA_INFO_NEW {
protected String areaNAME;
protected String areaFRAME;
protected BigInteger orderNO;
protected String parentAREACODE;
protected String startDATE;
protected String endDATE;
protected BigInteger areaLEVEL;
protected String validflag;
protected String remark;
/**
* Gets the value of the area_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_NAME() {
return areaNAME;
}
/**
* Sets the value of the area_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_NAME(String value) {
this.areaNAME = value;
}
/**
* Gets the value of the area_FRAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_FRAME() {
return areaFRAME;
}
/**
* Sets the value of the area_FRAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_FRAME(String value) {
this.areaFRAME = value;
}
/**
* Gets the value of the order_NO property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getORDER_NO() {
return orderNO;
}
/**
* Sets the value of the order_NO property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setORDER_NO(BigInteger value) {
this.orderNO = value;
}
/**
* Gets the value of the parent_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARENT_AREA_CODE() {
return parentAREACODE;
}
/**
* Sets the value of the parent_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARENT_AREA_CODE(String value) {
this.parentAREACODE = value;
}
/**
* Gets the value of the start_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_DATE() {
return startDATE;
}
/**
* Sets the value of the start_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_DATE(String value) {
this.startDATE = value;
}
/**
* Gets the value of the end_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_DATE() {
return endDATE;
}
/**
* Sets the value of the end_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_DATE(String value) {
this.endDATE = value;
}
/**
* Gets the value of the area_LEVEL property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAREA_LEVEL() {
return areaLEVEL;
}
/**
* Sets the value of the area_LEVEL property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAREA_LEVEL(BigInteger value) {
this.areaLEVEL = value;
}
/**
* Gets the value of the validflag property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVALIDFLAG() {
return validflag;
}
/**
* Sets the value of the validflag property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVALIDFLAG(String value) {
this.validflag = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
}
public static class AREA_INFO_OLD {
protected String areaNAME;
protected String areaFRAME;
protected BigInteger orderNO;
protected String parentAREACODE;
protected String startDATE;
protected String endDATE;
protected BigInteger areaLEVEL;
protected String validflag;
protected String remark;
/**
* Gets the value of the area_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_NAME() {
return areaNAME;
}
/**
* Sets the value of the area_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_NAME(String value) {
this.areaNAME = value;
}
/**
* Gets the value of the area_FRAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAREA_FRAME() {
return areaFRAME;
}
/**
* Sets the value of the area_FRAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAREA_FRAME(String value) {
this.areaFRAME = value;
}
/**
* Gets the value of the order_NO property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getORDER_NO() {
return orderNO;
}
/**
* Sets the value of the order_NO property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setORDER_NO(BigInteger value) {
this.orderNO = value;
}
/**
* Gets the value of the parent_AREA_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARENT_AREA_CODE() {
return parentAREACODE;
}
/**
* Sets the value of the parent_AREA_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARENT_AREA_CODE(String value) {
this.parentAREACODE = value;
}
/**
* Gets the value of the start_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_DATE() {
return startDATE;
}
/**
* Sets the value of the start_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_DATE(String value) {
this.startDATE = value;
}
/**
* Gets the value of the end_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_DATE() {
return endDATE;
}
/**
* Sets the value of the end_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_DATE(String value) {
this.endDATE = value;
}
/**
* Gets the value of the area_LEVEL property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAREA_LEVEL() {
return areaLEVEL;
}
/**
* Sets the value of the area_LEVEL property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAREA_LEVEL(BigInteger value) {
this.areaLEVEL = value;
}
/**
* Gets the value of the validflag property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVALIDFLAG() {
return validflag;
}
/**
* Sets the value of the validflag property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVALIDFLAG(String value) {
this.validflag = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
}
public static class PARA {
protected String paraID;
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
public String getPrecheckNO() {
return precheckNO;
}
public void setPrecheckNO(String precheckNO) {
this.precheckNO = precheckNO;
}
public String getOperateTYPE() {
return operateTYPE;
}
public void setOperateTYPE(String operateTYPE) {
this.operateTYPE = operateTYPE;
}
public String getAreaCODE() {
return areaCODE;
}
public void setAreaCODE(String areaCODE) {
this.areaCODE = areaCODE;
}
public String getBatchNO() {
return batchNO;
}
public void setBatchNO(String batchNO) {
this.batchNO = batchNO;
}
public AreaInfoPrecheckReqVO.AREA_INFO_OLD getAreaINFOOLD() {
return areaINFOOLD;
}
public void setAreaINFOOLD(AreaInfoPrecheckReqVO.AREA_INFO_OLD areaINFOOLD) {
this.areaINFOOLD = areaINFOOLD;
}
public AreaInfoPrecheckReqVO.AREA_INFO_NEW getAreaINFONEW() {
return areaINFONEW;
}
public void setAreaINFONEW(AreaInfoPrecheckReqVO.AREA_INFO_NEW areaINFONEW) {
this.areaINFONEW = areaINFONEW;
}
public List<AreaInfoPrecheckReqVO.PARA> getPara() {
return para;
}
public void setPara(List<AreaInfoPrecheckReqVO.PARA> para) {
this.para = para;
}
}
<file_sep>package com.ai.uchintService.common.bo;
import java.sql.*;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.DataType;
import com.ai.uchintService.common.ivalues.ITF_QZ_JY_WEValue;
import com.ai.uip.core.ivalues.*;
public class TF_QZ_JY_WEBean extends DataContainer implements DataContainerInterface,ITF_QZ_JY_WEValue{
private static String m_boName = "bo.TF_QZ_JY_WE";
public final static String S_OrderStatus = "ORDER_STATUS";
public final static String S_CreateTime = "CREATE_TIME";
public final static String S_ChnlCode = "CHNL_CODE";
public final static String S_OrderTime = "ORDER_TIME";
public final static String S_Reserved2 = "RESERVED2";
public final static String S_Reserved1 = "RESERVED1";
public final static String S_ShopId = "SHOP_ID";
public final static String S_LocalFlag = "LOCAL_FLAG";
public final static String S_PaidFee = "PAID_FEE";
public final static String S_PayTime = "PAY_TIME";
public final static String S_ProxyShopName = "PROXY_SHOP_NAME";
public final static String S_ReturnId = "RETURN_ID";
public final static String S_GdsList = "GDS_LIST";
public final static String S_OrderId = "ORDER_ID";
public final static String S_PayType = "PAY_TYPE";
public final static String S_ProxyShopId = "PROXY_SHOP_ID";
public final static String S_ShopName = "SHOP_NAME";
public final static String S_ReturnList = "RETURN_LIST";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_QZ_JY_WEBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�������������������ҵ���������");
}
public void initOrderStatus(String value){
this.initProperty(S_OrderStatus,value);
}
public void setOrderStatus(String value){
this.set(S_OrderStatus,value);
}
public void setOrderStatusNull(){
this.set(S_OrderStatus,null);
}
public String getOrderStatus(){
return DataType.getAsString(this.get(S_OrderStatus));
}
public String getOrderStatusInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrderStatus));
}
public void initCreateTime(Timestamp value){
this.initProperty(S_CreateTime,value);
}
public void setCreateTime(Timestamp value){
this.set(S_CreateTime,value);
}
public void setCreateTimeNull(){
this.set(S_CreateTime,null);
}
public Timestamp getCreateTime(){
return DataType.getAsDateTime(this.get(S_CreateTime));
}
public Timestamp getCreateTimeInitialValue(){
return DataType.getAsDateTime(this.getOldObj(S_CreateTime));
}
public void initChnlCode(String value){
this.initProperty(S_ChnlCode,value);
}
public void setChnlCode(String value){
this.set(S_ChnlCode,value);
}
public void setChnlCodeNull(){
this.set(S_ChnlCode,null);
}
public String getChnlCode(){
return DataType.getAsString(this.get(S_ChnlCode));
}
public String getChnlCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChnlCode));
}
public void initOrderTime(String value){
this.initProperty(S_OrderTime,value);
}
public void setOrderTime(String value){
this.set(S_OrderTime,value);
}
public void setOrderTimeNull(){
this.set(S_OrderTime,null);
}
public String getOrderTime(){
return DataType.getAsString(this.get(S_OrderTime));
}
public String getOrderTimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrderTime));
}
public void initReserved2(String value){
this.initProperty(S_Reserved2,value);
}
public void setReserved2(String value){
this.set(S_Reserved2,value);
}
public void setReserved2Null(){
this.set(S_Reserved2,null);
}
public String getReserved2(){
return DataType.getAsString(this.get(S_Reserved2));
}
public String getReserved2InitialValue(){
return DataType.getAsString(this.getOldObj(S_Reserved2));
}
public void initReserved1(String value){
this.initProperty(S_Reserved1,value);
}
public void setReserved1(String value){
this.set(S_Reserved1,value);
}
public void setReserved1Null(){
this.set(S_Reserved1,null);
}
public String getReserved1(){
return DataType.getAsString(this.get(S_Reserved1));
}
public String getReserved1InitialValue(){
return DataType.getAsString(this.getOldObj(S_Reserved1));
}
public void initShopId(String value){
this.initProperty(S_ShopId,value);
}
public void setShopId(String value){
this.set(S_ShopId,value);
}
public void setShopIdNull(){
this.set(S_ShopId,null);
}
public String getShopId(){
return DataType.getAsString(this.get(S_ShopId));
}
public String getShopIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ShopId));
}
public void initLocalFlag(String value){
this.initProperty(S_LocalFlag,value);
}
public void setLocalFlag(String value){
this.set(S_LocalFlag,value);
}
public void setLocalFlagNull(){
this.set(S_LocalFlag,null);
}
public String getLocalFlag(){
return DataType.getAsString(this.get(S_LocalFlag));
}
public String getLocalFlagInitialValue(){
return DataType.getAsString(this.getOldObj(S_LocalFlag));
}
public void initPaidFee(String value){
this.initProperty(S_PaidFee,value);
}
public void setPaidFee(String value){
this.set(S_PaidFee,value);
}
public void setPaidFeeNull(){
this.set(S_PaidFee,null);
}
public String getPaidFee(){
return DataType.getAsString(this.get(S_PaidFee));
}
public String getPaidFeeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PaidFee));
}
public void initPayTime(String value){
this.initProperty(S_PayTime,value);
}
public void setPayTime(String value){
this.set(S_PayTime,value);
}
public void setPayTimeNull(){
this.set(S_PayTime,null);
}
public String getPayTime(){
return DataType.getAsString(this.get(S_PayTime));
}
public String getPayTimeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayTime));
}
public void initProxyShopName(String value){
this.initProperty(S_ProxyShopName,value);
}
public void setProxyShopName(String value){
this.set(S_ProxyShopName,value);
}
public void setProxyShopNameNull(){
this.set(S_ProxyShopName,null);
}
public String getProxyShopName(){
return DataType.getAsString(this.get(S_ProxyShopName));
}
public String getProxyShopNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProxyShopName));
}
public void initReturnId(String value){
this.initProperty(S_ReturnId,value);
}
public void setReturnId(String value){
this.set(S_ReturnId,value);
}
public void setReturnIdNull(){
this.set(S_ReturnId,null);
}
public String getReturnId(){
return DataType.getAsString(this.get(S_ReturnId));
}
public String getReturnIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ReturnId));
}
public void initGdsList(String value){
this.initProperty(S_GdsList,value);
}
public void setGdsList(String value){
this.set(S_GdsList,value);
}
public void setGdsListNull(){
this.set(S_GdsList,null);
}
public String getGdsList(){
return DataType.getAsString(this.get(S_GdsList));
}
public String getGdsListInitialValue(){
return DataType.getAsString(this.getOldObj(S_GdsList));
}
public void initOrderId(String value){
this.initProperty(S_OrderId,value);
}
public void setOrderId(String value){
this.set(S_OrderId,value);
}
public void setOrderIdNull(){
this.set(S_OrderId,null);
}
public String getOrderId(){
return DataType.getAsString(this.get(S_OrderId));
}
public String getOrderIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_OrderId));
}
public void initPayType(String value){
this.initProperty(S_PayType,value);
}
public void setPayType(String value){
this.set(S_PayType,value);
}
public void setPayTypeNull(){
this.set(S_PayType,null);
}
public String getPayType(){
return DataType.getAsString(this.get(S_PayType));
}
public String getPayTypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_PayType));
}
public void initProxyShopId(String value){
this.initProperty(S_ProxyShopId,value);
}
public void setProxyShopId(String value){
this.set(S_ProxyShopId,value);
}
public void setProxyShopIdNull(){
this.set(S_ProxyShopId,null);
}
public String getProxyShopId(){
return DataType.getAsString(this.get(S_ProxyShopId));
}
public String getProxyShopIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProxyShopId));
}
public void initShopName(String value){
this.initProperty(S_ShopName,value);
}
public void setShopName(String value){
this.set(S_ShopName,value);
}
public void setShopNameNull(){
this.set(S_ShopName,null);
}
public String getShopName(){
return DataType.getAsString(this.get(S_ShopName));
}
public String getShopNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_ShopName));
}
public void initReturnList(String value){
this.initProperty(S_ReturnList,value);
}
public void setReturnList(String value){
this.set(S_ReturnList,value);
}
public void setReturnListNull(){
this.set(S_ReturnList,null);
}
public String getReturnList(){
return DataType.getAsString(this.get(S_ReturnList));
}
public String getReturnListInitialValue(){
return DataType.getAsString(this.getOldObj(S_ReturnList));
}
public void initProvinceCode(String value){
this.initProperty(S_ProvinceCode,value);
}
public void setProvinceCode(String value){
this.set(S_ProvinceCode,value);
}
public void setProvinceCodeNull(){
this.set(S_ProvinceCode,null);
}
public String getProvinceCode(){
return DataType.getAsString(this.get(S_ProvinceCode));
}
public String getProvinceCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ProvinceCode));
}
}
<file_sep>
package com.unicom.mss.sb_uc_uc_inquiryucinputvatmatchinfosrv;
import java.math.BigDecimal;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.w3._2001.xmlschema.Adapter1;
/**
* <p>Java class for SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PROVINCE_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="INVOICE_BATCH" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="INVOICE_CODE" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="INVOICE_NO" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="MATCHING_STATUS" type="{http://www.w3.org/2001/XMLSchema}decimal"/>
* <element name="PAY_BATCH" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="VOUCHER_NUMBER" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ACCOUNTING_DATE" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="LAST_UPDATE_DATE" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="RESERVED_1" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_2" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_3" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_4" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_5" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_6" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_7" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="RESERVED_8" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem", propOrder = {
"provinceCODE",
"invoiceBATCH",
"invoiceCODE",
"invoiceNO",
"matchingSTATUS",
"payBATCH",
"voucherNUMBER",
"accountingDATE",
"lastUPDATEDATE",
"reserved1",
"reserved2",
"reserved3",
"reserved4",
"reserved5",
"reserved6",
"reserved7",
"reserved8"
})
public class SB_UC_UC_InquiryUCInputVATMatchInfoSrvOutputItem {
@XmlElement(name = "PROVINCE_CODE", required = true, nillable = true)
protected String provinceCODE;
@XmlElement(name = "INVOICE_BATCH", required = true, nillable = true)
protected String invoiceBATCH;
@XmlElement(name = "INVOICE_CODE", required = true, nillable = true)
protected String invoiceCODE;
@XmlElement(name = "INVOICE_NO", required = true, nillable = true)
protected String invoiceNO;
@XmlElement(name = "MATCHING_STATUS", required = true, nillable = true)
protected BigDecimal matchingSTATUS;
@XmlElement(name = "PAY_BATCH", required = true, nillable = true)
protected String payBATCH;
@XmlElement(name = "VOUCHER_NUMBER", required = true, nillable = true)
protected String voucherNUMBER;
@XmlElement(name = "ACCOUNTING_DATE", required = true, type = String.class, nillable = true)
@XmlJavaTypeAdapter(Adapter1 .class)
@XmlSchemaType(name = "dateTime")
protected Date accountingDATE;
@XmlElement(name = "LAST_UPDATE_DATE", required = true, type = String.class, nillable = true)
@XmlJavaTypeAdapter(Adapter1 .class)
@XmlSchemaType(name = "dateTime")
protected Date lastUPDATEDATE;
@XmlElement(name = "RESERVED_1", required = true, nillable = true)
protected String reserved1;
@XmlElement(name = "RESERVED_2", required = true, nillable = true)
protected String reserved2;
@XmlElement(name = "RESERVED_3", required = true, nillable = true)
protected String reserved3;
@XmlElement(name = "RESERVED_4", required = true, nillable = true)
protected String reserved4;
@XmlElement(name = "RESERVED_5", required = true, nillable = true)
protected String reserved5;
@XmlElement(name = "RESERVED_6", required = true, nillable = true)
protected String reserved6;
@XmlElement(name = "RESERVED_7", required = true, nillable = true)
protected String reserved7;
@XmlElement(name = "RESERVED_8", required = true, nillable = true)
protected String reserved8;
/**
* Gets the value of the province_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPROVINCE_CODE() {
return provinceCODE;
}
/**
* Sets the value of the province_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPROVINCE_CODE(String value) {
this.provinceCODE = value;
}
/**
* Gets the value of the invoice_BATCH property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINVOICE_BATCH() {
return invoiceBATCH;
}
/**
* Sets the value of the invoice_BATCH property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINVOICE_BATCH(String value) {
this.invoiceBATCH = value;
}
/**
* Gets the value of the invoice_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINVOICE_CODE() {
return invoiceCODE;
}
/**
* Sets the value of the invoice_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINVOICE_CODE(String value) {
this.invoiceCODE = value;
}
/**
* Gets the value of the invoice_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINVOICE_NO() {
return invoiceNO;
}
/**
* Sets the value of the invoice_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINVOICE_NO(String value) {
this.invoiceNO = value;
}
/**
* Gets the value of the matching_STATUS property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getMATCHING_STATUS() {
return matchingSTATUS;
}
/**
* Sets the value of the matching_STATUS property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setMATCHING_STATUS(BigDecimal value) {
this.matchingSTATUS = value;
}
/**
* Gets the value of the pay_BATCH property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPAY_BATCH() {
return payBATCH;
}
/**
* Sets the value of the pay_BATCH property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPAY_BATCH(String value) {
this.payBATCH = value;
}
/**
* Gets the value of the voucher_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVOUCHER_NUMBER() {
return voucherNUMBER;
}
/**
* Sets the value of the voucher_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVOUCHER_NUMBER(String value) {
this.voucherNUMBER = value;
}
/**
* Gets the value of the accounting_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getACCOUNTING_DATE() {
return accountingDATE;
}
/**
* Sets the value of the accounting_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setACCOUNTING_DATE(Date value) {
this.accountingDATE = value;
}
/**
* Gets the value of the last_UPDATE_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getLAST_UPDATE_DATE() {
return lastUPDATEDATE;
}
/**
* Sets the value of the last_UPDATE_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLAST_UPDATE_DATE(Date value) {
this.lastUPDATEDATE = value;
}
/**
* Gets the value of the reserved_1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_1() {
return reserved1;
}
/**
* Sets the value of the reserved_1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_1(String value) {
this.reserved1 = value;
}
/**
* Gets the value of the reserved_2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_2() {
return reserved2;
}
/**
* Sets the value of the reserved_2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_2(String value) {
this.reserved2 = value;
}
/**
* Gets the value of the reserved_3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_3() {
return reserved3;
}
/**
* Sets the value of the reserved_3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_3(String value) {
this.reserved3 = value;
}
/**
* Gets the value of the reserved_4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_4() {
return reserved4;
}
/**
* Sets the value of the reserved_4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_4(String value) {
this.reserved4 = value;
}
/**
* Gets the value of the reserved_5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_5() {
return reserved5;
}
/**
* Sets the value of the reserved_5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_5(String value) {
this.reserved5 = value;
}
/**
* Gets the value of the reserved_6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_6() {
return reserved6;
}
/**
* Sets the value of the reserved_6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_6(String value) {
this.reserved6 = value;
}
/**
* Gets the value of the reserved_7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_7() {
return reserved7;
}
/**
* Sets the value of the reserved_7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_7(String value) {
this.reserved7 = value;
}
/**
* Gets the value of the reserved_8 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRESERVED_8() {
return reserved8;
}
/**
* Sets the value of the reserved_8 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRESERVED_8(String value) {
this.reserved8 = value;
}
}
<file_sep>package com.ai.uip.core.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IUIP_SERVICE_PENETRATIONValue extends DataStructInterface{
public final static String S_ServicePath = "SERVICE_PATH";
public final static String S_ServiceDesc = "SERVICE_DESC";
public final static String S_ServiceImplClass = "SERVICE_IMPL_CLASS";
public final static String S_ServiceStatus = "SERVICE_STATUS";
public final static String S_ServiceName = "SERVICE_NAME";
public final static String S_ServiceId = "SERVICE_ID";
public final static String S_ServiceCode = "SERVICE_CODE";
public final static String S_NameSpace = "NAME_SPACE";
public final static String S_ServiceDomain = "SERVICE_DOMAIN";
public String getServicePath();
public String getServiceDesc();
public String getServiceImplClass();
public Integer getServiceStatusAsInteger();
public int getServiceStatus();
public String getServiceName();
public Long getServiceIdAsLong();
public long getServiceId();
public String getServiceCode();
public String getNameSpace();
public Integer getServiceDomainAsInteger();
public int getServiceDomain();
public void setServicePath(String value);
public void setServiceDesc(String value);
public void setServiceImplClass(String value);
public void setServiceStatus(Integer value);
public void setServiceStatus(int value);
public void setServiceName(String value);
public void setServiceId(Long value);
public void setServiceId(long value);
public void setServiceCode(String value);
public void setNameSpace(String value);
public void setServiceDomain(Integer value);
public void setServiceDomain(int value);
}
<file_sep>
package cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssattached.UNIBSSATTACHED;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.agentdepositrechsyncrsp.AGENTDEPOSITRECHSYNCRSP;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibsshead.UNIBSSHEAD;
/**
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/unibssHead}UNI_BSS_HEAD"/>
* <element name="UNI_BSS_BODY">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/unibssBody/agentDepositRechSyncRsp}AGENT_DEPOSIT_RECH_SYNC_RSP"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element ref="{http://ws.chinaunicom.cn/unibssAttached}UNI_BSS_ATTACHED"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"unibsshead",
"unibssbody",
"unibssattached"
})
@XmlRootElement(name = "AGENT_DEPOSIT_RECH_SYNC_OUTPUT")
public class AGENTDEPOSITRECHSYNCOUTPUT {
@XmlElement(name = "UNI_BSS_HEAD", namespace = "http://ws.chinaunicom.cn/unibssHead", required = true)
protected UNIBSSHEAD unibsshead;
@XmlElement(name = "UNI_BSS_BODY", required = true)
protected AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY unibssbody;
@XmlElement(name = "UNI_BSS_ATTACHED", namespace = "http://ws.chinaunicom.cn/unibssAttached", required = true)
protected UNIBSSATTACHED unibssattached;
/**
*
* @return
* possible object is
* {@link UNIBSSHEAD }
*
*/
public UNIBSSHEAD getUNIBSSHEAD() {
return unibsshead;
}
/**
*
* @param value
* allowed object is
* {@link UNIBSSHEAD }
*
*/
public void setUNIBSSHEAD(UNIBSSHEAD value) {
this.unibsshead = value;
}
/**
*
* @return
* possible object is
* {@link AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY }
*
*/
public AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY getUNIBSSBODY() {
return unibssbody;
}
/**
*
* @param value
* allowed object is
* {@link AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY }
*
*/
public void setUNIBSSBODY(AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY value) {
this.unibssbody = value;
}
/**
*
* @return
* possible object is
* {@link UNIBSSATTACHED }
*
*/
public UNIBSSATTACHED getUNIBSSATTACHED() {
return unibssattached;
}
/**
*
* @param value
* allowed object is
* {@link UNIBSSATTACHED }
*
*/
public void setUNIBSSATTACHED(UNIBSSATTACHED value) {
this.unibssattached = value;
}
/**
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/unibssBody/agentDepositRechSyncRsp}AGENT_DEPOSIT_RECH_SYNC_RSP"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"agentdepositrechsyncrsp"
})
public static class UNIBSSBODY {
@XmlElement(name = "AGENT_DEPOSIT_RECH_SYNC_RSP", namespace = "http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/unibssBody/agentDepositRechSyncRsp", required = true)
protected AGENTDEPOSITRECHSYNCRSP agentdepositrechsyncrsp;
/**
*
* @return
* possible object is
* {@link AGENTDEPOSITRECHSYNCRSP }
*
*/
public AGENTDEPOSITRECHSYNCRSP getAGENTDEPOSITRECHSYNCRSP() {
return agentdepositrechsyncrsp;
}
/**
*
* @param value
* allowed object is
* {@link AGENTDEPOSITRECHSYNCRSP }
*
*/
public void setAGENTDEPOSITRECHSYNCRSP(AGENTDEPOSITRECHSYNCRSP value) {
this.agentdepositrechsyncrsp = value;
}
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.util.Date;
import com.ai.uchintService.busi.service.interfaces.IPaymentResultSV;
import com.ai.uchintService.common.bo.TD_M_AREABean;
import com.ai.uchintService.common.bo.TD_M_AREAEngine;
import com.ai.uchintService.common.bo.UCH_TF_CHL_PAY_APPLY_DETAILBean;
import com.ai.uchintService.common.bo.UCH_TF_CHL_PAY_APPLY_DETAILEngine;
import com.ai.uchintService.common.bo.UCH_TF_CHL_SETTLEBean;
import com.ai.uchintService.common.bo.UCH_TF_CHL_SETTLEEngine;
import com.ai.uchintService.common.bo.UCH_TF_CHL_SETTLE_LOGBean;
import com.ai.uchintService.common.bo.UCH_TF_CHL_SETTLE_LOGEngine;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYEngine;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLY_STATEBean;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLY_STATEEngine;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.PAYMENT_LINE_INFOItem;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvInputItem;
import com.ai.uchintService.busi.service.impl.UpdatePaymentResultInfoSVImpl;
public class PaymentResultSVImpl implements IPaymentResultSV {
public UC_TF_CHL_PAY_APPLYBean[] getBeans(String batchId, String lineId,String provinceCode)
throws Exception {
return UC_TF_CHL_PAY_APPLYEngine.getBeans("PAY_BATCH_ID='" + batchId
+ "' and LINE_NO='" + lineId + "' and province_code='"+provinceCode+"'", null);
}
public boolean compareVoucherNumber(
SB_UC_UC_ImportPaymentResultInfoSrvInputItem paymetResultInfoItem,String provinceCode) throws Exception {
UC_TF_CHL_PAY_APPLYBean[] beans;
beans = UC_TF_CHL_PAY_APPLYEngine.getBeans("PAY_BATCH_ID='"
+ paymetResultInfoItem.getBATCH_ID() + "' and province_code='"+provinceCode+"'", null);
if (beans.length <= 0) {
return false;
}
UC_TF_CHL_PAY_APPLYBean applyBean = beans[0];
if (applyBean.getVoucherNumber() == null
|| "".equals(applyBean.getVoucherNumber())) {
return true;
} else if (paymetResultInfoItem.getVOUCHER_NUMBER().equals(
applyBean.getVoucherNumber())) {
return true;
} else {
return false;
}
}
public boolean importPaymentResultInfo(PAYMENT_LINE_INFOItem paymentLINEINFOItem,String auditReturnMessage,Date lateUpdatedate,String voucherNumber,String provinceCode) throws Exception {
UpdatePaymentResultInfoSVImpl updatepay = new UpdatePaymentResultInfoSVImpl();
UC_TF_CHL_PAY_APPLYBean[] beans = null;
int flag = 0;
int haspayed =0;
// try{
//判断如果根据批次号和行信息找不到记录就返回false 如果根据流水号找不到记录也返回false
beans = UC_TF_CHL_PAY_APPLYEngine.getBeans("PAY_BATCH_ID='" + paymentLINEINFOItem.getBATCH_ID()+"' and LINE_NO='"+paymentLINEINFOItem.getLINE_ID()+"' and province_code='"+provinceCode+"'", null);
if (beans.length <= 0) {
flag+=1;
}
//根据支付状态表SERIAL_NO查询支付状态明细表的记录
if(beans.length>0){
UCH_TF_CHL_PAY_APPLY_DETAILBean[] applyDetailBeans = UCH_TF_CHL_PAY_APPLY_DETAILEngine.getBeans("SERIAL_NO='" + beans[0].getSerialNo()+"' and province_code='"+provinceCode+"'", null);
if (applyDetailBeans.length <= 0) {
flag+=1;
}
for(int i=0;i<applyDetailBeans.length;i++ ){
UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetailBean = applyDetailBeans[i];
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
UCH_TF_CHL_SETTLE_LOGBean[] settleLogBean = UCH_TF_CHL_SETTLE_LOGEngine.getBeans("BUSI_SERIAL_NO='" + applyDetailBean.getSerialNo()+"' and province_code='"+provinceCode+"'", null);
if(settleLogBean==null||settleLogBean.length<=0){
UCH_TF_CHL_SETTLEBean[] settleBeans = UCH_TF_CHL_SETTLEEngine.getBeans("PAY_OBJECT_ID='"+applyDetailBean.getPayObjectId()+"' AND BILL_CYCLE="+applyDetailBean.getStatMonth()+" and agent_chnl_id='"+applyDetailBean.getAgentChnlId()+"' and DEPT_TYPE ='"+applyDetailBean.getDeptType()+"' and province_code='"+provinceCode+"'",null);
if(settleBeans.length<=0){
flag+=1;
}
}
}
}
}
if(flag==0){
//修改支付信息表
UC_TF_CHL_PAY_APPLYBean applyBean = beans[0];
//31为作废状态,不操作
if(applyBean.getPayState().equals("31")){
return true;
}
//如果已经支付成功,只作插入 状态表 操作
/**
* add by liangwei 20140528
* 如果支付批已经是审批不通过,报账系统再次回复审批不通过,也只作插入 状态表 操作
*/
if( (applyBean.getPayState().equals("10")&&paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE()))
||
(applyBean.getPayState().equals("3")&&paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_R.equals(paymentLINEINFOItem.getRETURN_TYPE()) )
){
UC_TF_CHL_PAY_APPLY_STATEBean applyStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
applyStateBean.isNew();
applyStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
if(paymentLINEINFOItem.getBILL_NO()!=null){
applyStateBean.setBillNo(Long.parseLong(paymentLINEINFOItem.getBILL_NO()));
}
if(paymentLINEINFOItem.getBATCH_ID()!=null){
applyStateBean.setPayBatchId(paymentLINEINFOItem.getBATCH_ID());
}
if(paymentLINEINFOItem.getLINE_ID()!=null){
applyStateBean.setLineNo(Integer.parseInt(paymentLINEINFOItem.getLINE_ID()));
}
if(paymentLINEINFOItem.getINI_PAY_AMOUNT()!=null){
applyStateBean.setPayMoney(paymentLINEINFOItem.getINI_PAY_AMOUNT().doubleValue());
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyStateBean.setPayState(Constants.RESULT_CODE_STATUS_Y);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_N.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyStateBean.setPayState(Constants.RESULT_CODE_STATUS_N);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_R.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyStateBean.setPayState(Constants.RESULT_CODE_STATUS_R);
}
if(paymentLINEINFOItem.getERROR_MESSAGE()!=null&&paymentLINEINFOItem.getERROR_MESSAGE().length()>0){
applyStateBean.setErrorMsg(paymentLINEINFOItem.getERROR_MESSAGE());
}
if(lateUpdatedate!=null){
applyStateBean.setUpdateDate(CastUtil.date2timestamp(lateUpdatedate));
}
if(applyBean.getPayObjectType()!=null&&applyBean.getPayObjectType().length()<=2){
applyStateBean.setPayObjectType(applyBean.getPayObjectType());
}
if(applyBean.getPayObjectId()!=null){
applyStateBean.setPayObjectId(applyBean.getPayObjectId());
}
UC_TF_CHL_PAY_APPLY_STATEEngine.save(applyStateBean);
return true;
}else{
/**
* add by liangwei 20140528
* 为了 更新apply 表记录为不是31的, 不用appfram bean 方法了,采用 sql 方式 ,将下面代码段注释掉
*/
/*
applyBean.isModified();
if(auditReturnMessage!=null&&auditReturnMessage.length()>0){
applyBean.setUpdateRemark(auditReturnMessage);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyBean.setPayState(Constants.RESULT_CODE_STATUS_Y);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_N.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyBean.setPayState(Constants.RESULT_CODE_STATUS_N);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_R.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyBean.setPayState(Constants.RESULT_CODE_STATUS_R);
}
if(paymentLINEINFOItem.getPAYMENT_DATE()!=null){
applyBean.setPayDate(CastUtil.date2timestamp(paymentLINEINFOItem.getPAYMENT_DATE()));
}
applyBean.setUpdateStaffId(Constants.UPDATE_STAFF_ID_VALUE);
if(lateUpdatedate!=null){
applyBean.setUpdateDate(CastUtil.date2timestamp(lateUpdatedate));
}
if(voucherNumber!=null){
applyBean.setVoucherNumber(voucherNumber);
}
*/
//支付状态记录变更表插入一条新纪录
UC_TF_CHL_PAY_APPLY_STATEBean applyStateBean = new UC_TF_CHL_PAY_APPLY_STATEBean();
applyStateBean.isNew();
applyStateBean.setSerialNo(Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ )));
if(paymentLINEINFOItem.getBILL_NO()!=null){
applyStateBean.setBillNo(Long.parseLong(paymentLINEINFOItem.getBILL_NO()));
}
if(paymentLINEINFOItem.getBATCH_ID()!=null){
applyStateBean.setPayBatchId(paymentLINEINFOItem.getBATCH_ID());
}
if(paymentLINEINFOItem.getLINE_ID()!=null){
applyStateBean.setLineNo(Integer.parseInt(paymentLINEINFOItem.getLINE_ID()));
}
// if(paymentLINEINFOItem.getVENDOR_NUMBER()!=null){
// applyStateBean.setChnlId(getChlbean(paymentLINEINFOItem.getVENDOR_NUMBER()).getChnlId());
// }
if(paymentLINEINFOItem.getINI_PAY_AMOUNT()!=null){
applyStateBean.setPayMoney(paymentLINEINFOItem.getINI_PAY_AMOUNT().doubleValue());
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyStateBean.setPayState(Constants.RESULT_CODE_STATUS_Y);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_N.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyStateBean.setPayState(Constants.RESULT_CODE_STATUS_N);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_R.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyStateBean.setPayState(Constants.RESULT_CODE_STATUS_R);
}
// if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&"R".equals(paymentLINEINFOItem.getRETURN_TYPE())){
// applyStateBean.setErrorMsg(paymentLINEINFOItem.getERROR_MESSAGE());
// }
if(paymentLINEINFOItem.getERROR_MESSAGE()!=null&&paymentLINEINFOItem.getERROR_MESSAGE().length()>0){
applyStateBean.setErrorMsg(paymentLINEINFOItem.getERROR_MESSAGE());
}
// if(paymentLINEINFOItem.getPAYMENT_DATE()!=null){
// applyStateBean.setUpdateDate(CastUtil.date2timestamp(lateUpdatedate));
// }
if(lateUpdatedate!=null){
applyStateBean.setUpdateDate(CastUtil.date2timestamp(lateUpdatedate));
}
if(applyBean.getPayObjectType()!=null&&applyBean.getPayObjectType().length()<=2){
applyStateBean.setPayObjectType(applyBean.getPayObjectType());
}
if(applyBean.getPayObjectId()!=null){
applyStateBean.setPayObjectId(applyBean.getPayObjectId());
}
UC_TF_CHL_PAY_APPLY_STATEEngine.save(applyStateBean);
//根据支付状态明细表的CHNL_ID、AGENT_CHNL_ID、STAT_MONTH找到佣金结算表TF_CHL_SETTLE的CHNL_ID、AGENT_CHNL_ID、STAT_MONTH、BILL_CYCLE
UCH_TF_CHL_PAY_APPLY_DETAILBean[] applyDetailBeans = UCH_TF_CHL_PAY_APPLY_DETAILEngine.getBeans("SERIAL_NO='" + beans[0].getSerialNo()+"' and province_code='"+provinceCode+"'", null);
for(int i=0;i<applyDetailBeans.length;i++ ){
UCH_TF_CHL_PAY_APPLY_DETAILBean applyDetailBean = applyDetailBeans[i];
applyDetailBean.isModified();
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyDetailBean.setPayState(Constants.RESULT_CODE_STATUS_Y);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_N.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyDetailBean.setPayState(Constants.RESULT_CODE_STATUS_N);
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_R.equals(paymentLINEINFOItem.getRETURN_TYPE())){
applyDetailBean.setPayState(Constants.RESULT_CODE_STATUS_R);
}
/**
* add by liangwei 20140528
* 更新apply_detail 表 增加了 2个字段 UpdateStaffId、UpdateDate
*/
applyDetailBean.setUpdateStaffId(Constants.UPDATE_STAFF_ID_VALUE);
if(lateUpdatedate!=null){
applyDetailBean.setUpdateDate(CastUtil.date2timestamp(lateUpdatedate));
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
UCH_TF_CHL_SETTLE_LOGBean[] settleLogBean = UCH_TF_CHL_SETTLE_LOGEngine.getBeans("BUSI_SERIAL_NO='" + applyDetailBean.getSerialNo()+"' and PAY_OBJECT_ID='"+applyDetailBean.getPayObjectId()+"' and BILL_CYCLE='"+applyDetailBean.getStatMonth()+"' and agent_chnl_id='"+applyDetailBean.getAgentChnlId()+"' and DEPT_TYPE='"+applyDetailBean.getDeptType()+"' and province_code='"+provinceCode+"' and fee_type='"+applyDetailBean.getFeeType()+"' and pay_type='"+applyDetailBean.getPayType()+"'", null);
if(settleLogBean==null||settleLogBean.length<=0){//如果支付成功但结算日志表不存在记录则更新日志表以及结算表
/**
* add by liangwei 20140527
* 更新 settle 表 增加了 3个字段 settle_type、city_code、agent_pro_code
*/
//UCH_TF_CHL_SETTLEBean[] settleBeans = UCH_TF_CHL_SETTLEEngine.getBeans("PAY_OBJECT_ID='"+applyDetailBean.getPayObjectId()+"' AND BILL_CYCLE="+applyDetailBean.getStatMonth()+" and agent_chnl_id='"+applyDetailBean.getAgentChnlId()+"' and DEPT_TYPE ='"+applyDetailBean.getDeptType()+"' and province_code='"+provinceCode+"'",null);
UCH_TF_CHL_SETTLEBean[] settleBeans = UCH_TF_CHL_SETTLEEngine.getBeans("PAY_OBJECT_ID='"+applyDetailBean.getPayObjectId()+"' AND BILL_CYCLE="+applyDetailBean.getStatMonth()+" and agent_chnl_id='"+applyDetailBean.getAgentChnlId()+"' and DEPT_TYPE ='"+applyDetailBean.getDeptType()+"' and province_code='"+provinceCode+"' and settle_type='"+applyDetailBean.getSettleType()+"' and city_code ='"+applyDetailBean.getCityCode()+"' and agent_pro_code='"+applyDetailBean.getAgentProCode()+"' and fee_type='"+applyDetailBean.getFeeType()+"' and pay_type='"+applyDetailBean.getPayType()+"'",null);
UCH_TF_CHL_SETTLEBean settleBean = settleBeans[0];
UCH_TF_CHL_SETTLE_LOGBean settleLogBean2 = new UCH_TF_CHL_SETTLE_LOGBean();//结算日志表插入一条记录
settleLogBean2.isNew();
settleLogBean2.setChnlCommId(settleBean.getChnlCommId());
settleLogBean2.setPayObjectType(settleBean.getPayObjectType());
settleLogBean2.setPayObjectId(settleBean.getPayObjectId());
settleLogBean2.setProvinceCode(settleBean.getProvinceCode());
settleLogBean2.setCityCode(settleBean.getCityCode());
settleLogBean2.setAgentChnlId(settleBean.getAgentChnlId());
settleLogBean2.setAgentProCode(settleBean.getAgentProCode());
settleLogBean2.setAgentCityCode(settleBean.getAgentCityCode());
settleLogBean2.setDeptType(settleBean.getDeptType());
settleLogBean2.setBillCycle(settleBean.getBillCycle());
settleLogBean2.setAmount(settleBean.getAmount());
settleLogBean2.setAmountAdd(0);
settleLogBean2.setPayedAmountAdd(paymentLINEINFOItem.getINI_PAY_AMOUNT().doubleValue());
settleLogBean2.setPayedAmount(settleBean.getPayedAmount());
settleLogBean2.setPayedTaxAdd(applyDetailBean.getPayStatMoney()-applyDetailBean.getPayMoney());
settleLogBean2.setPayedTax(settleBean.getPayedTax());
settleLogBean2.setBusiSerialNo(applyDetailBean.getSerialNo()+"");
settleLogBean2.setBusiId("1000010002");
settleLogBean2.setOperTime(CastUtil.date2timestamp(new Date()));
settleLogBean2.setOperStaffId(applyBean.getPayStaffId());
settleLogBean2.setBackFlag(0);
settleLogBean2.setBackSerialNo("0");
settleLogBean2.setFeeType(settleBean.getFeeType());
settleLogBean2.setPayType(settleBean.getPayType());
UCH_TF_CHL_SETTLE_LOGEngine.save(settleLogBean2);
settleBean.isModified();
double payedAmount = settleBean.getPayedAmount()+applyDetailBean.getPayMoney();
settleBean.setPayedAmount(payedAmount);
double payedTax = settleBean.getPayedTax()+(applyDetailBean.getPayStatMoney()-applyDetailBean.getPayMoney());
settleBean.setPayedTax(payedTax);
/**
* add by zhangfan 20131125
* for pay
* new beingpayamount = old beingpayamount - paystatamount;
* 如果settletype==0 为日记月结,则更新,如果为日记周结,则不更新
*/
if(settleBean.getSettleType()==0){
settleBean.setBeingPayAmount(settleBean.getBeingPayAmount()-applyDetailBean.getPayStatMoney());
UCH_TF_CHL_SETTLEEngine.save(settleBean);
}
applyDetailBean.setHasPayed(1);
//applyBean.setHasPayed(1);
haspayed =1;
}
}
UCH_TF_CHL_PAY_APPLY_DETAILEngine.save(applyDetailBean);
}
/**
* add by liangwei 20140528
* 为了 更新apply 表记录为不是31的, 不用appfram bean 方法了,采用 sql 方式 ,将下面代码注释掉 ,并修改
*/
UC_TF_CHL_PAY_APPLYEngine.save(applyBean);
updatepay.saveApplyInfo(applyBean,paymentLINEINFOItem, auditReturnMessage, provinceCode, haspayed, lateUpdatedate, voucherNumber);
return true;
}
}else{
return false;
}
// }catch(Exception e){
// throw new SystemException(e.getMessage(), e);
// }
}
public boolean changeAreaCode(String areaCode) throws Exception {
TD_M_AREABean[] areas = TD_M_AREAEngine.getBeans("(parent_area_code='"+Constants.TD_M_AREA_09+"' or parent_area_code is null) and area_code='"+areaCode+"'",null);
if(areas.length>0){
return true;
}
return false;
}
}<file_sep>package com.ai.uchintService.busi.service.interfaces;
import com.unicom.wouchannel.inquiryagentauditinfosrv.InquiryAgentAuditInfoSrvINMSGCONTENT;
import com.unicom.wouchannel.inquiryagentauditinfosrv.ResponseMSGCONTENT;
public interface IInquiryAgentAuditInfoSrv {
public ResponseMSGCONTENT inquiryAgentAuditInfo(InquiryAgentAuditInfoSrvINMSGCONTENT inputItem) throws Exception;
}
<file_sep>package com.ai.uchintService.timer;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimerTask;
import com.ai.appframe2.common.ServiceManager;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.cuframe.util.DateUtils;
import com.ai.uchintService.common.bo.UC_DEFAULT_PARAMBean;
import com.ai.uchintService.common.bo.UC_QUERY_TIMEBean;
import com.ai.uchintService.common.bo.UC_QUERY_TIMEEngine;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uip.core.bo.UipAccessSystemBean;
import com.ai.uip.core.bo.UipAccessSystemEngine;
import com.ai.uip.core.bo.UipSubjectBean;
import com.ai.uip.core.bo.UipSubjectEngine;
import com.ai.uip.core.bo.UipSyncRecordBean;
import com.ai.uip.platform.service.interfaces.IUipSyncRecordSV;
import com.ai.uip.ws.comm.Constants;
public class QueryStatusTimerTask extends TimerTask{
private UC_DEFAULT_PARAMBean[] paramBeans ;
private long sleepTime =0;
private int areaSpace=0;
public long getSleepTime() {
return sleepTime;
}
public void setSleepTime(long sleepTime) {
this.sleepTime = sleepTime;
}
public int getAreaSpace() {
return areaSpace;
}
public void setAreaSpace(int areaSpace) {
this.areaSpace = areaSpace;
}
@Override
public void run() {
//取得上次跑的时间
Date runTime = new Date();
Date nowTime = new Date();
long preTime = 120;//每次取时间间隔2个小时的
try {
ServiceManager.getSession().startTransaction();
UC_QUERY_TIMEBean queryBean =UC_QUERY_TIMEEngine.getBean("queryStatus");
ServiceManager.getSession().commitTransaction();
if(queryBean!=null&&queryBean.getParamValue()!=null){
runTime = CastUtil.str2Date(queryBean.getParamValue());
}
//判断上次跑的时间加2个小时是否大于当前时间
Date tempDate = CastUtil.getPreTimeForMin(runTime,preTime);
while(!CastUtil.isDateBefore(nowTime,tempDate)){
System.out.println(tempDate);
insData(tempDate);
tempDate =CastUtil.getPreTimeForMin(tempDate,preTime);
}
// ServiceManager.getSession().commitTransaction();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public UC_DEFAULT_PARAMBean[] getParamBeans() {
return paramBeans;
}
public void setParamBeans(UC_DEFAULT_PARAMBean[] paramBeans) {
this.paramBeans = paramBeans;
}
public void insData(Date tempDate){
int areaNum=0;
try {
Date temp1Date = CastUtil.getPreTimeForMin(tempDate,-120);
Date temp2Date= tempDate;
List<String> recordList = new ArrayList<String>();
for(int i=0;i<paramBeans.length;i++){
recordList.add(paramBeans[i].getParamValue());
}
// for(int i=0;i<paramBeans.length;i++){
// if(areaNum<areaSpace){
// areaNum++;
// }else{
// Thread.sleep(sleepTime);
// areaNum=0;
// continue;
// }
// ServiceManager.getSession().startTransaction();
// UipSyncRecordBean uipSyncRecordBean = new UipSyncRecordBean();
// uipSyncRecordBean.setSubjectId(502);
// uipSyncRecordBean.setMonth(DateUtils.getDateString().substring(0,6));
// uipSyncRecordBean.setContentKind("04");
// uipSyncRecordBean.setBatchNo(1);
// uipSyncRecordBean.setState(Constants.UIP_SYNC_RECORD_STATE_00);
// uipSyncRecordBean.setInsertTime(new java.sql.Timestamp(new Date().getTime()));
// uipSyncRecordBean.setStateTime(new java.sql.Timestamp(new Date().getTime()));
// uipSyncRecordBean.setLockStatus(0);
// uipSyncRecordBean.setProvinceCode("502");
// IUipSyncRecordSV uipSyncRecordSV = (IUipSyncRecordSV) ServiceFactory.getService(IUipSyncRecordSV.class);
// uipSyncRecordBean.setProvinceCode(paramBeans[i].getParamValue());
// String ContentId="_"+paramBeans[i].getParamValue()+"_"+CastUtil.dateToStr3(CastUtil.getPreTimeForMin(temp1Date,-30))+"_"+CastUtil.dateToStr3(temp2Date);
// uipSyncRecordBean.setContentId(ContentId);
// uipSyncRecordSV.add(uipSyncRecordBean);
// System.out.println(new Date()+"---"+paramBeans[i].getParamValue());
// ServiceManager.getSession().commitTransaction();
// }
while(recordList.size()>0){
if(areaNum<areaSpace){
areaNum++;
}else{
Thread.sleep(sleepTime);
areaNum=0;
continue;
}
ServiceManager.getSession().startTransaction();
UipSyncRecordBean uipSyncRecordBean = new UipSyncRecordBean();
uipSyncRecordBean.setSubjectId(502);
uipSyncRecordBean.setMonth(DateUtils.getDateString().substring(0,6));
uipSyncRecordBean.setContentKind("04");
uipSyncRecordBean.setBatchNo(1);
uipSyncRecordBean.setState(Constants.UIP_SYNC_RECORD_STATE_00);
uipSyncRecordBean.setInsertTime(new java.sql.Timestamp(new Date().getTime()));
uipSyncRecordBean.setStateTime(new java.sql.Timestamp(new Date().getTime()));
uipSyncRecordBean.setLockStatus(0);
uipSyncRecordBean.setProvinceCode("502");
IUipSyncRecordSV uipSyncRecordSV = (IUipSyncRecordSV) ServiceFactory.getService(IUipSyncRecordSV.class);
uipSyncRecordBean.setProvinceCode(recordList.get(0));
String ContentId="_"+recordList.get(0)+"_"+CastUtil.dateToStr3(CastUtil.getPreTimeForMin(temp1Date,-30))+"_"+CastUtil.dateToStr3(temp2Date);
uipSyncRecordBean.setContentId(ContentId);
uipSyncRecordSV.add(uipSyncRecordBean);
System.out.println(new Date()+"---"+recordList.get(0));
ServiceManager.getSession().commitTransaction();
recordList.remove(0);
}
ServiceManager.getSession().startTransaction();
UC_QUERY_TIMEBean queryBean =UC_QUERY_TIMEEngine.getBean("queryStatus");
queryBean.isModified();
// queryBean.setParamValue(CastUtil.date2timestamp(temp2Date));
queryBean.setParamValue(CastUtil.dateToStr3(temp2Date));
UC_QUERY_TIMEEngine.save(queryBean);
ServiceManager.getSession().commitTransaction();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package com.unicom.mss.sb_eip_eip_importpartnerinfosrv;
import java.util.HashMap;
import java.util.logging.Logger;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.recif.IRecIfProcessorSRV;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-06-26T10:29:25.709+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "SB_EIP_EIP_ImportPartnerInfoSrv",
portName = "SB_EIP_EIP_ImportPartnerInfoSrvPort",
targetNamespace = "http://mss.unicom.com/SB_EIP_EIP_ImportPartnerInfoSrv",
wsdlLocation = "classpath:wsdl/SB_EIP_EIP_ImportPartnerInfoSrv/SB_EIP_EIP_ImportPartnerInfoSrv.wsdl",
endpointInterface = "com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SBEIPEIPImportPartnerInfoSrv")
public class SBEIPEIPImportPartnerInfoSrvImpl implements SBEIPEIPImportPartnerInfoSrv {
private static final Logger LOG = Logger.getLogger(SBEIPEIPImportPartnerInfoSrvImpl.class.getName());
/* (non-Javadoc)
* @see com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SBEIPEIPImportPartnerInfoSrv#process(com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvRequest payload )*
*/
public com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvResponse process(SB_EIP_EIP_ImportPartnerInfoSrvRequest payload) {
LOG.info("Executing operation process");
System.out.println(payload);
try {
IRecIfProcessorSRV recIfProcessorSRV = (IRecIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.SB_UC_UC_ImportPartnerInfoSrv, payload);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvResponse _return = (com.unicom.mss.sb_eip_eip_importpartnerinfosrv.SB_EIP_EIP_ImportPartnerInfoSrvResponse)map.get(Constants.MapResult.MAP_RESULTOBJ);;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface ITF_CHL_INVOICE_PACKAGEValue extends DataStructInterface {
public final static String S_AcctMonth = "ACCT_MONTH";
public final static String S_OrgName = "ORG_NAME";
public final static String S_InsertTime = "INSERT_TIME";
public final static String S_SumPureAmount = "SUM_PURE_AMOUNT";
public final static String S_TotalInvoice = "TOTAL_INVOICE";
public final static String S_SumTaxAmount = "SUM_TAX_AMOUNT";
public final static String S_VoucherNo = "VOUCHER_NO";
public final static String S_SumTotalAmount = "SUM_TOTAL_AMOUNT";
public final static String S_RequestId = "REQUEST_ID";
public final static String S_Status = "STATUS";
public final static String S_SetOfBooksId = "SET_OF_BOOKS_ID";
public final static String S_OrgId = "ORG_ID";
public final static String S_TotalBatch = "TOTAL_BATCH";
public final static String S_LastUpdateTime = "LAST_UPDATE_TIME";
public final static String S_PackageId = "PACKAGE_ID";
public final static String S_ProvinceCode = "PROVINCE_CODE";
public final static String S_AccountingDate = "ACCOUNTING_DATE";
public final static String S_SetOfBooksName = "SET_OF_BOOKS_NAME";
public final static String S_Attribute1 = "ATTRIBUTE1";
public String getAcctMonth();
public String getAttribute1();
public void setAttribute1(String value);
public String getSetOfBooksName();
public void setSetOfBooksName(String value);
public String getOrgName();
public Timestamp getInsertTime();
public Float getSumPureAmountAsFloat();
public float getSumPureAmount();
public Long getTotalInvoiceAsLong();
public long getTotalInvoice();
public Float getSumTaxAmountAsFloat();
public float getSumTaxAmount();
public String getVoucherNo();
public Float getSumTotalAmountAsFloat();
public float getSumTotalAmount();
public String getRequestId();
public String getStatus();
public String getSetOfBooksId();
public Long getOrgIdAsLong();
public long getOrgId();
public Long getTotalBatchAsLong();
public long getTotalBatch();
public Timestamp getLastUpdateTime();
public String getPackageId();
public String getProvinceCode();
public Timestamp getAccountingDate();
public void setAcctMonth(String value);
public void setOrgName(String value);
public void setInsertTime(Timestamp value);
public void setSumPureAmount(Float value);
public void setSumPureAmount(float value);
public void setTotalInvoice(Long value);
public void setTotalInvoice(long value);
public void setSumTaxAmount(Float value);
public void setSumTaxAmount(float value);
public void setVoucherNo(String value);
public void setSumTotalAmount(Float value);
public void setSumTotalAmount(float value);
public void setRequestId(String value);
public void setStatus(String value);
public void setSetOfBooksId(String value);
public void setOrgId(Long value);
public void setOrgId(long value);
public void setTotalBatch(Long value);
public void setTotalBatch(long value);
public void setLastUpdateTime(Timestamp value);
public void setPackageId(String value);
public void setProvinceCode(String value);
public void setAccountingDate(Timestamp value);
}
<file_sep>package com.ai.uchintService.ejb.paramImpl.precheckResult;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgcancelnotifyreq.CHANNEL_INFO_CHG_CANCEL_NOTIFY_REQ;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgcancelnotifyrsp.CHANNEL_INFO_CHG_CANCEL_NOTIFY_RSP;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD.ROUTING;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgCancelNotifyReqVO;
import com.ai.uchintService.ejb.VO.ChannelInfo.ChannelInfoChgCancelNotifyRspVO;
import com.ai.uchintService.ejb.VO.precheckResult.PrecheckResultReqVO;
import com.ai.uint.ejb.interfaces.IUipParamImplForSendSV;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ejb.util.ResultMsg;
import com.ai.uint.paramsMang.vo.PublishCfgVo;
/*
* 渠道信息修改变更通知
*/
public class ChannelInfoChgCancelNotifyImpl implements IUipParamImplForSendSV{
ChannelInfoChgCancelNotifyReqVO reqVO;
ChannelInfoChgCancelNotifyRspVO rspVO;
public ChannelInfoChgCancelNotifyImpl(){
rspVO = new ChannelInfoChgCancelNotifyRspVO();
}
@Override
public Map<String, Object> getRecordData(Object inputParam) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
if (inputParam instanceof PrecheckResultReqVO) {
reqVO = (ChannelInfoChgCancelNotifyReqVO)inputParam;
} else {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG,"类型匹配错误:"+inputParam.getClass().getName());
return retMap;
}
boolean flag = true;
String resultMsg = "";
if(reqVO.getCHNL_CODE() == null){
resultMsg = "chnlCODE 为空";
flag = false;
}
if (!flag) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
retMap.put(Constants.ResultMap.ResultKey.RESULT_MSG,resultMsg);
return retMap;
}
List<String> retContentId = new ArrayList<String>();
retContentId.add(reqVO.getCHNL_CODE());
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ,retContentId);
return retMap;
}
@Override
public Map<String, Object> getReqMsg(List<String> contentList,
Map<String, Long> detailMap, Long sendID, PublishCfgVo cfgVo) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT presultinput = new CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT();
UNI_BSS_HEAD uniBssHead = new UNI_BSS_HEAD();
//报文头
uniBssHead.setORIG_DOMAIN("000000");
uniBssHead.setSERVICE_NAME("BSdmChannelInfoSer");
uniBssHead.setOPERATE_NAME("channelInfoChgCancelNotify");
uniBssHead.setACTION_CODE("0");
uniBssHead.setACTION_RELATION("0");
ROUTING routing = new UNI_BSS_HEAD.ROUTING();
routing.setROUTE_TYPE("00");
routing.setROUTE_VALUE("09");
uniBssHead.setROUTING(routing);
uniBssHead.setPROC_ID(""+sendID);
uniBssHead.setTRANS_IDO(""+sendID);
uniBssHead.setPROCESS_TIME(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
UNI_BSS_HEAD.COM_BUS_INFO comBUSINFO = new UNI_BSS_HEAD.COM_BUS_INFO();
comBUSINFO.setOPER_ID("UCHL");
comBUSINFO.setPROVINCE_CODE("09");
comBUSINFO.setCHANNEL_ID("A1000");
comBUSINFO.setACCESS_TYPE("01");
comBUSINFO.setORDER_TYPE("01");
comBUSINFO.setCHANNEL_TYPE("2010101");
uniBssHead.setCOM_BUS_INFO(comBUSINFO);
UNI_BSS_HEAD.SP_RESERVE spRESERVE = new UNI_BSS_HEAD.SP_RESERVE();
spRESERVE.setTRANS_IDC(""+sendID);
SimpleDateFormat formatter8 = new SimpleDateFormat("yyyy-MM-dd");
spRESERVE.setCUTOFFDAY(formatter8.format(new Date(System.currentTimeMillis())));
spRESERVE.setOSNDUNS("0700");
spRESERVE.setHSNDUNS("0000");
SimpleDateFormat formatter17 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
spRESERVE.setCONV_ID(formatter17.format(new Date(System.currentTimeMillis())));
uniBssHead.setSP_RESERVE(spRESERVE);
uniBssHead.setTEST_FLAG("0");
uniBssHead.setMSG_SENDER("0700");
uniBssHead.setMSG_RECEIVER("0000");
//生成HEAD
presultinput.setUNI_BSS_HEAD(uniBssHead);
CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT.UNI_BSS_BODY uniBssBody = new CHANNEL_INFO_CHG_CANCEL_NOTIFY_INPUT.UNI_BSS_BODY();
CHANNEL_INFO_CHG_CANCEL_NOTIFY_REQ retreq = new CHANNEL_INFO_CHG_CANCEL_NOTIFY_REQ();
for(int i=0;i<contentList.size();i++) {
if (reqVO.getCHNL_CODE().equals(contentList.get(i))) {
retreq.setCHNL_CODE(reqVO.getCHNL_CODE());
retreq.setOPERATE_TYPE(reqVO.getOPERATE_TYPE());
break;
}
}
uniBssBody.setCHANNEL_INFO_CHG_CANCEL_NOTIFY_REQ(retreq);
presultinput.setUNI_BSS_BODY(uniBssBody);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, presultinput);
return retMap;
}
@Override
public void setSubsInfo(List<String> contentList, PublishCfgVo cfgVo) {
// TODO Auto-generated method stub
}
@Override
public Map<String, Object> getOutParam() {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, rspVO);
return retMap;
}
@Override
public Map<String, Object> handleRespMsg(List<String> contentList,
PublishCfgVo cfgVo, Object respObject, String resultDesc) {
Map<String, Object> retMap = new HashMap<String, Object>();
List<ResultMsg> retList = new ArrayList<ResultMsg>();
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS);
if (respObject == null) {
retMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
} else {
String strResultCode = Constants.StateDef.FAIL;
String strResultDesc = "";
CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT output = (CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT)respObject;
UNI_BSS_HEAD uniBSSHEAD = output.getUNI_BSS_HEAD();
if (uniBSSHEAD == null)
{
//包头为空,返回错误
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "对端返回UNI_BSS_HEAD为空";
}
else
{
UNI_BSS_HEAD.RESPONSE response = uniBSSHEAD.getRESPONSE();
if (response == null)
{
//包头RESPONSE节点为空,返回错误
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "对端返回UNI_BSS_HEAD的RESPONSE节点为空";
}
else
{
if (response.getRSP_CODE() == null)
{
//包头错误
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "对端返回UNI_BSS_HEAD的RESPONSE的RSP_CODE节点为空";
}
else
{
if (response.getRSP_CODE().equals("0000"))
{
//传输正确且业务成功
strResultCode = Constants.StateDef.SUCCESS;
strResultDesc = "处理成功";
}
else if (response.getRSP_CODE().equals("9999"))
{
//传输正确而业务错误,需要查询UNI_BSS_BODY节点
CHANNEL_INFO_CHG_CANCEL_NOTIFY_OUTPUT.UNI_BSS_BODY uniBSSBODY = output.getUNI_BSS_BODY();
if (uniBSSBODY == null)
{
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,对端返回UNI_BSS_BODY节点为空";
}
else
{
CHANNEL_INFO_CHG_CANCEL_NOTIFY_RSP precheckResultRsp = uniBSSBODY.getCHANNEL_INFO_CHG_CANCEL_NOTIFY_RSP();
if (precheckResultRsp == null)
{
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,对端返回UNI_BSS_BODY节点的PRECHECK_RESULT_RSP节点为空";
}
else
{
if (precheckResultRsp.getRESP_CODE() == null)
{
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,对端返回UNI_BSS_BODY节点的PRECHECK_RESULT_RSP节点的RESP_CODE节点为空";
}
else
{
String bodyRespDesc = "";
if (precheckResultRsp.getRESP_DESC() != null) bodyRespDesc = precheckResultRsp.getRESP_DESC();
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "业务错误,错误代码:"+precheckResultRsp.getRESP_CODE()+",错误描述:"+bodyRespDesc;
}
}
}
}
else
{
//传输错误
String rspDesc = "";
if (response.getRSP_DESC() != null) rspDesc = response.getRSP_DESC();
strResultCode = Constants.StateDef.FAIL;
strResultDesc = "传输错误,错误代码:"+response.getRSP_CODE()+",错误描述:"+rspDesc;
}
}
}
}
//返回框架报文解析信息
for (int i=0;i<contentList.size();i++) {
ResultMsg resultMsg = new ResultMsg();
resultMsg.setContentId(contentList.get(i));
resultMsg.setResultCode(strResultCode);
resultMsg.setResultDesc(strResultDesc);
retList.add(resultMsg);
}
//记录报文解析信息
rspVO.setRESP_CODE(strResultCode);
rspVO.setRESP_DESC(strResultDesc);
retMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, retList);
}
return retMap;
}
}
<file_sep>package com.ai.uchintService.ejb.paramImpl.departmentInfoSrv;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_INPUT;
import cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_OUTPUT;
import cn.chinaunicom.ws.departmentinfoser.unibssbody.departmentinforeq.DEPARTMENT_INFO_REQ;
import cn.chinaunicom.ws.departmentinfoser.unibssbody.departmentinforsp.DEPARTMENT_INFO_RSP;
import cn.chinaunicom.ws.unibssattached.UNI_BSS_ATTACHED;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
import com.ai.uchintService.ejb.impl.GenSdm2BHeaderImpl;
import com.ai.uint.ejb.util.CommonUtil;
import com.ai.uint.ejb.util.Constants;
import com.ai.uint.ws.interfaces.IWsSrvBusiServiceSV;
import com.ailk.uchannel.datasyncdepart.interfaces.IDataSyncDepartRemoteSV;
import com.ailk.uchannel.datasyncdepart.param.TdMDepartRequestVo;
import com.ailk.uchannel.datasyncdepart.param.TdMDepartResponseVo;
import com.ailk.uchannel.datasyncdepart.param.TdMDepartVo;
public class DepartmentInfoSrvImpl implements IWsSrvBusiServiceSV {
private static final String EJB_SV_DEF_DEPART_INFO_SYNC = "DEPART_INFO_SYNC";
@Override
public Map execute(Object inputParam, Long logId) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_INPUT parameters = (cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_INPUT)inputParam;
//返回日志信息
resultMap.put(Constants.SrvReceiveMap.SYSTEM_ID, "250");
resultMap.put(Constants.SrvReceiveMap.SERVICE_NO, parameters.getUNI_BSS_HEAD().getTRANS_IDH());
resultMap.put(Constants.SrvReceiveMap.BUSI_DATA_ID, parameters.getUNI_BSS_BODY().getDEPARTMENT_INFO_REQ().getDEPART_CODE());
resultMap.put(Constants.SrvReceiveMap.REQ_DATA_CNT, 1);
//ws请求报文转换成EJB调用的入参
TdMDepartRequestVo reqVo = getReqVo(parameters, logId);
//调用前台EJB服务
IDataSyncDepartRemoteSV ejbProcessor = (IDataSyncDepartRemoteSV)CommonUtil.getEjbsv(EJB_SV_DEF_DEPART_INFO_SYNC);
if (ejbProcessor == null) throw new Exception("look up " + EJB_SV_DEF_DEPART_INFO_SYNC + "失败");
TdMDepartResponseVo respVo = ejbProcessor.execute(reqVo);
//生成返回报文
cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_OUTPUT respObj = getRespObj(parameters, respVo, logId);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, respObj.getUNI_BSS_BODY().getDEPARTMENT_INFO_RSP().getRESP_CODE().equals("0000")?Constants.ResultMap.ResultCode.RESULT_CODE_SUCCESS:Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, "处理成功");
resultMap.put(Constants.ResultMap.ResultKey.RESULT_OBJ, respObj);
//返回日志信息
resultMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 1);
resultMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 0);
} catch (java.lang.Exception ex) {
ex.printStackTrace();
resultMap.put(Constants.ResultMap.ResultKey.RESULT_CODE, Constants.ResultMap.ResultCode.RESULT_CODE_FAIL);
resultMap.put(Constants.ResultMap.ResultKey.RESULT_MSG, ex.getMessage());
//返回日志信息
resultMap.put(Constants.SrvReceiveMap.SUCCESS_DATA_CNT, 0);
resultMap.put(Constants.SrvReceiveMap.FAIL_DATA_CNT, 1);
}
return resultMap;
}
private DEPARTMENT_INFO_OUTPUT getRespObj(DEPARTMENT_INFO_INPUT parameters, TdMDepartResponseVo respVo, Long logId) throws Exception {
cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_OUTPUT respObj = new cn.chinaunicom.ws.departmentinfoser.unibssbody.DEPARTMENT_INFO_OUTPUT();
//生成报文头
UNI_BSS_HEAD respHead = GenSdm2BHeaderImpl.genSdm2BHeader(parameters.getUNI_BSS_HEAD(), logId, "0", respVo.getResultCode().equals("1") ? "0000" : "8888", respVo.getResultCode());
respObj.setUNI_BSS_HEAD(respHead);
//生成报文体
DEPARTMENT_INFO_OUTPUT.UNI_BSS_BODY respBody = new DEPARTMENT_INFO_OUTPUT.UNI_BSS_BODY();
DEPARTMENT_INFO_RSP respInfo = new DEPARTMENT_INFO_RSP();
respInfo.setDEPART_CODE(parameters.getUNI_BSS_BODY().getDEPARTMENT_INFO_REQ().getDEPART_CODE());
respInfo.setRESP_CODE(respVo.getResultCode().equals("1") ? "0000" : "8888");
respInfo.setRESP_DESC(respVo.getResultDesc());
respBody.setDEPARTMENT_INFO_RSP(respInfo);
respObj.setUNI_BSS_BODY(respBody);
//生成ATTACHED节点
UNI_BSS_ATTACHED attache = new UNI_BSS_ATTACHED();
attache.setMEDIA_INFO("");
respObj.setUNI_BSS_ATTACHED(attache);
return respObj;
}
private TdMDepartRequestVo getReqVo(DEPARTMENT_INFO_INPUT parameters,long logId) throws Exception{
DEPARTMENT_INFO_REQ req = parameters.getUNI_BSS_BODY().getDEPARTMENT_INFO_REQ();
TdMDepartRequestVo repVo = new TdMDepartRequestVo();
repVo.setOperateType(req.getOPERATE_TYPE());
TdMDepartVo vo = new TdMDepartVo();
vo.setLogId(logId);
if (req.getADDR() != null) {
vo.setAddr(req.getADDR());
}
if (req.getADMIN_DEPART_CODE() != null) {
vo.setAdminDepartId(req.getADMIN_DEPART_CODE()) ;
}
if (req.getCITY_CODE() != null) {
vo.setCityCode(req.getCITY_CODE());
}
if (req.getDEPART_CODE() != null) {
vo.setDepartCode(req.getDEPART_CODE());
vo.setDepartId(req.getDEPART_CODE());
}
if (req.getDEPART_DISPLAY_NAME() != null) {
vo.setDepartDisplayName(req.getDEPART_DISPLAY_NAME());
}
if (req.getDEPART_FRAME() != null) {
vo.setDepartFrame(req.getDEPART_FRAME());
}
if (req.getDEPART_KIND_TYPE() != null) {
vo.setDepartKindType(req.getDEPART_KIND_TYPE());
}
if (req.getDEPART_LEVEL() != null) {
vo.setDepartLevel(Integer.parseInt(req.getDEPART_LEVEL()));
}
if (req.getDEPART_NAME() != null) {
vo.setDepartName(req.getDEPART_NAME());
}
if (req.getEND_DATE() != null) {
vo.setEndDate(new Timestamp(new SimpleDateFormat("yyyyMMdd").parse(req.getEND_DATE()).getTime()));
}
if (req.getEPARCHY_CODE() != null) {
vo.setEparchyCode(req.getEPARCHY_CODE());
}
if (req.getORDER_NO() != null) {
vo.setOrderNo(Integer.parseInt(req.getORDER_NO().toString()));
}
if (req.getPARENT_DEPART_CODE() != null) {
vo.setParentDepartId(req.getPARENT_DEPART_CODE());
}
if (req.getZIP_CODE() != null) {
vo.setZipCode(req.getZIP_CODE());
}
if (req.getVALIDFLAG() != null) {
vo.setValidflag(req.getVALIDFLAG());
}
if (req.getTEL() != null) {
vo.setTel(req.getTEL());
}
if (req.getSTART_DATE() != null) {
vo.setStartDate(new Timestamp(new SimpleDateFormat("yyyyMMdd").parse(req.getSTART_DATE()).getTime()));
}
if (req.getREMARK() != null) {
vo.setRemark(req.getREMARK());
}
if (req.getPROVINCE_CODE() != null) {
vo.setProvinceCode(req.getPROVINCE_CODE());
}
repVo.setTdMDepartVo(vo);
return repVo;
}
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,AreaInfoPrecheckSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,AreaInfoPrecheckSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,AreaInfoPrecheckSchema.xsd
areaInfoPrecheck,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.ITF_CHL_AGENT_AGREEMENT_RELValue;
public class TF_CHL_AGENT_AGREEMENT_RELBean extends DataContainer implements DataContainerInterface,ITF_CHL_AGENT_AGREEMENT_RELValue{
private static String m_boName = "bo.TF_CHL_AGENT_AGREEMENT_REL";
public final static String S_RelId = "REL_ID";
public final static String S_IsMainSign = "IS_MAIN_SIGN";
public final static String S_AgreeId = "AGREE_ID";
public final static String S_AgentId = "AGENT_ID";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public TF_CHL_AGENT_AGREEMENT_RELBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initRelId(long value){
this.initProperty(S_RelId,new Long(value));
}
public void setRelId(long value){
this.set(S_RelId,new Long(value));
}
public void setRelId(Long value){
this.set(S_RelId,value);
}
public Long getRelIdAsLong(){
return (Long )this.get(S_RelId);
}
public void setRelIdNull(){
this.set(S_RelId,null);
}
public long getRelId(){
return DataType.getAsLong(this.get(S_RelId));
}
public long getRelIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_RelId));
}
public void initIsMainSign(String value){
this.initProperty(S_IsMainSign,value);
}
public void setIsMainSign(String value){
this.set(S_IsMainSign,value);
}
public void setIsMainSignNull(){
this.set(S_IsMainSign,null);
}
public String getIsMainSign(){
return DataType.getAsString(this.get(S_IsMainSign));
}
public String getIsMainSignInitialValue(){
return DataType.getAsString(this.getOldObj(S_IsMainSign));
}
public void initAgreeId(long value){
this.initProperty(S_AgreeId,new Long(value));
}
public void setAgreeId(long value){
this.set(S_AgreeId,new Long(value));
}
public void setAgreeId(Long value){
this.set(S_AgreeId,value);
}
public Long getAgreeIdAsLong(){
return (Long )this.get(S_AgreeId);
}
public void setAgreeIdNull(){
this.set(S_AgreeId,null);
}
public long getAgreeId(){
return DataType.getAsLong(this.get(S_AgreeId));
}
public long getAgreeIdInitialValue(){
return DataType.getAsLong(this.getOldObj(S_AgreeId));
}
public void initAgentId(String value){
this.initProperty(S_AgentId,value);
}
public void setAgentId(String value){
this.set(S_AgentId,value);
}
public void setAgentIdNull(){
this.set(S_AgentId,null);
}
public String getAgentId(){
return DataType.getAsString(this.get(S_AgentId));
}
public String getAgentIdInitialValue(){
return DataType.getAsString(this.getOldObj(S_AgentId));
}
}
<file_sep>
package cn.chinaunicom.ws.staffinfoser.unibssbody.staffinforeq;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="OPERATE_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_NO">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_NO_OLD" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_PNAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_CLASS" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_TYPE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DEPART_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CHNL_CODE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="7"/>
* <minLength value="7"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MANAGER_INFO" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SEX">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="USER_PID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="18"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="SERIAL_NUMBER" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTACT_TEL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="15"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="DIMISSION_TAG">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="BIRTHDAY" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTACT_ADDR" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTACT_ZIP" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="6"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CONTACT_FAX" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="32"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="EDUCATION" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="NATION" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="POLITICAL" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IN_COMPANY_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="CUST_MANAGER_FLAG">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="1"/>
* <minLength value="1"/>
* </restriction>
* </simpleType>
* </element>
* <element name="IN_STATION_DATE" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="REMARK" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="512"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="START_DATE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="END_DATE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="8"/>
* <minLength value="8"/>
* </restriction>
* </simpleType>
* </element>
* <element name="STAFF_PASSWD" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="128"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"operateTYPE",
"staffNO",
"staffNOOLD",
"staffNAME",
"staffPNAME",
"staffCLASS",
"staffTYPE",
"departCODE",
"chnlCODE",
"managerINFO",
"sex",
"userPID",
"serialNUMBER",
"contactTEL",
"dimissionTAG",
"birthday",
"contactADDR",
"contactZIP",
"contactFAX",
"education",
"nation",
"political",
"inCOMPANYDATE",
"custMANAGERFLAG",
"inSTATIONDATE",
"remark",
"startDATE",
"endDATE",
"staffPASSWD",
"para"
})
@XmlRootElement(name = "STAFF_INFO_REQ")
public class STAFF_INFO_REQ {
@XmlElement(name = "OPERATE_TYPE", required = true)
protected String operateTYPE;
@XmlElement(name = "STAFF_NO", required = true)
protected String staffNO;
@XmlElement(name = "STAFF_NO_OLD")
protected String staffNOOLD;
@XmlElement(name = "STAFF_NAME", required = true)
protected String staffNAME;
@XmlElement(name = "STAFF_PNAME", required = true)
protected String staffPNAME;
@XmlElement(name = "STAFF_CLASS")
protected String staffCLASS;
@XmlElement(name = "STAFF_TYPE", required = true)
protected String staffTYPE;
@XmlElement(name = "DEPART_CODE")
protected String departCODE;
@XmlElement(name = "CHNL_CODE")
protected String chnlCODE;
@XmlElement(name = "MANAGER_INFO")
protected String managerINFO;
@XmlElement(name = "SEX", required = true)
protected String sex;
@XmlElement(name = "USER_PID", required = true)
protected String userPID;
@XmlElement(name = "SERIAL_NUMBER")
protected String serialNUMBER;
@XmlElement(name = "CONTACT_TEL")
protected String contactTEL;
@XmlElement(name = "DIMISSION_TAG", required = true)
protected String dimissionTAG;
@XmlElement(name = "BIRTHDAY")
protected String birthday;
@XmlElement(name = "CONTACT_ADDR")
protected String contactADDR;
@XmlElement(name = "CONTACT_ZIP")
protected String contactZIP;
@XmlElement(name = "CONTACT_FAX")
protected String contactFAX;
@XmlElement(name = "EDUCATION")
protected String education;
@XmlElement(name = "NATION")
protected String nation;
@XmlElement(name = "POLITICAL")
protected String political;
@XmlElement(name = "IN_COMPANY_DATE")
protected String inCOMPANYDATE;
@XmlElement(name = "CUST_MANAGER_FLAG", required = true)
protected String custMANAGERFLAG;
@XmlElement(name = "IN_STATION_DATE")
protected String inSTATIONDATE;
@XmlElement(name = "REMARK")
protected String remark;
@XmlElement(name = "START_DATE", required = true)
protected String startDATE;
@XmlElement(name = "END_DATE", required = true)
protected String endDATE;
@XmlElement(name = "STAFF_PASSWD")
protected String staffPASSWD;
@XmlElement(name = "PARA")
protected List<STAFF_INFO_REQ.PARA> para;
/**
* Gets the value of the operate_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATE_TYPE() {
return operateTYPE;
}
/**
* Sets the value of the operate_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATE_TYPE(String value) {
this.operateTYPE = value;
}
/**
* Gets the value of the staff_NO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_NO() {
return staffNO;
}
/**
* Sets the value of the staff_NO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_NO(String value) {
this.staffNO = value;
}
/**
* Gets the value of the staff_NO_OLD property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_NO_OLD() {
return staffNOOLD;
}
/**
* Sets the value of the staff_NO_OLD property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_NO_OLD(String value) {
this.staffNOOLD = value;
}
/**
* Gets the value of the staff_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_NAME() {
return staffNAME;
}
/**
* Sets the value of the staff_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_NAME(String value) {
this.staffNAME = value;
}
/**
* Gets the value of the staff_PNAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_PNAME() {
return staffPNAME;
}
/**
* Sets the value of the staff_PNAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_PNAME(String value) {
this.staffPNAME = value;
}
/**
* Gets the value of the staff_CLASS property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_CLASS() {
return staffCLASS;
}
/**
* Sets the value of the staff_CLASS property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_CLASS(String value) {
this.staffCLASS = value;
}
/**
* Gets the value of the staff_TYPE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_TYPE() {
return staffTYPE;
}
/**
* Sets the value of the staff_TYPE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_TYPE(String value) {
this.staffTYPE = value;
}
/**
* Gets the value of the depart_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDEPART_CODE() {
return departCODE;
}
/**
* Sets the value of the depart_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDEPART_CODE(String value) {
this.departCODE = value;
}
/**
* Gets the value of the chnl_CODE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCHNL_CODE() {
return chnlCODE;
}
/**
* Sets the value of the chnl_CODE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCHNL_CODE(String value) {
this.chnlCODE = value;
}
/**
* Gets the value of the manager_INFO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMANAGER_INFO() {
return managerINFO;
}
/**
* Sets the value of the manager_INFO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMANAGER_INFO(String value) {
this.managerINFO = value;
}
/**
* Gets the value of the sex property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSEX() {
return sex;
}
/**
* Sets the value of the sex property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSEX(String value) {
this.sex = value;
}
/**
* Gets the value of the user_PID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSER_PID() {
return userPID;
}
/**
* Sets the value of the user_PID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSER_PID(String value) {
this.userPID = value;
}
/**
* Gets the value of the serial_NUMBER property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSERIAL_NUMBER() {
return serialNUMBER;
}
/**
* Sets the value of the serial_NUMBER property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSERIAL_NUMBER(String value) {
this.serialNUMBER = value;
}
/**
* Gets the value of the contact_TEL property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTACT_TEL() {
return contactTEL;
}
/**
* Sets the value of the contact_TEL property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTACT_TEL(String value) {
this.contactTEL = value;
}
/**
* Gets the value of the dimission_TAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDIMISSION_TAG() {
return dimissionTAG;
}
/**
* Sets the value of the dimission_TAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDIMISSION_TAG(String value) {
this.dimissionTAG = value;
}
/**
* Gets the value of the birthday property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBIRTHDAY() {
return birthday;
}
/**
* Sets the value of the birthday property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBIRTHDAY(String value) {
this.birthday = value;
}
/**
* Gets the value of the contact_ADDR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTACT_ADDR() {
return contactADDR;
}
/**
* Sets the value of the contact_ADDR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTACT_ADDR(String value) {
this.contactADDR = value;
}
/**
* Gets the value of the contact_ZIP property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTACT_ZIP() {
return contactZIP;
}
/**
* Sets the value of the contact_ZIP property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTACT_ZIP(String value) {
this.contactZIP = value;
}
/**
* Gets the value of the contact_FAX property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTACT_FAX() {
return contactFAX;
}
/**
* Sets the value of the contact_FAX property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTACT_FAX(String value) {
this.contactFAX = value;
}
/**
* Gets the value of the education property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEDUCATION() {
return education;
}
/**
* Sets the value of the education property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEDUCATION(String value) {
this.education = value;
}
/**
* Gets the value of the nation property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNATION() {
return nation;
}
/**
* Sets the value of the nation property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNATION(String value) {
this.nation = value;
}
/**
* Gets the value of the political property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPOLITICAL() {
return political;
}
/**
* Sets the value of the political property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPOLITICAL(String value) {
this.political = value;
}
/**
* Gets the value of the in_COMPANY_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIN_COMPANY_DATE() {
return inCOMPANYDATE;
}
/**
* Sets the value of the in_COMPANY_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIN_COMPANY_DATE(String value) {
this.inCOMPANYDATE = value;
}
/**
* Gets the value of the cust_MANAGER_FLAG property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCUST_MANAGER_FLAG() {
return custMANAGERFLAG;
}
/**
* Sets the value of the cust_MANAGER_FLAG property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCUST_MANAGER_FLAG(String value) {
this.custMANAGERFLAG = value;
}
/**
* Gets the value of the in_STATION_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIN_STATION_DATE() {
return inSTATIONDATE;
}
/**
* Sets the value of the in_STATION_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIN_STATION_DATE(String value) {
this.inSTATIONDATE = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getREMARK() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setREMARK(String value) {
this.remark = value;
}
/**
* Gets the value of the start_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTART_DATE() {
return startDATE;
}
/**
* Sets the value of the start_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTART_DATE(String value) {
this.startDATE = value;
}
/**
* Gets the value of the end_DATE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEND_DATE() {
return endDATE;
}
/**
* Sets the value of the end_DATE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEND_DATE(String value) {
this.endDATE = value;
}
/**
* Gets the value of the staff_PASSWD property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSTAFF_PASSWD() {
return staffPASSWD;
}
/**
* Sets the value of the staff_PASSWD property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSTAFF_PASSWD(String value) {
this.staffPASSWD = value;
}
/**
* Gets the value of the para property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the para property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPARA().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link STAFF_INFO_REQ.PARA }
*
*
*/
public List<STAFF_INFO_REQ.PARA> getPARA() {
if (para == null) {
para = new ArrayList<STAFF_INFO_REQ.PARA>();
}
return this.para;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PARA_ID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="PARA_VALUE">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="60"/>
* <minLength value="0"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"paraID",
"paraVALUE"
})
public static class PARA {
@XmlElement(name = "PARA_ID", required = true)
protected String paraID;
@XmlElement(name = "PARA_VALUE", required = true)
protected String paraVALUE;
/**
* Gets the value of the para_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_ID() {
return paraID;
}
/**
* Sets the value of the para_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_ID(String value) {
this.paraID = value;
}
/**
* Gets the value of the para_VALUE property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPARA_VALUE() {
return paraVALUE;
}
/**
* Sets the value of the para_VALUE property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPARA_VALUE(String value) {
this.paraVALUE = value;
}
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.util.List;
import java.util.Map;
public interface IDownBsdmChnlFileBusiSV {
public List<List<String>> getDownloadFiles(List<String> fileNameList, String timerCode);
public Map<String, Object> preProcess(List<String> fileNameList, String logId);
}
<file_sep>dubbo_app_name=uip_dubbo_app
register_addr=zookeeper://10.1.249.149:59182
provider_port=20880<file_sep>package cn.chinaunicom.ws.ordser;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-03-19T10:54:44.960+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://ws.chinaunicom.cn/OrdSer/", name = "OrdSer")
@XmlSeeAlso({cn.chinaunicom.ws.ordser.unibssbody.orderchkreq.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.orderchgchkrsp.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.ordstatqryrsp.ObjectFactory.class, cn.chinaunicom.ws.unibsshead.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.ordersubreq.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.orderchkrsp.ObjectFactory.class, cn.chinaunicom.ws.unibssattached.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.ordstatqryreq.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.orderchgchkreq.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.ordersubrsp.ObjectFactory.class, cn.chinaunicom.ws.ordser.unibssbody.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface OrdSer {
@WebResult(name = "ORDER_CHK_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/OrdSer/orderChk/")
public cn.chinaunicom.ws.ordser.unibssbody.ORDER_CHK_OUTPUT orderChk(
@WebParam(partName = "parameters", name = "ORDER_CHK_INPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody")
cn.chinaunicom.ws.ordser.unibssbody.ORDER_CHK_INPUT parameters
);
@WebResult(name = "ORD_STAT_QRY_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/OrdSer/ordStatQry/")
public cn.chinaunicom.ws.ordser.unibssbody.ORD_STAT_QRY_OUTPUT ordStatQry(
@WebParam(partName = "parameters", name = "ORD_STAT_QRY_INPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody")
cn.chinaunicom.ws.ordser.unibssbody.ORD_STAT_QRY_INPUT parameters
);
@WebResult(name = "ORDERCHG_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/OrdSer/orderCHGCHK/")
public cn.chinaunicom.ws.ordser.unibssbody.ORDERCHG_OUTPUT orderCHGCHK(
@WebParam(partName = "parameters", name = "ORDERCHG_INPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody")
cn.chinaunicom.ws.ordser.unibssbody.ORDERCHG_INPUT parameters
);
@WebResult(name = "ORDERSUB_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/OrdSer/orderSub/")
public cn.chinaunicom.ws.ordser.unibssbody.ORDERSUB_OUTPUT orderSub(
@WebParam(partName = "parameters", name = "ORDERSUB_INPUT", targetNamespace = "http://ws.chinaunicom.cn/OrdSer/unibssBody")
cn.chinaunicom.ws.ordser.unibssbody.ORDERSUB_INPUT parameters
);
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IINT_TELETYEP_MAPValue;
public class INT_TELETYEP_MAPBean extends DataContainer implements DataContainerInterface,IINT_TELETYEP_MAPValue{
private static String m_boName = "bo.INT_TELETYEP_MAP";
public final static String S_ChlTeletype = "CHL_TELETYPE";
public final static String S_Comments = "COMMENTS";
public final static String S_ErpTeletype = "ERP_TELETYPE";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public INT_TELETYEP_MAPBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�����������������ҵ���������");
}
public void initChlTeletype(String value){
this.initProperty(S_ChlTeletype,value);
}
public void setChlTeletype(String value){
this.set(S_ChlTeletype,value);
}
public void setChlTeletypeNull(){
this.set(S_ChlTeletype,null);
}
public String getChlTeletype(){
return DataType.getAsString(this.get(S_ChlTeletype));
}
public String getChlTeletypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ChlTeletype));
}
public void initComments(String value){
this.initProperty(S_Comments,value);
}
public void setComments(String value){
this.set(S_Comments,value);
}
public void setCommentsNull(){
this.set(S_Comments,null);
}
public String getComments(){
return DataType.getAsString(this.get(S_Comments));
}
public String getCommentsInitialValue(){
return DataType.getAsString(this.getOldObj(S_Comments));
}
public void initErpTeletype(String value){
this.initProperty(S_ErpTeletype,value);
}
public void setErpTeletype(String value){
this.set(S_ErpTeletype,value);
}
public void setErpTeletypeNull(){
this.set(S_ErpTeletype,null);
}
public String getErpTeletype(){
return DataType.getAsString(this.get(S_ErpTeletype));
}
public String getErpTeletypeInitialValue(){
return DataType.getAsString(this.getOldObj(S_ErpTeletype));
}
}
<file_sep>package com.ai.uchintService.ftpFile.qingzhang.ypdk;
import com.ai.appframe2.subtable.function.ISubTableFunction;
public class SubTableFuncYPDK implements ISubTableFunction {
@Override
public String convert(Object columnValue) throws Exception {
return ((String)columnValue).substring(0,6);
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface ItestValue extends DataStructInterface{
public final static String S_ErpPaAreaCode = "ERP_PA_AREA_CODE";
public final static String S_ErpAreaLevel = "ERP_AREA_LEVEL";
public final static String S_ErpAreaCode = "ERP_AREA_CODE";
public final static String S_ErpAreaName = "ERP_AREA_NAME";
public final static String S_ErpCompanyCode = "ERP_COMPANY_CODE";
public String getErpPaAreaCode();
public String getErpAreaLevel();
public String getErpAreaCode();
public String getErpAreaName();
public String getErpCompanyCode();
public void setErpPaAreaCode(String value);
public void setErpAreaLevel(String value);
public void setErpAreaCode(String value);
public void setErpAreaName(String value);
public void setErpCompanyCode(String value);
}
<file_sep>0,unibssHead.xsd,UNI_BSS_HEAD,BSdmChannelInfoSchema.xsd
1,unibssHead.xsd,UNI_BSS_HEAD,BSdmChannelInfoSchema.xsd
2,unibssAttached.xsd,UNI_BSS_ATTACHED,BSdmChannelInfoSchema.xsd
channelInfoChgNotify,UNI_BSS_BODY,UNI_BSS_BODY
channelInfoPrecheckMsgNotify,UNI_BSS_BODY,UNI_BSS_BODY
channelInfoChgCancelNotify,UNI_BSS_BODY,UNI_BSS_BODY
channelInfoChg,UNI_BSS_BODY,UNI_BSS_BODY
<file_sep>package com.ai.uchintService.httpServer.dataServ.interfaces;
import java.util.Map;
import com.ai.uip.core.bo.UipServiceHttpBean;
public interface IUipServiceHttpSV {
public UipServiceHttpBean[] getBeans(String condition,Map parameter) throws Exception;
}
<file_sep>
package cn.chinaunicom.ws.agencypayser.body;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import cn.chinaunicom.ws.agencypayser.body.agencysignqiantadereq.AGENCY_SIGN_QIAN_TADE_REQ;
import cn.chinaunicom.ws.agencypayser.head.HEAD;;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/Head}HEAD"/>
* <element name="BODY">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/AgencyPaySer/Body/agencySignQianTadeReq}AGENCY_SIGN_QIAN_TADE_REQ"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"head",
"body"
})
@XmlRootElement(name = "AGENCY_SIGN_QIAN_TADE_INPUT")
public class AGENCY_SIGN_QIAN_TADE_INPUT {
@XmlElement(name = "HEAD", namespace = "http://ws.chinaunicom.cn/Head", required = true)
protected HEAD head;
@XmlElement(name = "BODY", required = true)
protected AGENCY_SIGN_QIAN_TADE_INPUT.BODY body;
/**
* Gets the value of the head property.
*
* @return
* possible object is
* {@link HEAD }
*
*/
public HEAD getHEAD() {
return head;
}
/**
* Sets the value of the head property.
*
* @param value
* allowed object is
* {@link HEAD }
*
*/
public void setHEAD(HEAD value) {
this.head = value;
}
/**
* Gets the value of the body property.
*
* @return
* possible object is
* {@link AGENCY_SIGN_QIAN_TADE_INPUT.BODY }
*
*/
public AGENCY_SIGN_QIAN_TADE_INPUT.BODY getBODY() {
return body;
}
/**
* Sets the value of the body property.
*
* @param value
* allowed object is
* {@link AGENCY_SIGN_QIAN_TADE_INPUT.BODY }
*
*/
public void setBODY(AGENCY_SIGN_QIAN_TADE_INPUT.BODY value) {
this.body = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/AgencyPaySer/Body/agencySignQianTadeReq}AGENCY_SIGN_QIAN_TADE_REQ"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"agencySIGNQIANTADEREQ"
})
public static class BODY {
@XmlElement(name = "AGENCY_SIGN_QIAN_TADE_REQ", namespace = "http://ws.chinaunicom.cn/AgencyPaySer/Body/agencySignQianTadeReq", required = true)
protected AGENCY_SIGN_QIAN_TADE_REQ agencySIGNQIANTADEREQ;
/**
* Gets the value of the agency_SIGN_QIAN_TADE_REQ property.
*
* @return
* possible object is
* {@link AGENCY_SIGN_QIAN_TADE_REQ }
*
*/
public AGENCY_SIGN_QIAN_TADE_REQ getAGENCY_SIGN_QIAN_TADE_REQ() {
return agencySIGNQIANTADEREQ;
}
/**
* Sets the value of the agency_SIGN_QIAN_TADE_REQ property.
*
* @param value
* allowed object is
* {@link AGENCY_SIGN_QIAN_TADE_REQ }
*
*/
public void setAGENCY_SIGN_QIAN_TADE_REQ(AGENCY_SIGN_QIAN_TADE_REQ value) {
this.agencySIGNQIANTADEREQ = value;
}
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
public interface IINT_CONVER_RELATIONValue extends DataStructInterface{
public final static String S_Subject = "SUBJECT";
public final static String S_TradeCode = "TRADE_CODE";
public final static String S_Comments = "COMMENTS";
public final static String S_ConverCode = "CONVER_CODE";
public final static String S_TeleType = "TELE_TYPE";
public final static String S_ClientCode = "CLIENT_CODE";
public final static String S_DataType = "DATA_TYPE";
public String getSubject();
public String getTradeCode();
public String getComments();
public String getConverCode();
public String getTeleType();
public String getClientCode();
public String getDataType();
public void setSubject(String value);
public void setTradeCode(String value);
public void setComments(String value);
public void setConverCode(String value);
public void setTeleType(String value);
public void setClientCode(String value);
public void setDataType(String value);
}
<file_sep>package com.ai.uchintService.common.bo;
import com.ai.appframe2.bo.DataContainer;
import com.ai.appframe2.common.AIException;
import com.ai.appframe2.common.DataContainerInterface;
import com.ai.appframe2.common.DataType;
import com.ai.appframe2.common.ObjectType;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.common.ivalues.IUC_TD_MDM_BANKValue;
public class UC_TD_MDM_BANKBean extends DataContainer implements DataContainerInterface,IUC_TD_MDM_BANKValue{
private static String m_boName = "bo.UC_TD_MDM_BANK";
public final static String S_State = "STATE";
public final static String S_BankCode = "BANK_CODE";
public final static String S_BankName = "BANK_NAME";
public static ObjectType S_TYPE = null;
static{
try {
S_TYPE = ServiceManager.getObjectTypeFactory().getInstance(m_boName);
}catch(Exception e){
throw new RuntimeException(e);
}
}
public UC_TD_MDM_BANKBean() throws AIException{
super(S_TYPE);
}
public static ObjectType getObjectTypeStatic() throws AIException{
return S_TYPE;
}
public void setObjectType(ObjectType value) throws AIException{
throw new AIException("�������������������ҵ���������");
}
public void initState(String value){
this.initProperty(S_State,value);
}
public void setState(String value){
this.set(S_State,value);
}
public void setStateNull(){
this.set(S_State,null);
}
public String getState(){
return DataType.getAsString(this.get(S_State));
}
public String getStateInitialValue(){
return DataType.getAsString(this.getOldObj(S_State));
}
public void initBankCode(String value){
this.initProperty(S_BankCode,value);
}
public void setBankCode(String value){
this.set(S_BankCode,value);
}
public void setBankCodeNull(){
this.set(S_BankCode,null);
}
public String getBankCode(){
return DataType.getAsString(this.get(S_BankCode));
}
public String getBankCodeInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankCode));
}
public void initBankName(String value){
this.initProperty(S_BankName,value);
}
public void setBankName(String value){
this.set(S_BankName,value);
}
public void setBankNameNull(){
this.set(S_BankName,null);
}
public String getBankName(){
return DataType.getAsString(this.get(S_BankName));
}
public String getBankNameInitialValue(){
return DataType.getAsString(this.getOldObj(S_BankName));
}
}
<file_sep>
package com.unicom.ecip.inquirychannelinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "inquiryChannelInfoSrvOUT", propOrder = {
"outMSGContent",
"rspcode"
})
public class InquiryChannelInfoSrvOUT {
protected Outmsgcontent outMSGContent;
@XmlElement(name = "RSPCODE")
protected String rspcode;
public Outmsgcontent getOutMSGContent() {
return outMSGContent;
}
public void setOutMSGContent(Outmsgcontent value) {
this.outMSGContent = value;
}
public String getRSPCODE() {
return rspcode;
}
public void setRSPCODE(String value) {
this.rspcode = value;
}
}
<file_sep>package com.ai.uchintService.httpServer.dataServ.impl;
import java.util.Map;
import com.ai.uchintService.httpServer.dataServ.interfaces.IUipServiceHttpSV;
import com.ai.uip.core.bo.UipServiceHttpBean;
import com.ai.uip.core.bo.UipServiceHttpEngine;
public class UipServiceHttpSVImpl implements IUipServiceHttpSV {
@Override
public UipServiceHttpBean[] getBeans(String condition, Map parameter) throws Exception {
return UipServiceHttpEngine.getBeans(condition, parameter);
}
}
<file_sep>
package cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link AGENTPREPAYRECHSYNCINPUT }
*
*/
public AGENTPREPAYRECHSYNCINPUT createAGENTPREPAYRECHSYNCINPUT() {
return new AGENTPREPAYRECHSYNCINPUT();
}
/**
* Create an instance of {@link AGENTDEPOSITRECHSYNCINPUT }
*
*/
public AGENTDEPOSITRECHSYNCINPUT createAGENTDEPOSITRECHSYNCINPUT() {
return new AGENTDEPOSITRECHSYNCINPUT();
}
/**
* Create an instance of {@link AGENTDEPOSITRECHSYNCOUTPUT }
*
*/
public AGENTDEPOSITRECHSYNCOUTPUT createAGENTDEPOSITRECHSYNCOUTPUT() {
return new AGENTDEPOSITRECHSYNCOUTPUT();
}
/**
* Create an instance of {@link AGENTPREPAYRECHSYNCOUTPUT }
*
*/
public AGENTPREPAYRECHSYNCOUTPUT createAGENTPREPAYRECHSYNCOUTPUT() {
return new AGENTPREPAYRECHSYNCOUTPUT();
}
/**
* Create an instance of {@link AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY }
*
*/
public AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY createAGENTPREPAYRECHSYNCINPUTUNIBSSBODY() {
return new AGENTPREPAYRECHSYNCINPUT.UNIBSSBODY();
}
/**
* Create an instance of {@link AGENTDEPOSITRECHSYNCINPUT.UNIBSSBODY }
*
*/
public AGENTDEPOSITRECHSYNCINPUT.UNIBSSBODY createAGENTDEPOSITRECHSYNCINPUTUNIBSSBODY() {
return new AGENTDEPOSITRECHSYNCINPUT.UNIBSSBODY();
}
/**
* Create an instance of {@link AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY }
*
*/
public AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY createAGENTDEPOSITRECHSYNCOUTPUTUNIBSSBODY() {
return new AGENTDEPOSITRECHSYNCOUTPUT.UNIBSSBODY();
}
/**
* Create an instance of {@link AGENTPREPAYRECHSYNCOUTPUT.UNIBSSBODY }
*
*/
public AGENTPREPAYRECHSYNCOUTPUT.UNIBSSBODY createAGENTPREPAYRECHSYNCOUTPUTUNIBSSBODY() {
return new AGENTPREPAYRECHSYNCOUTPUT.UNIBSSBODY();
}
}
<file_sep>
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package cn.chinaunicom.ws.agencypayser;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-06-29T11:29:19.639+08:00
* Generated source version: 2.3.5
*
*/
@javax.jws.WebService(
serviceName = "AgencyPaySer",
portName = "AgencyPaySerHttpEndpoint",
targetNamespace = "http://ws.chinaunicom.cn/AgencyPaySer/",
// wsdlLocation = "file:/D:/workspace/workspace_yaxin/uip_invoice/wsdl/AgencyPaySer/META-INF/AgencyPaySer.wsdl",
endpointInterface = "cn.chinaunicom.ws.agencypayser.AgencyPaySerPortType")
public class AgencyPaySerPortTypeImpl implements AgencyPaySerPortType {
private static final Logger LOG = Logger.getLogger(AgencyPaySerPortTypeImpl.class.getName());
/* (non-Javadoc)
* @see cn.chinaunicom.ws.agencypayser.AgencyPaySerPortType#agencySignQianTade(cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_INPUT parameters )*
*/
public cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_OUTPUT agencySignQianTade(cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_INPUT parameters) {
LOG.info("Executing operation agencySignQianTade");
System.out.println(parameters);
try {
// cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_OUTPUT _return = new cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_OUTPUT();
// cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_OUTPUT.BODY body = new cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_OUTPUT.BODY();
// cn.chinaunicom.ws.agencypayser.body.agencysignqiantadersp.AGENCY_SIGN_QIAN_TADE_RSP rsp = new cn.chinaunicom.ws.agencypayser.body.agencysignqiantadersp.AGENCY_SIGN_QIAN_TADE_RSP();
// rsp.setINFO_NUM(parameters.getBODY().getAGENCY_SIGN_QIAN_TADE_REQ().getINFO_NUM());
// rsp.setUSER_NM("zhang");
// rsp.setID_TYP("01");
// rsp.setIDENTIFY_NO("110121212121");
// rsp.setBANK_NM("CMCC");
// rsp.setACCOUNT_TPY("1");
// rsp.setACCOUNT_NO("0000");
// ArrayList<AGENCY_SIGN_QIAN_TADE_RSP.INFO_LIST> list = new ArrayList<AGENCY_SIGN_QIAN_TADE_RSP.INFO_LIST>();
// cn.chinaunicom.ws.agencypayser.body.agencysignqiantadereq.AGENCY_SIGN_QIAN_TADE_REQ req = parameters.getBODY().getAGENCY_SIGN_QIAN_TADE_REQ();
// for(int i = 0; i<req.getINFO_LIST().size();i++){
// AGENCY_SIGN_QIAN_TADE_RSP.INFO_LIST info = new AGENCY_SIGN_QIAN_TADE_RSP.INFO_LIST();
// info.setACT_ID(req.getINFO_LIST().get(i).getACT_ID());
// info.setAGR_NO("0000000000000000000000");
// info.setCARD_NM(req.getINFO_LIST().get(i).getCARD_NM());
// info.setEFF_FLG("0000");
// list.add(info);
// }
// rsp.setINFO_LIST(list);
// body.setAGENCY_SIGN_QIAN_TADE_RSP(rsp);
// _return.setHEAD(parameters.getHEAD());
// _return.setBODY(body);
// return _return;
IPenetrationIfProcessorSRV penetrationIfProcessorSRV= (IPenetrationIfProcessorSRV)ServiceFactory.getService("com.ai.uip.platform.penetration.interfaces.IPenetrationIfProcessorSRV");
Object obj = penetrationIfProcessorSRV.ifMsgProcessorForService(Constants.Agent.AGENCY_SIGN_QIAN_TADE, parameters);
return (cn.chinaunicom.ws.agencypayser.body.AGENCY_SIGN_QIAN_TADE_OUTPUT)obj;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
<file_sep>package cn.chinaunicom.ws.agencypaytadeser;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 2.3.5
* 2013-07-01T10:39:34.466+08:00
* Generated source version: 2.3.5
*
*/
@WebService(targetNamespace = "http://ws.chinaunicom.cn/AgencyPayTadeSer/", name = "AgencyPayTadeSerPortType")
@XmlSeeAlso({cn.chinaunicom.ws.agencypaytadeser.body.agencysigncalltadersp.ObjectFactory.class, cn.chinaunicom.ws.agencypaytadeser.body.agencysigncalltadereq.ObjectFactory.class, cn.chinaunicom.ws.agencypaytadeser.body.ObjectFactory.class, cn.chinaunicom.ws.agencypaytadeser.head.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface AgencyPayTadeSerPortType {
@WebResult(name = "AGENCY_SIGN_CALL_TADE_OUTPUT", targetNamespace = "http://ws.chinaunicom.cn/AgencyPayTadeSer/Body", partName = "parameters")
@WebMethod(action = "http://ws.chinaunicom.cn/AgencyPayTadeSer/agencySignCallTade/")
public cn.chinaunicom.ws.agencypaytadeser.body.AGENCY_SIGN_CALL_TADE_OUTPUT agencySignCallTade(
@WebParam(partName = "parameters", name = "AGENCY_SIGN_CALL_TADE_INPUT", targetNamespace = "http://ws.chinaunicom.cn/AgencyPayTadeSer/Body")
cn.chinaunicom.ws.agencypaytadeser.body.AGENCY_SIGN_CALL_TADE_INPUT parameters
);
}
<file_sep>
package cn.chinaunicom.ws.agencypaytadeser.head;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SERVICE_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="OPERATE_NAME">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="INTERVER">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="BIPCode">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="BIPVer">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="ActivityCode">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="Routing">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RouteType">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="RouteValue">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="ProcID">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="TransIDO">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="ProcessTime">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="SvcContVer">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"serviceNAME",
"operateNAME",
"interver",
"bipCode",
"bipVer",
"activityCode",
"routing",
"procID",
"transIDO",
"processTime",
"svcContVer"
})
@XmlRootElement(name = "HEAD")
public class HEAD {
@XmlElement(name = "SERVICE_NAME", required = true)
protected String serviceNAME;
@XmlElement(name = "OPERATE_NAME", required = true)
protected String operateNAME;
@XmlElement(name = "INTERVER", required = true)
protected String interver;
@XmlElement(name = "BIPCode", required = true)
protected String bipCode;
@XmlElement(name = "BIPVer", required = true)
protected String bipVer;
@XmlElement(name = "ActivityCode", required = true)
protected String activityCode;
@XmlElement(name = "Routing", required = true)
protected HEAD.Routing routing;
@XmlElement(name = "ProcID", required = true)
protected String procID;
@XmlElement(name = "TransIDO", required = true)
protected String transIDO;
@XmlElement(name = "ProcessTime", required = true)
protected String processTime;
@XmlElement(name = "SvcContVer", required = true)
protected String svcContVer;
/**
* Gets the value of the service_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSERVICE_NAME() {
return serviceNAME;
}
/**
* Sets the value of the service_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSERVICE_NAME(String value) {
this.serviceNAME = value;
}
/**
* Gets the value of the operate_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOPERATE_NAME() {
return operateNAME;
}
/**
* Sets the value of the operate_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOPERATE_NAME(String value) {
this.operateNAME = value;
}
/**
* Gets the value of the interver property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINTERVER() {
return interver;
}
/**
* Sets the value of the interver property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINTERVER(String value) {
this.interver = value;
}
/**
* Gets the value of the bipCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBIPCode() {
return bipCode;
}
/**
* Sets the value of the bipCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBIPCode(String value) {
this.bipCode = value;
}
/**
* Gets the value of the bipVer property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBIPVer() {
return bipVer;
}
/**
* Sets the value of the bipVer property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBIPVer(String value) {
this.bipVer = value;
}
/**
* Gets the value of the activityCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getActivityCode() {
return activityCode;
}
/**
* Sets the value of the activityCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setActivityCode(String value) {
this.activityCode = value;
}
/**
* Gets the value of the routing property.
*
* @return
* possible object is
* {@link HEAD.Routing }
*
*/
public HEAD.Routing getRouting() {
return routing;
}
/**
* Sets the value of the routing property.
*
* @param value
* allowed object is
* {@link HEAD.Routing }
*
*/
public void setRouting(HEAD.Routing value) {
this.routing = value;
}
/**
* Gets the value of the procID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProcID() {
return procID;
}
/**
* Sets the value of the procID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProcID(String value) {
this.procID = value;
}
/**
* Gets the value of the transIDO property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTransIDO() {
return transIDO;
}
/**
* Sets the value of the transIDO property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTransIDO(String value) {
this.transIDO = value;
}
/**
* Gets the value of the processTime property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProcessTime() {
return processTime;
}
/**
* Sets the value of the processTime property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProcessTime(String value) {
this.processTime = value;
}
/**
* Gets the value of the svcContVer property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSvcContVer() {
return svcContVer;
}
/**
* Sets the value of the svcContVer property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSvcContVer(String value) {
this.svcContVer = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RouteType">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="RouteValue">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"routeType",
"routeValue"
})
public static class Routing {
@XmlElement(name = "RouteType", required = true)
protected String routeType;
@XmlElement(name = "RouteValue", required = true)
protected String routeValue;
/**
* Gets the value of the routeType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRouteType() {
return routeType;
}
/**
* Sets the value of the routeType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRouteType(String value) {
this.routeType = value;
}
/**
* Gets the value of the routeValue property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRouteValue() {
return routeValue;
}
/**
* Sets the value of the routeValue property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRouteValue(String value) {
this.routeValue = value;
}
}
}
<file_sep>package com.ai.uchintService.common.util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.common.ServiceManager;
import com.ai.cuframe.util.DbUtil;
import com.ai.cuframe.util.ManagerUtil;
public class SvDbUtil {
private static final Log logger = LogFactory.getLog(SvDbUtil.class);
public static List<Map<String, Object>> query(String sql) {
Connection conn = null;
PreparedStatement ptmt = null;
ResultSet rset = null;
List list = new ArrayList();
logger.debug(DbUtil.genDebugSqlString(sql, null));
try {
conn = getConnection();
ptmt = conn.prepareStatement(sql);
rset = ptmt.executeQuery();
ResultSetMetaData rsmd = rset.getMetaData();
int cols = rsmd.getColumnCount();
while (rset.next()) {
Object object = null;
Map map = new LinkedHashMap<String, Object>();
for (int i = 1; i <= cols; i++) {
String columnTypeName = rsmd.getColumnTypeName(i);
if ("DATE".equals(columnTypeName)) {
map.put(rsmd.getColumnName(i).toLowerCase(), rset
.getTimestamp(i));
} else {
map.put(rsmd.getColumnName(i).toLowerCase(), rset
.getObject(i));
}
}
list.add(map);
}
} catch (Exception e) {
Map paramMap = new HashMap();
paramMap.put("sql", sql);
paramMap.put("msg", e.getMessage());
ManagerUtil.getErrorManager().throwError(2L, paramMap, e);
// throw new SystemException(e.getMessage(),sql,e);
} finally {
close(conn, ptmt, rset);
}
return list;
}
public static String queryForString(String sql) {
String retStr="";
Connection conn = null;
PreparedStatement ptmt = null;
// 创建resultset
ResultSet rset = null;
// 创建collection
try {
conn = getConnection();
// 赋予实例
ptmt = conn.prepareStatement(sql);
rset = ptmt.executeQuery();
if (rset.next()) {
retStr =rset.getString(1);
}
} catch (Exception e) {
e.printStackTrace();
}
finally {
close(conn,ptmt, null);
}
return retStr;
}
public static Integer exeSQL(String sql) {
Connection conn = null;
PreparedStatement pstmt = null;
int cnt;
boolean tmp = false;
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
cnt=pstmt.executeUpdate();
}catch(Exception e){
cnt=0;
Map paramMap=new HashMap();
paramMap.put("sql", sql);
paramMap.put("msg",e.getMessage());
ManagerUtil.getErrorManager().throwError(2L, paramMap, e);
}
finally {
close(conn,pstmt, null);
}
return cnt;
}
public static String getSequenceNextVal(String seqName) {
String sql="select " + seqName + ".nextval from dual";
String seq="";
try {
seq= queryForString(sql);
} catch (Exception e) {
logger.info(e.getMessage());
}
return seq;
}
private static Connection getConnection() throws SQLException {
Connection conn = ServiceManager.getSession().getConnection();
return conn;
}
private static void close(Connection conn, PreparedStatement stmt, ResultSet rs) {
//
try {
if (rs != null)
rs.close();
} catch (Throwable se) {
}
//
try {
if (stmt != null)
stmt.close();
} catch (Throwable se) {
}
try {
if (conn != null)
conn.close();
} catch (Throwable se) {
}
}
}
<file_sep>package com.ai.uchintService.busi.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ai.appframe2.common.ServiceManager;
import com.ai.uchintService.busi.service.interfaces.IUpdatePaymentResultInfoSV;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.PAYMENT_LINE_INFOItem;
public class UpdatePaymentResultInfoSVImpl implements IUpdatePaymentResultInfoSV{
@Override
public boolean importPaymentResultInfo(UC_TF_CHL_PAY_APPLYBean bean) throws SQLException {
String sql = "update tf_chl_pay_apply set update_remark='"+bean.getUpdateRemark()+"',pay_state='"+bean.getPayState()+"'" +
",pay_date =sysdate where pay_batch_id='"+bean.getPayBatchId()+"' and line_no="+bean.getLineNo();
String sql2 = "insert into TF_CHL_PAY_APPLY_STATE(SERIAL_NO,BILL_NO,PAY_BATCH_ID,LINE_NO,CHNL_ID,PAY_MONEY,PAY_STATE,ERROR_MSG,UPDATE_DATE) " +
" values("+Long.valueOf(CastUtil.getSequenceNextValSERIAL_NO(Constants.SERIAL_NO$SEQ ))+","+bean.getBillNo()
+",'"+bean.getPayBatchId()+"',"+bean.getLineNo()+",'"+bean.getPayObjectId()+"',"+bean.getPayMoney()+",'"+bean.getPayState()
+"','"+bean.getUpdateRemark()+"',sysdate)";
String sql3 = "update TF_CHL_PAY_APPLY_DETAIL set pay_state = '"+bean.getPayState()+"' where SERIAL_NO="+bean.getSerialNo();
String sql4 = "select * from TF_CHL_PAY_APPLY_DETAIL where SERIAL_NO="+bean.getSerialNo();
Connection conn = null;
PreparedStatement ptmt = null;
// 创建resultset
ResultSet rs = null;
ResultSet rs2 = null;
// 创建collection
try {
conn = getConnection();
// 赋予实例
ptmt = conn.prepareStatement(sql);
ptmt.executeUpdate();
ptmt = conn.prepareStatement(sql2);
ptmt.executeUpdate();
ptmt = conn.prepareStatement(sql3);
ptmt.executeUpdate();
ptmt = conn.prepareStatement(sql4);
rs = ptmt.executeQuery();
String chnlId = "";
String billCycle = "";
double paymoney = 0;
double payStatmoney =0;
while(rs.next()){
chnlId = rs.getString("chnl_id");
billCycle = rs.getString("stat_month");
paymoney = rs.getDouble("pay_money");
payStatmoney = rs.getDouble("pay_stat_money");
}
if("10".equals(bean.getPayState())){
String sql5 = "select * from TF_CHL_SETTLE where chnl_id='"+chnlId+"' and bill_cycle='"+billCycle+"'";
ptmt = conn.prepareStatement(sql5);
rs2 = ptmt.executeQuery();
double payedAmount =0;
double payedTax =0;
Long chnlCommId = null;
while(rs2.next()){
payedAmount = paymoney+rs2.getDouble("PAYED_AMOUNT");
payedTax = rs2.getDouble("PAYED_TAX")+(payStatmoney-paymoney);
chnlCommId = rs2.getLong("CHNL_COMM_ID");
}
String sql6 = "update TF_CHL_SETTLE set PAYED_AMOUNT="+payedAmount+",PAYED_TAX="+payedTax+" where CHNL_COMM_ID="+chnlCommId;
ptmt = conn.prepareStatement(sql6);
ptmt.executeUpdate();
}
return true;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
@Override
public void saveApplyInfo(UC_TF_CHL_PAY_APPLYBean bean,PAYMENT_LINE_INFOItem paymentLINEINFOItem,String auditReturnMessage,String provinceCode,int haspayed,Date lateUpdatedate,String voucherNumber) throws Exception {
String sql = " update tf_chl_pay_apply " ;
Connection conn = null;
PreparedStatement ptmt = null;
try {
sql += " set UPDATE_STAFF_ID='"+Constants.UPDATE_STAFF_ID_VALUE+"'";
if(auditReturnMessage!=null&&auditReturnMessage.length()>0){
sql += " , UPDATE_REMARK='"+auditReturnMessage+"'";
}
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_Y.equals(paymentLINEINFOItem.getRETURN_TYPE())){
sql += " , PAY_STATE='"+Constants.RESULT_CODE_STATUS_Y+"'";
}else
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_R.equals(paymentLINEINFOItem.getRETURN_TYPE())){
sql += " , PAY_STATE='"+Constants.RESULT_CODE_STATUS_R+"'";
}else
if(paymentLINEINFOItem.getRETURN_TYPE()!=null&&Constants.PUBLISH_RESULT_CODE_N.equals(paymentLINEINFOItem.getRETURN_TYPE())){
sql += " , PAY_STATE='"+Constants.RESULT_CODE_STATUS_N+"'";
}
System.out.println("PAY_DATE is "+paymentLINEINFOItem.getPAYMENT_DATE());
System.out.println("UPDATE_DATE is "+lateUpdatedate);
if(paymentLINEINFOItem.getPAYMENT_DATE()!=null){
sql += " , PAY_DATE=to_date('"+CastUtil.date2Str(paymentLINEINFOItem.getPAYMENT_DATE())+"' , 'yyyy-MM-dd HH24:mi:ss')";
}
if(lateUpdatedate!=null){
sql += " , UPDATE_DATE=to_date('"+CastUtil.date2Str(lateUpdatedate)+"' , 'yyyy-MM-dd HH24:mi:ss')";
}
if(voucherNumber!=null){
sql += " , VOUCHER_NUMBER='"+voucherNumber+"'";
}
sql += " , HAS_PAYED='"+haspayed+"'";
sql += " where PAY_STATE <> '31' and PAY_BATCH_ID='" + paymentLINEINFOItem.getBATCH_ID()+"' and LINE_NO='"+paymentLINEINFOItem.getLINE_ID()+"' and province_code='"+provinceCode+"'";
System.out.println("sql is "+sql);
// 创建collection
conn = getConnection();
// 赋予实例
ptmt = conn.prepareStatement(sql);
ptmt.executeUpdate();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}finally{
ptmt.close();
conn.close();
}
}
//定时查询更新的方法
public List<UC_TF_CHL_PAY_APPLYBean> queryAllpayApplyInfo(){
String sql = "select * from tf_chl_pay_apply where pay_state in('2','0')";
Connection conn = null;
PreparedStatement ptmt = null;
// 创建resultset
ResultSet rset = null;
// 创建collection
List<UC_TF_CHL_PAY_APPLYBean> list = new ArrayList<UC_TF_CHL_PAY_APPLYBean>();
try {
conn = getConnection();
// 赋予实例
ptmt = conn.prepareStatement(sql);
rset = ptmt.executeQuery();
while (rset.next()) {
UC_TF_CHL_PAY_APPLYBean bean1 = new UC_TF_CHL_PAY_APPLYBean();
bean1.setPayBatchId(rset.getString("pay_batch_id"));
bean1.setLineNo(rset.getInt("line_no"));
bean1.setSerialNo(rset.getInt("serial_no"));
bean1.setPayObjectId(rset.getString("pay_object_id"));
bean1.setBillNo(rset.getInt("bill_no"));
bean1.setPayMoney(rset.getDouble("pay_money"));
list.add(bean1);
}
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
rset.close();
ptmt.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return list;
}
public Connection getConnection() throws SQLException {
Connection conn = ServiceManager.getSession().getConnection();
return conn;
}
}
<file_sep>package com.ai.uchintService.common.ivalues;
import com.ai.appframe2.common.DataStructInterface;
import java.sql.Timestamp;
public interface IINT_TELETYEP_MAPValue extends DataStructInterface{
public final static String S_ChlTeletype = "CHL_TELETYPE";
public final static String S_Comments = "COMMENTS";
public final static String S_ErpTeletype = "ERP_TELETYPE";
public String getChlTeletype();
public String getComments();
public String getErpTeletype();
public void setChlTeletype(String value);
public void setComments(String value);
public void setErpTeletype(String value);
}
<file_sep>
package com.unicom.mss.sb_uc_uc_importcontractinfosrv;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for VendorInfoItem complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="VendorInfoItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="HEARDER_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BATCH_ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="FLAG" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="VENDOR_NUM" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="VENDOR_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BANK_ACCOUNT_NUM" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BANK_ACCOUNT_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="BANK_NAME" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VendorInfoItem", propOrder = {
"hearderID",
"batchID",
"flag",
"vendorNUM",
"vendorNAME",
"bankACCOUNTNUM",
"bankACCOUNTNAME",
"bankNAME"
})
public class VendorInfoItem {
@XmlElement(name = "HEARDER_ID", required = true, nillable = true)
protected String hearderID;
@XmlElement(name = "BATCH_ID", required = true, nillable = true)
protected String batchID;
@XmlElement(name = "FLAG", required = true, nillable = true)
protected String flag;
@XmlElement(name = "VENDOR_NUM", required = true, nillable = true)
protected String vendorNUM;
@XmlElement(name = "VENDOR_NAME", required = true, nillable = true)
protected String vendorNAME;
@XmlElement(name = "BANK_ACCOUNT_NUM", required = true, nillable = true)
protected String bankACCOUNTNUM;
@XmlElement(name = "BANK_ACCOUNT_NAME", required = true, nillable = true)
protected String bankACCOUNTNAME;
@XmlElement(name = "BANK_NAME", required = true, nillable = true)
protected String bankNAME;
/**
* Gets the value of the hearder_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHEARDER_ID() {
return hearderID;
}
/**
* Sets the value of the hearder_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHEARDER_ID(String value) {
this.hearderID = value;
}
/**
* Gets the value of the batch_ID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBATCH_ID() {
return batchID;
}
/**
* Sets the value of the batch_ID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBATCH_ID(String value) {
this.batchID = value;
}
/**
* Gets the value of the flag property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFLAG() {
return flag;
}
/**
* Sets the value of the flag property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFLAG(String value) {
this.flag = value;
}
/**
* Gets the value of the vendor_NUM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVENDOR_NUM() {
return vendorNUM;
}
/**
* Sets the value of the vendor_NUM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVENDOR_NUM(String value) {
this.vendorNUM = value;
}
/**
* Gets the value of the vendor_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVENDOR_NAME() {
return vendorNAME;
}
/**
* Sets the value of the vendor_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVENDOR_NAME(String value) {
this.vendorNAME = value;
}
/**
* Gets the value of the bank_ACCOUNT_NUM property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCOUNT_NUM() {
return bankACCOUNTNUM;
}
/**
* Sets the value of the bank_ACCOUNT_NUM property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCOUNT_NUM(String value) {
this.bankACCOUNTNUM = value;
}
/**
* Gets the value of the bank_ACCOUNT_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_ACCOUNT_NAME() {
return bankACCOUNTNAME;
}
/**
* Sets the value of the bank_ACCOUNT_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_ACCOUNT_NAME(String value) {
this.bankACCOUNTNAME = value;
}
/**
* Gets the value of the bank_NAME property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBANK_NAME() {
return bankNAME;
}
/**
* Sets the value of the bank_NAME property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBANK_NAME(String value) {
this.bankNAME = value;
}
}
<file_sep>
package cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import cn.chinaunicom.ws.bsdmchannelinfoser.unibssbody.channelinfochgreq.CHANNEL_INFO_CHG_REQ;
import cn.chinaunicom.ws.unibssattached.UNI_BSS_ATTACHED;
import cn.chinaunicom.ws.unibsshead.UNI_BSS_HEAD;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/unibssHead}UNI_BSS_HEAD"/>
* <element name="UNI_BSS_BODY" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/BSdmChannelInfoSer/unibssBody/channelInfoChgReq}CHANNEL_INFO_CHG_REQ"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element ref="{http://ws.chinaunicom.cn/unibssAttached}UNI_BSS_ATTACHED" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"uniBSSHEAD",
"uniBSSBODY",
"uniBSSATTACHED"
})
@XmlRootElement(name = "CHANNEL_INFO_CHG_INPUT")
public class CHANNEL_INFO_CHG_INPUT {
@XmlElement(name = "UNI_BSS_HEAD", namespace = "http://ws.chinaunicom.cn/unibssHead", required = true)
protected UNI_BSS_HEAD uniBSSHEAD;
@XmlElement(name = "UNI_BSS_BODY")
protected CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY uniBSSBODY;
@XmlElement(name = "UNI_BSS_ATTACHED", namespace = "http://ws.chinaunicom.cn/unibssAttached")
protected UNI_BSS_ATTACHED uniBSSATTACHED;
/**
* Gets the value of the uni_BSS_HEAD property.
*
* @return
* possible object is
* {@link UNI_BSS_HEAD }
*
*/
public UNI_BSS_HEAD getUNI_BSS_HEAD() {
return uniBSSHEAD;
}
/**
* Sets the value of the uni_BSS_HEAD property.
*
* @param value
* allowed object is
* {@link UNI_BSS_HEAD }
*
*/
public void setUNI_BSS_HEAD(UNI_BSS_HEAD value) {
this.uniBSSHEAD = value;
}
/**
* Gets the value of the uni_BSS_BODY property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY }
*
*/
public CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY getUNI_BSS_BODY() {
return uniBSSBODY;
}
/**
* Sets the value of the uni_BSS_BODY property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY }
*
*/
public void setUNI_BSS_BODY(CHANNEL_INFO_CHG_INPUT.UNI_BSS_BODY value) {
this.uniBSSBODY = value;
}
/**
* Gets the value of the uni_BSS_ATTACHED property.
*
* @return
* possible object is
* {@link UNI_BSS_ATTACHED }
*
*/
public UNI_BSS_ATTACHED getUNI_BSS_ATTACHED() {
return uniBSSATTACHED;
}
/**
* Sets the value of the uni_BSS_ATTACHED property.
*
* @param value
* allowed object is
* {@link UNI_BSS_ATTACHED }
*
*/
public void setUNI_BSS_ATTACHED(UNI_BSS_ATTACHED value) {
this.uniBSSATTACHED = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ws.chinaunicom.cn/BSdmChannelInfoSer/unibssBody/channelInfoChgReq}CHANNEL_INFO_CHG_REQ"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"channelINFOCHGREQ"
})
public static class UNI_BSS_BODY {
@XmlElement(name = "CHANNEL_INFO_CHG_REQ", namespace = "http://ws.chinaunicom.cn/BSdmChannelInfoSer/unibssBody/channelInfoChgReq", required = true)
protected CHANNEL_INFO_CHG_REQ channelINFOCHGREQ;
/**
* Gets the value of the channel_INFO_CHG_REQ property.
*
* @return
* possible object is
* {@link CHANNEL_INFO_CHG_REQ }
*
*/
public CHANNEL_INFO_CHG_REQ getCHANNEL_INFO_CHG_REQ() {
return channelINFOCHGREQ;
}
/**
* Sets the value of the channel_INFO_CHG_REQ property.
*
* @param value
* allowed object is
* {@link CHANNEL_INFO_CHG_REQ }
*
*/
public void setCHANNEL_INFO_CHG_REQ(CHANNEL_INFO_CHG_REQ value) {
this.channelINFOCHGREQ = value;
}
}
}
<file_sep>package cn.chinaunicom.ws.agentchargeinfosyncser;
import java.util.HashMap;
import javax.jws.WebService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCINPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTDEPOSITRECHSYNCOUTPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCINPUT;
import cn.chinaunicom.ws.agentchargeinfosyncser.unibssbody.AGENTPREPAYRECHSYNCOUTPUT;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.platform.recif.IRecIfProcessorSRV;
@WebService(
serviceName = "AgentChargeInfoSyncSer",
portName = "AgentChargeInfoSyncSerPort",
targetNamespace = "http://ws.chinaunicom.cn/AgentChargeInfoSyncSer/",
// wsdlLocation = "file:/D:/src/workspace/uip-uc_dev/wsdl/ImportAgentInfoSrv/importAgentInfoSrv.wsdl",
wsdlLocation = "classpath:wsdl/AgentChargeInfoSyncSer/META-INF/AgentChargeInfoSyncSer.wsdl",
endpointInterface = "cn.chinaunicom.ws.agentchargeinfosyncser.AgentChargeInfoSyncSer")
public class AgentChargeInfoSyncSerImpl implements AgentChargeInfoSyncSer {
private static final Log log = LogFactory.getLog(AgentChargeInfoSyncSerImpl.class);
@SuppressWarnings("unchecked")
@Override
public AGENTDEPOSITRECHSYNCOUTPUT agentDepositRechSync(
AGENTDEPOSITRECHSYNCINPUT parameters) {
log.info("开始执行押金保证金充值同步接口");
log.info(parameters);
try{
IRecIfProcessorSRV recIfProcessorSRV = (IRecIfProcessorSRV) ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.PAY_AGENT_DEPOSIT_RECH_SYNC, parameters);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
return (AGENTDEPOSITRECHSYNCOUTPUT)map.get(Constants.MapResult.MAP_RESULTOBJ);
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e);
}
}
@SuppressWarnings("unchecked")
@Override
public AGENTPREPAYRECHSYNCOUTPUT agentPrePayRechSync(
AGENTPREPAYRECHSYNCINPUT parameters) {
log.info("开始执行预存款充值同步接口");
log.info(parameters);
try{
IRecIfProcessorSRV recIfProcessorSRV = (IRecIfProcessorSRV) ServiceFactory.getService("com.ai.uip.platform.recif.RecIfProcessorSRV");
Object obj = recIfProcessorSRV.ifMsgProcessorForService(Constants.PAY_AGENT_PRE_PAY_RECH_SYNC, parameters);
HashMap<String, Object> map = (HashMap<String, Object>)obj;
return (AGENTPREPAYRECHSYNCOUTPUT)map.get(Constants.MapResult.MAP_RESULTOBJ);
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
<file_sep>package com.ai.uchintService.ftpFile;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.common.AIException;
import com.ai.cuframe.util.DbUtil;
import com.ai.uchintService.common.util.CastUtil;
import com.ai.uchintService.common.util.Constants;
import com.ai.uip.core.bo.UipOperateBean;
import com.ai.uip.platform.IPublishIfBase;
import com.ai.uip.platform.vo.PublishIfCfgVo;
public class JFPublishELFileSubsidies implements IPublishIfBase{
private static final Log logger = LogFactory.getLog(JFPublishELFileSubsidies.class);
private Map<String, Object> map = new Hashtable<String, Object>();
@Override
public HashMap<String, Object> pubIfParamGen(List<String> contentIdLst,
PublishIfCfgVo ifVo, Long logId, String syncType,
HashMap<String, Long> batchMap) {
HashMap<String, Object> obj = new HashMap<String, Object>();
logger.info("==============全成本实物补贴开始================");
String outFileName = "";
try{
/* 0设置成功返回的标示符和描述 */
obj.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_SUCCESSFUL);
obj.put(Constants.MapResult.MAP_RESULTMSG, "同步处理成功");
/* 1 循环生成文件 */
for(int i=0; i<contentIdLst.size(); i++){
outFileName = createLocalFile(contentIdLst.get(i), ifVo);
if(outFileName == null || outFileName.equals(Constants.FILE_STATE_UNDO)){
return null;
}
obj.put(Constants.MapResult.MAP_RESULTOBJ, outFileName);
}
/* 2 返回发送数据 */
return obj;
}catch(Exception e){
e.printStackTrace();
//清除obj数据、设置错误代码和描述、返回
obj.clear();
obj.put(Constants.MapResult.MAP_RESULTCODE, Constants.MapResultCode.CODE_OTHER_ERROR);
obj.put(Constants.MapResult.MAP_RESULTMSG, "生成数据错误" + e.getMessage());
obj.put(Constants.MapResult.MAP_RESULTOBJ, null);
return obj;
}finally{
if(outFileName != null){
String file_status = "";
if(outFileName.endsWith(Constants.FILE_STATE_UNDO)){
file_status = Constants.FILE_STATE_UNDO;
}else{
file_status = Constants.FILE_STATE_FAIL;
}
map.put("file_status", file_status);
}
}
}
@Override
public HashMap<String, Object> pubIfRetMsgProc(Object ifMsg,
PublishIfCfgVo ifVo, Long logId, List<String> contentIdLst,
HashMap<String, Long> batchMap) {
// TODO Auto-generated method stub
return null;
}
@Override
public HashMap<String, Object> pubIfServiceAdapter(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
// TODO Auto-generated method stub
return null;
}
@Override
public HashMap<String, Object> pubIfServiceContinue(Object ifMsg,
PublishIfCfgVo ifVo, Long logId) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean pubIfRetErrorMax(String contentId) {
// TODO Auto-generated method stub
return false;
}
/**
* 生成本地文本文件,并返回完整文件路径名
*/
private synchronized String createLocalFile(String contentId, PublishIfCfgVo ifVo) throws Exception{
//文件内容集合
List<String> contentList = new ArrayList<String>();
//清空map
map.clear();
try{
//文件名称
String filename = "";
//获取账期 提前两个月的账期
String acct_cycle_2 = CastUtil.getAcct2(-1);
//提前一个月的账期
String acct_cycle_1 = CastUtil.getAcct2(2);
if (acct_cycle_2==null || acct_cycle_2.equals("")) {
logger.info("===============查询账期表返回null===================");
throw new Exception("账期不合法或指定账期内没有数据!");
}
if (acct_cycle_1==null || acct_cycle_1.equals("")) {
logger.info("===============查询账期表返回null===================");
throw new Exception("账期不合法或指定账期内没有数据!");
}
filename="CMBQDDMAL06004A"+acct_cycle_1+"0001001.000";
File outFile = new File(ifVo.getOperBean().getFileBackupPath()+File.separator+filename);
FileWriter fw = new FileWriter(outFile);
logger.info("filename:"+filename);
String acct_cycle = "";
for(int j=0; j<6 ; j++){
//根据sql不同取不同的账期
if(j == 2||j == 3){
acct_cycle = acct_cycle_1;
}else{
acct_cycle = acct_cycle_2;
}
//获取sql
String sql = getSql(j, acct_cycle);
List<Map<String,Object>> resultList = DbUtil.query(sql, null);
if (resultList !=null && resultList.size()>0) {
for(int i=0;i<resultList.size();i++) {
//上传文件的内容
String fileContent = "";
//期间
fileContent += acct_cycle+"\t";
//全成本指标ID
// if(resultList.get(i).get("erp_client_code").equals("02")){
// fileContent += "3030201"+"\t";
// }else if(resultList.get(i).get("erp_client_code").equals("03")){
// fileContent += "3030203"+"\t";
// }else{
// fileContent += "\t";
// }
fileContent += resultList.get(i).get("erp_client_code")+"\t";
//公司编码
fileContent += resultList.get(i).get("erp_area_code")+"\t";
//成本中心
fileContent += resultList.get(i).get("cost_cen")+"\t";
// String sql_conver = "select a.conver_code from INT_CONVER_RELATION a "+
// " where a.data_type = '"+resultList.get(i).get("data_type")+"' and a.tele_type = '"+resultList.get(i).get("erp_tele_type")+"' "+
// " and a.trade_code = '"+resultList.get(i).get("trade_code")+"' and a.client_code = '"+resultList.get(i).get("erp_client_code")+"'";
// //专业
fileContent += resultList.get(i).get("erp_tele_type")+"\t";
//会计科目
// fileContent += "55011101010101"+"\t";
fileContent +=resultList.get(i).get("subject")+"\t";
//往来
fileContent += "0"+"\t";
//项目
fileContent += "0"+"\t";
//客户群
fileContent += "00"+"\t";
//备用1
fileContent += "0"+"\t";
//备用2
fileContent += "0"+"\t";
//金额
String money = resultList.get(i).get("total_money")+"";
fileContent += money+"\t";
//摘要
fileContent += resultList.get(i).get("busi_type")+"\t";
// fileContent += "\t";
//最后更新日期
fileContent+=resultList.get(i).get("update_date")+"\t";
//备用字段1
fileContent+=resultList.get(i).get("date_type")+"\t";
//渠道类型,代替原来的备用字段二
logger.info("chnl_kind_id:"+resultList.get(i).get("chnl_kind_id"));
fileContent+=resultList.get(i).get("chnl_kind_id")+"\t";
//备用字段2-5
//fileContent += "\t\t\t\t";
//备用字段3-5
fileContent += "\t\t\t";
//回车换行
fileContent += "\r\n";
// lineContent = FtpFileCommon.handlerArray(fileContent);
contentList.add(fileContent);
fw.append(fileContent);
}
}
}
if(contentList !=null && contentList.size()>0){
//设置map内容
map.put("data_type", 2);
map.put("filename", filename);
map.put("contentList", contentList);
}else{
//设置map内容
map.put("data_type", 2);
map.put("filename", filename);
map.put("contentList", contentList);
logger.info("=====中间结果表中没有符合要求的数据:contentList为空 ======");
return Constants.FILE_STATE_UNDO;
}
fw.flush();
fw.close();
return outFile.getAbsolutePath();
}catch(Exception e){
e.printStackTrace();
logger.info("生成文件报错.");
return null;
}
}
private String getSql(int sqlId, String acct_cycle){
String sql = "";
if(sqlId == 0){
//--应付现返佣金
sql = "select " +
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,replace(a.cost_cen,'U','') cost_cen,nvl(sum(a.total_menoey),0) total_money,to_char(update_date,'YYYY-MM-DD HH24:MI:SS ') update_date,erp_area_code,erp_tele_type,busi_type,a.subject,1 date_type " +
" ,a.chnl_kind_id "+
" from INT_ERP_TEMP_RESULT a " +
" where data_type=16 and ACCT_MONTH='"+acct_cycle+"' " +
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,update_date,erp_area_code,erp_tele_type,busi_type,subject,a.chnl_kind_id";
}else if(sqlId == 1){
//--应付实物补贴
sql = "select " +
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,replace(a.cost_cen,'U','') cost_cen,nvl(sum(a.total_menoey),0) total_money,to_char(update_date,'YYYY-MM-DD HH24:MI:SS ') update_date,erp_area_code,erp_tele_type,busi_type,a.subject,2 date_type " +
" ,a.chnl_kind_id "+
" from INT_ERP_TEMP_RESULT a " +
" where data_type=15 and ACCT_MONTH='"+acct_cycle+"' " +
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,update_date,erp_area_code,erp_tele_type,busi_type,subject,a.chnl_kind_id ";
}else if(sqlId == 2){
//--预提现返佣金
sql = "select " +
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,replace(a.cost_cen,'U','') cost_cen,nvl(sum(a.total_menoey),0) total_money,to_char(update_date,'YYYY-MM-DD HH24:MI:SS ') update_date,erp_area_code,erp_tele_type,busi_type,a.subject,3 date_type " +
" ,a.chnl_kind_id "+
" from INT_ERP_TEMP_RESULT a " +
" where data_type=14 and ACCT_MONTH='"+acct_cycle+"' " +
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,update_date,erp_area_code,erp_tele_type,busi_type,subject,a.chnl_kind_id ";
}else if(sqlId == 3){
//--预提实物补贴
sql = "select " +
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,replace(a.cost_cen,'U','') cost_cen,nvl(sum(a.total_menoey),0) total_money,to_char(update_date,'YYYY-MM-DD HH24:MI:SS ') update_date,erp_area_code,erp_tele_type,busi_type,a.subject,4 date_type " +
" ,a.chnl_kind_id "+
" from INT_ERP_TEMP_RESULT a " +
" where data_type=13 and ACCT_MONTH='"+acct_cycle+"' " +
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,update_date,erp_area_code,erp_tele_type,busi_type,subject,a.chnl_kind_id";
}else if(sqlId == 4){
//--冲销预提现返佣金
sql = "select " +
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,replace(a.cost_cen,'U','') cost_cen,nvl(sum(-a.total_menoey),0) total_money,to_char(update_date,'YYYY-MM-DD HH24:MI:SS ') update_date,erp_area_code,erp_tele_type,busi_type,a.subject,5 date_type " +
" ,a.chnl_kind_id "+
" from INT_ERP_TEMP_RESULT a " +
" where data_type=14 and ACCT_MONTH='"+acct_cycle+"' " +
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,update_date,erp_area_code,erp_tele_type,busi_type,subject,a.chnl_kind_id ";
}else if(sqlId == 5){
//--冲销预提实物补贴
sql = "select " +
" a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,replace(a.cost_cen,'U','') cost_cen,nvl(sum(-a.total_menoey),0) total_money,to_char(update_date,'YYYY-MM-DD HH24:MI:SS ') update_date,erp_area_code,erp_tele_type,busi_type,a.subject,6 date_type " +
" ,a.chnl_kind_id "+
" from INT_ERP_TEMP_RESULT a " +
" where data_type=13 and ACCT_MONTH='"+acct_cycle+"' " +
" group by a.data_type,a.erp_tele_type,a.trade_code,a.erp_client_code,a.cost_cen,update_date,erp_area_code,erp_tele_type,busi_type,subject,a.chnl_kind_id ";
}
return sql;
}
public static void main(String[] ags ){
PublishIfCfgVo vo =new PublishIfCfgVo();
JFPublishELFileSubsidies aa=new JFPublishELFileSubsidies();
List ll = new ArrayList<String>();
ll.add("1");
UipOperateBean operBean;
try {
operBean = new UipOperateBean();
operBean.setFileBackupPath("c:\\TEMP");
vo.setOperBean(operBean);
aa.pubIfParamGen(ll, vo, null, null, null);
} catch (AIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.ai.uint.ftp.util.ColumnCheckRule;
public interface IDownEssFileExtBusiSV {
public int save(String execSql, String[] dbColumnNames, List<Map> columnValuesList, Map<String,ColumnCheckRule> columnDefMap) throws SQLException;
}
<file_sep>package com.ai.uchintService.busi.service.interfaces;
import java.util.Date;
import com.ai.uchintService.common.bo.UC_TF_CHL_PAY_APPLYBean;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.PAYMENT_LINE_INFOItem;
import com.unicom.mss.sb_uc_uc_importpaymentresultinfosrv.SB_UC_UC_ImportPaymentResultInfoSrvInputItem;
public interface IPaymentResultSV {
public boolean importPaymentResultInfo(PAYMENT_LINE_INFOItem paymentLINEINFOItem,String auditReturnMessage,Date lateUpdatedate,String voucherNumber,String provinceCode) throws Exception;
public boolean compareVoucherNumber(SB_UC_UC_ImportPaymentResultInfoSrvInputItem paymetResultInfoItem,String provinceCode) throws Exception;
public UC_TF_CHL_PAY_APPLYBean[] getBeans(String batchId, String lineId,String provinceCode)throws Exception;
public boolean changeAreaCode(String areaCode) throws Exception;
}
| 8b9bcae5727a5b4cd7a95d6ae6522f1c65115562 | [
"Markdown",
"Java",
"Ant Build System",
"INI"
] | 220 | INI | liduote/UIP_PRODUCT | c7913bf8cc6fff10c22aee2445ae6d271694ed82 | f382d71f79d6ee70c072dd23afff16ec3b6d9871 |
refs/heads/master | <repo_name>Simakeng/Sync<file_sep>/README.ZH.MD
# Sync - 远程文件实时同步工具
[English](README.MD)
这是一个远程文件同步工具。这个工具可以让多个客户端的文件保持实时同步(取决于网速)。
特性列表:
- 实时文件同步 助力多人合作异地办公
- RSA + RC4 文件加密 保障数据安全
- 简易单配置易上手<file_sep>/Shared/Common/Cryptography/CRC32.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Sync.Common.Cryptography
{
class CRC32
{
static uint[] table = InitializeTable();
static uint[] InitializeTable()
{
if (!BitConverter.IsLittleEndian)
throw new PlatformNotSupportedException("Not supported on Big Endian processors");
var table = new UInt32[256];
for (var i = 0; i < 256; i++)
{
var entry = (UInt32)i;
for (var j = 0; j < 8; j++)
if ((entry & 1) == 1)
entry = (entry >> 1) ^ 0xedb88320u;
else
entry >>= 1;
table[i] = entry;
}
return table;
}
uint _hash = 0;
public uint hash
{
get { return _hash; }
}
public CRC32()
{
}
public void Compute(IList<byte> buffer, int start, int size)
{
for (var i = start; i < start + size; i++)
_hash = (hash >> 8) ^ table[buffer[i] ^ hash & 0xff];
}
public void Compute(byte[] arr)
{
Compute(arr, 0, arr.Length);
}
public void Compute(string str)
{
Compute(Encoding.UTF8.GetBytes(str));
}
public void Compute<T>(T value)
{
foreach (var GetBytes in typeof(BitConverter).GetMethods())
{
if (GetBytes.Name != "GetBytes")
continue;
if (GetBytes.GetParameters()[0].ParameterType != typeof(T))
continue;
var bytes = GetBytes.Invoke(null, new object[] { value }) as byte[];
Compute(bytes);
return;
}
throw new Exception("BitConverter Don't have GetBytes Instance that recive parameter with type " + typeof(T).FullName);
}
public override string ToString()
{
return _hash.ToString("X08");
}
}
}<file_sep>/Shared/Common/Protocal/Common.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Sync.Common.Protocal
{
enum Command
{
Connection,
Authorization,
QueryDirectoryInfo,
QueryFileInfo,
QueryDirectoryStructure,
DownloadFileContent,
UploadFileContent,
RequestFile,
StopRequestFile,
SendFile,
StopSendFile,
}
enum Info
{
FileChanged,
FileDeleted,
FileCreated,
DirectoryCreated,
DirectoryDeleted,
}
enum PacketType
{
Ping = 0,
Pong = 1,
Command = 2,
Info = 3,
Data = 4,
}
}
<file_sep>/SyncServer/Common/Network/Protocal/SyncHost.cs
using System;
using Sync.Common.Network;
using System.Net.Sockets;
using System.Collections.Generic;
using System.Threading;
namespace Sync
{
class SyncHost : SocketHost
{
List<Socket> clients = new List<Socket>();
public SyncHost(string host, int port, int maxclient, int maxcon) : base(host, port, maxcon)
{
ConnectionEnstablished += (Socket s) =>
{
if (clients.Count > maxclient)
{
// TODO : tell client we are full.
s.Close();
}
else
NewClientConnected(this, s);
};
}
private static void CheckClientVersion(Socket s)
{
};
private static void NewClientConnected(SyncHost host, Socket sclient)
{
host.clients.Add(sclient);
try
{
CheckClientVersion(sclient);
}
catch (Exception)
{
host.clients.Remove(sclient);
sclient.Close();
throw;
}
}
public void Deamon()
{
while (!Stoped)
Thread.Sleep(1);
}
}
}<file_sep>/Shared/Common/Protocal/DataTypes.cs
using System;
using System.IO;
using System.Text;
namespace Shared.Common.Types
{
internal class Length
{
public static byte[] Pack(int length)
{
byte[] res = null;
if (length < 0x7F)
{
res = new byte[] { (byte)length };
}
else if (length < 0x3FFF)
{
res = BitConverter.GetBytes((ushort)(length | 0x8000));
}
else
{
res = BitConverter.GetBytes((uint)(length | 0xC0000000));
}
return res;
}
public static int Unpack(Stream s)
{
var buffer = new byte[4];
s.Read(buffer, 0, 1);
if ((buffer[0] & 0x80) == 0)
return buffer[0];
else if ((buffer[0] & 0x40) == 0)
{
s.Read(buffer, 1, 1);
return BitConverter.ToInt16(buffer) & 0x3FFF;
}
else
{
s.Read(buffer, 1, 3);
return BitConverter.ToInt32(buffer) & 0x3FFFFFFF;
}
}
}
internal class String
{
public static byte[] Pack(string s)
{
MemoryStream ms = new MemoryStream();
StreamWriter sw = new StreamWriter(ms, Encoding.UTF8);
sw.Write(Length.Pack(s.Length));
sw.Write(s);
return ms.ToArray();
}
public static string Unpack(Stream s)
{
var len = Length.Unpack(s);
var buffer = new byte[len];
s.Read(buffer, 0, len);
return Encoding.UTF8.GetString(buffer);
}
}
internal class Object
{
public static byte[] Pack(object o)
{
// if o is string
if (o.GetType() == typeof(string))
return String.Pack(o as string);
// if o has a Pack Function
var funcPack = o.GetType().GetMethod("Pack");
if (funcPack != null)
return funcPack.Invoke(null, null) as byte[];
// if o can be convert to byte array by BitConverter
foreach (var func in typeof(BitConverter).GetMethods())
{
if (func.Name != "GetBytes")
continue;
var parms = func.GetParameters();
if (parms.Length != 0 && parms[0].GetType() == o.GetType())
return func.Invoke(null, new object[1] { o }) as byte[];
}
throw new TypeAccessException("Type <" + o.GetType().FullName + "> Is not Pack able!");
}
public static string Unpack(Stream s)
{
if (s.GetType() == typeof(string))
return String.Unpack(s);
}
}
}<file_sep>/Shared/Common/Network/Packet.cs
using Sync.Common.Cryptography;
using Sync.Common.Protocal;
using System;
using System.IO;
namespace Sync.Common.Network
{
/*
* ------------------------------------
* | SYNC | TYPE | LEN | DATA | CRC32 |
* ------------------------------------
*
* |------------------------------------------------------------------------------|
* | name | desc | length | note |
* |-------|------------------------------------|---------|-----------------------|
* | SYNC | sync header | 4byte | value fixed to "SYNC" |
* | PCID | id of this packet | 4byte | |
* | TYPE | type of this packet | 1byte | |
* | LEN | length of DATA segement | 1-4byte | see below |
* | DATA | packet data | ....... | |
* | CRC32 | crc32 cheksum of the entire packet | 4byte | |
* |------------------------------------------------------------------------------|
*
* When data length not greater than 127, the LEN is 1byte.
* When data length greater than 127, the LEN is 2byte.
* First bit of LEN is 1,the rest is the actual length.
*/
class Packet
{
public Packet() { }
private int _type = -1;
protected PacketType packetType
{
get
{
return (PacketType)_type;
}
set
{
_type = (int)value;
}
}
static Random rand = new Random();
static uint NewPacketID()
{
byte[] buf = new byte[4];
rand.NextBytes(buf);
return BitConverter.ToUInt32(buf, 0);
}
public uint packetID { get; } = NewPacketID();
MemoryStream datas = new MemoryStream();
public void AppendData(byte[] data)
{
datas.Write(data, 0, data.Length);
}
public byte[] ToBytes()
{
CRC32 crc32 = new CRC32();
var ms = new MemoryStream();
var sw = new StreamWriter(ms);
const string magic = "SYNC"; // magic!
sw.Write(magic);
crc32.Compute(magic);
sw.Write(packetID);
crc32.Compute(packetID);
sw.Write(_type);
crc32.Compute(_type);
var len = datas.Length;
if (len <= 127)
{
sw.Write((char)len);
crc32.Compute(new byte[] { (byte)len });
}
else
{
sw.Write((ushort)len & 0x8000);
crc32.Compute((ushort)len & 0x8000);
}
datas.Seek(0, SeekOrigin.Begin);
datas.CopyTo(ms);
crc32.Compute(datas.ToArray());
sw.Write(crc32.hash);
return ms.ToArray();
}
}
class InfoPacket : Packet
{
InfoPacket()
{
packetType = PacketType.Info;
}
public Info info { get; set; }
}
}<file_sep>/Shared/Common/Cryptography/RSA.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace Shared.Common.Cryptography
{
class RSA
{
RSACryptoServiceProvider rsp;
public RSA()
{
rsp = new RSACryptoServiceProvider();
}
public RSA(string xmlstring) : this()
{
rsp.FromXmlString(xmlstring);
}
private static string ConvertOpenSSLPublicKeyToXMLString(string pkey)
{
throw new NotImplementedException();
}
private static string ConvertOpenSSLPrivateKeyToXMLString(string pkey)
{
throw new NotImplementedException();
}
static RSA FromOpenSSLPublicKeyFile(string path)
{
var content = File.ReadAllText(path);
var xml = ConvertOpenSSLPublicKeyToXMLString(content);
return new RSA(xml);
}
static RSA FromOpenSSLPrivateKeyFile(string path)
{
var content = File.ReadAllText(path);
var xml = ConvertOpenSSLPrivateKeyToXMLString(content);
return new RSA(xml);
}
public byte[] Encrypt(byte[] rawdata) { return null; }
public byte[] Decrypt(byte[] rawdata) { return null; }
}
}
<file_sep>/Shared/Common/Protocal/PacketDatas/InfoPacket.cs
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace Shared.Common.Protocal.PacketData
{
public class ClientInfo
{
public string Name { get; set; }
public string MachineName { get; set; }
public string MachineMacAddress { get; set; }
public string TimeZone { get; set; }
public string ClientSigniture { get; set; }
public string ClientPublicKey { get; set; }
public byte[] Pack()
{
MemoryStream ms = new MemoryStream();
ms.Write(Types.String.Pack(Name));
ms.Write(Types.String.Pack(MachineName));
ms.Write(Types.String.Pack(MachineMacAddress));
ms.Write(Types.String.Pack(TimeZone));
return ms.ToArray();
}
public static ClientInfo Unpack(Stream s)
{
var info = new ClientInfo();
info.Name = Types.String.Unpack(s);
info.MachineName = Types.String.Unpack(s);
info.MachineMacAddress = Types.String.Unpack(s);
info.TimeZone = Types.String.Unpack(s);
return info;
}
}
}
<file_sep>/Shared/Common/Network/SocketHost.cs
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace Sync.Common.Network
{
internal class SocketHost
{
private Socket server;
private bool _stop = false;
private Thread hostThread;
public SocketHost(string host, int port, int maxcon)
{
server = new Socket(SocketType.Stream, ProtocolType.Tcp);
server.Bind(new IPEndPoint(IPAddress.Parse(host), port));
server.Listen(maxcon);
hostThread = new Thread(() =>
{
try
{
while (!_stop)
{
if (ConnectionEnstablished != null)
{
var client = server.Accept();
Thread clientThread = new Thread(() =>
{
ConnectionEnstablished.Invoke(client);
if (client.Connected)
client.Close();
});
clientThread.Start();
}
Thread.Sleep(0);
}
}
catch
{
this._stop = true;
throw;
}
});
hostThread.Start();
}
public void Stop()
{
_stop = true;
if (hostThread.IsAlive)
hostThread.Join();
}
public bool Stoped { get { return _stop; } }
~SocketHost()
{
Stop();
}
public Action<Socket> ConnectionEnstablished { get; set; } = null;
}
}<file_sep>/README.MD
# Sync - Real Time Remote File Synchronization Tool
[简体中文](README.ZH.MD)
This is a remote file synchronization tool. It can keep the files of multiple clients synchronized in real time(depends on the network speed).
Features:
- Real-time file synchronization helps multi-person cooperation in remote offices
- RSA + RC4 file encryption to ensure data security
- Simple single configuration easy to use<file_sep>/Shared/Common/Protocal/PacketDatas/CommandPacket.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Common.Protocal.PacketData
{
class ConnectionCommand
{
public string ClientVersion { get; set; }
public string ClientSigniture { get; set; }
public string ClientPublicKey { get; set; }
}
}<file_sep>/SyncServer/Program.cs
using System;
using Sync.Common.Network;
using System.Threading;
using System.Net.Sockets;
using Sync.Common.Cryptography;
namespace Sync
{
class Program
{
static void Main(string[] args)
{
SyncHost host = new SyncHost("0.0.0.0", 8686, 10, 10);
host.Deamon();
}
}
}
<file_sep>/Shared/Common/Protocal/PacketDatas/Common.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Shared.Common.Protocal.PacketDatas
{
public class PacketData
{
public byte[] Pack<T>(T data)
{
MemoryStream ms = new MemoryStream();
foreach (var prop in typeof(T).GetProperties())
{
if (prop.PropertyType == typeof(string))
{
string s = prop.GetValue(data) as string;
ms.Write(Types.Length.Pack(s.Length));
ms.Write(Types.String.Pack(s));
}
}
return ms.ToArray();
}
public T UnPack<T>(Stream s)
{
}
}
}
| 47486f652819c49f8e95ac4eac77812ce48ada7a | [
"Markdown",
"C#"
] | 13 | Markdown | Simakeng/Sync | e7fca271fb95dd11f3adcfb43e0b3cefe212ab70 | 6fef744f87bfb60a03fca84c7b063e023cae7caa |
refs/heads/master | <file_sep>function setResultado(value) {
document.getElementById('output').value = value;
}
function obtenerResultado() {
return(document.getElementById('output').value);
}
function agregar(entrada, event) {
var result = obtenerResultado();
if (result!='0' || isNaN(entrada)) setResultado(result + entrada);
else setResultado(entrada);
}
function calcular() {
var result = eval(obtenerResultado());
setResultado(result);
}
function limpiar() {
setResultado(0);
}<file_sep># Bootcamp 2019
Recopilación de algunos ejercicios realizados en el bootcamp JS 2019 [VER](https://danielm2402.github.io/RetosBootcamp/)
## Features
* JS
* HTML
* VUEJS
## Screenshots

 | 4e08e8718ffe9060e035cae54d36b9bb39de5122 | [
"JavaScript",
"Markdown"
] | 2 | JavaScript | danielm2402/RetosBootcamp | 6767c9bb57a99e805233debbc48c4b8654f4e457 | 5f162b7b83439f1c151c16330df41da42700907f |
refs/heads/master | <file_sep>const express = require('express')
const router = express.Router()
const Owner = require('../../models/owner')
const auth = require('../../middleware/auth')
router.post('/owner/register', async (req, res) => {
const owner = new Owner(req.body)
try {
await owner.save()
const token = await owner.generateAuthToken()
res.status(201).send({ owner, token})
} catch (e) {
res.status(400).send(e)
}
})
router.post('/owner', async (req, res) => {
try {
const owner = await Owner.findByCredentials(req.body.email, req.body.password)
const token = await owner.generateAuthToken()
res.send({ owner, token})
} catch(e) {
res.status(400).send()
}
})
module.exports = router<file_sep>const mongoose = require('mongoose')
const hyderabadcarSchema = new mongoose.Schema({
car_model: {
type: String,
required: true,
//trim: true
},
car_type: {
type: String,
required: true,
//trim: true
},
car_number: {
type: String,
required: true,
//trim: true
},
owner_id: {
type: String,
required: true,
//trim: true
},
owner_name: {
type: String,
required: true,
//trim: true
}
// documents: [{
// rc: {
// type: String,
// required: true
// }
//}]
})
const Hyderabadcar = mongoose.model('Hyderabadcar', hyderabadcarSchema)
module.exports = Hyderabadcar<file_sep>## About The Project
This project is about creating, updating, reading and deleting users where all users are stored in MongoDB.
## Built With
- Node.js
- Express.js
- Mongoose
## Getting Started
Initialize the npm.
```sh
npm init -y
```
Created following files:
- ***index.js***<br />
This file contains logic related to server. Local port used here 3000 and also used express.json() which parses incoming requests with JSON payloads and is based on body-parser.
- ***router/user.js***<br />
This files has logic related to RESTAPIs which uses Router from Express.js. GET, POST, PATCH, DELETE were used here to get, create, update and delete data.
- ***model/user.js***<br />
User model such as what are neccessary, validating input and how an object should be are written here. It uses mongoose schema to model the object.
- ***db/mongoose.js***<br />
Connections and parsers related to the database which is MongoDB in our case are written here.
## Running Application
Enable database.
```sh
/mongodb/bin/mongod.exe --dbpath=/<path of your mongodb>
```
Use following command to run the application.
```sh
npm run dev
```
## Git Commands Used
```sh
git add .
git commit
git push origin master
```
<file_sep>const http = require('http')
const express = require('express')
const socketio = require('socket.io')
const logger = require('../logger')
const router = new express.Router()
const User = require('../models/user_model')
const path = require('path')
const fs = require('fs')
const io = require("socket.io")
router.get('/ping', async (req, res) => {
User.find({}).then((users) => {
logger.log('success', 'Fetching users list')
setTimeout(() => {res.send(users)}, 2000)
}).catch((e) => {
logger.log('debug', 'Infrastructure at peak load')
res.status(404).send(e)
})
})
router.get('/monitor', async (req, res) => {
logger.log('info', 'admin logged in')
res.sendFile(path.join(__dirname, '../../logs.log'))
io.sockets.on('connection', function(socket) {
fs.watch(path.join(__dirname, '../../logs.log'), function(event, filename) {
console.log("Event:", event);
if (event == "change") {
fs.readFile(path.join(__dirname, '../../logs.log'),"UTF-8", function(err, data) {
if (err) throw err
socket.emit("receiveFile", data )
})
}
})
})
})
module.exports = router<file_sep>const mongoose = require('mongoose')
const validator = require('validator')
const userSchema = new mongoose.Schema({
fullname: {
type: String,
required: true,
trim: true
},
email: {
type: String,
unique: true,
required: true,
trim: true,
lowercase: true,
validate(value) {
if (!validator.isEmail(value)) {
throw new Error('Email is invalid')
}
}
},
phone: {
unique: true,
type: Number,
required: true,
minlength: 8,
trim: true,
},
address: {
street: String,
locality: String,
city: String,
state: String,
pincode: String,
coordinatesType: String,
coordinates: [Number]
},
distance: {
type: Number
}
}, {
timestamps: true
})
const User = mongoose.model('User', userSchema)
module.exports = User<file_sep>const mongoose = require('mongoose')
const userSchema = new mongoose.Schema({
name: {
type: String
},
age: {
type: Number
}
})
const User = mongoose.model('User', userSchema)
//Here are the commented lines which I hard-coded for user creation in Mongodb.
// const me = new User({
// name: 'Ganesh',
// age: 24
// })
// me.save().then(() => {
// console.log(me)
// }).catch((error) => {
// console.log(error)
// })
module.exports = User<file_sep>const mongoose = require('mongoose')
const validator = require('validator')
const bcrypt = require('bcryptjs')
const jwt = require('jsonwebtoken')
const ownerSchema = new mongoose.Schema({
fullname: {
type: String,
required: true,
trim: true
},
email: {
type: String,
unique: true,
required: true,
trim: true,
lowercase: true,
validate(value) {
if (!validator.isEmail(value)) {
throw new Error('Email is invalid')
}
}
},
password: {
type: String,
required: true,
minlength: 8,
trim: true,
},
tokens: [{
token: {
type: String,
required: true
}
}]
})
/*ownerSchema.virtual('posts', {
ref: 'Post',
localField: '_id',
foreignField: 'owner'
})*/
/*When a Mongoose document is passed to res.send, Mongoose converts the object into
JSON. You can customize this by adding toJSON as a method on the object. The method
below removes the password and tokens properties before sending the response back*/
ownerSchema.methods.toJSON = function () {
const owner = this
const ownerObject = owner.toObject()
delete ownerObject.password
delete ownerObject.tokens
//delete Object.avatar
return ownerObject
}
ownerSchema.statics.findByCredentials = async (email, password) => {
const owner = await Owner.findOne({ email })
if (!owner) {
throw new Error('Unable to login')
}
const isMatch = await bcrypt.compare(password, owner.password)
if (!isMatch) {
throw new Error('Unable to login')
}
return owner
}
ownerSchema.methods.generateAuthToken = async function () {
const owner = this
const token = jwt.sign({ _id: owner._id.toString() }, 'weplaybasketball')
owner.tokens = owner.tokens.concat({ token })
await owner.save()
return token
}
//isModified works when the user updates the pwd or creates the new pwd
ownerSchema.pre('save', async function (next) {
const owner = this
if(owner.isModified('password')) {
owner.password = await bcrypt.hash(owner.password, 8)
}
next()
})
const Owner = mongoose.model('Owner', ownerSchema)
module.exports = Owner<file_sep>const express = require('express')
const router = express.Router()
const Admin = require('../../models/admin')
const auth = require('../../middleware/auth')
const Hyderabadcar = require('../../models/hyderabadcars')
router.post('/admin/register', async (req, res) => {
const admin = new Admin(req.body)
try {
await admin.save()
res.status(201).send({ admin })
} catch (e) {
res.status(400).send(e)
}
})
router.post('/admin', async (req, res) => {
try {
const admin = await Admin.findByCredentials(req.body.username, req.body.password)
const token = await admin.generateAuthToken()
res.send({ admin, token})
} catch(e) {
res.status(400).send()
}
})
router.post('/admin/hyderabadcars', async (req, res) => {
const hyderabadcar = new Hyderabadcar(req.body)
try {
await hyderabadcar.save()
res.status(201).send( { hyderabadcar } )
} catch (e) {
res.status(400).send(e)
}
})
module.exports = router<file_sep>const path = require('path')
const express = require('express')
require('./mongodb')
const web_route = require('./routers/route')
const app = express()
const viewsPath = path.join(__dirname, '../views')
app.set('view engine', 'hbs')
app.set('views', viewsPath)
app.get('', (req, res) => {
res.render('index')
})
app.use(web_route)
module.exports = app<file_sep>const express = require('express')
const router = express.Router()
const User = require('../../models/user')
const auth = require('../../middleware/auth')
const city = 'hyderabad'
router.get('/', async (req, res) => {
res.send( { Response: 'This is web page' })
})
router.get('/home', async (req, res) => {
res.send( {Response: 'This is home page'})
})
router.get('/'+city+'/cars', async (req, res) => {
res.send( { Response: 'This is '+city+' cars page' })
})
router.get('/'+city+'/bikes', async (req, res) => {
res.send( { Response: 'This is '+city+' bikes page' })
})
router.get('/'+city+'/sharedride', async (req, res) => {
res.send( { Response: 'This is '+city+' ride page' })
})
module.exports = router<file_sep>const express = require('express')
const auth = require('../middleware/auth')
const Post = require('../models/post')
const router = new express.Router()
const multer = require('multer')
const upload_post = multer({
dest: 'posts',
limits: {
fileSize: 10000000
},
fileFilter(req, file, cb) {
if (!file.originalname.match(/\.(jpeg|jpg|png)$/)) {
return cb(new Error('Upload an image.'))
}
cb(undefined, true)
}
})
router.post('/posts', auth, upload_post.single('upload_post'), async (req, res) => {
const post = new Post({
...req.body,
owner: req.user._id
})
try {
await post.save()
res.status(201).send(post)
} catch (e) {
res.status(400).send(e)
}
})
router.get('/posts', auth, async (req, res) => {
try {
await req.user.populate('posts').execPopulate()
res.send(req.user.posts)
} catch (e) {
res.status(500).send()
}
})
router.get('/posts/:id', auth, async (req, res) => {
const _id = req.params.id
try {
const post = await Post.findOne({_id, owner: req.user._id})
if(!post) {
res.status(404).send()
}
res.send(post)
}
catch (e) {
res.status(500).send()
}
})
router.delete('/posts/:id', auth, async (req, res) => {
try {
const post = await Post.findOneAndDelete({_id: req.params.id, owner: req.user._id})
if(!post) {
res.status(404).send()
}
res.send(post)
} catch (e) {
res.status(500).send()
}
})
module.exports = router<file_sep>// const n = 5
// let n1=0, n2=1, n3
// const arr = [4,2,3,1,5]
// // for(let i=1;i<=n;i++){
// // console.log(n1)
// // n3 = n1+n2
// // n1=n2
// // n2=n3
// // }
// const myfunc = (num) => {
// return num * 10
// }
// console.log(arr.map(myfunc))
// console.log(arr.sort())
// console.log(arr.reverse())
// arr.splice(2,1,15,14)
// console.log(arr)
<file_sep>const express = require('express')
const router = express.Router()
const User = require('../model/user')
//Router to create new users
router.post('/register', async (req, res) => {
const user = new User(req.body)
try {
await user.save()
res.status(201).send({ user })
} catch (e) {
res.status(400).send(e)
}
})
//Router to update users data by considering phone as unique field
router.patch('/userupdate', async (req, res) => {
User.findOneAndUpdate(req.query.phone, req.body, function (err, user) {
if(err) {
res.status(400).send(err)
} else {
res.send(user)
}
})
})
//Router to get list of all users
router.get('/allusers', async(req, res) => {
User.find({}).then((users) => {
res.send(users)
}).catch((e) => {
res.status(500).send()
})
})
//Router to delete user
router.delete('/deleteuser', async (req, res) => {
User.findOneAndRemove(req.body, function(err, user) {
if(err) {
res.status(500).send()
} else {
res.send(user)
}
})
})
module.exports = router<file_sep>const express = require('express')
const path = require('path')
require('./db/mongoose')
//const User = require('./models/user')
const userRouter = require('./routers/user')
const postRouter = require('./routers/post')
const bodyParser = require('body-parser')
const app = express()
const port = process.env.PORT || 3000
const publicDirectoryPath = path.join(__dirname, '../public')
// app.use((req, res, next) => {
// res.status(503).send('Site is currently down. Check back soon!')
// })
app.use(express.static(publicDirectoryPath))
app.use(express.json())
app.use(userRouter)
app.use(postRouter)
app.use(bodyParser.json())
app.listen(port, () => {
console.log('Server is up on port: '+port)
}) | 20928576c9cf1cc99a19707fea3a5110668f05ac | [
"JavaScript",
"Markdown"
] | 14 | JavaScript | sujithranag/hilight | 2cf470d48ac23803f6fc4f6430ee7d7d633f5ffe | fa1872bc7c3d079ac778f8f1f044f7e8a9cc72a1 |
refs/heads/main | <repo_name>JesusRestrepo/Speed-Test<file_sep>/speedtest.py
import tkinter
import sys
import subprocess
def update_text():
cmd = "speedtest-cli"
speed = subprocess.call(cmd, shell=True)
return(cmd)
root = tkinter.Tk()
root.title("VELOCIMETER")
root.geometry("300x300")
button = tkinter.Button(root, text="Get Speed", width=30, command=update_text)
button.pack()
down_label = tkinter.Label(root, text="")
down_label.pack()
up_label = tkinter.Label(root, text="")
up_label.pack()
root.mainloop()<file_sep>/README.md
# Speed-Test
small app to measure internet speed
| 79e11c3a73bbb7b3f0b902c290c6bc5f2ae56659 | [
"Markdown",
"Python"
] | 2 | Python | JesusRestrepo/Speed-Test | 11e430df3ebe6323cfe2203ea010d6f26f31de72 | 7775dfd697768998c059dc4230f2a338d7fec7f9 |
refs/heads/master | <repo_name>rybrockdev/suggestmo-back-end<file_sep>/README.md
# Final project for Manchester Codes Bootcamp
___
Back-end code for the SuggestMo Database.
Using Express and Mongoose.
NoSQL/MongoDB.<file_sep>/src/controllers/userController.js
const User = require('../Models/userModel');
const Movie = require('../models/movieModel');
const jwt = require('jsonwebtoken');
exports.addUser = (req, res) => {
const user = new User({
firstName: req.body.firstName,
lastName: req.body.lastName,
email: req.body.email,
password: req.body.<PASSWORD>,
});
user.save().then(() => {
res.status(201).json(user.toObject());
})
.catch((error) => {
console.log(error);
})
};
exports.login = (req, res) => {
User.findOne({ email: req.body.email }, (error, user) => {
if (user !== null && user.validatePassword(req.body.password)) {
jwt.sign(user.sanitize(), process.env.JWT_SECRET, { expiresIn: '1d' }, (err, token) => {
console.log(err);
res.status('200').json({ token });
});
} else {
res.status(401).send();
}
});
};
exports.addMovie = (req, res) => {
const movie = new Movie({
title: req.body.title,
});
movie.save().then(() => {
res.status(201).json(movie);
})
.catch(error => {
console.log(error);
});
}
exports.deleteMovie = (req, res) => {
movie.deleteOne({ title: req.body.title }, function (err) {
res.status(200).send();
console.log(err);
})
} | da3d74527e2c0c919e140c8cb4f8e6e5b3057b19 | [
"Markdown",
"JavaScript"
] | 2 | Markdown | rybrockdev/suggestmo-back-end | d920c47d071f3038b05a7af1afd7836b8b01fa9a | 0b239dabe76b6a8b2a405c67ef2856762bc0f960 |
refs/heads/master | <repo_name>legendaryC/QoL1<file_sep>/QoL/main/models.py
from django.db import models
# clinical data.
class Albumin(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Albumin"
verbose_name = 'Albumin'
verbose_name_plural = 'Albumin'
class Alkaline_Phosphatase(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Alkaline_Phosphatase"
verbose_name = 'Alkaline_Phosphatase'
verbose_name_plural = 'Alkaline_Phosphatase'
class Bicarbonate(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Bicarbonate"
verbose_name = 'Bicarbonate'
verbose_name_plural = 'Bicarbonate'
class BUN(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "BUN"
verbose_name = 'BUN'
verbose_name_plural = 'BUN'
class Calcium(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Calcium"
verbose_name = 'Calcium'
verbose_name_plural = 'Calcium'
class Creatinine(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Creatinine"
verbose_name = 'Creatinine'
verbose_name_plural = 'Creatinine'
class Hemoglobin(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Hemoglobin"
verbose_name = 'Hemoglobin'
verbose_name_plural = 'Hemoglobin'
class Phosphorus(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Phosphorus"
verbose_name = 'Phosphorus'
verbose_name_plural = 'Phosphorus'
class Potassium(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Potassium"
verbose_name = 'Potassium'
verbose_name_plural = 'Potassium'
class PTH(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "PTH"
verbose_name = 'PTH'
verbose_name_plural = 'PTH'
class Sodium(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
value = models.FloatField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Sodium"
verbose_name = 'Sodium'
verbose_name_plural = 'Sodium'
# dialysis data
class Dialysis(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
weight = models.FloatField()
temperature = models.FloatField(null=True)
bp = models.CharField(max_length=6)
pulse_rate = models.IntegerField(null=True)
kt_v_ratio = models.FloatField(null=True)
dialysis_duration = models.DecimalField(
max_digits=3, decimal_places=2, null=True)
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Dialysis"
verbose_name = 'Dialysis'
verbose_name_plural = 'Dialysis'
# comorbidities data
class Comorbidities(models.Model):
patient_ID = models.CharField(max_length=6)
date_time = models.DateTimeField(auto_now_add=False)
diabetes = models.BooleanField()
hypertension = models.BooleanField()
cardiovascular_disease = models.BooleanField()
typhoid = models.BooleanField()
class Meta:
ordering = ['-date_time']
unique_together = (('patient_ID', 'date_time'),)
db_table = "Comorbidities"
verbose_name = 'Comorbidities'
verbose_name_plural = 'Comorbidities'
# demographic data
class Demography(models.Model):
user_ID = models.CharField(max_length=6, primary_key=True)
date_time = models.DateTimeField(auto_now_add=False)
age = models.IntegerField()
choice = (('M', 'M'), ('F', 'F'))
gender = models.CharField(max_length=1, choices=choice)
class Meta:
ordering = ['-date_time']
db_table = "Demography"
verbose_name = 'Demography'
verbose_name_plural = 'Demography'
class Medical_Info(models.Model):
patient_ID = models.CharField(max_length=6, primary_key=True)
date_time = models.DateTimeField(auto_now_add=False)
ckd = models.IntegerField(null=True)
first_dialysis_date = models.DateTimeField(auto_now_add=False, null=True)
number_of_dialysis = models.IntegerField(null=True)
expected_number_of_dialysis = models.IntegerField(null=True)
dialysis_frequency = models.IntegerField(null=True)
class Meta:
ordering = ['-date_time']
db_table = "Medical_Info"
verbose_name = 'Medical_Info'
verbose_name_plural = 'Medical_Info'
class Baseline_Survey(models.Model):
patient_ID = models.CharField(max_length=6, primary_key=True)
date_time = models.DateTimeField(auto_now_add=False)
mobility = models.IntegerField(null=True)
self_care = models.IntegerField(null=True)
usual_activities = models.IntegerField(null=True)
pain_level = models.IntegerField(null=True)
anxiety_level = models.IntegerField(null=True)
health_rating = models.IntegerField(null=True)
class Meta:
ordering = ['-date_time']
db_table = "Baseline_Survey"
verbose_name = "Baseline_Survey"
verbose_name_plural = "Baseline_Survey"
class Third_Month_Survey(models.Model):
patient_ID = models.CharField(max_length=6, primary_key=True)
date_time = models.DateTimeField(auto_now_add=False)
performance_status_score = models.IntegerField(null=True)
class Meta:
ordering = ['-date_time']
db_table = "Third_Month_Survey"
verbose_name = "Third_Month_Survey"
verbose_name_plural = "Third_Month_Survey"
<file_sep>/QoL/main/admin.py
from django.contrib import admin
from .models import Third_Month_Survey, Baseline_Survey, Medical_Info, Albumin, Sodium, Alkaline_Phosphatase, Bicarbonate, Hemoglobin, BUN, Calcium, Creatinine, Phosphorus, Potassium, PTH, Dialysis, Comorbidities, Demography
@admin.register(Albumin)
class AlbuminAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Alkaline_Phosphatase)
class Alkaline_PhosphataseAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Bicarbonate)
class BicarbonateAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(BUN)
class BUNAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Calcium)
class CalciumAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Creatinine)
class CreatinineAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Hemoglobin)
class HemoglobinAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Phosphorus)
class PhosphorusAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Potassium)
class PotassiumAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(PTH)
class PTHAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Sodium)
class SodiumAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'value')
@admin.register(Dialysis)
class DialysisAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'weight', "pulse_rate",
'temperature', 'bp', 'kt_v_ratio', 'dialysis_duration')
@admin.register(Comorbidities)
class ComorbiditiesAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'diabetes',
'hypertension', 'cardiovascular_disease', 'typhoid')
@admin.register(Demography)
class DemographyAdmin(admin.ModelAdmin):
list_display = ('user_ID', 'date_time', 'age', 'gender')
@admin.register(Medical_Info)
class Medical_InfoAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'ckd', 'first_dialysis_date',
'number_of_dialysis', 'expected_number_of_dialysis', 'dialysis_frequency')
@admin.register(Baseline_Survey)
class Baseline_SurveyAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'mobility', 'self_care',
'usual_activities', 'pain_level', 'anxiety_level', 'health_rating')
@admin.register(Third_Month_Survey)
class Third_Month_SurveyAdmin(admin.ModelAdmin):
list_display = ('patient_ID', 'date_time', 'performance_status_score')
<file_sep>/QoL/main/migrations/0003_dialysis_temperature.py
# Generated by Django 3.1.2 on 2020-10-27 20:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0002_auto_20201013_1948'),
]
operations = [
migrations.AddField(
model_name='dialysis',
name='temperature',
field=models.FloatField(null=True),
),
]
<file_sep>/QoL/main/views.py
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import JsonResponse
# @login_required(redirect_field_name='next', login_url='')
from django.contrib import auth
import json
def login(request):
print(12)
# here you get the post request username and password
username = request.GET.get('username', '')
print(12)
password = request.GET.get('password', '')
# authentication of the user, to check if it's active or None
user = auth.authenticate(username=username, password=password)
print(password)
if user is not None:
print(14)
if user.is_active:
# this is where the user login actually happens, before this the user
# is not logged in.
auth.login(request, user)
print(15)
return JsonResponse({"status":"400"})
else :
return HttpResponseRedirect("Invalid username or password")
# Create your views here.
# @login_required
# def home(request):
# return render(request, 'polls/detail.html', {'poll': p})<file_sep>/QoL/main/migrations/0002_auto_20201013_1948.py
# Generated by Django 3.1.2 on 2020-10-13 19:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='albumin',
options={'ordering': ['-date_time'], 'verbose_name': 'Albumin', 'verbose_name_plural': 'Albumin'},
),
migrations.AlterModelOptions(
name='alkaline_phosphatase',
options={'ordering': ['-date_time'], 'verbose_name': 'Alkaline_Phosphatase', 'verbose_name_plural': 'Alkaline_Phosphatase'},
),
migrations.AlterModelOptions(
name='baseline_survey',
options={'ordering': ['-date_time'], 'verbose_name': 'Baseline_Survey', 'verbose_name_plural': 'Baseline_Survey'},
),
migrations.AlterModelOptions(
name='bicarbonate',
options={'ordering': ['-date_time'], 'verbose_name': 'Bicarbonate', 'verbose_name_plural': 'Bicarbonate'},
),
migrations.AlterModelOptions(
name='bun',
options={'ordering': ['-date_time'], 'verbose_name': 'BUN', 'verbose_name_plural': 'BUN'},
),
migrations.AlterModelOptions(
name='calcium',
options={'ordering': ['-date_time'], 'verbose_name': 'Calcium', 'verbose_name_plural': 'Calcium'},
),
migrations.AlterModelOptions(
name='comorbidities',
options={'ordering': ['-date_time'], 'verbose_name': 'Comorbidities', 'verbose_name_plural': 'Comorbidities'},
),
migrations.AlterModelOptions(
name='creatinine',
options={'ordering': ['-date_time'], 'verbose_name': 'Creatinine', 'verbose_name_plural': 'Creatinine'},
),
migrations.AlterModelOptions(
name='demography',
options={'ordering': ['-date_time'], 'verbose_name': 'Demography', 'verbose_name_plural': 'Demography'},
),
migrations.AlterModelOptions(
name='dialysis',
options={'ordering': ['-date_time'], 'verbose_name': 'Dialysis', 'verbose_name_plural': 'Dialysis'},
),
migrations.AlterModelOptions(
name='hemoglobin',
options={'ordering': ['-date_time'], 'verbose_name': 'Hemoglobin', 'verbose_name_plural': 'Hemoglobin'},
),
migrations.AlterModelOptions(
name='medical_info',
options={'ordering': ['-date_time'], 'verbose_name': 'Medical_Info', 'verbose_name_plural': 'Medical_Info'},
),
migrations.AlterModelOptions(
name='phosphorus',
options={'ordering': ['-date_time'], 'verbose_name': 'Phosphorus', 'verbose_name_plural': 'Phosphorus'},
),
migrations.AlterModelOptions(
name='potassium',
options={'ordering': ['-date_time'], 'verbose_name': 'Potassium', 'verbose_name_plural': 'Potassium'},
),
migrations.AlterModelOptions(
name='pth',
options={'ordering': ['-date_time'], 'verbose_name': 'PTH', 'verbose_name_plural': 'PTH'},
),
migrations.AlterModelOptions(
name='sodium',
options={'ordering': ['-date_time'], 'verbose_name': 'Sodium', 'verbose_name_plural': 'Sodium'},
),
migrations.AlterModelOptions(
name='third_month_survey',
options={'ordering': ['-date_time'], 'verbose_name': 'Third_Month_Survey', 'verbose_name_plural': 'Third_Month_Survey'},
),
]
<file_sep>/QoL/main/migrations/0001_initial.py
# Generated by Django 2.1.3 on 2020-10-07 21:14
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Albumin',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Albumin',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Alkaline_Phosphatase',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Alkaline_Phosphatase',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Baseline_Survey',
fields=[
('patient_ID', models.CharField(max_length=6, primary_key=True, serialize=False)),
('date_time', models.DateTimeField()),
('mobility', models.IntegerField(null=True)),
('self_care', models.IntegerField(null=True)),
('usual_activities', models.IntegerField(null=True)),
('pain_level', models.IntegerField(null=True)),
('anxiety_level', models.IntegerField(null=True)),
('health_rating', models.IntegerField(null=True)),
],
options={
'db_table': 'Baseline_Survey',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Bicarbonate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Bicarbonate',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='BUN',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'BUN',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Calcium',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Calcium',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Comorbidities',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('diabetes', models.BooleanField()),
('hypertension', models.BooleanField()),
('cardiovascular_disease', models.BooleanField()),
('typhoid', models.BooleanField()),
],
options={
'db_table': 'Comorbidities',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Creatinine',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Creatinine',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Demography',
fields=[
('user_ID', models.CharField(max_length=6, primary_key=True, serialize=False)),
('date_time', models.DateTimeField()),
('age', models.IntegerField()),
('gender', models.CharField(choices=[('M', 'M'), ('F', 'F')], max_length=1)),
],
options={
'db_table': 'Demography',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Dialysis',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('weight', models.FloatField()),
('bp', models.CharField(max_length=6)),
('kt_v_ratio', models.FloatField(null=True)),
('dialysis_duration', models.DecimalField(decimal_places=2, max_digits=3, null=True)),
],
options={
'db_table': 'Dialysis',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Hemoglobin',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Hemoglobin',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Medical_Info',
fields=[
('patient_ID', models.CharField(max_length=6, primary_key=True, serialize=False)),
('date_time', models.DateTimeField()),
('ckd', models.IntegerField(null=True)),
('first_dialysis_date', models.DateTimeField(null=True)),
('number_of_dialysis', models.IntegerField(null=True)),
('expected_number_of_dialysis', models.IntegerField(null=True)),
('dialysis_frequency', models.IntegerField(null=True)),
],
options={
'db_table': 'Medical_Info',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Phosphorus',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Phosphorus',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Potassium',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Potassium',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='PTH',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'PTH',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Sodium',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('patient_ID', models.CharField(max_length=6)),
('date_time', models.DateTimeField()),
('value', models.FloatField()),
],
options={
'db_table': 'Sodium',
'ordering': ['-date_time'],
},
),
migrations.CreateModel(
name='Third_Month_Survey',
fields=[
('patient_ID', models.CharField(max_length=6, primary_key=True, serialize=False)),
('date_time', models.DateTimeField()),
('performance_status_score', models.IntegerField(null=True)),
],
options={
'db_table': 'Third_Month_Survey',
'ordering': ['-date_time'],
},
),
migrations.AlterUniqueTogether(
name='sodium',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='pth',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='potassium',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='phosphorus',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='hemoglobin',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='dialysis',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='creatinine',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='comorbidities',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='calcium',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='bun',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='bicarbonate',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='alkaline_phosphatase',
unique_together={('patient_ID', 'date_time')},
),
migrations.AlterUniqueTogether(
name='albumin',
unique_together={('patient_ID', 'date_time')},
),
]
<file_sep>/QoL/main/data.py
from .models import *
import datetime
import openpyxl
from pathlib import Path
import random
import re
class ImportData:
def __init__(self):
super().__init__()
def getID(self, s):
res = '0000'+str(s)
return 'pa'+res[-4:]
def get_data(self):
# new_entry = Albumin(patient_ID='pa0001',
# date_time=datetime.datetime(2020, 5, 17), value=1.2) kljlk
# new_entry.save()
xlsx_file = Path('/home/chen7874/QoL1/QoL/main', 'dataSet.xlsx')
wb_obj = openpyxl.load_workbook(xlsx_file)
# Read the active sheet:
sheet = wb_obj.active
# print(sheet["C1"].value)
i = None
for row in sheet.iter_rows(max_row=sheet.max_row-1):
# print(row[0].value, end='/n')
if row[0].value:
i = row[0].value
if type(row[3].value) is str:
info_day, info_month, info_year = re.split(
'-|/', row[3].value)
else:
info_day, info_month, info_year = row[3].value.day, row[3].value.month, row[3].value.year
if Medical_Info.objects.filter(patient_ID=self.getID(i)):
continue
medical_Info = Medical_Info(patient_ID=self.getID(i),
date_time=datetime.datetime(int(info_year), int(info_month), int(info_day)), ckd=float(row[16].value), first_dialysis_date=datetime.datetime(int(info_year), int(info_month), int(info_day)), number_of_dialysis=int(row[4].value), expected_number_of_dialysis=int(row[25].value), dialysis_frequency=2)
medical_Info.save()
# new_entry.save()
# for cell in row:
# print(cell.value, end=" ")
# print()
#NOTE: Lab_data
print("##", str(row[6].value))
if type(row[6].value) is str:
lab_day, lab_month, lab_year = re.split('-|/', row[6].value)
else:
lab_day, lab_month, lab_year = row[6].value.day, row[6].value.month, row[6].value.year
if Albumin.objects.filter(patient_ID=self.getID(i), date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day))):
continue
albumin = Albumin(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[7].value))
albumin.save()
bicarbonate = Bicarbonate(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[8].value))
bicarbonate.save()
bUN = BUN(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[9].value))
bUN.save()
calcium = Calcium(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[10].value))
calcium.save()
creatinine = Creatinine(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[11].value))
creatinine.save()
hemoglobin = Hemoglobin(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[12].value))
hemoglobin.save()
potassium = Potassium(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[13].value))
potassium.save()
phosphorus = Phosphorus(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[14].value))
phosphorus.save()
sodium = Sodium(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=float(row[15].value))
sodium.save()
pTH = PTH(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=random.randint(0, 70))
pTH.save()
alkaline_Phosphatase = Alkaline_Phosphatase(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), value=random.randint(0, 300))
alkaline_Phosphatase.save()
#NOTE: comorbidities
comorbidities = Comorbidities(patient_ID=self.getID(i),
date_time=datetime.datetime(int(lab_year), int(lab_month), int(lab_day)), hypertension=int(row[17].value), diabetes=int(row[18].value), cardiovascular_disease=random.randint(0, 1), typhoid=random.randint(0, 1))
comorbidities.save()
#NOTE: Dialysis_data
if type(row[20].value) is str:
dialysis_day, dialysis_month, dialysis_year = re.split(
'-|/', row[20].value)
else:
dialysis_day, dialysis_month, dialysis_year = row[
20].value.day, row[20].value.month, row[20].value.year
# weight = random.randint(80, 180)
dialysis = Dialysis(patient_ID=self.getID(i), date_time=datetime.datetime(int(dialysis_year), int(dialysis_month), int(
dialysis_day)), bp=str(random.randint(100, 140))+"/"+str(random.randint(60, 80)), weight=float(row[22].value), kt_v_ratio=float(row[23].value), temperature=random.randint(950, 1020)/10, pulse_rate=random.randint(60, 100), dialysis_duration=4)
dialysis.save()
# NOTE: Before_Dialysis:
# if int(dialysis_day) == 0:
# before_dialysis = Dialysis(patient_ID=self.getID(i), date_time=datetime.datetime(int(dialysis_year), int(dialysis_month)-1, 30), bp=random.randint(100, 140)+"/"+random.randint(
# 60, 80), weight=weight, kt_v_ratio=float(row[23].value), temperature=random.randint(950, 1020)/10, pulse_rate=random.randint(60, 100), dialysis_duration=4)
# before_dialysis.save()
# else:
# before_dialysis = Dialysis(patient_ID=self.getID(i), date_time=datetime.datetime(int(dialysis_year), int(dialysis_month), int(dialysis_day)-1), bp=str(random.randint(
# 100, 140))+"/"+str(random.randint(60, 80)), weight=weight, kt_v_ratio=float(row[23].value), temperature=random.randint(950, 1020)/10, pulse_rate=random.randint(60, 100), dialysis_duration=4)
# before_dialysis.save()
# else:
# for cell in row:
# print(i, cell.value, end=" ")
# print()
<file_sep>/requirements.txt
aniso8601==7.0.0
asgiref==3.2.10
autopep8==1.5.4
Django==3.1.2
django-cors-headers==3.5.0
django-rest-auth==0.9.5
djangorestframework==3.12.1
graphene==2.1.8
graphene-django==2.13.0
graphql-core==2.3.2
graphql-relay==2.0.1
promise==2.3
pycodestyle==2.6.0
PyMySQL==0.10.1
pytz==2020.1
Rx==1.6.1
singledispatch==3.4.0.3
six==1.15.0
sqlparse==0.4.1
toml==0.10.1
Unidecode==1.1.1
<file_sep>/QoL/main/schema.py
import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from .models import *
import datetime
from .data import ImportData
from .feedback import ImportFeedback
class AlbuminType(DjangoObjectType):
class Meta:
model = Albumin
class Alkaline_PhosphataseType(DjangoObjectType):
class Meta:
model = Alkaline_Phosphatase
class BicarbonateType(DjangoObjectType):
class Meta:
model = Bicarbonate
class BUNType(DjangoObjectType):
class Meta:
model = BUN
class CalciumType(DjangoObjectType):
class Meta:
model = Calcium
class CreatinineType(DjangoObjectType):
class Meta:
model = Creatinine
class HemoglobinType(DjangoObjectType):
class Meta:
model = Hemoglobin
class PhosphorusType(DjangoObjectType):
class Meta:
model = Phosphorus
class PotassiumType(DjangoObjectType):
class Meta:
model = Potassium
class PTHType(DjangoObjectType):
class Meta:
model = PTH
class SodiumType(DjangoObjectType):
class Meta:
model = Sodium
class DialysisType(DjangoObjectType):
class Meta:
model = Dialysis
class ComorbiditiesType(DjangoObjectType):
class Meta:
model = Comorbidities
class Medical_InfoType(DjangoObjectType):
class Meta:
model = Medical_Info
class Baseline_SurveyType(DjangoObjectType):
class Meta:
model = Baseline_Survey
def transferJSTime(s):
t = None
t = datetime.datetime.fromtimestamp(int(s) / 1000.0)
print(t)
return t
class Query(ObjectType):
# _Albumin = graphene.Field(AlbuminType, id=graphene.Int())
_Baseline_Survey = graphene.List(
Baseline_SurveyType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Baseline_Survey(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
# start = transferJSTime(kwargs.get('start'))
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
print("####")
print(end)
return Baseline_Survey.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
return Baseline_Survey.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Baseline_Survey.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Baseline_Survey.objects.filter(patient_ID=patient_ID)
return None
_Medical_Info = graphene.List(
Medical_InfoType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Medical_Info(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
# start = transferJSTime(kwargs.get('start'))
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
print("####")
print(end)
return Medical_Info.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
return Medical_Info.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Medical_Info.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Medical_Info.objects.filter(patient_ID=patient_ID)
return None
_Comorbidities = graphene.List(
ComorbiditiesType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Comorbidities(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
# start = transferJSTime(kwargs.get('start'))
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
print("####")
print(end)
return Comorbidities.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
return Comorbidities.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Comorbidities.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Comorbidities.objects.filter(patient_ID=patient_ID)
return None
_Dialysis = graphene.List(
DialysisType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Dialysis(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
# start = transferJSTime(kwargs.get('start'))
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
print("####")
print(end)
return Dialysis.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
return Dialysis.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Dialysis.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Dialysis.objects.filter(patient_ID=patient_ID)
return None
_Albumin = graphene.List(
AlbuminType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Albumin(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
# start = transferJSTime(kwargs.get('start'))
end, start = None, None
# print('#########JIAN CHEN#######################')
# obj = ImportData()
# obj.get_data()
# NOTE: import the feedback data
# obj = ImportFeedback()
# obj.get_data()
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
print("####")
print(end)
return Albumin.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
return Albumin.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Albumin.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Albumin.objects.filter(patient_ID=patient_ID)
return None
_Alkaline_Phosphatase = graphene.List(
Alkaline_PhosphataseType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Alkaline_Phosphatase(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Alkaline_Phosphatase.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Alkaline_Phosphatase.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Alkaline_Phosphatase.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Alkaline_Phosphatase.objects.filter(patient_ID=patient_ID)
return None
_Bicarbonate = graphene.List(
BicarbonateType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Bicarbonate(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Bicarbonate.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Bicarbonate.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Bicarbonate.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Bicarbonate.objects.filter(patient_ID=patient_ID)
return None
_B_U_N = graphene.List(
BUNType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__B_U_N(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return BUN.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return BUN.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return BUN.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return BUN.objects.filter(patient_ID=patient_ID)
return None
_Calcium = graphene.List(
CalciumType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Calcium(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Calcium.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Calcium.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Calcium.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Calcium.objects.filter(patient_ID=patient_ID)
return None
_Creatinine = graphene.List(
CreatinineType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Creatinine(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Creatinine.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Creatinine.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Creatinine.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Creatinine.objects.filter(patient_ID=patient_ID)
return None
_Hemoglobin = graphene.List(
HemoglobinType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Hemoglobin(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Hemoglobin.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Hemoglobin.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Hemoglobin.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Hemoglobin.objects.filter(patient_ID=patient_ID)
return None
_Phosphorus = graphene.List(
PhosphorusType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Phosphorus(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Phosphorus.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Phosphorus.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Phosphorus.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Phosphorus.objects.filter(patient_ID=patient_ID)
return None
_Potassium = graphene.List(
PotassiumType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Potassium(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Potassium.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Potassium.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Potassium.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Potassium.objects.filter(patient_ID=patient_ID)
return None
_P_T_H = graphene.List(
PTHType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__P_T_H(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return PTH.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return PTH.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return PTH.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return PTH.objects.filter(patient_ID=patient_ID)
return None
_Sodium = graphene.List(
SodiumType, patient_ID=graphene.String(), start=graphene.String(required=False), end=graphene.String(required=False))
def resolve__Sodium(self, info, **kwargs):
patient_ID = kwargs.get('patient_ID')
end, start = None, None
if kwargs.get('start'):
start = transferJSTime(kwargs.get('start'))
if kwargs.get('end'):
end = transferJSTime(kwargs.get('end'))
if patient_ID and start and end:
return Sodium.objects.filter(patient_ID=patient_ID, date_time__gt=start, date_time__lt=end)
if patient_ID and start:
print(123)
return Sodium.objects.filter(patient_ID=patient_ID, date_time__gt=start)
if patient_ID and end:
return Sodium.objects.filter(patient_ID=patient_ID, date_time__lt=end)
if patient_ID:
return Sodium.objects.filter(patient_ID=patient_ID)
return None
# class CreateAddress(graphene.Mutation):
# class Mutation(graphene.ObjectType):
# pass
schema = graphene.Schema(query=Query)
<file_sep>/QoL/uwsgi.ini
[uwsgi]
socket = /home/chen7874/QoL/uwsgi.sock
http=0.0.0.0:8080
chdir = /home/chen7874/QoL/
chmod-socket = 777
uid = root
gid =root
home = /home/chen7874/env/
# Django s wsgi file
module = QoL.wsgi
# process-related settings
# master
master = true
pidfile = /home/chen7874/master.pid
daemonize = /home/chen7874/QoL/QoL.log
# maximum number of worker processes
processes = 4
max-requests = 5000
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
buffer-size = 21573
static-map=/static= /home/chen7874/QoL/static/
<file_sep>/QoL/main/migrations/0004_dialysis_pulse_rate.py
# Generated by Django 3.1.2 on 2020-10-28 21:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0003_dialysis_temperature'),
]
operations = [
migrations.AddField(
model_name='dialysis',
name='pulse_rate',
field=models.IntegerField(null=True),
),
]
<file_sep>/QoL/main/tests.py
from django.test import TestCase
import models
print(1)
# Create your tests here.
| 208325317e26df718336927502eb31222a4e3050 | [
"Python",
"Text",
"INI"
] | 12 | Python | legendaryC/QoL1 | de17130193892f14064c4c671144707fac60b972 | 1fe3dfb772e3c2a1719439fe5beec8ae0f9fa736 |
refs/heads/master | <repo_name>SeanChan6557/i2c_keyboard<file_sep>/Makefile
#
# Makefile for the kernel wrt char device drivers.
#
obj-$(CONFIG_WRT_TOUCHKEY) += i2c-keyboard.o
<file_sep>/i2c-keyboard.c
/*
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#define IC_VALID_CHIPID 0x11
#define IC_CMD_CHIPID 0
#define IC_CMD_CODEVER 1
#define IC_CMD_GSTAT 2
#define IC_CMD_KEYS3 3
#define IC_CMD_KEYS4 4
#define IC_CMD_SLIDE 5
#define IC_CMD_GPIOS 6
#define IC_CMD_SUBVER 7
#define IC_CMD_CALIBRATE 10
#define IC_CMD_DRIVE_X 70
#define IC_CMD_PWMEN_X 74
#define IC_CMD_PWM_DUTY 76
#define IC_NUM_LEDS_X 8
//#define IC_CYCLE_INTERVAL (1*HZ)
#define IC_CYCLE_INTERVAL (30)
#define IC_CYCLE_INTERVAL_HAVE_KEY (15)
#define IC_CYCLE_INTERVAL_NO_KEY (2*HZ)
//#define KEY_LONG_KEY 80 //20*75 MS
//取消长按,把时间改成无限长
#define KEY_LONG_KEY 65000
#define KEY_JIFFIES (1 * HZ) /* 1s */
#define KEY_DEBOUNCE_JIFFIES (10 / (MSEC_PER_SEC / HZ)) /* 10ms */
#define D1_KEY_ADDRESS 0x18
static int ProjectNum;
static int gIsD1KeyBoard = 0;
/*
static unsigned char i2c_key_key2code2[] = {
KEY_BACKSPACE,KEY_F8,KEY_SPACE,KEY_DOWN,KEY_ENTER,
KEY_F9,KEY_F3,KEY_LEFT,KEY_RIGHT,KEY_F7,
KEY_UP, KEY_ESC
};*/
static unsigned char i2c_key_key2code_d0[] = {
KEY_3,KEY_2,KEY_6,KEY_1,KEY_5,
KEY_9,KEY_4,KEY_8,KEY_7,KEY_F5,
KEY_0, KEY_F6
};
static unsigned char i2c_key_key2code_d1[] = {
KEY_1,KEY_2,KEY_3,KEY_4,KEY_5,
KEY_6,KEY_7,KEY_8,KEY_9,KEY_F5,
KEY_0, KEY_F6
};
static unsigned char i2c_key_key2code_r7[] = {
KEY_F5,KEY_3,KEY_2,KEY_1,KEY_0,
KEY_6,KEY_5,KEY_4,KEY_7,KEY_8,
KEY_9, KEY_F6
};
//static unsigned char ismapflag=0;
static unsigned char i2c_key_capacity[] = {
KEY_8,KEY_3,KEY_2,KEY_1,KEY_0,
KEY_6,KEY_5,KEY_4,KEY_7,KEY_9,
KEY_RIGHTSHIFT, KEY_LEFTSHIFT,
KEY_F5,KEY_F6,KEY_F1,KEY_F2,
KEY_SPACE,KEY_UP,KEY_BACKSPACE,
KEY_RIGHT,KEY_F3,KEY_LEFT,KEY_DOWN,
KEY_ENTER,KEY_F7,KEY_ESC,KEY_F8,KEY_F9
};
struct i2c_key_data {
int irq;
struct i2c_client *client;
struct input_dev *input;
struct delayed_work dwork;
spinlock_t lock; /* Protects canceling/rescheduling of dwork */
unsigned short keycodes[ARRAY_SIZE(i2c_key_capacity)];
u16 key_matrix;
int delay_time;
bool pre_enter_int;
int irq_gpio;
int long_key_time;
int have_key_scan_time;
int no_key_scan_time;
int key1_timer;
int key2_timer;
struct timer_list timer;
};
static int i2c_key_read_block(struct i2c_client *client,
u8 inireg, u8 *buffer, unsigned int count)
{
int error, idx = 0;
/*
* Can't use SMBus block data read. Check for I2C functionality to speed
* things up whenever possible. Otherwise we will be forced to read
* sequentially.
*/
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
error = i2c_smbus_write_byte(client, inireg + idx);
if (error) {
dev_err(&client->dev,
"couldn't send request. Returned %d\n", error);
return error;
}
error = i2c_master_recv(client, buffer, count);
if (error != count) {
dev_err(&client->dev,
"couldn't read registers. Returned %d bytes\n", error);
return error;
}
} else {
while (count--) {
int data;
error = i2c_smbus_write_byte(client, inireg + idx);
if (error) {
dev_err(&client->dev,
"couldn't send request. Returned %d\n", error);
return error;
}
data = i2c_smbus_read_byte(client);
if (data < 0) {
dev_err(&client->dev,
"couldn't read register. Returned %d\n", data);
return data;
}
buffer[idx++] = data;
}
}
return 0;
}
static int i2c_key_get_key(struct i2c_key_data *i2c_key)
{
struct i2c_client *client = i2c_key->client;
struct input_dev *input = i2c_key->input;
char regs[2]={0,0};
int ret;
if(gIsD1KeyBoard){
ret = i2c_key_read_block(client, 3, regs, 1);
}else{
ret = i2c_key_read_block(client, 0, regs, 2);
}
if (ret) {
dev_err(&client->dev,
"could not perform chip read.\n");
return ret;
}
if(ProjectNum==1){ //R2M 7寸
if(regs[0]){
if(!i2c_key->key1_timer){
input_report_key(input,i2c_key_key2code_r7[regs[0]-1],1);
input_sync(input);
input_report_key(input,i2c_key_key2code_r7[regs[0]-1],0);
input_sync(input);
i2c_key->key1_timer = i2c_key->long_key_time;
}
}
else{
i2c_key->key1_timer = 0;
}
if(regs[1]){
if(!i2c_key->key2_timer) {
input_report_key(input,i2c_key_key2code_r7[regs[1]-1],1);
input_sync(input);
input_report_key(input,i2c_key_key2code_r7[regs[1]-1],0);
input_sync(input);
i2c_key->key2_timer = i2c_key->long_key_time;
}
}
else{
i2c_key->key2_timer = 0;
}
}else if(gIsD1KeyBoard){
if(regs[0]){
char ledsAllOffBuf[3] = {0X01,0XFF,0X00};
char ledsOnBuf[3] = {0,0,0};
if(!i2c_key->key1_timer){
input_report_key(input,i2c_key_key2code_d1[regs[0]-1],1);
input_sync(input);
input_report_key(input,i2c_key_key2code_d1[regs[0]-1],0);
input_sync(input);
i2c_key->key1_timer = i2c_key->long_key_time;
}
i2c_master_send(client, ledsAllOffBuf, 3);
ledsOnBuf[0] = 0x01;
ledsOnBuf[1] = regs[0];
ledsOnBuf[2] = 0x01;
i2c_master_send(client, ledsOnBuf, 3);
msleep(100);
i2c_master_send(client, ledsAllOffBuf, 3);
msleep(100);
i2c_master_send(client, ledsOnBuf, 3);
msleep(100);
i2c_master_send(client, ledsAllOffBuf, 3);
}
else{
i2c_key->key1_timer = 0;
}
}else{ //D0M 4.3寸
if(regs[0]){
if(!i2c_key->key1_timer){
input_report_key(input,i2c_key_key2code_d0[regs[0]-1],1);
input_sync(input);
input_report_key(input,i2c_key_key2code_d0[regs[0]-1],0);
input_sync(input);
i2c_key->key1_timer = i2c_key->long_key_time;
}
}
else{
i2c_key->key1_timer = 0;
}
if(regs[1]){
if(!i2c_key->key2_timer) {
input_report_key(input,i2c_key_key2code_d0[regs[1]-1],1);
input_sync(input);
input_report_key(input,i2c_key_key2code_d0[regs[1]-1],0);
input_sync(input);
i2c_key->key2_timer = i2c_key->long_key_time;
}
}
else{
i2c_key->key2_timer = 0;
}
}
return 0;
}
static irqreturn_t i2c_key_irq(int irq, void *_i2c_key)
{
struct i2c_key_data *i2c_key = _i2c_key;
unsigned long flags;
//printk(KERN_INFO "my drv irq happend!\n");
spin_lock_irqsave(&i2c_key->lock, flags);
mod_delayed_work(system_wq, &i2c_key->dwork, 0);
spin_unlock_irqrestore(&i2c_key->lock, flags);
return IRQ_HANDLED;
}
static void i2c_key_schedule_read(struct i2c_key_data *i2c_key)
{
spin_lock_irq(&i2c_key->lock);
schedule_delayed_work(&i2c_key->dwork, i2c_key->delay_time);
spin_unlock_irq(&i2c_key->lock);
}
static void i2c_key_worker(struct work_struct *work)
{
int val;
struct i2c_key_data *i2c_key =
container_of(work, struct i2c_key_data, dwork.work);
//dev_dbg(&i2c_key->client->dev, "worker\n");
i2c_key_get_key(i2c_key);
i2c_key->pre_enter_int = true;
/* Avoid device lock up by checking every so often */
//i2c_key_schedule_read(i2c_key);
//modify worker timer
val = gpio_get_value(i2c_key->irq_gpio);
if(val){
i2c_key->delay_time = i2c_key->no_key_scan_time;
//printk("########## have key rescan key###########");
}
else{
i2c_key->delay_time = i2c_key->have_key_scan_time;
}
i2c_key_schedule_read(i2c_key);
}
static void touch_keys_timer(unsigned long data)
{
struct i2c_key_data *i2c_key = (struct i2c_key_data*)data;
if(i2c_key->key1_timer >0)
i2c_key->key1_timer --;
if(i2c_key->key2_timer >0)
i2c_key->key2_timer --;
mod_timer(&i2c_key->timer, jiffies + KEY_DEBOUNCE_JIFFIES);
}
static int i2c_key_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_key_data *i2c_key;
struct input_dev *input;
unsigned long irq_flags;
struct device_node *np = client->dev.of_node;
int i;
int error;
int rc;
//printk(KERN_INFO "my drv start probe!!\n");
/* Check functionality */
error = i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_BYTE);
//printk(KERN_INFO "my drv i2c check succ!\n");
if (!error) {
dev_err(&client->dev, "%s adapter not supported\n",
dev_driver_string(&client->adapter->dev));
return -ENODEV;
}
//printk(KERN_INFO "my drv start identify!\n");
//if (!i2c_key_identify(client))
// return -ENODEV;
//printk(KERN_INFO "my drv start input device!\n");
/* Chip is valid and active. Allocate structure */
i2c_key = kzalloc(sizeof(struct i2c_key_data), GFP_KERNEL);
input = input_allocate_device();
if (!i2c_key || !input) {
dev_err(&client->dev, "insufficient memory\n");
error = -ENOMEM;
goto err_free_mem;
}
//printk(KERN_INFO "my drv start init delaywork!\n");
i2c_key->client = client;
i2c_key->input = input;
i2c_key->delay_time = IC_CYCLE_INTERVAL;
INIT_DELAYED_WORK(&i2c_key->dwork, i2c_key_worker);
spin_lock_init(&i2c_key->lock);
input->name = "WRT D0 TOUCH_KEYBOARD";
input->id.bustype = BUS_I2C;
input->id.vendor = 0x1001;
input->id.product = 0x0011;
input->id.version = 0x0003;
input->keycode = i2c_key->keycodes;
input->keycodesize = sizeof(i2c_key->keycodes[0]);
input->keycodemax = ARRAY_SIZE(i2c_key_capacity);
__set_bit(EV_KEY, input->evbit);
__clear_bit(EV_REP, input->evbit);
for (i = 0; i < ARRAY_SIZE(i2c_key_capacity); i++) {
i2c_key->keycodes[i] = i2c_key_capacity[i];
__set_bit(i2c_key_capacity[i], input->keybit);
}
__clear_bit(KEY_RESERVED, input->keybit);
i2c_key->irq_gpio = of_get_named_gpio_flags(np,"irq_gpio",0,(enum of_gpio_flags *)&irq_flags);
if(!gpio_is_valid(i2c_key->irq_gpio)){
dev_err(&client->dev, "failed to get i2c irq gpio!\n");
goto err_free_mem;
}
client->irq = i2c_key->irq_gpio;
gpio_request(client->irq,"i2c-key");
gpio_direction_input(client->irq);
//printk(KERN_INFO "my drv start reg irq,gpio = 0x%X!\n",client->irq);
if (client->irq>=0) {
i2c_key->irq = gpio_to_irq(client->irq);
//printk(KERN_INFO "my drv start reg irq,irq = %d!\n",i2c_key->irq);
error = request_irq(i2c_key->irq, i2c_key_irq,
IRQF_TRIGGER_FALLING, "i2c_key", i2c_key);
if (error) {
dev_err(&client->dev,
"failed to allocate irq %d\n", i2c_key->irq);
goto err_free_mem;
}
}
rc = of_property_read_u32(np, "ikey,long-key-time", &i2c_key->long_key_time);
if (rc) {
i2c_key->long_key_time = KEY_LONG_KEY;
//dev_warn(&client->dev,"ikey,long-key-time use defaule %d\n",i2c_key->long_key_time);
}
rc = of_property_read_u32(np, "ikey,have-key-scan-time", &i2c_key->have_key_scan_time);
if (rc) {
i2c_key->have_key_scan_time = IC_CYCLE_INTERVAL_HAVE_KEY;
// dev_warn(&client->dev,"ikey,have-key-scan-time use defaule %d\n",i2c_key->have_key_scan_time);
}
rc = of_property_read_u32(np, "ikey,no-key-scan-time", &i2c_key->no_key_scan_time);
if (rc) {
i2c_key->no_key_scan_time = IC_CYCLE_INTERVAL_NO_KEY;
//dev_warn(&client->dev, "ikey,no-key-scan-time use defaule %d\n",i2c_key->no_key_scan_time);
}
/*根据不同项目 定义不同的按键值*/
if(!of_property_read_u32(np, "wrt,project-num", &ProjectNum))
printk("ProjectNum:%d\n",ProjectNum);
i2c_key->key1_timer = 0;
i2c_key->key2_timer = 0;
//printk(KERN_INFO "my drv irq register success!\n");
error = input_register_device(i2c_key->input);
if (error) {
dev_err(&client->dev,
"Failed to register input device\n");
goto err_free_irq;
}
setup_timer(&i2c_key->timer, touch_keys_timer, (unsigned long)i2c_key);
mod_timer(&i2c_key->timer, jiffies + KEY_JIFFIES);
i2c_set_clientdata(client, i2c_key);
i2c_key_schedule_read(i2c_key);
return 0;
err_free_irq:
if (client->irq)
free_irq(i2c_key->irq, i2c_key);
err_free_mem:
input_free_device(input);
kfree(i2c_key);
return error;
}
static int i2c_key_remove(struct i2c_client *client)
{
struct i2c_key_data *i2c_key = i2c_get_clientdata(client);
/* Release IRQ so no queue will be scheduled */
if (i2c_key->irq)
free_irq(i2c_key->irq, i2c_key);
del_timer_sync(&i2c_key->timer);
cancel_delayed_work_sync(&i2c_key->dwork);
input_unregister_device(i2c_key->input);
kfree(i2c_key);
return 0;
}
//MODULE_DEVICE_TABLE(of, i2c_key_idtable_match);
static const struct i2c_device_id i2c_key_idtable[] = {
{"ikey_i2c_key", 0,},
{ }
};
MODULE_DEVICE_TABLE(i2c, i2c_key_idtable);
static struct of_device_id i2c_key_idtable_match[] = {
{.compatible = "ikey,i2c_key" },
{ },
};
static struct i2c_driver i2c_key_driver = {
.driver = {
.name = "ikey_i2c_key",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(i2c_key_idtable_match),
},
.id_table = i2c_key_idtable,
.probe = i2c_key_probe,
.remove = i2c_key_remove,
};
static const struct i2c_device_id i2c_key_idtable_d1[] = {
{"ikey_i2c_key_d1", 0,},
{ }
};
MODULE_DEVICE_TABLE(i2c, i2c_key_idtable_d1);
static struct of_device_id i2c_key_idtable_match_d1[] = {
{.compatible = "ikey,i2c_key_d1" },
{ },
};
static struct i2c_driver i2c_key_driver_d1 = {
.driver = {
.name = "ikey_i2c_key_d1",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(i2c_key_idtable_match_d1),
},
.id_table = i2c_key_idtable,
.probe = i2c_key_probe,
.remove = i2c_key_remove,
};
static int i2c_client_read(struct i2c_client *client, char *buf, int len)
{
struct i2c_msg msg;
msg.addr = client->addr;
msg.flags = client->flags | I2C_M_RD;
msg.buf = buf;
msg.len = len;
#ifdef CONFIG_I2C_ROCKCHIP_COMPAT
msg.scl_rate = 100 * 1000;
#endif
return i2c_transfer(client->adapter, &msg, 1);
}
static int i2c_client_detect(unsigned int nr,unsigned short addr)
{
char val[8];
struct i2c_client client;
client.flags = 0;
client.addr = addr;
client.adapter = i2c_get_adapter(nr);
return i2c_client_read(&client, val, 1);
}
static void is_d1_keyboard(void)
{
if(i2c_client_detect(1,D1_KEY_ADDRESS) > 0){
printk("is D1 keyboard !!!");
gIsD1KeyBoard = 1;
return;
}
printk("is D0 keyboard !!!");
gIsD1KeyBoard = 0;
}
//module_i2c_driver(i2c_key_driver);
static int __init my_init(void)
{
is_d1_keyboard();
if(gIsD1KeyBoard > 0){
printk("D1 keyboard init !!!");
return i2c_add_driver(&i2c_key_driver_d1);
}
printk("D0 keyboard init !!!");
return i2c_add_driver(&i2c_key_driver);
}
static void __exit my_exit(void)
{
if(gIsD1KeyBoard > 0){
printk("D1 keyboard exit !!!");
i2c_del_driver(&i2c_key_driver_d1);
}else{
printk("D1 keyboard exit !!!");
i2c_del_driver(&i2c_key_driver);
}
}
MODULE_AUTHOR("SeanChan");
MODULE_DESCRIPTION("touch_key_Driver for WRT D0/D1/R7 main machine with 4.inch");
MODULE_LICENSE("GPL");
module_init(my_init);
module_exit(my_exit);
| fc08134fb5f387d83ad222d6829a75bd6a4ecafd | [
"C",
"Makefile"
] | 2 | Makefile | SeanChan6557/i2c_keyboard | d6af2b8a6f74f6056242f8e2c0e207b259e88765 | e920c772daa4beafea7270f81785b720c5be816c |
refs/heads/master | <file_sep>/*
* 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.
*/
#ifndef SRC_SCANNER_CONSTRUCTS_SOURCECONDITIONS_H_
#define SRC_SCANNER_CONSTRUCTS_SOURCECONDITIONS_H_
#include <iostream>
using namespace std;
#include <pthread.h>
namespace writer {
class SinkConditions {
public:
SinkConditions() {
pthread_mutex_init(&resultMutex, 0);
pthread_mutexattr_t Attr;
pthread_mutexattr_init(&Attr);
pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&resultMutex, &Attr);
pthread_cond_init(&moreResults, 0);
alive = true;
closing = false;
}
void waitForResults() {
pthread_mutex_lock(&resultMutex);
if (alive && !closing) {
pthread_cond_wait(&moreResults, &resultMutex);
}
pthread_mutex_unlock(&resultMutex);
}
void awakeThreadsForResults() {
pthread_cond_broadcast(&moreResults);
}
bool isAlive() {
return alive;
}
bool isClosing()
{
return closing;
}
void close()
{
closing = false;
alive = true;
}
void awakeThreadsFinished() {
pthread_mutex_lock(&resultMutex);
closing = true;
awakeThreadsForResults();
pthread_mutex_unlock(&resultMutex);
}
protected:
volatile bool closing;
volatile bool alive;
pthread_cond_t moreResults;
pthread_mutex_t resultMutex;
};
}
#endif /* SRC_SCANNER_CONSTRUCTS_SOURCECONDITIONS_H_ */
<file_sep>/*
* 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.
*/
#ifndef SERVERHEURISTIC_H_
#define SERVERHEURISTIC_H_
#include "Heuristic.h"
#include "../../interconnect/TabletServer.h"
#include "../../interconnect/Scan.h"
#include "../Source.h"
#include <pthread.h>
namespace scanners
{
template<typename T>
struct ScanPair {
Source<KeyValue*, ResultBlock<KeyValue*>> *src;
Heuristic<T> *heuristic;
};
/**
* Contains base functionality to support multi scanning
*/
class ScannerHeuristic : Heuristic<interconnect::ThriftTransporter>
{
public:
/**
* Add a server interconnect
*/
void
addClientInterface (
ClientInterface<interconnect::ThriftTransporter> *serverIfc)
{
pthread_mutex_lock (&serverLock);
Heuristic::addClientInterface (serverIfc);
pthread_mutex_unlock (&serverLock);
}
ScannerHeuristic (short numThreads = 10) :
threadCount (numThreads), threads (NULL), started (false)
{
threads = new pthread_t[threadCount];
}
~ScannerHeuristic ()
{
if (threads != NULL) {
pthread_mutex_lock (&serverLock);
if (threads != NULL) {
if (started)
{
for (int i = 0; i < threadCount; i++) {
pthread_exit (&threads[i]);
}
}
delete threads;
threads = NULL;
started= false;
}
pthread_mutex_unlock (&serverLock);
}
}
uint16_t
scan (Source<KeyValue*, ResultBlock<KeyValue*>> *source)
{
uint16_t scans = 0;
for (int i = 0; i < threadCount; i++) {
ScanPair<interconnect::ThriftTransporter> *pair = new ScanPair<
interconnect::ThriftTransporter>;
pair->src = source;
pair->heuristic = this;
pthread_create (&threads[i], NULL, scanRoutine, (void*) pair);
}
return scans;
}
private:
pthread_mutex_t serverLock = PTHREAD_MUTEX_INITIALIZER;
pthread_t *threads;
uint16_t threadCount;
protected:
static void
closeScan (void *ptr)
{
Source<KeyValue*, ResultBlock<KeyValue*>> *source = static_cast<Source<
KeyValue*, ResultBlock<KeyValue*>>*> (ptr);
source->getResultSet ()->decrementProducers ();
}
static void *
scanRoutine (void *ptr)
{
ScanPair<ScannerHeuristic> *scanResource = static_cast<ScanPair<
ScannerHeuristic>*> (ptr);
Source<KeyValue*, ResultBlock<KeyValue*>> *source = scanResource->src;
source->getResultSet ()->registerProducer ();
pthread_cleanup_push(closeScan,source);
ServerInterconnect *conn = 0;
do {
conn = ((ScannerHeuristic*) scanResource->heuristic)->next ();
if (NULL != conn) {
Scan *scan = conn->scan (source->getColumns(),source->getIters());
do {
vector<KeyValue*> nextResults;
scan->getNextResults (&nextResults);
source->getResultSet ()->add (&nextResults);
nextResults.clear ();
Scan *newScan = conn->continueScan(scan);
if (NULL == newScan)
{
delete scan;
scan = NULL;
}
else
scan = newScan;
} while( scan != NULL);
} else {
delete scanResource;
break;
}
} while (NULL != conn);
pthread_cleanup_pop(1);
return 0;
}
virtual ServerInterconnect *
next ()
{
ClientInterface<interconnect::ThriftTransporter> *nextService = NULL;
pthread_mutex_lock (&serverLock);
if (!servers.empty ()) {
nextService = servers.back ();
servers.pop_back ();
}
pthread_mutex_unlock (&serverLock);
ServerInterconnect *connector =
dynamic_cast<ServerInterconnect*> (nextService);
return connector;
}
bool started;
vector<ClientInterface<interconnect::ThriftTransporter>*>::iterator it;
};
}
#endif /* SERVERHEURISTIC_H_ */
<file_sep>/*
* 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.
*/
#ifndef SRC_WRITER_IMPL_SINKIMPL_H_
#define SRC_WRITER_IMPL_SINKIMPL_H_
#include "../../data/constructs/Key.h"
#include "../../data/constructs/KeyValue.h"
#include "../../data/constructs/security/AuthInfo.h"
#include "../../data/constructs/security/Authorizations.h"
#include "../../data/constructs/value.h"
#include "../../scanner/constructs/Results.h"
#include "../../data/constructs/inputvalidation.h"
#include "../../data/client/ExtentLocator.h"
#include "../../data/constructs/client/zookeeperinstance.h"
#include "../../data/client/LocatorCache.h"
#include "../../interconnect/ClientInterface.h"
#include "../../interconnect/tableOps/TableOperations.h"
#include "../Sink.h"
#include "WriterHeuristic.h"
namespace writer
{
using namespace interconnect;
using namespace scanners;
using namespace cclient::data::zookeeper;
using namespace cclient::data;
using namespace cclient::data::security;
/*
*
*/
class BatchWriter : public Sink<KeyValue*>
{
public:
BatchWriter (Instance *instance,
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *tops,
Authorizations *auths, uint16_t threads);
virtual
~BatchWriter ();
void
flush (bool override = false);
void
setHeuristic (Heuristic<interconnect::ThriftTransporter> *heuristic)
{
writerHeuristic = (WriterHeuristic*) heuristic;
}
protected:
virtual uint64_t waitingSize()
{
return writerHeuristic->size();
}
virtual uint64_t maxWait()
{
return writerHeuristic->maxThreads();
}
WriterHeuristic *writerHeuristic;
AuthInfo *credentials;
vector<ClientInterface<interconnect::ThriftTransporter>*> servers;
ZookeeperInstance *connectorInstance;
TabletLocator *tableLocator;
};
} /* namespace data */
#endif /* SRC_WRITER_IMPL_SINKIMPL_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/SpanReceiver.h"
namespace org
{
namespace apache
{
namespace accumulo
{
namespace trace
{
namespace thrift
{
SpanReceiver_span_args::~SpanReceiver_span_args () throw ()
{
}
uint32_t
SpanReceiver_span_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->span.read (iprot);
this->__isset.span = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
SpanReceiver_span_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("SpanReceiver_span_args");
xfer += oprot->writeFieldBegin (
"span", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->span.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
SpanReceiver_span_pargs::~SpanReceiver_span_pargs () throw ()
{
}
uint32_t
SpanReceiver_span_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("SpanReceiver_span_pargs");
xfer += oprot->writeFieldBegin (
"span", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->span)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
SpanReceiverClient::span (const RemoteSpan& span)
{
send_span (span);
}
void
SpanReceiverClient::send_span (const RemoteSpan& span)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("span",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
SpanReceiver_span_pargs args;
args.span = &span;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
SpanReceiverProcessor::dispatchCall (
::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
const std::string& fname, int32_t seqid, void* callContext)
{
ProcessMap::iterator pfn;
pfn = processMap_.find (fname);
if (pfn == processMap_.end ())
{
iprot->skip (::apache::thrift::protocol::T_STRUCT);
iprot->readMessageEnd ();
iprot->getTransport ()->readEnd ();
::apache::thrift::TApplicationException x (
::apache::thrift::TApplicationException::UNKNOWN_METHOD,
"Invalid method name: '" + fname + "'");
oprot->writeMessageBegin (
fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return true;
}
(this->*(pfn->second)) (seqid, iprot, oprot, callContext);
return true;
}
void
SpanReceiverProcessor::process_span (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext ("SpanReceiver.span",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "SpanReceiver.span");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx, "SpanReceiver.span");
}
SpanReceiver_span_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx, "SpanReceiver.span", bytes);
}
try
{
iface_->span (args.span);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (ctx,
"SpanReceiver.span");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (ctx, "SpanReceiver.span");
}
return;
}
::boost::shared_ptr<::apache::thrift::TProcessor>
SpanReceiverProcessorFactory::getProcessor (
const ::apache::thrift::TConnectionInfo& connInfo)
{
::apache::thrift::ReleaseHandler<SpanReceiverIfFactory> cleanup (
handlerFactory_);
::boost::shared_ptr<SpanReceiverIf> handler (
handlerFactory_->getHandler (connInfo), cleanup);
::boost::shared_ptr<::apache::thrift::TProcessor> processor (
new SpanReceiverProcessor (handler));
return processor;
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#include "../../../include/interconnect/securityOps/SecurityOperations.h"
using namespace interconnect;
SecurityOperations::~SecurityOperations()
{
refDistributedConnector->freeTransport(cachedTransport);
clientInterface->close();
}
bool SecurityOperations::dropUser(string user)
{
// create the client interface so that this service is usable.
clientInterface->closeAndCreateClient();
return clientInterface->dropUser(credentials,user);
}
bool SecurityOperations::changeUserPassword(string user, string password)
{
clientInterface->closeAndCreateClient();
return clientInterface->changeUserPassword(credentials,user,password);
}
bool
SecurityOperations::createUser(string user, string password)
{
// create the client interface so that this service is usable.
clientInterface->closeAndCreateClient();
return clientInterface->createUser(credentials,user,password);
}
cclient::data::security::Authorizations *SecurityOperations::getAuths(string user)
{
// TODO
return NULL;
}
bool SecurityOperations::grantAuthorizations(Authorizations* auths, string user)
{
// create the client interface so that this service is usable.
clientInterface->closeAndCreateClient();
clientInterface->changeUserAuths(credentials,user,auths);
return true;
}
<file_sep>/*
* 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.
*/
#ifndef SRC_INTERCONNECT_ACCUMULO_ACCUMULOSTREAMS_H_
#define SRC_INTERCONNECT_ACCUMULO_ACCUMULOSTREAMS_H_
#include "../../scanner/impl/Scanner.h"
#include "../../writer/impl/SinkImpl.h"
namespace interconnect
{
using namespace scanners;
using namespace writer;
class AccumuloStreams : public Scanner, public BatchWriter
{
public:
AccumuloStreams (Instance *instance,
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *tops,
Authorizations *auths, uint16_t threads);
virtual
~AccumuloStreams ();
};
} /* namespace data */
#endif /* SRC_INTERCONNECT_ACCUMULO_ACCUMULOSTREAMS_H_ */
<file_sep>/*
* 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.
*/
#ifndef DATA_CLIENT_IMPL_METADATA_ROOTTABLETLOCATOR_H_
#define DATA_CLIENT_IMPL_METADATA_ROOTTABLETLOCATOR_H_
#include <set>
#include <vector>
using namespace std;
#include "ExtentLocator.h"
#include "../constructs/column.h"
#include "../constructs/StructureDefinitions.h"
#include "../constructs/client/Instance.h"
#include "../constructs/client/zookeeperinstance.h"
#include "TabletLocationObtainer.h"
#include "../constructs/security/AuthInfo.h"
namespace cclient {
namespace impl {
using namespace cclient::data;
using namespace cclient::data::zookeeper;
using namespace cclient::data::security;
static KeyExtent *ROOT_EXTENT = new KeyExtent("+r", "", "");
class RootTabletLocator: public TabletLocator {
public:
RootTabletLocator(Instance *instance);
~RootTabletLocator();
TabletLocation *locateTablet(AuthInfo *creds, string row, bool skipRow, bool retry) {
TabletLocation *location = getRootTabletLocation();
while (retry && location == NULL) {
pthread_yield();
location = getRootTabletLocation();
}
return location;
}
void binMutations(AuthInfo *credentials, vector<Mutation*> *mutations,
map<string, TabletServerMutations*> *binnedMutations,
set<string> *locations, vector<Mutation*> *failures) {
}
virtual vector<Range*> binRanges(AuthInfo *credentials,vector<Range*> *ranges,
set<string> *locations,
map<string, map<KeyExtent*, vector<Range*>,pointer_comparator<KeyExtent*> > > *binnedRanges) {
return vector<Range*>();
}
void invalidateCache(KeyExtent failedExtent) {
}
void invalidateCache() {
}
void invalidateCache(vector<KeyExtent> keySet) {
}
protected:
TabletLocation *getRootTabletLocation();
ZookeeperInstance *myInstance;
};
}
}
#endif /* DATA_CLIENT_IMPL_METADATA_ROOTTABLETLOCATOR_H_ */
<file_sep>/*
* 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.
*/
#ifndef CLIENTINTERFACE_H_
#define CLIENTINTERFACE_H_
#include <boost/shared_ptr.hpp>
#include <type_traits>
#include <string>
#include "transport/Transport.h"
#include "../data/constructs/security/AuthInfo.h"
using namespace boost;
using namespace std;
namespace interconnect
{
using namespace cclient::data;
using namespace cclient::data::security;
template<typename Tr>
class ClientInterface
{
public:
ClientInterface (const string host, const int port);
ClientInterface ()
{
}
virtual ~ClientInterface ();
virtual void
authenticate (string username, string password) = 0;
void
authenticate (AuthInfo *auth)
{
authenticate (auth->getUserName (), auth->getPassword ());
}
void
setTransport (boost::shared_ptr<Tr> transporty)
{
transport = transporty;
transport->registerService (instanceId, zookeepers);
}
bool
setAuthenticated (bool auth)
{
authenticated = auth;
return auth;
}
void
setCredentials (string user, string password)
{
authenticated_user = user;
authenticated_password = <PASSWORD>;
}
boost::shared_ptr<Tr>
getTransport ()
{
return transport;
}
protected:
boost::shared_ptr<Tr> transport;
string server_host;
int server_port;
bool authenticated;
string authenticated_user;
string authenticated_password;
// info abt cluster
string instanceId;
string zookeepers;
};
template<typename Tr>
ClientInterface<Tr>::ClientInterface (const string host, const int port) :
server_host (host), server_port (port)
{
}
template<typename Tr>
ClientInterface<Tr>::~ClientInterface ()
{
}
}
#endif /* CLIENTINTERFACE_H_ */
<file_sep>/*
* 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.
*/
#include "../../../include/writer/impl/SinkImpl.h"
#include "../../../include/writer/impl/../../data/constructs/KeyValue.h"
#include "../../../include/writer/impl/../../data/constructs/Mutation.h"
#include "../../../include/writer/impl/../../data/constructs/Key.h"
#include "../../../include/writer/impl/../../data/constructs/value.h"
#include "../../../include/writer/impl/WriterHeuristic.h"
using namespace writer;
using namespace cclient::data;
BatchWriter::BatchWriter (Instance *instance,
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *tops,
Authorizations *auths, uint16_t threads) :
Sink<KeyValue*> (500)
{
connectorInstance = dynamic_cast<ZookeeperInstance*> (instance);
tableLocator = cachedLocators.getLocator (
LocatorKey (connectorInstance, tops->getTableId ()));
credentials = tops->getCredentials ();
writerHeuristic = new WriterHeuristic (threads);
}
BatchWriter::~BatchWriter ()
{
writerHeuristic->close();
delete writerHeuristic;
}
void
BatchWriter::flush (bool override)
{
while(sinkQueue->size_approx() > 0)
{
KeyValue **kv = new KeyValue*[queueSize];
size_t dequeued = sinkQueue->try_dequeue_bulk (kv, queueSize);
Mutation *prevMutation = NULL;
vector<Mutation*> *mutation = new vector<Mutation*> ();
for (uint64_t i = 0; i < dequeued; i++) {
Key *key = kv[i]->getKey ();
Value *value = kv[i]->getValue ();
if (NULL != prevMutation) {
std::pair<char*, size_t> row = key->getRow ();
if (row.second > 0) {
string rowStr = string (row.first, row.second);
if (prevMutation->getRow () == rowStr) {
prevMutation->put (key->getColFamilyStr (),
key->getColQualifierStr (),
key->getColVisibilityStr (),
key->getTimeStamp (), key->isDeleted (),
value->data (), value->size ());
delete kv[i];
continue;
}
}
}
Mutation *m = new Mutation (key->getRowStr ());
m->put (key->getColFamilyStr (), key->getColQualifierStr (),
key->getColVisibilityStr (), key->getTimeStamp (),
key->isDeleted (), value->data (), value->size ());
prevMutation = m;
mutation->push_back (m);
delete kv[i];
}
//delete kv;
map<string, TabletServerMutations*> binnedMutations;
set<string> locations;
vector<Mutation*> failures;
tableLocator->binMutations (credentials, mutation, &binnedMutations,
&locations, &failures);
for (string location : locations) {
vector<string> locationSplit = split (location, ':');
ServerDefinition *rangeDef = new ServerDefinition (
credentials,
NULL,
locationSplit.at (0), atoi (locationSplit.at (1).c_str ()));
writerHeuristic->write (rangeDef, connectorInstance->getConfiguration(), binnedMutations.at (location));
}
delete[] kv;
delete mutation;
}
if (override) {
writerHeuristic->close ();
}
}
<file_sep>/*
* 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.
*/
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#include "../../../../../../include/data/constructs/client/zookeeper/test/../zoocache.h"
#include "../../../../../../include/data/constructs/client/zookeeper/test/../../../configuration/Configuration.h"
#include "../../../../../../include/data/constructs/client/zookeeper/test/../../zookeeperinstance.h"
using namespace cclient::data::zookeeper;
using namespace cclient::impl;
int main(int argc, char **argv) {
string host = "localhost:2181";
string instance = "instance";
uint32_t timeout = 1000;
if (argc == 3) {
host = argv[1];
instance = argv[2];
}
ZookeeperInstance *zkInst = new ZookeeperInstance(instance,host,timeout,new Configuration());
cout << zkInst->getInstanceId() << endl;
vector<string> locs = zkInst->getMasterLocations();
for(vector<string>::iterator it = locs.begin(); it != locs.end(); it++)
{
cout << *it << endl;
}
delete zkInst;
return 0;
}
<file_sep>
***
[](https://travis-ci.org/phrocker/NativeKV)
Native KeyValue connector. While initial support has been built for Apache Accumulo, the design
can and has been used to extend to other Key/Value Stores
Currently the code is a merger of C && C++ code. V0.1 will represent a shift more toward
creating a C API, creating exernalized factories for the thrift code.
Capabilities That will be supported in V0.1 --
Currently we are known to work with version 1.6.x and 1.7
--Table Operations--
Most table operations are currently supported
This includes the fate operations that the normal Accumulo client performs.
--Security Operations--
Security operations aren't all implemented, but you should be able to add users, change authorizations, passwords,
and remove users.
Requirements:
GNU 4+
cmake
make
thrift
zookeeper
libhdfs3
Building
```
run install scripts located in root directory
mkdir build && cd build && cmake .. && cmake --build . ; make test
This will build the package and library, which you can use. It will also build
examples in the examples directory
```
Creating a Scanner
```
Configuration conf;
conf.set("FILE_SYSTEM_ROOT", "/accumulo");
ZookeeperInstance *instance = new ZookeeperInstance(argv[1], argv[2], 1000,
&conf);
AuthInfo creds(argv[3], argv[4], instance->getInstanceId());
interconnect::MasterConnect *master = new MasterConnect(&creds, instance);
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *ops = master->tableOps(
table);
// create the scanner with ten threads.
Scanner *scanner =
dynamic_cast<Scanner*>(ops->createScanner(&scanAuths, 10));
// range from a to d
Key *startkey = new Key();
startkey->setRow("a", 1);
Key *stopKey = new Key();
stopKey->setRow("d", 1);
Range *range = new Range(startkey, true, stopKey, true);
// build your range.
scanner->addRange(range);
Results<KeyValue*, ResultBlock<KeyValue*>> *results =
scanner->getResultSet();
for (auto iter = results->begin(); iter != results->end(); iter++) {
KeyValue *kv = *iter;
if (kv != NULL && kv->getKey() != NULL)
cout << "got -- " << (*iter)->getKey() << endl;
else
cout << "Key is null" << endl;
}
```
Full Example
```
bool
keyCompare (KeyValue* a, KeyValue* b)
{
return *(a->getKey ()) < *(b->getKey ());
}
std::pair<string, string>
writeRfile (string nameNode, uint16_t port)
{
struct hdfsBuilder *builder = hdfsNewBuilder ();
string dir = "/testImport/";
string fail = "/testImportFail/";
string path = dir;
path.append ("test.rf");
//set namenode address.
hdfsBuilderSetNameNode (builder, nameNode.c_str ());
//set namenode port.
hdfsBuilderSetNameNodePort (builder, port);
//connect to hdfs
hdfsFS fs = hdfsBuilderConnect (builder);
hdfsDelete (fs, dir.c_str (), 1);
if (hdfsCreateDirectory (fs, dir.c_str ()) == -1) {
cout << "Could not create directory " << dir << endl;
exit (1);
}
hdfsDelete (fs, fail.c_str (), 1);
if (hdfsCreateDirectory (fs, fail.c_str ()) == -1) {
cout << "Could not create directory " << fail << endl;
exit (1);
}
HdfsStream *stream = new HdfsStream (fs, path.c_str (), O_WRONLY | O_APPEND,
1024 * 5, 3, 1024 * 1024 * 1);
Compressor *compressor = new ZLibCompressor (256 * 1024);
BlockCompressedFile bcFile (compressor);
EndianTranslationStream *outStream = new EndianTranslationStream (stream);
RFile *newRFile = new RFile (outStream, &bcFile);
vector<KeyValue*> keyValues;
Key *prevKey = NULL;
struct timeval start, end;
long mtime, seconds, useconds;
char rw[13], cf[3], cq[8], cv[8];
int i = 0;
string moto = "hello moto";
string vis = "00000001";
for (i = 1; i < 150; i++) {
Value *v = new Value (moto);
Key *k = new Key ();
string rowSt = "2";
memset (rw, 0x00, 13);
sprintf (rw, "bat");
k->setRow ((const char*) rw, 8);
sprintf (cf, "%03d", i);
k->setColFamily ((const char*) cf, 3);
sprintf (cq, "%08d", i);
sprintf (cv, "%08d", i);
k->setColQualifier ((const char*) cq, 8);
k->setColVisibility (vis.c_str (), vis.size ());
k->setTimeStamp (1445105294261L);
KeyValue *kv = new KeyValue ();
kv->setKey (k);
kv->setValue (v);
keyValues.push_back (kv);
prevKey = k;
}
std::sort (keyValues.begin (), keyValues.end (), keyCompare);
newRFile->addLocalityGroup ();
for (std::vector<KeyValue*>::iterator it = keyValues.begin ();
it != keyValues.end (); ++it) {
newRFile->append (*it);
}
newRFile->close ();
outStream->flush ();
stream->flush ();
delete outStream;
delete stream;
delete newRFile;
for (std::vector<KeyValue*>::iterator it = keyValues.begin ();
it != keyValues.end (); ++it) {
delete (*it)->getKey ();
delete (*it);
}
//free hdfs builder
hdfsFreeBuilder (builder);
dir = "/testImport/";
fail = "/testImportFail/";
stringstream nd;
nd << nameNode << ":" << port << dir;
path = nd.str();
stringstream faildir;
faildir << nameNode << ":" << port << fail;
fail = faildir.str();
return std::make_pair (path, fail);
}
int
main (int argc, char **argv)
{
if (argc < 5) {
cout << "Arguments required: ./ClientExample"
<< " <instance name> <zks> <user> <password>"
<< " <optional hdfsNN> <optional hdfsPort>" << endl;
exit (1);
}
string nameNode = "";
uint16_t nnPort = 0;
if (argc == 6) {
cout << "Arguments must contains namenode port" << endl;
exit (1);
} else if (argc == 7) {
nameNode = argv[5];
nnPort = atoi (argv[6]);
}
string table = "blah2";
Configuration conf;
conf.set ("FILE_SYSTEM_ROOT", "/accumulo");
ZookeeperInstance *instance = 0;
try{
instance = new ZookeeperInstance (argv[1], argv[2], 1000,
&conf);
}catch(ClientException ce)
{
cout << "Could not connect to ZK. Error: " << ce.what() << endl;
return 1;
}
AuthInfo creds (argv[3], argv[4], instance->getInstanceId ());
interconnect::MasterConnect *master = new MasterConnect (&creds, instance);
ClientTableOps *ops = dynamic_cast<ClientTableOps*>(master->tableOps (
table));
SecurityOperations *secOps = master->securityOps();
// create the table. no harm/no foul if it exists
cout << "Checking if " << table << " exists." << endl;
if (!ops->exists ()) {
cout << "Now, creating " << table << endl;
if (!ops->create ()) {
cout << "Could not create table " << endl;
}
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
}
Authorizations auths;
Authorizations scanAuths;
scanAuths.addAuthorization("00000001");
if (secOps->createUser("dude","thedude"))
{
// now let's drop the user
secOps->dropUser("dude");
}
else
cout << "Could not create user 'dude'" << endl;
secOps->grantAuthorizations(&scanAuths,"root");
int fruit_to_write = 200;
cout << "Writing " << fruit_to_write << " apples and bananas" << endl;
BatchWriter *sink = dynamic_cast<BatchWriter*>(ops->createWriter (&auths, 1));
for (int i = 0; i < fruit_to_write; i++) {
KeyValue *newKv = new KeyValue ();
Key *newKey = new Key ();
newKey->setRow ("a", 1);
newKey->setColFamily ("apple", 5);
stringstream cq;
cq << "banana" << i;
newKey->setColQualifier (cq.str ().c_str (), cq.str ().length ());
newKey->setTimeStamp(1445105294261L);
newKv->setKey (newKey);
newKv->setValue (new Value ());
sink->push (newKv);
}
// close will free memory for objects given to it
sink->close ();
delete sink;
if ( ((ClientTableOps*)ops)->flush("a","z",true) ) {
cout << "flush successful " << endl;
}
if (!IsEmpty (&nameNode)) {
cout << "Writing test Rfile since you specified the NN" << endl;
std::pair<string, string> rfilePair = writeRfile (nameNode, nnPort);
try {
((ClientTableOps*) ops)->import (rfilePair.first, rfilePair.second,true);
}
// close will free memory for objects given to it
catch (std::runtime_error &e) {
cout << "could not complete bulk import" << endl;
}
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
}
if (((ClientTableOps*) ops)->compact("a","z",true)) {
cout << "Compaction successful " << endl;
}
//scan with 10 threads
cout << "Reading values from row a to d" << endl;
Scanner *scanner =
dynamic_cast<Scanner*> (ops->createScanner (&scanAuths, 10));
// range from a to d
Key *startkey = new Key ();
startkey->setRow ("a", 1);
Key *stopKey = new Key ();
stopKey->setRow ("z", 1);
Range *range = new Range (startkey, true, stopKey, false);
scanner->addRange (range);
Results<KeyValue*, ResultBlock<KeyValue*>> *results =
scanner->getResultSet ();
int counter = 0;
for (auto iter = results->begin (); iter != results->end ();
iter++, counter++) {
KeyValue *kv = *iter;
if (kv != NULL && kv->getKey () != NULL)
cout << "got -- " << (*iter)->getKey () << endl;
else
cout << "Key is null" << endl;
delete kv;
}
delete range;
delete scanner;
cout << "Received " << counter << " results " << endl;
cout << "Removing table" << endl;
ops->remove ();
delete ops;
//assert(counter == fruit_to_write/2 );
delete master;
delete instance;
return 0;
}
```
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/client_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace client
{
namespace impl
{
namespace thrift
{
int _kTableOperationValues[] =
{ TableOperation::CREATE, TableOperation::DELETE,
TableOperation::RENAME, TableOperation::SET_PROPERTY,
TableOperation::REMOVE_PROPERTY, TableOperation::OFFLINE,
TableOperation::ONLINE, TableOperation::FLUSH,
TableOperation::PERMISSION, TableOperation::CLONE,
TableOperation::MERGE, TableOperation::DELETE_RANGE,
TableOperation::BULK_IMPORT, TableOperation::COMPACT,
TableOperation::IMPORT, TableOperation::EXPORT,
TableOperation::COMPACT_CANCEL };
const char* _kTableOperationNames[] =
{ "CREATE", "DELETE", "RENAME", "SET_PROPERTY",
"REMOVE_PROPERTY", "OFFLINE", "ONLINE", "FLUSH",
"PERMISSION", "CLONE", "MERGE", "DELETE_RANGE",
"BULK_IMPORT", "COMPACT", "IMPORT", "EXPORT",
"COMPACT_CANCEL" };
const std::map<int, const char*> _TableOperation_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (17, _kTableOperationValues,
_kTableOperationNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kTableOperationExceptionTypeValues[] =
{ TableOperationExceptionType::EXISTS,
TableOperationExceptionType::NOTFOUND,
TableOperationExceptionType::OFFLINE,
TableOperationExceptionType::BULK_BAD_INPUT_DIRECTORY,
TableOperationExceptionType::BULK_BAD_ERROR_DIRECTORY,
TableOperationExceptionType::BAD_RANGE,
TableOperationExceptionType::OTHER,
TableOperationExceptionType::NAMESPACE_EXISTS,
TableOperationExceptionType::NAMESPACE_NOTFOUND,
TableOperationExceptionType::INVALID_NAME };
const char* _kTableOperationExceptionTypeNames[] =
{ "EXISTS", "NOTFOUND", "OFFLINE", "BULK_BAD_INPUT_DIRECTORY",
"BULK_BAD_ERROR_DIRECTORY", "BAD_RANGE", "OTHER",
"NAMESPACE_EXISTS", "NAMESPACE_NOTFOUND", "INVALID_NAME" };
const std::map<int, const char*> _TableOperationExceptionType_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (
10, _kTableOperationExceptionTypeValues,
_kTableOperationExceptionTypeNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kConfigurationTypeValues[] =
{ ConfigurationType::CURRENT, ConfigurationType::SITE,
ConfigurationType::DEFAULT };
const char* _kConfigurationTypeNames[] =
{ "CURRENT", "SITE", "DEFAULT" };
const std::map<int, const char*> _ConfigurationType_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (3, _kConfigurationTypeValues,
_kConfigurationTypeNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kSecurityErrorCodeValues[] =
{ SecurityErrorCode::DEFAULT_SECURITY_ERROR,
SecurityErrorCode::BAD_CREDENTIALS,
SecurityErrorCode::PERMISSION_DENIED,
SecurityErrorCode::USER_DOESNT_EXIST,
SecurityErrorCode::CONNECTION_ERROR,
SecurityErrorCode::USER_EXISTS,
SecurityErrorCode::GRANT_INVALID,
SecurityErrorCode::BAD_AUTHORIZATIONS,
SecurityErrorCode::INVALID_INSTANCEID,
SecurityErrorCode::TABLE_DOESNT_EXIST,
SecurityErrorCode::UNSUPPORTED_OPERATION,
SecurityErrorCode::INVALID_TOKEN,
SecurityErrorCode::AUTHENTICATOR_FAILED,
SecurityErrorCode::AUTHORIZOR_FAILED,
SecurityErrorCode::PERMISSIONHANDLER_FAILED,
SecurityErrorCode::TOKEN_EXPIRED,
SecurityErrorCode::SERIALIZATION_ERROR,
SecurityErrorCode::INSUFFICIENT_PROPERTIES,
SecurityErrorCode::NAMESPACE_DOESNT_EXIST };
const char* _kSecurityErrorCodeNames[] =
{ "DEFAULT_SECURITY_ERROR", "BAD_CREDENTIALS",
"PERMISSION_DENIED", "USER_DOESNT_EXIST",
"CONNECTION_ERROR", "USER_EXISTS", "GRANT_INVALID",
"BAD_AUTHORIZATIONS", "INVALID_INSTANCEID",
"TABLE_DOESNT_EXIST", "UNSUPPORTED_OPERATION",
"INVALID_TOKEN", "AUTHENTICATOR_FAILED",
"AUTHORIZOR_FAILED", "PERMISSIONHANDLER_FAILED",
"TOKEN_EXPIRED", "SERIALIZATION_ERROR",
"INSUFFICIENT_PROPERTIES", "NAMESPACE_DOESNT_EXIST" };
const std::map<int, const char*> _SecurityErrorCode_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (19,
_kSecurityErrorCodeValues,
_kSecurityErrorCodeNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
ThriftSecurityException::~ThriftSecurityException () throw ()
{
}
void
ThriftSecurityException::__set_user (const std::string& val)
{
this->user = val;
}
void
ThriftSecurityException::__set_code (
const SecurityErrorCode::type val)
{
this->code = val;
}
const char* ThriftSecurityException::ascii_fingerprint =
"D6FD826D949221396F4FFC3ECCD3D192";
const uint8_t ThriftSecurityException::binary_fingerprint[16] =
{ 0xD6, 0xFD, 0x82, 0x6D, 0x94, 0x92, 0x21, 0x39, 0x6F, 0x4F,
0xFC, 0x3E, 0xCC, 0xD3, 0xD1, 0x92 };
uint32_t
ThriftSecurityException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->user);
this->__isset.user = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast0;
xfer += iprot->readI32 (ecast0);
this->code = (SecurityErrorCode::type) ecast0;
this->__isset.code = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ThriftSecurityException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ThriftSecurityException");
xfer += oprot->writeFieldBegin (
"user", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->user);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"code", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32 ((int32_t) this->code);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ThriftSecurityException &a, ThriftSecurityException &b)
{
using ::std::swap;
swap (a.user, b.user);
swap (a.code, b.code);
swap (a.__isset, b.__isset);
}
ThriftSecurityException::ThriftSecurityException (
const ThriftSecurityException& other1) :
TException ()
{
user = other1.user;
code = other1.code;
__isset = other1.__isset;
}
ThriftSecurityException&
ThriftSecurityException::operator= (
const ThriftSecurityException& other2)
{
user = other2.user;
code = other2.code;
__isset = other2.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const ThriftSecurityException& obj)
{
using ::apache::thrift::to_string;
out << "ThriftSecurityException(";
out << "user=" << to_string (obj.user);
out << ", " << "code=" << to_string (obj.code);
out << ")";
return out;
}
ThriftTableOperationException::~ThriftTableOperationException () throw ()
{
}
void
ThriftTableOperationException::__set_tableId (
const std::string& val)
{
this->tableId = val;
}
void
ThriftTableOperationException::__set_tableName (
const std::string& val)
{
this->tableName = val;
}
void
ThriftTableOperationException::__set_op (
const TableOperation::type val)
{
this->op = val;
}
void
ThriftTableOperationException::__set_type (
const TableOperationExceptionType::type val)
{
this->type = val;
}
void
ThriftTableOperationException::__set_description (
const std::string& val)
{
this->description = val;
}
const char* ThriftTableOperationException::ascii_fingerprint =
"25ADB6C99E620F729A978F0716AE3156";
const uint8_t ThriftTableOperationException::binary_fingerprint[16] =
{ 0x25, 0xAD, 0xB6, 0xC9, 0x9E, 0x62, 0x0F, 0x72, 0x9A, 0x97,
0x8F, 0x07, 0x16, 0xAE, 0x31, 0x56 };
uint32_t
ThriftTableOperationException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast3;
xfer += iprot->readI32 (ecast3);
this->op = (TableOperation::type) ecast3;
this->__isset.op = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast4;
xfer += iprot->readI32 (ecast4);
this->type =
(TableOperationExceptionType::type) ecast4;
this->__isset.type = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->description);
this->__isset.description = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ThriftTableOperationException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ThriftTableOperationException");
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"op", ::apache::thrift::protocol::T_I32, 3);
xfer += oprot->writeI32 ((int32_t) this->op);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"type", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32 ((int32_t) this->type);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"description", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString (this->description);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ThriftTableOperationException &a,
ThriftTableOperationException &b)
{
using ::std::swap;
swap (a.tableId, b.tableId);
swap (a.tableName, b.tableName);
swap (a.op, b.op);
swap (a.type, b.type);
swap (a.description, b.description);
swap (a.__isset, b.__isset);
}
ThriftTableOperationException::ThriftTableOperationException (
const ThriftTableOperationException& other5) :
TException ()
{
tableId = other5.tableId;
tableName = other5.tableName;
op = other5.op;
type = other5.type;
description = other5.description;
__isset = other5.__isset;
}
ThriftTableOperationException&
ThriftTableOperationException::operator= (
const ThriftTableOperationException& other6)
{
tableId = other6.tableId;
tableName = other6.tableName;
op = other6.op;
type = other6.type;
description = other6.description;
__isset = other6.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out,
const ThriftTableOperationException& obj)
{
using ::apache::thrift::to_string;
out << "ThriftTableOperationException(";
out << "tableId=" << to_string (obj.tableId);
out << ", " << "tableName=" << to_string (obj.tableName);
out << ", " << "op=" << to_string (obj.op);
out << ", " << "type=" << to_string (obj.type);
out << ", " << "description=" << to_string (obj.description);
out << ")";
return out;
}
TDiskUsage::~TDiskUsage () throw ()
{
}
void
TDiskUsage::__set_tables (const std::vector<std::string> & val)
{
this->tables = val;
}
void
TDiskUsage::__set_usage (const int64_t val)
{
this->usage = val;
}
const char* TDiskUsage::ascii_fingerprint =
"D26F4F5E2867D41CF7E0391263932D6B";
const uint8_t TDiskUsage::binary_fingerprint[16] =
{ 0xD2, 0x6F, 0x4F, 0x5E, 0x28, 0x67, 0xD4, 0x1C, 0xF7, 0xE0,
0x39, 0x12, 0x63, 0x93, 0x2D, 0x6B };
uint32_t
TDiskUsage::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->tables.clear ();
uint32_t _size7;
::apache::thrift::protocol::TType _etype10;
xfer += iprot->readListBegin (_etype10, _size7);
this->tables.resize (_size7);
uint32_t _i11;
for (_i11 = 0; _i11 < _size7; ++_i11)
{
xfer += iprot->readString (
this->tables[_i11]);
}
xfer += iprot->readListEnd ();
}
this->__isset.tables = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->usage);
this->__isset.usage = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TDiskUsage::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TDiskUsage");
xfer += oprot->writeFieldBegin (
"tables", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->tables.size ()));
std::vector<std::string>::const_iterator _iter12;
for (_iter12 = this->tables.begin ();
_iter12 != this->tables.end (); ++_iter12)
{
xfer += oprot->writeString ((*_iter12));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"usage", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64 (this->usage);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TDiskUsage &a, TDiskUsage &b)
{
using ::std::swap;
swap (a.tables, b.tables);
swap (a.usage, b.usage);
swap (a.__isset, b.__isset);
}
TDiskUsage::TDiskUsage (const TDiskUsage& other13)
{
tables = other13.tables;
usage = other13.usage;
__isset = other13.__isset;
}
TDiskUsage&
TDiskUsage::operator= (const TDiskUsage& other14)
{
tables = other14.tables;
usage = other14.usage;
__isset = other14.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TDiskUsage& obj)
{
using ::apache::thrift::to_string;
out << "TDiskUsage(";
out << "tables=" << to_string (obj.tables);
out << ", " << "usage=" << to_string (obj.usage);
out << ")";
return out;
}
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef trace_TYPES_H
#define trace_TYPES_H
#include <iosfwd>
#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>
#include <thrift/cxxfunctional.h>
namespace org { namespace apache { namespace accumulo { namespace trace { namespace thrift {
class RemoteSpan;
class TInfo;
typedef struct _RemoteSpan__isset {
_RemoteSpan__isset() : sender(false), svc(false), traceId(false), spanId(false), parentId(false), start(false), stop(false), description(false), data(false) {}
bool sender :1;
bool svc :1;
bool traceId :1;
bool spanId :1;
bool parentId :1;
bool start :1;
bool stop :1;
bool description :1;
bool data :1;
} _RemoteSpan__isset;
class RemoteSpan {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x22,0xEA,0x46,0xE7,0x38,0xFD,0xCE,0x79,0x62,0x36,0x3D,0x25,0xAE,0xC4,0x6F,0xDF};
RemoteSpan(const RemoteSpan&);
RemoteSpan& operator=(const RemoteSpan&);
RemoteSpan() : sender(), svc(), traceId(0), spanId(0), parentId(0), start(0), stop(0), description() {
}
virtual ~RemoteSpan() throw();
std::string sender;
std::string svc;
int64_t traceId;
int64_t spanId;
int64_t parentId;
int64_t start;
int64_t stop;
std::string description;
std::map<std::string, std::string> data;
_RemoteSpan__isset __isset;
void __set_sender(const std::string& val);
void __set_svc(const std::string& val);
void __set_traceId(const int64_t val);
void __set_spanId(const int64_t val);
void __set_parentId(const int64_t val);
void __set_start(const int64_t val);
void __set_stop(const int64_t val);
void __set_description(const std::string& val);
void __set_data(const std::map<std::string, std::string> & val);
bool operator == (const RemoteSpan & rhs) const
{
if (!(sender == rhs.sender))
return false;
if (!(svc == rhs.svc))
return false;
if (!(traceId == rhs.traceId))
return false;
if (!(spanId == rhs.spanId))
return false;
if (!(parentId == rhs.parentId))
return false;
if (!(start == rhs.start))
return false;
if (!(stop == rhs.stop))
return false;
if (!(description == rhs.description))
return false;
if (!(data == rhs.data))
return false;
return true;
}
bool operator != (const RemoteSpan &rhs) const {
return !(*this == rhs);
}
bool operator < (const RemoteSpan & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const RemoteSpan& obj);
};
void swap(RemoteSpan &a, RemoteSpan &b);
typedef struct _TInfo__isset {
_TInfo__isset() : traceId(false), parentId(false) {}
bool traceId :1;
bool parentId :1;
} _TInfo__isset;
class TInfo {
public:
static const char* ascii_fingerprint; // = "F33135321253DAEB67B0E79E416CA831";
static const uint8_t binary_fingerprint[16]; // = {0xF3,0x31,0x35,0x32,0x12,0x53,0xDA,0xEB,0x67,0xB0,0xE7,0x9E,0x41,0x6C,0xA8,0x31};
TInfo(const TInfo&);
TInfo& operator=(const TInfo&);
TInfo() : traceId(0), parentId(0) {
}
virtual ~TInfo() throw();
int64_t traceId;
int64_t parentId;
_TInfo__isset __isset;
void __set_traceId(const int64_t val);
void __set_parentId(const int64_t val);
bool operator == (const TInfo & rhs) const
{
if (!(traceId == rhs.traceId))
return false;
if (!(parentId == rhs.parentId))
return false;
return true;
}
bool operator != (const TInfo &rhs) const {
return !(*this == rhs);
}
bool operator < (const TInfo & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const TInfo& obj);
};
void swap(TInfo &a, TInfo &b);
}}}}} // namespace
#endif
<file_sep>/*
* 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.
*/
#include <list>
#include <string>
using namespace std;
#include "../../../include/data/exceptions/ClientException.h"
#include "../../../include/interconnect/namespaceOps/NamespaceOperations.h"
#include "../../../include/interconnect/tableOps/../../data/constructs/ConfigurationOptions.h"
using namespace cclient::exceptions;
namespace interconnect{
NamespaceOperations::~NamespaceOperations()
{
}
bool NamespaceOperations::exists(std::string name){
if (IsEmpty(&name))
name = myNamespace;
return namespaces.find (name) != std::end (namespaces);
}
void NamespaceOperations::create(string name)
{
interconnect::AccumuloMasterTransporter *baseTransport =
clientInterface->getTransport ().get ();
if (IsEmpty(&name))
name = myNamespace;
if (!baseTransport->createNamespace(credentials,name))
{
throw ClientException(COULD_NOT_CREATE_NAMESPACE);
}
else{
loadNamespaces();
}
}
bool NamespaceOperations::remove(string name)
{
if (IsEmpty(&name))
name = myNamespace;
string id = namespaces[name];
if (IsEmpty(&id) || id == "accumulo" )
{
throw ClientException(DELETE_DEFAULT_NAMESPACE);
}
else
{
interconnect::AccumuloMasterTransporter *baseTransport =
clientInterface->getTransport ().get ();
if (!baseTransport->deletenamespace(credentials,name))
{
throw ClientException(COULD_NOT_CREATE_NAMESPACE);
}
else{
loadNamespaces();
}
}
return false;
}
void NamespaceOperations::rename(string newName, string oldName)
{
if (IsEmpty(&oldName))
{
oldName = myNamespace;
}
string id = namespaces[oldName];
if (IsEmpty(&id) || id == "accumulo" )
{
throw ClientException(DELETE_DEFAULT_NAMESPACE);
}
else
{
interconnect::AccumuloMasterTransporter *baseTransport =
clientInterface->getTransport ().get ();
if (!baseTransport->renamenamespace(credentials,oldName,newName))
{
throw ClientException(COULD_NOT_CREATE_NAMESPACE);
}
else{
loadNamespaces();
}
}
}
string NamespaceOperations::systemNamespace()
{
return "accumulo";
}
list< string > NamespaceOperations::list()
{
return namespaceNames;
}
void NamespaceOperations::loadNamespaces(bool force)
{
pthread_mutex_lock (&namesOpMutex);
const Configuration *conf = myInstance->getConfiguration ();
string fsRoot = conf->get (FILE_SYSTEM_ROOT_CFG);
fsRoot.append ("/");
fsRoot.append (myInstance->getInstanceId ());
fsRoot.append ( TABLE_GET_NAMESPACES);
InstanceCache *cache = myInstance->getInstanceCache ();
std::list<string> namespaceIds = cache->getChildren (fsRoot,force);
namespaces.clear ();
namespaceNames.clear();
for (string retrievedId : namespaceIds) {
string tablePath = fsRoot;
tablePath.append ("/");
tablePath.append (retrievedId);
string namePath = tablePath;
namePath.append (TABLE_GET_NAME);
char *path = (char*) cache->getData (namePath);
if (IsEmpty (path)) {
continue;
pthread_mutex_unlock (&namesOpMutex);
}
std::string namespaceName = string (path);
if (!IsEmpty (&namespaceName)) {
// insert both representations
namespaces.insert (std::make_pair (retrievedId, namespaceName));
namespaces.insert (std::make_pair (namespaceName, retrievedId));
namespaceNames.push_back(namespaceName);
}
}
pthread_mutex_unlock (&namesOpMutex);
}
}
<file_sep>/*
* 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.
*/
#ifndef TABLETSERVERLOCATOR_H_
#define TABLETSERVERLOCATOR_H_
#include <map>
#include <sstream>
#include "ExtentLocator.h"
#include "../constructs/client/Instance.h"
#include "TabletLocationObtainer.h"
using namespace std;
namespace cclient {
namespace impl {
class TabletServerLocator: public TabletLocator {
public:
TabletServerLocator(string tableId, TabletLocator *parent,
TabletLocationObtainer *locator, Instance *inst);
virtual ~TabletServerLocator();
virtual list<TabletLocation*> locations(AuthInfo *credentials)
{
stringstream metadataRow;
metadataRow << tableId << ';';
TabletLocation *location = parent->locateTablet(credentials,
metadataRow.str(), false, true);
list<TabletLocation*> locations = locator->findTablet(credentials,
location, metadataRow.str(), lastTabletRow, parent);
return locations;
}
TabletLocation *locateTablet(AuthInfo *creds, string row, bool skipRow,
bool retry) {
string modifiedRow;
if (skipRow) {
char *backing = new char[row.length() + 1];
memset(backing, 0x01, row.length() + 1);
memcpy(backing, row.c_str(), row.length());
modifiedRow = string(backing);
delete[] backing;
} else
modifiedRow = row;
// check cached
stringstream metadataRow;
metadataRow << tableId << ';' << modifiedRow;
TabletLocation *parentLocation = parent->locateTablet(creds,
metadataRow.str(), false, retry);
if (NULL != parentLocation) {
list<TabletLocation*> locations = locator->findTablet(creds,
parentLocation, metadataRow.str(), lastTabletRow, parent);
TabletLocation *returnLocation = NULL;
for (auto location : locations) {
if (location->getExtent()->getPrevEndRow().length() == 0
|| location->getExtent()->getPrevEndRow()
< modifiedRow) {
returnLocation = location;
break;
} else {
cout << "could not find location" << endl;
exit(1);
}
}
for (auto loc : locations) {
if (returnLocation != loc)
{
delete loc;
}
}
delete parentLocation;
if (NULL != returnLocation)
return returnLocation;
else
throw new ClientException("Could not find tablet");
} else {
cout << "could not find location" << endl;
exit(1);
}
return 0;
}
inline void binMutations(AuthInfo *credentials, vector<Mutation*> *mutations,
map<string, TabletServerMutations*> *binnedMutations,
set<string> *locations, vector<Mutation*> *failures) {
map<string, TabletServerMutations*>::iterator it;
for (Mutation *m : *mutations) {
TabletLocation *loc = locateTablet(credentials, m->getRow(), false,false);
TabletServerMutations *tsm = NULL;
it = binnedMutations->find(loc->getLocation());
if (it != binnedMutations->end()) {
tsm = it->second;
}
if (NULL == tsm) {
locations->insert(loc->getLocation());
tsm = new TabletServerMutations(loc->getSession());
binnedMutations->insert(
std::make_pair(loc->getLocation(), tsm));
}
tsm->addMutation(loc->getExtent(), m);
loc->setExtent(0);
delete loc;
}
}
vector<Range*> binRanges(AuthInfo *credentials, vector<Range*> *ranges,
set<string> *locations,
map<string,
map<KeyExtent*, vector<Range*>,
pointer_comparator<KeyExtent*> > > *binnedRanges) {
string startRow = "";
vector<Range*> failures;
vector<TabletLocation*> tabletLocations;
for (auto range : *ranges) {
if (range->getStartKey() != NULL) {
startRow = string(range->getStartKey()->getRow().first,
range->getStartKey()->getRow().second);
}
TabletLocation *loc = locateTablet(credentials, startRow, false,
false);
if (NULL == loc) {
failures.push_back(range);
continue;
}
tabletLocations.push_back(loc);
string stopKey = "";
if (range->getStopKey() != NULL)
stopKey = string(range->getStopKey()->getRow().first,
range->getStopKey()->getRow().second);
string extentEndRow = loc->getExtent()->getEndRow();
while (!range->getInfiniteStopKey() && stopKey >= extentEndRow) {
loc = locateTablet(credentials, extentEndRow, true, false);
if (NULL == loc) {
break;
}
tabletLocations.push_back(loc);
extentEndRow = loc->getExtent()->getEndRow();
if (extentEndRow.length() == 0)
break;
}
for (auto locs : tabletLocations) {
locations->insert(loc->getLocation());
(*binnedRanges)[loc->getLocation()][locs->getExtent()].push_back(
range);
}
}
return failures;
}
void invalidateCache(KeyExtent failedExtent) {
}
void invalidateCache() {
}
void invalidateCache(vector<KeyExtent> keySet) {
}
protected:
string lastTabletRow;
string tableId;
TabletLocator *parent;
TabletLocationObtainer *locator;
Instance *instance;
};
} /* namespace data */
} /* namespace cclient */
#endif /* TABLETSERVERLOCATOR_H_ */
<file_sep>/*
* 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.
*/
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include <string>
#include <map>
using namespace std;
namespace cclient {
namespace impl {
/**
* Purpose & Design: Based on the hadoop configuration object
*/
class Configuration {
public:
/**
* Constructor
*/
Configuration();
virtual ~Configuration();
/**
* Sets the value of the name
* @param name config option name
* @param value
*/
void set(string name, string value);
/**
* Returns the config option
* @param name
*/
string get(string name) const ;
/**
* Returns the config option using default if the map option isn't set
*/
string get(string name, string def) const ;
uint32_t getLong(string name) const ;
uint32_t getLong(string name, uint32_t def) const ;
protected:
map<string, string> configurationMap;
};
} /* namespace impl */
} /* namespace cclient */
#endif /* CONFIGURATION_H_ */
<file_sep>/*
* 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.
*/
#ifndef KEYVALUE_H_
#define KEYVALUE_H_
#include <stdint.h>
#include "Key.h"
#include "value.h"
#include "rkey.h"
#include "../streaming/Streams.h"
namespace cclient
{
namespace data
{
class KeyValue : public StreamInterface
{
public:
KeyValue();
virtual ~KeyValue();
void setKey(Key *k, bool set_ownership = false);
Key *getKey();
inline bool hasOwnerShip()
{
return my_alloc;
}
StreamInterface *getStream();
Value *getValue();
void setValue(Value *v);
void setValue(uint8_t *b, size_t size);
uint64_t write(OutputStream *outStream);
KeyValue &operator=(const KeyValue &other);
bool operator <(const KeyValue &rhs) const;
bool operator <(const KeyValue *rhs) const;
bool operator == (const KeyValue *rhs) const;
bool operator == (const KeyValue & rhs) const;
bool operator != (const KeyValue &rhs) const;
bool operator != (const KeyValue *rhs) const;
protected:
Key *key;
Value *value;
bool my_alloc;
};
} /* namespace data */
} /* namespace cclient */
#endif /* KEYVALUE_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/data_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace data
{
namespace thrift
{
int _kTCMStatusValues[] =
{ TCMStatus::ACCEPTED, TCMStatus::REJECTED, TCMStatus::VIOLATED,
TCMStatus::IGNORED };
const char* _kTCMStatusNames[] =
{ "ACCEPTED", "REJECTED", "VIOLATED", "IGNORED" };
const std::map<int, const char*> _TCMStatus_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (4, _kTCMStatusValues,
_kTCMStatusNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
TKey::~TKey () throw ()
{
}
void
TKey::__set_row (const std::string& val)
{
this->row = val;
}
void
TKey::__set_colFamily (const std::string& val)
{
this->colFamily = val;
}
void
TKey::__set_colQualifier (const std::string& val)
{
this->colQualifier = val;
}
void
TKey::__set_colVisibility (const std::string& val)
{
this->colVisibility = val;
}
void
TKey::__set_timestamp (const int64_t val)
{
this->timestamp = val;
}
const char* TKey::ascii_fingerprint =
"A25840E2198F27E10AEEE70C9265C644";
const uint8_t TKey::binary_fingerprint[16] =
{ 0xA2, 0x58, 0x40, 0xE2, 0x19, 0x8F, 0x27, 0xE1, 0x0A, 0xEE,
0xE7, 0x0C, 0x92, 0x65, 0xC6, 0x44 };
uint32_t
TKey::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->row);
this->__isset.row = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->colFamily);
this->__isset.colFamily = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->colQualifier);
this->__isset.colQualifier = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->colVisibility);
this->__isset.colVisibility = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->timestamp);
this->__isset.timestamp = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TKey::write (::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TKey");
xfer += oprot->writeFieldBegin (
"row", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary (this->row);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"colFamily", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeBinary (this->colFamily);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"colQualifier", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->colQualifier);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"colVisibility", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeBinary (this->colVisibility);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("timestamp",
::apache::thrift::protocol::T_I64,
5);
xfer += oprot->writeI64 (this->timestamp);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TKey &a, TKey &b)
{
using ::std::swap;
swap (a.row, b.row);
swap (a.colFamily, b.colFamily);
swap (a.colQualifier, b.colQualifier);
swap (a.colVisibility, b.colVisibility);
swap (a.timestamp, b.timestamp);
swap (a.__isset, b.__isset);
}
TKey::TKey (const TKey& other0)
{
row = other0.row;
colFamily = other0.colFamily;
colQualifier = other0.colQualifier;
colVisibility = other0.colVisibility;
timestamp = other0.timestamp;
__isset = other0.__isset;
}
TKey&
TKey::operator= (const TKey& other1)
{
row = other1.row;
colFamily = other1.colFamily;
colQualifier = other1.colQualifier;
colVisibility = other1.colVisibility;
timestamp = other1.timestamp;
__isset = other1.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TKey& obj)
{
using ::apache::thrift::to_string;
out << "TKey(";
out << "row=" << to_string (obj.row);
out << ", " << "colFamily=" << to_string (obj.colFamily);
out << ", " << "colQualifier=" << to_string (obj.colQualifier);
out << ", " << "colVisibility=" << to_string (obj.colVisibility);
out << ", " << "timestamp=" << to_string (obj.timestamp);
out << ")";
return out;
}
TColumn::~TColumn () throw ()
{
}
void
TColumn::__set_columnFamily (const std::string& val)
{
this->columnFamily = val;
}
void
TColumn::__set_columnQualifier (const std::string& val)
{
this->columnQualifier = val;
}
void
TColumn::__set_columnVisibility (const std::string& val)
{
this->columnVisibility = val;
}
const char* TColumn::ascii_fingerprint =
"<KEY>";
const uint8_t TColumn::binary_fingerprint[16] =
{ 0xAB, 0x87, 0x99, 0x40, 0xBD, 0x15, 0xB6, 0xB2, 0x56, 0x91,
0x26, 0x5F, 0x73, 0x84, 0xB2, 0x71 };
uint32_t
TColumn::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->columnFamily);
this->__isset.columnFamily = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->columnQualifier);
this->__isset.columnQualifier = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->columnVisibility);
this->__isset.columnVisibility = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TColumn::write (::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TColumn");
xfer += oprot->writeFieldBegin (
"columnFamily", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary (this->columnFamily);
xfer += oprot->writeFieldEnd ();
if (this->columnQualifier.length () > 0)
{
xfer += oprot->writeFieldBegin (
"columnQualifier", ::apache::thrift::protocol::T_STRING,
2);
xfer += oprot->writeBinary (this->columnQualifier);
xfer += oprot->writeFieldEnd ();
}
if (this->columnVisibility.length () > 0)
{
xfer += oprot->writeFieldBegin (
"columnVisibility", ::apache::thrift::protocol::T_STRING,
3);
xfer += oprot->writeBinary (this->columnVisibility);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TColumn &a, TColumn &b)
{
using ::std::swap;
swap (a.columnFamily, b.columnFamily);
swap (a.columnQualifier, b.columnQualifier);
swap (a.columnVisibility, b.columnVisibility);
swap (a.__isset, b.__isset);
}
TColumn::TColumn (const TColumn& other2)
{
columnFamily = other2.columnFamily;
columnQualifier = other2.columnQualifier;
columnVisibility = other2.columnVisibility;
__isset = other2.__isset;
}
TColumn&
TColumn::operator= (const TColumn& other3)
{
columnFamily = other3.columnFamily;
columnQualifier = other3.columnQualifier;
columnVisibility = other3.columnVisibility;
__isset = other3.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TColumn& obj)
{
using ::apache::thrift::to_string;
out << "TColumn(";
out << "columnFamily=" << to_string (obj.columnFamily);
out << ", " << "columnQualifier="
<< to_string (obj.columnQualifier);
out << ", " << "columnVisibility="
<< to_string (obj.columnVisibility);
out << ")";
return out;
}
TMutation::~TMutation () throw ()
{
}
void
TMutation::__set_row (const std::string& val)
{
this->row = val;
}
void
TMutation::__set_data (const std::string& val)
{
this->data = val;
}
void
TMutation::__set_values (const std::vector<std::string> & val)
{
this->values = val;
}
void
TMutation::__set_entries (const int32_t val)
{
this->entries = val;
}
const char* TMutation::ascii_fingerprint =
"FD79BD16256E16CC9822166FFB701F19";
const uint8_t TMutation::binary_fingerprint[16] =
{ 0xFD, 0x79, 0xBD, 0x16, 0x25, 0x6E, 0x16, 0xCC, 0x98, 0x22,
0x16, 0x6F, 0xFB, 0x70, 0x1F, 0x19 };
uint32_t
TMutation::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->row);
this->__isset.row = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->data);
this->__isset.data = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->values.clear ();
uint32_t _size4;
::apache::thrift::protocol::TType _etype7;
xfer += iprot->readListBegin (_etype7, _size4);
this->values.resize (_size4);
uint32_t _i8;
for (_i8 = 0; _i8 < _size4; ++_i8)
{
xfer += iprot->readBinary (this->values[_i8]);
}
xfer += iprot->readListEnd ();
}
this->__isset.values = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->entries);
this->__isset.entries = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TMutation::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TMutation");
xfer += oprot->writeFieldBegin (
"row", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary (this->row);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"data", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeBinary (this->data);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"values", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->values.size ()));
std::vector<std::string>::const_iterator _iter9;
for (_iter9 = this->values.begin ();
_iter9 != this->values.end (); ++_iter9)
{
xfer += oprot->writeBinary ((*_iter9));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("entries",
::apache::thrift::protocol::T_I32,
4);
xfer += oprot->writeI32 (this->entries);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TMutation &a, TMutation &b)
{
using ::std::swap;
swap (a.row, b.row);
swap (a.data, b.data);
swap (a.values, b.values);
swap (a.entries, b.entries);
swap (a.__isset, b.__isset);
}
TMutation::TMutation (const TMutation& other10)
{
row = other10.row;
data = other10.data;
values = other10.values;
entries = other10.entries;
__isset = other10.__isset;
}
TMutation&
TMutation::operator= (const TMutation& other11)
{
row = other11.row;
data = other11.data;
values = other11.values;
entries = other11.entries;
__isset = other11.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TMutation& obj)
{
using ::apache::thrift::to_string;
out << "TMutation(";
out << "row=" << to_string (obj.row);
out << ", " << "data=" << to_string (obj.data);
out << ", " << "values=" << to_string (obj.values);
out << ", " << "entries=" << to_string (obj.entries);
out << ")";
return out;
}
TKeyExtent::~TKeyExtent () throw ()
{
}
void
TKeyExtent::__set_table (const std::string& val)
{
this->table = val;
}
void
TKeyExtent::__set_endRow (const std::string& val)
{
this->endRow = val;
}
void
TKeyExtent::__set_prevEndRow (const std::string& val)
{
this->prevEndRow = val;
}
const char* TKeyExtent::ascii_fingerprint =
"<KEY>";
const uint8_t TKeyExtent::binary_fingerprint[16] =
{ 0xAB, 0x87, 0x99, 0x40, 0xBD, 0x15, 0xB6, 0xB2, 0x56, 0x91,
0x26, 0x5F, 0x73, 0x84, 0xB2, 0x71 };
uint32_t
TKeyExtent::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->table);
this->__isset.table = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->endRow);
this->__isset.endRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->prevEndRow);
this->__isset.prevEndRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TKeyExtent::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TKeyExtent");
xfer += oprot->writeFieldBegin (
"table", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary (this->table);
xfer += oprot->writeFieldEnd ();
if (this->endRow.length () > 0)
{
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeBinary (this->endRow);
xfer += oprot->writeFieldEnd ();
}
if (this->prevEndRow.length () > 0)
{
xfer += oprot->writeFieldBegin (
"prevEndRow", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->prevEndRow);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TKeyExtent &a, TKeyExtent &b)
{
using ::std::swap;
swap (a.table, b.table);
swap (a.endRow, b.endRow);
swap (a.prevEndRow, b.prevEndRow);
swap (a.__isset, b.__isset);
}
TKeyExtent::TKeyExtent (const TKeyExtent& other12)
{
table = other12.table;
endRow = other12.endRow;
prevEndRow = other12.prevEndRow;
__isset = other12.__isset;
}
TKeyExtent&
TKeyExtent::operator= (const TKeyExtent& other13)
{
table = other13.table;
endRow = other13.endRow;
prevEndRow = other13.prevEndRow;
__isset = other13.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TKeyExtent& obj)
{
using ::apache::thrift::to_string;
out << "TKeyExtent(";
out << "table=" << to_string (obj.table);
out << ", " << "endRow=" << to_string (obj.endRow);
out << ", " << "prevEndRow=" << to_string (obj.prevEndRow);
out << ")";
return out;
}
TKeyValue::~TKeyValue () throw ()
{
}
void
TKeyValue::__set_key (const TKey& val)
{
this->key = val;
}
void
TKeyValue::__set_value (const std::string& val)
{
this->value = val;
}
const char* TKeyValue::ascii_fingerprint =
"<KEY>";
const uint8_t TKeyValue::binary_fingerprint[16] =
{ 0x8D, 0xCB, 0xA6, 0xF4, 0xB3, 0x36, 0xC8, 0x85, 0x49, 0x64,
0xF0, 0x8F, 0xBF, 0x39, 0x19, 0x43 };
uint32_t
TKeyValue::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->key.read (iprot);
this->__isset.key = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->value);
this->__isset.value = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TKeyValue::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TKeyValue");
xfer += oprot->writeFieldBegin (
"key", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->key.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeBinary (this->value);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TKeyValue &a, TKeyValue &b)
{
using ::std::swap;
swap (a.key, b.key);
swap (a.value, b.value);
swap (a.__isset, b.__isset);
}
TKeyValue::TKeyValue (const TKeyValue& other14)
{
key = other14.key;
value = other14.value;
__isset = other14.__isset;
}
TKeyValue&
TKeyValue::operator= (const TKeyValue& other15)
{
key = other15.key;
value = other15.value;
__isset = other15.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TKeyValue& obj)
{
using ::apache::thrift::to_string;
out << "TKeyValue(";
out << "key=" << to_string (obj.key);
out << ", " << "value=" << to_string (obj.value);
out << ")";
return out;
}
ScanResult::~ScanResult () throw ()
{
}
void
ScanResult::__set_results (const std::vector<TKeyValue> & val)
{
this->results = val;
}
void
ScanResult::__set_more (const bool val)
{
this->more = val;
}
const char* ScanResult::ascii_fingerprint =
"6F1B73B7E271D491518DF10CFB0E8087";
const uint8_t ScanResult::binary_fingerprint[16] =
{ 0x6F, 0x1B, 0x73, 0xB7, 0xE2, 0x71, 0xD4, 0x91, 0x51, 0x8D,
0xF1, 0x0C, 0xFB, 0x0E, 0x80, 0x87 };
uint32_t
ScanResult::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->results.clear ();
uint32_t _size16;
::apache::thrift::protocol::TType _etype19;
xfer += iprot->readListBegin (_etype19, _size16);
this->results.resize (_size16);
uint32_t _i20;
for (_i20 = 0; _i20 < _size16; ++_i20)
{
xfer += this->results[_i20].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.results = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->more);
this->__isset.more = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ScanResult::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ScanResult");
xfer += oprot->writeFieldBegin (
"results", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->results.size ()));
std::vector<TKeyValue>::const_iterator _iter21;
for (_iter21 = this->results.begin ();
_iter21 != this->results.end (); ++_iter21)
{
xfer += (*_iter21).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"more", ::apache::thrift::protocol::T_BOOL, 2);
xfer += oprot->writeBool (this->more);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ScanResult &a, ScanResult &b)
{
using ::std::swap;
swap (a.results, b.results);
swap (a.more, b.more);
swap (a.__isset, b.__isset);
}
ScanResult::ScanResult (const ScanResult& other22)
{
results = other22.results;
more = other22.more;
__isset = other22.__isset;
}
ScanResult&
ScanResult::operator= (const ScanResult& other23)
{
results = other23.results;
more = other23.more;
__isset = other23.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const ScanResult& obj)
{
using ::apache::thrift::to_string;
out << "ScanResult(";
out << "results=" << to_string (obj.results);
out << ", " << "more=" << to_string (obj.more);
out << ")";
return out;
}
TRange::~TRange () throw ()
{
}
void
TRange::__set_start (const TKey& val)
{
this->start = val;
}
void
TRange::__set_stop (const TKey& val)
{
this->stop = val;
}
void
TRange::__set_startKeyInclusive (const bool val)
{
this->startKeyInclusive = val;
}
void
TRange::__set_stopKeyInclusive (const bool val)
{
this->stopKeyInclusive = val;
}
void
TRange::__set_infiniteStartKey (const bool val)
{
this->infiniteStartKey = val;
}
void
TRange::__set_infiniteStopKey (const bool val)
{
this->infiniteStopKey = val;
}
const char* TRange::ascii_fingerprint =
"51C5BDA7AC16F12A08D7C8B6BB52C360";
const uint8_t TRange::binary_fingerprint[16] =
{ 0x51, 0xC5, 0xBD, 0xA7, 0xAC, 0x16, 0xF1, 0x2A, 0x08, 0xD7,
0xC8, 0xB6, 0xBB, 0x52, 0xC3, 0x60 };
uint32_t
TRange::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->start.read (iprot);
this->__isset.start = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->stop.read (iprot);
this->__isset.stop = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->startKeyInclusive);
this->__isset.startKeyInclusive = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->stopKeyInclusive);
this->__isset.stopKeyInclusive = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->infiniteStartKey);
this->__isset.infiniteStartKey = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->infiniteStopKey);
this->__isset.infiniteStopKey = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TRange::write (::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TRange");
xfer += oprot->writeFieldBegin (
"start", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->start.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"stop", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->stop.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startKeyInclusive", ::apache::thrift::protocol::T_BOOL, 3);
xfer += oprot->writeBool (this->startKeyInclusive);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"stopKeyInclusive", ::apache::thrift::protocol::T_BOOL, 4);
xfer += oprot->writeBool (this->stopKeyInclusive);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"infiniteStartKey", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool (this->infiniteStartKey);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"infiniteStopKey", ::apache::thrift::protocol::T_BOOL, 6);
xfer += oprot->writeBool (this->infiniteStopKey);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TRange &a, TRange &b)
{
using ::std::swap;
swap (a.start, b.start);
swap (a.stop, b.stop);
swap (a.startKeyInclusive, b.startKeyInclusive);
swap (a.stopKeyInclusive, b.stopKeyInclusive);
swap (a.infiniteStartKey, b.infiniteStartKey);
swap (a.infiniteStopKey, b.infiniteStopKey);
swap (a.__isset, b.__isset);
}
TRange::TRange (const TRange& other24)
{
start = other24.start;
stop = other24.stop;
startKeyInclusive = other24.startKeyInclusive;
stopKeyInclusive = other24.stopKeyInclusive;
infiniteStartKey = other24.infiniteStartKey;
infiniteStopKey = other24.infiniteStopKey;
__isset = other24.__isset;
}
TRange&
TRange::operator= (const TRange& other25)
{
start = other25.start;
stop = other25.stop;
startKeyInclusive = other25.startKeyInclusive;
stopKeyInclusive = other25.stopKeyInclusive;
infiniteStartKey = other25.infiniteStartKey;
infiniteStopKey = other25.infiniteStopKey;
__isset = other25.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TRange& obj)
{
using ::apache::thrift::to_string;
out << "TRange(";
out << "start=" << to_string (obj.start);
out << ", " << "stop=" << to_string (obj.stop);
out << ", " << "startKeyInclusive="
<< to_string (obj.startKeyInclusive);
out << ", " << "stopKeyInclusive="
<< to_string (obj.stopKeyInclusive);
out << ", " << "infiniteStartKey="
<< to_string (obj.infiniteStartKey);
out << ", " << "infiniteStopKey="
<< to_string (obj.infiniteStopKey);
out << ")";
return out;
}
MultiScanResult::~MultiScanResult () throw ()
{
}
void
MultiScanResult::__set_results (const std::vector<TKeyValue> & val)
{
this->results = val;
}
void
MultiScanResult::__set_failures (const ScanBatch& val)
{
this->failures = val;
}
void
MultiScanResult::__set_fullScans (
const std::vector<TKeyExtent> & val)
{
this->fullScans = val;
}
void
MultiScanResult::__set_partScan (const TKeyExtent& val)
{
this->partScan = val;
}
void
MultiScanResult::__set_partNextKey (const TKey& val)
{
this->partNextKey = val;
}
void
MultiScanResult::__set_partNextKeyInclusive (const bool val)
{
this->partNextKeyInclusive = val;
}
void
MultiScanResult::__set_more (const bool val)
{
this->more = val;
}
const char* MultiScanResult::ascii_fingerprint =
"1710A2EAC368D6E92A3F98939AD49DAF";
const uint8_t MultiScanResult::binary_fingerprint[16] =
{ 0x17, 0x10, 0xA2, 0xEA, 0xC3, 0x68, 0xD6, 0xE9, 0x2A, 0x3F,
0x98, 0x93, 0x9A, 0xD4, 0x9D, 0xAF };
uint32_t
MultiScanResult::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->results.clear ();
uint32_t _size26;
::apache::thrift::protocol::TType _etype29;
xfer += iprot->readListBegin (_etype29, _size26);
this->results.resize (_size26);
uint32_t _i30;
for (_i30 = 0; _i30 < _size26; ++_i30)
{
xfer += this->results[_i30].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.results = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->failures.clear ();
uint32_t _size31;
::apache::thrift::protocol::TType _ktype32;
::apache::thrift::protocol::TType _vtype33;
xfer += iprot->readMapBegin (_ktype32, _vtype33,
_size31);
uint32_t _i35;
for (_i35 = 0; _i35 < _size31; ++_i35)
{
TKeyExtent _key36;
xfer += _key36.read (iprot);
std::vector<TRange> & _val37 =
this->failures[_key36];
{
_val37.clear ();
uint32_t _size38;
::apache::thrift::protocol::TType _etype41;
xfer += iprot->readListBegin (_etype41,
_size38);
_val37.resize (_size38);
uint32_t _i42;
for (_i42 = 0; _i42 < _size38; ++_i42)
{
xfer += _val37[_i42].read (iprot);
}
xfer += iprot->readListEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.failures = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->fullScans.clear ();
uint32_t _size43;
::apache::thrift::protocol::TType _etype46;
xfer += iprot->readListBegin (_etype46, _size43);
this->fullScans.resize (_size43);
uint32_t _i47;
for (_i47 = 0; _i47 < _size43; ++_i47)
{
xfer += this->fullScans[_i47].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.fullScans = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->partScan.read (iprot);
this->__isset.partScan = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->partNextKey.read (iprot);
this->__isset.partNextKey = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->partNextKeyInclusive);
this->__isset.partNextKeyInclusive = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->more);
this->__isset.more = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MultiScanResult::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("MultiScanResult");
xfer += oprot->writeFieldBegin (
"results", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->results.size ()));
std::vector<TKeyValue>::const_iterator _iter48;
for (_iter48 = this->results.begin ();
_iter48 != this->results.end (); ++_iter48)
{
xfer += (*_iter48).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("failures",
::apache::thrift::protocol::T_MAP,
2);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_LIST,
static_cast<uint32_t> (this->failures.size ()));
std::map<TKeyExtent, std::vector<TRange> >::const_iterator _iter49;
for (_iter49 = this->failures.begin ();
_iter49 != this->failures.end (); ++_iter49)
{
xfer += _iter49->first.write (oprot);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter49->second.size ()));
std::vector<TRange>::const_iterator _iter50;
for (_iter50 = _iter49->second.begin ();
_iter50 != _iter49->second.end (); ++_iter50)
{
xfer += (*_iter50).write (oprot);
}
xfer += oprot->writeListEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"fullScans", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->fullScans.size ()));
std::vector<TKeyExtent>::const_iterator _iter51;
for (_iter51 = this->fullScans.begin ();
_iter51 != this->fullScans.end (); ++_iter51)
{
xfer += (*_iter51).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"partScan", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->partScan.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"partNextKey", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->partNextKey.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"partNextKeyInclusive", ::apache::thrift::protocol::T_BOOL,
6);
xfer += oprot->writeBool (this->partNextKeyInclusive);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"more", ::apache::thrift::protocol::T_BOOL, 7);
xfer += oprot->writeBool (this->more);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (MultiScanResult &a, MultiScanResult &b)
{
using ::std::swap;
swap (a.results, b.results);
swap (a.failures, b.failures);
swap (a.fullScans, b.fullScans);
swap (a.partScan, b.partScan);
swap (a.partNextKey, b.partNextKey);
swap (a.partNextKeyInclusive, b.partNextKeyInclusive);
swap (a.more, b.more);
swap (a.__isset, b.__isset);
}
MultiScanResult::MultiScanResult (const MultiScanResult& other52)
{
results = other52.results;
failures = other52.failures;
fullScans = other52.fullScans;
partScan = other52.partScan;
partNextKey = other52.partNextKey;
partNextKeyInclusive = other52.partNextKeyInclusive;
more = other52.more;
__isset = other52.__isset;
}
MultiScanResult&
MultiScanResult::operator= (const MultiScanResult& other53)
{
results = other53.results;
failures = other53.failures;
fullScans = other53.fullScans;
partScan = other53.partScan;
partNextKey = other53.partNextKey;
partNextKeyInclusive = other53.partNextKeyInclusive;
more = other53.more;
__isset = other53.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const MultiScanResult& obj)
{
using ::apache::thrift::to_string;
out << "MultiScanResult(";
out << "results=" << to_string (obj.results);
out << ", " << "failures=" << to_string (obj.failures);
out << ", " << "fullScans=" << to_string (obj.fullScans);
out << ", " << "partScan=" << to_string (obj.partScan);
out << ", " << "partNextKey=" << to_string (obj.partNextKey);
out << ", " << "partNextKeyInclusive="
<< to_string (obj.partNextKeyInclusive);
out << ", " << "more=" << to_string (obj.more);
out << ")";
return out;
}
InitialScan::~InitialScan () throw ()
{
}
void
InitialScan::__set_scanID (const ScanID val)
{
this->scanID = val;
}
void
InitialScan::__set_result (const ScanResult& val)
{
this->result = val;
}
const char* InitialScan::ascii_fingerprint =
"18AE44780236DD1CAB1037C71440C057";
const uint8_t InitialScan::binary_fingerprint[16] =
{ 0x18, 0xAE, 0x44, 0x78, 0x02, 0x36, 0xDD, 0x1C, 0xAB, 0x10,
0x37, 0xC7, 0x14, 0x40, 0xC0, 0x57 };
uint32_t
InitialScan::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanID);
this->__isset.scanID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->result.read (iprot);
this->__isset.result = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
InitialScan::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("InitialScan");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->scanID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"result", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->result.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (InitialScan &a, InitialScan &b)
{
using ::std::swap;
swap (a.scanID, b.scanID);
swap (a.result, b.result);
swap (a.__isset, b.__isset);
}
InitialScan::InitialScan (const InitialScan& other54)
{
scanID = other54.scanID;
result = other54.result;
__isset = other54.__isset;
}
InitialScan&
InitialScan::operator= (const InitialScan& other55)
{
scanID = other55.scanID;
result = other55.result;
__isset = other55.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const InitialScan& obj)
{
using ::apache::thrift::to_string;
out << "InitialScan(";
out << "scanID=" << to_string (obj.scanID);
out << ", " << "result=" << to_string (obj.result);
out << ")";
return out;
}
InitialMultiScan::~InitialMultiScan () throw ()
{
}
void
InitialMultiScan::__set_scanID (const ScanID val)
{
this->scanID = val;
}
void
InitialMultiScan::__set_result (const MultiScanResult& val)
{
this->result = val;
}
const char* InitialMultiScan::ascii_fingerprint =
"3D143740F405DA8C33D95336FD4CFC33";
const uint8_t InitialMultiScan::binary_fingerprint[16] =
{ 0x3D, 0x14, 0x37, 0x40, 0xF4, 0x05, 0xDA, 0x8C, 0x33, 0xD9,
0x53, 0x36, 0xFD, 0x4C, 0xFC, 0x33 };
uint32_t
InitialMultiScan::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanID);
this->__isset.scanID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->result.read (iprot);
this->__isset.result = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
InitialMultiScan::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("InitialMultiScan");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->scanID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"result", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->result.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (InitialMultiScan &a, InitialMultiScan &b)
{
using ::std::swap;
swap (a.scanID, b.scanID);
swap (a.result, b.result);
swap (a.__isset, b.__isset);
}
InitialMultiScan::InitialMultiScan (const InitialMultiScan& other56)
{
scanID = other56.scanID;
result = other56.result;
__isset = other56.__isset;
}
InitialMultiScan&
InitialMultiScan::operator= (const InitialMultiScan& other57)
{
scanID = other57.scanID;
result = other57.result;
__isset = other57.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const InitialMultiScan& obj)
{
using ::apache::thrift::to_string;
out << "InitialMultiScan(";
out << "scanID=" << to_string (obj.scanID);
out << ", " << "result=" << to_string (obj.result);
out << ")";
return out;
}
IterInfo::~IterInfo () throw ()
{
}
void
IterInfo::__set_priority (const int32_t val)
{
this->priority = val;
}
void
IterInfo::__set_className (const std::string& val)
{
this->className = val;
}
void
IterInfo::__set_iterName (const std::string& val)
{
this->iterName = val;
}
const char* IterInfo::ascii_fingerprint =
"3368C2F81F2FEF71F11EDACDB2A3ECEF";
const uint8_t IterInfo::binary_fingerprint[16] =
{ 0x33, 0x68, 0xC2, 0xF8, 0x1F, 0x2F, 0xEF, 0x71, 0xF1, 0x1E,
0xDA, 0xCD, 0xB2, 0xA3, 0xEC, 0xEF };
uint32_t
IterInfo::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->priority);
this->__isset.priority = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->className);
this->__isset.className = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->iterName);
this->__isset.iterName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
IterInfo::write (::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("IterInfo");
xfer += oprot->writeFieldBegin ("priority",
::apache::thrift::protocol::T_I32,
1);
xfer += oprot->writeI32 (this->priority);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->className);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"iterName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->iterName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (IterInfo &a, IterInfo &b)
{
using ::std::swap;
swap (a.priority, b.priority);
swap (a.className, b.className);
swap (a.iterName, b.iterName);
swap (a.__isset, b.__isset);
}
IterInfo::IterInfo (const IterInfo& other58)
{
priority = other58.priority;
className = other58.className;
iterName = other58.iterName;
__isset = other58.__isset;
}
IterInfo&
IterInfo::operator= (const IterInfo& other59)
{
priority = other59.priority;
className = other59.className;
iterName = other59.iterName;
__isset = other59.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const IterInfo& obj)
{
using ::apache::thrift::to_string;
out << "IterInfo(";
out << "priority=" << to_string (obj.priority);
out << ", " << "className=" << to_string (obj.className);
out << ", " << "iterName=" << to_string (obj.iterName);
out << ")";
return out;
}
TConstraintViolationSummary::~TConstraintViolationSummary () throw ()
{
}
void
TConstraintViolationSummary::__set_constrainClass (
const std::string& val)
{
this->constrainClass = val;
}
void
TConstraintViolationSummary::__set_violationCode (const int16_t val)
{
this->violationCode = val;
}
void
TConstraintViolationSummary::__set_violationDescription (
const std::string& val)
{
this->violationDescription = val;
}
void
TConstraintViolationSummary::__set_numberOfViolatingMutations (
const int64_t val)
{
this->numberOfViolatingMutations = val;
}
const char* TConstraintViolationSummary::ascii_fingerprint =
"67DCD7E9C756B859BA6A7E138EFB1053";
const uint8_t TConstraintViolationSummary::binary_fingerprint[16] =
{ 0x67, 0xDC, 0xD7, 0xE9, 0xC7, 0x56, 0xB8, 0x59, 0xBA, 0x6A,
0x7E, 0x13, 0x8E, 0xFB, 0x10, 0x53 };
uint32_t
TConstraintViolationSummary::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->constrainClass);
this->__isset.constrainClass = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I16)
{
xfer += iprot->readI16 (this->violationCode);
this->__isset.violationCode = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (
this->violationDescription);
this->__isset.violationDescription = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (
this->numberOfViolatingMutations);
this->__isset.numberOfViolatingMutations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TConstraintViolationSummary::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TConstraintViolationSummary");
xfer += oprot->writeFieldBegin (
"constrainClass", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->constrainClass);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("violationCode",
::apache::thrift::protocol::T_I16,
2);
xfer += oprot->writeI16 (this->violationCode);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"violationDescription", ::apache::thrift::protocol::T_STRING,
3);
xfer += oprot->writeString (this->violationDescription);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("numberOfViolatingMutations",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 (this->numberOfViolatingMutations);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TConstraintViolationSummary &a,
TConstraintViolationSummary &b)
{
using ::std::swap;
swap (a.constrainClass, b.constrainClass);
swap (a.violationCode, b.violationCode);
swap (a.violationDescription, b.violationDescription);
swap (a.numberOfViolatingMutations, b.numberOfViolatingMutations);
swap (a.__isset, b.__isset);
}
TConstraintViolationSummary::TConstraintViolationSummary (
const TConstraintViolationSummary& other60)
{
constrainClass = other60.constrainClass;
violationCode = other60.violationCode;
violationDescription = other60.violationDescription;
numberOfViolatingMutations = other60.numberOfViolatingMutations;
__isset = other60.__isset;
}
TConstraintViolationSummary&
TConstraintViolationSummary::operator= (
const TConstraintViolationSummary& other61)
{
constrainClass = other61.constrainClass;
violationCode = other61.violationCode;
violationDescription = other61.violationDescription;
numberOfViolatingMutations = other61.numberOfViolatingMutations;
__isset = other61.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out,
const TConstraintViolationSummary& obj)
{
using ::apache::thrift::to_string;
out << "TConstraintViolationSummary(";
out << "constrainClass=" << to_string (obj.constrainClass);
out << ", " << "violationCode=" << to_string (obj.violationCode);
out << ", " << "violationDescription="
<< to_string (obj.violationDescription);
out << ", " << "numberOfViolatingMutations="
<< to_string (obj.numberOfViolatingMutations);
out << ")";
return out;
}
UpdateErrors::~UpdateErrors () throw ()
{
}
void
UpdateErrors::__set_failedExtents (
const std::map<TKeyExtent, int64_t> & val)
{
this->failedExtents = val;
}
void
UpdateErrors::__set_violationSummaries (
const std::vector<TConstraintViolationSummary> & val)
{
this->violationSummaries = val;
}
void
UpdateErrors::__set_authorizationFailures (
const std::map<TKeyExtent,
::org::apache::accumulo::core::client::impl::thrift::SecurityErrorCode::type> & val)
{
this->authorizationFailures = val;
}
const char* UpdateErrors::ascii_fingerprint =
"795EFE92A2DF5316A5DED38CBC5BFB32";
const uint8_t UpdateErrors::binary_fingerprint[16] =
{ 0x79, 0x5E, 0xFE, 0x92, 0xA2, 0xDF, 0x53, 0x16, 0xA5, 0xDE,
0xD3, 0x8C, 0xBC, 0x5B, 0xFB, 0x32 };
uint32_t
UpdateErrors::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->failedExtents.clear ();
uint32_t _size62;
::apache::thrift::protocol::TType _ktype63;
::apache::thrift::protocol::TType _vtype64;
xfer += iprot->readMapBegin (_ktype63, _vtype64,
_size62);
uint32_t _i66;
for (_i66 = 0; _i66 < _size62; ++_i66)
{
TKeyExtent _key67;
xfer += _key67.read (iprot);
int64_t& _val68 = this->failedExtents[_key67];
xfer += iprot->readI64 (_val68);
}
xfer += iprot->readMapEnd ();
}
this->__isset.failedExtents = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->violationSummaries.clear ();
uint32_t _size69;
::apache::thrift::protocol::TType _etype72;
xfer += iprot->readListBegin (_etype72, _size69);
this->violationSummaries.resize (_size69);
uint32_t _i73;
for (_i73 = 0; _i73 < _size69; ++_i73)
{
xfer += this->violationSummaries[_i73].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.violationSummaries = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->authorizationFailures.clear ();
uint32_t _size74;
::apache::thrift::protocol::TType _ktype75;
::apache::thrift::protocol::TType _vtype76;
xfer += iprot->readMapBegin (_ktype75, _vtype76,
_size74);
uint32_t _i78;
for (_i78 = 0; _i78 < _size74; ++_i78)
{
TKeyExtent _key79;
xfer += _key79.read (iprot);
::org::apache::accumulo::core::client::impl::thrift::SecurityErrorCode::type& _val80 =
this->authorizationFailures[_key79];
int32_t ecast81;
xfer += iprot->readI32 (ecast81);
_val80 =
(::org::apache::accumulo::core::client::impl::thrift::SecurityErrorCode::type) ecast81;
}
xfer += iprot->readMapEnd ();
}
this->__isset.authorizationFailures = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
UpdateErrors::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("UpdateErrors");
xfer += oprot->writeFieldBegin ("failedExtents",
::apache::thrift::protocol::T_MAP,
1);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_I64,
static_cast<uint32_t> (this->failedExtents.size ()));
std::map<TKeyExtent, int64_t>::const_iterator _iter82;
for (_iter82 = this->failedExtents.begin ();
_iter82 != this->failedExtents.end (); ++_iter82)
{
xfer += _iter82->first.write (oprot);
xfer += oprot->writeI64 (_iter82->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"violationSummaries", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->violationSummaries.size ()));
std::vector<TConstraintViolationSummary>::const_iterator _iter83;
for (_iter83 = this->violationSummaries.begin ();
_iter83 != this->violationSummaries.end (); ++_iter83)
{
xfer += (*_iter83).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("authorizationFailures",
::apache::thrift::protocol::T_MAP,
3);
{
xfer +=
oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_I32,
static_cast<uint32_t> (this->authorizationFailures.size ()));
std::map<TKeyExtent,
::org::apache::accumulo::core::client::impl::thrift::SecurityErrorCode::type>::const_iterator _iter84;
for (_iter84 = this->authorizationFailures.begin ();
_iter84 != this->authorizationFailures.end (); ++_iter84)
{
xfer += _iter84->first.write (oprot);
xfer += oprot->writeI32 ((int32_t) _iter84->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (UpdateErrors &a, UpdateErrors &b)
{
using ::std::swap;
swap (a.failedExtents, b.failedExtents);
swap (a.violationSummaries, b.violationSummaries);
swap (a.authorizationFailures, b.authorizationFailures);
swap (a.__isset, b.__isset);
}
UpdateErrors::UpdateErrors (const UpdateErrors& other85)
{
failedExtents = other85.failedExtents;
violationSummaries = other85.violationSummaries;
authorizationFailures = other85.authorizationFailures;
__isset = other85.__isset;
}
UpdateErrors&
UpdateErrors::operator= (const UpdateErrors& other86)
{
failedExtents = other86.failedExtents;
violationSummaries = other86.violationSummaries;
authorizationFailures = other86.authorizationFailures;
__isset = other86.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const UpdateErrors& obj)
{
using ::apache::thrift::to_string;
out << "UpdateErrors(";
out << "failedExtents=" << to_string (obj.failedExtents);
out << ", " << "violationSummaries="
<< to_string (obj.violationSummaries);
out << ", " << "authorizationFailures="
<< to_string (obj.authorizationFailures);
out << ")";
return out;
}
TCMResult::~TCMResult () throw ()
{
}
void
TCMResult::__set_cmid (const int64_t val)
{
this->cmid = val;
}
void
TCMResult::__set_status (const TCMStatus::type val)
{
this->status = val;
}
const char* TCMResult::ascii_fingerprint =
"DFA40D9D2884599F3D1E7A57578F1384";
const uint8_t TCMResult::binary_fingerprint[16] =
{ 0xDF, 0xA4, 0x0D, 0x9D, 0x28, 0x84, 0x59, 0x9F, 0x3D, 0x1E,
0x7A, 0x57, 0x57, 0x8F, 0x13, 0x84 };
uint32_t
TCMResult::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->cmid);
this->__isset.cmid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast87;
xfer += iprot->readI32 (ecast87);
this->status = (TCMStatus::type) ecast87;
this->__isset.status = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TCMResult::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TCMResult");
xfer += oprot->writeFieldBegin ("cmid",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->cmid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("status",
::apache::thrift::protocol::T_I32,
2);
xfer += oprot->writeI32 ((int32_t) this->status);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TCMResult &a, TCMResult &b)
{
using ::std::swap;
swap (a.cmid, b.cmid);
swap (a.status, b.status);
swap (a.__isset, b.__isset);
}
TCMResult::TCMResult (const TCMResult& other88)
{
cmid = other88.cmid;
status = other88.status;
__isset = other88.__isset;
}
TCMResult&
TCMResult::operator= (const TCMResult& other89)
{
cmid = other89.cmid;
status = other89.status;
__isset = other89.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TCMResult& obj)
{
using ::apache::thrift::to_string;
out << "TCMResult(";
out << "cmid=" << to_string (obj.cmid);
out << ", " << "status=" << to_string (obj.status);
out << ")";
return out;
}
MapFileInfo::~MapFileInfo () throw ()
{
}
void
MapFileInfo::__set_estimatedSize (const int64_t val)
{
this->estimatedSize = val;
}
const char* MapFileInfo::ascii_fingerprint =
"56A59CE7FFAF82BCA8A19FAACDE4FB75";
const uint8_t MapFileInfo::binary_fingerprint[16] =
{ 0x56, 0xA5, 0x9C, 0xE7, 0xFF, 0xAF, 0x82, 0xBC, 0xA8, 0xA1,
0x9F, 0xAA, 0xCD, 0xE4, 0xFB, 0x75 };
uint32_t
MapFileInfo::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->estimatedSize);
this->__isset.estimatedSize = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MapFileInfo::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("MapFileInfo");
xfer += oprot->writeFieldBegin ("estimatedSize",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->estimatedSize);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (MapFileInfo &a, MapFileInfo &b)
{
using ::std::swap;
swap (a.estimatedSize, b.estimatedSize);
swap (a.__isset, b.__isset);
}
MapFileInfo::MapFileInfo (const MapFileInfo& other90)
{
estimatedSize = other90.estimatedSize;
__isset = other90.__isset;
}
MapFileInfo&
MapFileInfo::operator= (const MapFileInfo& other91)
{
estimatedSize = other91.estimatedSize;
__isset = other91.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const MapFileInfo& obj)
{
using ::apache::thrift::to_string;
out << "MapFileInfo(";
out << "estimatedSize=" << to_string (obj.estimatedSize);
out << ")";
return out;
}
TCondition::~TCondition () throw ()
{
}
void
TCondition::__set_cf (const std::string& val)
{
this->cf = val;
}
void
TCondition::__set_cq (const std::string& val)
{
this->cq = val;
}
void
TCondition::__set_cv (const std::string& val)
{
this->cv = val;
}
void
TCondition::__set_ts (const int64_t val)
{
this->ts = val;
}
void
TCondition::__set_hasTimestamp (const bool val)
{
this->hasTimestamp = val;
}
void
TCondition::__set_val (const std::string& val)
{
this->val = val;
}
void
TCondition::__set_iterators (const std::string& val)
{
this->iterators = val;
}
const char* TCondition::ascii_fingerprint =
"7C10ECB52A73C8207C0290A240145B89";
const uint8_t TCondition::binary_fingerprint[16] =
{ 0x7C, 0x10, 0xEC, 0xB5, 0x2A, 0x73, 0xC8, 0x20, 0x7C, 0x02,
0x90, 0xA2, 0x40, 0x14, 0x5B, 0x89 };
uint32_t
TCondition::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->cf);
this->__isset.cf = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->cq);
this->__isset.cq = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->cv);
this->__isset.cv = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->ts);
this->__isset.ts = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->hasTimestamp);
this->__isset.hasTimestamp = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->val);
this->__isset.val = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->iterators);
this->__isset.iterators = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TCondition::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TCondition");
xfer += oprot->writeFieldBegin (
"cf", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary (this->cf);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"cq", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeBinary (this->cq);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"cv", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->cv);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ts",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 (this->ts);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"hasTimestamp", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool (this->hasTimestamp);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"val", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary (this->val);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"iterators", ::apache::thrift::protocol::T_STRING, 7);
xfer += oprot->writeBinary (this->iterators);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TCondition &a, TCondition &b)
{
using ::std::swap;
swap (a.cf, b.cf);
swap (a.cq, b.cq);
swap (a.cv, b.cv);
swap (a.ts, b.ts);
swap (a.hasTimestamp, b.hasTimestamp);
swap (a.val, b.val);
swap (a.iterators, b.iterators);
swap (a.__isset, b.__isset);
}
TCondition::TCondition (const TCondition& other92)
{
cf = other92.cf;
cq = other92.cq;
cv = other92.cv;
ts = other92.ts;
hasTimestamp = other92.hasTimestamp;
val = other92.val;
iterators = other92.iterators;
__isset = other92.__isset;
}
TCondition&
TCondition::operator= (const TCondition& other93)
{
cf = other93.cf;
cq = other93.cq;
cv = other93.cv;
ts = other93.ts;
hasTimestamp = other93.hasTimestamp;
val = other93.val;
iterators = other93.iterators;
__isset = other93.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TCondition& obj)
{
using ::apache::thrift::to_string;
out << "TCondition(";
out << "cf=" << to_string (obj.cf);
out << ", " << "cq=" << to_string (obj.cq);
out << ", " << "cv=" << to_string (obj.cv);
out << ", " << "ts=" << to_string (obj.ts);
out << ", " << "hasTimestamp=" << to_string (obj.hasTimestamp);
out << ", " << "val=" << to_string (obj.val);
out << ", " << "iterators=" << to_string (obj.iterators);
out << ")";
return out;
}
TConditionalMutation::~TConditionalMutation () throw ()
{
}
void
TConditionalMutation::__set_conditions (
const std::vector<TCondition> & val)
{
this->conditions = val;
}
void
TConditionalMutation::__set_mutation (const TMutation& val)
{
this->mutation = val;
}
void
TConditionalMutation::__set_id (const int64_t val)
{
this->id = val;
}
const char* TConditionalMutation::ascii_fingerprint =
"ECCD956F0F2184F4DDCCA904328BB05C";
const uint8_t TConditionalMutation::binary_fingerprint[16] =
{ 0xEC, 0xCD, 0x95, 0x6F, 0x0F, 0x21, 0x84, 0xF4, 0xDD, 0xCC,
0xA9, 0x04, 0x32, 0x8B, 0xB0, 0x5C };
uint32_t
TConditionalMutation::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->conditions.clear ();
uint32_t _size94;
::apache::thrift::protocol::TType _etype97;
xfer += iprot->readListBegin (_etype97, _size94);
this->conditions.resize (_size94);
uint32_t _i98;
for (_i98 = 0; _i98 < _size94; ++_i98)
{
xfer += this->conditions[_i98].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.conditions = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->mutation.read (iprot);
this->__isset.mutation = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->id);
this->__isset.id = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TConditionalMutation::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TConditionalMutation");
xfer += oprot->writeFieldBegin (
"conditions", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->conditions.size ()));
std::vector<TCondition>::const_iterator _iter99;
for (_iter99 = this->conditions.begin ();
_iter99 != this->conditions.end (); ++_iter99)
{
xfer += (*_iter99).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"mutation", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->mutation.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("id",
::apache::thrift::protocol::T_I64,
3);
xfer += oprot->writeI64 (this->id);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TConditionalMutation &a, TConditionalMutation &b)
{
using ::std::swap;
swap (a.conditions, b.conditions);
swap (a.mutation, b.mutation);
swap (a.id, b.id);
swap (a.__isset, b.__isset);
}
TConditionalMutation::TConditionalMutation (
const TConditionalMutation& other100)
{
conditions = other100.conditions;
mutation = other100.mutation;
id = other100.id;
__isset = other100.__isset;
}
TConditionalMutation&
TConditionalMutation::operator= (
const TConditionalMutation& other101)
{
conditions = other101.conditions;
mutation = other101.mutation;
id = other101.id;
__isset = other101.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TConditionalMutation& obj)
{
using ::apache::thrift::to_string;
out << "TConditionalMutation(";
out << "conditions=" << to_string (obj.conditions);
out << ", " << "mutation=" << to_string (obj.mutation);
out << ", " << "id=" << to_string (obj.id);
out << ")";
return out;
}
TConditionalSession::~TConditionalSession () throw ()
{
}
void
TConditionalSession::__set_sessionId (const int64_t val)
{
this->sessionId = val;
}
void
TConditionalSession::__set_tserverLock (const std::string& val)
{
this->tserverLock = val;
}
void
TConditionalSession::__set_ttl (const int64_t val)
{
this->ttl = val;
}
const char* TConditionalSession::ascii_fingerprint =
"FEBAC9C9DD701ABE5222D0CA33FDA432";
const uint8_t TConditionalSession::binary_fingerprint[16] =
{ 0xFE, 0xBA, 0xC9, 0xC9, 0xDD, 0x70, 0x1A, 0xBE, 0x52, 0x22,
0xD0, 0xCA, 0x33, 0xFD, 0xA4, 0x32 };
uint32_t
TConditionalSession::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->sessionId);
this->__isset.sessionId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tserverLock);
this->__isset.tserverLock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->ttl);
this->__isset.ttl = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TConditionalSession::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TConditionalSession");
xfer += oprot->writeFieldBegin ("sessionId",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->sessionId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tserverLock", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tserverLock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ttl",
::apache::thrift::protocol::T_I64,
3);
xfer += oprot->writeI64 (this->ttl);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TConditionalSession &a, TConditionalSession &b)
{
using ::std::swap;
swap (a.sessionId, b.sessionId);
swap (a.tserverLock, b.tserverLock);
swap (a.ttl, b.ttl);
swap (a.__isset, b.__isset);
}
TConditionalSession::TConditionalSession (
const TConditionalSession& other102)
{
sessionId = other102.sessionId;
tserverLock = other102.tserverLock;
ttl = other102.ttl;
__isset = other102.__isset;
}
TConditionalSession&
TConditionalSession::operator= (const TConditionalSession& other103)
{
sessionId = other103.sessionId;
tserverLock = other103.tserverLock;
ttl = other103.ttl;
__isset = other103.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TConditionalSession& obj)
{
using ::apache::thrift::to_string;
out << "TConditionalSession(";
out << "sessionId=" << to_string (obj.sessionId);
out << ", " << "tserverLock=" << to_string (obj.tserverLock);
out << ", " << "ttl=" << to_string (obj.ttl);
out << ")";
return out;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#include <iostream>
#include <sstream>
#include <assert.h>
using namespace std;
#include "../include/data/constructs/KeyValue.h"
#include "../include/data/constructs/security/Authorizations.h"
#include "../include/scanner/constructs/Results.h"
#include "../include/scanner/impl/Scanner.h"
#include "../include/data/constructs/client/zookeeperinstance.h"
#include "../include/interconnect/Master.h"
#include "../include/interconnect/tableOps/TableOperations.h"
#include "../include/data/constructs/rfile/RFile.h"
#include "../include/data/constructs/compressor/compressor.h"
#include "../include/data/constructs/compressor/zlibCompressor.h"
#include "../include/data/streaming/HdfsStream.h"
#define BOOST_IOSTREAMS_NO_LIB 1
using namespace cclient::data;
using namespace cclient::data::compression;
using namespace cclient::data::zookeeper;
using namespace cclient::data::streams;
using namespace interconnect;
using namespace scanners;
using namespace boost::iostreams;
bool
keyCompare (KeyValue* a, KeyValue* b)
{
return *(a->getKey ()) < *(b->getKey ());
}
int
main (int argc, char **argv)
{
struct hdfsBuilder *builder = hdfsNewBuilder ();
if (argc < 6) {
cout << "Arguments required: ./TableOps"
<< " <instance name> <zks> <user> <password>"
<< " <table>" << endl;
exit (1);
}
string table = argv[5];
std::shared_ptr<Configuration> conf(new Configuration());
conf->set ("FILE_SYSTEM_ROOT", "/accumulo");
ZookeeperInstance *instance = new ZookeeperInstance (argv[1], argv[2], 1000,
conf);
AuthInfo creds (argv[3], argv[4], instance->getInstanceId ());
interconnect::MasterConnect *master = new MasterConnect (&creds, instance);
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *ops = master->tableOps (
table);
// create the table. no harm/no foul if it exists
cout << "Checking if " << table << " exists." << endl;
if (!ops->exists ()) {
cout << "It does, so I am creating it." << endl;
ops->create ();
} else {
cout << table << " already exists, not creating it" << endl;
}
cout << "Compacting table " << endl;
((AccumuloTableOperations*)ops)->compact("a","z",false);
NamespaceOperations *nameOps = master->namespaceOps();
for(auto nm : nameOps->list())
{
cout << "found namespace " << nm << endl;
}
nameOps->create("testing");
nameOps->rename("blahblah","testing");
for(auto nm : nameOps->list())
{
assert(nm != "testing");
}
nameOps->remove("blahblah");
delete ops;
hdfsFreeBuilder(builder);
return 0;
}
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/TabletClientService.h"
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace tabletserver
{
namespace thrift
{
TabletClientService_startScan_args::~TabletClientService_startScan_args () throw ()
{
}
uint32_t
TabletClientService_startScan_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 11:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->range.read (iprot);
this->__isset.range = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->columns.clear ();
uint32_t _size106;
::apache::thrift::protocol::TType _etype109;
xfer += iprot->readListBegin (_etype109,
_size106);
this->columns.resize (_size106);
uint32_t _i110;
for (_i110 = 0; _i110 < _size106; ++_i110)
{
xfer += this->columns[_i110].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.columns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->batchSize);
this->__isset.batchSize = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->ssiList.clear ();
uint32_t _size111;
::apache::thrift::protocol::TType _etype114;
xfer += iprot->readListBegin (_etype114,
_size111);
this->ssiList.resize (_size111);
uint32_t _i115;
for (_i115 = 0; _i115 < _size111; ++_i115)
{
xfer += this->ssiList[_i115].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.ssiList = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->ssio.clear ();
uint32_t _size116;
::apache::thrift::protocol::TType _ktype117;
::apache::thrift::protocol::TType _vtype118;
xfer += iprot->readMapBegin (_ktype117, _vtype118,
_size116);
uint32_t _i120;
for (_i120 = 0; _i120 < _size116; ++_i120)
{
std::string _key121;
xfer += iprot->readString (_key121);
std::map<std::string, std::string> & _val122 =
this->ssio[_key121];
{
_val122.clear ();
uint32_t _size123;
::apache::thrift::protocol::TType _ktype124;
::apache::thrift::protocol::TType _vtype125;
xfer += iprot->readMapBegin (_ktype124,
_vtype125,
_size123);
uint32_t _i127;
for (_i127 = 0; _i127 < _size123; ++_i127)
{
std::string _key128;
xfer += iprot->readString (_key128);
std::string& _val129 =
_val122[_key128];
xfer += iprot->readString (_val129);
}
xfer += iprot->readMapEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.ssio = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->authorizations.clear ();
uint32_t _size130;
::apache::thrift::protocol::TType _etype133;
xfer += iprot->readListBegin (_etype133,
_size130);
this->authorizations.resize (_size130);
uint32_t _i134;
for (_i134 = 0; _i134 < _size130; ++_i134)
{
xfer += iprot->readBinary (
this->authorizations[_i134]);
}
xfer += iprot->readListEnd ();
}
this->__isset.authorizations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->waitForWrites);
this->__isset.waitForWrites = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->isolated);
this->__isset.isolated = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 12:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->readaheadThreshold);
this->__isset.readaheadThreshold = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startScan_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startScan_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"range", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->range.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"columns", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->columns.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TColumn>::const_iterator _iter135;
for (_iter135 = this->columns.begin ();
_iter135 != this->columns.end (); ++_iter135)
{
xfer += (*_iter135).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("batchSize",
::apache::thrift::protocol::T_I32,
5);
xfer += oprot->writeI32 (this->batchSize);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ssiList", ::apache::thrift::protocol::T_LIST, 6);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->ssiList.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo>::const_iterator _iter136;
for (_iter136 = this->ssiList.begin ();
_iter136 != this->ssiList.end (); ++_iter136)
{
xfer += (*_iter136).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ssio",
::apache::thrift::protocol::T_MAP,
7);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> (this->ssio.size ()));
std::map<std::string, std::map<std::string, std::string> >::const_iterator _iter137;
for (_iter137 = this->ssio.begin ();
_iter137 != this->ssio.end (); ++_iter137)
{
xfer += oprot->writeString (_iter137->first);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (_iter137->second.size ()));
std::map<std::string, std::string>::const_iterator _iter138;
for (_iter138 = _iter137->second.begin ();
_iter138 != _iter137->second.end (); ++_iter138)
{
xfer += oprot->writeString (_iter138->first);
xfer += oprot->writeString (_iter138->second);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 8);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->authorizations.size ()));
std::vector<std::string>::const_iterator _iter139;
for (_iter139 = this->authorizations.begin ();
_iter139 != this->authorizations.end (); ++_iter139)
{
xfer += oprot->writeBinary ((*_iter139));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"waitForWrites", ::apache::thrift::protocol::T_BOOL, 9);
xfer += oprot->writeBool (this->waitForWrites);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"isolated", ::apache::thrift::protocol::T_BOOL, 10);
xfer += oprot->writeBool (this->isolated);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 11);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("readaheadThreshold",
::apache::thrift::protocol::T_I64,
12);
xfer += oprot->writeI64 (this->readaheadThreshold);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startScan_pargs::~TabletClientService_startScan_pargs () throw ()
{
}
uint32_t
TabletClientService_startScan_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startScan_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->extent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"range", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->range)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"columns", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> ((*(this->columns)).size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TColumn>::const_iterator _iter140;
for (_iter140 = (*(this->columns)).begin ();
_iter140 != (*(this->columns)).end (); ++_iter140)
{
xfer += (*_iter140).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("batchSize",
::apache::thrift::protocol::T_I32,
5);
xfer += oprot->writeI32 ((*(this->batchSize)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ssiList", ::apache::thrift::protocol::T_LIST, 6);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> ((*(this->ssiList)).size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo>::const_iterator _iter141;
for (_iter141 = (*(this->ssiList)).begin ();
_iter141 != (*(this->ssiList)).end (); ++_iter141)
{
xfer += (*_iter141).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ssio",
::apache::thrift::protocol::T_MAP,
7);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> ((*(this->ssio)).size ()));
std::map<std::string, std::map<std::string, std::string> >::const_iterator _iter142;
for (_iter142 = (*(this->ssio)).begin ();
_iter142 != (*(this->ssio)).end (); ++_iter142)
{
xfer += oprot->writeString (_iter142->first);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (_iter142->second.size ()));
std::map<std::string, std::string>::const_iterator _iter143;
for (_iter143 = _iter142->second.begin ();
_iter143 != _iter142->second.end (); ++_iter143)
{
xfer += oprot->writeString (_iter143->first);
xfer += oprot->writeString (_iter143->second);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 8);
{
xfer +=
oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->authorizations)).size ()));
std::vector<std::string>::const_iterator _iter144;
for (_iter144 = (*(this->authorizations)).begin ();
_iter144 != (*(this->authorizations)).end (); ++_iter144)
{
xfer += oprot->writeBinary ((*_iter144));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"waitForWrites", ::apache::thrift::protocol::T_BOOL, 9);
xfer += oprot->writeBool ((*(this->waitForWrites)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"isolated", ::apache::thrift::protocol::T_BOOL, 10);
xfer += oprot->writeBool ((*(this->isolated)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 11);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("readaheadThreshold",
::apache::thrift::protocol::T_I64,
12);
xfer += oprot->writeI64 ((*(this->readaheadThreshold)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startScan_result::~TabletClientService_startScan_result () throw ()
{
}
uint32_t
TabletClientService_startScan_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tmfe.read (iprot);
this->__isset.tmfe = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startScan_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_startScan_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nste)
{
xfer += oprot->writeFieldBegin (
"nste", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->nste.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tmfe)
{
xfer += oprot->writeFieldBegin (
"tmfe", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tmfe.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_startScan_presult::~TabletClientService_startScan_presult () throw ()
{
}
uint32_t
TabletClientService_startScan_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tmfe.read (iprot);
this->__isset.tmfe = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_continueScan_args::~TabletClientService_continueScan_args () throw ()
{
}
uint32_t
TabletClientService_continueScan_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanID);
this->__isset.scanID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_continueScan_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_continueScan_args");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->scanID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_continueScan_pargs::~TabletClientService_continueScan_pargs () throw ()
{
}
uint32_t
TabletClientService_continueScan_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_continueScan_pargs");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 ((*(this->scanID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_continueScan_result::~TabletClientService_continueScan_result () throw ()
{
}
uint32_t
TabletClientService_continueScan_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tmfe.read (iprot);
this->__isset.tmfe = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_continueScan_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_continueScan_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nssi)
{
xfer += oprot->writeFieldBegin (
"nssi", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->nssi.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nste)
{
xfer += oprot->writeFieldBegin (
"nste", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->nste.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tmfe)
{
xfer += oprot->writeFieldBegin (
"tmfe", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tmfe.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_continueScan_presult::~TabletClientService_continueScan_presult () throw ()
{
}
uint32_t
TabletClientService_continueScan_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tmfe.read (iprot);
this->__isset.tmfe = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_closeScan_args::~TabletClientService_closeScan_args () throw ()
{
}
uint32_t
TabletClientService_closeScan_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanID);
this->__isset.scanID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_closeScan_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeScan_args");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->scanID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeScan_pargs::~TabletClientService_closeScan_pargs () throw ()
{
}
uint32_t
TabletClientService_closeScan_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeScan_pargs");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 ((*(this->scanID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startMultiScan_args::~TabletClientService_startMultiScan_args () throw ()
{
}
uint32_t
TabletClientService_startMultiScan_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 8:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->batch.clear ();
uint32_t _size145;
::apache::thrift::protocol::TType _ktype146;
::apache::thrift::protocol::TType _vtype147;
xfer += iprot->readMapBegin (_ktype146, _vtype147,
_size145);
uint32_t _i149;
for (_i149 = 0; _i149 < _size145; ++_i149)
{
::org::apache::accumulo::core::data::thrift::TKeyExtent _key150;
xfer += _key150.read (iprot);
std::vector<
::org::apache::accumulo::core::data::thrift::TRange> & _val151 =
this->batch[_key150];
{
_val151.clear ();
uint32_t _size152;
::apache::thrift::protocol::TType _etype155;
xfer += iprot->readListBegin (_etype155,
_size152);
_val151.resize (_size152);
uint32_t _i156;
for (_i156 = 0; _i156 < _size152; ++_i156)
{
xfer += _val151[_i156].read (iprot);
}
xfer += iprot->readListEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.batch = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->columns.clear ();
uint32_t _size157;
::apache::thrift::protocol::TType _etype160;
xfer += iprot->readListBegin (_etype160,
_size157);
this->columns.resize (_size157);
uint32_t _i161;
for (_i161 = 0; _i161 < _size157; ++_i161)
{
xfer += this->columns[_i161].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.columns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->ssiList.clear ();
uint32_t _size162;
::apache::thrift::protocol::TType _etype165;
xfer += iprot->readListBegin (_etype165,
_size162);
this->ssiList.resize (_size162);
uint32_t _i166;
for (_i166 = 0; _i166 < _size162; ++_i166)
{
xfer += this->ssiList[_i166].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.ssiList = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->ssio.clear ();
uint32_t _size167;
::apache::thrift::protocol::TType _ktype168;
::apache::thrift::protocol::TType _vtype169;
xfer += iprot->readMapBegin (_ktype168, _vtype169,
_size167);
uint32_t _i171;
for (_i171 = 0; _i171 < _size167; ++_i171)
{
std::string _key172;
xfer += iprot->readString (_key172);
std::map<std::string, std::string> & _val173 =
this->ssio[_key172];
{
_val173.clear ();
uint32_t _size174;
::apache::thrift::protocol::TType _ktype175;
::apache::thrift::protocol::TType _vtype176;
xfer += iprot->readMapBegin (_ktype175,
_vtype176,
_size174);
uint32_t _i178;
for (_i178 = 0; _i178 < _size174; ++_i178)
{
std::string _key179;
xfer += iprot->readString (_key179);
std::string& _val180 =
_val173[_key179];
xfer += iprot->readString (_val180);
}
xfer += iprot->readMapEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.ssio = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->authorizations.clear ();
uint32_t _size181;
::apache::thrift::protocol::TType _etype184;
xfer += iprot->readListBegin (_etype184,
_size181);
this->authorizations.resize (_size181);
uint32_t _i185;
for (_i185 = 0; _i185 < _size181; ++_i185)
{
xfer += iprot->readBinary (
this->authorizations[_i185]);
}
xfer += iprot->readListEnd ();
}
this->__isset.authorizations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->waitForWrites);
this->__isset.waitForWrites = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startMultiScan_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startMultiScan_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("batch",
::apache::thrift::protocol::T_MAP,
2);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_LIST,
static_cast<uint32_t> (this->batch.size ()));
std::map<
::org::apache::accumulo::core::data::thrift::TKeyExtent,
std::vector<
::org::apache::accumulo::core::data::thrift::TRange> >::const_iterator _iter186;
for (_iter186 = this->batch.begin ();
_iter186 != this->batch.end (); ++_iter186)
{
xfer += _iter186->first.write (oprot);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter186->second.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TRange>::const_iterator _iter187;
for (_iter187 = _iter186->second.begin ();
_iter187 != _iter186->second.end (); ++_iter187)
{
xfer += (*_iter187).write (oprot);
}
xfer += oprot->writeListEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"columns", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->columns.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TColumn>::const_iterator _iter188;
for (_iter188 = this->columns.begin ();
_iter188 != this->columns.end (); ++_iter188)
{
xfer += (*_iter188).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ssiList", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->ssiList.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo>::const_iterator _iter189;
for (_iter189 = this->ssiList.begin ();
_iter189 != this->ssiList.end (); ++_iter189)
{
xfer += (*_iter189).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ssio",
::apache::thrift::protocol::T_MAP,
5);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> (this->ssio.size ()));
std::map<std::string, std::map<std::string, std::string> >::const_iterator _iter190;
for (_iter190 = this->ssio.begin ();
_iter190 != this->ssio.end (); ++_iter190)
{
xfer += oprot->writeString (_iter190->first);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (_iter190->second.size ()));
std::map<std::string, std::string>::const_iterator _iter191;
for (_iter191 = _iter190->second.begin ();
_iter191 != _iter190->second.end (); ++_iter191)
{
xfer += oprot->writeString (_iter191->first);
xfer += oprot->writeString (_iter191->second);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 6);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->authorizations.size ()));
std::vector<std::string>::const_iterator _iter192;
for (_iter192 = this->authorizations.begin ();
_iter192 != this->authorizations.end (); ++_iter192)
{
xfer += oprot->writeBinary ((*_iter192));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"waitForWrites", ::apache::thrift::protocol::T_BOOL, 7);
xfer += oprot->writeBool (this->waitForWrites);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 8);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startMultiScan_pargs::~TabletClientService_startMultiScan_pargs () throw ()
{
}
uint32_t
TabletClientService_startMultiScan_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startMultiScan_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("batch",
::apache::thrift::protocol::T_MAP,
2);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_LIST,
static_cast<uint32_t> ((*(this->batch)).size ()));
std::map<
::org::apache::accumulo::core::data::thrift::TKeyExtent,
std::vector<
::org::apache::accumulo::core::data::thrift::TRange> >::const_iterator _iter193;
for (_iter193 = (*(this->batch)).begin ();
_iter193 != (*(this->batch)).end (); ++_iter193)
{
xfer += _iter193->first.write (oprot);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter193->second.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TRange>::const_iterator _iter194;
for (_iter194 = _iter193->second.begin ();
_iter194 != _iter193->second.end (); ++_iter194)
{
xfer += (*_iter194).write (oprot);
}
xfer += oprot->writeListEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"columns", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> ((*(this->columns)).size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TColumn>::const_iterator _iter195;
for (_iter195 = (*(this->columns)).begin ();
_iter195 != (*(this->columns)).end (); ++_iter195)
{
xfer += (*_iter195).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ssiList", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> ((*(this->ssiList)).size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo>::const_iterator _iter196;
for (_iter196 = (*(this->ssiList)).begin ();
_iter196 != (*(this->ssiList)).end (); ++_iter196)
{
xfer += (*_iter196).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ssio",
::apache::thrift::protocol::T_MAP,
5);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> ((*(this->ssio)).size ()));
std::map<std::string, std::map<std::string, std::string> >::const_iterator _iter197;
for (_iter197 = (*(this->ssio)).begin ();
_iter197 != (*(this->ssio)).end (); ++_iter197)
{
xfer += oprot->writeString (_iter197->first);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (_iter197->second.size ()));
std::map<std::string, std::string>::const_iterator _iter198;
for (_iter198 = _iter197->second.begin ();
_iter198 != _iter197->second.end (); ++_iter198)
{
xfer += oprot->writeString (_iter198->first);
xfer += oprot->writeString (_iter198->second);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 6);
{
xfer +=
oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->authorizations)).size ()));
std::vector<std::string>::const_iterator _iter199;
for (_iter199 = (*(this->authorizations)).begin ();
_iter199 != (*(this->authorizations)).end (); ++_iter199)
{
xfer += oprot->writeBinary ((*_iter199));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"waitForWrites", ::apache::thrift::protocol::T_BOOL, 7);
xfer += oprot->writeBool ((*(this->waitForWrites)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 8);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startMultiScan_result::~TabletClientService_startMultiScan_result () throw ()
{
}
uint32_t
TabletClientService_startMultiScan_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startMultiScan_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_startMultiScan_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_startMultiScan_presult::~TabletClientService_startMultiScan_presult () throw ()
{
}
uint32_t
TabletClientService_startMultiScan_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_continueMultiScan_args::~TabletClientService_continueMultiScan_args () throw ()
{
}
uint32_t
TabletClientService_continueMultiScan_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanID);
this->__isset.scanID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_continueMultiScan_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_continueMultiScan_args");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->scanID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_continueMultiScan_pargs::~TabletClientService_continueMultiScan_pargs () throw ()
{
}
uint32_t
TabletClientService_continueMultiScan_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_continueMultiScan_pargs");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 ((*(this->scanID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_continueMultiScan_result::~TabletClientService_continueMultiScan_result () throw ()
{
}
uint32_t
TabletClientService_continueMultiScan_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_continueMultiScan_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_continueMultiScan_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nssi)
{
xfer += oprot->writeFieldBegin (
"nssi", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->nssi.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_continueMultiScan_presult::~TabletClientService_continueMultiScan_presult () throw ()
{
}
uint32_t
TabletClientService_continueMultiScan_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_closeMultiScan_args::~TabletClientService_closeMultiScan_args () throw ()
{
}
uint32_t
TabletClientService_closeMultiScan_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanID);
this->__isset.scanID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_closeMultiScan_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeMultiScan_args");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->scanID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeMultiScan_pargs::~TabletClientService_closeMultiScan_pargs () throw ()
{
}
uint32_t
TabletClientService_closeMultiScan_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeMultiScan_pargs");
xfer += oprot->writeFieldBegin ("scanID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 ((*(this->scanID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeMultiScan_result::~TabletClientService_closeMultiScan_result () throw ()
{
}
uint32_t
TabletClientService_closeMultiScan_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_closeMultiScan_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_closeMultiScan_result");
if (this->__isset.nssi)
{
xfer += oprot->writeFieldBegin (
"nssi", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->nssi.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_closeMultiScan_presult::~TabletClientService_closeMultiScan_presult () throw ()
{
}
uint32_t
TabletClientService_closeMultiScan_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_startUpdate_args::~TabletClientService_startUpdate_args () throw ()
{
}
uint32_t
TabletClientService_startUpdate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startUpdate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startUpdate_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startUpdate_pargs::~TabletClientService_startUpdate_pargs () throw ()
{
}
uint32_t
TabletClientService_startUpdate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startUpdate_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startUpdate_result::~TabletClientService_startUpdate_result () throw ()
{
}
uint32_t
TabletClientService_startUpdate_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startUpdate_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_startUpdate_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_I64, 0);
xfer += oprot->writeI64 (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_startUpdate_presult::~TabletClientService_startUpdate_presult () throw ()
{
}
uint32_t
TabletClientService_startUpdate_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_applyUpdates_args::~TabletClientService_applyUpdates_args () throw ()
{
}
uint32_t
TabletClientService_applyUpdates_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->updateID);
this->__isset.updateID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->keyExtent.read (iprot);
this->__isset.keyExtent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->mutations.clear ();
uint32_t _size200;
::apache::thrift::protocol::TType _etype203;
xfer += iprot->readListBegin (_etype203,
_size200);
this->mutations.resize (_size200);
uint32_t _i204;
for (_i204 = 0; _i204 < _size200; ++_i204)
{
xfer += this->mutations[_i204].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.mutations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_applyUpdates_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_applyUpdates_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("updateID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->updateID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"keyExtent", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->keyExtent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"mutations", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->mutations.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TMutation>::const_iterator _iter205;
for (_iter205 = this->mutations.begin ();
_iter205 != this->mutations.end (); ++_iter205)
{
xfer += (*_iter205).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_applyUpdates_pargs::~TabletClientService_applyUpdates_pargs () throw ()
{
}
uint32_t
TabletClientService_applyUpdates_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_applyUpdates_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("updateID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->updateID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"keyExtent", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->keyExtent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"mutations", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> ((*(this->mutations)).size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TMutation>::const_iterator _iter206;
for (_iter206 = (*(this->mutations)).begin ();
_iter206 != (*(this->mutations)).end (); ++_iter206)
{
xfer += (*_iter206).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeUpdate_args::~TabletClientService_closeUpdate_args () throw ()
{
}
uint32_t
TabletClientService_closeUpdate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->updateID);
this->__isset.updateID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_closeUpdate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeUpdate_args");
xfer += oprot->writeFieldBegin ("updateID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->updateID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeUpdate_pargs::~TabletClientService_closeUpdate_pargs () throw ()
{
}
uint32_t
TabletClientService_closeUpdate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeUpdate_pargs");
xfer += oprot->writeFieldBegin ("updateID",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 ((*(this->updateID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeUpdate_result::~TabletClientService_closeUpdate_result () throw ()
{
}
uint32_t
TabletClientService_closeUpdate_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_closeUpdate_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_closeUpdate_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nssi)
{
xfer += oprot->writeFieldBegin (
"nssi", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->nssi.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_closeUpdate_presult::~TabletClientService_closeUpdate_presult () throw ()
{
}
uint32_t
TabletClientService_closeUpdate_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_update_args::~TabletClientService_update_args () throw ()
{
}
uint32_t
TabletClientService_update_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->keyExtent.read (iprot);
this->__isset.keyExtent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->mutation.read (iprot);
this->__isset.mutation = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_update_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_update_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"keyExtent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->keyExtent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"mutation", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->mutation.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_update_pargs::~TabletClientService_update_pargs () throw ()
{
}
uint32_t
TabletClientService_update_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_update_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"keyExtent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->keyExtent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"mutation", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->mutation)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_update_result::~TabletClientService_update_result () throw ()
{
}
uint32_t
TabletClientService_update_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->cve.read (iprot);
this->__isset.cve = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_update_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_update_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nste)
{
xfer += oprot->writeFieldBegin (
"nste", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->nste.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.cve)
{
xfer += oprot->writeFieldBegin (
"cve", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->cve.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_update_presult::~TabletClientService_update_presult () throw ()
{
}
uint32_t
TabletClientService_update_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->cve.read (iprot);
this->__isset.cve = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_startConditionalUpdate_args::~TabletClientService_startConditionalUpdate_args () throw ()
{
}
uint32_t
TabletClientService_startConditionalUpdate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->authorizations.clear ();
uint32_t _size207;
::apache::thrift::protocol::TType _etype210;
xfer += iprot->readListBegin (_etype210,
_size207);
this->authorizations.resize (_size207);
uint32_t _i211;
for (_i211 = 0; _i211 < _size207; ++_i211)
{
xfer += iprot->readBinary (
this->authorizations[_i211]);
}
xfer += iprot->readListEnd ();
}
this->__isset.authorizations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableID);
this->__isset.tableID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startConditionalUpdate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startConditionalUpdate_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->authorizations.size ()));
std::vector<std::string>::const_iterator _iter212;
for (_iter212 = this->authorizations.begin ();
_iter212 != this->authorizations.end (); ++_iter212)
{
xfer += oprot->writeBinary ((*_iter212));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableID", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->tableID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startConditionalUpdate_pargs::~TabletClientService_startConditionalUpdate_pargs () throw ()
{
}
uint32_t
TabletClientService_startConditionalUpdate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_startConditionalUpdate_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 3);
{
xfer +=
oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->authorizations)).size ()));
std::vector<std::string>::const_iterator _iter213;
for (_iter213 = (*(this->authorizations)).begin ();
_iter213 != (*(this->authorizations)).end (); ++_iter213)
{
xfer += oprot->writeBinary ((*_iter213));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableID", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->tableID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_startConditionalUpdate_result::~TabletClientService_startConditionalUpdate_result () throw ()
{
}
uint32_t
TabletClientService_startConditionalUpdate_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_startConditionalUpdate_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_startConditionalUpdate_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_startConditionalUpdate_presult::~TabletClientService_startConditionalUpdate_presult () throw ()
{
}
uint32_t
TabletClientService_startConditionalUpdate_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_conditionalUpdate_args::~TabletClientService_conditionalUpdate_args () throw ()
{
}
uint32_t
TabletClientService_conditionalUpdate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->sessID);
this->__isset.sessID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->mutations.clear ();
uint32_t _size214;
::apache::thrift::protocol::TType _ktype215;
::apache::thrift::protocol::TType _vtype216;
xfer += iprot->readMapBegin (_ktype215, _vtype216,
_size214);
uint32_t _i218;
for (_i218 = 0; _i218 < _size214; ++_i218)
{
::org::apache::accumulo::core::data::thrift::TKeyExtent _key219;
xfer += _key219.read (iprot);
std::vector<
::org::apache::accumulo::core::data::thrift::TConditionalMutation> & _val220 =
this->mutations[_key219];
{
_val220.clear ();
uint32_t _size221;
::apache::thrift::protocol::TType _etype224;
xfer += iprot->readListBegin (_etype224,
_size221);
_val220.resize (_size221);
uint32_t _i225;
for (_i225 = 0; _i225 < _size221; ++_i225)
{
xfer += _val220[_i225].read (iprot);
}
xfer += iprot->readListEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.mutations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->symbols.clear ();
uint32_t _size226;
::apache::thrift::protocol::TType _etype229;
xfer += iprot->readListBegin (_etype229,
_size226);
this->symbols.resize (_size226);
uint32_t _i230;
for (_i230 = 0; _i230 < _size226; ++_i230)
{
xfer += iprot->readString (
this->symbols[_i230]);
}
xfer += iprot->readListEnd ();
}
this->__isset.symbols = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_conditionalUpdate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_conditionalUpdate_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("sessID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->sessID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("mutations",
::apache::thrift::protocol::T_MAP,
3);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_LIST,
static_cast<uint32_t> (this->mutations.size ()));
std::map<
::org::apache::accumulo::core::data::thrift::TKeyExtent,
std::vector<
::org::apache::accumulo::core::data::thrift::TConditionalMutation> >::const_iterator _iter231;
for (_iter231 = this->mutations.begin ();
_iter231 != this->mutations.end (); ++_iter231)
{
xfer += _iter231->first.write (oprot);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter231->second.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TConditionalMutation>::const_iterator _iter232;
for (_iter232 = _iter231->second.begin ();
_iter232 != _iter231->second.end (); ++_iter232)
{
xfer += (*_iter232).write (oprot);
}
xfer += oprot->writeListEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"symbols", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->symbols.size ()));
std::vector<std::string>::const_iterator _iter233;
for (_iter233 = this->symbols.begin ();
_iter233 != this->symbols.end (); ++_iter233)
{
xfer += oprot->writeString ((*_iter233));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_conditionalUpdate_pargs::~TabletClientService_conditionalUpdate_pargs () throw ()
{
}
uint32_t
TabletClientService_conditionalUpdate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_conditionalUpdate_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("sessID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->sessID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("mutations",
::apache::thrift::protocol::T_MAP,
3);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_LIST,
static_cast<uint32_t> ((*(this->mutations)).size ()));
std::map<
::org::apache::accumulo::core::data::thrift::TKeyExtent,
std::vector<
::org::apache::accumulo::core::data::thrift::TConditionalMutation> >::const_iterator _iter234;
for (_iter234 = (*(this->mutations)).begin ();
_iter234 != (*(this->mutations)).end (); ++_iter234)
{
xfer += _iter234->first.write (oprot);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter234->second.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TConditionalMutation>::const_iterator _iter235;
for (_iter235 = _iter234->second.begin ();
_iter235 != _iter234->second.end (); ++_iter235)
{
xfer += (*_iter235).write (oprot);
}
xfer += oprot->writeListEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"symbols", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->symbols)).size ()));
std::vector<std::string>::const_iterator _iter236;
for (_iter236 = (*(this->symbols)).begin ();
_iter236 != (*(this->symbols)).end (); ++_iter236)
{
xfer += oprot->writeString ((*_iter236));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_conditionalUpdate_result::~TabletClientService_conditionalUpdate_result () throw ()
{
}
uint32_t
TabletClientService_conditionalUpdate_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size237;
::apache::thrift::protocol::TType _etype240;
xfer += iprot->readListBegin (_etype240,
_size237);
this->success.resize (_size237);
uint32_t _i241;
for (_i241 = 0; _i241 < _size237; ++_i241)
{
xfer += this->success[_i241].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_conditionalUpdate_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_conditionalUpdate_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->success.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TCMResult>::const_iterator _iter242;
for (_iter242 = this->success.begin ();
_iter242 != this->success.end (); ++_iter242)
{
xfer += (*_iter242).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nssi)
{
xfer += oprot->writeFieldBegin (
"nssi", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->nssi.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_conditionalUpdate_presult::~TabletClientService_conditionalUpdate_presult () throw ()
{
}
uint32_t
TabletClientService_conditionalUpdate_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size243;
::apache::thrift::protocol::TType _etype246;
xfer += iprot->readListBegin (_etype246,
_size243);
(*(this->success)).resize (_size243);
uint32_t _i247;
for (_i247 = 0; _i247 < _size243; ++_i247)
{
xfer += (*(this->success))[_i247].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nssi.read (iprot);
this->__isset.nssi = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_invalidateConditionalUpdate_args::~TabletClientService_invalidateConditionalUpdate_args () throw ()
{
}
uint32_t
TabletClientService_invalidateConditionalUpdate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->sessID);
this->__isset.sessID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_invalidateConditionalUpdate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_invalidateConditionalUpdate_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("sessID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->sessID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_invalidateConditionalUpdate_pargs::~TabletClientService_invalidateConditionalUpdate_pargs () throw ()
{
}
uint32_t
TabletClientService_invalidateConditionalUpdate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_invalidateConditionalUpdate_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("sessID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->sessID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_invalidateConditionalUpdate_result::~TabletClientService_invalidateConditionalUpdate_result () throw ()
{
}
uint32_t
TabletClientService_invalidateConditionalUpdate_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
xfer += iprot->skip (ftype);
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_invalidateConditionalUpdate_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_invalidateConditionalUpdate_result");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_invalidateConditionalUpdate_presult::~TabletClientService_invalidateConditionalUpdate_presult () throw ()
{
}
uint32_t
TabletClientService_invalidateConditionalUpdate_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
xfer += iprot->skip (ftype);
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_closeConditionalUpdate_args::~TabletClientService_closeConditionalUpdate_args () throw ()
{
}
uint32_t
TabletClientService_closeConditionalUpdate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->sessID);
this->__isset.sessID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_closeConditionalUpdate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeConditionalUpdate_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("sessID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->sessID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_closeConditionalUpdate_pargs::~TabletClientService_closeConditionalUpdate_pargs () throw ()
{
}
uint32_t
TabletClientService_closeConditionalUpdate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_closeConditionalUpdate_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("sessID",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->sessID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_bulkImport_args::~TabletClientService_bulkImport_args () throw ()
{
}
uint32_t
TabletClientService_bulkImport_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->tid);
this->__isset.tid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->files.clear ();
uint32_t _size248;
::apache::thrift::protocol::TType _ktype249;
::apache::thrift::protocol::TType _vtype250;
xfer += iprot->readMapBegin (_ktype249, _vtype250,
_size248);
uint32_t _i252;
for (_i252 = 0; _i252 < _size248; ++_i252)
{
::org::apache::accumulo::core::data::thrift::TKeyExtent _key253;
xfer += _key253.read (iprot);
std::map<std::string,
::org::apache::accumulo::core::data::thrift::MapFileInfo> & _val254 =
this->files[_key253];
{
_val254.clear ();
uint32_t _size255;
::apache::thrift::protocol::TType _ktype256;
::apache::thrift::protocol::TType _vtype257;
xfer += iprot->readMapBegin (_ktype256,
_vtype257,
_size255);
uint32_t _i259;
for (_i259 = 0; _i259 < _size255; ++_i259)
{
std::string _key260;
xfer += iprot->readString (_key260);
::org::apache::accumulo::core::data::thrift::MapFileInfo& _val261 =
_val254[_key260];
xfer += _val261.read (iprot);
}
xfer += iprot->readMapEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.files = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->setTime);
this->__isset.setTime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_bulkImport_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_bulkImport_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("files",
::apache::thrift::protocol::T_MAP,
2);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> (this->files.size ()));
std::map<
::org::apache::accumulo::core::data::thrift::TKeyExtent,
std::map<std::string,
::org::apache::accumulo::core::data::thrift::MapFileInfo> >::const_iterator _iter262;
for (_iter262 = this->files.begin ();
_iter262 != this->files.end (); ++_iter262)
{
xfer += _iter262->first.write (oprot);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter262->second.size ()));
std::map<std::string,
::org::apache::accumulo::core::data::thrift::MapFileInfo>::const_iterator _iter263;
for (_iter263 = _iter262->second.begin ();
_iter263 != _iter262->second.end (); ++_iter263)
{
xfer += oprot->writeString (_iter263->first);
xfer += _iter263->second.write (oprot);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("tid",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 (this->tid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"setTime", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool (this->setTime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_bulkImport_pargs::~TabletClientService_bulkImport_pargs () throw ()
{
}
uint32_t
TabletClientService_bulkImport_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_bulkImport_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("files",
::apache::thrift::protocol::T_MAP,
2);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRUCT,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> ((*(this->files)).size ()));
std::map<
::org::apache::accumulo::core::data::thrift::TKeyExtent,
std::map<std::string,
::org::apache::accumulo::core::data::thrift::MapFileInfo> >::const_iterator _iter264;
for (_iter264 = (*(this->files)).begin ();
_iter264 != (*(this->files)).end (); ++_iter264)
{
xfer += _iter264->first.write (oprot);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (_iter264->second.size ()));
std::map<std::string,
::org::apache::accumulo::core::data::thrift::MapFileInfo>::const_iterator _iter265;
for (_iter265 = _iter264->second.begin ();
_iter265 != _iter264->second.end (); ++_iter265)
{
xfer += oprot->writeString (_iter265->first);
xfer += _iter265->second.write (oprot);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("tid",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 ((*(this->tid)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"setTime", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool ((*(this->setTime)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_bulkImport_result::~TabletClientService_bulkImport_result () throw ()
{
}
uint32_t
TabletClientService_bulkImport_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size266;
::apache::thrift::protocol::TType _etype269;
xfer += iprot->readListBegin (_etype269,
_size266);
this->success.resize (_size266);
uint32_t _i270;
for (_i270 = 0; _i270 < _size266; ++_i270)
{
xfer += this->success[_i270].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_bulkImport_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_bulkImport_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->success.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TKeyExtent>::const_iterator _iter271;
for (_iter271 = this->success.begin ();
_iter271 != this->success.end (); ++_iter271)
{
xfer += (*_iter271).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_bulkImport_presult::~TabletClientService_bulkImport_presult () throw ()
{
}
uint32_t
TabletClientService_bulkImport_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size272;
::apache::thrift::protocol::TType _etype275;
xfer += iprot->readListBegin (_etype275,
_size272);
(*(this->success)).resize (_size272);
uint32_t _i276;
for (_i276 = 0; _i276 < _size272; ++_i276)
{
xfer += (*(this->success))[_i276].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_splitTablet_args::~TabletClientService_splitTablet_args () throw ()
{
}
uint32_t
TabletClientService_splitTablet_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->splitPoint);
this->__isset.splitPoint = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_splitTablet_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_splitTablet_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"splitPoint", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->splitPoint);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_splitTablet_pargs::~TabletClientService_splitTablet_pargs () throw ()
{
}
uint32_t
TabletClientService_splitTablet_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_splitTablet_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->extent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"splitPoint", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary ((*(this->splitPoint)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_splitTablet_result::~TabletClientService_splitTablet_result () throw ()
{
}
uint32_t
TabletClientService_splitTablet_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_splitTablet_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_splitTablet_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.nste)
{
xfer += oprot->writeFieldBegin (
"nste", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->nste.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_splitTablet_presult::~TabletClientService_splitTablet_presult () throw ()
{
}
uint32_t
TabletClientService_splitTablet_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->nste.read (iprot);
this->__isset.nste = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_loadTablet_args::~TabletClientService_loadTablet_args () throw ()
{
}
uint32_t
TabletClientService_loadTablet_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_loadTablet_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_loadTablet_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_loadTablet_pargs::~TabletClientService_loadTablet_pargs () throw ()
{
}
uint32_t
TabletClientService_loadTablet_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_loadTablet_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->extent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_unloadTablet_args::~TabletClientService_unloadTablet_args () throw ()
{
}
uint32_t
TabletClientService_unloadTablet_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->save);
this->__isset.save = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_unloadTablet_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_unloadTablet_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"save", ::apache::thrift::protocol::T_BOOL, 3);
xfer += oprot->writeBool (this->save);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_unloadTablet_pargs::~TabletClientService_unloadTablet_pargs () throw ()
{
}
uint32_t
TabletClientService_unloadTablet_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_unloadTablet_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->extent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"save", ::apache::thrift::protocol::T_BOOL, 3);
xfer += oprot->writeBool ((*(this->save)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_flush_args::~TabletClientService_flush_args () throw ()
{
}
uint32_t
TabletClientService_flush_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->startRow);
this->__isset.startRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->endRow);
this->__isset.endRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_flush_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_flush_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startRow", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeBinary (this->startRow);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary (this->endRow);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_flush_pargs::~TabletClientService_flush_pargs () throw ()
{
}
uint32_t
TabletClientService_flush_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_flush_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableId)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startRow", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeBinary ((*(this->startRow)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary ((*(this->endRow)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_flushTablet_args::~TabletClientService_flushTablet_args () throw ()
{
}
uint32_t
TabletClientService_flushTablet_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_flushTablet_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_flushTablet_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_flushTablet_pargs::~TabletClientService_flushTablet_pargs () throw ()
{
}
uint32_t
TabletClientService_flushTablet_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_flushTablet_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->extent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_chop_args::~TabletClientService_chop_args () throw ()
{
}
uint32_t
TabletClientService_chop_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_chop_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TabletClientService_chop_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_chop_pargs::~TabletClientService_chop_pargs () throw ()
{
}
uint32_t
TabletClientService_chop_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_chop_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->extent)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_compact_args::~TabletClientService_compact_args () throw ()
{
}
uint32_t
TabletClientService_compact_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->startRow);
this->__isset.startRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->endRow);
this->__isset.endRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_compact_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_compact_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startRow", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeBinary (this->startRow);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary (this->endRow);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_compact_pargs::~TabletClientService_compact_pargs () throw ()
{
}
uint32_t
TabletClientService_compact_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_compact_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->tableId)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startRow", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeBinary ((*(this->startRow)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary ((*(this->endRow)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getTabletServerStatus_args::~TabletClientService_getTabletServerStatus_args () throw ()
{
}
uint32_t
TabletClientService_getTabletServerStatus_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getTabletServerStatus_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getTabletServerStatus_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getTabletServerStatus_pargs::~TabletClientService_getTabletServerStatus_pargs () throw ()
{
}
uint32_t
TabletClientService_getTabletServerStatus_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getTabletServerStatus_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getTabletServerStatus_result::~TabletClientService_getTabletServerStatus_result () throw ()
{
}
uint32_t
TabletClientService_getTabletServerStatus_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getTabletServerStatus_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_getTabletServerStatus_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_getTabletServerStatus_presult::~TabletClientService_getTabletServerStatus_presult () throw ()
{
}
uint32_t
TabletClientService_getTabletServerStatus_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_getTabletStats_args::~TabletClientService_getTabletStats_args () throw ()
{
}
uint32_t
TabletClientService_getTabletStats_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getTabletStats_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getTabletStats_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getTabletStats_pargs::~TabletClientService_getTabletStats_pargs () throw ()
{
}
uint32_t
TabletClientService_getTabletStats_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getTabletStats_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableId)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getTabletStats_result::~TabletClientService_getTabletStats_result () throw ()
{
}
uint32_t
TabletClientService_getTabletStats_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size277;
::apache::thrift::protocol::TType _etype280;
xfer += iprot->readListBegin (_etype280,
_size277);
this->success.resize (_size277);
uint32_t _i281;
for (_i281 = 0; _i281 < _size277; ++_i281)
{
xfer += this->success[_i281].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getTabletStats_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_getTabletStats_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->success.size ()));
std::vector<TabletStats>::const_iterator _iter282;
for (_iter282 = this->success.begin ();
_iter282 != this->success.end (); ++_iter282)
{
xfer += (*_iter282).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_getTabletStats_presult::~TabletClientService_getTabletStats_presult () throw ()
{
}
uint32_t
TabletClientService_getTabletStats_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size283;
::apache::thrift::protocol::TType _etype286;
xfer += iprot->readListBegin (_etype286,
_size283);
(*(this->success)).resize (_size283);
uint32_t _i287;
for (_i287 = 0; _i287 < _size283; ++_i287)
{
xfer += (*(this->success))[_i287].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_getHistoricalStats_args::~TabletClientService_getHistoricalStats_args () throw ()
{
}
uint32_t
TabletClientService_getHistoricalStats_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getHistoricalStats_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getHistoricalStats_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getHistoricalStats_pargs::~TabletClientService_getHistoricalStats_pargs () throw ()
{
}
uint32_t
TabletClientService_getHistoricalStats_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getHistoricalStats_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getHistoricalStats_result::~TabletClientService_getHistoricalStats_result () throw ()
{
}
uint32_t
TabletClientService_getHistoricalStats_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getHistoricalStats_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_getHistoricalStats_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_getHistoricalStats_presult::~TabletClientService_getHistoricalStats_presult () throw ()
{
}
uint32_t
TabletClientService_getHistoricalStats_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_halt_args::~TabletClientService_halt_args () throw ()
{
}
uint32_t
TabletClientService_halt_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_halt_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TabletClientService_halt_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_halt_pargs::~TabletClientService_halt_pargs () throw ()
{
}
uint32_t
TabletClientService_halt_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_halt_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_halt_result::~TabletClientService_halt_result () throw ()
{
}
uint32_t
TabletClientService_halt_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_halt_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_halt_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_halt_presult::~TabletClientService_halt_presult () throw ()
{
}
uint32_t
TabletClientService_halt_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_fastHalt_args::~TabletClientService_fastHalt_args () throw ()
{
}
uint32_t
TabletClientService_fastHalt_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->lock);
this->__isset.lock = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_fastHalt_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_fastHalt_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->lock);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_fastHalt_pargs::~TabletClientService_fastHalt_pargs () throw ()
{
}
uint32_t
TabletClientService_fastHalt_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_fastHalt_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"lock", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->lock)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getActiveScans_args::~TabletClientService_getActiveScans_args () throw ()
{
}
uint32_t
TabletClientService_getActiveScans_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getActiveScans_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getActiveScans_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getActiveScans_pargs::~TabletClientService_getActiveScans_pargs () throw ()
{
}
uint32_t
TabletClientService_getActiveScans_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getActiveScans_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getActiveScans_result::~TabletClientService_getActiveScans_result () throw ()
{
}
uint32_t
TabletClientService_getActiveScans_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size288;
::apache::thrift::protocol::TType _etype291;
xfer += iprot->readListBegin (_etype291,
_size288);
this->success.resize (_size288);
uint32_t _i292;
for (_i292 = 0; _i292 < _size288; ++_i292)
{
xfer += this->success[_i292].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getActiveScans_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_getActiveScans_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->success.size ()));
std::vector<ActiveScan>::const_iterator _iter293;
for (_iter293 = this->success.begin ();
_iter293 != this->success.end (); ++_iter293)
{
xfer += (*_iter293).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_getActiveScans_presult::~TabletClientService_getActiveScans_presult () throw ()
{
}
uint32_t
TabletClientService_getActiveScans_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size294;
::apache::thrift::protocol::TType _etype297;
xfer += iprot->readListBegin (_etype297,
_size294);
(*(this->success)).resize (_size294);
uint32_t _i298;
for (_i298 = 0; _i298 < _size294; ++_i298)
{
xfer += (*(this->success))[_i298].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_getActiveCompactions_args::~TabletClientService_getActiveCompactions_args () throw ()
{
}
uint32_t
TabletClientService_getActiveCompactions_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getActiveCompactions_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getActiveCompactions_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getActiveCompactions_pargs::~TabletClientService_getActiveCompactions_pargs () throw ()
{
}
uint32_t
TabletClientService_getActiveCompactions_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_getActiveCompactions_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_getActiveCompactions_result::~TabletClientService_getActiveCompactions_result () throw ()
{
}
uint32_t
TabletClientService_getActiveCompactions_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size299;
::apache::thrift::protocol::TType _etype302;
xfer += iprot->readListBegin (_etype302,
_size299);
this->success.resize (_size299);
uint32_t _i303;
for (_i303 = 0; _i303 < _size299; ++_i303)
{
xfer += this->success[_i303].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_getActiveCompactions_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"TabletClientService_getActiveCompactions_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->success.size ()));
std::vector<ActiveCompaction>::const_iterator _iter304;
for (_iter304 = this->success.begin ();
_iter304 != this->success.end (); ++_iter304)
{
xfer += (*_iter304).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TabletClientService_getActiveCompactions_presult::~TabletClientService_getActiveCompactions_presult () throw ()
{
}
uint32_t
TabletClientService_getActiveCompactions_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size305;
::apache::thrift::protocol::TType _etype308;
xfer += iprot->readListBegin (_etype308,
_size305);
(*(this->success)).resize (_size305);
uint32_t _i309;
for (_i309 = 0; _i309 < _size305; ++_i309)
{
xfer += (*(this->success))[_i309].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
TabletClientService_removeLogs_args::~TabletClientService_removeLogs_args () throw ()
{
}
uint32_t
TabletClientService_removeLogs_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->filenames.clear ();
uint32_t _size310;
::apache::thrift::protocol::TType _etype313;
xfer += iprot->readListBegin (_etype313,
_size310);
this->filenames.resize (_size310);
uint32_t _i314;
for (_i314 = 0; _i314 < _size310; ++_i314)
{
xfer += iprot->readString (
this->filenames[_i314]);
}
xfer += iprot->readListEnd ();
}
this->__isset.filenames = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletClientService_removeLogs_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_removeLogs_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"filenames", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->filenames.size ()));
std::vector<std::string>::const_iterator _iter315;
for (_iter315 = this->filenames.begin ();
_iter315 != this->filenames.end (); ++_iter315)
{
xfer += oprot->writeString ((*_iter315));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TabletClientService_removeLogs_pargs::~TabletClientService_removeLogs_pargs () throw ()
{
}
uint32_t
TabletClientService_removeLogs_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"TabletClientService_removeLogs_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"filenames", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->filenames)).size ()));
std::vector<std::string>::const_iterator _iter316;
for (_iter316 = (*(this->filenames)).begin ();
_iter316 != (*(this->filenames)).end (); ++_iter316)
{
xfer += oprot->writeString ((*_iter316));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
TabletClientServiceClient::startScan (
::org::apache::accumulo::core::data::thrift::InitialScan& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent,
const ::org::apache::accumulo::core::data::thrift::TRange& range,
const std::vector<
::org::apache::accumulo::core::data::thrift::TColumn> & columns,
const int32_t batchSize,
const std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo> & ssiList,
const std::map<std::string, std::map<std::string, std::string> > & ssio,
const std::vector<std::string> & authorizations,
const bool waitForWrites, const bool isolated,
const int64_t readaheadThreshold)
{
send_startScan (tinfo, credentials, extent, range, columns,
batchSize, ssiList, ssio, authorizations,
waitForWrites, isolated, readaheadThreshold);
recv_startScan (_return);
}
void
TabletClientServiceClient::send_startScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent,
const ::org::apache::accumulo::core::data::thrift::TRange& range,
const std::vector<
::org::apache::accumulo::core::data::thrift::TColumn> & columns,
const int32_t batchSize,
const std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo> & ssiList,
const std::map<std::string, std::map<std::string, std::string> > & ssio,
const std::vector<std::string> & authorizations,
const bool waitForWrites, const bool isolated,
const int64_t readaheadThreshold)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("startScan",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_startScan_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.extent = &extent;
args.range = ⦥
args.columns = &columns;
args.batchSize = &batchSize;
args.ssiList = &ssiList;
args.ssio = &ssio;
args.authorizations = &authorizations;
args.waitForWrites = &waitForWrites;
args.isolated = &isolated;
args.readaheadThreshold = &readaheadThreshold;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_startScan (
::org::apache::accumulo::core::data::thrift::InitialScan& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("startScan") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_startScan_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.nste)
{
throw result.nste;
}
if (result.__isset.tmfe)
{
throw result.tmfe;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"startScan failed: unknown result");
}
void
TabletClientServiceClient::continueScan (
::org::apache::accumulo::core::data::thrift::ScanResult& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
send_continueScan (tinfo, scanID);
recv_continueScan (_return);
}
void
TabletClientServiceClient::send_continueScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("continueScan",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_continueScan_pargs args;
args.tinfo = &tinfo;
args.scanID = &scanID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_continueScan (
::org::apache::accumulo::core::data::thrift::ScanResult& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("continueScan") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_continueScan_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.nssi)
{
throw result.nssi;
}
if (result.__isset.nste)
{
throw result.nste;
}
if (result.__isset.tmfe)
{
throw result.tmfe;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"continueScan failed: unknown result");
}
void
TabletClientServiceClient::closeScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
send_closeScan (tinfo, scanID);
}
void
TabletClientServiceClient::send_closeScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("closeScan",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_closeScan_pargs args;
args.tinfo = &tinfo;
args.scanID = &scanID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::startMultiScan (
::org::apache::accumulo::core::data::thrift::InitialMultiScan& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::ScanBatch& batch,
const std::vector<
::org::apache::accumulo::core::data::thrift::TColumn> & columns,
const std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo> & ssiList,
const std::map<std::string, std::map<std::string, std::string> > & ssio,
const std::vector<std::string> & authorizations,
const bool waitForWrites)
{
send_startMultiScan (tinfo, credentials, batch, columns, ssiList,
ssio, authorizations, waitForWrites);
recv_startMultiScan (_return);
}
void
TabletClientServiceClient::send_startMultiScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::ScanBatch& batch,
const std::vector<
::org::apache::accumulo::core::data::thrift::TColumn> & columns,
const std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo> & ssiList,
const std::map<std::string, std::map<std::string, std::string> > & ssio,
const std::vector<std::string> & authorizations,
const bool waitForWrites)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("startMultiScan",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_startMultiScan_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.batch = &batch;
args.columns = &columns;
args.ssiList = &ssiList;
args.ssio = &ssio;
args.authorizations = &authorizations;
args.waitForWrites = &waitForWrites;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_startMultiScan (
::org::apache::accumulo::core::data::thrift::InitialMultiScan& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("startMultiScan") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_startMultiScan_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"startMultiScan failed: unknown result");
}
void
TabletClientServiceClient::continueMultiScan (
::org::apache::accumulo::core::data::thrift::MultiScanResult& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
send_continueMultiScan (tinfo, scanID);
recv_continueMultiScan (_return);
}
void
TabletClientServiceClient::send_continueMultiScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("continueMultiScan",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_continueMultiScan_pargs args;
args.tinfo = &tinfo;
args.scanID = &scanID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_continueMultiScan (
::org::apache::accumulo::core::data::thrift::MultiScanResult& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("continueMultiScan") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_continueMultiScan_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.nssi)
{
throw result.nssi;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"continueMultiScan failed: unknown result");
}
void
TabletClientServiceClient::closeMultiScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
send_closeMultiScan (tinfo, scanID);
recv_closeMultiScan ();
}
void
TabletClientServiceClient::send_closeMultiScan (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::ScanID scanID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("closeMultiScan",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_closeMultiScan_pargs args;
args.tinfo = &tinfo;
args.scanID = &scanID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_closeMultiScan ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("closeMultiScan") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_closeMultiScan_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.nssi)
{
throw result.nssi;
}
return;
}
::org::apache::accumulo::core::data::thrift::UpdateID
TabletClientServiceClient::startUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_startUpdate (tinfo, credentials);
return recv_startUpdate ();
}
void
TabletClientServiceClient::send_startUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("startUpdate",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_startUpdate_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
::org::apache::accumulo::core::data::thrift::UpdateID
TabletClientServiceClient::recv_startUpdate ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("startUpdate") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
::org::apache::accumulo::core::data::thrift::UpdateID _return;
TabletClientService_startUpdate_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"startUpdate failed: unknown result");
}
void
TabletClientServiceClient::applyUpdates (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID updateID,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& keyExtent,
const std::vector<
::org::apache::accumulo::core::data::thrift::TMutation> & mutations)
{
send_applyUpdates (tinfo, updateID, keyExtent, mutations);
}
void
TabletClientServiceClient::send_applyUpdates (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID updateID,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& keyExtent,
const std::vector<
::org::apache::accumulo::core::data::thrift::TMutation> & mutations)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("applyUpdates",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_applyUpdates_pargs args;
args.tinfo = &tinfo;
args.updateID = &updateID;
args.keyExtent = &keyExtent;
args.mutations = &mutations;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::closeUpdate (
::org::apache::accumulo::core::data::thrift::UpdateErrors& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID updateID)
{
send_closeUpdate (tinfo, updateID);
recv_closeUpdate (_return);
}
void
TabletClientServiceClient::send_closeUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID updateID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("closeUpdate",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_closeUpdate_pargs args;
args.tinfo = &tinfo;
args.updateID = &updateID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_closeUpdate (
::org::apache::accumulo::core::data::thrift::UpdateErrors& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("closeUpdate") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_closeUpdate_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.nssi)
{
throw result.nssi;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"closeUpdate failed: unknown result");
}
void
TabletClientServiceClient::update (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& keyExtent,
const ::org::apache::accumulo::core::data::thrift::TMutation& mutation)
{
send_update (tinfo, credentials, keyExtent, mutation);
recv_update ();
}
void
TabletClientServiceClient::send_update (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& keyExtent,
const ::org::apache::accumulo::core::data::thrift::TMutation& mutation)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("update",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_update_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.keyExtent = &keyExtent;
args.mutation = &mutation;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_update ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("update") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_update_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.nste)
{
throw result.nste;
}
if (result.__isset.cve)
{
throw result.cve;
}
return;
}
void
TabletClientServiceClient::startConditionalUpdate (
::org::apache::accumulo::core::data::thrift::TConditionalSession& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::vector<std::string> & authorizations,
const std::string& tableID)
{
send_startConditionalUpdate (tinfo, credentials, authorizations,
tableID);
recv_startConditionalUpdate (_return);
}
void
TabletClientServiceClient::send_startConditionalUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::vector<std::string> & authorizations,
const std::string& tableID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("startConditionalUpdate",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_startConditionalUpdate_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.authorizations = &authorizations;
args.tableID = &tableID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_startConditionalUpdate (
::org::apache::accumulo::core::data::thrift::TConditionalSession& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("startConditionalUpdate") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_startConditionalUpdate_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"startConditionalUpdate failed: unknown result");
}
void
TabletClientServiceClient::conditionalUpdate (
std::vector<
::org::apache::accumulo::core::data::thrift::TCMResult> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID sessID,
const ::org::apache::accumulo::core::data::thrift::CMBatch& mutations,
const std::vector<std::string> & symbols)
{
send_conditionalUpdate (tinfo, sessID, mutations, symbols);
recv_conditionalUpdate (_return);
}
void
TabletClientServiceClient::send_conditionalUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID sessID,
const ::org::apache::accumulo::core::data::thrift::CMBatch& mutations,
const std::vector<std::string> & symbols)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("conditionalUpdate",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_conditionalUpdate_pargs args;
args.tinfo = &tinfo;
args.sessID = &sessID;
args.mutations = &mutations;
args.symbols = &symbols;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_conditionalUpdate (
std::vector<
::org::apache::accumulo::core::data::thrift::TCMResult> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("conditionalUpdate") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_conditionalUpdate_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.nssi)
{
throw result.nssi;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"conditionalUpdate failed: unknown result");
}
void
TabletClientServiceClient::invalidateConditionalUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID sessID)
{
send_invalidateConditionalUpdate (tinfo, sessID);
recv_invalidateConditionalUpdate ();
}
void
TabletClientServiceClient::send_invalidateConditionalUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID sessID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("invalidateConditionalUpdate",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_invalidateConditionalUpdate_pargs args;
args.tinfo = &tinfo;
args.sessID = &sessID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_invalidateConditionalUpdate ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("invalidateConditionalUpdate") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_invalidateConditionalUpdate_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
return;
}
void
TabletClientServiceClient::closeConditionalUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID sessID)
{
send_closeConditionalUpdate (tinfo, sessID);
}
void
TabletClientServiceClient::send_closeConditionalUpdate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::data::thrift::UpdateID sessID)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("closeConditionalUpdate",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_closeConditionalUpdate_pargs args;
args.tinfo = &tinfo;
args.sessID = &sessID;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::bulkImport (
std::vector<
::org::apache::accumulo::core::data::thrift::TKeyExtent> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t tid,
const ::org::apache::accumulo::core::data::thrift::TabletFiles& files,
const bool setTime)
{
send_bulkImport (tinfo, credentials, tid, files, setTime);
recv_bulkImport (_return);
}
void
TabletClientServiceClient::send_bulkImport (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t tid,
const ::org::apache::accumulo::core::data::thrift::TabletFiles& files,
const bool setTime)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("bulkImport",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_bulkImport_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tid = &tid;
args.files = &files;
args.setTime = &setTime;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_bulkImport (
std::vector<
::org::apache::accumulo::core::data::thrift::TKeyExtent> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("bulkImport") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_bulkImport_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"bulkImport failed: unknown result");
}
void
TabletClientServiceClient::splitTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent,
const std::string& splitPoint)
{
send_splitTablet (tinfo, credentials, extent, splitPoint);
recv_splitTablet ();
}
void
TabletClientServiceClient::send_splitTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent,
const std::string& splitPoint)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("splitTablet",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_splitTablet_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.extent = &extent;
args.splitPoint = &splitPoint;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_splitTablet ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("splitTablet") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_splitTablet_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.nste)
{
throw result.nste;
}
return;
}
void
TabletClientServiceClient::loadTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent)
{
send_loadTablet (tinfo, credentials, lock, extent);
}
void
TabletClientServiceClient::send_loadTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("loadTablet",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_loadTablet_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.extent = &extent;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::unloadTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent,
const bool save)
{
send_unloadTablet (tinfo, credentials, lock, extent, save);
}
void
TabletClientServiceClient::send_unloadTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent,
const bool save)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("unloadTablet",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_unloadTablet_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.extent = &extent;
args.save = &save;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::flush (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock, const std::string& tableId,
const std::string& startRow, const std::string& endRow)
{
send_flush (tinfo, credentials, lock, tableId, startRow, endRow);
}
void
TabletClientServiceClient::send_flush (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock, const std::string& tableId,
const std::string& startRow, const std::string& endRow)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("flush",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_flush_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.tableId = &tableId;
args.startRow = &startRow;
args.endRow = &endRow;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::flushTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent)
{
send_flushTablet (tinfo, credentials, lock, extent);
}
void
TabletClientServiceClient::send_flushTablet (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("flushTablet",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_flushTablet_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.extent = &extent;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::chop (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent)
{
send_chop (tinfo, credentials, lock, extent);
}
void
TabletClientServiceClient::send_chop (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& extent)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("chop",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_chop_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.extent = &extent;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::compact (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock, const std::string& tableId,
const std::string& startRow, const std::string& endRow)
{
send_compact (tinfo, credentials, lock, tableId, startRow,
endRow);
}
void
TabletClientServiceClient::send_compact (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock, const std::string& tableId,
const std::string& startRow, const std::string& endRow)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("compact",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_compact_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.tableId = &tableId;
args.startRow = &startRow;
args.endRow = &endRow;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::getTabletServerStatus (
::org::apache::accumulo::core::master::thrift::TabletServerStatus& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_getTabletServerStatus (tinfo, credentials);
recv_getTabletServerStatus (_return);
}
void
TabletClientServiceClient::send_getTabletServerStatus (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getTabletServerStatus",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_getTabletServerStatus_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_getTabletServerStatus (
::org::apache::accumulo::core::master::thrift::TabletServerStatus& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getTabletServerStatus") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_getTabletServerStatus_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getTabletServerStatus failed: unknown result");
}
void
TabletClientServiceClient::getTabletStats (
std::vector<TabletStats> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableId)
{
send_getTabletStats (tinfo, credentials, tableId);
recv_getTabletStats (_return);
}
void
TabletClientServiceClient::send_getTabletStats (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableId)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getTabletStats",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_getTabletStats_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableId = &tableId;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_getTabletStats (
std::vector<TabletStats> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getTabletStats") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_getTabletStats_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getTabletStats failed: unknown result");
}
void
TabletClientServiceClient::getHistoricalStats (
TabletStats& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_getHistoricalStats (tinfo, credentials);
recv_getHistoricalStats (_return);
}
void
TabletClientServiceClient::send_getHistoricalStats (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getHistoricalStats",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_getHistoricalStats_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_getHistoricalStats (
TabletStats& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getHistoricalStats") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_getHistoricalStats_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getHistoricalStats failed: unknown result");
}
void
TabletClientServiceClient::halt (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock)
{
send_halt (tinfo, credentials, lock);
recv_halt ();
}
void
TabletClientServiceClient::send_halt (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("halt",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_halt_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_halt ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("halt") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_halt_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
TabletClientServiceClient::fastHalt (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock)
{
send_fastHalt (tinfo, credentials, lock);
}
void
TabletClientServiceClient::send_fastHalt (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& lock)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("fastHalt",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_fastHalt_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.lock = &lock;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::getActiveScans (
std::vector<ActiveScan> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_getActiveScans (tinfo, credentials);
recv_getActiveScans (_return);
}
void
TabletClientServiceClient::send_getActiveScans (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getActiveScans",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_getActiveScans_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_getActiveScans (
std::vector<ActiveScan> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getActiveScans") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_getActiveScans_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getActiveScans failed: unknown result");
}
void
TabletClientServiceClient::getActiveCompactions (
std::vector<ActiveCompaction> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_getActiveCompactions (tinfo, credentials);
recv_getActiveCompactions (_return);
}
void
TabletClientServiceClient::send_getActiveCompactions (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getActiveCompactions",
::apache::thrift::protocol::T_CALL,
cseqid);
TabletClientService_getActiveCompactions_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
TabletClientServiceClient::recv_getActiveCompactions (
std::vector<ActiveCompaction> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getActiveCompactions") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
TabletClientService_getActiveCompactions_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getActiveCompactions failed: unknown result");
}
void
TabletClientServiceClient::removeLogs (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::vector<std::string> & filenames)
{
send_removeLogs (tinfo, credentials, filenames);
}
void
TabletClientServiceClient::send_removeLogs (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::vector<std::string> & filenames)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("removeLogs",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
TabletClientService_removeLogs_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.filenames = &filenames;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
TabletClientServiceProcessor::dispatchCall (
::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
const std::string& fname, int32_t seqid, void* callContext)
{
ProcessMap::iterator pfn;
pfn = processMap_.find (fname);
if (pfn == processMap_.end ())
{
return ::org::apache::accumulo::core::client::impl::thrift::ClientServiceProcessor::dispatchCall (
iprot, oprot, fname, seqid, callContext);
}
(this->*(pfn->second)) (seqid, iprot, oprot, callContext);
return true;
}
void
TabletClientServiceProcessor::process_startScan (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.startScan", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.startScan");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.startScan");
}
TabletClientService_startScan_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.startScan", bytes);
}
TabletClientService_startScan_result result;
try
{
iface_->startScan (result.success, args.tinfo,
args.credentials, args.extent, args.range,
args.columns, args.batchSize, args.ssiList,
args.ssio, args.authorizations,
args.waitForWrites, args.isolated,
args.readaheadThreshold);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (NotServingTabletException &nste)
{
result.nste = nste;
result.__isset.nste = true;
}
catch (TooManyFilesException &tmfe)
{
result.tmfe = tmfe;
result.__isset.tmfe = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.startScan");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"startScan", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.startScan");
}
oprot->writeMessageBegin ("startScan",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.startScan", bytes);
}
}
void
TabletClientServiceProcessor::process_continueScan (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.continueScan", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.continueScan");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.continueScan");
}
TabletClientService_continueScan_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.continueScan", bytes);
}
TabletClientService_continueScan_result result;
try
{
iface_->continueScan (result.success, args.tinfo,
args.scanID);
result.__isset.success = true;
}
catch (NoSuchScanIDException &nssi)
{
result.nssi = nssi;
result.__isset.nssi = true;
}
catch (NotServingTabletException &nste)
{
result.nste = nste;
result.__isset.nste = true;
}
catch (TooManyFilesException &tmfe)
{
result.tmfe = tmfe;
result.__isset.tmfe = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.continueScan");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"continueScan", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.continueScan");
}
oprot->writeMessageBegin ("continueScan",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.continueScan", bytes);
}
}
void
TabletClientServiceProcessor::process_closeScan (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.closeScan", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.closeScan");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.closeScan");
}
TabletClientService_closeScan_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.closeScan", bytes);
}
try
{
iface_->closeScan (args.tinfo, args.scanID);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.closeScan");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.closeScan");
}
return;
}
void
TabletClientServiceProcessor::process_startMultiScan (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.startMultiScan", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.startMultiScan");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.startMultiScan");
}
TabletClientService_startMultiScan_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.startMultiScan", bytes);
}
TabletClientService_startMultiScan_result result;
try
{
iface_->startMultiScan (result.success, args.tinfo,
args.credentials, args.batch,
args.columns, args.ssiList, args.ssio,
args.authorizations,
args.waitForWrites);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.startMultiScan");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"startMultiScan", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.startMultiScan");
}
oprot->writeMessageBegin ("startMultiScan",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.startMultiScan", bytes);
}
}
void
TabletClientServiceProcessor::process_continueMultiScan (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.continueMultiScan", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.continueMultiScan");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.continueMultiScan");
}
TabletClientService_continueMultiScan_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.continueMultiScan", bytes);
}
TabletClientService_continueMultiScan_result result;
try
{
iface_->continueMultiScan (result.success, args.tinfo,
args.scanID);
result.__isset.success = true;
}
catch (NoSuchScanIDException &nssi)
{
result.nssi = nssi;
result.__isset.nssi = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.continueMultiScan");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"continueMultiScan",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.continueMultiScan");
}
oprot->writeMessageBegin ("continueMultiScan",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.continueMultiScan", bytes);
}
}
void
TabletClientServiceProcessor::process_closeMultiScan (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.closeMultiScan", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.closeMultiScan");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.closeMultiScan");
}
TabletClientService_closeMultiScan_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.closeMultiScan", bytes);
}
TabletClientService_closeMultiScan_result result;
try
{
iface_->closeMultiScan (args.tinfo, args.scanID);
}
catch (NoSuchScanIDException &nssi)
{
result.nssi = nssi;
result.__isset.nssi = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.closeMultiScan");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"closeMultiScan", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.closeMultiScan");
}
oprot->writeMessageBegin ("closeMultiScan",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.closeMultiScan", bytes);
}
}
void
TabletClientServiceProcessor::process_startUpdate (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.startUpdate", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.startUpdate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.startUpdate");
}
TabletClientService_startUpdate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.startUpdate", bytes);
}
TabletClientService_startUpdate_result result;
try
{
result.success = iface_->startUpdate (args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.startUpdate");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"startUpdate", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.startUpdate");
}
oprot->writeMessageBegin ("startUpdate",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.startUpdate", bytes);
}
}
void
TabletClientServiceProcessor::process_applyUpdates (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.applyUpdates", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.applyUpdates");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.applyUpdates");
}
TabletClientService_applyUpdates_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.applyUpdates", bytes);
}
try
{
iface_->applyUpdates (args.tinfo, args.updateID,
args.keyExtent, args.mutations);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.applyUpdates");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.applyUpdates");
}
return;
}
void
TabletClientServiceProcessor::process_closeUpdate (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.closeUpdate", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.closeUpdate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.closeUpdate");
}
TabletClientService_closeUpdate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.closeUpdate", bytes);
}
TabletClientService_closeUpdate_result result;
try
{
iface_->closeUpdate (result.success, args.tinfo,
args.updateID);
result.__isset.success = true;
}
catch (NoSuchScanIDException &nssi)
{
result.nssi = nssi;
result.__isset.nssi = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.closeUpdate");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"closeUpdate", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.closeUpdate");
}
oprot->writeMessageBegin ("closeUpdate",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.closeUpdate", bytes);
}
}
void
TabletClientServiceProcessor::process_update (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.update", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.update");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"TabletClientService.update");
}
TabletClientService_update_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"TabletClientService.update",
bytes);
}
TabletClientService_update_result result;
try
{
iface_->update (args.tinfo, args.credentials, args.keyExtent,
args.mutation);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (NotServingTabletException &nste)
{
result.nste = nste;
result.__isset.nste = true;
}
catch (ConstraintViolationException &cve)
{
result.cve = cve;
result.__isset.cve = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.update");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"update", ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (ctx,
"TabletClientService.update");
}
oprot->writeMessageBegin ("update",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (ctx,
"TabletClientService.update",
bytes);
}
}
void
TabletClientServiceProcessor::process_startConditionalUpdate (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.startConditionalUpdate",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.startConditionalUpdate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.startConditionalUpdate");
}
TabletClientService_startConditionalUpdate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.startConditionalUpdate", bytes);
}
TabletClientService_startConditionalUpdate_result result;
try
{
iface_->startConditionalUpdate (result.success, args.tinfo,
args.credentials,
args.authorizations,
args.tableID);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.startConditionalUpdate");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"startConditionalUpdate",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.startConditionalUpdate");
}
oprot->writeMessageBegin ("startConditionalUpdate",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.startConditionalUpdate", bytes);
}
}
void
TabletClientServiceProcessor::process_conditionalUpdate (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.conditionalUpdate", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.conditionalUpdate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.conditionalUpdate");
}
TabletClientService_conditionalUpdate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.conditionalUpdate", bytes);
}
TabletClientService_conditionalUpdate_result result;
try
{
iface_->conditionalUpdate (result.success, args.tinfo,
args.sessID, args.mutations,
args.symbols);
result.__isset.success = true;
}
catch (NoSuchScanIDException &nssi)
{
result.nssi = nssi;
result.__isset.nssi = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.conditionalUpdate");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"conditionalUpdate",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.conditionalUpdate");
}
oprot->writeMessageBegin ("conditionalUpdate",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.conditionalUpdate", bytes);
}
}
void
TabletClientServiceProcessor::process_invalidateConditionalUpdate (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.invalidateConditionalUpdate",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.invalidateConditionalUpdate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.invalidateConditionalUpdate");
}
TabletClientService_invalidateConditionalUpdate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.invalidateConditionalUpdate",
bytes);
}
TabletClientService_invalidateConditionalUpdate_result result;
try
{
iface_->invalidateConditionalUpdate (args.tinfo, args.sessID);
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx,
"TabletClientService.invalidateConditionalUpdate");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"invalidateConditionalUpdate",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.invalidateConditionalUpdate");
}
oprot->writeMessageBegin ("invalidateConditionalUpdate",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.invalidateConditionalUpdate",
bytes);
}
}
void
TabletClientServiceProcessor::process_closeConditionalUpdate (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.closeConditionalUpdate",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.closeConditionalUpdate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.closeConditionalUpdate");
}
TabletClientService_closeConditionalUpdate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.closeConditionalUpdate", bytes);
}
try
{
iface_->closeConditionalUpdate (args.tinfo, args.sessID);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.closeConditionalUpdate");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.closeConditionalUpdate");
}
return;
}
void
TabletClientServiceProcessor::process_bulkImport (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.bulkImport", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.bulkImport");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.bulkImport");
}
TabletClientService_bulkImport_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.bulkImport", bytes);
}
TabletClientService_bulkImport_result result;
try
{
iface_->bulkImport (result.success, args.tinfo,
args.credentials, args.tid, args.files,
args.setTime);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.bulkImport");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"bulkImport", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.bulkImport");
}
oprot->writeMessageBegin ("bulkImport",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.bulkImport", bytes);
}
}
void
TabletClientServiceProcessor::process_splitTablet (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.splitTablet", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.splitTablet");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.splitTablet");
}
TabletClientService_splitTablet_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.splitTablet", bytes);
}
TabletClientService_splitTablet_result result;
try
{
iface_->splitTablet (args.tinfo, args.credentials,
args.extent, args.splitPoint);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (NotServingTabletException &nste)
{
result.nste = nste;
result.__isset.nste = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.splitTablet");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"splitTablet", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.splitTablet");
}
oprot->writeMessageBegin ("splitTablet",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.splitTablet", bytes);
}
}
void
TabletClientServiceProcessor::process_loadTablet (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.loadTablet", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.loadTablet");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.loadTablet");
}
TabletClientService_loadTablet_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.loadTablet", bytes);
}
try
{
iface_->loadTablet (args.tinfo, args.credentials, args.lock,
args.extent);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.loadTablet");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.loadTablet");
}
return;
}
void
TabletClientServiceProcessor::process_unloadTablet (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.unloadTablet", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.unloadTablet");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.unloadTablet");
}
TabletClientService_unloadTablet_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.unloadTablet", bytes);
}
try
{
iface_->unloadTablet (args.tinfo, args.credentials, args.lock,
args.extent, args.save);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.unloadTablet");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.unloadTablet");
}
return;
}
void
TabletClientServiceProcessor::process_flush (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.flush", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "TabletClientService.flush");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"TabletClientService.flush");
}
TabletClientService_flush_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"TabletClientService.flush",
bytes);
}
try
{
iface_->flush (args.tinfo, args.credentials, args.lock,
args.tableId, args.startRow, args.endRow);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.flush");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.flush");
}
return;
}
void
TabletClientServiceProcessor::process_flushTablet (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.flushTablet", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.flushTablet");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.flushTablet");
}
TabletClientService_flushTablet_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.flushTablet", bytes);
}
try
{
iface_->flushTablet (args.tinfo, args.credentials, args.lock,
args.extent);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.flushTablet");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.flushTablet");
}
return;
}
void
TabletClientServiceProcessor::process_chop (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.chop", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "TabletClientService.chop");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"TabletClientService.chop");
}
TabletClientService_chop_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"TabletClientService.chop",
bytes);
}
try
{
iface_->chop (args.tinfo, args.credentials, args.lock,
args.extent);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.chop");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.chop");
}
return;
}
void
TabletClientServiceProcessor::process_compact (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.compact", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.compact");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"TabletClientService.compact");
}
TabletClientService_compact_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"TabletClientService.compact",
bytes);
}
try
{
iface_->compact (args.tinfo, args.credentials, args.lock,
args.tableId, args.startRow, args.endRow);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.compact");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.compact");
}
return;
}
void
TabletClientServiceProcessor::process_getTabletServerStatus (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.getTabletServerStatus", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.getTabletServerStatus");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.getTabletServerStatus");
}
TabletClientService_getTabletServerStatus_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.getTabletServerStatus", bytes);
}
TabletClientService_getTabletServerStatus_result result;
try
{
iface_->getTabletServerStatus (result.success, args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.getTabletServerStatus");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getTabletServerStatus",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.getTabletServerStatus");
}
oprot->writeMessageBegin ("getTabletServerStatus",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.getTabletServerStatus", bytes);
}
}
void
TabletClientServiceProcessor::process_getTabletStats (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.getTabletStats", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.getTabletStats");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.getTabletStats");
}
TabletClientService_getTabletStats_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.getTabletStats", bytes);
}
TabletClientService_getTabletStats_result result;
try
{
iface_->getTabletStats (result.success, args.tinfo,
args.credentials, args.tableId);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.getTabletStats");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getTabletStats", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.getTabletStats");
}
oprot->writeMessageBegin ("getTabletStats",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.getTabletStats", bytes);
}
}
void
TabletClientServiceProcessor::process_getHistoricalStats (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.getHistoricalStats", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.getHistoricalStats");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.getHistoricalStats");
}
TabletClientService_getHistoricalStats_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.getHistoricalStats", bytes);
}
TabletClientService_getHistoricalStats_result result;
try
{
iface_->getHistoricalStats (result.success, args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.getHistoricalStats");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getHistoricalStats",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.getHistoricalStats");
}
oprot->writeMessageBegin ("getHistoricalStats",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.getHistoricalStats", bytes);
}
}
void
TabletClientServiceProcessor::process_halt (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.halt", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "TabletClientService.halt");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"TabletClientService.halt");
}
TabletClientService_halt_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"TabletClientService.halt",
bytes);
}
TabletClientService_halt_result result;
try
{
iface_->halt (args.tinfo, args.credentials, args.lock);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.halt");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"halt", ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (ctx,
"TabletClientService.halt");
}
oprot->writeMessageBegin ("halt",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (ctx,
"TabletClientService.halt",
bytes);
}
}
void
TabletClientServiceProcessor::process_fastHalt (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.fastHalt", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.fastHalt");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"TabletClientService.fastHalt");
}
TabletClientService_fastHalt_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"TabletClientService.fastHalt",
bytes);
}
try
{
iface_->fastHalt (args.tinfo, args.credentials, args.lock);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.fastHalt");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.fastHalt");
}
return;
}
void
TabletClientServiceProcessor::process_getActiveScans (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.getActiveScans", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.getActiveScans");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.getActiveScans");
}
TabletClientService_getActiveScans_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.getActiveScans", bytes);
}
TabletClientService_getActiveScans_result result;
try
{
iface_->getActiveScans (result.success, args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.getActiveScans");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getActiveScans", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.getActiveScans");
}
oprot->writeMessageBegin ("getActiveScans",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.getActiveScans", bytes);
}
}
void
TabletClientServiceProcessor::process_getActiveCompactions (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.getActiveCompactions", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.getActiveCompactions");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.getActiveCompactions");
}
TabletClientService_getActiveCompactions_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.getActiveCompactions", bytes);
}
TabletClientService_getActiveCompactions_result result;
try
{
iface_->getActiveCompactions (result.success, args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.getActiveCompactions");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getActiveCompactions",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "TabletClientService.getActiveCompactions");
}
oprot->writeMessageBegin ("getActiveCompactions",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "TabletClientService.getActiveCompactions", bytes);
}
}
void
TabletClientServiceProcessor::process_removeLogs (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"TabletClientService.removeLogs", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"TabletClientService.removeLogs");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "TabletClientService.removeLogs");
}
TabletClientService_removeLogs_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "TabletClientService.removeLogs", bytes);
}
try
{
iface_->removeLogs (args.tinfo, args.credentials,
args.filenames);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TabletClientService.removeLogs");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "TabletClientService.removeLogs");
}
return;
}
::boost::shared_ptr<::apache::thrift::TProcessor>
TabletClientServiceProcessorFactory::getProcessor (
const ::apache::thrift::TConnectionInfo& connInfo)
{
::apache::thrift::ReleaseHandler<TabletClientServiceIfFactory> cleanup (
handlerFactory_);
::boost::shared_ptr<TabletClientServiceIf> handler (
handlerFactory_->getHandler (connInfo), cleanup);
::boost::shared_ptr<::apache::thrift::TProcessor> processor (
new TabletClientServiceProcessor (handler));
return processor;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef MasterClientService_H
#define MasterClientService_H
#include <thrift/TDispatchProcessor.h>
#include "master_types.h"
#include "FateService.h"
namespace org { namespace apache { namespace accumulo { namespace core { namespace master { namespace thrift {
class MasterClientServiceIf : virtual public FateServiceIf {
public:
virtual ~MasterClientServiceIf() {}
virtual int64_t initiateFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName) = 0;
virtual void waitForFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& startRow, const std::string& endRow, const int64_t flushID, const int64_t maxLoops) = 0;
virtual void setTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property, const std::string& value) = 0;
virtual void removeTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property) = 0;
virtual void setNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property, const std::string& value) = 0;
virtual void removeNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property) = 0;
virtual void setMasterGoalState(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const MasterGoalState::type state) = 0;
virtual void shutdown(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const bool stopTabletServers) = 0;
virtual void shutdownTabletServer(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tabletServer, const bool force) = 0;
virtual void setSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property, const std::string& value) = 0;
virtual void removeSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property) = 0;
virtual void getMasterStats(MasterMonitorInfo& _return, const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials) = 0;
virtual void reportSplitExtent(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletSplit& split) = 0;
virtual void reportTabletStatus(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletLoadState::type status, const ::org::apache::accumulo::core::data::thrift::TKeyExtent& tablet) = 0;
};
class MasterClientServiceIfFactory : virtual public FateServiceIfFactory {
public:
typedef MasterClientServiceIf Handler;
virtual ~MasterClientServiceIfFactory() {}
virtual MasterClientServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
virtual void releaseHandler(FateServiceIf* /* handler */) = 0;
};
class MasterClientServiceIfSingletonFactory : virtual public MasterClientServiceIfFactory {
public:
MasterClientServiceIfSingletonFactory(const boost::shared_ptr<MasterClientServiceIf>& iface) : iface_(iface) {}
virtual ~MasterClientServiceIfSingletonFactory() {}
virtual MasterClientServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
return iface_.get();
}
virtual void releaseHandler(FateServiceIf* /* handler */) {}
protected:
boost::shared_ptr<MasterClientServiceIf> iface_;
};
class MasterClientServiceNull : virtual public MasterClientServiceIf , virtual public FateServiceNull {
public:
virtual ~MasterClientServiceNull() {}
int64_t initiateFlush(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* tableName */) {
int64_t _return = 0;
return _return;
}
void waitForFlush(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* tableName */, const std::string& /* startRow */, const std::string& /* endRow */, const int64_t /* flushID */, const int64_t /* maxLoops */) {
return;
}
void setTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* tableName */, const std::string& /* property */, const std::string& /* value */) {
return;
}
void removeTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* tableName */, const std::string& /* property */) {
return;
}
void setNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* ns */, const std::string& /* property */, const std::string& /* value */) {
return;
}
void removeNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* ns */, const std::string& /* property */) {
return;
}
void setMasterGoalState(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const MasterGoalState::type /* state */) {
return;
}
void shutdown(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const bool /* stopTabletServers */) {
return;
}
void shutdownTabletServer(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* tabletServer */, const bool /* force */) {
return;
}
void setSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* property */, const std::string& /* value */) {
return;
}
void removeSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* property */) {
return;
}
void getMasterStats(MasterMonitorInfo& /* _return */, const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */) {
return;
}
void reportSplitExtent(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* serverName */, const TabletSplit& /* split */) {
return;
}
void reportTabletStatus(const ::org::apache::accumulo::trace::thrift::TInfo& /* tinfo */, const ::org::apache::accumulo::core::security::thrift::TCredentials& /* credentials */, const std::string& /* serverName */, const TabletLoadState::type /* status */, const ::org::apache::accumulo::core::data::thrift::TKeyExtent& /* tablet */) {
return;
}
};
typedef struct _MasterClientService_initiateFlush_args__isset {
_MasterClientService_initiateFlush_args__isset() : tinfo(false), credentials(false), tableName(false) {}
bool tinfo :1;
bool credentials :1;
bool tableName :1;
} _MasterClientService_initiateFlush_args__isset;
class MasterClientService_initiateFlush_args {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x01,0x07,0x4F,0xA9,0xCF,0x7C,0xC6,0x03,0x56,0x8C,0x30,0x6F,0xC5,0x5E,0xC5,0xB0};
MasterClientService_initiateFlush_args(const MasterClientService_initiateFlush_args&);
MasterClientService_initiateFlush_args& operator=(const MasterClientService_initiateFlush_args&);
MasterClientService_initiateFlush_args() : tableName() {
}
virtual ~MasterClientService_initiateFlush_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string tableName;
_MasterClientService_initiateFlush_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_tableName(const std::string& val);
bool operator == (const MasterClientService_initiateFlush_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(tableName == rhs.tableName))
return false;
return true;
}
bool operator != (const MasterClientService_initiateFlush_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_initiateFlush_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_initiateFlush_args& obj);
};
class MasterClientService_initiateFlush_pargs {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x01,0x07,0x4F,0xA9,0xCF,0x7C,0xC6,0x03,0x56,0x8C,0x30,0x6F,0xC5,0x5E,0xC5,0xB0};
virtual ~MasterClientService_initiateFlush_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* tableName;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_initiateFlush_pargs& obj);
};
typedef struct _MasterClientService_initiateFlush_result__isset {
_MasterClientService_initiateFlush_result__isset() : success(false), sec(false), tope(false) {}
bool success :1;
bool sec :1;
bool tope :1;
} _MasterClientService_initiateFlush_result__isset;
class MasterClientService_initiateFlush_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0xCF,0x52,0x1E,0x6B,0xC7,0x0B,0x8F,0x06,0x59,0x83,0x5F,0x64,0x40,0x8D,0x5A,0x55};
MasterClientService_initiateFlush_result(const MasterClientService_initiateFlush_result&);
MasterClientService_initiateFlush_result& operator=(const MasterClientService_initiateFlush_result&);
MasterClientService_initiateFlush_result() : success(0) {
}
virtual ~MasterClientService_initiateFlush_result() throw();
int64_t success;
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_initiateFlush_result__isset __isset;
void __set_success(const int64_t val);
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
void __set_tope(const ::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException& val);
bool operator == (const MasterClientService_initiateFlush_result & rhs) const
{
if (!(success == rhs.success))
return false;
if (!(sec == rhs.sec))
return false;
if (!(tope == rhs.tope))
return false;
return true;
}
bool operator != (const MasterClientService_initiateFlush_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_initiateFlush_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_initiateFlush_result& obj);
};
typedef struct _MasterClientService_initiateFlush_presult__isset {
_MasterClientService_initiateFlush_presult__isset() : success(false), sec(false), tope(false) {}
bool success :1;
bool sec :1;
bool tope :1;
} _MasterClientService_initiateFlush_presult__isset;
class MasterClientService_initiateFlush_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0xCF,0x52,0x1E,0x6B,0xC7,0x0B,0x8F,0x06,0x59,0x83,0x5F,0x64,0x40,0x8D,0x5A,0x55};
virtual ~MasterClientService_initiateFlush_presult() throw();
int64_t* success;
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_initiateFlush_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_initiateFlush_presult& obj);
};
typedef struct _MasterClientService_waitForFlush_args__isset {
_MasterClientService_waitForFlush_args__isset() : tinfo(false), credentials(false), tableName(false), startRow(false), endRow(false), flushID(false), maxLoops(false) {}
bool tinfo :1;
bool credentials :1;
bool tableName :1;
bool startRow :1;
bool endRow :1;
bool flushID :1;
bool maxLoops :1;
} _MasterClientService_waitForFlush_args__isset;
class MasterClientService_waitForFlush_args {
public:
static const char* ascii_fingerprint; // = "956F6826A87169936AF35805E489A6F6";
static const uint8_t binary_fingerprint[16]; // = {0x95,0x6F,0x68,0x26,0xA8,0x71,0x69,0x93,0x6A,0xF3,0x58,0x05,0xE4,0x89,0xA6,0xF6};
MasterClientService_waitForFlush_args(const MasterClientService_waitForFlush_args&);
MasterClientService_waitForFlush_args& operator=(const MasterClientService_waitForFlush_args&);
MasterClientService_waitForFlush_args() : tableName(), startRow(), endRow(), flushID(0), maxLoops(0) {
}
virtual ~MasterClientService_waitForFlush_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string tableName;
std::string startRow;
std::string endRow;
int64_t flushID;
int64_t maxLoops;
_MasterClientService_waitForFlush_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_tableName(const std::string& val);
void __set_startRow(const std::string& val);
void __set_endRow(const std::string& val);
void __set_flushID(const int64_t val);
void __set_maxLoops(const int64_t val);
bool operator == (const MasterClientService_waitForFlush_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(tableName == rhs.tableName))
return false;
if (!(startRow == rhs.startRow))
return false;
if (!(endRow == rhs.endRow))
return false;
if (!(flushID == rhs.flushID))
return false;
if (!(maxLoops == rhs.maxLoops))
return false;
return true;
}
bool operator != (const MasterClientService_waitForFlush_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_waitForFlush_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_waitForFlush_args& obj);
};
class MasterClientService_waitForFlush_pargs {
public:
static const char* ascii_fingerprint; // = "956F6826A87169936AF35805E489A6F6";
static const uint8_t binary_fingerprint[16]; // = {0x95,0x6F,0x68,0x26,0xA8,0x71,0x69,0x93,0x6A,0xF3,0x58,0x05,0xE4,0x89,0xA6,0xF6};
virtual ~MasterClientService_waitForFlush_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* tableName;
const std::string* startRow;
const std::string* endRow;
const int64_t* flushID;
const int64_t* maxLoops;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_waitForFlush_pargs& obj);
};
typedef struct _MasterClientService_waitForFlush_result__isset {
_MasterClientService_waitForFlush_result__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_waitForFlush_result__isset;
class MasterClientService_waitForFlush_result {
public:
static const char* ascii_fingerprint; // = "<KEY>F0A";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
MasterClientService_waitForFlush_result(const MasterClientService_waitForFlush_result&);
MasterClientService_waitForFlush_result& operator=(const MasterClientService_waitForFlush_result&);
MasterClientService_waitForFlush_result() {
}
virtual ~MasterClientService_waitForFlush_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_waitForFlush_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
void __set_tope(const ::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException& val);
bool operator == (const MasterClientService_waitForFlush_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
if (!(tope == rhs.tope))
return false;
return true;
}
bool operator != (const MasterClientService_waitForFlush_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_waitForFlush_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_waitForFlush_result& obj);
};
typedef struct _MasterClientService_waitForFlush_presult__isset {
_MasterClientService_waitForFlush_presult__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_waitForFlush_presult__isset;
class MasterClientService_waitForFlush_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
virtual ~MasterClientService_waitForFlush_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_waitForFlush_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_waitForFlush_presult& obj);
};
typedef struct _MasterClientService_setTableProperty_args__isset {
_MasterClientService_setTableProperty_args__isset() : tinfo(false), credentials(false), tableName(false), property(false), value(false) {}
bool tinfo :1;
bool credentials :1;
bool tableName :1;
bool property :1;
bool value :1;
} _MasterClientService_setTableProperty_args__isset;
class MasterClientService_setTableProperty_args {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x71,0x81,0x8B,0x86,0x25,0x8E,0x7C,0x92,0xB0,0x4C,0xBD,0x7B,0x8C,0xCD,0xAD,0xB8};
MasterClientService_setTableProperty_args(const MasterClientService_setTableProperty_args&);
MasterClientService_setTableProperty_args& operator=(const MasterClientService_setTableProperty_args&);
MasterClientService_setTableProperty_args() : tableName(), property(), value() {
}
virtual ~MasterClientService_setTableProperty_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string tableName;
std::string property;
std::string value;
_MasterClientService_setTableProperty_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_tableName(const std::string& val);
void __set_property(const std::string& val);
void __set_value(const std::string& val);
bool operator == (const MasterClientService_setTableProperty_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(tableName == rhs.tableName))
return false;
if (!(property == rhs.property))
return false;
if (!(value == rhs.value))
return false;
return true;
}
bool operator != (const MasterClientService_setTableProperty_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setTableProperty_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setTableProperty_args& obj);
};
class MasterClientService_setTableProperty_pargs {
public:
static const char* ascii_fingerprint; // = "71818B86258E7C92B04CBD<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x71,0x81,0x8B,0x86,0x25,0x8E,0x7C,0x92,0xB0,0x4C,0xBD,0x7B,0x8C,0xCD,0xAD,0xB8};
virtual ~MasterClientService_setTableProperty_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* tableName;
const std::string* property;
const std::string* value;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setTableProperty_pargs& obj);
};
typedef struct _MasterClientService_setTableProperty_result__isset {
_MasterClientService_setTableProperty_result__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_setTableProperty_result__isset;
class MasterClientService_setTableProperty_result {
public:
static const char* ascii_fingerprint; // = "4D27D81C231C927DC5A8A3697BB71F0A";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
MasterClientService_setTableProperty_result(const MasterClientService_setTableProperty_result&);
MasterClientService_setTableProperty_result& operator=(const MasterClientService_setTableProperty_result&);
MasterClientService_setTableProperty_result() {
}
virtual ~MasterClientService_setTableProperty_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_setTableProperty_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
void __set_tope(const ::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException& val);
bool operator == (const MasterClientService_setTableProperty_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
if (!(tope == rhs.tope))
return false;
return true;
}
bool operator != (const MasterClientService_setTableProperty_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setTableProperty_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setTableProperty_result& obj);
};
typedef struct _MasterClientService_setTableProperty_presult__isset {
_MasterClientService_setTableProperty_presult__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_setTableProperty_presult__isset;
class MasterClientService_setTableProperty_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
virtual ~MasterClientService_setTableProperty_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_setTableProperty_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setTableProperty_presult& obj);
};
typedef struct _MasterClientService_removeTableProperty_args__isset {
_MasterClientService_removeTableProperty_args__isset() : tinfo(false), credentials(false), tableName(false), property(false) {}
bool tinfo :1;
bool credentials :1;
bool tableName :1;
bool property :1;
} _MasterClientService_removeTableProperty_args__isset;
class MasterClientService_removeTableProperty_args {
public:
static const char* ascii_fingerprint; // = "8<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x82,0xC9,0x42,0x4B,0x26,0x34,0x4B,0x1C,0xF0,0x4C,0x9C,0xE4,0xCC,0x4B,0x25,0xFB};
MasterClientService_removeTableProperty_args(const MasterClientService_removeTableProperty_args&);
MasterClientService_removeTableProperty_args& operator=(const MasterClientService_removeTableProperty_args&);
MasterClientService_removeTableProperty_args() : tableName(), property() {
}
virtual ~MasterClientService_removeTableProperty_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string tableName;
std::string property;
_MasterClientService_removeTableProperty_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_tableName(const std::string& val);
void __set_property(const std::string& val);
bool operator == (const MasterClientService_removeTableProperty_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(tableName == rhs.tableName))
return false;
if (!(property == rhs.property))
return false;
return true;
}
bool operator != (const MasterClientService_removeTableProperty_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_removeTableProperty_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeTableProperty_args& obj);
};
class MasterClientService_removeTableProperty_pargs {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x82,0xC9,0x42,0x4B,0x26,0x34,0x4B,0x1C,0xF0,0x4C,0x9C,0xE4,0xCC,0x4B,0x25,0xFB};
virtual ~MasterClientService_removeTableProperty_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* tableName;
const std::string* property;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeTableProperty_pargs& obj);
};
typedef struct _MasterClientService_removeTableProperty_result__isset {
_MasterClientService_removeTableProperty_result__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_removeTableProperty_result__isset;
class MasterClientService_removeTableProperty_result {
public:
static const char* ascii_fingerprint; // = "4D27D81C231C927DC5A8A3697BB71F0A";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
MasterClientService_removeTableProperty_result(const MasterClientService_removeTableProperty_result&);
MasterClientService_removeTableProperty_result& operator=(const MasterClientService_removeTableProperty_result&);
MasterClientService_removeTableProperty_result() {
}
virtual ~MasterClientService_removeTableProperty_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_removeTableProperty_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
void __set_tope(const ::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException& val);
bool operator == (const MasterClientService_removeTableProperty_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
if (!(tope == rhs.tope))
return false;
return true;
}
bool operator != (const MasterClientService_removeTableProperty_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_removeTableProperty_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeTableProperty_result& obj);
};
typedef struct _MasterClientService_removeTableProperty_presult__isset {
_MasterClientService_removeTableProperty_presult__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_removeTableProperty_presult__isset;
class MasterClientService_removeTableProperty_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
virtual ~MasterClientService_removeTableProperty_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_removeTableProperty_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeTableProperty_presult& obj);
};
typedef struct _MasterClientService_setNamespaceProperty_args__isset {
_MasterClientService_setNamespaceProperty_args__isset() : tinfo(false), credentials(false), ns(false), property(false), value(false) {}
bool tinfo :1;
bool credentials :1;
bool ns :1;
bool property :1;
bool value :1;
} _MasterClientService_setNamespaceProperty_args__isset;
class MasterClientService_setNamespaceProperty_args {
public:
static const char* ascii_fingerprint; // = "7<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x71,0x81,0x8B,0x86,0x25,0x8E,0x7C,0x92,0xB0,0x4C,0xBD,0x7B,0x8C,0xCD,0xAD,0xB8};
MasterClientService_setNamespaceProperty_args(const MasterClientService_setNamespaceProperty_args&);
MasterClientService_setNamespaceProperty_args& operator=(const MasterClientService_setNamespaceProperty_args&);
MasterClientService_setNamespaceProperty_args() : ns(), property(), value() {
}
virtual ~MasterClientService_setNamespaceProperty_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string ns;
std::string property;
std::string value;
_MasterClientService_setNamespaceProperty_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_ns(const std::string& val);
void __set_property(const std::string& val);
void __set_value(const std::string& val);
bool operator == (const MasterClientService_setNamespaceProperty_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(ns == rhs.ns))
return false;
if (!(property == rhs.property))
return false;
if (!(value == rhs.value))
return false;
return true;
}
bool operator != (const MasterClientService_setNamespaceProperty_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setNamespaceProperty_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setNamespaceProperty_args& obj);
};
class MasterClientService_setNamespaceProperty_pargs {
public:
static const char* ascii_fingerprint; // = "7<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x71,0x81,0x8B,0x86,0x25,0x8E,0x7C,0x92,0xB0,0x4C,0xBD,0x7B,0x8C,0xCD,0xAD,0xB8};
virtual ~MasterClientService_setNamespaceProperty_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* ns;
const std::string* property;
const std::string* value;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setNamespaceProperty_pargs& obj);
};
typedef struct _MasterClientService_setNamespaceProperty_result__isset {
_MasterClientService_setNamespaceProperty_result__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_setNamespaceProperty_result__isset;
class MasterClientService_setNamespaceProperty_result {
public:
static const char* ascii_fingerprint; // = "4D27D81C231C927DC5A8A3697BB71F0A";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
MasterClientService_setNamespaceProperty_result(const MasterClientService_setNamespaceProperty_result&);
MasterClientService_setNamespaceProperty_result& operator=(const MasterClientService_setNamespaceProperty_result&);
MasterClientService_setNamespaceProperty_result() {
}
virtual ~MasterClientService_setNamespaceProperty_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_setNamespaceProperty_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
void __set_tope(const ::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException& val);
bool operator == (const MasterClientService_setNamespaceProperty_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
if (!(tope == rhs.tope))
return false;
return true;
}
bool operator != (const MasterClientService_setNamespaceProperty_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setNamespaceProperty_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setNamespaceProperty_result& obj);
};
typedef struct _MasterClientService_setNamespaceProperty_presult__isset {
_MasterClientService_setNamespaceProperty_presult__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_setNamespaceProperty_presult__isset;
class MasterClientService_setNamespaceProperty_presult {
public:
static const char* ascii_fingerprint; // = "4<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
virtual ~MasterClientService_setNamespaceProperty_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_setNamespaceProperty_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setNamespaceProperty_presult& obj);
};
typedef struct _MasterClientService_removeNamespaceProperty_args__isset {
_MasterClientService_removeNamespaceProperty_args__isset() : tinfo(false), credentials(false), ns(false), property(false) {}
bool tinfo :1;
bool credentials :1;
bool ns :1;
bool property :1;
} _MasterClientService_removeNamespaceProperty_args__isset;
class MasterClientService_removeNamespaceProperty_args {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x82,0xC9,0x42,0x4B,0x26,0x34,0x4B,0x1C,0xF0,0x4C,0x9C,0xE4,0xCC,0x4B,0x25,0xFB};
MasterClientService_removeNamespaceProperty_args(const MasterClientService_removeNamespaceProperty_args&);
MasterClientService_removeNamespaceProperty_args& operator=(const MasterClientService_removeNamespaceProperty_args&);
MasterClientService_removeNamespaceProperty_args() : ns(), property() {
}
virtual ~MasterClientService_removeNamespaceProperty_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string ns;
std::string property;
_MasterClientService_removeNamespaceProperty_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_ns(const std::string& val);
void __set_property(const std::string& val);
bool operator == (const MasterClientService_removeNamespaceProperty_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(ns == rhs.ns))
return false;
if (!(property == rhs.property))
return false;
return true;
}
bool operator != (const MasterClientService_removeNamespaceProperty_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_removeNamespaceProperty_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeNamespaceProperty_args& obj);
};
class MasterClientService_removeNamespaceProperty_pargs {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x82,0xC9,0x42,0x4B,0x26,0x34,0x4B,0x1C,0xF0,0x4C,0x9C,0xE4,0xCC,0x4B,0x25,0xFB};
virtual ~MasterClientService_removeNamespaceProperty_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* ns;
const std::string* property;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeNamespaceProperty_pargs& obj);
};
typedef struct _MasterClientService_removeNamespaceProperty_result__isset {
_MasterClientService_removeNamespaceProperty_result__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_removeNamespaceProperty_result__isset;
class MasterClientService_removeNamespaceProperty_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
MasterClientService_removeNamespaceProperty_result(const MasterClientService_removeNamespaceProperty_result&);
MasterClientService_removeNamespaceProperty_result& operator=(const MasterClientService_removeNamespaceProperty_result&);
MasterClientService_removeNamespaceProperty_result() {
}
virtual ~MasterClientService_removeNamespaceProperty_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_removeNamespaceProperty_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
void __set_tope(const ::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException& val);
bool operator == (const MasterClientService_removeNamespaceProperty_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
if (!(tope == rhs.tope))
return false;
return true;
}
bool operator != (const MasterClientService_removeNamespaceProperty_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_removeNamespaceProperty_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeNamespaceProperty_result& obj);
};
typedef struct _MasterClientService_removeNamespaceProperty_presult__isset {
_MasterClientService_removeNamespaceProperty_presult__isset() : sec(false), tope(false) {}
bool sec :1;
bool tope :1;
} _MasterClientService_removeNamespaceProperty_presult__isset;
class MasterClientService_removeNamespaceProperty_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>BB71F0A";
static const uint8_t binary_fingerprint[16]; // = {0x4D,0x27,0xD8,0x1C,0x23,0x1C,0x92,0x7D,0xC5,0xA8,0xA3,0x69,0x7B,0xB7,0x1F,0x0A};
virtual ~MasterClientService_removeNamespaceProperty_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException tope;
_MasterClientService_removeNamespaceProperty_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeNamespaceProperty_presult& obj);
};
typedef struct _MasterClientService_setMasterGoalState_args__isset {
_MasterClientService_setMasterGoalState_args__isset() : tinfo(false), credentials(false), state(false) {}
bool tinfo :1;
bool credentials :1;
bool state :1;
} _MasterClientService_setMasterGoalState_args__isset;
class MasterClientService_setMasterGoalState_args {
public:
static const char* ascii_fingerprint; // = "300F6C0EDC2EAA93985E1C90600C8812";
static const uint8_t binary_fingerprint[16]; // = {0x30,0x0F,0x6C,0x0E,0xDC,0x2E,0xAA,0x93,0x98,0x5E,0x1C,0x90,0x60,0x0C,0x88,0x12};
MasterClientService_setMasterGoalState_args(const MasterClientService_setMasterGoalState_args&);
MasterClientService_setMasterGoalState_args& operator=(const MasterClientService_setMasterGoalState_args&);
MasterClientService_setMasterGoalState_args() : state((MasterGoalState::type)0) {
}
virtual ~MasterClientService_setMasterGoalState_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
MasterGoalState::type state;
_MasterClientService_setMasterGoalState_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_state(const MasterGoalState::type val);
bool operator == (const MasterClientService_setMasterGoalState_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(state == rhs.state))
return false;
return true;
}
bool operator != (const MasterClientService_setMasterGoalState_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setMasterGoalState_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setMasterGoalState_args& obj);
};
class MasterClientService_setMasterGoalState_pargs {
public:
static const char* ascii_fingerprint; // = "300F6C0EDC2EAA93985E1C90600C8812";
static const uint8_t binary_fingerprint[16]; // = {0x30,0x0F,0x6C,0x0E,0xDC,0x2E,0xAA,0x93,0x98,0x5E,0x1C,0x90,0x60,0x0C,0x88,0x12};
virtual ~MasterClientService_setMasterGoalState_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const MasterGoalState::type* state;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setMasterGoalState_pargs& obj);
};
typedef struct _MasterClientService_setMasterGoalState_result__isset {
_MasterClientService_setMasterGoalState_result__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_setMasterGoalState_result__isset;
class MasterClientService_setMasterGoalState_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
MasterClientService_setMasterGoalState_result(const MasterClientService_setMasterGoalState_result&);
MasterClientService_setMasterGoalState_result& operator=(const MasterClientService_setMasterGoalState_result&);
MasterClientService_setMasterGoalState_result() {
}
virtual ~MasterClientService_setMasterGoalState_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_setMasterGoalState_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
bool operator == (const MasterClientService_setMasterGoalState_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
return true;
}
bool operator != (const MasterClientService_setMasterGoalState_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setMasterGoalState_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setMasterGoalState_result& obj);
};
typedef struct _MasterClientService_setMasterGoalState_presult__isset {
_MasterClientService_setMasterGoalState_presult__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_setMasterGoalState_presult__isset;
class MasterClientService_setMasterGoalState_presult {
public:
static const char* ascii_fingerprint; // = "2<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
virtual ~MasterClientService_setMasterGoalState_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_setMasterGoalState_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setMasterGoalState_presult& obj);
};
typedef struct _MasterClientService_shutdown_args__isset {
_MasterClientService_shutdown_args__isset() : tinfo(false), credentials(false), stopTabletServers(false) {}
bool tinfo :1;
bool credentials :1;
bool stopTabletServers :1;
} _MasterClientService_shutdown_args__isset;
class MasterClientService_shutdown_args {
public:
static const char* ascii_fingerprint; // = "8B608B6568E00E2E773DCA6B90206416";
static const uint8_t binary_fingerprint[16]; // = {0x8B,0x60,0x8B,0x65,0x68,0xE0,0x0E,0x2E,0x77,0x3D,0xCA,0x6B,0x90,0x20,0x64,0x16};
MasterClientService_shutdown_args(const MasterClientService_shutdown_args&);
MasterClientService_shutdown_args& operator=(const MasterClientService_shutdown_args&);
MasterClientService_shutdown_args() : stopTabletServers(0) {
}
virtual ~MasterClientService_shutdown_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
bool stopTabletServers;
_MasterClientService_shutdown_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_stopTabletServers(const bool val);
bool operator == (const MasterClientService_shutdown_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(stopTabletServers == rhs.stopTabletServers))
return false;
return true;
}
bool operator != (const MasterClientService_shutdown_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_shutdown_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdown_args& obj);
};
class MasterClientService_shutdown_pargs {
public:
static const char* ascii_fingerprint; // = "8B608B6568E00E2E773DCA6B90206416";
static const uint8_t binary_fingerprint[16]; // = {0x8B,0x60,0x8B,0x65,0x68,0xE0,0x0E,0x2E,0x77,0x3D,0xCA,0x6B,0x90,0x20,0x64,0x16};
virtual ~MasterClientService_shutdown_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const bool* stopTabletServers;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdown_pargs& obj);
};
typedef struct _MasterClientService_shutdown_result__isset {
_MasterClientService_shutdown_result__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_shutdown_result__isset;
class MasterClientService_shutdown_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
MasterClientService_shutdown_result(const MasterClientService_shutdown_result&);
MasterClientService_shutdown_result& operator=(const MasterClientService_shutdown_result&);
MasterClientService_shutdown_result() {
}
virtual ~MasterClientService_shutdown_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_shutdown_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
bool operator == (const MasterClientService_shutdown_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
return true;
}
bool operator != (const MasterClientService_shutdown_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_shutdown_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdown_result& obj);
};
typedef struct _MasterClientService_shutdown_presult__isset {
_MasterClientService_shutdown_presult__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_shutdown_presult__isset;
class MasterClientService_shutdown_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
virtual ~MasterClientService_shutdown_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_shutdown_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdown_presult& obj);
};
typedef struct _MasterClientService_shutdownTabletServer_args__isset {
_MasterClientService_shutdownTabletServer_args__isset() : tinfo(false), credentials(false), tabletServer(false), force(false) {}
bool tinfo :1;
bool credentials :1;
bool tabletServer :1;
bool force :1;
} _MasterClientService_shutdownTabletServer_args__isset;
class MasterClientService_shutdownTabletServer_args {
public:
static const char* ascii_fingerprint; // = "B353174E0D87552EBDBAC73E7103D52D";
static const uint8_t binary_fingerprint[16]; // = {0xB3,0x53,0x17,0x4E,0x0D,0x87,0x55,0x2E,0xBD,0xBA,0xC7,0x3E,0x71,0x03,0xD5,0x2D};
MasterClientService_shutdownTabletServer_args(const MasterClientService_shutdownTabletServer_args&);
MasterClientService_shutdownTabletServer_args& operator=(const MasterClientService_shutdownTabletServer_args&);
MasterClientService_shutdownTabletServer_args() : tabletServer(), force(0) {
}
virtual ~MasterClientService_shutdownTabletServer_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string tabletServer;
bool force;
_MasterClientService_shutdownTabletServer_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_tabletServer(const std::string& val);
void __set_force(const bool val);
bool operator == (const MasterClientService_shutdownTabletServer_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(tabletServer == rhs.tabletServer))
return false;
if (!(force == rhs.force))
return false;
return true;
}
bool operator != (const MasterClientService_shutdownTabletServer_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_shutdownTabletServer_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdownTabletServer_args& obj);
};
class MasterClientService_shutdownTabletServer_pargs {
public:
static const char* ascii_fingerprint; // = "B353174E0D87552EBDBAC73E7103D52D";
static const uint8_t binary_fingerprint[16]; // = {0xB3,0x53,0x17,0x4E,0x0D,0x87,0x55,0x2E,0xBD,0xBA,0xC7,0x3E,0x71,0x03,0xD5,0x2D};
virtual ~MasterClientService_shutdownTabletServer_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* tabletServer;
const bool* force;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdownTabletServer_pargs& obj);
};
typedef struct _MasterClientService_shutdownTabletServer_result__isset {
_MasterClientService_shutdownTabletServer_result__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_shutdownTabletServer_result__isset;
class MasterClientService_shutdownTabletServer_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
MasterClientService_shutdownTabletServer_result(const MasterClientService_shutdownTabletServer_result&);
MasterClientService_shutdownTabletServer_result& operator=(const MasterClientService_shutdownTabletServer_result&);
MasterClientService_shutdownTabletServer_result() {
}
virtual ~MasterClientService_shutdownTabletServer_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_shutdownTabletServer_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
bool operator == (const MasterClientService_shutdownTabletServer_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
return true;
}
bool operator != (const MasterClientService_shutdownTabletServer_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_shutdownTabletServer_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdownTabletServer_result& obj);
};
typedef struct _MasterClientService_shutdownTabletServer_presult__isset {
_MasterClientService_shutdownTabletServer_presult__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_shutdownTabletServer_presult__isset;
class MasterClientService_shutdownTabletServer_presult {
public:
static const char* ascii_fingerprint; // = "2EFF1E534C8CBE58ACF12DBD7FBA560E";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
virtual ~MasterClientService_shutdownTabletServer_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_shutdownTabletServer_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_shutdownTabletServer_presult& obj);
};
typedef struct _MasterClientService_setSystemProperty_args__isset {
_MasterClientService_setSystemProperty_args__isset() : tinfo(false), credentials(false), property(false), value(false) {}
bool tinfo :1;
bool credentials :1;
bool property :1;
bool value :1;
} _MasterClientService_setSystemProperty_args__isset;
class MasterClientService_setSystemProperty_args {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x82,0xC9,0x42,0x4B,0x26,0x34,0x4B,0x1C,0xF0,0x4C,0x9C,0xE4,0xCC,0x4B,0x25,0xFB};
MasterClientService_setSystemProperty_args(const MasterClientService_setSystemProperty_args&);
MasterClientService_setSystemProperty_args& operator=(const MasterClientService_setSystemProperty_args&);
MasterClientService_setSystemProperty_args() : property(), value() {
}
virtual ~MasterClientService_setSystemProperty_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string property;
std::string value;
_MasterClientService_setSystemProperty_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_property(const std::string& val);
void __set_value(const std::string& val);
bool operator == (const MasterClientService_setSystemProperty_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(property == rhs.property))
return false;
if (!(value == rhs.value))
return false;
return true;
}
bool operator != (const MasterClientService_setSystemProperty_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setSystemProperty_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setSystemProperty_args& obj);
};
class MasterClientService_setSystemProperty_pargs {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x82,0xC9,0x42,0x4B,0x26,0x34,0x4B,0x1C,0xF0,0x4C,0x9C,0xE4,0xCC,0x4B,0x25,0xFB};
virtual ~MasterClientService_setSystemProperty_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* property;
const std::string* value;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setSystemProperty_pargs& obj);
};
typedef struct _MasterClientService_setSystemProperty_result__isset {
_MasterClientService_setSystemProperty_result__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_setSystemProperty_result__isset;
class MasterClientService_setSystemProperty_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
MasterClientService_setSystemProperty_result(const MasterClientService_setSystemProperty_result&);
MasterClientService_setSystemProperty_result& operator=(const MasterClientService_setSystemProperty_result&);
MasterClientService_setSystemProperty_result() {
}
virtual ~MasterClientService_setSystemProperty_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_setSystemProperty_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
bool operator == (const MasterClientService_setSystemProperty_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
return true;
}
bool operator != (const MasterClientService_setSystemProperty_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_setSystemProperty_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setSystemProperty_result& obj);
};
typedef struct _MasterClientService_setSystemProperty_presult__isset {
_MasterClientService_setSystemProperty_presult__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_setSystemProperty_presult__isset;
class MasterClientService_setSystemProperty_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
virtual ~MasterClientService_setSystemProperty_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_setSystemProperty_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_setSystemProperty_presult& obj);
};
typedef struct _MasterClientService_removeSystemProperty_args__isset {
_MasterClientService_removeSystemProperty_args__isset() : tinfo(false), credentials(false), property(false) {}
bool tinfo :1;
bool credentials :1;
bool property :1;
} _MasterClientService_removeSystemProperty_args__isset;
class MasterClientService_removeSystemProperty_args {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x01,0x07,0x4F,0xA9,0xCF,0x7C,0xC6,0x03,0x56,0x8C,0x30,0x6F,0xC5,0x5E,0xC5,0xB0};
MasterClientService_removeSystemProperty_args(const MasterClientService_removeSystemProperty_args&);
MasterClientService_removeSystemProperty_args& operator=(const MasterClientService_removeSystemProperty_args&);
MasterClientService_removeSystemProperty_args() : property() {
}
virtual ~MasterClientService_removeSystemProperty_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string property;
_MasterClientService_removeSystemProperty_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_property(const std::string& val);
bool operator == (const MasterClientService_removeSystemProperty_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(property == rhs.property))
return false;
return true;
}
bool operator != (const MasterClientService_removeSystemProperty_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_removeSystemProperty_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeSystemProperty_args& obj);
};
class MasterClientService_removeSystemProperty_pargs {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x01,0x07,0x4F,0xA9,0xCF,0x7C,0xC6,0x03,0x56,0x8C,0x30,0x6F,0xC5,0x5E,0xC5,0xB0};
virtual ~MasterClientService_removeSystemProperty_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* property;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeSystemProperty_pargs& obj);
};
typedef struct _MasterClientService_removeSystemProperty_result__isset {
_MasterClientService_removeSystemProperty_result__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_removeSystemProperty_result__isset;
class MasterClientService_removeSystemProperty_result {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
MasterClientService_removeSystemProperty_result(const MasterClientService_removeSystemProperty_result&);
MasterClientService_removeSystemProperty_result& operator=(const MasterClientService_removeSystemProperty_result&);
MasterClientService_removeSystemProperty_result() {
}
virtual ~MasterClientService_removeSystemProperty_result() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_removeSystemProperty_result__isset __isset;
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
bool operator == (const MasterClientService_removeSystemProperty_result & rhs) const
{
if (!(sec == rhs.sec))
return false;
return true;
}
bool operator != (const MasterClientService_removeSystemProperty_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_removeSystemProperty_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeSystemProperty_result& obj);
};
typedef struct _MasterClientService_removeSystemProperty_presult__isset {
_MasterClientService_removeSystemProperty_presult__isset() : sec(false) {}
bool sec :1;
} _MasterClientService_removeSystemProperty_presult__isset;
class MasterClientService_removeSystemProperty_presult {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x2E,0xFF,0x1E,0x53,0x4C,0x8C,0xBE,0x58,0xAC,0xF1,0x2D,0xBD,0x7F,0xBA,0x56,0x0E};
virtual ~MasterClientService_removeSystemProperty_presult() throw();
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_removeSystemProperty_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_removeSystemProperty_presult& obj);
};
typedef struct _MasterClientService_getMasterStats_args__isset {
_MasterClientService_getMasterStats_args__isset() : tinfo(false), credentials(false) {}
bool tinfo :1;
bool credentials :1;
} _MasterClientService_getMasterStats_args__isset;
class MasterClientService_getMasterStats_args {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x05,0x55,0xE3,0x9F,0xE2,0xCB,0xB1,0x9B,0x29,0x00,0x0C,0xC0,0x17,0xA1,0x80,0x01};
MasterClientService_getMasterStats_args(const MasterClientService_getMasterStats_args&);
MasterClientService_getMasterStats_args& operator=(const MasterClientService_getMasterStats_args&);
MasterClientService_getMasterStats_args() {
}
virtual ~MasterClientService_getMasterStats_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
_MasterClientService_getMasterStats_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
bool operator == (const MasterClientService_getMasterStats_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
return true;
}
bool operator != (const MasterClientService_getMasterStats_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_getMasterStats_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_getMasterStats_args& obj);
};
class MasterClientService_getMasterStats_pargs {
public:
static const char* ascii_fingerprint; // = "<KEY>";
static const uint8_t binary_fingerprint[16]; // = {0x05,0x55,0xE3,0x9F,0xE2,0xCB,0xB1,0x9B,0x29,0x00,0x0C,0xC0,0x17,0xA1,0x80,0x01};
virtual ~MasterClientService_getMasterStats_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_getMasterStats_pargs& obj);
};
typedef struct _MasterClientService_getMasterStats_result__isset {
_MasterClientService_getMasterStats_result__isset() : success(false), sec(false) {}
bool success :1;
bool sec :1;
} _MasterClientService_getMasterStats_result__isset;
class MasterClientService_getMasterStats_result {
public:
static const char* ascii_fingerprint; // = "38261913D0A8832E854DE428ED2565CE";
static const uint8_t binary_fingerprint[16]; // = {0x38,0x26,0x19,0x13,0xD0,0xA8,0x83,0x2E,0x85,0x4D,0xE4,0x28,0xED,0x25,0x65,0xCE};
MasterClientService_getMasterStats_result(const MasterClientService_getMasterStats_result&);
MasterClientService_getMasterStats_result& operator=(const MasterClientService_getMasterStats_result&);
MasterClientService_getMasterStats_result() {
}
virtual ~MasterClientService_getMasterStats_result() throw();
MasterMonitorInfo success;
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_getMasterStats_result__isset __isset;
void __set_success(const MasterMonitorInfo& val);
void __set_sec(const ::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException& val);
bool operator == (const MasterClientService_getMasterStats_result & rhs) const
{
if (!(success == rhs.success))
return false;
if (!(sec == rhs.sec))
return false;
return true;
}
bool operator != (const MasterClientService_getMasterStats_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_getMasterStats_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_getMasterStats_result& obj);
};
typedef struct _MasterClientService_getMasterStats_presult__isset {
_MasterClientService_getMasterStats_presult__isset() : success(false), sec(false) {}
bool success :1;
bool sec :1;
} _MasterClientService_getMasterStats_presult__isset;
class MasterClientService_getMasterStats_presult {
public:
static const char* ascii_fingerprint; // = "38261913D0A8832E854DE428ED2565CE";
static const uint8_t binary_fingerprint[16]; // = {0x38,0x26,0x19,0x13,0xD0,0xA8,0x83,0x2E,0x85,0x4D,0xE4,0x28,0xED,0x25,0x65,0xCE};
virtual ~MasterClientService_getMasterStats_presult() throw();
MasterMonitorInfo* success;
::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException sec;
_MasterClientService_getMasterStats_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_getMasterStats_presult& obj);
};
typedef struct _MasterClientService_reportSplitExtent_args__isset {
_MasterClientService_reportSplitExtent_args__isset() : tinfo(false), credentials(false), serverName(false), split(false) {}
bool tinfo :1;
bool credentials :1;
bool serverName :1;
bool split :1;
} _MasterClientService_reportSplitExtent_args__isset;
class MasterClientService_reportSplitExtent_args {
public:
static const char* ascii_fingerprint; // = "DFDFFE3C4638494C48346609D04C093C";
static const uint8_t binary_fingerprint[16]; // = {0xDF,0xDF,0xFE,0x3C,0x46,0x38,0x49,0x4C,0x48,0x34,0x66,0x09,0xD0,0x4C,0x09,0x3C};
MasterClientService_reportSplitExtent_args(const MasterClientService_reportSplitExtent_args&);
MasterClientService_reportSplitExtent_args& operator=(const MasterClientService_reportSplitExtent_args&);
MasterClientService_reportSplitExtent_args() : serverName() {
}
virtual ~MasterClientService_reportSplitExtent_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string serverName;
TabletSplit split;
_MasterClientService_reportSplitExtent_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_serverName(const std::string& val);
void __set_split(const TabletSplit& val);
bool operator == (const MasterClientService_reportSplitExtent_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(serverName == rhs.serverName))
return false;
if (!(split == rhs.split))
return false;
return true;
}
bool operator != (const MasterClientService_reportSplitExtent_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_reportSplitExtent_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_reportSplitExtent_args& obj);
};
class MasterClientService_reportSplitExtent_pargs {
public:
static const char* ascii_fingerprint; // = "DFDFFE3C4638494C48346609D04C093C";
static const uint8_t binary_fingerprint[16]; // = {0xDF,0xDF,0xFE,0x3C,0x46,0x38,0x49,0x4C,0x48,0x34,0x66,0x09,0xD0,0x4C,0x09,0x3C};
virtual ~MasterClientService_reportSplitExtent_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* serverName;
const TabletSplit* split;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_reportSplitExtent_pargs& obj);
};
typedef struct _MasterClientService_reportTabletStatus_args__isset {
_MasterClientService_reportTabletStatus_args__isset() : tinfo(false), credentials(false), serverName(false), status(false), tablet(false) {}
bool tinfo :1;
bool credentials :1;
bool serverName :1;
bool status :1;
bool tablet :1;
} _MasterClientService_reportTabletStatus_args__isset;
class MasterClientService_reportTabletStatus_args {
public:
static const char* ascii_fingerprint; // = "72F661B04557E690CE151FA482CEBD13";
static const uint8_t binary_fingerprint[16]; // = {0x72,0xF6,0x61,0xB0,0x45,0x57,0xE6,0x90,0xCE,0x15,0x1F,0xA4,0x82,0xCE,0xBD,0x13};
MasterClientService_reportTabletStatus_args(const MasterClientService_reportTabletStatus_args&);
MasterClientService_reportTabletStatus_args& operator=(const MasterClientService_reportTabletStatus_args&);
MasterClientService_reportTabletStatus_args() : serverName(), status((TabletLoadState::type)0) {
}
virtual ~MasterClientService_reportTabletStatus_args() throw();
::org::apache::accumulo::trace::thrift::TInfo tinfo;
::org::apache::accumulo::core::security::thrift::TCredentials credentials;
std::string serverName;
TabletLoadState::type status;
::org::apache::accumulo::core::data::thrift::TKeyExtent tablet;
_MasterClientService_reportTabletStatus_args__isset __isset;
void __set_tinfo(const ::org::apache::accumulo::trace::thrift::TInfo& val);
void __set_credentials(const ::org::apache::accumulo::core::security::thrift::TCredentials& val);
void __set_serverName(const std::string& val);
void __set_status(const TabletLoadState::type val);
void __set_tablet(const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val);
bool operator == (const MasterClientService_reportTabletStatus_args & rhs) const
{
if (!(tinfo == rhs.tinfo))
return false;
if (!(credentials == rhs.credentials))
return false;
if (!(serverName == rhs.serverName))
return false;
if (!(status == rhs.status))
return false;
if (!(tablet == rhs.tablet))
return false;
return true;
}
bool operator != (const MasterClientService_reportTabletStatus_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MasterClientService_reportTabletStatus_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_reportTabletStatus_args& obj);
};
class MasterClientService_reportTabletStatus_pargs {
public:
static const char* ascii_fingerprint; // = "72F661B04557E690CE151FA482CEBD13";
static const uint8_t binary_fingerprint[16]; // = {0x72,0xF6,0x61,0xB0,0x45,0x57,0xE6,0x90,0xCE,0x15,0x1F,0xA4,0x82,0xCE,0xBD,0x13};
virtual ~MasterClientService_reportTabletStatus_pargs() throw();
const ::org::apache::accumulo::trace::thrift::TInfo* tinfo;
const ::org::apache::accumulo::core::security::thrift::TCredentials* credentials;
const std::string* serverName;
const TabletLoadState::type* status;
const ::org::apache::accumulo::core::data::thrift::TKeyExtent* tablet;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const MasterClientService_reportTabletStatus_pargs& obj);
};
class MasterClientServiceClient : virtual public MasterClientServiceIf, public FateServiceClient {
public:
MasterClientServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) :
FateServiceClient(prot, prot) {}
MasterClientServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : FateServiceClient(iprot, oprot) {}
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
return piprot_;
}
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
return poprot_;
}
int64_t initiateFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName);
void send_initiateFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName);
int64_t recv_initiateFlush();
void waitForFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& startRow, const std::string& endRow, const int64_t flushID, const int64_t maxLoops);
void send_waitForFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& startRow, const std::string& endRow, const int64_t flushID, const int64_t maxLoops);
void recv_waitForFlush();
void setTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property, const std::string& value);
void send_setTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property, const std::string& value);
void recv_setTableProperty();
void removeTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property);
void send_removeTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property);
void recv_removeTableProperty();
void setNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property, const std::string& value);
void send_setNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property, const std::string& value);
void recv_setNamespaceProperty();
void removeNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property);
void send_removeNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property);
void recv_removeNamespaceProperty();
void setMasterGoalState(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const MasterGoalState::type state);
void send_setMasterGoalState(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const MasterGoalState::type state);
void recv_setMasterGoalState();
void shutdown(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const bool stopTabletServers);
void send_shutdown(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const bool stopTabletServers);
void recv_shutdown();
void shutdownTabletServer(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tabletServer, const bool force);
void send_shutdownTabletServer(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tabletServer, const bool force);
void recv_shutdownTabletServer();
void setSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property, const std::string& value);
void send_setSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property, const std::string& value);
void recv_setSystemProperty();
void removeSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property);
void send_removeSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property);
void recv_removeSystemProperty();
void getMasterStats(MasterMonitorInfo& _return, const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials);
void send_getMasterStats(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials);
void recv_getMasterStats(MasterMonitorInfo& _return);
void reportSplitExtent(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletSplit& split);
void send_reportSplitExtent(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletSplit& split);
void reportTabletStatus(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletLoadState::type status, const ::org::apache::accumulo::core::data::thrift::TKeyExtent& tablet);
void send_reportTabletStatus(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletLoadState::type status, const ::org::apache::accumulo::core::data::thrift::TKeyExtent& tablet);
};
class MasterClientServiceProcessor : public FateServiceProcessor {
protected:
boost::shared_ptr<MasterClientServiceIf> iface_;
virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
private:
typedef void (MasterClientServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
typedef std::map<std::string, ProcessFunction> ProcessMap;
ProcessMap processMap_;
void process_initiateFlush(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_waitForFlush(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_setTableProperty(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_removeTableProperty(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_setNamespaceProperty(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_removeNamespaceProperty(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_setMasterGoalState(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_shutdown(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_shutdownTabletServer(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_setSystemProperty(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_removeSystemProperty(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_getMasterStats(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_reportSplitExtent(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_reportTabletStatus(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
public:
MasterClientServiceProcessor(boost::shared_ptr<MasterClientServiceIf> iface) :
FateServiceProcessor(iface),
iface_(iface) {
processMap_["initiateFlush"] = &MasterClientServiceProcessor::process_initiateFlush;
processMap_["waitForFlush"] = &MasterClientServiceProcessor::process_waitForFlush;
processMap_["setTableProperty"] = &MasterClientServiceProcessor::process_setTableProperty;
processMap_["removeTableProperty"] = &MasterClientServiceProcessor::process_removeTableProperty;
processMap_["setNamespaceProperty"] = &MasterClientServiceProcessor::process_setNamespaceProperty;
processMap_["removeNamespaceProperty"] = &MasterClientServiceProcessor::process_removeNamespaceProperty;
processMap_["setMasterGoalState"] = &MasterClientServiceProcessor::process_setMasterGoalState;
processMap_["shutdown"] = &MasterClientServiceProcessor::process_shutdown;
processMap_["shutdownTabletServer"] = &MasterClientServiceProcessor::process_shutdownTabletServer;
processMap_["setSystemProperty"] = &MasterClientServiceProcessor::process_setSystemProperty;
processMap_["removeSystemProperty"] = &MasterClientServiceProcessor::process_removeSystemProperty;
processMap_["getMasterStats"] = &MasterClientServiceProcessor::process_getMasterStats;
processMap_["reportSplitExtent"] = &MasterClientServiceProcessor::process_reportSplitExtent;
processMap_["reportTabletStatus"] = &MasterClientServiceProcessor::process_reportTabletStatus;
}
virtual ~MasterClientServiceProcessor() {}
};
class MasterClientServiceProcessorFactory : public ::apache::thrift::TProcessorFactory {
public:
MasterClientServiceProcessorFactory(const ::boost::shared_ptr< MasterClientServiceIfFactory >& handlerFactory) :
handlerFactory_(handlerFactory) {}
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
protected:
::boost::shared_ptr< MasterClientServiceIfFactory > handlerFactory_;
};
class MasterClientServiceMultiface : virtual public MasterClientServiceIf, public FateServiceMultiface {
public:
MasterClientServiceMultiface(std::vector<boost::shared_ptr<MasterClientServiceIf> >& ifaces) : ifaces_(ifaces) {
std::vector<boost::shared_ptr<MasterClientServiceIf> >::iterator iter;
for (iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
FateServiceMultiface::add(*iter);
}
}
virtual ~MasterClientServiceMultiface() {}
protected:
std::vector<boost::shared_ptr<MasterClientServiceIf> > ifaces_;
MasterClientServiceMultiface() {}
void add(boost::shared_ptr<MasterClientServiceIf> iface) {
FateServiceMultiface::add(iface);
ifaces_.push_back(iface);
}
public:
int64_t initiateFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->initiateFlush(tinfo, credentials, tableName);
}
return ifaces_[i]->initiateFlush(tinfo, credentials, tableName);
}
void waitForFlush(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& startRow, const std::string& endRow, const int64_t flushID, const int64_t maxLoops) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->waitForFlush(tinfo, credentials, tableName, startRow, endRow, flushID, maxLoops);
}
ifaces_[i]->waitForFlush(tinfo, credentials, tableName, startRow, endRow, flushID, maxLoops);
}
void setTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property, const std::string& value) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->setTableProperty(tinfo, credentials, tableName, property, value);
}
ifaces_[i]->setTableProperty(tinfo, credentials, tableName, property, value);
}
void removeTableProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tableName, const std::string& property) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->removeTableProperty(tinfo, credentials, tableName, property);
}
ifaces_[i]->removeTableProperty(tinfo, credentials, tableName, property);
}
void setNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property, const std::string& value) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->setNamespaceProperty(tinfo, credentials, ns, property, value);
}
ifaces_[i]->setNamespaceProperty(tinfo, credentials, ns, property, value);
}
void removeNamespaceProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& ns, const std::string& property) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->removeNamespaceProperty(tinfo, credentials, ns, property);
}
ifaces_[i]->removeNamespaceProperty(tinfo, credentials, ns, property);
}
void setMasterGoalState(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const MasterGoalState::type state) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->setMasterGoalState(tinfo, credentials, state);
}
ifaces_[i]->setMasterGoalState(tinfo, credentials, state);
}
void shutdown(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const bool stopTabletServers) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->shutdown(tinfo, credentials, stopTabletServers);
}
ifaces_[i]->shutdown(tinfo, credentials, stopTabletServers);
}
void shutdownTabletServer(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& tabletServer, const bool force) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->shutdownTabletServer(tinfo, credentials, tabletServer, force);
}
ifaces_[i]->shutdownTabletServer(tinfo, credentials, tabletServer, force);
}
void setSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property, const std::string& value) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->setSystemProperty(tinfo, credentials, property, value);
}
ifaces_[i]->setSystemProperty(tinfo, credentials, property, value);
}
void removeSystemProperty(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& property) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->removeSystemProperty(tinfo, credentials, property);
}
ifaces_[i]->removeSystemProperty(tinfo, credentials, property);
}
void getMasterStats(MasterMonitorInfo& _return, const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->getMasterStats(_return, tinfo, credentials);
}
ifaces_[i]->getMasterStats(_return, tinfo, credentials);
return;
}
void reportSplitExtent(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletSplit& split) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->reportSplitExtent(tinfo, credentials, serverName, split);
}
ifaces_[i]->reportSplitExtent(tinfo, credentials, serverName, split);
}
void reportTabletStatus(const ::org::apache::accumulo::trace::thrift::TInfo& tinfo, const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials, const std::string& serverName, const TabletLoadState::type status, const ::org::apache::accumulo::core::data::thrift::TKeyExtent& tablet) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->reportTabletStatus(tinfo, credentials, serverName, status, tablet);
}
ifaces_[i]->reportTabletStatus(tinfo, credentials, serverName, status, tablet);
}
};
}}}}}} // namespace
#endif
<file_sep>/*
* 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.
*/
#ifndef KEYEXTENT_H_
#define KEYEXTENT_H_
#include "inputvalidation.h"
#include "../exceptions/ClientException.h"
#include "../exceptions/IllegalArgumentException.h"
#include "StructureDefinitions.h"
#include <string>
#include <iostream>
#include "value.h"
using namespace std;
namespace cclient
{
namespace data
{
using namespace exceptions;
class KeyExtent
{
public:
KeyExtent (string flattenedText, Value *prevEndRow);
KeyExtent (string tableIdIn, string endRowIn) :
KeyExtent (tableIdIn, endRowIn, "")
{
}
KeyExtent (KeyExtent *copy) : tableId(copy->getTableId()), endRow ( copy->getEndRow() ), prevEndRow(copy->getPrevEndRow())
{
}
KeyExtent (string tableIdIn, string endRowIn, string prevEndRowIn)
{
if (IsEmpty (&tableIdIn))
{
throw IllegalArgumentException ("Table Id cannot be null");
}
if (!IsEmpty (&endRowIn) && !IsEmpty (&prevEndRowIn))
{
if (prevEndRowIn.compare (endRowIn) >= 0)
{
throw IllegalArgumentException ("PrevEndRow >= endRow");
}
}
setTableId (tableIdIn);
endRow = endRowIn;
prevEndRow = prevEndRowIn;
}
static string
createMetadataEntry (string table, string row)
{
string entry (table);
if (IsEmpty (&row))
{
entry.append ("<");
}
else
{
entry.append (";");
entry.append (row);
}
return entry;
}
virtual
~KeyExtent ();
bool
operator < (const KeyExtent &rhs) const
{
int result = tableId.compare (rhs.tableId);
if (result < 0)
return result;
else if (result > 0)
return false;
result = endRow.compare (rhs.endRow);
if (result < 0)
return result;
else if (result > 0)
return false;
result = prevEndRow.compare (rhs.prevEndRow);
if (result < 0)
return true;
else
return false;
}
bool
operator == (const KeyExtent &rhs) const
{
int result = tableId.compare (rhs.tableId);
if (result != 0)
return (result == 0);
result = endRow.compare (rhs.endRow);
if (result != 0)
return (result == 0);
result = prevEndRow.compare (rhs.prevEndRow);
if (result != 0)
return (result == 0);
return true;
}
void
setTableId (string id)
{
tableId = id;
}
string
getTableId ()
{
return tableId;
}
string
getEndRow ()
{
return endRow;
}
string
getPrevEndRow ()
{
return prevEndRow;
}
protected:
void
setPrevEndRow (Value *prevEndRow)
{
std::pair<unsigned char *, size_t> valuePair = prevEndRow->getValue ();
setPrevEndRow ((char*) valuePair.first, valuePair.second);
}
void
setPrevEndRow (char *text, size_t text_len)
{
prevEndRow = string (text + 1, text_len - 1);
}
void
decodeMetadataRow (string flattenedText)
{
int16_t semiPos = -1;
int16_t ltPos = -1;
if (flattenedText.at (flattenedText.size () - 1) == '<')
{
ltPos = flattenedText.size () - 1;
}
else
{
for (uint32_t i = 0; i < flattenedText.size (); i++)
{
if (flattenedText.at (i) == ';')
{
semiPos = i;
break;
}
}
}
if (semiPos < 0 && ltPos < 0)
{
throw new ClientException ("Metadata row does not contain ; or <");
}
if (semiPos < 0)
{
tableId = flattenedText.substr (0, flattenedText.size () - 1);
endRow = "";
}
else
{
tableId = flattenedText.substr (0, semiPos);
endRow = flattenedText.substr (
semiPos + 1, flattenedText.size () - (semiPos + 1));
}
}
string tableId;
string endRow;
string prevEndRow;
};
static const KeyExtent ROOT_TABLET_EXTENT (
METADATA_TABLE_ID,
KeyExtent::createMetadataEntry (METADATA_TABLE_ID, ""));
} /* namespace data */
} /* namespace cclient */
#endif /* KEYEXTENT_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/ClientService.h"
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace client
{
namespace impl
{
namespace thrift
{
ClientService_getRootTabletLocation_args::~ClientService_getRootTabletLocation_args () throw ()
{
}
uint32_t
ClientService_getRootTabletLocation_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
xfer += iprot->skip (ftype);
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getRootTabletLocation_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getRootTabletLocation_args");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getRootTabletLocation_pargs::~ClientService_getRootTabletLocation_pargs () throw ()
{
}
uint32_t
ClientService_getRootTabletLocation_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getRootTabletLocation_pargs");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getRootTabletLocation_result::~ClientService_getRootTabletLocation_result () throw ()
{
}
uint32_t
ClientService_getRootTabletLocation_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getRootTabletLocation_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getRootTabletLocation_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRING, 0);
xfer += oprot->writeString (this->success);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getRootTabletLocation_presult::~ClientService_getRootTabletLocation_presult () throw ()
{
}
uint32_t
ClientService_getRootTabletLocation_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getInstanceId_args::~ClientService_getInstanceId_args () throw ()
{
}
uint32_t
ClientService_getInstanceId_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
xfer += iprot->skip (ftype);
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getInstanceId_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getInstanceId_args");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getInstanceId_pargs::~ClientService_getInstanceId_pargs () throw ()
{
}
uint32_t
ClientService_getInstanceId_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getInstanceId_pargs");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getInstanceId_result::~ClientService_getInstanceId_result () throw ()
{
}
uint32_t
ClientService_getInstanceId_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getInstanceId_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getInstanceId_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRING, 0);
xfer += oprot->writeString (this->success);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getInstanceId_presult::~ClientService_getInstanceId_presult () throw ()
{
}
uint32_t
ClientService_getInstanceId_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getZooKeepers_args::~ClientService_getZooKeepers_args () throw ()
{
}
uint32_t
ClientService_getZooKeepers_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
xfer += iprot->skip (ftype);
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getZooKeepers_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getZooKeepers_args");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getZooKeepers_pargs::~ClientService_getZooKeepers_pargs () throw ()
{
}
uint32_t
ClientService_getZooKeepers_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getZooKeepers_pargs");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getZooKeepers_result::~ClientService_getZooKeepers_result () throw ()
{
}
uint32_t
ClientService_getZooKeepers_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getZooKeepers_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getZooKeepers_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRING, 0);
xfer += oprot->writeString (this->success);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getZooKeepers_presult::~ClientService_getZooKeepers_presult () throw ()
{
}
uint32_t
ClientService_getZooKeepers_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_bulkImportFiles_args::~ClientService_bulkImportFiles_args () throw ()
{
}
uint32_t
ClientService_bulkImportFiles_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->tid);
this->__isset.tid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->files.clear ();
uint32_t _size15;
::apache::thrift::protocol::TType _etype18;
xfer += iprot->readListBegin (_etype18,
_size15);
this->files.resize (_size15);
uint32_t _i19;
for (_i19 = 0; _i19 < _size15; ++_i19)
{
xfer += iprot->readString (
this->files[_i19]);
}
xfer += iprot->readListEnd ();
}
this->__isset.files = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->errorDir);
this->__isset.errorDir = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->setTime);
this->__isset.setTime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_bulkImportFiles_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_bulkImportFiles_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tid", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64 (this->tid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"files", ::apache::thrift::protocol::T_LIST, 5);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->files.size ()));
std::vector<std::string>::const_iterator _iter20;
for (_iter20 = this->files.begin ();
_iter20 != this->files.end (); ++_iter20)
{
xfer += oprot->writeString ((*_iter20));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"errorDir", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeString (this->errorDir);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"setTime", ::apache::thrift::protocol::T_BOOL, 7);
xfer += oprot->writeBool (this->setTime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 8);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_bulkImportFiles_pargs::~ClientService_bulkImportFiles_pargs () throw ()
{
}
uint32_t
ClientService_bulkImportFiles_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_bulkImportFiles_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tid", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64 ((*(this->tid)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->tableId)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"files", ::apache::thrift::protocol::T_LIST, 5);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->files)).size ()));
std::vector<std::string>::const_iterator _iter21;
for (_iter21 = (*(this->files)).begin ();
_iter21 != (*(this->files)).end (); ++_iter21)
{
xfer += oprot->writeString ((*_iter21));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"errorDir", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeString ((*(this->errorDir)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"setTime", ::apache::thrift::protocol::T_BOOL, 7);
xfer += oprot->writeBool ((*(this->setTime)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 8);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_bulkImportFiles_result::~ClientService_bulkImportFiles_result () throw ()
{
}
uint32_t
ClientService_bulkImportFiles_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size22;
::apache::thrift::protocol::TType _etype25;
xfer += iprot->readListBegin (_etype25,
_size22);
this->success.resize (_size22);
uint32_t _i26;
for (_i26 = 0; _i26 < _size22; ++_i26)
{
xfer += iprot->readString (
this->success[_i26]);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_bulkImportFiles_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_bulkImportFiles_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->success.size ()));
std::vector<std::string>::const_iterator _iter27;
for (_iter27 = this->success.begin ();
_iter27 != this->success.end (); ++_iter27)
{
xfer += oprot->writeString ((*_iter27));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_bulkImportFiles_presult::~ClientService_bulkImportFiles_presult () throw ()
{
}
uint32_t
ClientService_bulkImportFiles_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size28;
::apache::thrift::protocol::TType _etype31;
xfer += iprot->readListBegin (_etype31,
_size28);
(*(this->success)).resize (_size28);
uint32_t _i32;
for (_i32 = 0; _i32 < _size28; ++_i32)
{
xfer += iprot->readString (
(*(this->success))[_i32]);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_isActive_args::~ClientService_isActive_args () throw ()
{
}
uint32_t
ClientService_isActive_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->tid);
this->__isset.tid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_isActive_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ClientService_isActive_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tid", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64 (this->tid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_isActive_pargs::~ClientService_isActive_pargs () throw ()
{
}
uint32_t
ClientService_isActive_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_isActive_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tid", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64 ((*(this->tid)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_isActive_result::~ClientService_isActive_result () throw ()
{
}
uint32_t
ClientService_isActive_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_isActive_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_isActive_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_isActive_presult::~ClientService_isActive_presult () throw ()
{
}
uint32_t
ClientService_isActive_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_ping_args::~ClientService_ping_args () throw ()
{
}
uint32_t
ClientService_ping_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_ping_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ClientService_ping_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_ping_pargs::~ClientService_ping_pargs () throw ()
{
}
uint32_t
ClientService_ping_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ClientService_ping_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_ping_result::~ClientService_ping_result () throw ()
{
}
uint32_t
ClientService_ping_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_ping_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin ("ClientService_ping_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_ping_presult::~ClientService_ping_presult () throw ()
{
}
uint32_t
ClientService_ping_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getDiskUsage_args::~ClientService_getDiskUsage_args () throw ()
{
}
uint32_t
ClientService_getDiskUsage_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_SET)
{
{
this->tables.clear ();
uint32_t _size33;
::apache::thrift::protocol::TType _etype36;
xfer += iprot->readSetBegin (_etype36, _size33);
uint32_t _i37;
for (_i37 = 0; _i37 < _size33; ++_i37)
{
std::string _elem38;
xfer += iprot->readString (_elem38);
this->tables.insert (_elem38);
}
xfer += iprot->readSetEnd ();
}
this->__isset.tables = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getDiskUsage_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getDiskUsage_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tables", ::apache::thrift::protocol::T_SET, 2);
{
xfer += oprot->writeSetBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->tables.size ()));
std::set<std::string>::const_iterator _iter39;
for (_iter39 = this->tables.begin ();
_iter39 != this->tables.end (); ++_iter39)
{
xfer += oprot->writeString ((*_iter39));
}
xfer += oprot->writeSetEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getDiskUsage_pargs::~ClientService_getDiskUsage_pargs () throw ()
{
}
uint32_t
ClientService_getDiskUsage_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getDiskUsage_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tables", ::apache::thrift::protocol::T_SET, 2);
{
xfer += oprot->writeSetBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->tables)).size ()));
std::set<std::string>::const_iterator _iter40;
for (_iter40 = (*(this->tables)).begin ();
_iter40 != (*(this->tables)).end (); ++_iter40)
{
xfer += oprot->writeString ((*_iter40));
}
xfer += oprot->writeSetEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getDiskUsage_result::~ClientService_getDiskUsage_result () throw ()
{
}
uint32_t
ClientService_getDiskUsage_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size41;
::apache::thrift::protocol::TType _etype44;
xfer += iprot->readListBegin (_etype44,
_size41);
this->success.resize (_size41);
uint32_t _i45;
for (_i45 = 0; _i45 < _size41; ++_i45)
{
xfer += this->success[_i45].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->toe.read (iprot);
this->__isset.toe = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getDiskUsage_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getDiskUsage_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->success.size ()));
std::vector<TDiskUsage>::const_iterator _iter46;
for (_iter46 = this->success.begin ();
_iter46 != this->success.end (); ++_iter46)
{
xfer += (*_iter46).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.toe)
{
xfer += oprot->writeFieldBegin (
"toe", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->toe.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getDiskUsage_presult::~ClientService_getDiskUsage_presult () throw ()
{
}
uint32_t
ClientService_getDiskUsage_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size47;
::apache::thrift::protocol::TType _etype50;
xfer += iprot->readListBegin (_etype50,
_size47);
(*(this->success)).resize (_size47);
uint32_t _i51;
for (_i51 = 0; _i51 < _size47; ++_i51)
{
xfer += (*(this->success))[_i51].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->toe.read (iprot);
this->__isset.toe = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_listLocalUsers_args::~ClientService_listLocalUsers_args () throw ()
{
}
uint32_t
ClientService_listLocalUsers_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_listLocalUsers_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_listLocalUsers_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_listLocalUsers_pargs::~ClientService_listLocalUsers_pargs () throw ()
{
}
uint32_t
ClientService_listLocalUsers_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_listLocalUsers_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_listLocalUsers_result::~ClientService_listLocalUsers_result () throw ()
{
}
uint32_t
ClientService_listLocalUsers_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_SET)
{
{
this->success.clear ();
uint32_t _size52;
::apache::thrift::protocol::TType _etype55;
xfer += iprot->readSetBegin (_etype55, _size52);
uint32_t _i56;
for (_i56 = 0; _i56 < _size52; ++_i56)
{
std::string _elem57;
xfer += iprot->readString (_elem57);
this->success.insert (_elem57);
}
xfer += iprot->readSetEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_listLocalUsers_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_listLocalUsers_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_SET, 0);
{
xfer += oprot->writeSetBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->success.size ()));
std::set<std::string>::const_iterator _iter58;
for (_iter58 = this->success.begin ();
_iter58 != this->success.end (); ++_iter58)
{
xfer += oprot->writeString ((*_iter58));
}
xfer += oprot->writeSetEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_listLocalUsers_presult::~ClientService_listLocalUsers_presult () throw ()
{
}
uint32_t
ClientService_listLocalUsers_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_SET)
{
{
(*(this->success)).clear ();
uint32_t _size59;
::apache::thrift::protocol::TType _etype62;
xfer += iprot->readSetBegin (_etype62, _size59);
uint32_t _i63;
for (_i63 = 0; _i63 < _size59; ++_i63)
{
std::string _elem64;
xfer += iprot->readString (_elem64);
(*(this->success)).insert (_elem64);
}
xfer += iprot->readSetEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_createLocalUser_args::~ClientService_createLocalUser_args () throw ()
{
}
uint32_t
ClientService_createLocalUser_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->password);
this->__isset.password = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_createLocalUser_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_createLocalUser_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"password", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->password);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_createLocalUser_pargs::~ClientService_createLocalUser_pargs () throw ()
{
}
uint32_t
ClientService_createLocalUser_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_createLocalUser_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"password", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary ((*(this->password)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_createLocalUser_result::~ClientService_createLocalUser_result () throw ()
{
}
uint32_t
ClientService_createLocalUser_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_createLocalUser_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_createLocalUser_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_createLocalUser_presult::~ClientService_createLocalUser_presult () throw ()
{
}
uint32_t
ClientService_createLocalUser_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_dropLocalUser_args::~ClientService_dropLocalUser_args () throw ()
{
}
uint32_t
ClientService_dropLocalUser_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_dropLocalUser_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_dropLocalUser_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_dropLocalUser_pargs::~ClientService_dropLocalUser_pargs () throw ()
{
}
uint32_t
ClientService_dropLocalUser_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_dropLocalUser_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_dropLocalUser_result::~ClientService_dropLocalUser_result () throw ()
{
}
uint32_t
ClientService_dropLocalUser_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_dropLocalUser_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_dropLocalUser_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_dropLocalUser_presult::~ClientService_dropLocalUser_presult () throw ()
{
}
uint32_t
ClientService_dropLocalUser_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_changeLocalUserPassword_args::~ClientService_changeLocalUserPassword_args () throw ()
{
}
uint32_t
ClientService_changeLocalUserPassword_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->password);
this->__isset.password = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_changeLocalUserPassword_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_changeLocalUserPassword_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"password", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->password);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_changeLocalUserPassword_pargs::~ClientService_changeLocalUserPassword_pargs () throw ()
{
}
uint32_t
ClientService_changeLocalUserPassword_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_changeLocalUserPassword_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"password", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary ((*(this->password)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_changeLocalUserPassword_result::~ClientService_changeLocalUserPassword_result () throw ()
{
}
uint32_t
ClientService_changeLocalUserPassword_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_changeLocalUserPassword_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_changeLocalUserPassword_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_changeLocalUserPassword_presult::~ClientService_changeLocalUserPassword_presult () throw ()
{
}
uint32_t
ClientService_changeLocalUserPassword_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_authenticate_args::~ClientService_authenticate_args () throw ()
{
}
uint32_t
ClientService_authenticate_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_authenticate_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_authenticate_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_authenticate_pargs::~ClientService_authenticate_pargs () throw ()
{
}
uint32_t
ClientService_authenticate_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_authenticate_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_authenticate_result::~ClientService_authenticate_result () throw ()
{
}
uint32_t
ClientService_authenticate_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_authenticate_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_authenticate_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_authenticate_presult::~ClientService_authenticate_presult () throw ()
{
}
uint32_t
ClientService_authenticate_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_authenticateUser_args::~ClientService_authenticateUser_args () throw ()
{
}
uint32_t
ClientService_authenticateUser_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->toAuth.read (iprot);
this->__isset.toAuth = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_authenticateUser_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_authenticateUser_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"toAuth", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->toAuth.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_authenticateUser_pargs::~ClientService_authenticateUser_pargs () throw ()
{
}
uint32_t
ClientService_authenticateUser_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_authenticateUser_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"toAuth", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->toAuth)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_authenticateUser_result::~ClientService_authenticateUser_result () throw ()
{
}
uint32_t
ClientService_authenticateUser_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_authenticateUser_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_authenticateUser_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_authenticateUser_presult::~ClientService_authenticateUser_presult () throw ()
{
}
uint32_t
ClientService_authenticateUser_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_changeAuthorizations_args::~ClientService_changeAuthorizations_args () throw ()
{
}
uint32_t
ClientService_changeAuthorizations_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->authorizations.clear ();
uint32_t _size65;
::apache::thrift::protocol::TType _etype68;
xfer += iprot->readListBegin (_etype68,
_size65);
this->authorizations.resize (_size65);
uint32_t _i69;
for (_i69 = 0; _i69 < _size65; ++_i69)
{
xfer += iprot->readBinary (
this->authorizations[_i69]);
}
xfer += iprot->readListEnd ();
}
this->__isset.authorizations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_changeAuthorizations_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_changeAuthorizations_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->authorizations.size ()));
std::vector<std::string>::const_iterator _iter70;
for (_iter70 = this->authorizations.begin ();
_iter70 != this->authorizations.end (); ++_iter70)
{
xfer += oprot->writeBinary ((*_iter70));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_changeAuthorizations_pargs::~ClientService_changeAuthorizations_pargs () throw ()
{
}
uint32_t
ClientService_changeAuthorizations_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_changeAuthorizations_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 3);
{
xfer +=
oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->authorizations)).size ()));
std::vector<std::string>::const_iterator _iter71;
for (_iter71 = (*(this->authorizations)).begin ();
_iter71 != (*(this->authorizations)).end (); ++_iter71)
{
xfer += oprot->writeBinary ((*_iter71));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_changeAuthorizations_result::~ClientService_changeAuthorizations_result () throw ()
{
}
uint32_t
ClientService_changeAuthorizations_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_changeAuthorizations_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_changeAuthorizations_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_changeAuthorizations_presult::~ClientService_changeAuthorizations_presult () throw ()
{
}
uint32_t
ClientService_changeAuthorizations_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getUserAuthorizations_args::~ClientService_getUserAuthorizations_args () throw ()
{
}
uint32_t
ClientService_getUserAuthorizations_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getUserAuthorizations_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getUserAuthorizations_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getUserAuthorizations_pargs::~ClientService_getUserAuthorizations_pargs () throw ()
{
}
uint32_t
ClientService_getUserAuthorizations_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getUserAuthorizations_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getUserAuthorizations_result::~ClientService_getUserAuthorizations_result () throw ()
{
}
uint32_t
ClientService_getUserAuthorizations_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->success.clear ();
uint32_t _size72;
::apache::thrift::protocol::TType _etype75;
xfer += iprot->readListBegin (_etype75,
_size72);
this->success.resize (_size72);
uint32_t _i76;
for (_i76 = 0; _i76 < _size72; ++_i76)
{
xfer += iprot->readBinary (
this->success[_i76]);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getUserAuthorizations_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getUserAuthorizations_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->success.size ()));
std::vector<std::string>::const_iterator _iter77;
for (_iter77 = this->success.begin ();
_iter77 != this->success.end (); ++_iter77)
{
xfer += oprot->writeBinary ((*_iter77));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getUserAuthorizations_presult::~ClientService_getUserAuthorizations_presult () throw ()
{
}
uint32_t
ClientService_getUserAuthorizations_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
(*(this->success)).clear ();
uint32_t _size78;
::apache::thrift::protocol::TType _etype81;
xfer += iprot->readListBegin (_etype81,
_size78);
(*(this->success)).resize (_size78);
uint32_t _i82;
for (_i82 = 0; _i82 < _size78; ++_i82)
{
xfer += iprot->readBinary (
(*(this->success))[_i82]);
}
xfer += iprot->readListEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_hasSystemPermission_args::~ClientService_hasSystemPermission_args () throw ()
{
}
uint32_t
ClientService_hasSystemPermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->sysPerm);
this->__isset.sysPerm = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_hasSystemPermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_hasSystemPermission_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"sysPerm", ::apache::thrift::protocol::T_BYTE, 3);
xfer += oprot->writeByte (this->sysPerm);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_hasSystemPermission_pargs::~ClientService_hasSystemPermission_pargs () throw ()
{
}
uint32_t
ClientService_hasSystemPermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_hasSystemPermission_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"sysPerm", ::apache::thrift::protocol::T_BYTE, 3);
xfer += oprot->writeByte ((*(this->sysPerm)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_hasSystemPermission_result::~ClientService_hasSystemPermission_result () throw ()
{
}
uint32_t
ClientService_hasSystemPermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_hasSystemPermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_hasSystemPermission_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_hasSystemPermission_presult::~ClientService_hasSystemPermission_presult () throw ()
{
}
uint32_t
ClientService_hasSystemPermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_hasTablePermission_args::~ClientService_hasTablePermission_args () throw ()
{
}
uint32_t
ClientService_hasTablePermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->tblPerm);
this->__isset.tblPerm = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_hasTablePermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_hasTablePermission_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tblPerm", ::apache::thrift::protocol::T_BYTE, 4);
xfer += oprot->writeByte (this->tblPerm);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_hasTablePermission_pargs::~ClientService_hasTablePermission_pargs () throw ()
{
}
uint32_t
ClientService_hasTablePermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_hasTablePermission_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tblPerm", ::apache::thrift::protocol::T_BYTE, 4);
xfer += oprot->writeByte ((*(this->tblPerm)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_hasTablePermission_result::~ClientService_hasTablePermission_result () throw ()
{
}
uint32_t
ClientService_hasTablePermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_hasTablePermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_hasTablePermission_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_hasTablePermission_presult::~ClientService_hasTablePermission_presult () throw ()
{
}
uint32_t
ClientService_hasTablePermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_hasNamespacePermission_args::~ClientService_hasNamespacePermission_args () throw ()
{
}
uint32_t
ClientService_hasNamespacePermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->ns);
this->__isset.ns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->tblNspcPerm);
this->__isset.tblNspcPerm = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_hasNamespacePermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_hasNamespacePermission_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->ns);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tblNspcPerm", ::apache::thrift::protocol::T_BYTE, 5);
xfer += oprot->writeByte (this->tblNspcPerm);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_hasNamespacePermission_pargs::~ClientService_hasNamespacePermission_pargs () throw ()
{
}
uint32_t
ClientService_hasNamespacePermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_hasNamespacePermission_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->ns)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tblNspcPerm", ::apache::thrift::protocol::T_BYTE, 5);
xfer += oprot->writeByte ((*(this->tblNspcPerm)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_hasNamespacePermission_result::~ClientService_hasNamespacePermission_result () throw ()
{
}
uint32_t
ClientService_hasNamespacePermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_hasNamespacePermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_hasNamespacePermission_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_hasNamespacePermission_presult::~ClientService_hasNamespacePermission_presult () throw ()
{
}
uint32_t
ClientService_hasNamespacePermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_grantSystemPermission_args::~ClientService_grantSystemPermission_args () throw ()
{
}
uint32_t
ClientService_grantSystemPermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->permission);
this->__isset.permission = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_grantSystemPermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_grantSystemPermission_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 3);
xfer += oprot->writeByte (this->permission);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_grantSystemPermission_pargs::~ClientService_grantSystemPermission_pargs () throw ()
{
}
uint32_t
ClientService_grantSystemPermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_grantSystemPermission_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 3);
xfer += oprot->writeByte ((*(this->permission)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_grantSystemPermission_result::~ClientService_grantSystemPermission_result () throw ()
{
}
uint32_t
ClientService_grantSystemPermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_grantSystemPermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_grantSystemPermission_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_grantSystemPermission_presult::~ClientService_grantSystemPermission_presult () throw ()
{
}
uint32_t
ClientService_grantSystemPermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_revokeSystemPermission_args::~ClientService_revokeSystemPermission_args () throw ()
{
}
uint32_t
ClientService_revokeSystemPermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->permission);
this->__isset.permission = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_revokeSystemPermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_revokeSystemPermission_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 3);
xfer += oprot->writeByte (this->permission);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_revokeSystemPermission_pargs::~ClientService_revokeSystemPermission_pargs () throw ()
{
}
uint32_t
ClientService_revokeSystemPermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_revokeSystemPermission_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 3);
xfer += oprot->writeByte ((*(this->permission)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_revokeSystemPermission_result::~ClientService_revokeSystemPermission_result () throw ()
{
}
uint32_t
ClientService_revokeSystemPermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_revokeSystemPermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_revokeSystemPermission_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_revokeSystemPermission_presult::~ClientService_revokeSystemPermission_presult () throw ()
{
}
uint32_t
ClientService_revokeSystemPermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_grantTablePermission_args::~ClientService_grantTablePermission_args () throw ()
{
}
uint32_t
ClientService_grantTablePermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->permission);
this->__isset.permission = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_grantTablePermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_grantTablePermission_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 4);
xfer += oprot->writeByte (this->permission);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_grantTablePermission_pargs::~ClientService_grantTablePermission_pargs () throw ()
{
}
uint32_t
ClientService_grantTablePermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_grantTablePermission_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 4);
xfer += oprot->writeByte ((*(this->permission)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_grantTablePermission_result::~ClientService_grantTablePermission_result () throw ()
{
}
uint32_t
ClientService_grantTablePermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_grantTablePermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_grantTablePermission_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_grantTablePermission_presult::~ClientService_grantTablePermission_presult () throw ()
{
}
uint32_t
ClientService_grantTablePermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_revokeTablePermission_args::~ClientService_revokeTablePermission_args () throw ()
{
}
uint32_t
ClientService_revokeTablePermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->permission);
this->__isset.permission = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_revokeTablePermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_revokeTablePermission_args");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 4);
xfer += oprot->writeByte (this->permission);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_revokeTablePermission_pargs::~ClientService_revokeTablePermission_pargs () throw ()
{
}
uint32_t
ClientService_revokeTablePermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_revokeTablePermission_pargs");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 4);
xfer += oprot->writeByte ((*(this->permission)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_revokeTablePermission_result::~ClientService_revokeTablePermission_result () throw ()
{
}
uint32_t
ClientService_revokeTablePermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_revokeTablePermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_revokeTablePermission_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_revokeTablePermission_presult::~ClientService_revokeTablePermission_presult () throw ()
{
}
uint32_t
ClientService_revokeTablePermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_grantNamespacePermission_args::~ClientService_grantNamespacePermission_args () throw ()
{
}
uint32_t
ClientService_grantNamespacePermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->ns);
this->__isset.ns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->permission);
this->__isset.permission = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_grantNamespacePermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_grantNamespacePermission_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->ns);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 5);
xfer += oprot->writeByte (this->permission);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_grantNamespacePermission_pargs::~ClientService_grantNamespacePermission_pargs () throw ()
{
}
uint32_t
ClientService_grantNamespacePermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_grantNamespacePermission_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->ns)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 5);
xfer += oprot->writeByte ((*(this->permission)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_grantNamespacePermission_result::~ClientService_grantNamespacePermission_result () throw ()
{
}
uint32_t
ClientService_grantNamespacePermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_grantNamespacePermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_grantNamespacePermission_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_grantNamespacePermission_presult::~ClientService_grantNamespacePermission_presult () throw ()
{
}
uint32_t
ClientService_grantNamespacePermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_revokeNamespacePermission_args::~ClientService_revokeNamespacePermission_args () throw ()
{
}
uint32_t
ClientService_revokeNamespacePermission_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->ns);
this->__isset.ns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BYTE)
{
xfer += iprot->readByte (this->permission);
this->__isset.permission = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_revokeNamespacePermission_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_revokeNamespacePermission_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->ns);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 5);
xfer += oprot->writeByte (this->permission);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_revokeNamespacePermission_pargs::~ClientService_revokeNamespacePermission_pargs () throw ()
{
}
uint32_t
ClientService_revokeNamespacePermission_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_revokeNamespacePermission_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->principal)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->ns)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"permission", ::apache::thrift::protocol::T_BYTE, 5);
xfer += oprot->writeByte ((*(this->permission)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_revokeNamespacePermission_result::~ClientService_revokeNamespacePermission_result () throw ()
{
}
uint32_t
ClientService_revokeNamespacePermission_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_revokeNamespacePermission_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_revokeNamespacePermission_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_revokeNamespacePermission_presult::~ClientService_revokeNamespacePermission_presult () throw ()
{
}
uint32_t
ClientService_revokeNamespacePermission_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getConfiguration_args::~ClientService_getConfiguration_args () throw ()
{
}
uint32_t
ClientService_getConfiguration_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast83;
xfer += iprot->readI32 (ecast83);
this->type = (ConfigurationType::type) ecast83;
this->__isset.type = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getConfiguration_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getConfiguration_args");
xfer += oprot->writeFieldBegin (
"type", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32 ((int32_t) this->type);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getConfiguration_pargs::~ClientService_getConfiguration_pargs () throw ()
{
}
uint32_t
ClientService_getConfiguration_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getConfiguration_pargs");
xfer += oprot->writeFieldBegin (
"type", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32 ((int32_t) (*(this->type)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getConfiguration_result::~ClientService_getConfiguration_result () throw ()
{
}
uint32_t
ClientService_getConfiguration_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->success.clear ();
uint32_t _size84;
::apache::thrift::protocol::TType _ktype85;
::apache::thrift::protocol::TType _vtype86;
xfer += iprot->readMapBegin (_ktype85, _vtype86,
_size84);
uint32_t _i88;
for (_i88 = 0; _i88 < _size84; ++_i88)
{
std::string _key89;
xfer += iprot->readString (_key89);
std::string& _val90 = this->success[_key89];
xfer += iprot->readString (_val90);
}
xfer += iprot->readMapEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getConfiguration_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getConfiguration_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_MAP, 0);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->success.size ()));
std::map<std::string, std::string>::const_iterator _iter91;
for (_iter91 = this->success.begin ();
_iter91 != this->success.end (); ++_iter91)
{
xfer += oprot->writeString (_iter91->first);
xfer += oprot->writeString (_iter91->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getConfiguration_presult::~ClientService_getConfiguration_presult () throw ()
{
}
uint32_t
ClientService_getConfiguration_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
(*(this->success)).clear ();
uint32_t _size92;
::apache::thrift::protocol::TType _ktype93;
::apache::thrift::protocol::TType _vtype94;
xfer += iprot->readMapBegin (_ktype93, _vtype94,
_size92);
uint32_t _i96;
for (_i96 = 0; _i96 < _size92; ++_i96)
{
std::string _key97;
xfer += iprot->readString (_key97);
std::string& _val98 =
(*(this->success))[_key97];
xfer += iprot->readString (_val98);
}
xfer += iprot->readMapEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getTableConfiguration_args::~ClientService_getTableConfiguration_args () throw ()
{
}
uint32_t
ClientService_getTableConfiguration_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getTableConfiguration_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getTableConfiguration_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getTableConfiguration_pargs::~ClientService_getTableConfiguration_pargs () throw ()
{
}
uint32_t
ClientService_getTableConfiguration_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getTableConfiguration_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getTableConfiguration_result::~ClientService_getTableConfiguration_result () throw ()
{
}
uint32_t
ClientService_getTableConfiguration_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->success.clear ();
uint32_t _size99;
::apache::thrift::protocol::TType _ktype100;
::apache::thrift::protocol::TType _vtype101;
xfer += iprot->readMapBegin (_ktype100,
_vtype101,
_size99);
uint32_t _i103;
for (_i103 = 0; _i103 < _size99; ++_i103)
{
std::string _key104;
xfer += iprot->readString (_key104);
std::string& _val105 =
this->success[_key104];
xfer += iprot->readString (_val105);
}
xfer += iprot->readMapEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getTableConfiguration_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getTableConfiguration_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_MAP, 0);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->success.size ()));
std::map<std::string, std::string>::const_iterator _iter106;
for (_iter106 = this->success.begin ();
_iter106 != this->success.end (); ++_iter106)
{
xfer += oprot->writeString (_iter106->first);
xfer += oprot->writeString (_iter106->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getTableConfiguration_presult::~ClientService_getTableConfiguration_presult () throw ()
{
}
uint32_t
ClientService_getTableConfiguration_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
(*(this->success)).clear ();
uint32_t _size107;
::apache::thrift::protocol::TType _ktype108;
::apache::thrift::protocol::TType _vtype109;
xfer += iprot->readMapBegin (_ktype108,
_vtype109,
_size107);
uint32_t _i111;
for (_i111 = 0; _i111 < _size107; ++_i111)
{
std::string _key112;
xfer += iprot->readString (_key112);
std::string& _val113 =
(*(this->success))[_key112];
xfer += iprot->readString (_val113);
}
xfer += iprot->readMapEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_getNamespaceConfiguration_args::~ClientService_getNamespaceConfiguration_args () throw ()
{
}
uint32_t
ClientService_getNamespaceConfiguration_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->ns);
this->__isset.ns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getNamespaceConfiguration_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getNamespaceConfiguration_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->ns);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getNamespaceConfiguration_pargs::~ClientService_getNamespaceConfiguration_pargs () throw ()
{
}
uint32_t
ClientService_getNamespaceConfiguration_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_getNamespaceConfiguration_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->ns)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_getNamespaceConfiguration_result::~ClientService_getNamespaceConfiguration_result () throw ()
{
}
uint32_t
ClientService_getNamespaceConfiguration_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->success.clear ();
uint32_t _size114;
::apache::thrift::protocol::TType _ktype115;
::apache::thrift::protocol::TType _vtype116;
xfer += iprot->readMapBegin (_ktype115,
_vtype116,
_size114);
uint32_t _i118;
for (_i118 = 0; _i118 < _size114; ++_i118)
{
std::string _key119;
xfer += iprot->readString (_key119);
std::string& _val120 =
this->success[_key119];
xfer += iprot->readString (_val120);
}
xfer += iprot->readMapEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_getNamespaceConfiguration_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_getNamespaceConfiguration_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_MAP, 0);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->success.size ()));
std::map<std::string, std::string>::const_iterator _iter121;
for (_iter121 = this->success.begin ();
_iter121 != this->success.end (); ++_iter121)
{
xfer += oprot->writeString (_iter121->first);
xfer += oprot->writeString (_iter121->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_getNamespaceConfiguration_presult::~ClientService_getNamespaceConfiguration_presult () throw ()
{
}
uint32_t
ClientService_getNamespaceConfiguration_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
(*(this->success)).clear ();
uint32_t _size122;
::apache::thrift::protocol::TType _ktype123;
::apache::thrift::protocol::TType _vtype124;
xfer += iprot->readMapBegin (_ktype123,
_vtype124,
_size122);
uint32_t _i126;
for (_i126 = 0; _i126 < _size122; ++_i126)
{
std::string _key127;
xfer += iprot->readString (_key127);
std::string& _val128 =
(*(this->success))[_key127];
xfer += iprot->readString (_val128);
}
xfer += iprot->readMapEnd ();
}
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_checkClass_args::~ClientService_checkClass_args () throw ()
{
}
uint32_t
ClientService_checkClass_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->className);
this->__isset.className = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->interfaceMatch);
this->__isset.interfaceMatch = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_checkClass_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_checkClass_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->className);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"interfaceMatch", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->interfaceMatch);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_checkClass_pargs::~ClientService_checkClass_pargs () throw ()
{
}
uint32_t
ClientService_checkClass_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_checkClass_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->className)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"interfaceMatch", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->interfaceMatch)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_checkClass_result::~ClientService_checkClass_result () throw ()
{
}
uint32_t
ClientService_checkClass_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_checkClass_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_checkClass_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_checkClass_presult::~ClientService_checkClass_presult () throw ()
{
}
uint32_t
ClientService_checkClass_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_checkTableClass_args::~ClientService_checkTableClass_args () throw ()
{
}
uint32_t
ClientService_checkTableClass_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->className);
this->__isset.className = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->interfaceMatch);
this->__isset.interfaceMatch = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_checkTableClass_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_checkTableClass_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->className);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"interfaceMatch", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->interfaceMatch);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_checkTableClass_pargs::~ClientService_checkTableClass_pargs () throw ()
{
}
uint32_t
ClientService_checkTableClass_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_checkTableClass_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableId)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->className)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"interfaceMatch", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->interfaceMatch)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_checkTableClass_result::~ClientService_checkTableClass_result () throw ()
{
}
uint32_t
ClientService_checkTableClass_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_checkTableClass_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_checkTableClass_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_checkTableClass_presult::~ClientService_checkTableClass_presult () throw ()
{
}
uint32_t
ClientService_checkTableClass_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
ClientService_checkNamespaceClass_args::~ClientService_checkNamespaceClass_args () throw ()
{
}
uint32_t
ClientService_checkNamespaceClass_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->namespaceId);
this->__isset.namespaceId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->className);
this->__isset.className = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->interfaceMatch);
this->__isset.interfaceMatch = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_checkNamespaceClass_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_checkNamespaceClass_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"namespaceId", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->namespaceId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->className);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"interfaceMatch", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString (this->interfaceMatch);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_checkNamespaceClass_pargs::~ClientService_checkNamespaceClass_pargs () throw ()
{
}
uint32_t
ClientService_checkNamespaceClass_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"ClientService_checkNamespaceClass_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"namespaceId", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->namespaceId)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"className", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->className)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"interfaceMatch", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString ((*(this->interfaceMatch)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
ClientService_checkNamespaceClass_result::~ClientService_checkNamespaceClass_result () throw ()
{
}
uint32_t
ClientService_checkNamespaceClass_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ClientService_checkNamespaceClass_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"ClientService_checkNamespaceClass_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
ClientService_checkNamespaceClass_presult::~ClientService_checkNamespaceClass_presult () throw ()
{
}
uint32_t
ClientService_checkNamespaceClass_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
void
ClientServiceClient::getRootTabletLocation (std::string& _return)
{
send_getRootTabletLocation ();
recv_getRootTabletLocation (_return);
}
void
ClientServiceClient::send_getRootTabletLocation ()
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getRootTabletLocation",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getRootTabletLocation_pargs args;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getRootTabletLocation (
std::string& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getRootTabletLocation") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getRootTabletLocation_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getRootTabletLocation failed: unknown result");
}
void
ClientServiceClient::getInstanceId (std::string& _return)
{
send_getInstanceId ();
recv_getInstanceId (_return);
}
void
ClientServiceClient::send_getInstanceId ()
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getInstanceId",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getInstanceId_pargs args;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getInstanceId (std::string& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getInstanceId") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getInstanceId_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getInstanceId failed: unknown result");
}
void
ClientServiceClient::getZooKeepers (std::string& _return)
{
send_getZooKeepers ();
recv_getZooKeepers (_return);
}
void
ClientServiceClient::send_getZooKeepers ()
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getZooKeepers",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getZooKeepers_pargs args;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getZooKeepers (std::string& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getZooKeepers") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getZooKeepers_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getZooKeepers failed: unknown result");
}
void
ClientServiceClient::bulkImportFiles (
std::vector<std::string> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t tid, const std::string& tableId,
const std::vector<std::string> & files,
const std::string& errorDir, const bool setTime)
{
send_bulkImportFiles (tinfo, credentials, tid, tableId, files,
errorDir, setTime);
recv_bulkImportFiles (_return);
}
void
ClientServiceClient::send_bulkImportFiles (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t tid, const std::string& tableId,
const std::vector<std::string> & files,
const std::string& errorDir, const bool setTime)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("bulkImportFiles",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_bulkImportFiles_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tid = &tid;
args.tableId = &tableId;
args.files = &files;
args.errorDir = &errorDir;
args.setTime = &setTime;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_bulkImportFiles (
std::vector<std::string> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("bulkImportFiles") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_bulkImportFiles_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"bulkImportFiles failed: unknown result");
}
bool
ClientServiceClient::isActive (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const int64_t tid)
{
send_isActive (tinfo, tid);
return recv_isActive ();
}
void
ClientServiceClient::send_isActive (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const int64_t tid)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("isActive",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_isActive_pargs args;
args.tinfo = &tinfo;
args.tid = &tid;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_isActive ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("isActive") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_isActive_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"isActive failed: unknown result");
}
void
ClientServiceClient::ping (
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_ping (credentials);
recv_ping ();
}
void
ClientServiceClient::send_ping (
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("ping",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_ping_pargs args;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_ping ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("ping") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_ping_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
ClientServiceClient::getDiskUsage (
std::vector<TDiskUsage> & _return,
const std::set<std::string> & tables,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_getDiskUsage (tables, credentials);
recv_getDiskUsage (_return);
}
void
ClientServiceClient::send_getDiskUsage (
const std::set<std::string> & tables,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getDiskUsage",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getDiskUsage_pargs args;
args.tables = &tables;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getDiskUsage (
std::vector<TDiskUsage> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getDiskUsage") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getDiskUsage_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.toe)
{
throw result.toe;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getDiskUsage failed: unknown result");
}
void
ClientServiceClient::listLocalUsers (
std::set<std::string> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_listLocalUsers (tinfo, credentials);
recv_listLocalUsers (_return);
}
void
ClientServiceClient::send_listLocalUsers (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("listLocalUsers",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_listLocalUsers_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_listLocalUsers (
std::set<std::string> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("listLocalUsers") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_listLocalUsers_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"listLocalUsers failed: unknown result");
}
void
ClientServiceClient::createLocalUser (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& password)
{
send_createLocalUser (tinfo, credentials, principal, password);
recv_createLocalUser ();
}
void
ClientServiceClient::send_createLocalUser (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& password)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("createLocalUser",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_createLocalUser_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.password = &<PASSWORD>;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_createLocalUser ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("createLocalUser") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_createLocalUser_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
ClientServiceClient::dropLocalUser (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal)
{
send_dropLocalUser (tinfo, credentials, principal);
recv_dropLocalUser ();
}
void
ClientServiceClient::send_dropLocalUser (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("dropLocalUser",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_dropLocalUser_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_dropLocalUser ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("dropLocalUser") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_dropLocalUser_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
ClientServiceClient::changeLocalUserPassword (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& password)
{
send_changeLocalUserPassword (tinfo, credentials, principal,
password);
recv_changeLocalUserPassword ();
}
void
ClientServiceClient::send_changeLocalUserPassword (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& password)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("changeLocalUserPassword",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_changeLocalUserPassword_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.password = &<PASSWORD>;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_changeLocalUserPassword ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("changeLocalUserPassword") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_changeLocalUserPassword_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
bool
ClientServiceClient::authenticate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_authenticate (tinfo, credentials);
return recv_authenticate ();
}
void
ClientServiceClient::send_authenticate (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("authenticate",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_authenticate_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_authenticate ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("authenticate") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_authenticate_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"authenticate failed: unknown result");
}
bool
ClientServiceClient::authenticateUser (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::security::thrift::TCredentials& toAuth)
{
send_authenticateUser (tinfo, credentials, toAuth);
return recv_authenticateUser ();
}
void
ClientServiceClient::send_authenticateUser (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ::org::apache::accumulo::core::security::thrift::TCredentials& toAuth)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("authenticateUser",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_authenticateUser_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.toAuth = &toAuth;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_authenticateUser ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("authenticateUser") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_authenticateUser_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"authenticateUser failed: unknown result");
}
void
ClientServiceClient::changeAuthorizations (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal,
const std::vector<std::string> & authorizations)
{
send_changeAuthorizations (tinfo, credentials, principal,
authorizations);
recv_changeAuthorizations ();
}
void
ClientServiceClient::send_changeAuthorizations (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal,
const std::vector<std::string> & authorizations)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("changeAuthorizations",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_changeAuthorizations_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.authorizations = &authorizations;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_changeAuthorizations ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("changeAuthorizations") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_changeAuthorizations_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
ClientServiceClient::getUserAuthorizations (
std::vector<std::string> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal)
{
send_getUserAuthorizations (tinfo, credentials, principal);
recv_getUserAuthorizations (_return);
}
void
ClientServiceClient::send_getUserAuthorizations (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getUserAuthorizations",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getUserAuthorizations_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getUserAuthorizations (
std::vector<std::string> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getUserAuthorizations") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getUserAuthorizations_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getUserAuthorizations failed: unknown result");
}
bool
ClientServiceClient::hasSystemPermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const int8_t sysPerm)
{
send_hasSystemPermission (tinfo, credentials, principal,
sysPerm);
return recv_hasSystemPermission ();
}
void
ClientServiceClient::send_hasSystemPermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const int8_t sysPerm)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("hasSystemPermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_hasSystemPermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.sysPerm = &sysPerm;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_hasSystemPermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("hasSystemPermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_hasSystemPermission_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"hasSystemPermission failed: unknown result");
}
bool
ClientServiceClient::hasTablePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& tableName,
const int8_t tblPerm)
{
send_hasTablePermission (tinfo, credentials, principal,
tableName, tblPerm);
return recv_hasTablePermission ();
}
void
ClientServiceClient::send_hasTablePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& tableName,
const int8_t tblPerm)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("hasTablePermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_hasTablePermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.tableName = &tableName;
args.tblPerm = &tblPerm;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_hasTablePermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("hasTablePermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_hasTablePermission_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"hasTablePermission failed: unknown result");
}
bool
ClientServiceClient::hasNamespacePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& ns,
const int8_t tblNspcPerm)
{
send_hasNamespacePermission (tinfo, credentials, principal, ns,
tblNspcPerm);
return recv_hasNamespacePermission ();
}
void
ClientServiceClient::send_hasNamespacePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& ns,
const int8_t tblNspcPerm)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("hasNamespacePermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_hasNamespacePermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.ns = &ns;
args.tblNspcPerm = &tblNspcPerm;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_hasNamespacePermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("hasNamespacePermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_hasNamespacePermission_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"hasNamespacePermission failed: unknown result");
}
void
ClientServiceClient::grantSystemPermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const int8_t permission)
{
send_grantSystemPermission (tinfo, credentials, principal,
permission);
recv_grantSystemPermission ();
}
void
ClientServiceClient::send_grantSystemPermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const int8_t permission)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("grantSystemPermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_grantSystemPermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.permission = &permission;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_grantSystemPermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("grantSystemPermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_grantSystemPermission_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
ClientServiceClient::revokeSystemPermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const int8_t permission)
{
send_revokeSystemPermission (tinfo, credentials, principal,
permission);
recv_revokeSystemPermission ();
}
void
ClientServiceClient::send_revokeSystemPermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const int8_t permission)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("revokeSystemPermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_revokeSystemPermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.permission = &permission;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_revokeSystemPermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("revokeSystemPermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_revokeSystemPermission_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
ClientServiceClient::grantTablePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& tableName,
const int8_t permission)
{
send_grantTablePermission (tinfo, credentials, principal,
tableName, permission);
recv_grantTablePermission ();
}
void
ClientServiceClient::send_grantTablePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& tableName,
const int8_t permission)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("grantTablePermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_grantTablePermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.tableName = &tableName;
args.permission = &permission;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_grantTablePermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("grantTablePermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_grantTablePermission_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
ClientServiceClient::revokeTablePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& tableName,
const int8_t permission)
{
send_revokeTablePermission (tinfo, credentials, principal,
tableName, permission);
recv_revokeTablePermission ();
}
void
ClientServiceClient::send_revokeTablePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& tableName,
const int8_t permission)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("revokeTablePermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_revokeTablePermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.tableName = &tableName;
args.permission = &permission;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_revokeTablePermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("revokeTablePermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_revokeTablePermission_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
ClientServiceClient::grantNamespacePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& ns,
const int8_t permission)
{
send_grantNamespacePermission (tinfo, credentials, principal,
ns, permission);
recv_grantNamespacePermission ();
}
void
ClientServiceClient::send_grantNamespacePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& ns,
const int8_t permission)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("grantNamespacePermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_grantNamespacePermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.ns = &ns;
args.permission = &permission;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_grantNamespacePermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("grantNamespacePermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_grantNamespacePermission_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
ClientServiceClient::revokeNamespacePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& ns,
const int8_t permission)
{
send_revokeNamespacePermission (tinfo, credentials, principal,
ns, permission);
recv_revokeNamespacePermission ();
}
void
ClientServiceClient::send_revokeNamespacePermission (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& principal, const std::string& ns,
const int8_t permission)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("revokeNamespacePermission",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_revokeNamespacePermission_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.principal = &principal;
args.ns = &ns;
args.permission = &permission;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_revokeNamespacePermission ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("revokeNamespacePermission") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_revokeNamespacePermission_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
ClientServiceClient::getConfiguration (
std::map<std::string, std::string> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ConfigurationType::type type)
{
send_getConfiguration (tinfo, credentials, type);
recv_getConfiguration (_return);
}
void
ClientServiceClient::send_getConfiguration (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const ConfigurationType::type type)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getConfiguration",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getConfiguration_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.type = &type;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getConfiguration (
std::map<std::string, std::string> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getConfiguration") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getConfiguration_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getConfiguration failed: unknown result");
}
void
ClientServiceClient::getTableConfiguration (
std::map<std::string, std::string> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName)
{
send_getTableConfiguration (tinfo, credentials, tableName);
recv_getTableConfiguration (_return);
}
void
ClientServiceClient::send_getTableConfiguration (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getTableConfiguration",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getTableConfiguration_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableName = &tableName;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getTableConfiguration (
std::map<std::string, std::string> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getTableConfiguration") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getTableConfiguration_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getTableConfiguration failed: unknown result");
}
void
ClientServiceClient::getNamespaceConfiguration (
std::map<std::string, std::string> & _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& ns)
{
send_getNamespaceConfiguration (tinfo, credentials, ns);
recv_getNamespaceConfiguration (_return);
}
void
ClientServiceClient::send_getNamespaceConfiguration (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& ns)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getNamespaceConfiguration",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_getNamespaceConfiguration_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.ns = &ns;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
ClientServiceClient::recv_getNamespaceConfiguration (
std::map<std::string, std::string> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getNamespaceConfiguration") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
ClientService_getNamespaceConfiguration_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getNamespaceConfiguration failed: unknown result");
}
bool
ClientServiceClient::checkClass (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& className,
const std::string& interfaceMatch)
{
send_checkClass (tinfo, credentials, className, interfaceMatch);
return recv_checkClass ();
}
void
ClientServiceClient::send_checkClass (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& className,
const std::string& interfaceMatch)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("checkClass",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_checkClass_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.className = &className;
args.interfaceMatch = &interfaceMatch;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_checkClass ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("checkClass") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_checkClass_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"checkClass failed: unknown result");
}
bool
ClientServiceClient::checkTableClass (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableId, const std::string& className,
const std::string& interfaceMatch)
{
send_checkTableClass (tinfo, credentials, tableId, className,
interfaceMatch);
return recv_checkTableClass ();
}
void
ClientServiceClient::send_checkTableClass (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableId, const std::string& className,
const std::string& interfaceMatch)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("checkTableClass",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_checkTableClass_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableId = &tableId;
args.className = &className;
args.interfaceMatch = &interfaceMatch;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_checkTableClass ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("checkTableClass") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_checkTableClass_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"checkTableClass failed: unknown result");
}
bool
ClientServiceClient::checkNamespaceClass (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& namespaceId, const std::string& className,
const std::string& interfaceMatch)
{
send_checkNamespaceClass (tinfo, credentials, namespaceId,
className, interfaceMatch);
return recv_checkNamespaceClass ();
}
void
ClientServiceClient::send_checkNamespaceClass (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& namespaceId, const std::string& className,
const std::string& interfaceMatch)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("checkNamespaceClass",
::apache::thrift::protocol::T_CALL,
cseqid);
ClientService_checkNamespaceClass_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.namespaceId = &namespaceId;
args.className = &className;
args.interfaceMatch = &interfaceMatch;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
ClientServiceClient::recv_checkNamespaceClass ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("checkNamespaceClass") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
ClientService_checkNamespaceClass_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"checkNamespaceClass failed: unknown result");
}
bool
ClientServiceProcessor::dispatchCall (
::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
const std::string& fname, int32_t seqid, void* callContext)
{
ProcessMap::iterator pfn;
pfn = processMap_.find (fname);
if (pfn == processMap_.end ())
{
iprot->skip (::apache::thrift::protocol::T_STRUCT);
iprot->readMessageEnd ();
iprot->getTransport ()->readEnd ();
::apache::thrift::TApplicationException x (
::apache::thrift::TApplicationException::UNKNOWN_METHOD,
"Invalid method name: '" + fname + "'");
oprot->writeMessageBegin (
fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return true;
}
(this->*(pfn->second)) (seqid, iprot, oprot, callContext);
return true;
}
void
ClientServiceProcessor::process_getRootTabletLocation (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getRootTabletLocation", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getRootTabletLocation");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getRootTabletLocation");
}
ClientService_getRootTabletLocation_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getRootTabletLocation", bytes);
}
ClientService_getRootTabletLocation_result result;
try
{
iface_->getRootTabletLocation (result.success);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getRootTabletLocation");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getRootTabletLocation",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getRootTabletLocation");
}
oprot->writeMessageBegin ("getRootTabletLocation",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getRootTabletLocation", bytes);
}
}
void
ClientServiceProcessor::process_getInstanceId (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getInstanceId", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getInstanceId");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getInstanceId");
}
ClientService_getInstanceId_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getInstanceId", bytes);
}
ClientService_getInstanceId_result result;
try
{
iface_->getInstanceId (result.success);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getInstanceId");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getInstanceId",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getInstanceId");
}
oprot->writeMessageBegin ("getInstanceId",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getInstanceId", bytes);
}
}
void
ClientServiceProcessor::process_getZooKeepers (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getZooKeepers", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getZooKeepers");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getZooKeepers");
}
ClientService_getZooKeepers_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getZooKeepers", bytes);
}
ClientService_getZooKeepers_result result;
try
{
iface_->getZooKeepers (result.success);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getZooKeepers");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getZooKeepers",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getZooKeepers");
}
oprot->writeMessageBegin ("getZooKeepers",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getZooKeepers", bytes);
}
}
void
ClientServiceProcessor::process_bulkImportFiles (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.bulkImportFiles", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.bulkImportFiles");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.bulkImportFiles");
}
ClientService_bulkImportFiles_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.bulkImportFiles", bytes);
}
ClientService_bulkImportFiles_result result;
try
{
iface_->bulkImportFiles (result.success, args.tinfo,
args.credentials, args.tid,
args.tableId, args.files,
args.errorDir, args.setTime);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.bulkImportFiles");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"bulkImportFiles",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.bulkImportFiles");
}
oprot->writeMessageBegin ("bulkImportFiles",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.bulkImportFiles", bytes);
}
}
void
ClientServiceProcessor::process_isActive (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.isActive", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "ClientService.isActive");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"ClientService.isActive");
}
ClientService_isActive_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"ClientService.isActive",
bytes);
}
ClientService_isActive_result result;
try
{
result.success = iface_->isActive (args.tinfo, args.tid);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.isActive");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"isActive", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (ctx,
"ClientService.isActive");
}
oprot->writeMessageBegin ("isActive",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (ctx,
"ClientService.isActive",
bytes);
}
}
void
ClientServiceProcessor::process_ping (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext ("ClientService.ping",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "ClientService.ping");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx, "ClientService.ping");
}
ClientService_ping_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx, "ClientService.ping",
bytes);
}
ClientService_ping_result result;
try
{
iface_->ping (args.credentials);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.ping");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"ping", ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (ctx, "ClientService.ping");
}
oprot->writeMessageBegin ("ping",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (ctx, "ClientService.ping",
bytes);
}
}
void
ClientServiceProcessor::process_getDiskUsage (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getDiskUsage", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getDiskUsage");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"ClientService.getDiskUsage");
}
ClientService_getDiskUsage_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"ClientService.getDiskUsage",
bytes);
}
ClientService_getDiskUsage_result result;
try
{
iface_->getDiskUsage (result.success, args.tables,
args.credentials);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &toe)
{
result.toe = toe;
result.__isset.toe = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getDiskUsage");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getDiskUsage", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getDiskUsage");
}
oprot->writeMessageBegin ("getDiskUsage",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getDiskUsage", bytes);
}
}
void
ClientServiceProcessor::process_listLocalUsers (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.listLocalUsers", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.listLocalUsers");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.listLocalUsers");
}
ClientService_listLocalUsers_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.listLocalUsers", bytes);
}
ClientService_listLocalUsers_result result;
try
{
iface_->listLocalUsers (result.success, args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.listLocalUsers");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"listLocalUsers",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.listLocalUsers");
}
oprot->writeMessageBegin ("listLocalUsers",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.listLocalUsers", bytes);
}
}
void
ClientServiceProcessor::process_createLocalUser (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.createLocalUser", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.createLocalUser");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.createLocalUser");
}
ClientService_createLocalUser_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.createLocalUser", bytes);
}
ClientService_createLocalUser_result result;
try
{
iface_->createLocalUser (args.tinfo, args.credentials,
args.principal, args.password);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.createLocalUser");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"createLocalUser",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.createLocalUser");
}
oprot->writeMessageBegin ("createLocalUser",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.createLocalUser", bytes);
}
}
void
ClientServiceProcessor::process_dropLocalUser (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.dropLocalUser", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.dropLocalUser");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.dropLocalUser");
}
ClientService_dropLocalUser_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.dropLocalUser", bytes);
}
ClientService_dropLocalUser_result result;
try
{
iface_->dropLocalUser (args.tinfo, args.credentials,
args.principal);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.dropLocalUser");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"dropLocalUser",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.dropLocalUser");
}
oprot->writeMessageBegin ("dropLocalUser",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.dropLocalUser", bytes);
}
}
void
ClientServiceProcessor::process_changeLocalUserPassword (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.changeLocalUserPassword", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.changeLocalUserPassword");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.changeLocalUserPassword");
}
ClientService_changeLocalUserPassword_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.changeLocalUserPassword", bytes);
}
ClientService_changeLocalUserPassword_result result;
try
{
iface_->changeLocalUserPassword (args.tinfo,
args.credentials,
args.principal,
args.password);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.changeLocalUserPassword");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"changeLocalUserPassword",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.changeLocalUserPassword");
}
oprot->writeMessageBegin ("changeLocalUserPassword",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.changeLocalUserPassword", bytes);
}
}
void
ClientServiceProcessor::process_authenticate (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.authenticate", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.authenticate");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"ClientService.authenticate");
}
ClientService_authenticate_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"ClientService.authenticate",
bytes);
}
ClientService_authenticate_result result;
try
{
result.success = iface_->authenticate (args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.authenticate");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"authenticate", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.authenticate");
}
oprot->writeMessageBegin ("authenticate",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.authenticate", bytes);
}
}
void
ClientServiceProcessor::process_authenticateUser (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.authenticateUser", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.authenticateUser");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.authenticateUser");
}
ClientService_authenticateUser_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.authenticateUser", bytes);
}
ClientService_authenticateUser_result result;
try
{
result.success = iface_->authenticateUser (args.tinfo,
args.credentials,
args.toAuth);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.authenticateUser");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"authenticateUser",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.authenticateUser");
}
oprot->writeMessageBegin ("authenticateUser",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.authenticateUser", bytes);
}
}
void
ClientServiceProcessor::process_changeAuthorizations (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.changeAuthorizations", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.changeAuthorizations");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.changeAuthorizations");
}
ClientService_changeAuthorizations_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.changeAuthorizations", bytes);
}
ClientService_changeAuthorizations_result result;
try
{
iface_->changeAuthorizations (args.tinfo, args.credentials,
args.principal,
args.authorizations);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.changeAuthorizations");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"changeAuthorizations",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.changeAuthorizations");
}
oprot->writeMessageBegin ("changeAuthorizations",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.changeAuthorizations", bytes);
}
}
void
ClientServiceProcessor::process_getUserAuthorizations (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getUserAuthorizations", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getUserAuthorizations");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getUserAuthorizations");
}
ClientService_getUserAuthorizations_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getUserAuthorizations", bytes);
}
ClientService_getUserAuthorizations_result result;
try
{
iface_->getUserAuthorizations (result.success, args.tinfo,
args.credentials,
args.principal);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getUserAuthorizations");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getUserAuthorizations",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getUserAuthorizations");
}
oprot->writeMessageBegin ("getUserAuthorizations",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getUserAuthorizations", bytes);
}
}
void
ClientServiceProcessor::process_hasSystemPermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.hasSystemPermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.hasSystemPermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.hasSystemPermission");
}
ClientService_hasSystemPermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.hasSystemPermission", bytes);
}
ClientService_hasSystemPermission_result result;
try
{
result.success = iface_->hasSystemPermission (
args.tinfo, args.credentials, args.principal,
args.sysPerm);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.hasSystemPermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"hasSystemPermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.hasSystemPermission");
}
oprot->writeMessageBegin ("hasSystemPermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.hasSystemPermission", bytes);
}
}
void
ClientServiceProcessor::process_hasTablePermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.hasTablePermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.hasTablePermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.hasTablePermission");
}
ClientService_hasTablePermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.hasTablePermission", bytes);
}
ClientService_hasTablePermission_result result;
try
{
result.success = iface_->hasTablePermission (
args.tinfo, args.credentials, args.principal,
args.tableName, args.tblPerm);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.hasTablePermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"hasTablePermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.hasTablePermission");
}
oprot->writeMessageBegin ("hasTablePermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.hasTablePermission", bytes);
}
}
void
ClientServiceProcessor::process_hasNamespacePermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.hasNamespacePermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.hasNamespacePermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.hasNamespacePermission");
}
ClientService_hasNamespacePermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.hasNamespacePermission", bytes);
}
ClientService_hasNamespacePermission_result result;
try
{
result.success = iface_->hasNamespacePermission (
args.tinfo, args.credentials, args.principal, args.ns,
args.tblNspcPerm);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.hasNamespacePermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"hasNamespacePermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.hasNamespacePermission");
}
oprot->writeMessageBegin ("hasNamespacePermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.hasNamespacePermission", bytes);
}
}
void
ClientServiceProcessor::process_grantSystemPermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.grantSystemPermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.grantSystemPermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.grantSystemPermission");
}
ClientService_grantSystemPermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.grantSystemPermission", bytes);
}
ClientService_grantSystemPermission_result result;
try
{
iface_->grantSystemPermission (args.tinfo, args.credentials,
args.principal,
args.permission);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.grantSystemPermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"grantSystemPermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.grantSystemPermission");
}
oprot->writeMessageBegin ("grantSystemPermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.grantSystemPermission", bytes);
}
}
void
ClientServiceProcessor::process_revokeSystemPermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.revokeSystemPermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.revokeSystemPermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.revokeSystemPermission");
}
ClientService_revokeSystemPermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.revokeSystemPermission", bytes);
}
ClientService_revokeSystemPermission_result result;
try
{
iface_->revokeSystemPermission (args.tinfo,
args.credentials,
args.principal,
args.permission);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.revokeSystemPermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"revokeSystemPermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.revokeSystemPermission");
}
oprot->writeMessageBegin ("revokeSystemPermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.revokeSystemPermission", bytes);
}
}
void
ClientServiceProcessor::process_grantTablePermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.grantTablePermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.grantTablePermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.grantTablePermission");
}
ClientService_grantTablePermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.grantTablePermission", bytes);
}
ClientService_grantTablePermission_result result;
try
{
iface_->grantTablePermission (args.tinfo, args.credentials,
args.principal,
args.tableName,
args.permission);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.grantTablePermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"grantTablePermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.grantTablePermission");
}
oprot->writeMessageBegin ("grantTablePermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.grantTablePermission", bytes);
}
}
void
ClientServiceProcessor::process_revokeTablePermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.revokeTablePermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.revokeTablePermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.revokeTablePermission");
}
ClientService_revokeTablePermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.revokeTablePermission", bytes);
}
ClientService_revokeTablePermission_result result;
try
{
iface_->revokeTablePermission (args.tinfo, args.credentials,
args.principal,
args.tableName,
args.permission);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.revokeTablePermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"revokeTablePermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.revokeTablePermission");
}
oprot->writeMessageBegin ("revokeTablePermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.revokeTablePermission", bytes);
}
}
void
ClientServiceProcessor::process_grantNamespacePermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.grantNamespacePermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.grantNamespacePermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.grantNamespacePermission");
}
ClientService_grantNamespacePermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.grantNamespacePermission", bytes);
}
ClientService_grantNamespacePermission_result result;
try
{
iface_->grantNamespacePermission (args.tinfo,
args.credentials,
args.principal, args.ns,
args.permission);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.grantNamespacePermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"grantNamespacePermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.grantNamespacePermission");
}
oprot->writeMessageBegin ("grantNamespacePermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.grantNamespacePermission", bytes);
}
}
void
ClientServiceProcessor::process_revokeNamespacePermission (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.revokeNamespacePermission", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.revokeNamespacePermission");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.revokeNamespacePermission");
}
ClientService_revokeNamespacePermission_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.revokeNamespacePermission", bytes);
}
ClientService_revokeNamespacePermission_result result;
try
{
iface_->revokeNamespacePermission (args.tinfo,
args.credentials,
args.principal, args.ns,
args.permission);
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.revokeNamespacePermission");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"revokeNamespacePermission",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.revokeNamespacePermission");
}
oprot->writeMessageBegin ("revokeNamespacePermission",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.revokeNamespacePermission", bytes);
}
}
void
ClientServiceProcessor::process_getConfiguration (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getConfiguration", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getConfiguration");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getConfiguration");
}
ClientService_getConfiguration_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getConfiguration", bytes);
}
ClientService_getConfiguration_result result;
try
{
iface_->getConfiguration (result.success, args.tinfo,
args.credentials, args.type);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getConfiguration");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getConfiguration",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getConfiguration");
}
oprot->writeMessageBegin ("getConfiguration",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getConfiguration", bytes);
}
}
void
ClientServiceProcessor::process_getTableConfiguration (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getTableConfiguration", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getTableConfiguration");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getTableConfiguration");
}
ClientService_getTableConfiguration_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getTableConfiguration", bytes);
}
ClientService_getTableConfiguration_result result;
try
{
iface_->getTableConfiguration (result.success, args.tinfo,
args.credentials,
args.tableName);
result.__isset.success = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getTableConfiguration");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getTableConfiguration",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getTableConfiguration");
}
oprot->writeMessageBegin ("getTableConfiguration",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getTableConfiguration", bytes);
}
}
void
ClientServiceProcessor::process_getNamespaceConfiguration (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.getNamespaceConfiguration", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.getNamespaceConfiguration");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.getNamespaceConfiguration");
}
ClientService_getNamespaceConfiguration_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.getNamespaceConfiguration", bytes);
}
ClientService_getNamespaceConfiguration_result result;
try
{
iface_->getNamespaceConfiguration (result.success,
args.tinfo,
args.credentials,
args.ns);
result.__isset.success = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.getNamespaceConfiguration");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getNamespaceConfiguration",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.getNamespaceConfiguration");
}
oprot->writeMessageBegin ("getNamespaceConfiguration",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.getNamespaceConfiguration", bytes);
}
}
void
ClientServiceProcessor::process_checkClass (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.checkClass", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.checkClass");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"ClientService.checkClass");
}
ClientService_checkClass_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"ClientService.checkClass",
bytes);
}
ClientService_checkClass_result result;
try
{
result.success = iface_->checkClass (args.tinfo,
args.credentials,
args.className,
args.interfaceMatch);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.checkClass");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"checkClass", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (ctx,
"ClientService.checkClass");
}
oprot->writeMessageBegin ("checkClass",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (ctx,
"ClientService.checkClass",
bytes);
}
}
void
ClientServiceProcessor::process_checkTableClass (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.checkTableClass", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.checkTableClass");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.checkTableClass");
}
ClientService_checkTableClass_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.checkTableClass", bytes);
}
ClientService_checkTableClass_result result;
try
{
result.success = iface_->checkTableClass (
args.tinfo, args.credentials, args.tableId,
args.className, args.interfaceMatch);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.checkTableClass");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"checkTableClass",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.checkTableClass");
}
oprot->writeMessageBegin ("checkTableClass",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.checkTableClass", bytes);
}
}
void
ClientServiceProcessor::process_checkNamespaceClass (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"ClientService.checkNamespaceClass", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"ClientService.checkNamespaceClass");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "ClientService.checkNamespaceClass");
}
ClientService_checkNamespaceClass_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "ClientService.checkNamespaceClass", bytes);
}
ClientService_checkNamespaceClass_result result;
try
{
result.success = iface_->checkNamespaceClass (
args.tinfo, args.credentials, args.namespaceId,
args.className, args.interfaceMatch);
result.__isset.success = true;
}
catch (ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "ClientService.checkNamespaceClass");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"checkNamespaceClass",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "ClientService.checkNamespaceClass");
}
oprot->writeMessageBegin ("checkNamespaceClass",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "ClientService.checkNamespaceClass", bytes);
}
}
::boost::shared_ptr<::apache::thrift::TProcessor>
ClientServiceProcessorFactory::getProcessor (
const ::apache::thrift::TConnectionInfo& connInfo)
{
::apache::thrift::ReleaseHandler<ClientServiceIfFactory> cleanup (
handlerFactory_);
::boost::shared_ptr<ClientServiceIf> handler (
handlerFactory_->getHandler (connInfo), cleanup);
::boost::shared_ptr<::apache::thrift::TProcessor> processor (
new ClientServiceProcessor (handler));
return processor;
}
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef SOURCE_H_
#define SOURCE_H_
#include <iostream>
#include <string>
#include <cstdint>
#include <vector>
using namespace std;
#include "./constructs/Results.h"
#include "../data/constructs/server/ServerDefinition.h"
#include "../data/constructs/IterInfo.h"
#include "../data/constructs/column.h"
namespace scanners {
using namespace cclient::data;
using namespace cclient::data::tserver;
template<typename T, class BlockType>
class Source {
public:
Source() {
iters = new vector<cclient::data::IterInfo*>();
}
virtual void addRange(Range *range) = 0;
/**
* Add the list of user supplied Iterators;
*/
void addIterators(vector<cclient::data::IterInfo*> *iterV) {
iters->insert(iters->end(), iterV->begin(), iterV->end());
}
virtual Results<T, BlockType> * getResultSet() = 0;
virtual void addResults(Results<T, BlockType> *results) = 0;
virtual ~Source() {
for(auto iter : *iters)
{
delete iter;
}
delete iters;
for(auto column : columns)
{
delete column;
}
}
vector<Column*> *getColumns()
{
return &columns;
}
vector<cclient::data::IterInfo*> *getIters()
{
return iters;
}
void fetchColumn(string col, string colqual="")
{
if (!IsEmpty(&colqual))
{
columns.push_back(new Column(col,colqual));
}
else
columns.push_back(new Column(col));
}
protected:
vector<Column*> columns;
vector<cclient::data::IterInfo*> *iters;
};
}
#endif /* SCANNER_H_ */
<file_sep>/*
* 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.
*/
#ifndef SRC_INTERCONNECT_FATEINTERFACE_H_
#define SRC_INTERCONNECT_FATEINTERFACE_H_
#include <concurrency/ThreadManager.h>
#include <chrono>
#include <thread>
#include <pthread.h>
#include <sys/time.h>
#include <map>
#include <set>
#include <string>
#include <algorithm> // std::random_shuffle
#include <vector> // std::vector
#include <ctime> // std::time
#include <cstdlib> // std::rand, std::srand
using namespace std;
#include "../../data/constructs/inputvalidation.h"
#include "../../data/constructs/IterInfo.h"
#include "../../data/constructs/configuration/Configuration.h"
#include "../../data/extern/thrift/data_types.h"
#include "../../data/extern/thrift/tabletserver_types.h"
#include "../../data/constructs/scanstate.h"
#include "../../data/exceptions/ClientException.h"
#include "../../data/exceptions/IllegalArgumentException.h"
#include "../../data/constructs/tablet/TabletType.h"
#include "../scanrequest/ScanIdentifier.h"
#include "Transport.h"
#include <boost/concept_check.hpp>
#include <boost/shared_ptr.hpp>
#include "../../data/extern/thrift/ClientService.h"
#include "../../data/extern/thrift/master_types.h"
#include "../../data/extern/thrift/MasterClientService.h"
#include "../../data/extern/thrift/ThriftWrapper.h"
#include "../../data/constructs/security/AuthInfo.h"
#include "../Scan.h"
using namespace cclient::data;
using namespace cclient::exceptions;
//#include <protocol/TBinaryProtocol.h>
#include <protocol/TCompactProtocol.h>
#include <server/TSimpleServer.h>
#include <transport/TServerSocket.h>
#include <transport/TServerTransport.h>
#include <transport/TTransport.h>
#include <transport/TSocket.h>
#include <transport/TTransportException.h>
#include <transport/TBufferTransports.h>
#include "MasterInterface.h"
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
namespace interconnect
{
/**
* Fate implementation class
* Purpose: Defines the interface for all fate operations
* Design: Extends MasterInterface to be able to access
* master objects for re-creation
**/
class FateInterface : public MasterInterface
{
protected:
/**
* Executes fate operations.
* @param auth authorization info
* @param type fate operation
* @param tableArgs namespace or table arguments
* @param options options for this fate operation
* @param wait determines if we will wait on the fate operation
* @return return value of the fate operation
**/
string
doFateOperations (
AuthInfo *auth,
org::apache::accumulo::core::master::thrift::FateOperation::type type,
vector<string> tableArgs, map<string, string> options, bool wait = false);
};
}
#endif
<file_sep>/*
* 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.
*/
#ifndef security_TYPES_H
#define security_TYPES_H
#include <iosfwd>
#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>
#include <thrift/cxxfunctional.h>
namespace org { namespace apache { namespace accumulo { namespace core { namespace security { namespace thrift {
class TCredentials;
typedef struct _TCredentials__isset {
_TCredentials__isset() : principal(false), tokenClassName(false), token(false), instanceId(false) {}
bool principal :1;
bool tokenClassName :1;
bool token :1;
bool instanceId :1;
} _TCredentials__isset;
class TCredentials {
public:
static const char* ascii_fingerprint; // = "C93D890311F28844166CF6E571EB3AC2";
static const uint8_t binary_fingerprint[16]; // = {0xC9,0x3D,0x89,0x03,0x11,0xF2,0x88,0x44,0x16,0x6C,0xF6,0xE5,0x71,0xEB,0x3A,0xC2};
TCredentials(const TCredentials&);
TCredentials& operator=(const TCredentials&);
TCredentials() : principal(), tokenClassName(), token(), instanceId() {
}
virtual ~TCredentials() throw();
std::string principal;
std::string tokenClassName;
std::string token;
std::string instanceId;
_TCredentials__isset __isset;
void __set_principal(const std::string& val);
void __set_tokenClassName(const std::string& val);
void __set_token(const std::string& val);
void __set_instanceId(const std::string& val);
bool operator == (const TCredentials & rhs) const
{
if (!(principal == rhs.principal))
return false;
if (!(tokenClassName == rhs.tokenClassName))
return false;
if (!(token == rhs.token))
return false;
if (!(instanceId == rhs.instanceId))
return false;
return true;
}
bool operator != (const TCredentials &rhs) const {
return !(*this == rhs);
}
bool operator < (const TCredentials & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
friend std::ostream& operator<<(std::ostream& out, const TCredentials& obj);
};
void swap(TCredentials &a, TCredentials &b);
}}}}}} // namespace
#endif
<file_sep>/*
* 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.
*/
#ifndef USEROPERATIONS_H
#define USEROPERATIONS_H
#include <iostream>
#include "../../data/constructs/security/Authorizations.h"
#include "../../data/constructs/KeyValue.h"
#include "../../data/constructs/security/AuthInfo.h"
#include "../../data/constructs/client/Instance.h"
#include "../../scanner/Source.h"
#include "../../scanner/constructs/Results.h"
#include "../transport/AccumuloMasterTransporter.h"
#include "../RootInterface.h"
#include <map>
#include <string>
using namespace scanners;
using namespace writer;
using namespace cclient::data;
using namespace cclient::data::security;
namespace interconnect
{
class SecurityOperations
{
public:
SecurityOperations(AuthInfo *creds, Instance *instance,
CachedTransport<interconnect::AccumuloMasterTransporter> *interface, DistributedConnector<interconnect::AccumuloMasterTransporter> *distributedConnector) : credentials(creds), myInstance(instance),clientInterface(interface->getTransport())
{
ptr = boost::shared_ptr<interconnect::AccumuloMasterTransporter>(interface->getTransporter());
cachedTransport = interface;
refDistributedConnector = distributedConnector;
}
~SecurityOperations();
bool createUser(string user,string password);
bool changeUserPassword(string user, string password);
bool dropUser(string user);
cclient::data::security::Authorizations *getAuths(string user);
bool grantAuthorizations(Authorizations *auths, string user);
protected:
boost::shared_ptr<interconnect::AccumuloMasterTransporter> ptr;
interconnect::AccumuloMasterTransporter *clientInterface;
CachedTransport<interconnect::AccumuloMasterTransporter> *cachedTransport;
DistributedConnector<interconnect::AccumuloMasterTransporter> *refDistributedConnector;
Instance *myInstance;
AuthInfo *credentials;
};
}
#endif // USEROPERATIONS_H
<file_sep>/*
* 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.
*/
#ifndef MASTER_H_
#define MASTER_H_
//#define SIGNED_RIGHT_SHIFT_IS 5
//#define ARITHMETIC_RIGHT_SHIFT 5
#include "../data/constructs/client/Instance.h"
#include <protocol/TBinaryProtocol.h>
#include <protocol/TCompactProtocol.h>
#include <server/TSimpleServer.h>
#include <transport/TServerSocket.h>
#include <transport/TServerTransport.h>
#include <transport/TTransport.h>
#include <transport/TSocket.h>
#include <server/TNonblockingServer.h>
#include <transport/TBufferTransports.h>
#include <concurrency/ThreadManager.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
#include "TabletServer.h"
#include <string>
#include <vector>
#include <memory>
#include "ClientInterface.h"
using namespace std;
#include <boost/shared_ptr.hpp>
using boost::shared_ptr;
#include "tableOps/ClientTableOps.h"
#include "namespaceOps/NamespaceOperations.h"
#include "securityOps/SecurityOperations.h"
#include "../data/constructs/inputvalidation.h"
#include "transport/AccumuloMasterTransporter.h"
namespace interconnect
{
using namespace cclient::data;
static DistributedConnector<interconnect::AccumuloMasterTransporter> MASTER_COORDINATOR;
/**
* Purpose: Accumulo master connector.
*
* Design: Extends root interface provuding a master transport, which
* is based on the thrift connector
*
*/
class MasterConnect : public RootInterface<
interconnect::AccumuloMasterTransporter, KeyValue*, ResultBlock<KeyValue*>>
{
public:
/**
* Constructor
* @param credentials incoming user credentials
* @param instance incoming instance
*/
MasterConnect (AuthInfo *credentials, Instance *instance);
/**
* Returns an instance of table operations
* @param table incoming table
* @returns instance of table ops for this type of interface
*/
std::unique_ptr<AccumuloTableOperations>
tableOps (string table);
std::unique_ptr<NamespaceOperations> namespaceOps(string nm = "");
std::unique_ptr<SecurityOperations> securityOps();
virtual
~MasterConnect ();
protected:
void findTservers();
Instance *instance;
vector<ServerConnection> tabletServers;
CachedTransport<interconnect::AccumuloMasterTransporter> *cachedTransport;
friend class AccumuloTableOperations;
friend class SecurityOperations;
};
}
#endif /* MASTER_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/TestService.h"
namespace org
{
namespace apache
{
namespace accumulo
{
namespace trace
{
namespace thrift
{
TestService_checkTrace_args::~TestService_checkTrace_args () throw ()
{
}
uint32_t
TestService_checkTrace_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->message);
this->__isset.message = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TestService_checkTrace_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TestService_checkTrace_args");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"message", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->message);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TestService_checkTrace_pargs::~TestService_checkTrace_pargs () throw ()
{
}
uint32_t
TestService_checkTrace_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TestService_checkTrace_pargs");
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"message", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->message)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
TestService_checkTrace_result::~TestService_checkTrace_result () throw ()
{
}
uint32_t
TestService_checkTrace_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TestService_checkTrace_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin ("TestService_checkTrace_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_BOOL, 0);
xfer += oprot->writeBool (this->success);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
TestService_checkTrace_presult::~TestService_checkTrace_presult () throw ()
{
}
uint32_t
TestService_checkTrace_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
bool
TestServiceClient::checkTrace (const TInfo& tinfo,
const std::string& message)
{
send_checkTrace (tinfo, message);
return recv_checkTrace ();
}
void
TestServiceClient::send_checkTrace (const TInfo& tinfo,
const std::string& message)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("checkTrace",
::apache::thrift::protocol::T_CALL,
cseqid);
TestService_checkTrace_pargs args;
args.tinfo = &tinfo;
args.message = &message;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
TestServiceClient::recv_checkTrace ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("checkTrace") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
bool _return;
TestService_checkTrace_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"checkTrace failed: unknown result");
}
bool
TestServiceProcessor::dispatchCall (
::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
const std::string& fname, int32_t seqid, void* callContext)
{
ProcessMap::iterator pfn;
pfn = processMap_.find (fname);
if (pfn == processMap_.end ())
{
iprot->skip (::apache::thrift::protocol::T_STRUCT);
iprot->readMessageEnd ();
iprot->getTransport ()->readEnd ();
::apache::thrift::TApplicationException x (
::apache::thrift::TApplicationException::UNKNOWN_METHOD,
"Invalid method name: '" + fname + "'");
oprot->writeMessageBegin (
fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return true;
}
(this->*(pfn->second)) (seqid, iprot, oprot, callContext);
return true;
}
void
TestServiceProcessor::process_checkTrace (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext ("TestService.checkTrace",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx, "TestService.checkTrace");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx, "TestService.checkTrace");
}
TestService_checkTrace_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx, "TestService.checkTrace",
bytes);
}
TestService_checkTrace_result result;
try
{
result.success = iface_->checkTrace (args.tinfo, args.message);
result.__isset.success = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "TestService.checkTrace");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"checkTrace", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (ctx, "TestService.checkTrace");
}
oprot->writeMessageBegin ("checkTrace",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (ctx, "TestService.checkTrace",
bytes);
}
}
::boost::shared_ptr<::apache::thrift::TProcessor>
TestServiceProcessorFactory::getProcessor (
const ::apache::thrift::TConnectionInfo& connInfo)
{
::apache::thrift::ReleaseHandler<TestServiceIfFactory> cleanup (
handlerFactory_);
::boost::shared_ptr<TestServiceIf> handler (
handlerFactory_->getHandler (connInfo), cleanup);
::boost::shared_ptr<::apache::thrift::TProcessor> processor (
new TestServiceProcessor (handler));
return processor;
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef ITERINFO_H_
#define ITERINFO_H_
#include <string>
#include <map>
using namespace std;
namespace cclient
{
namespace data
{
class IterInfo
{
public:
IterInfo (string name, string cl, uint32_t pri) :
iterName (name), iterClass (cl), priority (pri)
{
}
virtual
~IterInfo ()
{
}
uint32_t
getPriority () const
{
return priority;
}
string
getName () const
{
return iterName;
}
string
getClass () const
{
return iterClass;
}
void
addOption (string optionName, string optionValue)
{
options[optionName] = optionValue;
}
const map<string, string>
getOptions () const
{
return options;
}
protected:
map<string, string> options;
uint32_t priority;
string iterName;
string iterClass;
};
} /* namespace data */
} /* namespace cclient */
#endif /* ITERINFO_H_ */
<file_sep>/*
* 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.
*/
#ifndef EXTENTLOCATOR_H_
#define EXTENTLOCATOR_H_
#include <string>
#include <map>
#include <vector>
#include <set>
#include "../constructs/client/TabletServerMutations.h"
#include "../constructs/Mutation.h"
#include "../constructs/Range.h"
#include "../constructs/client/Instance.h"
using namespace std;
#include "TabletLocation.h"
namespace cclient
{
namespace impl
{
using namespace cclient::data;
class LocatorKey
{
public:
LocatorKey (Instance *instance, string table) :
instance (instance), tableName (table)
{
}
Instance *instance;
string tableName;
bool
operator== (const LocatorKey &key)
{
return instance->getInstanceId () == key.instance->getInstanceId ()
&& tableName == key.tableName;
}
bool
operator > (const LocatorKey &key) const
{
return instance->getInstanceId () >= key.instance->getInstanceId ()
&& tableName > key.tableName;
}
bool
operator < (const LocatorKey &key) const
{
return instance->getInstanceId () <= key.instance->getInstanceId ()
&& tableName < key.tableName;
}
};
class TabletLocator
{
public:
TabletLocator ();
virtual
~TabletLocator ();
virtual TabletLocation *
locateTablet (AuthInfo *creds, string row, bool skipRow, bool retry) = 0;
virtual list<TabletLocation*> locations(AuthInfo *credentials)
{
return list<TabletLocation*>();
}
virtual void
binMutations (AuthInfo *credentials, vector<Mutation*> *mutations,
map<string, TabletServerMutations*> *binnedMutations,
set<string> *locations, vector<Mutation*> *failures) = 0;
virtual vector<Range*>
binRanges (
AuthInfo *credentials,
vector<Range*> *ranges,
set<string> *locations,
map<string,
map<KeyExtent*, vector<Range*>, pointer_comparator<KeyExtent*> > > *binnedRanges) = 0;
virtual void
invalidateCache (KeyExtent failedExtent) = 0;
virtual void
invalidateCache () = 0;
virtual void
invalidateCache (vector<KeyExtent> keySet) = 0;
};
} /* namespace data */
} /* namespace cclient */
#endif /* EXTENTLOCATOR_H_ */
<file_sep>/*
* 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.
*/
#ifndef UTIL_BTREE_SAFE_BTREE_MAP_H__
#define UTIL_BTREE_SAFE_BTREE_MAP_H__
#include <functional>
#include <memory>
#include <utility>
#include "btree_container.h"
#include "btree_map.h"
#include "safe_btree.h"
namespace btree
{
// The safe_btree_map class is needed mainly for its constructors.
template<typename Key, typename Value, typename Compare = std::less<Key>,
typename Alloc = std::allocator<std::pair<const Key, Value> >,
int TargetNodeSize = 256>
class safe_btree_map : public btree_map_container<
safe_btree<btree_map_params<Key, Value, Compare, Alloc, TargetNodeSize> > >
{
typedef safe_btree_map<Key, Value, Compare, Alloc, TargetNodeSize> self_type;
typedef btree_map_params<Key, Value, Compare, Alloc, TargetNodeSize> params_type;
typedef safe_btree<params_type> btree_type;
typedef btree_map_container<btree_type> super_type;
public:
typedef typename btree_type::key_compare key_compare;
typedef typename btree_type::allocator_type allocator_type;
public:
// Default constructor.
safe_btree_map (const key_compare &comp = key_compare (),
const allocator_type &alloc = allocator_type ()) :
super_type (comp, alloc)
{
}
// Copy constructor.
safe_btree_map (const self_type &x) :
super_type (x)
{
}
// Range constructor.
template<class InputIterator>
safe_btree_map (InputIterator b, InputIterator e,
const key_compare &comp = key_compare (),
const allocator_type &alloc = allocator_type ()) :
super_type (b, e, comp, alloc)
{
}
};
template<typename K, typename V, typename C, typename A, int N>
inline void
swap (safe_btree_map<K, V, C, A, N> &x, safe_btree_map<K, V, C, A, N> &y)
{
x.swap (y);
}
} // namespace btree
#endif // UTIL_BTREE_SAFE_BTREE_MAP_H__
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/MasterClientService.h"
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace master
{
namespace thrift
{
MasterClientService_initiateFlush_args::~MasterClientService_initiateFlush_args () throw ()
{
}
uint32_t
MasterClientService_initiateFlush_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_initiateFlush_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_initiateFlush_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_initiateFlush_pargs::~MasterClientService_initiateFlush_pargs () throw ()
{
}
uint32_t
MasterClientService_initiateFlush_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_initiateFlush_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_initiateFlush_result::~MasterClientService_initiateFlush_result () throw ()
{
}
uint32_t
MasterClientService_initiateFlush_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_initiateFlush_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_initiateFlush_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_I64, 0);
xfer += oprot->writeI64 (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_initiateFlush_presult::~MasterClientService_initiateFlush_presult () throw ()
{
}
uint32_t
MasterClientService_initiateFlush_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_waitForFlush_args::~MasterClientService_waitForFlush_args () throw ()
{
}
uint32_t
MasterClientService_waitForFlush_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->startRow);
this->__isset.startRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->endRow);
this->__isset.endRow = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->flushID);
this->__isset.flushID = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->maxLoops);
this->__isset.maxLoops = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_waitForFlush_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_waitForFlush_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("flushID",
::apache::thrift::protocol::T_I64,
3);
xfer += oprot->writeI64 (this->flushID);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("maxLoops",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 (this->maxLoops);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startRow", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary (this->startRow);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 7);
xfer += oprot->writeBinary (this->endRow);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_waitForFlush_pargs::~MasterClientService_waitForFlush_pargs () throw ()
{
}
uint32_t
MasterClientService_waitForFlush_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_waitForFlush_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("flushID",
::apache::thrift::protocol::T_I64,
3);
xfer += oprot->writeI64 ((*(this->flushID)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("maxLoops",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 ((*(this->maxLoops)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"startRow", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeBinary ((*(this->startRow)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"endRow", ::apache::thrift::protocol::T_STRING, 7);
xfer += oprot->writeBinary ((*(this->endRow)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_waitForFlush_result::~MasterClientService_waitForFlush_result () throw ()
{
}
uint32_t
MasterClientService_waitForFlush_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_waitForFlush_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_waitForFlush_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_waitForFlush_presult::~MasterClientService_waitForFlush_presult () throw ()
{
}
uint32_t
MasterClientService_waitForFlush_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_setTableProperty_args::~MasterClientService_setTableProperty_args () throw ()
{
}
uint32_t
MasterClientService_setTableProperty_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->property);
this->__isset.property = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->value);
this->__isset.value = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setTableProperty_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setTableProperty_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->property);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->value);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setTableProperty_pargs::~MasterClientService_setTableProperty_pargs () throw ()
{
}
uint32_t
MasterClientService_setTableProperty_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setTableProperty_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->property)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->value)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setTableProperty_result::~MasterClientService_setTableProperty_result () throw ()
{
}
uint32_t
MasterClientService_setTableProperty_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setTableProperty_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_setTableProperty_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_setTableProperty_presult::~MasterClientService_setTableProperty_presult () throw ()
{
}
uint32_t
MasterClientService_setTableProperty_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_removeTableProperty_args::~MasterClientService_removeTableProperty_args () throw ()
{
}
uint32_t
MasterClientService_removeTableProperty_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableName);
this->__isset.tableName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->property);
this->__isset.property = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_removeTableProperty_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_removeTableProperty_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tableName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->property);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_removeTableProperty_pargs::~MasterClientService_removeTableProperty_pargs () throw ()
{
}
uint32_t
MasterClientService_removeTableProperty_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_removeTableProperty_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tableName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->property)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_removeTableProperty_result::~MasterClientService_removeTableProperty_result () throw ()
{
}
uint32_t
MasterClientService_removeTableProperty_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_removeTableProperty_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_removeTableProperty_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_removeTableProperty_presult::~MasterClientService_removeTableProperty_presult () throw ()
{
}
uint32_t
MasterClientService_removeTableProperty_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_setNamespaceProperty_args::~MasterClientService_setNamespaceProperty_args () throw ()
{
}
uint32_t
MasterClientService_setNamespaceProperty_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->ns);
this->__isset.ns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->property);
this->__isset.property = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->value);
this->__isset.value = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setNamespaceProperty_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setNamespaceProperty_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->ns);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->property);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->value);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setNamespaceProperty_pargs::~MasterClientService_setNamespaceProperty_pargs () throw ()
{
}
uint32_t
MasterClientService_setNamespaceProperty_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setNamespaceProperty_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->ns)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->property)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString ((*(this->value)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setNamespaceProperty_result::~MasterClientService_setNamespaceProperty_result () throw ()
{
}
uint32_t
MasterClientService_setNamespaceProperty_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setNamespaceProperty_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_setNamespaceProperty_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_setNamespaceProperty_presult::~MasterClientService_setNamespaceProperty_presult () throw ()
{
}
uint32_t
MasterClientService_setNamespaceProperty_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_removeNamespaceProperty_args::~MasterClientService_removeNamespaceProperty_args () throw ()
{
}
uint32_t
MasterClientService_removeNamespaceProperty_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->ns);
this->__isset.ns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->property);
this->__isset.property = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_removeNamespaceProperty_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_removeNamespaceProperty_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->ns);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->property);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_removeNamespaceProperty_pargs::~MasterClientService_removeNamespaceProperty_pargs () throw ()
{
}
uint32_t
MasterClientService_removeNamespaceProperty_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_removeNamespaceProperty_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ns", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->ns)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->property)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_removeNamespaceProperty_result::~MasterClientService_removeNamespaceProperty_result () throw ()
{
}
uint32_t
MasterClientService_removeNamespaceProperty_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_removeNamespaceProperty_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_removeNamespaceProperty_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_removeNamespaceProperty_presult::~MasterClientService_removeNamespaceProperty_presult () throw ()
{
}
uint32_t
MasterClientService_removeNamespaceProperty_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_setMasterGoalState_args::~MasterClientService_setMasterGoalState_args () throw ()
{
}
uint32_t
MasterClientService_setMasterGoalState_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast90;
xfer += iprot->readI32 (ecast90);
this->state = (MasterGoalState::type) ecast90;
this->__isset.state = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setMasterGoalState_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setMasterGoalState_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("state",
::apache::thrift::protocol::T_I32,
2);
xfer += oprot->writeI32 ((int32_t) this->state);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setMasterGoalState_pargs::~MasterClientService_setMasterGoalState_pargs () throw ()
{
}
uint32_t
MasterClientService_setMasterGoalState_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setMasterGoalState_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("state",
::apache::thrift::protocol::T_I32,
2);
xfer += oprot->writeI32 ((int32_t) (*(this->state)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setMasterGoalState_result::~MasterClientService_setMasterGoalState_result () throw ()
{
}
uint32_t
MasterClientService_setMasterGoalState_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setMasterGoalState_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_setMasterGoalState_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_setMasterGoalState_presult::~MasterClientService_setMasterGoalState_presult () throw ()
{
}
uint32_t
MasterClientService_setMasterGoalState_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_shutdown_args::~MasterClientService_shutdown_args () throw ()
{
}
uint32_t
MasterClientService_shutdown_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->stopTabletServers);
this->__isset.stopTabletServers = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_shutdown_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_shutdown_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"stopTabletServers", ::apache::thrift::protocol::T_BOOL, 2);
xfer += oprot->writeBool (this->stopTabletServers);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_shutdown_pargs::~MasterClientService_shutdown_pargs () throw ()
{
}
uint32_t
MasterClientService_shutdown_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_shutdown_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"stopTabletServers", ::apache::thrift::protocol::T_BOOL, 2);
xfer += oprot->writeBool ((*(this->stopTabletServers)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_shutdown_result::~MasterClientService_shutdown_result () throw ()
{
}
uint32_t
MasterClientService_shutdown_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_shutdown_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_shutdown_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_shutdown_presult::~MasterClientService_shutdown_presult () throw ()
{
}
uint32_t
MasterClientService_shutdown_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_shutdownTabletServer_args::~MasterClientService_shutdownTabletServer_args () throw ()
{
}
uint32_t
MasterClientService_shutdownTabletServer_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tabletServer);
this->__isset.tabletServer = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->force);
this->__isset.force = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_shutdownTabletServer_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_shutdownTabletServer_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tabletServer", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tabletServer);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"force", ::apache::thrift::protocol::T_BOOL, 4);
xfer += oprot->writeBool (this->force);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_shutdownTabletServer_pargs::~MasterClientService_shutdownTabletServer_pargs () throw ()
{
}
uint32_t
MasterClientService_shutdownTabletServer_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_shutdownTabletServer_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tabletServer", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->tabletServer)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"force", ::apache::thrift::protocol::T_BOOL, 4);
xfer += oprot->writeBool ((*(this->force)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_shutdownTabletServer_result::~MasterClientService_shutdownTabletServer_result () throw ()
{
}
uint32_t
MasterClientService_shutdownTabletServer_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_shutdownTabletServer_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_shutdownTabletServer_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_shutdownTabletServer_presult::~MasterClientService_shutdownTabletServer_presult () throw ()
{
}
uint32_t
MasterClientService_shutdownTabletServer_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_setSystemProperty_args::~MasterClientService_setSystemProperty_args () throw ()
{
}
uint32_t
MasterClientService_setSystemProperty_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->property);
this->__isset.property = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->value);
this->__isset.value = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setSystemProperty_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setSystemProperty_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->property);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->value);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setSystemProperty_pargs::~MasterClientService_setSystemProperty_pargs () throw ()
{
}
uint32_t
MasterClientService_setSystemProperty_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_setSystemProperty_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->property)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"value", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString ((*(this->value)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_setSystemProperty_result::~MasterClientService_setSystemProperty_result () throw ()
{
}
uint32_t
MasterClientService_setSystemProperty_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_setSystemProperty_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_setSystemProperty_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_setSystemProperty_presult::~MasterClientService_setSystemProperty_presult () throw ()
{
}
uint32_t
MasterClientService_setSystemProperty_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_removeSystemProperty_args::~MasterClientService_removeSystemProperty_args () throw ()
{
}
uint32_t
MasterClientService_removeSystemProperty_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->property);
this->__isset.property = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_removeSystemProperty_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_removeSystemProperty_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->property);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_removeSystemProperty_pargs::~MasterClientService_removeSystemProperty_pargs () throw ()
{
}
uint32_t
MasterClientService_removeSystemProperty_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_removeSystemProperty_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"property", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->property)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_removeSystemProperty_result::~MasterClientService_removeSystemProperty_result () throw ()
{
}
uint32_t
MasterClientService_removeSystemProperty_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_removeSystemProperty_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_removeSystemProperty_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_removeSystemProperty_presult::~MasterClientService_removeSystemProperty_presult () throw ()
{
}
uint32_t
MasterClientService_removeSystemProperty_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_getMasterStats_args::~MasterClientService_getMasterStats_args () throw ()
{
}
uint32_t
MasterClientService_getMasterStats_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_getMasterStats_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_getMasterStats_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_getMasterStats_pargs::~MasterClientService_getMasterStats_pargs () throw ()
{
}
uint32_t
MasterClientService_getMasterStats_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_getMasterStats_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_getMasterStats_result::~MasterClientService_getMasterStats_result () throw ()
{
}
uint32_t
MasterClientService_getMasterStats_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->success.read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_getMasterStats_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"MasterClientService_getMasterStats_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRUCT, 0);
xfer += this->success.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
MasterClientService_getMasterStats_presult::~MasterClientService_getMasterStats_presult () throw ()
{
}
uint32_t
MasterClientService_getMasterStats_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += (*(this->success)).read (iprot);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
MasterClientService_reportSplitExtent_args::~MasterClientService_reportSplitExtent_args () throw ()
{
}
uint32_t
MasterClientService_reportSplitExtent_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->serverName);
this->__isset.serverName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->split.read (iprot);
this->__isset.split = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_reportSplitExtent_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_reportSplitExtent_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"serverName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->serverName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"split", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->split.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_reportSplitExtent_pargs::~MasterClientService_reportSplitExtent_pargs () throw ()
{
}
uint32_t
MasterClientService_reportSplitExtent_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_reportSplitExtent_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"serverName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->serverName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"split", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->split)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_reportTabletStatus_args::~MasterClientService_reportTabletStatus_args () throw ()
{
}
uint32_t
MasterClientService_reportTabletStatus_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->serverName);
this->__isset.serverName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast91;
xfer += iprot->readI32 (ecast91);
this->status = (TabletLoadState::type) ecast91;
this->__isset.status = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tablet.read (iprot);
this->__isset.tablet = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterClientService_reportTabletStatus_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_reportTabletStatus_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"serverName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->serverName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("status",
::apache::thrift::protocol::T_I32,
3);
xfer += oprot->writeI32 ((int32_t) this->status);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tablet", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->tablet.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
MasterClientService_reportTabletStatus_pargs::~MasterClientService_reportTabletStatus_pargs () throw ()
{
}
uint32_t
MasterClientService_reportTabletStatus_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"MasterClientService_reportTabletStatus_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"serverName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString ((*(this->serverName)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("status",
::apache::thrift::protocol::T_I32,
3);
xfer += oprot->writeI32 ((int32_t) (*(this->status)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tablet", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += (*(this->tablet)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
int64_t
MasterClientServiceClient::initiateFlush (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName)
{
send_initiateFlush (tinfo, credentials, tableName);
return recv_initiateFlush ();
}
void
MasterClientServiceClient::send_initiateFlush (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("initiateFlush",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_initiateFlush_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableName = &tableName;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
int64_t
MasterClientServiceClient::recv_initiateFlush ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("initiateFlush") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
int64_t _return;
MasterClientService_initiateFlush_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"initiateFlush failed: unknown result");
}
void
MasterClientServiceClient::waitForFlush (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName, const std::string& startRow,
const std::string& endRow, const int64_t flushID,
const int64_t maxLoops)
{
send_waitForFlush (tinfo, credentials, tableName, startRow,
endRow, flushID, maxLoops);
recv_waitForFlush ();
}
void
MasterClientServiceClient::send_waitForFlush (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName, const std::string& startRow,
const std::string& endRow, const int64_t flushID,
const int64_t maxLoops)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("waitForFlush",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_waitForFlush_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableName = &tableName;
args.startRow = &startRow;
args.endRow = &endRow;
args.flushID = &flushID;
args.maxLoops = &maxLoops;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_waitForFlush ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("waitForFlush") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_waitForFlush_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
MasterClientServiceClient::setTableProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName, const std::string& property,
const std::string& value)
{
send_setTableProperty (tinfo, credentials, tableName, property,
value);
recv_setTableProperty ();
}
void
MasterClientServiceClient::send_setTableProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName, const std::string& property,
const std::string& value)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("setTableProperty",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_setTableProperty_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableName = &tableName;
args.property = &property;
args.value = &value;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_setTableProperty ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("setTableProperty") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_setTableProperty_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
MasterClientServiceClient::removeTableProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName, const std::string& property)
{
send_removeTableProperty (tinfo, credentials, tableName,
property);
recv_removeTableProperty ();
}
void
MasterClientServiceClient::send_removeTableProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tableName, const std::string& property)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("removeTableProperty",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_removeTableProperty_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tableName = &tableName;
args.property = &property;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_removeTableProperty ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("removeTableProperty") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_removeTableProperty_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
MasterClientServiceClient::setNamespaceProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& ns, const std::string& property,
const std::string& value)
{
send_setNamespaceProperty (tinfo, credentials, ns, property,
value);
recv_setNamespaceProperty ();
}
void
MasterClientServiceClient::send_setNamespaceProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& ns, const std::string& property,
const std::string& value)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("setNamespaceProperty",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_setNamespaceProperty_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.ns = &ns;
args.property = &property;
args.value = &value;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_setNamespaceProperty ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("setNamespaceProperty") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_setNamespaceProperty_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
MasterClientServiceClient::removeNamespaceProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& ns, const std::string& property)
{
send_removeNamespaceProperty (tinfo, credentials, ns, property);
recv_removeNamespaceProperty ();
}
void
MasterClientServiceClient::send_removeNamespaceProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& ns, const std::string& property)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("removeNamespaceProperty",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_removeNamespaceProperty_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.ns = &ns;
args.property = &property;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_removeNamespaceProperty ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("removeNamespaceProperty") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_removeNamespaceProperty_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
MasterClientServiceClient::setMasterGoalState (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const MasterGoalState::type state)
{
send_setMasterGoalState (tinfo, credentials, state);
recv_setMasterGoalState ();
}
void
MasterClientServiceClient::send_setMasterGoalState (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const MasterGoalState::type state)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("setMasterGoalState",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_setMasterGoalState_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.state = &state;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_setMasterGoalState ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("setMasterGoalState") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_setMasterGoalState_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
MasterClientServiceClient::shutdown (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const bool stopTabletServers)
{
send_shutdown (tinfo, credentials, stopTabletServers);
recv_shutdown ();
}
void
MasterClientServiceClient::send_shutdown (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const bool stopTabletServers)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("shutdown",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_shutdown_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.stopTabletServers = &stopTabletServers;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_shutdown ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("shutdown") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_shutdown_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
MasterClientServiceClient::shutdownTabletServer (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tabletServer, const bool force)
{
send_shutdownTabletServer (tinfo, credentials, tabletServer,
force);
recv_shutdownTabletServer ();
}
void
MasterClientServiceClient::send_shutdownTabletServer (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& tabletServer, const bool force)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("shutdownTabletServer",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_shutdownTabletServer_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.tabletServer = &tabletServer;
args.force = &force;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_shutdownTabletServer ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("shutdownTabletServer") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_shutdownTabletServer_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
MasterClientServiceClient::setSystemProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& property, const std::string& value)
{
send_setSystemProperty (tinfo, credentials, property, value);
recv_setSystemProperty ();
}
void
MasterClientServiceClient::send_setSystemProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& property, const std::string& value)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("setSystemProperty",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_setSystemProperty_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.property = &property;
args.value = &value;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_setSystemProperty ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("setSystemProperty") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_setSystemProperty_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
MasterClientServiceClient::removeSystemProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& property)
{
send_removeSystemProperty (tinfo, credentials, property);
recv_removeSystemProperty ();
}
void
MasterClientServiceClient::send_removeSystemProperty (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& property)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("removeSystemProperty",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_removeSystemProperty_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.property = &property;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_removeSystemProperty ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("removeSystemProperty") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_removeSystemProperty_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
void
MasterClientServiceClient::getMasterStats (
MasterMonitorInfo& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_getMasterStats (tinfo, credentials);
recv_getMasterStats (_return);
}
void
MasterClientServiceClient::send_getMasterStats (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("getMasterStats",
::apache::thrift::protocol::T_CALL,
cseqid);
MasterClientService_getMasterStats_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::recv_getMasterStats (
MasterMonitorInfo& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("getMasterStats") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
MasterClientService_getMasterStats_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"getMasterStats failed: unknown result");
}
void
MasterClientServiceClient::reportSplitExtent (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& serverName, const TabletSplit& split)
{
send_reportSplitExtent (tinfo, credentials, serverName, split);
}
void
MasterClientServiceClient::send_reportSplitExtent (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& serverName, const TabletSplit& split)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("reportSplitExtent",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
MasterClientService_reportSplitExtent_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.serverName = &serverName;
args.split = &split;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
MasterClientServiceClient::reportTabletStatus (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& serverName,
const TabletLoadState::type status,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& tablet)
{
send_reportTabletStatus (tinfo, credentials, serverName, status,
tablet);
}
void
MasterClientServiceClient::send_reportTabletStatus (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const std::string& serverName,
const TabletLoadState::type status,
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& tablet)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("reportTabletStatus",
::apache::thrift::protocol::T_ONEWAY,
cseqid);
MasterClientService_reportTabletStatus_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.serverName = &serverName;
args.status = &status;
args.tablet = &tablet;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
bool
MasterClientServiceProcessor::dispatchCall (
::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
const std::string& fname, int32_t seqid, void* callContext)
{
ProcessMap::iterator pfn;
pfn = processMap_.find (fname);
if (pfn == processMap_.end ())
{
return FateServiceProcessor::dispatchCall (iprot, oprot,
fname, seqid,
callContext);
}
(this->*(pfn->second)) (seqid, iprot, oprot, callContext);
return true;
}
void
MasterClientServiceProcessor::process_initiateFlush (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.initiateFlush", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.initiateFlush");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.initiateFlush");
}
MasterClientService_initiateFlush_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.initiateFlush", bytes);
}
MasterClientService_initiateFlush_result result;
try
{
result.success = iface_->initiateFlush (args.tinfo,
args.credentials,
args.tableName);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.initiateFlush");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"initiateFlush", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.initiateFlush");
}
oprot->writeMessageBegin ("initiateFlush",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.initiateFlush", bytes);
}
}
void
MasterClientServiceProcessor::process_waitForFlush (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.waitForFlush", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.waitForFlush");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.waitForFlush");
}
MasterClientService_waitForFlush_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.waitForFlush", bytes);
}
MasterClientService_waitForFlush_result result;
try
{
iface_->waitForFlush (args.tinfo, args.credentials,
args.tableName, args.startRow,
args.endRow, args.flushID,
args.maxLoops);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.waitForFlush");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"waitForFlush", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.waitForFlush");
}
oprot->writeMessageBegin ("waitForFlush",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.waitForFlush", bytes);
}
}
void
MasterClientServiceProcessor::process_setTableProperty (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.setTableProperty", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.setTableProperty");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.setTableProperty");
}
MasterClientService_setTableProperty_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.setTableProperty", bytes);
}
MasterClientService_setTableProperty_result result;
try
{
iface_->setTableProperty (args.tinfo, args.credentials,
args.tableName, args.property,
args.value);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.setTableProperty");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"setTableProperty",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.setTableProperty");
}
oprot->writeMessageBegin ("setTableProperty",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.setTableProperty", bytes);
}
}
void
MasterClientServiceProcessor::process_removeTableProperty (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.removeTableProperty", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.removeTableProperty");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.removeTableProperty");
}
MasterClientService_removeTableProperty_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.removeTableProperty", bytes);
}
MasterClientService_removeTableProperty_result result;
try
{
iface_->removeTableProperty (args.tinfo, args.credentials,
args.tableName, args.property);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.removeTableProperty");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"removeTableProperty",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.removeTableProperty");
}
oprot->writeMessageBegin ("removeTableProperty",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.removeTableProperty", bytes);
}
}
void
MasterClientServiceProcessor::process_setNamespaceProperty (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.setNamespaceProperty", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.setNamespaceProperty");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.setNamespaceProperty");
}
MasterClientService_setNamespaceProperty_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.setNamespaceProperty", bytes);
}
MasterClientService_setNamespaceProperty_result result;
try
{
iface_->setNamespaceProperty (args.tinfo, args.credentials,
args.ns, args.property,
args.value);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.setNamespaceProperty");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"setNamespaceProperty",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.setNamespaceProperty");
}
oprot->writeMessageBegin ("setNamespaceProperty",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.setNamespaceProperty", bytes);
}
}
void
MasterClientServiceProcessor::process_removeNamespaceProperty (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.removeNamespaceProperty",
callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.removeNamespaceProperty");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.removeNamespaceProperty");
}
MasterClientService_removeNamespaceProperty_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.removeNamespaceProperty",
bytes);
}
MasterClientService_removeNamespaceProperty_result result;
try
{
iface_->removeNamespaceProperty (args.tinfo, args.credentials,
args.ns, args.property);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.removeNamespaceProperty");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"removeNamespaceProperty",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.removeNamespaceProperty");
}
oprot->writeMessageBegin ("removeNamespaceProperty",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.removeNamespaceProperty",
bytes);
}
}
void
MasterClientServiceProcessor::process_setMasterGoalState (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.setMasterGoalState", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.setMasterGoalState");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.setMasterGoalState");
}
MasterClientService_setMasterGoalState_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.setMasterGoalState", bytes);
}
MasterClientService_setMasterGoalState_result result;
try
{
iface_->setMasterGoalState (args.tinfo, args.credentials,
args.state);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.setMasterGoalState");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"setMasterGoalState",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.setMasterGoalState");
}
oprot->writeMessageBegin ("setMasterGoalState",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.setMasterGoalState", bytes);
}
}
void
MasterClientServiceProcessor::process_shutdown (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.shutdown", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.shutdown");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (ctx,
"MasterClientService.shutdown");
}
MasterClientService_shutdown_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (ctx,
"MasterClientService.shutdown",
bytes);
}
MasterClientService_shutdown_result result;
try
{
iface_->shutdown (args.tinfo, args.credentials,
args.stopTabletServers);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.shutdown");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"shutdown", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.shutdown");
}
oprot->writeMessageBegin ("shutdown",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.shutdown", bytes);
}
}
void
MasterClientServiceProcessor::process_shutdownTabletServer (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.shutdownTabletServer", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.shutdownTabletServer");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.shutdownTabletServer");
}
MasterClientService_shutdownTabletServer_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.shutdownTabletServer", bytes);
}
MasterClientService_shutdownTabletServer_result result;
try
{
iface_->shutdownTabletServer (args.tinfo, args.credentials,
args.tabletServer, args.force);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.shutdownTabletServer");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"shutdownTabletServer",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.shutdownTabletServer");
}
oprot->writeMessageBegin ("shutdownTabletServer",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.shutdownTabletServer", bytes);
}
}
void
MasterClientServiceProcessor::process_setSystemProperty (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.setSystemProperty", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.setSystemProperty");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.setSystemProperty");
}
MasterClientService_setSystemProperty_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.setSystemProperty", bytes);
}
MasterClientService_setSystemProperty_result result;
try
{
iface_->setSystemProperty (args.tinfo, args.credentials,
args.property, args.value);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.setSystemProperty");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"setSystemProperty",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.setSystemProperty");
}
oprot->writeMessageBegin ("setSystemProperty",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.setSystemProperty", bytes);
}
}
void
MasterClientServiceProcessor::process_removeSystemProperty (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.removeSystemProperty", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.removeSystemProperty");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.removeSystemProperty");
}
MasterClientService_removeSystemProperty_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.removeSystemProperty", bytes);
}
MasterClientService_removeSystemProperty_result result;
try
{
iface_->removeSystemProperty (args.tinfo, args.credentials,
args.property);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.removeSystemProperty");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"removeSystemProperty",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.removeSystemProperty");
}
oprot->writeMessageBegin ("removeSystemProperty",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.removeSystemProperty", bytes);
}
}
void
MasterClientServiceProcessor::process_getMasterStats (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.getMasterStats", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.getMasterStats");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.getMasterStats");
}
MasterClientService_getMasterStats_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.getMasterStats", bytes);
}
MasterClientService_getMasterStats_result result;
try
{
iface_->getMasterStats (result.success, args.tinfo,
args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.getMasterStats");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"getMasterStats", ::apache::thrift::protocol::T_EXCEPTION,
seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "MasterClientService.getMasterStats");
}
oprot->writeMessageBegin ("getMasterStats",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "MasterClientService.getMasterStats", bytes);
}
}
void
MasterClientServiceProcessor::process_reportSplitExtent (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.reportSplitExtent", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.reportSplitExtent");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.reportSplitExtent");
}
MasterClientService_reportSplitExtent_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.reportSplitExtent", bytes);
}
try
{
iface_->reportSplitExtent (args.tinfo, args.credentials,
args.serverName, args.split);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.reportSplitExtent");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "MasterClientService.reportSplitExtent");
}
return;
}
void
MasterClientServiceProcessor::process_reportTabletStatus (
int32_t, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol*, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"MasterClientService.reportTabletStatus", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"MasterClientService.reportTabletStatus");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "MasterClientService.reportTabletStatus");
}
MasterClientService_reportTabletStatus_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "MasterClientService.reportTabletStatus", bytes);
}
try
{
iface_->reportTabletStatus (args.tinfo, args.credentials,
args.serverName, args.status,
args.tablet);
}
catch (const std::exception&)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "MasterClientService.reportTabletStatus");
}
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->asyncComplete (
ctx, "MasterClientService.reportTabletStatus");
}
return;
}
::boost::shared_ptr<::apache::thrift::TProcessor>
MasterClientServiceProcessorFactory::getProcessor (
const ::apache::thrift::TConnectionInfo& connInfo)
{
::apache::thrift::ReleaseHandler<MasterClientServiceIfFactory> cleanup (
handlerFactory_);
::boost::shared_ptr<MasterClientServiceIf> handler (
handlerFactory_->getHandler (connInfo), cleanup);
::boost::shared_ptr<::apache::thrift::TProcessor> processor (
new MasterClientServiceProcessor (handler));
return processor;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/FateService.h"
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace master
{
namespace thrift
{
FateService_beginFateOperation_args::~FateService_beginFateOperation_args () throw ()
{
}
uint32_t
FateService_beginFateOperation_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_beginFateOperation_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_beginFateOperation_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_beginFateOperation_pargs::~FateService_beginFateOperation_pargs () throw ()
{
}
uint32_t
FateService_beginFateOperation_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_beginFateOperation_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_beginFateOperation_result::~FateService_beginFateOperation_result () throw ()
{
}
uint32_t
FateService_beginFateOperation_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_beginFateOperation_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"FateService_beginFateOperation_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_I64, 0);
xfer += oprot->writeI64 (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
FateService_beginFateOperation_presult::~FateService_beginFateOperation_presult () throw ()
{
}
uint32_t
FateService_beginFateOperation_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
FateService_executeFateOperation_args::~FateService_executeFateOperation_args () throw ()
{
}
uint32_t
FateService_executeFateOperation_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 7:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->opid);
this->__isset.opid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast73;
xfer += iprot->readI32 (ecast73);
this->op = (FateOperation::type) ecast73;
this->__isset.op = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->arguments.clear ();
uint32_t _size74;
::apache::thrift::protocol::TType _etype77;
xfer += iprot->readListBegin (_etype77, _size74);
this->arguments.resize (_size74);
uint32_t _i78;
for (_i78 = 0; _i78 < _size74; ++_i78)
{
xfer += iprot->readBinary (
this->arguments[_i78]);
}
xfer += iprot->readListEnd ();
}
this->__isset.arguments = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->options.clear ();
uint32_t _size79;
::apache::thrift::protocol::TType _ktype80;
::apache::thrift::protocol::TType _vtype81;
xfer += iprot->readMapBegin (_ktype80, _vtype81,
_size79);
uint32_t _i83;
for (_i83 = 0; _i83 < _size79; ++_i83)
{
std::string _key84;
xfer += iprot->readString (_key84);
std::string& _val85 = this->options[_key84];
xfer += iprot->readString (_val85);
}
xfer += iprot->readMapEnd ();
}
this->__isset.options = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_BOOL)
{
xfer += iprot->readBool (this->autoClean);
this->__isset.autoClean = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_executeFateOperation_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_executeFateOperation_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("opid",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->opid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("op",
::apache::thrift::protocol::T_I32,
3);
xfer += oprot->writeI32 ((int32_t) this->op);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"arguments", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->arguments.size ()));
std::vector<std::string>::const_iterator _iter86;
for (_iter86 = this->arguments.begin ();
_iter86 != this->arguments.end (); ++_iter86)
{
xfer += oprot->writeBinary ((*_iter86));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("options",
::apache::thrift::protocol::T_MAP,
5);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->options.size ()));
std::map<std::string, std::string>::const_iterator _iter87;
for (_iter87 = this->options.begin ();
_iter87 != this->options.end (); ++_iter87)
{
xfer += oprot->writeString (_iter87->first);
xfer += oprot->writeString (_iter87->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"autoClean", ::apache::thrift::protocol::T_BOOL, 6);
xfer += oprot->writeBool (this->autoClean);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 7);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_executeFateOperation_pargs::~FateService_executeFateOperation_pargs () throw ()
{
}
uint32_t
FateService_executeFateOperation_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_executeFateOperation_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("opid",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->opid)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("op",
::apache::thrift::protocol::T_I32,
3);
xfer += oprot->writeI32 ((int32_t) (*(this->op)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"arguments", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->arguments)).size ()));
std::vector<std::string>::const_iterator _iter88;
for (_iter88 = (*(this->arguments)).begin ();
_iter88 != (*(this->arguments)).end (); ++_iter88)
{
xfer += oprot->writeBinary ((*_iter88));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("options",
::apache::thrift::protocol::T_MAP,
5);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> ((*(this->options)).size ()));
std::map<std::string, std::string>::const_iterator _iter89;
for (_iter89 = (*(this->options)).begin ();
_iter89 != (*(this->options)).end (); ++_iter89)
{
xfer += oprot->writeString (_iter89->first);
xfer += oprot->writeString (_iter89->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"autoClean", ::apache::thrift::protocol::T_BOOL, 6);
xfer += oprot->writeBool ((*(this->autoClean)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 7);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_executeFateOperation_result::~FateService_executeFateOperation_result () throw ()
{
}
uint32_t
FateService_executeFateOperation_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_executeFateOperation_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"FateService_executeFateOperation_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
FateService_executeFateOperation_presult::~FateService_executeFateOperation_presult () throw ()
{
}
uint32_t
FateService_executeFateOperation_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
FateService_waitForFateOperation_args::~FateService_waitForFateOperation_args () throw ()
{
}
uint32_t
FateService_waitForFateOperation_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->opid);
this->__isset.opid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_waitForFateOperation_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_waitForFateOperation_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("opid",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->opid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_waitForFateOperation_pargs::~FateService_waitForFateOperation_pargs () throw ()
{
}
uint32_t
FateService_waitForFateOperation_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_waitForFateOperation_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("opid",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->opid)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_waitForFateOperation_result::~FateService_waitForFateOperation_result () throw ()
{
}
uint32_t
FateService_waitForFateOperation_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->success);
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_waitForFateOperation_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"FateService_waitForFateOperation_result");
if (this->__isset.success)
{
xfer += oprot->writeFieldBegin (
"success", ::apache::thrift::protocol::T_STRING, 0);
xfer += oprot->writeString (this->success);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
else if (this->__isset.tope)
{
xfer += oprot->writeFieldBegin (
"tope", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->tope.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
FateService_waitForFateOperation_presult::~FateService_waitForFateOperation_presult () throw ()
{
}
uint32_t
FateService_waitForFateOperation_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString ((*(this->success)));
this->__isset.success = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tope.read (iprot);
this->__isset.tope = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
FateService_finishFateOperation_args::~FateService_finishFateOperation_args () throw ()
{
}
uint32_t
FateService_finishFateOperation_args::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->tinfo.read (iprot);
this->__isset.tinfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->credentials.read (iprot);
this->__isset.credentials = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->opid);
this->__isset.opid = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_finishFateOperation_args::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_finishFateOperation_args");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->credentials.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("opid",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->opid);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->tinfo.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_finishFateOperation_pargs::~FateService_finishFateOperation_pargs () throw ()
{
}
uint32_t
FateService_finishFateOperation_pargs::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin (
"FateService_finishFateOperation_pargs");
xfer += oprot->writeFieldBegin (
"credentials", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += (*(this->credentials)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("opid",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 ((*(this->opid)));
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tinfo", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += (*(this->tinfo)).write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
FateService_finishFateOperation_result::~FateService_finishFateOperation_result () throw ()
{
}
uint32_t
FateService_finishFateOperation_result::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
FateService_finishFateOperation_result::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
xfer += oprot->writeStructBegin (
"FateService_finishFateOperation_result");
if (this->__isset.sec)
{
xfer += oprot->writeFieldBegin (
"sec", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->sec.write (oprot);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
return xfer;
}
FateService_finishFateOperation_presult::~FateService_finishFateOperation_presult () throw ()
{
}
uint32_t
FateService_finishFateOperation_presult::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->sec.read (iprot);
this->__isset.sec = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
int64_t
FateServiceClient::beginFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
send_beginFateOperation (tinfo, credentials);
return recv_beginFateOperation ();
}
void
FateServiceClient::send_beginFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("beginFateOperation",
::apache::thrift::protocol::T_CALL,
cseqid);
FateService_beginFateOperation_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
int64_t
FateServiceClient::recv_beginFateOperation ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("beginFateOperation") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
int64_t _return;
FateService_beginFateOperation_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
return _return;
}
if (result.__isset.sec)
{
throw result.sec;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"beginFateOperation failed: unknown result");
}
void
FateServiceClient::executeFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t opid, const FateOperation::type op,
const std::vector<std::string> & arguments,
const std::map<std::string, std::string> & options,
const bool autoClean)
{
send_executeFateOperation (tinfo, credentials, opid, op,
arguments, options, autoClean);
recv_executeFateOperation ();
}
void
FateServiceClient::send_executeFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t opid, const FateOperation::type op,
const std::vector<std::string> & arguments,
const std::map<std::string, std::string> & options,
const bool autoClean)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("executeFateOperation",
::apache::thrift::protocol::T_CALL,
cseqid);
FateService_executeFateOperation_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.opid = &opid;
args.op = &op;
args.arguments = &arguments;
args.options = &options;
args.autoClean = &autoClean;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
FateServiceClient::recv_executeFateOperation ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("executeFateOperation") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
FateService_executeFateOperation_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
return;
}
void
FateServiceClient::waitForFateOperation (
std::string& _return,
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t opid)
{
send_waitForFateOperation (tinfo, credentials, opid);
recv_waitForFateOperation (_return);
}
void
FateServiceClient::send_waitForFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t opid)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("waitForFateOperation",
::apache::thrift::protocol::T_CALL,
cseqid);
FateService_waitForFateOperation_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.opid = &opid;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
FateServiceClient::recv_waitForFateOperation (std::string& _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("waitForFateOperation") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
FateService_waitForFateOperation_presult result;
result.success = &_return;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.success)
{
// _return pointer has now been filled
return;
}
if (result.__isset.sec)
{
throw result.sec;
}
if (result.__isset.tope)
{
throw result.tope;
}
throw ::apache::thrift::TApplicationException (
::apache::thrift::TApplicationException::MISSING_RESULT,
"waitForFateOperation failed: unknown result");
}
void
FateServiceClient::finishFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t opid)
{
send_finishFateOperation (tinfo, credentials, opid);
recv_finishFateOperation ();
}
void
FateServiceClient::send_finishFateOperation (
const ::org::apache::accumulo::trace::thrift::TInfo& tinfo,
const ::org::apache::accumulo::core::security::thrift::TCredentials& credentials,
const int64_t opid)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin ("finishFateOperation",
::apache::thrift::protocol::T_CALL,
cseqid);
FateService_finishFateOperation_pargs args;
args.tinfo = &tinfo;
args.credentials = &credentials;
args.opid = &opid;
args.write (oprot_);
oprot_->writeMessageEnd ();
oprot_->getTransport ()->writeEnd ();
oprot_->getTransport ()->flush ();
}
void
FateServiceClient::recv_finishFateOperation ()
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin (fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION)
{
::apache::thrift::TApplicationException x;
x.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
if (fname.compare ("finishFateOperation") != 0)
{
iprot_->skip (::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
}
FateService_finishFateOperation_presult result;
result.read (iprot_);
iprot_->readMessageEnd ();
iprot_->getTransport ()->readEnd ();
if (result.__isset.sec)
{
throw result.sec;
}
return;
}
bool
FateServiceProcessor::dispatchCall (
::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot,
const std::string& fname, int32_t seqid, void* callContext)
{
ProcessMap::iterator pfn;
pfn = processMap_.find (fname);
if (pfn == processMap_.end ())
{
iprot->skip (::apache::thrift::protocol::T_STRUCT);
iprot->readMessageEnd ();
iprot->getTransport ()->readEnd ();
::apache::thrift::TApplicationException x (
::apache::thrift::TApplicationException::UNKNOWN_METHOD,
"Invalid method name: '" + fname + "'");
oprot->writeMessageBegin (
fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return true;
}
(this->*(pfn->second)) (seqid, iprot, oprot, callContext);
return true;
}
void
FateServiceProcessor::process_beginFateOperation (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"FateService.beginFateOperation", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"FateService.beginFateOperation");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "FateService.beginFateOperation");
}
FateService_beginFateOperation_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "FateService.beginFateOperation", bytes);
}
FateService_beginFateOperation_result result;
try
{
result.success = iface_->beginFateOperation (
args.tinfo, args.credentials);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "FateService.beginFateOperation");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"beginFateOperation",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "FateService.beginFateOperation");
}
oprot->writeMessageBegin ("beginFateOperation",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "FateService.beginFateOperation", bytes);
}
}
void
FateServiceProcessor::process_executeFateOperation (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"FateService.executeFateOperation", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"FateService.executeFateOperation");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "FateService.executeFateOperation");
}
FateService_executeFateOperation_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "FateService.executeFateOperation", bytes);
}
FateService_executeFateOperation_result result;
try
{
iface_->executeFateOperation (args.tinfo, args.credentials,
args.opid, args.op,
args.arguments, args.options,
args.autoClean);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "FateService.executeFateOperation");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"executeFateOperation",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "FateService.executeFateOperation");
}
oprot->writeMessageBegin ("executeFateOperation",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "FateService.executeFateOperation", bytes);
}
}
void
FateServiceProcessor::process_waitForFateOperation (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"FateService.waitForFateOperation", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"FateService.waitForFateOperation");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "FateService.waitForFateOperation");
}
FateService_waitForFateOperation_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "FateService.waitForFateOperation", bytes);
}
FateService_waitForFateOperation_result result;
try
{
iface_->waitForFateOperation (result.success, args.tinfo,
args.credentials, args.opid);
result.__isset.success = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftTableOperationException &tope)
{
result.tope = tope;
result.__isset.tope = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "FateService.waitForFateOperation");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"waitForFateOperation",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "FateService.waitForFateOperation");
}
oprot->writeMessageBegin ("waitForFateOperation",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "FateService.waitForFateOperation", bytes);
}
}
void
FateServiceProcessor::process_finishFateOperation (
int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot,
::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get () != NULL)
{
ctx = this->eventHandler_->getContext (
"FateService.finishFateOperation", callContext);
}
::apache::thrift::TProcessorContextFreer freer (
this->eventHandler_.get (), ctx,
"FateService.finishFateOperation");
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preRead (
ctx, "FateService.finishFateOperation");
}
FateService_finishFateOperation_args args;
args.read (iprot);
iprot->readMessageEnd ();
uint32_t bytes = iprot->getTransport ()->readEnd ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postRead (
ctx, "FateService.finishFateOperation", bytes);
}
FateService_finishFateOperation_result result;
try
{
iface_->finishFateOperation (args.tinfo, args.credentials,
args.opid);
}
catch (::org::apache::accumulo::core::client::impl::thrift::ThriftSecurityException &sec)
{
result.sec = sec;
result.__isset.sec = true;
}
catch (const std::exception& e)
{
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->handlerError (
ctx, "FateService.finishFateOperation");
}
::apache::thrift::TApplicationException x (e.what ());
oprot->writeMessageBegin (
"finishFateOperation",
::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write (oprot);
oprot->writeMessageEnd ();
oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
return;
}
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->preWrite (
ctx, "FateService.finishFateOperation");
}
oprot->writeMessageBegin ("finishFateOperation",
::apache::thrift::protocol::T_REPLY,
seqid);
result.write (oprot);
oprot->writeMessageEnd ();
bytes = oprot->getTransport ()->writeEnd ();
oprot->getTransport ()->flush ();
if (this->eventHandler_.get () != NULL)
{
this->eventHandler_->postWrite (
ctx, "FateService.finishFateOperation", bytes);
}
}
::boost::shared_ptr<::apache::thrift::TProcessor>
FateServiceProcessorFactory::getProcessor (
const ::apache::thrift::TConnectionInfo& connInfo)
{
::apache::thrift::ReleaseHandler<FateServiceIfFactory> cleanup (
handlerFactory_);
::boost::shared_ptr<FateServiceIf> handler (
handlerFactory_->getHandler (connInfo), cleanup);
::boost::shared_ptr<::apache::thrift::TProcessor> processor (
new FateServiceProcessor (handler));
return processor;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef SRC_INTERCONNECT_TABLEOPS_CLIENTTABLEOPS_H_
#define SRC_INTERCONNECT_TABLEOPS_CLIENTTABLEOPS_H_
#include "TableOperations.h"
#include "../../data/constructs/KeyValue.h"
#include "../../data/constructs/security/AuthInfo.h"
#include "../../data/constructs/client/Instance.h"
#include "../../scanner/Source.h"
#include "../../scanner/constructs/Results.h"
#include "../transport/AccumuloMasterTransporter.h"
#include "../RootInterface.h"
#include "../../writer/Sink.h"
namespace interconnect
{
#include <map>
#include <vector>
#include <string>
using namespace scanners;
using namespace writer;
using namespace cclient::data;
/**
* Accumulo Table Operations;
*/
class AccumuloTableOperations: public interconnect::TableOperations<KeyValue*,
ResultBlock<KeyValue*>>
{
public:
AccumuloTableOperations(AuthInfo *creds, Instance *instance, string table,
RootInterface<interconnect::AccumuloMasterTransporter, KeyValue*,
ResultBlock<KeyValue*>> *interface, CachedTransport<interconnect::AccumuloMasterTransporter> *tserverConn, DistributedConnector<interconnect::AccumuloMasterTransporter> *distributedConnector) :
TableOperations<KeyValue*, ResultBlock<KeyValue*>>(creds, instance,
table), clientInterface(interface), tserverConn(tserverConn), distributedConnector(distributedConnector)
{
loadTableOps();
getTableId();
}
virtual ~AccumuloTableOperations();
/**
* Create a table.
* @param recreate will recreate a table if necessary
* @return whether or not the table was created.
**/
virtual bool create(bool recreate=false);
/**
* Removes the current table
* @return whether or not removal was successful.
**/
virtual bool remove();
/**
* Determines if the table exists.
* @param createIfNot will create the table if true and it does not exist
* @return returns boolean of whether or not the table exists
**/
virtual bool exists(bool createIfNot=false);
/**
* Imports rfiles in path specified in dir
* @param dir dir containing rfiles
* @param fail_path failure path directory
* @param setTime Accumulo will set the time
* @return status of create
**/
virtual bool import(string dir, string fail_path, bool setTime=false);
/**
* Flushes the current table
* @param startRow start row on which to begin the flush
* @param endRow end point for the flush
* @param wait wait on this operation before returning
* @return status of flush
**/
virtual bool flush(std::string startRow, std::string endRow, bool wait);
/**
* Compacts the current table
* @param startRow start row on which to begin the compaction
* @param endRow end point for the compaction
* @param wait wait on this operation before returning
* @return status of compaction
**/
virtual bool compact(std::string startRow, std::string endRow, bool wait);
/**
* Returns the table ID
* @return table ID
**/
std::string getTableId();
/**
* Sets a table property
* @param property property names
* @param value property value
*/
virtual void setProperty(string property, string value);
/**
* Removes a property on this table.
* @param property property name to remove
*/
virtual void removeProperty(string property);
/**
* Returns all table properties.
* @return table properties
*/
virtual map<string,string> getProperties();
/**
* Returns splits for this table.
* @return table splits.
*/
vector<string> listSplits();
/**
* Adds splits for the current table
* @param partitions table splits
**/
void addSplits(set<string> partitions);
/**
* Creates a new scanner
* @param auths authorizations for this scanner
* @param threads current threads
* @return new scanner
**/
Source<KeyValue*, ResultBlock<KeyValue*>> *createScanner(
Authorizations *auths, uint16_t threads);
/**
* Creates a writer for the current table
* @param auths authorizations for this writer
* @param threads number of threads for writer
* @return new batch writer
*/
Sink<KeyValue*> *createWriter(Authorizations *auths,
uint16_t threads);
protected:
DistributedConnector<interconnect::AccumuloMasterTransporter> *distributedConnector;
CachedTransport<interconnect::AccumuloMasterTransporter> *tserverConn;
RootInterface<interconnect::AccumuloMasterTransporter, KeyValue*,
ResultBlock<KeyValue*>> *clientInterface;
void loadTableOps(bool force = false);
};
extern map<string, string> nameSpaceIds;
} /* namespace impl */
#endif /* SRC_INTERCONNECT_TABLEOPS_CLIENTTABLEOPS_H_ */
<file_sep>/*
* 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.
*/
#ifndef SCANNER_H_
#define SCANNER_H_
#include <algorithm>
#include <map>
#include <string>
#include <set>
using namespace std;
#include <pthread.h>
#include "../Source.h"
#include "../../data/constructs/Key.h"
#include "../../data/constructs/security/AuthInfo.h"
#include "../../data/constructs/security/Authorizations.h"
#include "../../data/constructs/value.h"
#include "../constructs/Results.h"
#include "../../data/constructs/inputvalidation.h"
#include "../../data/client/ExtentLocator.h"
#include "../../data/exceptions/ClientException.h"
#include "../../data/constructs/client/zookeeperinstance.h"
#include "../../data/client/LocatorCache.h"
#include "../constructs/ServerHeuristic.h"
#include "../../interconnect/ClientInterface.h"
#include "../../interconnect/tableOps/TableOperations.h"
namespace scanners {
using namespace interconnect;
using namespace cclient::data::zookeeper;
using namespace cclient::data;
using namespace cclient::data::security;
using namespace cclient::exceptions;
/**
Scanner scans uses the interconnect to retrieve Keys and Values from the data source.
**/
class Scanner: public scanners::Source<KeyValue*, ResultBlock<KeyValue*>> {
public:
/**
* Scanner constructor
* @param instance connector instance
* @param top table operations refereuce
* @param auths authorizations
* @param threads threads for the scanner
**/
Scanner(Instance *instance,
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *tops,
Authorizations *auths, uint16_t threads);
/**
* Adds a range to the scanner
* @param range
**/
void addRange(Range *range) {
pthread_mutex_lock(&scannerLock);
// throw exception if running
ranges->push_back(range);
pthread_mutex_unlock(&scannerLock);
}
/**
* Returns a result set.
* @return results iterator.
**/
Results<KeyValue*, ResultBlock<KeyValue*>> *getResultSet() {
pthread_mutex_lock(&scannerLock);
if (IsEmpty(resultSet) && IsEmpty(&servers)) {
resultSet = new Results<KeyValue*, ResultBlock<KeyValue*>>();
map<string,
map<KeyExtent*, vector<Range*>,
pointer_comparator<KeyExtent*> > > returnRanges;
set<string> locations;
tableLocator->binRanges(credentials, ranges, &locations,
&returnRanges);
for (string location : locations) {
vector<string> locationSplit = split(location, ':');
if (locationSplit.size() != 2 )
{
}
char *res = 0;
errno = 0;
uint64_t port = strtoul(locationSplit.at(1).c_str(),&res,10);
if (((port == (uint64_t)LONG_MIN || port == (uint64_t)LONG_MAX ) && errno != 0 ) || *res !='\0')
{
throw cclient::exceptions::ClientException( INVALID_SERVER_PORT);
}
for (auto hostExtents : returnRanges.at(location)) {
vector<KeyExtent*> extents;
extents.push_back(hostExtents.first);
RangeDefinition *rangeDef = new RangeDefinition(credentials,
scannerAuths, locationSplit.at(0),
port,
&hostExtents.second, &extents, &columns);
interconnect::ServerInterconnect *directConnect =
new interconnect::ServerInterconnect(rangeDef,
connectorInstance->getConfiguration());
scannerHeuristic->addClientInterface(directConnect);
}
}
// begin the scan, however the pre-configured heuristic chooses
scannerHeuristic->scan(this);
}
pthread_mutex_unlock(&scannerLock);
return resultSet;
}
void addResults(Results<KeyValue*, ResultBlock<KeyValue*>> *results) {
}
/**
* Sets the heuristic for this scanner
* @param heuristic scanner heuristic
*/
void setHeuristic(ScannerHeuristic *heuristic) {
scannerHeuristic = heuristic;
}
virtual ~Scanner() {
delete ranges;
delete scannerHeuristic;
}
protected:
/**
* Flushes the scanner
* @param override ensures that flushes occur despite not meeting requirements
**/
void flush(bool override = false);
/**
* Adds a connecting server definition
* @param ifc server definition
**/
void addServerDefinition(
ClientInterface<interconnect::ThriftTransporter> *ifc) {
servers.push_back(ifc);
}
/**
* Adds a vector of connecting server definition
* @param ifc server definition
**/
void addServerDefinition(
vector<ClientInterface<interconnect::ThriftTransporter>*> ifc) {
servers.insert(servers.end(), ifc.begin(), ifc.end());
}
// scanner
pthread_mutex_t scannerLock = PTHREAD_MUTEX_INITIALIZER;
// vector of ranges to interrogate.
vector<Range*> *ranges;
// result set iterator
Results<KeyValue*, ResultBlock<KeyValue*>> *resultSet;
// credentials
AuthInfo *credentials;
// scanner authorizations
Authorizations *scannerAuths;
// servers to access
vector<ClientInterface<interconnect::ThriftTransporter>*> servers;
// zookeeper instance
ZookeeperInstance *connectorInstance;
// scanner heuristic to control server access
ScannerHeuristic *scannerHeuristic;
// tablet locator
TabletLocator *tableLocator;
};
}
#endif /* SCANNER_H_ */
<file_sep>/*
* 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.
*/
#ifndef SRC_INTERCONNECT_ACCUMULOCONNECTOR_H_
#define SRC_INTERCONNECT_ACCUMULOCONNECTOR_H_
#include "../data/constructs/inputvalidation.h"
#include "../data/constructs/IterInfo.h"
#include "../data/constructs/configuration/Configuration.h"
#include "../data/extern/thrift/data_types.h"
#include "../data/constructs/scanstate.h"
#include "../data/exceptions/ClientException.h"
#include "../data/exceptions/IllegalArgumentException.h"
#include "../data/constructs/tablet/TabletType.h"
#include "../interconnect/ClientInterface.h"
#include "../data/constructs/server/RangeDefinition.h"
#include "DistributedConnector.h"
#include "../data/constructs/server/ServerDefinition.h"
using namespace cclient::exceptions;
using namespace cclient::data;
using namespace org::apache::accumulo::core::data::thrift;
using namespace cclient::data::tserver;
using namespace cclient::impl;
namespace interconnect {
/**
* Default Accumulo Connector
* Purpose: acts as the the most basic interface supplying connecting objects
* Design: Extends the most basic thrift interface, ClientInterface for
* thrift rpc calls
*/
template<typename Tr>
class AccumuloConnector: virtual public ClientInterface<Tr> {
public:
AccumuloConnector() :
ClientInterface<Tr>(), myDistributedConnector(NULL), credentials(
NULL), rangeDef(NULL), tServer(NULL), serverDef(NULL) {
}
AccumuloConnector(const string host, const int port) :
ClientInterface<Tr>(host, port), myDistributedConnector(NULL), credentials(
NULL), rangeDef(NULL), tServer(NULL), serverDef(NULL) {
}
virtual ~AccumuloConnector() {
}
AuthInfo *getCredentials() {
return credentials;
}
protected:
DistributedConnector<Tr> *myDistributedConnector;
AuthInfo *credentials;
RangeDefinition *rangeDef;
ServerConnection *tServer;
ServerDefinition *serverDef;
};
} /* namespace interconnect */
#endif /* SRC_INTERCONNECT_ACCUMULOCONNECTOR_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/tabletserver_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace tabletserver
{
namespace thrift
{
int _kScanTypeValues[] =
{ ScanType::SINGLE, ScanType::BATCH };
const char* _kScanTypeNames[] =
{ "SINGLE", "BATCH" };
const std::map<int, const char*> _ScanType_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (2, _kScanTypeValues,
_kScanTypeNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kScanStateValues[] =
{ ScanState::IDLE, ScanState::RUNNING, ScanState::QUEUED };
const char* _kScanStateNames[] =
{ "IDLE", "RUNNING", "QUEUED" };
const std::map<int, const char*> _ScanState_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (3, _kScanStateValues,
_kScanStateNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kCompactionTypeValues[] =
{ CompactionType::MINOR, CompactionType::MERGE,
CompactionType::MAJOR, CompactionType::FULL };
const char* _kCompactionTypeNames[] =
{ "MINOR", "MERGE", "MAJOR", "FULL" };
const std::map<int, const char*> _CompactionType_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (4, _kCompactionTypeValues,
_kCompactionTypeNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kCompactionReasonValues[] =
{ CompactionReason::USER, CompactionReason::SYSTEM,
CompactionReason::CHOP, CompactionReason::IDLE,
CompactionReason::CLOSE };
const char* _kCompactionReasonNames[] =
{ "USER", "SYSTEM", "CHOP", "IDLE", "CLOSE" };
const std::map<int, const char*> _CompactionReason_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (5, _kCompactionReasonValues,
_kCompactionReasonNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
NotServingTabletException::~NotServingTabletException () throw ()
{
}
void
NotServingTabletException::__set_extent (
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val)
{
this->extent = val;
}
const char* NotServingTabletException::ascii_fingerprint =
"636807D016867BC3A79FD54005E0677E";
const uint8_t NotServingTabletException::binary_fingerprint[16] =
{ 0x63, 0x68, 0x07, 0xD0, 0x16, 0x86, 0x7B, 0xC3, 0xA7, 0x9F,
0xD5, 0x40, 0x05, 0xE0, 0x67, 0x7E };
uint32_t
NotServingTabletException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
NotServingTabletException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("NotServingTabletException");
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (NotServingTabletException &a, NotServingTabletException &b)
{
using ::std::swap;
swap (a.extent, b.extent);
swap (a.__isset, b.__isset);
}
NotServingTabletException::NotServingTabletException (
const NotServingTabletException& other0) :
TException ()
{
extent = other0.extent;
__isset = other0.__isset;
}
NotServingTabletException&
NotServingTabletException::operator= (
const NotServingTabletException& other1)
{
extent = other1.extent;
__isset = other1.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const NotServingTabletException& obj)
{
using ::apache::thrift::to_string;
out << "NotServingTabletException(";
out << "extent=" << to_string (obj.extent);
out << ")";
return out;
}
TooManyFilesException::~TooManyFilesException () throw ()
{
}
void
TooManyFilesException::__set_extent (
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val)
{
this->extent = val;
}
const char* TooManyFilesException::ascii_fingerprint =
"636807D016867BC3A79FD54005E0677E";
const uint8_t TooManyFilesException::binary_fingerprint[16] =
{ 0x63, 0x68, 0x07, 0xD0, 0x16, 0x86, 0x7B, 0xC3, 0xA7, 0x9F,
0xD5, 0x40, 0x05, 0xE0, 0x67, 0x7E };
uint32_t
TooManyFilesException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TooManyFilesException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TooManyFilesException");
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TooManyFilesException &a, TooManyFilesException &b)
{
using ::std::swap;
swap (a.extent, b.extent);
swap (a.__isset, b.__isset);
}
TooManyFilesException::TooManyFilesException (
const TooManyFilesException& other2) :
TException ()
{
extent = other2.extent;
__isset = other2.__isset;
}
TooManyFilesException&
TooManyFilesException::operator= (
const TooManyFilesException& other3)
{
extent = other3.extent;
__isset = other3.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TooManyFilesException& obj)
{
using ::apache::thrift::to_string;
out << "TooManyFilesException(";
out << "extent=" << to_string (obj.extent);
out << ")";
return out;
}
NoSuchScanIDException::~NoSuchScanIDException () throw ()
{
}
const char* NoSuchScanIDException::ascii_fingerprint =
"99914B932BD37A50B983C5E7C90AE93B";
const uint8_t NoSuchScanIDException::binary_fingerprint[16] =
{ 0x99, 0x91, 0x4B, 0x93, 0x2B, 0xD3, 0x7A, 0x50, 0xB9, 0x83,
0xC5, 0xE7, 0xC9, 0x0A, 0xE9, 0x3B };
uint32_t
NoSuchScanIDException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
xfer += iprot->skip (ftype);
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
NoSuchScanIDException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("NoSuchScanIDException");
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (NoSuchScanIDException &a, NoSuchScanIDException &b)
{
using ::std::swap;
(void) a;
(void) b;
}
NoSuchScanIDException::NoSuchScanIDException (
const NoSuchScanIDException& other4) :
TException ()
{
(void) other4;
}
NoSuchScanIDException&
NoSuchScanIDException::operator= (
const NoSuchScanIDException& other5)
{
(void) other5;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const NoSuchScanIDException& obj)
{
using ::apache::thrift::to_string;
(void) obj;
out << "NoSuchScanIDException(";
out << ")";
return out;
}
ConstraintViolationException::~ConstraintViolationException () throw ()
{
}
void
ConstraintViolationException::__set_violationSummaries (
const std::vector<
::org::apache::accumulo::core::data::thrift::TConstraintViolationSummary> & val)
{
this->violationSummaries = val;
}
const char* ConstraintViolationException::ascii_fingerprint =
"3884B00559CED48471BE62CF7B94E4D1";
const uint8_t ConstraintViolationException::binary_fingerprint[16] =
{ 0x38, 0x84, 0xB0, 0x05, 0x59, 0xCE, 0xD4, 0x84, 0x71, 0xBE,
0x62, 0xCF, 0x7B, 0x94, 0xE4, 0xD1 };
uint32_t
ConstraintViolationException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->violationSummaries.clear ();
uint32_t _size6;
::apache::thrift::protocol::TType _etype9;
xfer += iprot->readListBegin (_etype9, _size6);
this->violationSummaries.resize (_size6);
uint32_t _i10;
for (_i10 = 0; _i10 < _size6; ++_i10)
{
xfer += this->violationSummaries[_i10].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.violationSummaries = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ConstraintViolationException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ConstraintViolationException");
xfer += oprot->writeFieldBegin (
"violationSummaries", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->violationSummaries.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TConstraintViolationSummary>::const_iterator _iter11;
for (_iter11 = this->violationSummaries.begin ();
_iter11 != this->violationSummaries.end (); ++_iter11)
{
xfer += (*_iter11).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ConstraintViolationException &a,
ConstraintViolationException &b)
{
using ::std::swap;
swap (a.violationSummaries, b.violationSummaries);
swap (a.__isset, b.__isset);
}
ConstraintViolationException::ConstraintViolationException (
const ConstraintViolationException& other12) :
TException ()
{
violationSummaries = other12.violationSummaries;
__isset = other12.__isset;
}
ConstraintViolationException&
ConstraintViolationException::operator= (
const ConstraintViolationException& other13)
{
violationSummaries = other13.violationSummaries;
__isset = other13.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out,
const ConstraintViolationException& obj)
{
using ::apache::thrift::to_string;
out << "ConstraintViolationException(";
out << "violationSummaries="
<< to_string (obj.violationSummaries);
out << ")";
return out;
}
ActionStats::~ActionStats () throw ()
{
}
void
ActionStats::__set_status (const int32_t val)
{
this->status = val;
}
void
ActionStats::__set_elapsed (const double val)
{
this->elapsed = val;
}
void
ActionStats::__set_num (const int32_t val)
{
this->num = val;
}
void
ActionStats::__set_count (const int64_t val)
{
this->count = val;
}
void
ActionStats::__set_sumDev (const double val)
{
this->sumDev = val;
}
void
ActionStats::__set_fail (const int32_t val)
{
this->fail = val;
}
void
ActionStats::__set_queueTime (const double val)
{
this->queueTime = val;
}
void
ActionStats::__set_queueSumDev (const double val)
{
this->queueSumDev = val;
}
const char* ActionStats::ascii_fingerprint =
"38F10F0BD2F539F3CA606E0480459450";
const uint8_t ActionStats::binary_fingerprint[16] =
{ 0x38, 0xF1, 0x0F, 0x0B, 0xD2, 0xF5, 0x39, 0xF3, 0xCA, 0x60,
0x6E, 0x04, 0x80, 0x45, 0x94, 0x50 };
uint32_t
ActionStats::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->status);
this->__isset.status = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->elapsed);
this->__isset.elapsed = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->num);
this->__isset.num = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->count);
this->__isset.count = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->sumDev);
this->__isset.sumDev = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->fail);
this->__isset.fail = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->queueTime);
this->__isset.queueTime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->queueSumDev);
this->__isset.queueSumDev = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ActionStats::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ActionStats");
xfer += oprot->writeFieldBegin ("status",
::apache::thrift::protocol::T_I32,
1);
xfer += oprot->writeI32 (this->status);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"elapsed", ::apache::thrift::protocol::T_DOUBLE, 2);
xfer += oprot->writeDouble (this->elapsed);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("num",
::apache::thrift::protocol::T_I32,
3);
xfer += oprot->writeI32 (this->num);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("count",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 (this->count);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"sumDev", ::apache::thrift::protocol::T_DOUBLE, 5);
xfer += oprot->writeDouble (this->sumDev);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("fail",
::apache::thrift::protocol::T_I32,
6);
xfer += oprot->writeI32 (this->fail);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"queueTime", ::apache::thrift::protocol::T_DOUBLE, 7);
xfer += oprot->writeDouble (this->queueTime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"queueSumDev", ::apache::thrift::protocol::T_DOUBLE, 8);
xfer += oprot->writeDouble (this->queueSumDev);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ActionStats &a, ActionStats &b)
{
using ::std::swap;
swap (a.status, b.status);
swap (a.elapsed, b.elapsed);
swap (a.num, b.num);
swap (a.count, b.count);
swap (a.sumDev, b.sumDev);
swap (a.fail, b.fail);
swap (a.queueTime, b.queueTime);
swap (a.queueSumDev, b.queueSumDev);
swap (a.__isset, b.__isset);
}
ActionStats::ActionStats (const ActionStats& other14)
{
status = other14.status;
elapsed = other14.elapsed;
num = other14.num;
count = other14.count;
sumDev = other14.sumDev;
fail = other14.fail;
queueTime = other14.queueTime;
queueSumDev = other14.queueSumDev;
__isset = other14.__isset;
}
ActionStats&
ActionStats::operator= (const ActionStats& other15)
{
status = other15.status;
elapsed = other15.elapsed;
num = other15.num;
count = other15.count;
sumDev = other15.sumDev;
fail = other15.fail;
queueTime = other15.queueTime;
queueSumDev = other15.queueSumDev;
__isset = other15.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const ActionStats& obj)
{
using ::apache::thrift::to_string;
out << "ActionStats(";
out << "status=" << to_string (obj.status);
out << ", " << "elapsed=" << to_string (obj.elapsed);
out << ", " << "num=" << to_string (obj.num);
out << ", " << "count=" << to_string (obj.count);
out << ", " << "sumDev=" << to_string (obj.sumDev);
out << ", " << "fail=" << to_string (obj.fail);
out << ", " << "queueTime=" << to_string (obj.queueTime);
out << ", " << "queueSumDev=" << to_string (obj.queueSumDev);
out << ")";
return out;
}
TabletStats::~TabletStats () throw ()
{
}
void
TabletStats::__set_extent (
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val)
{
this->extent = val;
}
void
TabletStats::__set_majors (const ActionStats& val)
{
this->majors = val;
}
void
TabletStats::__set_minors (const ActionStats& val)
{
this->minors = val;
}
void
TabletStats::__set_splits (const ActionStats& val)
{
this->splits = val;
}
void
TabletStats::__set_numEntries (const int64_t val)
{
this->numEntries = val;
}
void
TabletStats::__set_ingestRate (const double val)
{
this->ingestRate = val;
}
void
TabletStats::__set_queryRate (const double val)
{
this->queryRate = val;
}
void
TabletStats::__set_splitCreationTime (const int64_t val)
{
this->splitCreationTime = val;
}
const char* TabletStats::ascii_fingerprint =
"EDECD13D47255249DE8E10225F40F87E";
const uint8_t TabletStats::binary_fingerprint[16] =
{ 0xED, 0xEC, 0xD1, 0x3D, 0x47, 0x25, 0x52, 0x49, 0xDE, 0x8E,
0x10, 0x22, 0x5F, 0x40, 0xF8, 0x7E };
uint32_t
TabletStats::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->majors.read (iprot);
this->__isset.majors = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->minors.read (iprot);
this->__isset.minors = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->splits.read (iprot);
this->__isset.splits = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->numEntries);
this->__isset.numEntries = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->ingestRate);
this->__isset.ingestRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->queryRate);
this->__isset.queryRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->splitCreationTime);
this->__isset.splitCreationTime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletStats::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TabletStats");
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"majors", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->majors.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"minors", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->minors.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"splits", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->splits.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("numEntries",
::apache::thrift::protocol::T_I64,
5);
xfer += oprot->writeI64 (this->numEntries);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ingestRate", ::apache::thrift::protocol::T_DOUBLE, 6);
xfer += oprot->writeDouble (this->ingestRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"queryRate", ::apache::thrift::protocol::T_DOUBLE, 7);
xfer += oprot->writeDouble (this->queryRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("splitCreationTime",
::apache::thrift::protocol::T_I64,
8);
xfer += oprot->writeI64 (this->splitCreationTime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TabletStats &a, TabletStats &b)
{
using ::std::swap;
swap (a.extent, b.extent);
swap (a.majors, b.majors);
swap (a.minors, b.minors);
swap (a.splits, b.splits);
swap (a.numEntries, b.numEntries);
swap (a.ingestRate, b.ingestRate);
swap (a.queryRate, b.queryRate);
swap (a.splitCreationTime, b.splitCreationTime);
swap (a.__isset, b.__isset);
}
TabletStats::TabletStats (const TabletStats& other16)
{
extent = other16.extent;
majors = other16.majors;
minors = other16.minors;
splits = other16.splits;
numEntries = other16.numEntries;
ingestRate = other16.ingestRate;
queryRate = other16.queryRate;
splitCreationTime = other16.splitCreationTime;
__isset = other16.__isset;
}
TabletStats&
TabletStats::operator= (const TabletStats& other17)
{
extent = other17.extent;
majors = other17.majors;
minors = other17.minors;
splits = other17.splits;
numEntries = other17.numEntries;
ingestRate = other17.ingestRate;
queryRate = other17.queryRate;
splitCreationTime = other17.splitCreationTime;
__isset = other17.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TabletStats& obj)
{
using ::apache::thrift::to_string;
out << "TabletStats(";
out << "extent=" << to_string (obj.extent);
out << ", " << "majors=" << to_string (obj.majors);
out << ", " << "minors=" << to_string (obj.minors);
out << ", " << "splits=" << to_string (obj.splits);
out << ", " << "numEntries=" << to_string (obj.numEntries);
out << ", " << "ingestRate=" << to_string (obj.ingestRate);
out << ", " << "queryRate=" << to_string (obj.queryRate);
out << ", " << "splitCreationTime="
<< to_string (obj.splitCreationTime);
out << ")";
return out;
}
ActiveScan::~ActiveScan () throw ()
{
}
void
ActiveScan::__set_client (const std::string& val)
{
this->client = val;
}
void
ActiveScan::__set_user (const std::string& val)
{
this->user = val;
}
void
ActiveScan::__set_tableId (const std::string& val)
{
this->tableId = val;
}
void
ActiveScan::__set_age (const int64_t val)
{
this->age = val;
}
void
ActiveScan::__set_idleTime (const int64_t val)
{
this->idleTime = val;
}
void
ActiveScan::__set_type (const ScanType::type val)
{
this->type = val;
}
void
ActiveScan::__set_state (const ScanState::type val)
{
this->state = val;
}
void
ActiveScan::__set_extent (
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val)
{
this->extent = val;
}
void
ActiveScan::__set_columns (
const std::vector<
::org::apache::accumulo::core::data::thrift::TColumn> & val)
{
this->columns = val;
}
void
ActiveScan::__set_ssiList (
const std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo> & val)
{
this->ssiList = val;
}
void
ActiveScan::__set_ssio (
const std::map<std::string, std::map<std::string, std::string> > & val)
{
this->ssio = val;
}
void
ActiveScan::__set_authorizations (
const std::vector<std::string> & val)
{
this->authorizations = val;
}
void
ActiveScan::__set_scanId (const int64_t val)
{
this->scanId = val;
__isset.scanId = true;
}
const char* ActiveScan::ascii_fingerprint =
"B3549C14C0C72FCBA06F1947AA8A1F62";
const uint8_t ActiveScan::binary_fingerprint[16] =
{ 0xB3, 0x54, 0x9C, 0x14, 0xC0, 0xC7, 0x2F, 0xCB, 0xA0, 0x6F,
0x19, 0x47, 0xAA, 0x8A, 0x1F, 0x62 };
uint32_t
ActiveScan::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->client);
this->__isset.client = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->user);
this->__isset.user = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tableId);
this->__isset.tableId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->age);
this->__isset.age = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->idleTime);
this->__isset.idleTime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast18;
xfer += iprot->readI32 (ecast18);
this->type = (ScanType::type) ecast18;
this->__isset.type = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast19;
xfer += iprot->readI32 (ecast19);
this->state = (ScanState::type) ecast19;
this->__isset.state = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->columns.clear ();
uint32_t _size20;
::apache::thrift::protocol::TType _etype23;
xfer += iprot->readListBegin (_etype23, _size20);
this->columns.resize (_size20);
uint32_t _i24;
for (_i24 = 0; _i24 < _size20; ++_i24)
{
xfer += this->columns[_i24].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.columns = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->ssiList.clear ();
uint32_t _size25;
::apache::thrift::protocol::TType _etype28;
xfer += iprot->readListBegin (_etype28, _size25);
this->ssiList.resize (_size25);
uint32_t _i29;
for (_i29 = 0; _i29 < _size25; ++_i29)
{
xfer += this->ssiList[_i29].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.ssiList = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 12:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->ssio.clear ();
uint32_t _size30;
::apache::thrift::protocol::TType _ktype31;
::apache::thrift::protocol::TType _vtype32;
xfer += iprot->readMapBegin (_ktype31, _vtype32,
_size30);
uint32_t _i34;
for (_i34 = 0; _i34 < _size30; ++_i34)
{
std::string _key35;
xfer += iprot->readString (_key35);
std::map<std::string, std::string> & _val36 =
this->ssio[_key35];
{
_val36.clear ();
uint32_t _size37;
::apache::thrift::protocol::TType _ktype38;
::apache::thrift::protocol::TType _vtype39;
xfer += iprot->readMapBegin (_ktype38,
_vtype39,
_size37);
uint32_t _i41;
for (_i41 = 0; _i41 < _size37; ++_i41)
{
std::string _key42;
xfer += iprot->readString (_key42);
std::string& _val43 = _val36[_key42];
xfer += iprot->readString (_val43);
}
xfer += iprot->readMapEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.ssio = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 13:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->authorizations.clear ();
uint32_t _size44;
::apache::thrift::protocol::TType _etype47;
xfer += iprot->readListBegin (_etype47, _size44);
this->authorizations.resize (_size44);
uint32_t _i48;
for (_i48 = 0; _i48 < _size44; ++_i48)
{
xfer += iprot->readBinary (
this->authorizations[_i48]);
}
xfer += iprot->readListEnd ();
}
this->__isset.authorizations = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 14:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->scanId);
this->__isset.scanId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ActiveScan::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ActiveScan");
xfer += oprot->writeFieldBegin (
"client", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->client);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"user", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->user);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tableId", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->tableId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("age",
::apache::thrift::protocol::T_I64,
5);
xfer += oprot->writeI64 (this->age);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("idleTime",
::apache::thrift::protocol::T_I64,
6);
xfer += oprot->writeI64 (this->idleTime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("type",
::apache::thrift::protocol::T_I32,
7);
xfer += oprot->writeI32 ((int32_t) this->type);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("state",
::apache::thrift::protocol::T_I32,
8);
xfer += oprot->writeI32 ((int32_t) this->state);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 9);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"columns", ::apache::thrift::protocol::T_LIST, 10);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->columns.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TColumn>::const_iterator _iter49;
for (_iter49 = this->columns.begin ();
_iter49 != this->columns.end (); ++_iter49)
{
xfer += (*_iter49).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ssiList", ::apache::thrift::protocol::T_LIST, 11);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->ssiList.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo>::const_iterator _iter50;
for (_iter50 = this->ssiList.begin ();
_iter50 != this->ssiList.end (); ++_iter50)
{
xfer += (*_iter50).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ssio",
::apache::thrift::protocol::T_MAP,
12);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> (this->ssio.size ()));
std::map<std::string, std::map<std::string, std::string> >::const_iterator _iter51;
for (_iter51 = this->ssio.begin ();
_iter51 != this->ssio.end (); ++_iter51)
{
xfer += oprot->writeString (_iter51->first);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (_iter51->second.size ()));
std::map<std::string, std::string>::const_iterator _iter52;
for (_iter52 = _iter51->second.begin ();
_iter52 != _iter51->second.end (); ++_iter52)
{
xfer += oprot->writeString (_iter52->first);
xfer += oprot->writeString (_iter52->second);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"authorizations", ::apache::thrift::protocol::T_LIST, 13);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->authorizations.size ()));
std::vector<std::string>::const_iterator _iter53;
for (_iter53 = this->authorizations.begin ();
_iter53 != this->authorizations.end (); ++_iter53)
{
xfer += oprot->writeBinary ((*_iter53));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
if (this->__isset.scanId)
{
xfer += oprot->writeFieldBegin (
"scanId", ::apache::thrift::protocol::T_I64, 14);
xfer += oprot->writeI64 (this->scanId);
xfer += oprot->writeFieldEnd ();
}
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ActiveScan &a, ActiveScan &b)
{
using ::std::swap;
swap (a.client, b.client);
swap (a.user, b.user);
swap (a.tableId, b.tableId);
swap (a.age, b.age);
swap (a.idleTime, b.idleTime);
swap (a.type, b.type);
swap (a.state, b.state);
swap (a.extent, b.extent);
swap (a.columns, b.columns);
swap (a.ssiList, b.ssiList);
swap (a.ssio, b.ssio);
swap (a.authorizations, b.authorizations);
swap (a.scanId, b.scanId);
swap (a.__isset, b.__isset);
}
ActiveScan::ActiveScan (const ActiveScan& other54)
{
client = other54.client;
user = other54.user;
tableId = other54.tableId;
age = other54.age;
idleTime = other54.idleTime;
type = other54.type;
state = other54.state;
extent = other54.extent;
columns = other54.columns;
ssiList = other54.ssiList;
ssio = other54.ssio;
authorizations = other54.authorizations;
scanId = other54.scanId;
__isset = other54.__isset;
}
ActiveScan&
ActiveScan::operator= (const ActiveScan& other55)
{
client = other55.client;
user = other55.user;
tableId = other55.tableId;
age = other55.age;
idleTime = other55.idleTime;
type = other55.type;
state = other55.state;
extent = other55.extent;
columns = other55.columns;
ssiList = other55.ssiList;
ssio = other55.ssio;
authorizations = other55.authorizations;
scanId = other55.scanId;
__isset = other55.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const ActiveScan& obj)
{
using ::apache::thrift::to_string;
out << "ActiveScan(";
out << "client=" << to_string (obj.client);
out << ", " << "user=" << to_string (obj.user);
out << ", " << "tableId=" << to_string (obj.tableId);
out << ", " << "age=" << to_string (obj.age);
out << ", " << "idleTime=" << to_string (obj.idleTime);
out << ", " << "type=" << to_string (obj.type);
out << ", " << "state=" << to_string (obj.state);
out << ", " << "extent=" << to_string (obj.extent);
out << ", " << "columns=" << to_string (obj.columns);
out << ", " << "ssiList=" << to_string (obj.ssiList);
out << ", " << "ssio=" << to_string (obj.ssio);
out << ", " << "authorizations="
<< to_string (obj.authorizations);
out << ", " << "scanId=";
(obj.__isset.scanId ?
(out << to_string (obj.scanId)) : (out << "<null>"));
out << ")";
return out;
}
ActiveCompaction::~ActiveCompaction () throw ()
{
}
void
ActiveCompaction::__set_extent (
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val)
{
this->extent = val;
}
void
ActiveCompaction::__set_age (const int64_t val)
{
this->age = val;
}
void
ActiveCompaction::__set_inputFiles (
const std::vector<std::string> & val)
{
this->inputFiles = val;
}
void
ActiveCompaction::__set_outputFile (const std::string& val)
{
this->outputFile = val;
}
void
ActiveCompaction::__set_type (const CompactionType::type val)
{
this->type = val;
}
void
ActiveCompaction::__set_reason (const CompactionReason::type val)
{
this->reason = val;
}
void
ActiveCompaction::__set_localityGroup (const std::string& val)
{
this->localityGroup = val;
}
void
ActiveCompaction::__set_entriesRead (const int64_t val)
{
this->entriesRead = val;
}
void
ActiveCompaction::__set_entriesWritten (const int64_t val)
{
this->entriesWritten = val;
}
void
ActiveCompaction::__set_ssiList (
const std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo> & val)
{
this->ssiList = val;
}
void
ActiveCompaction::__set_ssio (
const std::map<std::string, std::map<std::string, std::string> > & val)
{
this->ssio = val;
}
const char* ActiveCompaction::ascii_fingerprint =
"F21BEB5FC0933DF8AFDE54B450E3AA88";
const uint8_t ActiveCompaction::binary_fingerprint[16] =
{ 0xF2, 0x1B, 0xEB, 0x5F, 0xC0, 0x93, 0x3D, 0xF8, 0xAF, 0xDE,
0x54, 0xB4, 0x50, 0xE3, 0xAA, 0x88 };
uint32_t
ActiveCompaction::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->extent.read (iprot);
this->__isset.extent = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->age);
this->__isset.age = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->inputFiles.clear ();
uint32_t _size56;
::apache::thrift::protocol::TType _etype59;
xfer += iprot->readListBegin (_etype59, _size56);
this->inputFiles.resize (_size56);
uint32_t _i60;
for (_i60 = 0; _i60 < _size56; ++_i60)
{
xfer += iprot->readString (
this->inputFiles[_i60]);
}
xfer += iprot->readListEnd ();
}
this->__isset.inputFiles = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->outputFile);
this->__isset.outputFile = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast61;
xfer += iprot->readI32 (ecast61);
this->type = (CompactionType::type) ecast61;
this->__isset.type = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast62;
xfer += iprot->readI32 (ecast62);
this->reason = (CompactionReason::type) ecast62;
this->__isset.reason = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->localityGroup);
this->__isset.localityGroup = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->entriesRead);
this->__isset.entriesRead = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->entriesWritten);
this->__isset.entriesWritten = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->ssiList.clear ();
uint32_t _size63;
::apache::thrift::protocol::TType _etype66;
xfer += iprot->readListBegin (_etype66, _size63);
this->ssiList.resize (_size63);
uint32_t _i67;
for (_i67 = 0; _i67 < _size63; ++_i67)
{
xfer += this->ssiList[_i67].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.ssiList = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->ssio.clear ();
uint32_t _size68;
::apache::thrift::protocol::TType _ktype69;
::apache::thrift::protocol::TType _vtype70;
xfer += iprot->readMapBegin (_ktype69, _vtype70,
_size68);
uint32_t _i72;
for (_i72 = 0; _i72 < _size68; ++_i72)
{
std::string _key73;
xfer += iprot->readString (_key73);
std::map<std::string, std::string> & _val74 =
this->ssio[_key73];
{
_val74.clear ();
uint32_t _size75;
::apache::thrift::protocol::TType _ktype76;
::apache::thrift::protocol::TType _vtype77;
xfer += iprot->readMapBegin (_ktype76,
_vtype77,
_size75);
uint32_t _i79;
for (_i79 = 0; _i79 < _size75; ++_i79)
{
std::string _key80;
xfer += iprot->readString (_key80);
std::string& _val81 = _val74[_key80];
xfer += iprot->readString (_val81);
}
xfer += iprot->readMapEnd ();
}
}
xfer += iprot->readMapEnd ();
}
this->__isset.ssio = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
ActiveCompaction::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("ActiveCompaction");
xfer += oprot->writeFieldBegin (
"extent", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->extent.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("age",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->age);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"inputFiles", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->inputFiles.size ()));
std::vector<std::string>::const_iterator _iter82;
for (_iter82 = this->inputFiles.begin ();
_iter82 != this->inputFiles.end (); ++_iter82)
{
xfer += oprot->writeString ((*_iter82));
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"outputFile", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->outputFile);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("type",
::apache::thrift::protocol::T_I32,
5);
xfer += oprot->writeI32 ((int32_t) this->type);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("reason",
::apache::thrift::protocol::T_I32,
6);
xfer += oprot->writeI32 ((int32_t) this->reason);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"localityGroup", ::apache::thrift::protocol::T_STRING, 7);
xfer += oprot->writeString (this->localityGroup);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("entriesRead",
::apache::thrift::protocol::T_I64,
8);
xfer += oprot->writeI64 (this->entriesRead);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("entriesWritten",
::apache::thrift::protocol::T_I64,
9);
xfer += oprot->writeI64 (this->entriesWritten);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ssiList", ::apache::thrift::protocol::T_LIST, 10);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->ssiList.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::IterInfo>::const_iterator _iter83;
for (_iter83 = this->ssiList.begin ();
_iter83 != this->ssiList.end (); ++_iter83)
{
xfer += (*_iter83).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("ssio",
::apache::thrift::protocol::T_MAP,
11);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_MAP,
static_cast<uint32_t> (this->ssio.size ()));
std::map<std::string, std::map<std::string, std::string> >::const_iterator _iter84;
for (_iter84 = this->ssio.begin ();
_iter84 != this->ssio.end (); ++_iter84)
{
xfer += oprot->writeString (_iter84->first);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (_iter84->second.size ()));
std::map<std::string, std::string>::const_iterator _iter85;
for (_iter85 = _iter84->second.begin ();
_iter85 != _iter84->second.end (); ++_iter85)
{
xfer += oprot->writeString (_iter85->first);
xfer += oprot->writeString (_iter85->second);
}
xfer += oprot->writeMapEnd ();
}
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (ActiveCompaction &a, ActiveCompaction &b)
{
using ::std::swap;
swap (a.extent, b.extent);
swap (a.age, b.age);
swap (a.inputFiles, b.inputFiles);
swap (a.outputFile, b.outputFile);
swap (a.type, b.type);
swap (a.reason, b.reason);
swap (a.localityGroup, b.localityGroup);
swap (a.entriesRead, b.entriesRead);
swap (a.entriesWritten, b.entriesWritten);
swap (a.ssiList, b.ssiList);
swap (a.ssio, b.ssio);
swap (a.__isset, b.__isset);
}
ActiveCompaction::ActiveCompaction (const ActiveCompaction& other86)
{
extent = other86.extent;
age = other86.age;
inputFiles = other86.inputFiles;
outputFile = other86.outputFile;
type = other86.type;
reason = other86.reason;
localityGroup = other86.localityGroup;
entriesRead = other86.entriesRead;
entriesWritten = other86.entriesWritten;
ssiList = other86.ssiList;
ssio = other86.ssio;
__isset = other86.__isset;
}
ActiveCompaction&
ActiveCompaction::operator= (const ActiveCompaction& other87)
{
extent = other87.extent;
age = other87.age;
inputFiles = other87.inputFiles;
outputFile = other87.outputFile;
type = other87.type;
reason = other87.reason;
localityGroup = other87.localityGroup;
entriesRead = other87.entriesRead;
entriesWritten = other87.entriesWritten;
ssiList = other87.ssiList;
ssio = other87.ssio;
__isset = other87.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const ActiveCompaction& obj)
{
using ::apache::thrift::to_string;
out << "ActiveCompaction(";
out << "extent=" << to_string (obj.extent);
out << ", " << "age=" << to_string (obj.age);
out << ", " << "inputFiles=" << to_string (obj.inputFiles);
out << ", " << "outputFile=" << to_string (obj.outputFile);
out << ", " << "type=" << to_string (obj.type);
out << ", " << "reason=" << to_string (obj.reason);
out << ", " << "localityGroup=" << to_string (obj.localityGroup);
out << ", " << "entriesRead=" << to_string (obj.entriesRead);
out << ", " << "entriesWritten="
<< to_string (obj.entriesWritten);
out << ", " << "ssiList=" << to_string (obj.ssiList);
out << ", " << "ssio=" << to_string (obj.ssio);
out << ")";
return out;
}
TIteratorSetting::~TIteratorSetting () throw ()
{
}
void
TIteratorSetting::__set_priority (const int32_t val)
{
this->priority = val;
}
void
TIteratorSetting::__set_name (const std::string& val)
{
this->name = val;
}
void
TIteratorSetting::__set_iteratorClass (const std::string& val)
{
this->iteratorClass = val;
}
void
TIteratorSetting::__set_properties (
const std::map<std::string, std::string> & val)
{
this->properties = val;
}
const char* TIteratorSetting::ascii_fingerprint =
"985C857916964E43205EAC92A157CB4E";
const uint8_t TIteratorSetting::binary_fingerprint[16] =
{ 0x98, 0x5C, 0x85, 0x79, 0x16, 0x96, 0x4E, 0x43, 0x20, 0x5E,
0xAC, 0x92, 0xA1, 0x57, 0xCB, 0x4E };
uint32_t
TIteratorSetting::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->priority);
this->__isset.priority = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->name);
this->__isset.name = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->iteratorClass);
this->__isset.iteratorClass = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->properties.clear ();
uint32_t _size88;
::apache::thrift::protocol::TType _ktype89;
::apache::thrift::protocol::TType _vtype90;
xfer += iprot->readMapBegin (_ktype89, _vtype90,
_size88);
uint32_t _i92;
for (_i92 = 0; _i92 < _size88; ++_i92)
{
std::string _key93;
xfer += iprot->readString (_key93);
std::string& _val94 = this->properties[_key93];
xfer += iprot->readString (_val94);
}
xfer += iprot->readMapEnd ();
}
this->__isset.properties = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TIteratorSetting::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TIteratorSetting");
xfer += oprot->writeFieldBegin ("priority",
::apache::thrift::protocol::T_I32,
1);
xfer += oprot->writeI32 (this->priority);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"name", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->name);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"iteratorClass", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->iteratorClass);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("properties",
::apache::thrift::protocol::T_MAP,
4);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->properties.size ()));
std::map<std::string, std::string>::const_iterator _iter95;
for (_iter95 = this->properties.begin ();
_iter95 != this->properties.end (); ++_iter95)
{
xfer += oprot->writeString (_iter95->first);
xfer += oprot->writeString (_iter95->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TIteratorSetting &a, TIteratorSetting &b)
{
using ::std::swap;
swap (a.priority, b.priority);
swap (a.name, b.name);
swap (a.iteratorClass, b.iteratorClass);
swap (a.properties, b.properties);
swap (a.__isset, b.__isset);
}
TIteratorSetting::TIteratorSetting (const TIteratorSetting& other96)
{
priority = other96.priority;
name = other96.name;
iteratorClass = other96.iteratorClass;
properties = other96.properties;
__isset = other96.__isset;
}
TIteratorSetting&
TIteratorSetting::operator= (const TIteratorSetting& other97)
{
priority = other97.priority;
name = other97.name;
iteratorClass = other97.iteratorClass;
properties = other97.properties;
__isset = other97.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TIteratorSetting& obj)
{
using ::apache::thrift::to_string;
out << "TIteratorSetting(";
out << "priority=" << to_string (obj.priority);
out << ", " << "name=" << to_string (obj.name);
out << ", " << "iteratorClass=" << to_string (obj.iteratorClass);
out << ", " << "properties=" << to_string (obj.properties);
out << ")";
return out;
}
IteratorConfig::~IteratorConfig () throw ()
{
}
void
IteratorConfig::__set_iterators (
const std::vector<TIteratorSetting> & val)
{
this->iterators = val;
}
const char* IteratorConfig::ascii_fingerprint =
"FFF95A9CEF69279C7B1115140EF9F6D7";
const uint8_t IteratorConfig::binary_fingerprint[16] =
{ 0xFF, 0xF9, 0x5A, 0x9C, 0xEF, 0x69, 0x27, 0x9C, 0x7B, 0x11,
0x15, 0x14, 0x0E, 0xF9, 0xF6, 0xD7 };
uint32_t
IteratorConfig::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->iterators.clear ();
uint32_t _size98;
::apache::thrift::protocol::TType _etype101;
xfer += iprot->readListBegin (_etype101, _size98);
this->iterators.resize (_size98);
uint32_t _i102;
for (_i102 = 0; _i102 < _size98; ++_i102)
{
xfer += this->iterators[_i102].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.iterators = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
IteratorConfig::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("IteratorConfig");
xfer += oprot->writeFieldBegin (
"iterators", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->iterators.size ()));
std::vector<TIteratorSetting>::const_iterator _iter103;
for (_iter103 = this->iterators.begin ();
_iter103 != this->iterators.end (); ++_iter103)
{
xfer += (*_iter103).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (IteratorConfig &a, IteratorConfig &b)
{
using ::std::swap;
swap (a.iterators, b.iterators);
swap (a.__isset, b.__isset);
}
IteratorConfig::IteratorConfig (const IteratorConfig& other104)
{
iterators = other104.iterators;
__isset = other104.__isset;
}
IteratorConfig&
IteratorConfig::operator= (const IteratorConfig& other105)
{
iterators = other105.iterators;
__isset = other105.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const IteratorConfig& obj)
{
using ::apache::thrift::to_string;
out << "IteratorConfig(";
out << "iterators=" << to_string (obj.iterators);
out << ")";
return out;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef INPUTVALIDATION_H
#define INPUTVALIDATION_H
#include <sstream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <cstring>
using namespace std;
template<typename T>
class has_size {
typedef char one;
typedef long two;
template<typename C> static one test(decltype(&C::size));
template<typename C> static two test(...);
public:
enum {
value = sizeof(test<T>(0)) == sizeof(char)
};
};
template<typename T>
static auto IsEmpty(
T *t) -> typename enable_if<has_size<T>::value ==1, bool>::type {
return (NULL == t || t->size() == 0);
}
template<typename T>
static auto IsEmpty(
T *t) -> typename enable_if<not has_size<T>::value , bool>::type {
return (NULL == t);
}
static auto IsEmpty(char *t)-> decltype(NULL !=t, bool()) {
return (NULL == t || strlen(t) == 0);
}
template<typename ... T>
bool IsEmpty() {
return false;
}
static bool isValidPort(uint32_t port) {
if (port < 1024 || port > 65535) {
return false;
}
return true;
}
template< typename T >
class pointer_comparator : public std::binary_function< T, T, bool >
{
public :
bool operator()( T x, T y ) const {
return *x < *y;
}
};
template<typename T, size_t N>
inline size_t array_length(T data[N])
{
return N;
};
template<typename T, size_t N>
size_t array_length(const T (&x)[N])
{
return N;
}
static vector<string> split(string str, char delim) {
stringstream test(str);
string segment;
vector<string> seglist;
while (std::getline(test, segment, delim)) {
seglist.push_back(segment);
}
return seglist;
}
#endif // INPUTVALIDATION_H
<file_sep>/*
* 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.
*/
#include <vector>
#include <memory>
using namespace std;
#include "../../../include/data/client/MetaDataLocationObtainer.h"
#include "../../../include/data/client/../constructs/server/RangeDefinition.h"
#include "../../../include/data/client/../constructs/StructureDefinitions.h"
#include "../../../include/data/client/../../interconnect/TabletServer.h"
#include "../../../include/data/client/../../interconnect/Scan.h"
#include "../../../include/data/client/../constructs/Range.h"
#include "../../../include/data/client/../constructs/KeyExtent.h"
#include "../../../include/data/client/../constructs/Key.h"
#include "../../../include/data/client/../constructs/IterInfo.h"
#include "../../../include/data/client/../constructs/value.h"
#include "../../../include/data/client/TabletLocation.h"
namespace cclient
{
namespace impl
{
using namespace cclient::data;
using namespace cclient::data::tserver;
MetaDataLocationObtainer::~MetaDataLocationObtainer ()
{
for (vector<Column*>::iterator locIt = columns->begin ();
locIt != columns->end (); locIt++)
{
delete (*locIt);
}
delete columns;
}
list<TabletLocation*>
MetaDataLocationObtainer::findTablet (AuthInfo *credentials,
TabletLocation *source, string row,
string stopRow, TabletLocator *parent)
{
list<TabletLocation*> tabletLocations;
Key startKey;
startKey.setRow (row.c_str (), row.size ());
Key endKey;
endKey.setRow (stopRow.c_str (), stopRow.size ());
Range *range = new Range (&startKey, true, &endKey, true);
map<Key, Value> resultSet;
Authorizations emptyAuths;
vector<Range*> ranges;
ranges.push_back (range);
vector<KeyExtent*> extents;
extents.push_back (source->getExtent ());
RangeDefinition *rangeDef = new RangeDefinition (credentials, &emptyAuths,
source->getServer (),
source->getPort (),
&ranges, &extents);
Configuration conf;
interconnect::ServerInterconnect *directConnect =
new interconnect::ServerInterconnect (rangeDef, &conf);
IterInfo wriIter (
"WRI", "org.apache.accumulo.core.iterators.user.WholeRowIterator",
10000);
vector<IterInfo*> iters;
iters.push_back (&wriIter);
interconnect::Scan *initScan = directConnect->scan (columns, &iters);
vector<KeyValue*> kvResults;
initScan->getNextResults (&kvResults);
map<Key*, Value*, pointer_comparator<Key*>> results = decodeResults (
&kvResults);
Key *key = 0;
Value * value = 0;
string lastRowFromKey = "";
string currentRow = "";
string location = "", session = "";
Value *prevRow = 0;
KeyExtent *ke;
for (map<Key*, Value*>::iterator it = results.begin ();
it != results.end (); it++)
{
key = it->first;
currentRow = string (key->getRow ().first, key->getRow ().second);
if (currentRow != lastRowFromKey)
{
prevRow = 0;
location = session = "";
lastRowFromKey = currentRow;
}
std::pair<char*, size_t> cfBytes = key->getColFamily ();
string cf = string (cfBytes.first, cfBytes.second);
std::pair<char*, size_t> cqBytes = key->getColQualifier ();
string cq = string (cqBytes.first, cqBytes.second);
value = it->second;
std::pair<uint8_t*, size_t> valBytes = value->getValue ();
if (cf == METADATA_CURRENT_LOCATION_COLUMN_FAMILY
|| cf == METADATA_FUTURE_LOCATION_COLUMN_FAMILY)
{
location = string ((char*) valBytes.first, valBytes.second);
session = cq;
}
else if (cf == METADATA_TABLET_COLUMN_FAMILY
&& cq == METADATA_PREV_ROW_COLUMN_CQ)
{
prevRow = value;
}
if (prevRow != NULL)
{
ke = new KeyExtent (currentRow, prevRow);
if (location.length () > 0)
{
TabletLocation *te = new TabletLocation (ke, location,
session);
tabletLocations.push_back (te);
}
}
}
for (map<Key*, Value*>::iterator it = results.begin ();
it != results.end (); it++)
{
delete it->first;
delete it->second;
}
delete initScan;
// cleanup
// delete rangeDef;
delete range;
delete directConnect;
return tabletLocations;
}
} /* namespace impl */
} /* namespace cclient */
<file_sep>/*
* 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.
*/
#ifndef METADATALOCATIONOBTAINER_H_
#define METADATALOCATIONOBTAINER_H_
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
#include "TabletLocationObtainer.h"
#include "../constructs/column.h"
#include "../constructs/StructureDefinitions.h"
#include "../constructs/client/Instance.h"
#include "../constructs/security/AuthInfo.h"
namespace cclient {
namespace impl {
using namespace cclient::data;
using namespace cclient::data::security;
class MetaDataLocationObtainer: public TabletLocationObtainer {
public:
MetaDataLocationObtainer(Instance *instance) :
instance(instance) {
columns = new vector<Column*>();
columns->push_back(
new Column(METADATA_CURRENT_LOCATION_COLUMN_FAMILY));
columns->push_back(new Column(METADATA_TABLET_COLUMN_FAMILY,
METADATA_PREV_ROW_COLUMN_CQ));
sort(columns->begin(),columns->end());
}
virtual ~MetaDataLocationObtainer();
list<TabletLocation*> findTablet(AuthInfo *credentials, TabletLocation *source, string row,
string stopRow, TabletLocator *parent);
list<TabletLocation*> findTablet(AuthInfo *credentials, string tabletserver,
map<KeyExtent, list<Range> > *map, TabletLocator *parent) {
return list<TabletLocation*>();
}
protected:
vector<Column*> *columns;
Instance *instance;
};
} /* namespace impl */
} /* namespace cclient */
#endif /* METADATALOCATIONOBTAINER_H_ */
<file_sep>/*
* 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.
*/
#ifndef SRC_CLIENTEXAMPLE_H_
#define SRC_CLIENTEXAMPLE_H_
#ifdef __cplusplus
extern "C" {
#endif
struct TableOps {
char *table_name;
// stuff you don't use
struct connector *parent;
void *tableOpsPtr;
};
struct connector {
// stuff you don't use
void *masterPtr;
void *zk;
};
struct connector *create_connector(char *instance, char *zks, char *username,
char *password);
int free_connector(struct connector *connector);
struct TableOps *open_table(struct connector *connector, char *tableName);
struct TableOps *create_table(struct connector *connector, char *tableName);
int free_table(struct TableOps *tableOps);
#ifdef __cplusplus
}
//end extern "C"
#endif
#endif
<file_sep>/*
* 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.
*/
#ifndef SCAN_H_
#define SCAN_H_ 1
#include <iostream>
#include <vector>
#include <stdio.h> /* printf, scanf, puts, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h>
#include "../data/constructs/KeyValue.h"
//http://sector.sourceforge.net/software.html
/**
* Represents a running scan
*/
namespace interconnect
{
using namespace cclient::data;
class Scan
{
public:
Scan();
~Scan();
bool setNextResults(vector<KeyValue*> *resultSet)
{
results.insert(results.end(), resultSet->begin(),
resultSet->end());
return true;
}
bool getNextResults(vector<KeyValue*> *resultSet)
{
resultSet->insert(resultSet->end(), results.begin(), results.end());
results.clear();
return hasMore;
}
void setHasMore(bool more)
{
hasMore = more;
}
bool getHasMore()
{
return hasMore;
}
int64_t getId()
{
return scanId;
}
void setScanId(int64_t scanId)
{
this->scanId = scanId;
}
protected:
int64_t scanId;
bool hasMore;
vector<KeyValue*> results;
};
}
#endif /* SCAN_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/trace_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace org
{
namespace apache
{
namespace accumulo
{
namespace trace
{
namespace thrift
{
RemoteSpan::~RemoteSpan () throw ()
{
}
void
RemoteSpan::__set_sender (const std::string& val)
{
this->sender = val;
}
void
RemoteSpan::__set_svc (const std::string& val)
{
this->svc = val;
}
void
RemoteSpan::__set_traceId (const int64_t val)
{
this->traceId = val;
}
void
RemoteSpan::__set_spanId (const int64_t val)
{
this->spanId = val;
}
void
RemoteSpan::__set_parentId (const int64_t val)
{
this->parentId = val;
}
void
RemoteSpan::__set_start (const int64_t val)
{
this->start = val;
}
void
RemoteSpan::__set_stop (const int64_t val)
{
this->stop = val;
}
void
RemoteSpan::__set_description (const std::string& val)
{
this->description = val;
}
void
RemoteSpan::__set_data (
const std::map<std::string, std::string> & val)
{
this->data = val;
}
const char* RemoteSpan::ascii_fingerprint =
"<KEY>CE7962363D25AEC46FDF";
const uint8_t RemoteSpan::binary_fingerprint[16] =
{ 0x22, 0xEA, 0x46, 0xE7, 0x38, 0xFD, 0xCE, 0x79, 0x62, 0x36, 0x3D,
0x25, 0xAE, 0xC4, 0x6F, 0xDF };
uint32_t
RemoteSpan::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->sender);
this->__isset.sender = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->svc);
this->__isset.svc = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->traceId);
this->__isset.traceId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->spanId);
this->__isset.spanId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->parentId);
this->__isset.parentId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->start);
this->__isset.start = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->stop);
this->__isset.stop = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->description);
this->__isset.description = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->data.clear ();
uint32_t _size0;
::apache::thrift::protocol::TType _ktype1;
::apache::thrift::protocol::TType _vtype2;
xfer += iprot->readMapBegin (_ktype1, _vtype2,
_size0);
uint32_t _i4;
for (_i4 = 0; _i4 < _size0; ++_i4)
{
std::string _key5;
xfer += iprot->readString (_key5);
std::string& _val6 = this->data[_key5];
xfer += iprot->readString (_val6);
}
xfer += iprot->readMapEnd ();
}
this->__isset.data = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
RemoteSpan::write (::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("RemoteSpan");
xfer += oprot->writeFieldBegin (
"sender", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->sender);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"svc", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->svc);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("traceId",
::apache::thrift::protocol::T_I64,
3);
xfer += oprot->writeI64 (this->traceId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("spanId",
::apache::thrift::protocol::T_I64,
4);
xfer += oprot->writeI64 (this->spanId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("parentId",
::apache::thrift::protocol::T_I64,
5);
xfer += oprot->writeI64 (this->parentId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("start",
::apache::thrift::protocol::T_I64,
6);
xfer += oprot->writeI64 (this->start);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("stop",
::apache::thrift::protocol::T_I64,
7);
xfer += oprot->writeI64 (this->stop);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"description", ::apache::thrift::protocol::T_STRING, 8);
xfer += oprot->writeString (this->description);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("data",
::apache::thrift::protocol::T_MAP,
9);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->data.size ()));
std::map<std::string, std::string>::const_iterator _iter7;
for (_iter7 = this->data.begin (); _iter7 != this->data.end ();
++_iter7)
{
xfer += oprot->writeString (_iter7->first);
xfer += oprot->writeString (_iter7->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (RemoteSpan &a, RemoteSpan &b)
{
using ::std::swap;
swap (a.sender, b.sender);
swap (a.svc, b.svc);
swap (a.traceId, b.traceId);
swap (a.spanId, b.spanId);
swap (a.parentId, b.parentId);
swap (a.start, b.start);
swap (a.stop, b.stop);
swap (a.description, b.description);
swap (a.data, b.data);
swap (a.__isset, b.__isset);
}
RemoteSpan::RemoteSpan (const RemoteSpan& other8)
{
sender = other8.sender;
svc = other8.svc;
traceId = other8.traceId;
spanId = other8.spanId;
parentId = other8.parentId;
start = other8.start;
stop = other8.stop;
description = other8.description;
data = other8.data;
__isset = other8.__isset;
}
RemoteSpan&
RemoteSpan::operator= (const RemoteSpan& other9)
{
sender = other9.sender;
svc = other9.svc;
traceId = other9.traceId;
spanId = other9.spanId;
parentId = other9.parentId;
start = other9.start;
stop = other9.stop;
description = other9.description;
data = other9.data;
__isset = other9.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const RemoteSpan& obj)
{
using ::apache::thrift::to_string;
out << "RemoteSpan(";
out << "sender=" << to_string (obj.sender);
out << ", " << "svc=" << to_string (obj.svc);
out << ", " << "traceId=" << to_string (obj.traceId);
out << ", " << "spanId=" << to_string (obj.spanId);
out << ", " << "parentId=" << to_string (obj.parentId);
out << ", " << "start=" << to_string (obj.start);
out << ", " << "stop=" << to_string (obj.stop);
out << ", " << "description=" << to_string (obj.description);
out << ", " << "data=" << to_string (obj.data);
out << ")";
return out;
}
TInfo::~TInfo () throw ()
{
}
void
TInfo::__set_traceId (const int64_t val)
{
this->traceId = val;
}
void
TInfo::__set_parentId (const int64_t val)
{
this->parentId = val;
}
const char* TInfo::ascii_fingerprint =
"F33135321253DAEB67B0E79E416CA831";
const uint8_t TInfo::binary_fingerprint[16] =
{ 0xF3, 0x31, 0x35, 0x32, 0x12, 0x53, 0xDA, 0xEB, 0x67, 0xB0, 0xE7,
0x9E, 0x41, 0x6C, 0xA8, 0x31 };
uint32_t
TInfo::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->traceId);
this->__isset.traceId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->parentId);
this->__isset.parentId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TInfo::write (::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TInfo");
xfer += oprot->writeFieldBegin ("traceId",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->traceId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("parentId",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->parentId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TInfo &a, TInfo &b)
{
using ::std::swap;
swap (a.traceId, b.traceId);
swap (a.parentId, b.parentId);
swap (a.__isset, b.__isset);
}
TInfo::TInfo (const TInfo& other10)
{
traceId = other10.traceId;
parentId = other10.parentId;
__isset = other10.__isset;
}
TInfo&
TInfo::operator= (const TInfo& other11)
{
traceId = other11.traceId;
parentId = other11.parentId;
__isset = other11.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TInfo& obj)
{
using ::apache::thrift::to_string;
out << "TInfo(";
out << "traceId=" << to_string (obj.traceId);
out << ", " << "parentId=" << to_string (obj.parentId);
out << ")";
return out;
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#include <iostream>
#include <algorithm>
#include <sstream>
using namespace std;
#include "../include/data/constructs/KeyValue.h"
#include "../include/data/constructs/security/Authorizations.h"
#include "../include/scanner/constructs/Results.h"
#include "../include/scanner/impl/Scanner.h"
#include "../include/writer/impl/SinkImpl.h"
#include "../include/data/constructs/client/zookeeperinstance.h"
#include "../include/interconnect/Master.h"
#include "../include/interconnect/tableOps/TableOperations.h"
#include "../include/interconnect/securityOps/SecurityOperations.h"
#include "../include/data/constructs/rfile/RFile.h"
#include "../include/data/constructs/compressor/compressor.h"
#include "../include/data/constructs/compressor/zlibCompressor.h"
#include "../include/data/streaming/HdfsStream.h"
#include <assert.h>
#define BOOST_IOSTREAMS_NO_LIB 1
using namespace cclient::data;
using namespace cclient::data::compression;
using namespace cclient::data::zookeeper;
using namespace cclient::data::streams;
using namespace interconnect;
using namespace scanners;
using namespace boost::iostreams;
bool
keyCompare (KeyValue* a, KeyValue* b)
{
return *(a->getKey ()) < *(b->getKey ());
}
std::pair<string, string>
writeRfile (string nameNode, uint16_t port)
{
struct hdfsBuilder *builder = hdfsNewBuilder ();
string dir = "/testImport/";
string fail = "/testImportFail/";
string path = dir;
path.append ("test.rf");
//set namenode address.
hdfsBuilderSetNameNode (builder, nameNode.c_str ());
//set namenode port.
hdfsBuilderSetNameNodePort (builder, port);
//connect to hdfs
hdfsFS fs = hdfsBuilderConnect (builder);
hdfsDelete (fs, dir.c_str (), 1);
if (hdfsCreateDirectory (fs, dir.c_str ()) == -1) {
cout << "Could not create directory " << dir << endl;
exit (1);
}
hdfsDelete (fs, fail.c_str (), 1);
if (hdfsCreateDirectory (fs, fail.c_str ()) == -1) {
cout << "Could not create directory " << fail << endl;
exit (1);
}
HdfsStream *stream = new HdfsStream (fs, path.c_str (), O_WRONLY | O_APPEND,
1024 * 5, 3, 1024 * 1024 * 1);
Compressor *compressor = new ZLibCompressor (256 * 1024);
BlockCompressedFile bcFile (compressor);
EndianTranslationStream *outStream = new EndianTranslationStream (stream);
RFile *newRFile = new RFile (outStream, &bcFile);
vector<KeyValue*> keyValues;
char rw[13], cf[3], cq[8], cv[8];
int i = 0;
string moto = "hello moto";
string vis = "00000001";
for (i = 1; i < 150; i++) {
Value *v = new Value (moto);
Key *k = new Key ();
string rowSt = "2";
memset (rw, 0x00, 13);
sprintf (rw, "bat");
k->setRow ((const char*) rw, 8);
sprintf (cf, "%03d", i);
k->setColFamily ((const char*) cf, 3);
sprintf (cq, "%08d", i);
sprintf (cv, "%08d", i);
k->setColQualifier ((const char*) cq, 8);
k->setColVisibility (vis.c_str (), vis.size ());
k->setTimeStamp (1445105294261L);
KeyValue *kv = new KeyValue ();
kv->setKey (k);
kv->setValue (v);
keyValues.push_back (kv);
}
std::sort (keyValues.begin (), keyValues.end (), keyCompare);
newRFile->addLocalityGroup ();
for (std::vector<KeyValue*>::iterator it = keyValues.begin ();
it != keyValues.end (); ++it) {
newRFile->append (*it);
}
newRFile->close ();
outStream->flush ();
stream->flush ();
delete outStream;
delete stream;
delete newRFile;
for (std::vector<KeyValue*>::iterator it = keyValues.begin ();
it != keyValues.end (); ++it) {
delete (*it)->getKey ();
delete (*it);
}
//free hdfs builder
hdfsFreeBuilder (builder);
dir = "/testImport/";
fail = "/testImportFail/";
stringstream nd;
nd << nameNode << ":" << port << dir;
path = nd.str();
stringstream faildir;
faildir << nameNode << ":" << port << fail;
fail = faildir.str();
return std::make_pair (path, fail);
}
int
main (int argc, char **argv)
{
if (argc < 5) {
cout << "Arguments required: ./ClientExample"
<< " <instance name> <zks> <user> <password>"
<< " <optional hdfsNN> <optional hdfsPort>" << endl;
exit (1);
}
string nameNode = "";
uint16_t nnPort = 0;
if (argc == 6) {
cout << "Arguments must contains namenode port" << endl;
exit (1);
} else if (argc == 7) {
nameNode = argv[5];
nnPort = atoi (argv[6]);
}
string table = "InsertTest";
Configuration conf;
conf.set ("FILE_SYSTEM_ROOT", "/accumulo");
ZookeeperInstance *instance = 0;
try{
instance = new ZookeeperInstance (argv[1], argv[2], 60*1000*1000,
&conf);
}catch(ClientException ce)
{
cout << "Could not connect to ZK. Error: " << ce.what() << endl;
return 1;
}
AuthInfo creds (argv[3], argv[4], instance->getInstanceId ());
interconnect::MasterConnect *master = 0;
try
{
master = new MasterConnect (&creds, instance);
}catch(ClientException ce)
{
cout << "Could not connect to Master. Error: " << ce.what() << endl;
return 1;
}
AccumuloTableOperations *ops = dynamic_cast<AccumuloTableOperations*>(master->tableOps (
table));
SecurityOperations *secOps = master->securityOps();
// create the table. no harm/no foul if it exists
cout << "Checking if " << table << " exists." << endl;
if (!ops->exists ()) {
cout << "Now, creating " << table << endl;
if (!ops->create ()) {
cout << "Could not create table " << endl;
}
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
}
set<string> tables = ops->listTables();
auto it = find (tables.begin(), tables.end(), table);
if (it == tables.end())
throw runtime_error("Could not find table");
for(auto table : tables)
{
cout << "Table : " << table << endl;
}
Authorizations auths;
uint64_t fruit_to_write = -1;
cout << "Writing " << fruit_to_write << " apples and bananas" << endl;
BatchWriter *sink = dynamic_cast<BatchWriter*>(ops->createWriter (&auths, 25));
map<string,string> tableOps = ops->getProperties();
if (tableOps["table.split.threshold"] != "1G")
{
cout << "Unknown default table configuration!!!" << endl;
}
ops->setProperty("table.split.threshold","15G");
tableOps = ops->getProperties();
if (tableOps["table.split.threshold"] != "15G")
{
cout << "Could not set table configuration" << endl;
ops->remove();
return 1;
}
else
{
cout << "Successfully set table.split.threshold to 1K " << endl;
}
uint64_t i =0;
while(true){
KeyValue *newKv = new KeyValue ();
Key *newKey = new Key ();
newKey->setRow ("a", 1);
newKey->setColFamily ("apple", 5);
stringstream cq;
cq << "banana" << i;
newKey->setColQualifier (cq.str ().c_str (), cq.str ().length ());
newKey->setTimeStamp(1445105294261L);
newKv->setKey (newKey,true);
Value *v = new Value();
newKv->setValue (v);
delete v;
sink->push (newKv);
i++;
}
cout << "wrote " << i << endl;
// close will free memory for objects given to it
sink->close ();
cout << "delete sink " << endl;
delete sink;
cout << "initiate flush " << endl;
if ( ((AccumuloTableOperations*)ops)->flush("a","z",true) ) {
cout << "flush successful " << endl;
}
else
cout << "flush unsuccessful" << endl;
ops->compact("a","z",true);
set<string> shplits;
shplits.insert("apple");
shplits.insert("banana");
ops->addSplits(shplits);
vector<string> splits = ops->listSplits();
for(string split : splits)
{
cout << "split " << split << endl;
}
cout << "Removing table" << endl;
//ops->remove ();
tables = ops->listTables();
it = find (tables.begin(), tables.end(), table);
for(auto table : tables)
{
cout << "Table : " << table << endl;
}
delete ops;
//assert(counter == fruit_to_write/2 );
delete master;
delete secOps;
delete instance;
return 0;
}
<file_sep>/*
* 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.
*/
#include <algorithm>
#include <map>
#include <string>
#include <set>
using namespace std;
#include <pthread.h>
#include "../../../include/scanner/impl/../Source.h"
#include "../../../include/scanner/impl/../../data/constructs/Key.h"
#include "../../../include/scanner/impl/../../data/constructs/security/AuthInfo.h"
#include "../../../include/scanner/impl/../../data/constructs/security/Authorizations.h"
#include "../../../include/scanner/impl/../../data/constructs/value.h"
#include "../../../include/scanner/impl/../constructs/Results.h"
#include "../../../include/scanner/impl/../../data/constructs/inputvalidation.h"
#include "../../../include/scanner/impl/../../data/client/ExtentLocator.h"
#include "../../../include/scanner/impl/../../data/constructs/client/zookeeperinstance.h"
#include "../../../include/scanner/impl/../../data/client/LocatorCache.h"
#include "../../../include/scanner/impl/../constructs/ServerHeuristic.h"
#include "../../../include/scanner/impl/../../interconnect/ClientInterface.h"
#include "../../../include/scanner/impl/../../interconnect/tableOps/TableOperations.h"
#include "../../../include/scanner/impl/Scanner.h"
namespace scanners
{
Scanner::Scanner (Instance *instance,
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *tops,
Authorizations *auths, uint16_t threads) :
scannerAuths (auths)
{
scannerHeuristic = new ScannerHeuristic (threads);
connectorInstance = dynamic_cast<ZookeeperInstance*> (instance);
resultSet = NULL;
tableLocator = cachedLocators.getLocator (
LocatorKey (connectorInstance, tops->getTableId ()));
credentials = tops->getCredentials ();
ranges = new vector<Range*> ();
}
}
<file_sep>/*
* 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.
*/
#ifndef SRC_WRITER_SINK_H_
#define SRC_WRITER_SINK_H_
#include <iostream>
#include <chrono>
#include <thread>
#include "../data/extern/concurrentqueue/concurrentqueue.h"
namespace writer
{
using namespace scanners;
template<class T>
class Sink
{
protected:
moodycamel::ConcurrentQueue<T> *sinkQueue;
virtual bool
exceedQueue ();
virtual bool
enqueue (T obj);
uint16_t queueSize;
volatile uint16_t currentSize = 0;
virtual uint64_t maxWait()
{
return 0;
}
virtual uint64_t waitingSize()
{
return 0;
}
public:
Sink (uint16_t maxQueue) :
queueSize (maxQueue)
{
sinkQueue = new moodycamel::ConcurrentQueue<T> (queueSize * 1.5);
}
virtual
~Sink ()
{
delete sinkQueue;
}
/**
* Method to put object onto the queue
* @param obj incoming object to push into the sink
*/
bool
push (T obj);
/**
* Flushes the sink
*/
virtual void
flush (bool override = false) = 0;
/**
* Closes the sink
*/
virtual void
close ()
{
flush (true);
}
inline virtual size_t
size ()
{
return sinkQueue->size_approx ();
}
};
/**
* Method to put object onto the queue
* @param obj incoming object to push into the sink
*/
template<typename T>
bool
Sink<T>::push (T obj)
{
while(waitingSize() >= ((maxWait()+1)*1.5)) {
std::cout << "waitingSize " << waitingSize() << " " << maxWait() << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
/**
* If enqueue r
*/
if (enqueue (obj) && exceedQueue ()) {
flush ();
}
return true;
}
/**
* Method to put object onto the queue
* @param obj incoming object to push into the sink
*/
template<typename T>
bool
Sink<T>::enqueue (T obj)
{
return sinkQueue->try_enqueue (obj);
}
/**
* Method to put object onto the queue
* @param obj incoming object to push into the sink
*/
template<typename T>
bool
Sink<T>::exceedQueue ()
{
if (size () > queueSize) {
return true;
}
return false;
}
} /* namespace writer */
#endif /* SRC_WRITER_SINK_H_ */
<file_sep>/*
* 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.
*/
#ifndef INSTANCE_H_
#define INSTANCE_H_
#include <memory>
#include <string>
#include <list>
#include <vector>
using namespace std;
#include "../security/AuthInfo.h"
#include "InstanceCache.h"
#include "../configuration/Configuration.h"
#include "../include/interconnect/transport/ServerConnection.h"
#include <string>
#include <list>
using namespace std;
namespace cclient {
namespace data {
using namespace cclient::impl;
using namespace cclient::data::security;
/**
* Instance represents a connecting object for the key value store
* Nearly all key value stores follow a root/worker paradigm.
* This class is meant to facilitate that paradigm.
*
**/
class Instance {
public:
Instance() {
}
/**
* Returns the controller
* @return root location
**/
virtual string getRootTabletLocation() = 0;
/**
* Returns the controller
* @return root location
**/
virtual vector<string> getMasterLocations() = 0;
/**
* Returns a list of server that will do work
* @return a vector of serverconnections
**/
virtual vector<interconnect::ServerConnection> getServers() = 0;
/**
* return instance ID
* @return instance ID
**/
virtual string getInstanceId() = 0;
/**
* Return instance namespace
* @return instance name
**/
virtual string getInstanceName() = 0;
/**
* Return link to instance instance cache
* @return instance cache
**/
virtual InstanceCache *getInstanceCache() =0;
/**
* Returns configuration
* @return configuration reference
**/
virtual const Configuration *getConfiguration() = 0;
/**
* Sets configuration object
* @param configuration object
**/
virtual void setConfiguration(std::unique_ptr<Configuration> conf) = 0;
/**
* Destructor
**/
virtual ~Instance() {
}
};
} /* namespace impl */
} /* namespace cclient */
#endif /* INSTANCE_H_ */
<file_sep>/*
* 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.
*/
#ifndef SERVERDEFINITION_H_
#define SERVERDEFINITION_H_
#include <iostream>
#include <string>
using namespace std;
#include "../security/AuthInfo.h"
#include "../security/Authorizations.h"
#include "../Range.h"
#include "../KeyExtent.h"
namespace cclient {
namespace data {
using namespace security;
namespace tserver {
class ServerDefinition {
public:
/**
* Constructor
* @param creds ptr to creds
* @param auths ptr to auths
* @param host host name we're connecting to
* @param port incoming port
*/
ServerDefinition(AuthInfo *creds, Authorizations *auths, string host,
uint32_t port);
// default to a port
~ServerDefinition();
AuthInfo *getCredentials();
Authorizations *getAuthorizations() const;
string getServer() const;
uint32_t getPort() const;
protected:
AuthInfo *credentials;
Authorizations *auths;
string server;
uint32_t port;
};
}
}
}
#endif /* SERVERDEFINITION_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/master_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace master
{
namespace thrift
{
int _kMasterStateValues[] =
{ MasterState::INITIAL, MasterState::HAVE_LOCK,
MasterState::SAFE_MODE, MasterState::NORMAL,
MasterState::UNLOAD_METADATA_TABLETS,
MasterState::UNLOAD_ROOT_TABLET, MasterState::STOP };
const char* _kMasterStateNames[] =
{ "INITIAL", "HAVE_LOCK", "SAFE_MODE", "NORMAL",
"UNLOAD_METADATA_TABLETS", "UNLOAD_ROOT_TABLET", "STOP" };
const std::map<int, const char*> _MasterState_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (7, _kMasterStateValues,
_kMasterStateNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kMasterGoalStateValues[] =
{ MasterGoalState::CLEAN_STOP, MasterGoalState::SAFE_MODE,
MasterGoalState::NORMAL };
const char* _kMasterGoalStateNames[] =
{ "CLEAN_STOP", "SAFE_MODE", "NORMAL" };
const std::map<int, const char*> _MasterGoalState_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (3, _kMasterGoalStateValues,
_kMasterGoalStateNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kTabletLoadStateValues[] =
{ TabletLoadState::LOADED, TabletLoadState::LOAD_FAILURE,
TabletLoadState::UNLOADED,
TabletLoadState::UNLOAD_FAILURE_NOT_SERVING,
TabletLoadState::UNLOAD_ERROR, TabletLoadState::CHOPPED };
const char* _kTabletLoadStateNames[] =
{ "LOADED", "LOAD_FAILURE", "UNLOADED",
"UNLOAD_FAILURE_NOT_SERVING", "UNLOAD_ERROR", "CHOPPED" };
const std::map<int, const char*> _TabletLoadState_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (6, _kTabletLoadStateValues,
_kTabletLoadStateNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
int _kFateOperationValues[] =
{ FateOperation::TABLE_CREATE, FateOperation::TABLE_CLONE,
FateOperation::TABLE_DELETE, FateOperation::TABLE_RENAME,
FateOperation::TABLE_ONLINE, FateOperation::TABLE_OFFLINE,
FateOperation::TABLE_MERGE, FateOperation::TABLE_DELETE_RANGE,
FateOperation::TABLE_BULK_IMPORT,
FateOperation::TABLE_COMPACT, FateOperation::TABLE_IMPORT,
FateOperation::TABLE_EXPORT,
FateOperation::TABLE_CANCEL_COMPACT,
FateOperation::NAMESPACE_CREATE,
FateOperation::NAMESPACE_DELETE,
FateOperation::NAMESPACE_RENAME };
const char* _kFateOperationNames[] =
{ "TABLE_CREATE", "TABLE_CLONE", "TABLE_DELETE", "TABLE_RENAME",
"TABLE_ONLINE", "TABLE_OFFLINE", "TABLE_MERGE",
"TABLE_DELETE_RANGE", "TABLE_BULK_IMPORT", "TABLE_COMPACT",
"TABLE_IMPORT", "TABLE_EXPORT", "TABLE_CANCEL_COMPACT",
"NAMESPACE_CREATE", "NAMESPACE_DELETE", "NAMESPACE_RENAME" };
const std::map<int, const char*> _FateOperation_VALUES_TO_NAMES (
::apache::thrift::TEnumIterator (16, _kFateOperationValues,
_kFateOperationNames),
::apache::thrift::TEnumIterator (-1, NULL, NULL));
Compacting::~Compacting () throw ()
{
}
void
Compacting::__set_running (const int32_t val)
{
this->running = val;
}
void
Compacting::__set_queued (const int32_t val)
{
this->queued = val;
}
const char* Compacting::ascii_fingerprint =
"989D1F1AE8D148D5E2119FFEC4BBBEE3";
const uint8_t Compacting::binary_fingerprint[16] =
{ 0x98, 0x9D, 0x1F, 0x1A, 0xE8, 0xD1, 0x48, 0xD5, 0xE2, 0x11,
0x9F, 0xFE, 0xC4, 0xBB, 0xBE, 0xE3 };
uint32_t
Compacting::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->running);
this->__isset.running = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->queued);
this->__isset.queued = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
Compacting::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("Compacting");
xfer += oprot->writeFieldBegin ("running",
::apache::thrift::protocol::T_I32,
1);
xfer += oprot->writeI32 (this->running);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("queued",
::apache::thrift::protocol::T_I32,
2);
xfer += oprot->writeI32 (this->queued);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (Compacting &a, Compacting &b)
{
using ::std::swap;
swap (a.running, b.running);
swap (a.queued, b.queued);
swap (a.__isset, b.__isset);
}
Compacting::Compacting (const Compacting& other0)
{
running = other0.running;
queued = other0.queued;
__isset = other0.__isset;
}
Compacting&
Compacting::operator= (const Compacting& other1)
{
running = other1.running;
queued = other1.queued;
__isset = other1.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const Compacting& obj)
{
using ::apache::thrift::to_string;
out << "Compacting(";
out << "running=" << to_string (obj.running);
out << ", " << "queued=" << to_string (obj.queued);
out << ")";
return out;
}
TableInfo::~TableInfo () throw ()
{
}
void
TableInfo::__set_recs (const int64_t val)
{
this->recs = val;
}
void
TableInfo::__set_recsInMemory (const int64_t val)
{
this->recsInMemory = val;
}
void
TableInfo::__set_tablets (const int32_t val)
{
this->tablets = val;
}
void
TableInfo::__set_onlineTablets (const int32_t val)
{
this->onlineTablets = val;
}
void
TableInfo::__set_ingestRate (const double val)
{
this->ingestRate = val;
}
void
TableInfo::__set_ingestByteRate (const double val)
{
this->ingestByteRate = val;
}
void
TableInfo::__set_queryRate (const double val)
{
this->queryRate = val;
}
void
TableInfo::__set_queryByteRate (const double val)
{
this->queryByteRate = val;
}
void
TableInfo::__set_minors (const Compacting& val)
{
this->minors = val;
}
void
TableInfo::__set_majors (const Compacting& val)
{
this->majors = val;
}
void
TableInfo::__set_scans (const Compacting& val)
{
this->scans = val;
}
void
TableInfo::__set_scanRate (const double val)
{
this->scanRate = val;
}
const char* TableInfo::ascii_fingerprint =
"D1B40B6CDBBA041D2E4F3215B5A7FF49";
const uint8_t TableInfo::binary_fingerprint[16] =
{ 0xD1, 0xB4, 0x0B, 0x6C, 0xDB, 0xBA, 0x04, 0x1D, 0x2E, 0x4F,
0x32, 0x15, 0xB5, 0xA7, 0xFF, 0x49 };
uint32_t
TableInfo::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->recs);
this->__isset.recs = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->recsInMemory);
this->__isset.recsInMemory = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->tablets);
this->__isset.tablets = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->onlineTablets);
this->__isset.onlineTablets = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->ingestRate);
this->__isset.ingestRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->ingestByteRate);
this->__isset.ingestByteRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->queryRate);
this->__isset.queryRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->queryByteRate);
this->__isset.queryByteRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->minors.read (iprot);
this->__isset.minors = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->majors.read (iprot);
this->__isset.majors = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->scans.read (iprot);
this->__isset.scans = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 12:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->scanRate);
this->__isset.scanRate = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TableInfo::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TableInfo");
xfer += oprot->writeFieldBegin ("recs",
::apache::thrift::protocol::T_I64,
1);
xfer += oprot->writeI64 (this->recs);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("recsInMemory",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->recsInMemory);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("tablets",
::apache::thrift::protocol::T_I32,
3);
xfer += oprot->writeI32 (this->tablets);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("onlineTablets",
::apache::thrift::protocol::T_I32,
4);
xfer += oprot->writeI32 (this->onlineTablets);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ingestRate", ::apache::thrift::protocol::T_DOUBLE, 5);
xfer += oprot->writeDouble (this->ingestRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"ingestByteRate", ::apache::thrift::protocol::T_DOUBLE, 6);
xfer += oprot->writeDouble (this->ingestByteRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"queryRate", ::apache::thrift::protocol::T_DOUBLE, 7);
xfer += oprot->writeDouble (this->queryRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"queryByteRate", ::apache::thrift::protocol::T_DOUBLE, 8);
xfer += oprot->writeDouble (this->queryByteRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"minors", ::apache::thrift::protocol::T_STRUCT, 9);
xfer += this->minors.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"majors", ::apache::thrift::protocol::T_STRUCT, 10);
xfer += this->majors.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"scans", ::apache::thrift::protocol::T_STRUCT, 11);
xfer += this->scans.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"scanRate", ::apache::thrift::protocol::T_DOUBLE, 12);
xfer += oprot->writeDouble (this->scanRate);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TableInfo &a, TableInfo &b)
{
using ::std::swap;
swap (a.recs, b.recs);
swap (a.recsInMemory, b.recsInMemory);
swap (a.tablets, b.tablets);
swap (a.onlineTablets, b.onlineTablets);
swap (a.ingestRate, b.ingestRate);
swap (a.ingestByteRate, b.ingestByteRate);
swap (a.queryRate, b.queryRate);
swap (a.queryByteRate, b.queryByteRate);
swap (a.minors, b.minors);
swap (a.majors, b.majors);
swap (a.scans, b.scans);
swap (a.scanRate, b.scanRate);
swap (a.__isset, b.__isset);
}
TableInfo::TableInfo (const TableInfo& other2)
{
recs = other2.recs;
recsInMemory = other2.recsInMemory;
tablets = other2.tablets;
onlineTablets = other2.onlineTablets;
ingestRate = other2.ingestRate;
ingestByteRate = other2.ingestByteRate;
queryRate = other2.queryRate;
queryByteRate = other2.queryByteRate;
minors = other2.minors;
majors = other2.majors;
scans = other2.scans;
scanRate = other2.scanRate;
__isset = other2.__isset;
}
TableInfo&
TableInfo::operator= (const TableInfo& other3)
{
recs = other3.recs;
recsInMemory = other3.recsInMemory;
tablets = other3.tablets;
onlineTablets = other3.onlineTablets;
ingestRate = other3.ingestRate;
ingestByteRate = other3.ingestByteRate;
queryRate = other3.queryRate;
queryByteRate = other3.queryByteRate;
minors = other3.minors;
majors = other3.majors;
scans = other3.scans;
scanRate = other3.scanRate;
__isset = other3.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TableInfo& obj)
{
using ::apache::thrift::to_string;
out << "TableInfo(";
out << "recs=" << to_string (obj.recs);
out << ", " << "recsInMemory=" << to_string (obj.recsInMemory);
out << ", " << "tablets=" << to_string (obj.tablets);
out << ", " << "onlineTablets=" << to_string (obj.onlineTablets);
out << ", " << "ingestRate=" << to_string (obj.ingestRate);
out << ", " << "ingestByteRate="
<< to_string (obj.ingestByteRate);
out << ", " << "queryRate=" << to_string (obj.queryRate);
out << ", " << "queryByteRate=" << to_string (obj.queryByteRate);
out << ", " << "minors=" << to_string (obj.minors);
out << ", " << "majors=" << to_string (obj.majors);
out << ", " << "scans=" << to_string (obj.scans);
out << ", " << "scanRate=" << to_string (obj.scanRate);
out << ")";
return out;
}
RecoveryStatus::~RecoveryStatus () throw ()
{
}
void
RecoveryStatus::__set_name (const std::string& val)
{
this->name = val;
}
void
RecoveryStatus::__set_runtime (const int32_t val)
{
this->runtime = val;
}
void
RecoveryStatus::__set_progress (const double val)
{
this->progress = val;
}
const char* RecoveryStatus::ascii_fingerprint =
"EDDD3E9D46980BDB38F82C7B45738053";
const uint8_t RecoveryStatus::binary_fingerprint[16] =
{ 0xED, 0xDD, 0x3E, 0x9D, 0x46, 0x98, 0x0B, 0xDB, 0x38, 0xF8,
0x2C, 0x7B, 0x45, 0x73, 0x80, 0x53 };
uint32_t
RecoveryStatus::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->name);
this->__isset.name = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->runtime);
this->__isset.runtime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->progress);
this->__isset.progress = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
RecoveryStatus::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("RecoveryStatus");
xfer += oprot->writeFieldBegin (
"name", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->name);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("runtime",
::apache::thrift::protocol::T_I32,
5);
xfer += oprot->writeI32 (this->runtime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"progress", ::apache::thrift::protocol::T_DOUBLE, 6);
xfer += oprot->writeDouble (this->progress);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (RecoveryStatus &a, RecoveryStatus &b)
{
using ::std::swap;
swap (a.name, b.name);
swap (a.runtime, b.runtime);
swap (a.progress, b.progress);
swap (a.__isset, b.__isset);
}
RecoveryStatus::RecoveryStatus (const RecoveryStatus& other4)
{
name = other4.name;
runtime = other4.runtime;
progress = other4.progress;
__isset = other4.__isset;
}
RecoveryStatus&
RecoveryStatus::operator= (const RecoveryStatus& other5)
{
name = other5.name;
runtime = other5.runtime;
progress = other5.progress;
__isset = other5.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const RecoveryStatus& obj)
{
using ::apache::thrift::to_string;
out << "RecoveryStatus(";
out << "name=" << to_string (obj.name);
out << ", " << "runtime=" << to_string (obj.runtime);
out << ", " << "progress=" << to_string (obj.progress);
out << ")";
return out;
}
TabletServerStatus::~TabletServerStatus () throw ()
{
}
void
TabletServerStatus::__set_tableMap (
const std::map<std::string, TableInfo> & val)
{
this->tableMap = val;
}
void
TabletServerStatus::__set_lastContact (const int64_t val)
{
this->lastContact = val;
}
void
TabletServerStatus::__set_name (const std::string& val)
{
this->name = val;
}
void
TabletServerStatus::__set_osLoad (const double val)
{
this->osLoad = val;
}
void
TabletServerStatus::__set_holdTime (const int64_t val)
{
this->holdTime = val;
}
void
TabletServerStatus::__set_lookups (const int64_t val)
{
this->lookups = val;
}
void
TabletServerStatus::__set_indexCacheHits (const int64_t val)
{
this->indexCacheHits = val;
}
void
TabletServerStatus::__set_indexCacheRequest (const int64_t val)
{
this->indexCacheRequest = val;
}
void
TabletServerStatus::__set_dataCacheHits (const int64_t val)
{
this->dataCacheHits = val;
}
void
TabletServerStatus::__set_dataCacheRequest (const int64_t val)
{
this->dataCacheRequest = val;
}
void
TabletServerStatus::__set_logSorts (
const std::vector<RecoveryStatus> & val)
{
this->logSorts = val;
}
const char* TabletServerStatus::ascii_fingerprint =
"DD8B6FED027FCEF184342CD2B4178461";
const uint8_t TabletServerStatus::binary_fingerprint[16] =
{ 0xDD, 0x8B, 0x6F, 0xED, 0x02, 0x7F, 0xCE, 0xF1, 0x84, 0x34,
0x2C, 0xD2, 0xB4, 0x17, 0x84, 0x61 };
uint32_t
TabletServerStatus::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->tableMap.clear ();
uint32_t _size6;
::apache::thrift::protocol::TType _ktype7;
::apache::thrift::protocol::TType _vtype8;
xfer += iprot->readMapBegin (_ktype7, _vtype8,
_size6);
uint32_t _i10;
for (_i10 = 0; _i10 < _size6; ++_i10)
{
std::string _key11;
xfer += iprot->readString (_key11);
TableInfo& _val12 = this->tableMap[_key11];
xfer += _val12.read (iprot);
}
xfer += iprot->readMapEnd ();
}
this->__isset.tableMap = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->lastContact);
this->__isset.lastContact = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->name);
this->__isset.name = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_DOUBLE)
{
xfer += iprot->readDouble (this->osLoad);
this->__isset.osLoad = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->holdTime);
this->__isset.holdTime = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->lookups);
this->__isset.lookups = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->indexCacheHits);
this->__isset.indexCacheHits = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->indexCacheRequest);
this->__isset.indexCacheRequest = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 12:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->dataCacheHits);
this->__isset.dataCacheHits = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 13:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->dataCacheRequest);
this->__isset.dataCacheRequest = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 14:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->logSorts.clear ();
uint32_t _size13;
::apache::thrift::protocol::TType _etype16;
xfer += iprot->readListBegin (_etype16, _size13);
this->logSorts.resize (_size13);
uint32_t _i17;
for (_i17 = 0; _i17 < _size13; ++_i17)
{
xfer += this->logSorts[_i17].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.logSorts = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletServerStatus::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TabletServerStatus");
xfer += oprot->writeFieldBegin ("tableMap",
::apache::thrift::protocol::T_MAP,
1);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->tableMap.size ()));
std::map<std::string, TableInfo>::const_iterator _iter18;
for (_iter18 = this->tableMap.begin ();
_iter18 != this->tableMap.end (); ++_iter18)
{
xfer += oprot->writeString (_iter18->first);
xfer += _iter18->second.write (oprot);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("lastContact",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->lastContact);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"name", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->name);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"osLoad", ::apache::thrift::protocol::T_DOUBLE, 5);
xfer += oprot->writeDouble (this->osLoad);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("holdTime",
::apache::thrift::protocol::T_I64,
7);
xfer += oprot->writeI64 (this->holdTime);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("lookups",
::apache::thrift::protocol::T_I64,
8);
xfer += oprot->writeI64 (this->lookups);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("indexCacheHits",
::apache::thrift::protocol::T_I64,
10);
xfer += oprot->writeI64 (this->indexCacheHits);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("indexCacheRequest",
::apache::thrift::protocol::T_I64,
11);
xfer += oprot->writeI64 (this->indexCacheRequest);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("dataCacheHits",
::apache::thrift::protocol::T_I64,
12);
xfer += oprot->writeI64 (this->dataCacheHits);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("dataCacheRequest",
::apache::thrift::protocol::T_I64,
13);
xfer += oprot->writeI64 (this->dataCacheRequest);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"logSorts", ::apache::thrift::protocol::T_LIST, 14);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->logSorts.size ()));
std::vector<RecoveryStatus>::const_iterator _iter19;
for (_iter19 = this->logSorts.begin ();
_iter19 != this->logSorts.end (); ++_iter19)
{
xfer += (*_iter19).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TabletServerStatus &a, TabletServerStatus &b)
{
using ::std::swap;
swap (a.tableMap, b.tableMap);
swap (a.lastContact, b.lastContact);
swap (a.name, b.name);
swap (a.osLoad, b.osLoad);
swap (a.holdTime, b.holdTime);
swap (a.lookups, b.lookups);
swap (a.indexCacheHits, b.indexCacheHits);
swap (a.indexCacheRequest, b.indexCacheRequest);
swap (a.dataCacheHits, b.dataCacheHits);
swap (a.dataCacheRequest, b.dataCacheRequest);
swap (a.logSorts, b.logSorts);
swap (a.__isset, b.__isset);
}
TabletServerStatus::TabletServerStatus (
const TabletServerStatus& other20)
{
tableMap = other20.tableMap;
lastContact = other20.lastContact;
name = other20.name;
osLoad = other20.osLoad;
holdTime = other20.holdTime;
lookups = other20.lookups;
indexCacheHits = other20.indexCacheHits;
indexCacheRequest = other20.indexCacheRequest;
dataCacheHits = other20.dataCacheHits;
dataCacheRequest = other20.dataCacheRequest;
logSorts = other20.logSorts;
__isset = other20.__isset;
}
TabletServerStatus&
TabletServerStatus::operator= (const TabletServerStatus& other21)
{
tableMap = other21.tableMap;
lastContact = other21.lastContact;
name = other21.name;
osLoad = other21.osLoad;
holdTime = other21.holdTime;
lookups = other21.lookups;
indexCacheHits = other21.indexCacheHits;
indexCacheRequest = other21.indexCacheRequest;
dataCacheHits = other21.dataCacheHits;
dataCacheRequest = other21.dataCacheRequest;
logSorts = other21.logSorts;
__isset = other21.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TabletServerStatus& obj)
{
using ::apache::thrift::to_string;
out << "TabletServerStatus(";
out << "tableMap=" << to_string (obj.tableMap);
out << ", " << "lastContact=" << to_string (obj.lastContact);
out << ", " << "name=" << to_string (obj.name);
out << ", " << "osLoad=" << to_string (obj.osLoad);
out << ", " << "holdTime=" << to_string (obj.holdTime);
out << ", " << "lookups=" << to_string (obj.lookups);
out << ", " << "indexCacheHits="
<< to_string (obj.indexCacheHits);
out << ", " << "indexCacheRequest="
<< to_string (obj.indexCacheRequest);
out << ", " << "dataCacheHits=" << to_string (obj.dataCacheHits);
out << ", " << "dataCacheRequest="
<< to_string (obj.dataCacheRequest);
out << ", " << "logSorts=" << to_string (obj.logSorts);
out << ")";
return out;
}
DeadServer::~DeadServer () throw ()
{
}
void
DeadServer::__set_server (const std::string& val)
{
this->server = val;
}
void
DeadServer::__set_lastStatus (const int64_t val)
{
this->lastStatus = val;
}
void
DeadServer::__set_status (const std::string& val)
{
this->status = val;
}
const char* DeadServer::ascii_fingerprint =
"FA35BEC6F4D26D79A7E0AD1366489BCC";
const uint8_t DeadServer::binary_fingerprint[16] =
{ 0xFA, 0x35, 0xBE, 0xC6, 0xF4, 0xD2, 0x6D, 0x79, 0xA7, 0xE0,
0xAD, 0x13, 0x66, 0x48, 0x9B, 0xCC };
uint32_t
DeadServer::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->server);
this->__isset.server = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64)
{
xfer += iprot->readI64 (this->lastStatus);
this->__isset.lastStatus = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->status);
this->__isset.status = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
DeadServer::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("DeadServer");
xfer += oprot->writeFieldBegin (
"server", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->server);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("lastStatus",
::apache::thrift::protocol::T_I64,
2);
xfer += oprot->writeI64 (this->lastStatus);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"status", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString (this->status);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (DeadServer &a, DeadServer &b)
{
using ::std::swap;
swap (a.server, b.server);
swap (a.lastStatus, b.lastStatus);
swap (a.status, b.status);
swap (a.__isset, b.__isset);
}
DeadServer::DeadServer (const DeadServer& other22)
{
server = other22.server;
lastStatus = other22.lastStatus;
status = other22.status;
__isset = other22.__isset;
}
DeadServer&
DeadServer::operator= (const DeadServer& other23)
{
server = other23.server;
lastStatus = other23.lastStatus;
status = other23.status;
__isset = other23.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const DeadServer& obj)
{
using ::apache::thrift::to_string;
out << "DeadServer(";
out << "server=" << to_string (obj.server);
out << ", " << "lastStatus=" << to_string (obj.lastStatus);
out << ", " << "status=" << to_string (obj.status);
out << ")";
return out;
}
MasterMonitorInfo::~MasterMonitorInfo () throw ()
{
}
void
MasterMonitorInfo::__set_tableMap (
const std::map<std::string, TableInfo> & val)
{
this->tableMap = val;
}
void
MasterMonitorInfo::__set_tServerInfo (
const std::vector<TabletServerStatus> & val)
{
this->tServerInfo = val;
}
void
MasterMonitorInfo::__set_badTServers (
const std::map<std::string, int8_t> & val)
{
this->badTServers = val;
}
void
MasterMonitorInfo::__set_state (const MasterState::type val)
{
this->state = val;
}
void
MasterMonitorInfo::__set_goalState (const MasterGoalState::type val)
{
this->goalState = val;
}
void
MasterMonitorInfo::__set_unassignedTablets (const int32_t val)
{
this->unassignedTablets = val;
}
void
MasterMonitorInfo::__set_serversShuttingDown (
const std::set<std::string> & val)
{
this->serversShuttingDown = val;
}
void
MasterMonitorInfo::__set_deadTabletServers (
const std::vector<DeadServer> & val)
{
this->deadTabletServers = val;
}
const char* MasterMonitorInfo::ascii_fingerprint =
"97129B4CC16BA8DA7D678FBCE0016340";
const uint8_t MasterMonitorInfo::binary_fingerprint[16] =
{ 0x97, 0x12, 0x9B, 0x4C, 0xC1, 0x6B, 0xA8, 0xDA, 0x7D, 0x67,
0x8F, 0xBC, 0xE0, 0x01, 0x63, 0x40 };
uint32_t
MasterMonitorInfo::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->tableMap.clear ();
uint32_t _size24;
::apache::thrift::protocol::TType _ktype25;
::apache::thrift::protocol::TType _vtype26;
xfer += iprot->readMapBegin (_ktype25, _vtype26,
_size24);
uint32_t _i28;
for (_i28 = 0; _i28 < _size24; ++_i28)
{
std::string _key29;
xfer += iprot->readString (_key29);
TableInfo& _val30 = this->tableMap[_key29];
xfer += _val30.read (iprot);
}
xfer += iprot->readMapEnd ();
}
this->__isset.tableMap = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->tServerInfo.clear ();
uint32_t _size31;
::apache::thrift::protocol::TType _etype34;
xfer += iprot->readListBegin (_etype34, _size31);
this->tServerInfo.resize (_size31);
uint32_t _i35;
for (_i35 = 0; _i35 < _size31; ++_i35)
{
xfer += this->tServerInfo[_i35].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.tServerInfo = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_MAP)
{
{
this->badTServers.clear ();
uint32_t _size36;
::apache::thrift::protocol::TType _ktype37;
::apache::thrift::protocol::TType _vtype38;
xfer += iprot->readMapBegin (_ktype37, _vtype38,
_size36);
uint32_t _i40;
for (_i40 = 0; _i40 < _size36; ++_i40)
{
std::string _key41;
xfer += iprot->readString (_key41);
int8_t& _val42 = this->badTServers[_key41];
xfer += iprot->readByte (_val42);
}
xfer += iprot->readMapEnd ();
}
this->__isset.badTServers = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast43;
xfer += iprot->readI32 (ecast43);
this->state = (MasterState::type) ecast43;
this->__isset.state = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_I32)
{
int32_t ecast44;
xfer += iprot->readI32 (ecast44);
this->goalState = (MasterGoalState::type) ecast44;
this->__isset.goalState = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I32)
{
xfer += iprot->readI32 (this->unassignedTablets);
this->__isset.unassignedTablets = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_SET)
{
{
this->serversShuttingDown.clear ();
uint32_t _size45;
::apache::thrift::protocol::TType _etype48;
xfer += iprot->readSetBegin (_etype48, _size45);
uint32_t _i49;
for (_i49 = 0; _i49 < _size45; ++_i49)
{
std::string _elem50;
xfer += iprot->readString (_elem50);
this->serversShuttingDown.insert (_elem50);
}
xfer += iprot->readSetEnd ();
}
this->__isset.serversShuttingDown = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->deadTabletServers.clear ();
uint32_t _size51;
::apache::thrift::protocol::TType _etype54;
xfer += iprot->readListBegin (_etype54, _size51);
this->deadTabletServers.resize (_size51);
uint32_t _i55;
for (_i55 = 0; _i55 < _size51; ++_i55)
{
xfer += this->deadTabletServers[_i55].read (
iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.deadTabletServers = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
MasterMonitorInfo::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("MasterMonitorInfo");
xfer += oprot->writeFieldBegin ("tableMap",
::apache::thrift::protocol::T_MAP,
1);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->tableMap.size ()));
std::map<std::string, TableInfo>::const_iterator _iter56;
for (_iter56 = this->tableMap.begin ();
_iter56 != this->tableMap.end (); ++_iter56)
{
xfer += oprot->writeString (_iter56->first);
xfer += _iter56->second.write (oprot);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tServerInfo", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->tServerInfo.size ()));
std::vector<TabletServerStatus>::const_iterator _iter57;
for (_iter57 = this->tServerInfo.begin ();
_iter57 != this->tServerInfo.end (); ++_iter57)
{
xfer += (*_iter57).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("badTServers",
::apache::thrift::protocol::T_MAP,
3);
{
xfer += oprot->writeMapBegin (
::apache::thrift::protocol::T_STRING,
::apache::thrift::protocol::T_BYTE,
static_cast<uint32_t> (this->badTServers.size ()));
std::map<std::string, int8_t>::const_iterator _iter58;
for (_iter58 = this->badTServers.begin ();
_iter58 != this->badTServers.end (); ++_iter58)
{
xfer += oprot->writeString (_iter58->first);
xfer += oprot->writeByte (_iter58->second);
}
xfer += oprot->writeMapEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("state",
::apache::thrift::protocol::T_I32,
6);
xfer += oprot->writeI32 ((int32_t) this->state);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("unassignedTablets",
::apache::thrift::protocol::T_I32,
7);
xfer += oprot->writeI32 (this->unassignedTablets);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("goalState",
::apache::thrift::protocol::T_I32,
8);
xfer += oprot->writeI32 ((int32_t) this->goalState);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin ("serversShuttingDown",
::apache::thrift::protocol::T_SET,
9);
{
xfer +=
oprot->writeSetBegin (
::apache::thrift::protocol::T_STRING,
static_cast<uint32_t> (this->serversShuttingDown.size ()));
std::set<std::string>::const_iterator _iter59;
for (_iter59 = this->serversShuttingDown.begin ();
_iter59 != this->serversShuttingDown.end (); ++_iter59)
{
xfer += oprot->writeString ((*_iter59));
}
xfer += oprot->writeSetEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"deadTabletServers", ::apache::thrift::protocol::T_LIST, 10);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->deadTabletServers.size ()));
std::vector<DeadServer>::const_iterator _iter60;
for (_iter60 = this->deadTabletServers.begin ();
_iter60 != this->deadTabletServers.end (); ++_iter60)
{
xfer += (*_iter60).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (MasterMonitorInfo &a, MasterMonitorInfo &b)
{
using ::std::swap;
swap (a.tableMap, b.tableMap);
swap (a.tServerInfo, b.tServerInfo);
swap (a.badTServers, b.badTServers);
swap (a.state, b.state);
swap (a.goalState, b.goalState);
swap (a.unassignedTablets, b.unassignedTablets);
swap (a.serversShuttingDown, b.serversShuttingDown);
swap (a.deadTabletServers, b.deadTabletServers);
swap (a.__isset, b.__isset);
}
MasterMonitorInfo::MasterMonitorInfo (
const MasterMonitorInfo& other61)
{
tableMap = other61.tableMap;
tServerInfo = other61.tServerInfo;
badTServers = other61.badTServers;
state = other61.state;
goalState = other61.goalState;
unassignedTablets = other61.unassignedTablets;
serversShuttingDown = other61.serversShuttingDown;
deadTabletServers = other61.deadTabletServers;
__isset = other61.__isset;
}
MasterMonitorInfo&
MasterMonitorInfo::operator= (const MasterMonitorInfo& other62)
{
tableMap = other62.tableMap;
tServerInfo = other62.tServerInfo;
badTServers = other62.badTServers;
state = other62.state;
goalState = other62.goalState;
unassignedTablets = other62.unassignedTablets;
serversShuttingDown = other62.serversShuttingDown;
deadTabletServers = other62.deadTabletServers;
__isset = other62.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const MasterMonitorInfo& obj)
{
using ::apache::thrift::to_string;
out << "MasterMonitorInfo(";
out << "tableMap=" << to_string (obj.tableMap);
out << ", " << "tServerInfo=" << to_string (obj.tServerInfo);
out << ", " << "badTServers=" << to_string (obj.badTServers);
out << ", " << "state=" << to_string (obj.state);
out << ", " << "goalState=" << to_string (obj.goalState);
out << ", " << "unassignedTablets="
<< to_string (obj.unassignedTablets);
out << ", " << "serversShuttingDown="
<< to_string (obj.serversShuttingDown);
out << ", " << "deadTabletServers="
<< to_string (obj.deadTabletServers);
out << ")";
return out;
}
TabletSplit::~TabletSplit () throw ()
{
}
void
TabletSplit::__set_oldTablet (
const ::org::apache::accumulo::core::data::thrift::TKeyExtent& val)
{
this->oldTablet = val;
}
void
TabletSplit::__set_newTablets (
const std::vector<
::org::apache::accumulo::core::data::thrift::TKeyExtent> & val)
{
this->newTablets = val;
}
const char* TabletSplit::ascii_fingerprint =
"512446FDB691C6A2252369D371A5BDE9";
const uint8_t TabletSplit::binary_fingerprint[16] =
{ 0x51, 0x24, 0x46, 0xFD, 0xB6, 0x91, 0xC6, 0xA2, 0x25, 0x23,
0x69, 0xD3, 0x71, 0xA5, 0xBD, 0xE9 };
uint32_t
TabletSplit::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT)
{
xfer += this->oldTablet.read (iprot);
this->__isset.oldTablet = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST)
{
{
this->newTablets.clear ();
uint32_t _size63;
::apache::thrift::protocol::TType _etype66;
xfer += iprot->readListBegin (_etype66, _size63);
this->newTablets.resize (_size63);
uint32_t _i67;
for (_i67 = 0; _i67 < _size63; ++_i67)
{
xfer += this->newTablets[_i67].read (iprot);
}
xfer += iprot->readListEnd ();
}
this->__isset.newTablets = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TabletSplit::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TabletSplit");
xfer += oprot->writeFieldBegin (
"oldTablet", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->oldTablet.write (oprot);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"newTablets", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin (
::apache::thrift::protocol::T_STRUCT,
static_cast<uint32_t> (this->newTablets.size ()));
std::vector<
::org::apache::accumulo::core::data::thrift::TKeyExtent>::const_iterator _iter68;
for (_iter68 = this->newTablets.begin ();
_iter68 != this->newTablets.end (); ++_iter68)
{
xfer += (*_iter68).write (oprot);
}
xfer += oprot->writeListEnd ();
}
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TabletSplit &a, TabletSplit &b)
{
using ::std::swap;
swap (a.oldTablet, b.oldTablet);
swap (a.newTablets, b.newTablets);
swap (a.__isset, b.__isset);
}
TabletSplit::TabletSplit (const TabletSplit& other69)
{
oldTablet = other69.oldTablet;
newTablets = other69.newTablets;
__isset = other69.__isset;
}
TabletSplit&
TabletSplit::operator= (const TabletSplit& other70)
{
oldTablet = other70.oldTablet;
newTablets = other70.newTablets;
__isset = other70.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TabletSplit& obj)
{
using ::apache::thrift::to_string;
out << "TabletSplit(";
out << "oldTablet=" << to_string (obj.oldTablet);
out << ", " << "newTablets=" << to_string (obj.newTablets);
out << ")";
return out;
}
RecoveryException::~RecoveryException () throw ()
{
}
void
RecoveryException::__set_why (const std::string& val)
{
this->why = val;
}
const char* RecoveryException::ascii_fingerprint =
"EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t RecoveryException::binary_fingerprint[16] =
{ 0xEF, 0xB9, 0x29, 0x59, 0x5D, 0x31, 0x2A, 0xC8, 0xF3, 0x05,
0xD5, 0xA7, 0x94, 0xCF, 0xED, 0xA1 };
uint32_t
RecoveryException::read (
::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->why);
this->__isset.why = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
RecoveryException::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("RecoveryException");
xfer += oprot->writeFieldBegin (
"why", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->why);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (RecoveryException &a, RecoveryException &b)
{
using ::std::swap;
swap (a.why, b.why);
swap (a.__isset, b.__isset);
}
RecoveryException::RecoveryException (
const RecoveryException& other71) :
TException ()
{
why = other71.why;
__isset = other71.__isset;
}
RecoveryException&
RecoveryException::operator= (const RecoveryException& other72)
{
why = other72.why;
__isset = other72.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const RecoveryException& obj)
{
using ::apache::thrift::to_string;
out << "RecoveryException(";
out << "why=" << to_string (obj.why);
out << ")";
return out;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#ifndef RANGE_H_
#define RANGE_H_
#include "../exceptions/IllegalArgumentException.h"
#include "Key.h"
namespace cclient {
namespace data {
using namespace cclient::exceptions;
class Range {
public:
Range();
Range(Key *startKey, bool startInclusive, Key *endKey, bool endKeyInclusive);
Key *getStartKey()
{
return start;
}
Key *getStopKey()
{
return stop;
}
bool getStartKeyInclusive()
{
return startKeyInclusive;
}
bool getStopKeyInclusive()
{
return stopKeyInclusive;
}
bool getInfiniteStartKey()
{
return infiniteStartKey;
}
bool getInfiniteStopKey()
{
return infiniteStopKey;
}
virtual ~Range();
protected:
Key *start;
Key *stop;
bool startKeyInclusive;
bool stopKeyInclusive;
bool infiniteStartKey;
bool infiniteStopKey;
};
} /* namespace data */
} /* namespace cclient */
#endif /* RANGE_H_ */
<file_sep>/*
* 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.
*/
#include <iostream>
#include <sstream>
using namespace std;
#include "../../include/extern/../data/constructs/KeyValue.h"
#include "../../include/extern/../data/constructs/security/Authorizations.h"
#include "../../include/extern/../scanner/constructs/Results.h"
#include "../../include/extern/../scanner/impl/Scanner.h"
#include "../../include/extern/../data/constructs/client/zookeeperinstance.h"
#include "../../include/extern/../interconnect/Master.h"
#include "../../include/extern/../interconnect/tableOps/TableOperations.h"
#include "../../include/extern/../data/constructs/rfile/RFile.h"
#include "../../include/extern/../data/constructs/compressor/compressor.h"
#include "../../include/extern/../data/constructs/compressor/zlibCompressor.h"
#include "../../include/extern/../data/streaming/HdfsStream.h"
#include "../../include/extern/accumulo.h"
using namespace cclient::data;
using namespace cclient::data::compression;
using namespace cclient::data::zookeeper;
using namespace cclient::data::streams;
using namespace interconnect;
using namespace scanners;
extern "C"
{
struct connector *
create_connector (char *instance, char *zks, char *username, char *password)
{
Configuration conf;
conf.set ("FILE_SYSTEM_ROOT", "/accumulo");
ZookeeperInstance *instPtr = new ZookeeperInstance (string (instance),
string (zks), 1000,
&conf);
struct connector *con = new connector ();
con->zk = instPtr;
AuthInfo creds (string (username), string (password),
instPtr->getInstanceId ());
interconnect::MasterConnect *master = new MasterConnect (&creds, instPtr);
con->masterPtr = master;
return con;
}
int
free_connector (struct connector *connector)
{
ZookeeperInstance *instPtr = static_cast<ZookeeperInstance*> (connector->zk);
delete instPtr;
interconnect::MasterConnect *master =
static_cast<interconnect::MasterConnect*> (connector->masterPtr);
delete master;
delete connector;
return 0;
}
TableOps *
open_table (struct connector *connector, char *tableName)
{
struct TableOps *tableOps = new TableOps ();
interconnect::MasterConnect *master =
static_cast<interconnect::MasterConnect*> (connector->masterPtr);
TableOperations<KeyValue*, ResultBlock<KeyValue*>> *ops = master->tableOps (
tableName);
tableOps->tableOpsPtr = ops;
tableOps->table_name = tableName;
return tableOps;
}
struct TableOps *
create_table (struct connector *connector, char *tableName)
{
struct TableOps *tableOps = open_table (connector, tableName);
AccumuloTableOperations *tableOpsCpp =
static_cast<AccumuloTableOperations*> (tableOps->tableOpsPtr);
tableOpsCpp->create (true);
return tableOps;
}
int
free_table (struct TableOps *tableOps)
{
if (NULL != tableOps->tableOpsPtr)
{
AccumuloTableOperations *tableOpsCpp =
static_cast<AccumuloTableOperations*> (tableOps->tableOpsPtr);
delete tableOps;
}
delete tableOps;
return 1;
}
}
<file_sep>/*
* 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.
*/
#include "../../../../include/data/extern/thrift/security_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace org
{
namespace apache
{
namespace accumulo
{
namespace core
{
namespace security
{
namespace thrift
{
TCredentials::~TCredentials () throw ()
{
}
void
TCredentials::__set_principal (const std::string& val)
{
this->principal = val;
}
void
TCredentials::__set_tokenClassName (const std::string& val)
{
this->tokenClassName = val;
}
void
TCredentials::__set_token (const std::string& val)
{
this->token = val;
}
void
TCredentials::__set_instanceId (const std::string& val)
{
this->instanceId = val;
}
const char* TCredentials::ascii_fingerprint =
"<KEY>";
const uint8_t TCredentials::binary_fingerprint[16] =
{ 0xC9, 0x3D, 0x89, 0x03, 0x11, 0xF2, 0x88, 0x44, 0x16, 0x6C,
0xF6, 0xE5, 0x71, 0xEB, 0x3A, 0xC2 };
uint32_t
TCredentials::read (::apache::thrift::protocol::TProtocol* iprot)
{
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin (fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin (fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP)
{
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->principal);
this->__isset.principal = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->tokenClassName);
this->__isset.tokenClassName = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readBinary (this->token);
this->__isset.token = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING)
{
xfer += iprot->readString (this->instanceId);
this->__isset.instanceId = true;
}
else
{
xfer += iprot->skip (ftype);
}
break;
default:
xfer += iprot->skip (ftype);
break;
}
xfer += iprot->readFieldEnd ();
}
xfer += iprot->readStructEnd ();
return xfer;
}
uint32_t
TCredentials::write (
::apache::thrift::protocol::TProtocol* oprot) const
{
uint32_t xfer = 0;
oprot->incrementRecursionDepth ();
xfer += oprot->writeStructBegin ("TCredentials");
xfer += oprot->writeFieldBegin (
"principal", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString (this->principal);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"tokenClassName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString (this->tokenClassName);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"token", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary (this->token);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldBegin (
"instanceId", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString (this->instanceId);
xfer += oprot->writeFieldEnd ();
xfer += oprot->writeFieldStop ();
xfer += oprot->writeStructEnd ();
oprot->decrementRecursionDepth ();
return xfer;
}
void
swap (TCredentials &a, TCredentials &b)
{
using ::std::swap;
swap (a.principal, b.principal);
swap (a.tokenClassName, b.tokenClassName);
swap (a.token, b.token);
swap (a.instanceId, b.instanceId);
swap (a.__isset, b.__isset);
}
TCredentials::TCredentials (const TCredentials& other0)
{
principal = other0.principal;
tokenClassName = other0.tokenClassName;
token = other0.token;
instanceId = other0.instanceId;
__isset = other0.__isset;
}
TCredentials&
TCredentials::operator= (const TCredentials& other1)
{
principal = other1.principal;
tokenClassName = other1.tokenClassName;
token = other1.token;
instanceId = other1.instanceId;
__isset = other1.__isset;
return *this;
}
std::ostream&
operator<< (std::ostream& out, const TCredentials& obj)
{
using ::apache::thrift::to_string;
out << "TCredentials(";
out << "principal=" << to_string (obj.principal);
out << ", " << "tokenClassName="
<< to_string (obj.tokenClassName);
out << ", " << "token=" << to_string (obj.token);
out << ", " << "instanceId=" << to_string (obj.instanceId);
out << ")";
return out;
}
}
}
}
}
}
} // namespace
<file_sep>/*
* 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.
*/
#include "../../../../../include/data/constructs/rfile/bcfile/BlockRegion.h"
using namespace cclient::data;
using namespace cclient::data::streams;
uint64_t
BlockRegion::read (InputStream *in)
{
offset = in->readHadoopLong ();
compressedSize = in->readHadoopLong ();
rawSize = in->readHadoopLong ();
cout << "offset is " << offset << " compressedSize is " << compressedSize << " rawSize is " << rawSize << " position is " << in->getPos() << endl;
return in->getPos ();
}
uint64_t
BlockRegion::write (OutputStream *out)
{
/*if (compressor != NULL)
{
// only set these values if the compressor isn't null
// otherwise take what we have.
setOffset( compressor->getStreamOffset() );
setCompressedSize(compressor->getCompressedSize());
setRawSize(compressor->bytesWritten());
}*/
out->writeEncodedLong (offset);
out->writeEncodedLong (compressedSize);
uint64_t pos = out->writeEncodedLong(rawSize);
cout << "offset is " << offset << " compressedSize is " << compressedSize << " rawSize is " << rawSize << " position is " << pos << endl;
return pos;
}
<file_sep>/*
* 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.
*/
#ifndef SRC_WRITER_IMPL_WRITERHEURISTIC_H_
#define SRC_WRITER_IMPL_WRITERHEURISTIC_H_
#include <pthread.h>
#include "../../scanner/constructs/Heuristic.h"
#include "../../data/constructs/server/ServerDefinition.h"
#include "../../data/extern/concurrentqueue/concurrentqueue.h"
#include "../SinkConditionals.h"
#include "../../interconnect/TabletServer.h"
namespace writer {
using namespace interconnect;
using namespace scanners;
using namespace cclient::data::tserver;
struct WritePair {
//ServerInterconnect *interconnect;
ServerDefinition *rangeDef;
const Configuration *conf;
TabletServerMutations *mutations;
};
/*
*
*/
class WriterHeuristic: public Heuristic<interconnect::ThriftTransporter> {
public:
WriterHeuristic(short numThreads = 10);
/**
* Add a server interconnect
*/
void addClientInterface(
ClientInterface<interconnect::ThriftTransporter> *serverIfc) {
pthread_mutex_lock(&serverLock);
Heuristic::addClientInterface(serverIfc);
pthread_mutex_unlock(&serverLock);
}
uint16_t write(//ServerInterconnect *interConnect,
ServerDefinition *rangeDef,
const Configuration *conf,
TabletServerMutations *mutations) {
if (!started) {
pthread_mutex_lock(&serverLock);
if (!started) {
for (int i = 0; i < threadCount; i++) {
pthread_create(&threads[i], NULL, write_thrift,
(void*) this);
}
}
started = true;
pthread_mutex_unlock(&serverLock);
}
WritePair *pair = new WritePair;
//pair->interconnect = interConnect;
pair->conf = conf;
pair->rangeDef = rangeDef;
pair->mutations = mutations;
while(!queue->try_enqueue(pair))
{
if (!conditionals->isAlive())
throw runtime_error("Closed during write");
}
conditionals->awakeThreadsForResults();
return queue->size_approx();
}
void close() {
pthread_mutex_lock(&serverLock);
if (threads == NULL)
{
pthread_mutex_unlock(&serverLock);
return;
}
closed = true;
if (started)
{
conditionals->awakeThreadsFinished();
for (int i = 0; i < threadCount; i++) {
pthread_join(threads[i], NULL);
}
}
conditionals->close();
delete[] threads;
threads = NULL;
pthread_mutex_unlock(&serverLock);
}
uint64_t maxThreads()
{
return threadCount;
}
uint64_t size()
{
return queue->size_approx();
}
virtual ~WriterHeuristic();
protected:
static void *write_thrift(void *ptr) {
WriterHeuristic *heuristic = static_cast<WriterHeuristic*>(ptr);
WritePair *pair = NULL;
do {
pair = heuristic->next();
if (NULL != pair) {
ServerInterconnect *conn=
new interconnect::ServerInterconnect (
pair->rangeDef, pair->conf);
if (NULL != conn) {
conn->write(pair->mutations);
delete pair->rangeDef;
delete pair->mutations;
delete conn;
}
delete pair;
} else {
break;
}
} while (NULL != pair);
return 0;
}
virtual WritePair *next() {
WritePair *pair = NULL;
if (!conditionals->isAlive())
{
return pair;
}
do {
if (!queue->try_dequeue(pair)) {
conditionals->waitForResults();
if (queue->try_dequeue(pair)) {
break;
}
if (conditionals->isClosing()) {
return NULL;
}
}
else
{
break;
}
} while (conditionals->isAlive());
return pair;
}
volatile bool started;
moodycamel::ConcurrentQueue<WritePair*> *queue;
private:
SinkConditions *conditionals;
pthread_mutex_t serverLock = PTHREAD_MUTEX_INITIALIZER;
pthread_t *threads;
uint16_t threadCount;
volatile bool closed;
}
;
} /* namespace data */
#endif /* SRC_WRITER_IMPL_WRITERHEURISTIC_H_ */
<file_sep>/*
* 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.
*/
#ifndef UTIL_BTREE_SAFE_BTREE_SET_H__
#define UTIL_BTREE_SAFE_BTREE_SET_H__
#include <functional>
#include <memory>
#include "btree_container.h"
#include "btree_set.h"
#include "safe_btree.h"
namespace btree
{
// The safe_btree_set class is needed mainly for its constructors.
template<typename Key, typename Compare = std::less<Key>,
typename Alloc = std::allocator<Key>, int TargetNodeSize = 256>
class safe_btree_set : public btree_unique_container<
safe_btree<btree_set_params<Key, Compare, Alloc, TargetNodeSize> > >
{
typedef safe_btree_set<Key, Compare, Alloc, TargetNodeSize> self_type;
typedef btree_set_params<Key, Compare, Alloc, TargetNodeSize> params_type;
typedef safe_btree<params_type> btree_type;
typedef btree_unique_container<btree_type> super_type;
public:
typedef typename btree_type::key_compare key_compare;
typedef typename btree_type::allocator_type allocator_type;
public:
// Default constructor.
safe_btree_set (const key_compare &comp = key_compare (),
const allocator_type &alloc = allocator_type ()) :
super_type (comp, alloc)
{
}
// Copy constructor.
safe_btree_set (const self_type &x) :
super_type (x)
{
}
// Range constructor.
template<class InputIterator>
safe_btree_set (InputIterator b, InputIterator e,
const key_compare &comp = key_compare (),
const allocator_type &alloc = allocator_type ()) :
super_type (b, e, comp, alloc)
{
}
};
template<typename K, typename C, typename A, int N>
inline void
swap (safe_btree_set<K, C, A, N> &x, safe_btree_set<K, C, A, N> &y)
{
x.swap (y);
}
} // namespace btree
#endif // UTIL_BTREE_SAFE_BTREE_SET_H__
<file_sep>/*
* 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.
*/
#ifndef TABLETLOCATIONOBTAINER_H_
#define TABLETLOCATIONOBTAINER_H_
#include <list>
#include <iostream>
#include <map>
#include <string>
using namespace std;
#include "../constructs/KeyExtent.h"
#include "../constructs/Key.h"
#include "../constructs/KeyValue.h"
#include "../constructs/value.h"
#include "../constructs/Range.h"
#include "../streaming/input/InputStream.h"
#include "ExtentLocator.h"
#include "TabletLocation.h"
namespace cclient {
namespace impl {
using namespace cclient::data;
using namespace cclient::data::streams;
class TabletLocationObtainer {
public:
TabletLocationObtainer();
virtual ~TabletLocationObtainer();
virtual list<TabletLocation*> findTablet(AuthInfo *credentials, TabletLocation *source, string row,
string stopRow, TabletLocator *parent) = 0;
virtual list<TabletLocation*> findTablet(AuthInfo *credentials, string tabletserver,
map<KeyExtent, list<Range> > *map, TabletLocator *parent) = 0;
protected:
inline std::pair<uint32_t, uint8_t*> readByteArray(InputStream *stream);
map<Key*, Value*,pointer_comparator<Key*>> decodeResults(vector<KeyValue*> *results);
};
} /* namespace data */
} /* namespace cclient */
#endif /* TABLETLOCATIONOBTAINER_H_ */
<file_sep>/*
* 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.
*/
#include "../../../../include/data/constructs/client/TabletServerMutations.h"
namespace cclient
{
namespace data
{
TabletServerMutations::TabletServerMutations (string sessionId) :
session (sessionId)
{
mutations = new map<KeyExtent*, vector<Mutation*>> ();
}
TabletServerMutations::~TabletServerMutations ()
{
for (map<KeyExtent*, vector<Mutation*>>::iterator it =
mutations->begin (); it != mutations->end (); it++)
{
delete it->first;
for (auto mutation : it->second)
{
delete mutation;
}
}
delete mutations;
}
} /* namespace data */
} /* namespace cclient */
| c8bcf9ffb780c9911ce6a6548762cddfe025a46a | [
"Markdown",
"C",
"C++"
] | 58 | C++ | mjwall/Apeirogon | a483da5dd942d3651922ef973a7ca62ff35187fe | 658f3951f273c163748a00f8e21457660ff6e918 |
refs/heads/master | <repo_name>janeenscott/2.4-sk8<file_sep>/app.py
from flask import Flask
from flask import request
from flask import render_template
import requests
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
#********** from planets demo
#need to switch planet api info info form
# @app.route("/")
# def index():
# response = requests.get('https://swapi.co/api/planets/')
#
# planets = data['results']
#
# # return render_template('index.html', planet_list=planets)
@app.route('/thank-you/', methods=['GET', 'POST'])
# configured to accept POST requests, so we can access for data (name and email) as a dictionary
def thank_you():
print(request.form[''])
return 'Thank you!'
| f2eeeafd04441a539fe50901fafd0cf7437d4a2d | [
"Python"
] | 1 | Python | janeenscott/2.4-sk8 | f6bb47f7b7c16f79c3cac938efdaaf8790d7adbc | e38f212c1c516c61810c96408b5b1e6f85896940 |
refs/heads/master | <repo_name>dohd2201/classroom-management<file_sep>/src/components/registerForm/ConvertData.js
// convet 1 -> 01
const convertNum = (num) => (num > 0 && num < 10 ? `0${num}` : `${num}`);
// convert birthday to YYYY-MM-DD
const convertBirthday = (time) => {
const t = new Date(time);
const d = t.getDate();
const m = t.getMonth() + 1;
const y = t.getFullYear();
return `${y}-${convertNum(m)}-${convertNum(d)}`;
};
// Convert data in form to create data
export const ConvertDataToCreateUser = (data) => {
const {
fullName,
gender,
birthday,
CCCD,
university,
majors,
skills,
phone,
email,
facebook,
province,
district,
ward,
detail,
} = data;
const convertedData = {
fullName,
gender,
birthday: convertBirthday(birthday),
CCCD,
university,
majors,
skills,
phone,
address: {
province,
district,
ward,
detail,
},
email,
facebook,
};
return convertedData;
};
// get province id and district id by name
export const getID = (arr, name) => {
let id;
for (let i = 0; i < arr.length; i++) {
if (arr[i].name === name) {
id = arr[i].id;
}
}
return id;
};
// Convert data in form to data used to update userInfo
export const ConvertDataToUpdateUserInfo = (data) => {
const { fullName, gender, birthday, CCCD, university, majors, skills } = data;
const convertedData = {
fullName,
gender,
birthday: convertBirthday(birthday),
CCCD,
university,
majors,
skills,
};
return convertedData;
};
// Convert data in form to data used to update userContact
export const ConvertDataToUpdateUserContact = (data) => {
const { phone, email, facebook, province, district, ward, detail } = data;
const convertedData = {
phone,
address: {
province,
district,
ward,
detail,
},
email,
facebook,
};
return convertedData;
};
<file_sep>/backend/src/address/address.model.ts
'use strict';
import { AddressNS } from "./address";
import { Db } from "mongodb";
import { FromMongoMany , FromMongoOne, MongoModel } from "../../lib/mongodb";
export class AddressMongoData implements AddressNS.DAL {
constructor(private db : Db) { }
private col_address = this.db.collection<MongoModel<AddressNS.Address>>("address");
async init() { }
async ListAddress(filter){
const docs = await this.col_address.find(filter).toArray()
return FromMongoMany<AddressNS.Address>(docs)
}
async GetAddress(name: string){
const address = await this.col_address.findOne({name})
return FromMongoOne<AddressNS.Address>(address)
}
}<file_sep>/src/components/topbar/Topbar.js
import React from "react";
import "./topbar.css";
import {
NotificationsNone,
Settings,
ExitToAppOutlined,
PersonOutline,
} from "@material-ui/icons";
import { NavLink } from "react-router-dom";
function Topbar() {
return (
<div className="topbar">
<div className="topbarWrapper">
<div className="topLeft">
<NavLink className="link" to="/dashboard">
<span className="logo">HDD</span>
</NavLink>
</div>
<div className="topRight">
<div className="topbarIconContainer">
<NotificationsNone />
<span className="topIconBadge">2</span>
</div>
<div className="topbarIconContainer">
<Settings />
</div>
<div className="topAvatarDropdown">
<img src="../images/avatar.jpg" alt="" className="topAvatar" />
<div className="logout">
<div className="logoutItem">
<ExitToAppOutlined />
<span>Log out</span>
</div>
<div className="logoutItem">
<PersonOutline />
<span>My profile</span>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
export default Topbar;
<file_sep>/src/components/sidebar/Sidebar.js
import React, { useState } from 'react';
import './sidebar.css';
import { NavLink, Link } from 'react-router-dom';
import {
AssessmentOutlined,
CheckOutlined,
DashboardOutlined,
PeopleAltOutlined,
} from '@material-ui/icons';
function Sidebar() {
return (
<div className="sidebar">
<div className="sidebarSearch">
<input placeholder="Search" />
</div>
<div className="sidebarWrapper">
<div className="sidebarMenu">
<ul className="sidebarList">
<NavLink
activeClassName="active-class"
className="link"
to="/dashboard"
>
<li className="sidebarListItem">
<DashboardOutlined className="sidebarIcon" /> Trang chủ
</li>
</NavLink>
<NavLink
activeClassName="active-class"
className="link"
to="/takeCare"
>
<li className="sidebarListItem">
<AssessmentOutlined className="sidebarIcon" /> Chăm sóc khách
hàng
</li>
</NavLink>
<NavLink
activeClassName="active-class"
className="link"
to="/users"
>
<li className="sidebarListItem">
<PeopleAltOutlined className="sidebarIcon" /> Quản lí thành viên
</li>
</NavLink>
<NavLink
activeClassName="active-class"
className="link"
to="/activeUsers"
>
<li className="sidebarListItem">
<CheckOutlined className="sidebarIcon" /> Phê duyệt thành viên
</li>
</NavLink>
<NavLink
activeClassName="active-class"
className="link"
to="/classrooms"
>
<li className="sidebarListItem">
<AssessmentOutlined className="sidebarIcon" /> Quản lí lớp học
</li>
</NavLink>
</ul>
</div>
</div>
</div>
);
}
export default Sidebar;
<file_sep>/src/modules/user/userInfo/UserInfo.js
import React, { useState, useEffect } from 'react';
import './userInfo.css';
import {
Add,
ArrowRight,
EmailOutlined,
Facebook,
HomeOutlined,
LocationOnOutlined,
PhoneAndroidOutlined,
} from '@material-ui/icons';
import { Link, useParams } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
import {
userInfoSelector,
getInfo,
} from '../../../store/reducers/userInfoSlice';
function UserInfo() {
const { id } = useParams();
const dispatch = useDispatch();
const userInfo = useSelector(userInfoSelector);
useEffect(() => {
dispatch(getInfo(id));
}, [dispatch, id]);
return (
<div className="userInfo">
<div className="userInfoTitle">
<HomeOutlined className="userInfoIconTitle" /> / Quay lại trang chủ
</div>
<div className="userInfoButton">
<Link className="link" to="/users/user/update/:userID">
<span>Chỉnh sửa thông tin</span>
</Link>
</div>
<div className="userInfoWrapper">
<div className="userInfoLeft">
<div className="userInfoLeftImg">
<img src="../images/avatar.jpg" />
</div>
<h3 className="userInfoLeftTitle">Contact</h3>
<div className="userInfoLeftContact">
<div className="userInfoContactList">
<div className="userInfoContactItem">
<PhoneAndroidOutlined className="userInfoIcon" />
{userInfo.contact.phone}
</div>
<div className="userInfoContactItem">
<EmailOutlined className="userInfoIcon" />
{userInfo.contact.email}
</div>
<div className="userInfoContactItem">
<Facebook className="userInfoIcon" />
{userInfo.contact.facebook}
</div>
<div className="userInfoContactItem">
<LocationOnOutlined className="userInfoIcon" />
{`${userInfo.contact.address.province}, ${userInfo.contact.address.district}, ${userInfo.contact.address.ward}, ${userInfo.contact.address.detail}`}
</div>
</div>
</div>
<h3 className="userInfoLeftTitle">Education</h3>
<div className="userInfoLeftEducation">
<div className="userInfoEducationList">
<p className="school">{userInfo.university}</p>
<p className="major">{userInfo.majors}</p>
<p className="time">(2019-2022)</p>
</div>
</div>
<h3 className="userInfoLeftTitle">Skills</h3>
<div className="userInfoLeftSkill">
{userInfo.skills.map((skill) => (
<p>
<ArrowRight /> {skill}
</p>
))}
</div>
</div>
<div className="userInfoRight">
<div className="userInfoRightHeader">
<p className="personName">{userInfo.fullName}</p>
<p className="jobPosition">Intern React</p>
</div>
<h3 className="userInfoRightTitle">Profile</h3>
<div className="userInfoProfile">
<p className="text">
Dưới đây là một số đoạn code tạo khung Text mẫu dạng HTML CSS
(đóng khung text văn bản trong HTML hoặc code tạo khung HTML) để
anh em chèn vào bài viết cho nó nhí nhảnh tí :v Các mẫu mình tham
khảo từ nhiều website trong và ngoài nước, thấy ưng cái bụng là
hốt về để dành chơi :v
</p>
</div>
<h3 className="userInfoRightTitle">Internship Reviews</h3>
<div className="userInfoReview">
<div className="userInfoReviewItem">
<b className="progressName">
<Add className="userInfoIcon" /> Quá trình 1:
</b>
<p className="text">Thời gian: 6/2021-10/2021</p>
<p className="text">
- Dưới đây là một số đoạn code tạo khung Text mẫu dạng HTML CSS
(đóng khung text văn bản trong HTML hoặc code tạo khung HTML) để
anh em chèn vào bài viết cho nó nhí nhảnh tí :v Các mẫu mình
tham khảo từ nhiều website trong và ngoài nước, thấy ưng cái
bụng là hốt về để dành chơi :v
</p>
</div>
<div className="userInfoReviewItem">
<b className="progressName">
<Add className="userInfoIcon" /> Quá trình 2:
</b>
<p className="text">Thời gian: 6/2021-10/2021</p>
<p className="text">
- Dưới đây là một số đoạn code tạo khung Text mẫu dạng HTML CSS
(đóng khung text văn bản trong HTML hoặc code tạo khung HTML) để
anh em chèn vào bài viết cho nó nhí nhảnh tí :v Các mẫu mình
tham khảo từ nhiều website trong và ngoài nước, thấy ưng cái
bụng là hốt về để dành chơi :v
</p>
</div>
</div>
</div>
</div>
</div>
);
}
export default UserInfo;
<file_sep>/src/modules/takeCare/InputForm.js
import React, { useState } from 'react';
import Input from '@mui/material/Input';
import Button from '@mui/material/Button';
import { addLink } from '../../store/reducers/takeCareSlice';
import { useDispatch } from 'react-redux';
export const InputForm = () => {
const [input, setInput] = useState('');
const dispatch = useDispatch();
const handleSubmit = (e) => {
e.preventDefault();
dispatch(addLink(input));
setInput('');
};
return (
<form onSubmit={handleSubmit}>
<Input
placeholder="Placeholder"
value={input}
onChange={(e) => setInput(e.target.value)}
/>
<Button variant="contained" type="submit" size="small">
Thêm
</Button>
</form>
);
};
<file_sep>/backend/src/todo/todo.business.ts
import { TodoNS } from "./todo";
export class TodoBLLBase implements TodoNS.BLL {
constructor(private dal : TodoNS.DAL) { }
async init() { }
async GetTodo(id : string) {
const doc = await this.dal.GetTodo(id);
return doc;
}
async ListTodo() {
const docs = await this.dal.ListTodo();
return docs;
}
async CreateTodo(params : TodoNS.CreateTodoParams) {
const todo : TodoNS.Todo = {
id : TodoNS.Generator.NewTodoId(),
name : params.name,
title : params.title,
ctime : Date.now(),
mtime : Date.now()
}
await this.dal.CreateTodo(todo);
return todo;
}
async UpdateTodo(id : string, params : TodoNS.UpdateTodoParams) {
const todo = await this.GetTodo(id);
if (params.name) {
todo.name = params.name;
}
if (params.title) {
todo.title = params.title;
}
todo.mtime = Date.now();
await this.dal.UpdateTodo(todo);
return todo;
}
async DeleteTodo(id : string) {
const todo = await this.GetTodo(id);
await this.dal.DeleteTodo(id);
return todo;
}
}<file_sep>/src/store/reducers/usersSlice.js
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import axios from "axios";
//// reducer thunk
/// get list users
export const getUsers = createAsyncThunk("users/usersFetched", async () => {
const response = await axios.get("http://localhost:4000/api/user/user/list");
return response.data;
});
/// delete user
export const deleteUser = createAsyncThunk("users/userDelete", async (id) => {
await axios.post(`http://localhost:4000/api/user/user/delete?code=${id}`);
return id;
});
/// create user
export const createUser = createAsyncThunk("users/userCreate", async (data) => {
const response = await axios.post(
`http://localhost:4000/api/user/user/create`,
data
);
return response.data;
});
//// tạo slice
const usersSlice = createSlice({
name: "users",
initialState: {
allUsers: [],
},
///// xử lý reducers
extraReducers: {
//// get users
[getUsers.pending]: (state, action) => {
console.log("Fetching users from backend");
},
[getUsers.fulfilled]: (state, action) => {
console.log("done");
state.allUsers = action.payload;
},
[getUsers.rejected]: (state, action) => {
console.log("false");
},
//// delete user
[deleteUser.pending]: (state, action) => {
console.log("Loading...");
},
[deleteUser.fulfilled]: (state, action) => {
console.log("done");
const userID = action.payload;
state.allUsers = state.allUsers.filter((user) => user.code !== userID);
},
[deleteUser.rejected]: (state, action) => {
console.log("false");
},
// //// update user info
// [updateInfo.pending]: (state, action) => {
// console.log('Loading...');
// },
// [updateInfo.fulfilled]: (state, action) => {
// console.log('update info done');
// const updatedUser = action.payload;
// state.allUsers = state.allUsers.map((user) => {
// if (user.code === updatedUser.code) {
// return updatedUser;
// }
// return user;
// });
// },
// [updateInfo.rejected]: (state, action) => {
// console.log('false');
// },
// //// update user
// [updateContact.pending]: (state, action) => {
// console.log('Loading...');
// },
// [updateContact.fulfilled]: (state, action) => {
// console.log('update contact done');
// },
// [updateContact.rejected]: (state, action) => {
// console.log('false');
// },
//// create user
[createUser.pending]: (state, action) => {
console.log("Loading...");
},
[createUser.fulfilled]: (state, action) => {
state.allUsers.unshift(action.payload);
},
[createUser.rejected]: (state, action) => {
console.log("false");
},
},
});
//// Tạo reducer/////
const usersReducer = usersSlice.reducer;
//// Selector /////
export const usersSelector = (state) => state.usersReducer.allUsers;
//// export reducer cho index.js ////
export default usersReducer;
<file_sep>/src/modules/classroom/Classroom.js
import React from "react";
import "./classroom.css";
import { HomeOutlined } from "@material-ui/icons";
function Classroom() {
return (
<div className="classroom">
<div className="classroomTitle">
<HomeOutlined className="classroomIcon" /> / Danh sách lớp học
</div>
</div>
);
}
export default Classroom;
<file_sep>/backend/src/todo/todo.ts
import rand from "../../lib/rand";
export namespace TodoNS {
export interface Todo {
id : string;
name : string;
title : string;
ctime : number;
mtime : number;
}
export interface CreateTodoParams {
name : string;
title : string;
}
export interface UpdateTodoParams {
name? : string;
title? : string;
}
export interface BLL {
ListTodo() : Promise<Todo[]>;
GetTodo(id : string) : Promise<Todo>;
CreateTodo(params : CreateTodoParams) : Promise<Todo>;
UpdateTodo(id : string, params : UpdateTodoParams) : Promise<Todo>;
DeleteTodo(id : string) : Promise<Todo>;
}
export interface DAL {
ListTodo() : Promise<Todo[]>;
GetTodo(name : string) : Promise<Todo>;
CreateTodo(todo : Todo) : Promise<void>;
UpdateTodo(todo : Todo) : Promise<void>;
DeleteTodo(id : string) : Promise<void>;
}
export const Generator = {
NewTodoId : () => rand.uppercase(8)
}
export const Errors = {
ErrTodoNotFound : "Todo not found"
}
}
<file_sep>/src/components/modal/Modal.js
import React from "react";
import "./modal.css";
import { useDispatch } from "react-redux";
import { deleteUser } from "../../store/reducers/usersSlice";
function Modal(props) {
const dispatch = useDispatch();
const deleteID = props.deleteUsers;
console.log(deleteID);
return (
<div className="modal">
<button className="close" onClick={() => props.closeModal(false)}>
x
</button>
<div className="modalContainer">
<div className="title">
<h3>XTP TECHNOLOGY</h3>
</div>
<div className="content">
<p>Bạn muốn xóa thành viên này ?</p>
</div>
<div className="footer">
<button
className="cancelBtn button"
onClick={() => props.closeModal(false)}
>
Thoát
</button>
<button
className="okBtn button"
onClick={() => {
dispatch(deleteUser(deleteID));
props.closeModal(false);
}}
>
Tiếp tục
</button>
</div>
</div>
</div>
);
}
export default Modal;
<file_sep>/src/components/registerForm/userFormComp/InputBirthday.js
import React from 'react';
import TextField from '@mui/material/TextField';
import AdapterDateFns from '@mui/lab/AdapterDateFns';
import LocalizationProvider from '@mui/lab/LocalizationProvider';
import DatePicker from '@mui/lab/DatePicker';
import { Controller, useFormContext } from 'react-hook-form';
const InputBirthday = ({ oldValue }) => {
const {
control,
trigger,
formState: { errors },
} = useFormContext();
return (
<Controller
name="birthday"
control={control}
defaultValue={new Date(oldValue)}
render={({ field }) => (
<LocalizationProvider dateAdapter={AdapterDateFns}>
<DatePicker
{...field}
label={<strong>Ngày sinh</strong>}
disableFuture
maxDate={new Date('2010-01-01')}
minDate={new Date('1970-01-01')}
openTo="year"
views={['year', 'month', 'day']}
renderInput={(params) => (
<TextField
{...params}
name="birthday"
fullWidth
error={!!errors.birthday}
helperText={errors.birthday?.message}
variant="standard"
margin="dense"
onKeyUp={() => {
trigger('birthday');
}}
/>
)}
/>
</LocalizationProvider>
)}
/>
);
};
export default InputBirthday;
<file_sep>/backend/src/user/user.api.ts
import * as express from "express";
import { UserNS } from "./user";
import { HttpParamValidators, HttpStatusCodes } from "../../lib/http";
export function NewUserAPI(userBLL: UserNS.BLL) {
const router = express.Router();
router.use(express.json());
const gender_values = Object.values(UserNS.Gender);
/////////// User route ///////////
router.get("/user/list", async (req, res) => {
const docs = await userBLL.ListUser();
res.json(docs);
})
router.get("/user/get", async (req, res) => {
const code = HttpParamValidators.MustBeString(req, res, req.query, "code", 6);
const doc = await userBLL.GetUser(code);
if (!doc) {
return res.status(HttpStatusCodes.NotFound).json(UserNS.Errors.ErrUserNotFound)
}
return res.json(doc);
})
router.post("/user/create", async(req, res) =>{
const userParams: UserNS.CreateUserParams = {
fullName: HttpParamValidators.MustBeString(req, res, req.body, "fullName", 2),
gender: HttpParamValidators.MustBeOneOf(req, res, req.body, "gender", gender_values),
birthday: HttpParamValidators.MustBeString(req, res, req.body, "birthday", 2),
university: HttpParamValidators.MustBeString(req, res, req.body, "university", 2),
majors: HttpParamValidators.MustBeString(req, res, req.body, "majors", 2),
CCCD: HttpParamValidators.MustBeString(req, res, req.body, "CCCD", 2),
skills: req.body.skills
}
const user = await userBLL.CreateUser(userParams)
const contactParams: UserNS.CreateContactParams = {
ref_id: user.code,
phone: HttpParamValidators.MustBeString(req, res, req.body, "phone", 2),
address: req.body.address,
email: HttpParamValidators.MustBeString(req, res, req.body, "email", 2),
facebook: HttpParamValidators.MustBeString(req, res, req.body, "facebook", 2)
}
const contact = await userBLL.CreateContact(contactParams)
return res.json({...user, contact})
})
router.post("/user/update", async(req, res)=>{
const code = HttpParamValidators.MustBeString(req, res, req.query, "code", 6)
const params: UserNS.UpdateUserParams = {}
if (req.body.fullName)
params.fullName = HttpParamValidators.MustBeString(req, res, req.body, "fullName", 2)
if (req.body.gender)
params.gender= HttpParamValidators.MustBeOneOf(req, res, req.body, "gender", gender_values)
if (req.body.birthday)
params.birthday= HttpParamValidators.MustBeString(req, res, req.body, "birthday", 2)
if (req.body.university)
params.university= HttpParamValidators.MustBeString(req, res, req.body, "university", 2)
if (req.body.majors)
params.majors= HttpParamValidators.MustBeString(req, res, req.body, "majors", 2)
if (req.body.CCCD)
params.CCCD= HttpParamValidators.MustBeString(req, res, req.body, "CCCD", 2)
if (req.body.skills)
params.skills= req.body.skills
const doc = await userBLL.UpdateUser(code, params);
return res.json(doc);
})
router.post("/user/delete", async(req,res)=>{
const code = HttpParamValidators.MustBeString(req, res, req.query, "code", 6)
const user = await userBLL.DeleteUser(code)
return res.json({user})
})
/////////// Contact route ///////////
router.get("/contact/list", async(req, res)=>{
const filter = {} as any
if(req.query.ref_id)
filter.ref_id = req.query.ref_id
const docs = await userBLL.ListContact(filter)
return res.json(docs)
})
router.get("/contact/get", async(req, res)=>{
const code = HttpParamValidators.MustBeString(req, res, req.query, "code", 6);
const doc = await userBLL.GetContact(code);
if (!doc) {
return res.status(HttpStatusCodes.NotFound).json(UserNS.Errors.ErrContactNotFound)
}
return res.json(doc);
})
router.post("/contact/create", async(req, res)=>{
const params: UserNS.CreateContactParams = {
ref_id: HttpParamValidators.MustBeString(req, res, req.body, "code", 2),
phone: HttpParamValidators.MustBeString(req, res, req.body, "phone", 2),
address: req.body.address,
email: HttpParamValidators.MustBeString(req, res, req.body, "email", 2),
facebook: HttpParamValidators.MustBeString(req, res, req.body, "facebook", 2)
}
const doc = await userBLL.CreateContact(params)
res.json(doc)
})
router.post("/contact/update", async(req, res)=>{
const code = HttpParamValidators.MustBeString(req, res, req.query, "code", 6)
const params: UserNS.UpdateContactParams = {}
if (req.body.phone)
params.phone = HttpParamValidators.MustBeString(req, res, req.body, "phone", 2)
if (req.body.address)
params.address= req.body.address
if (req.body.email)
params.email= HttpParamValidators.MustBeString(req, res, req.body, "email", 2)
if (req.body.facebook)
params.facebook= HttpParamValidators.MustBeString(req, res, req.body, "facebook", 2)
const doc = await userBLL.UpdateContact(code, params);
return res.json(doc);
})
router.post("/contact/delete", async(req,res)=>{
const code = HttpParamValidators.MustBeString(req, res, req.query, "code", 6)
const doc = await userBLL.DeleteContact(code)
return res.json(doc)
})
return router;
}<file_sep>/src/components/registerForm/userFormComp/InputTypeSelectSkills.js
import React from 'react';
import TextField from '@mui/material/TextField';
import MenuItem from '@mui/material/MenuItem';
import ListItemText from '@mui/material/ListItemText';
import Checkbox from '@mui/material/Checkbox';
import { Controller, useFormContext } from 'react-hook-form';
const MenuProps = {
PaperProps: {
style: {
maxHeight: 150,
width: 250,
},
},
};
const skills = [
'HTML',
'CSS',
'Javascipt',
'React JS',
'Vue JS',
'Angular JS',
'Node JS',
'Typescipt',
'PHP',
'Laravel',
];
const InputTypeSelectSkills = ({ oldValue }) => {
const {
control,
trigger,
formState: { errors },
} = useFormContext();
return (
<Controller
control={control}
name="skills"
defaultValue={oldValue}
render={({ field: { value, onChange } }) => {
// console.log(value);
return (
<TextField
select
fullWidth
label={<strong>Kiến thức</strong>}
error={!!errors.skills}
helperText={errors.skills?.message}
SelectProps={{
multiple: true,
value: value === undefined ? [] : value,
renderValue: (selected) => selected.join(', '),
onChange: onChange,
MenuProps: MenuProps,
}}
variant="standard"
margin="dense"
onKeyUp={async () => {
await trigger('skills');
}}
>
{skills.map((n) => (
<MenuItem key={n} value={n}>
<Checkbox checked={value.includes(n)} />
<ListItemText primary={n} />
</MenuItem>
))}
</TextField>
);
}}
/>
);
};
export default InputTypeSelectSkills;
<file_sep>/backend/src/user/user.model.ts
import { UserNS } from "./user";
import { Db } from "mongodb";
import { FromMongoMany , FromMongoOne, MongoModel, ToMongoData } from "../../lib/mongodb";
export class UserMongoData implements UserNS.DAL {
constructor(private db : Db) { }
private col_user = this.db.collection<MongoModel<UserNS.User>>("user");
private col_contact = this.db.collection<MongoModel<UserNS.Contact>>("contact");
async init() { }
//////////////// User DAL /////////////////
async ListUser(){
const docs = await this.col_user.find().toArray()
return FromMongoMany<UserNS.User>(docs)
}
async GetUser(code: string){
const doc = await this.col_user.findOne({code})
return FromMongoOne<UserNS.User>(doc)
}
async CreateUser(user: UserNS.User){
try {
await this.col_user.insertOne(ToMongoData(user))
} catch (error) {
throw error
}
}
async UpdateUser(user: UserNS.User){
await this.col_user.updateOne({_id: user.id}, {$set: user})
}
async DeleteUser(code: string){
await this.col_user.deleteOne({code})
}
//////////////// Contact DAL /////////////////
async ListContact(filter: any){
const docs = await this.col_contact.find(filter).toArray()
return FromMongoMany<UserNS.Contact>(docs)
}
async GetContact(code: string){
const doc = await this.col_contact.findOne({ref_id: code})
return FromMongoOne<UserNS.Contact>(doc)
}
async CreateContact(contact: UserNS.Contact){
try {
await this.col_contact.insertOne(ToMongoData(contact))
} catch (error) {
throw error
}
}
async UpdateContact(contact: UserNS.Contact){
await this.col_contact.updateOne({ref_id: contact.ref_id}, {$set: contact})
}
async DeleteContact(code: string){
await this.col_contact.deleteMany({ref_id: code})
}
}<file_sep>/src/App.js
import React, { Fragment, useState } from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import Sidebar from "./components/sidebar/Sidebar";
import Topbar from "./components/topbar/Topbar";
import Dashboard from "./modules/dashboard/Dashboard";
import User from "./modules/user/User";
import Classroom from "./modules/classroom/Classroom";
import ActiveUsers from "./modules/activeUsers/ActiveUsers";
import RegisterForm from "./components/registerForm/RegisterForm";
import Success from "./components/success/Success";
function App() {
return (
<Router>
<Topbar />
<Switch>
<Route exact path="/">
<div className={'container'}>
<Sidebar />
<Dashboard />
</div>
</Route>
<Route path="/dashboard">
<div className={'container'}>
<Sidebar />
<Dashboard />
</div>
</Route>
<Route path="/users">
<div className={'container'}>
<Sidebar />
<User />
</div>
</Route>
<Route path="/classrooms">
<div className={'container'}>
<Sidebar />
<Classroom />
</div>
</Route>
<Route path="/takeCare">
<div className={'container'}>
<Sidebar />
<TakeCare />
</div>
</Route>
<Route path="/activeUsers">
<div className={'container'}>
<Sidebar />
<ActiveUsers />
</div>
</Route>
<Route path="/signup">
<UserForm type="public" />
</Route>
<Route path="/success">
<Success />
</Route>
</Switch>
</Router>
);
}
export default App;
<file_sep>/backend/src/index.ts
import * as express from "express";
import * as cors from "cors";
import * as dotenv from "dotenv";
import "./config";
import { Connect } from "../lib/mongodb";
import { NewTodoAPI } from "./todo/todo.api";
import { TodoBLLBase } from "./todo/todo.business";
import { TodoMongoData } from "./todo/todo.model";
import { NewUserAPI } from "./user/user.api";
import { UserBLLBase } from "./user/user.business";
import { UserMongoData } from "./user/user.model";
import { NewAddressAPI } from "./address/address.api";
import { AddressBLLBase } from "./address/address.business";
import { AddressMongoData } from "./address/address.model";
async function main() {
dotenv.config();
const client = await Connect(process.env.DB_URL);
const db = client.db(process.env.DB_NAME);
console.log("connected to database")
/***************************************************/
const todoDAL = new TodoMongoData(db);
await todoDAL.init();
const todoBLL = new TodoBLLBase(todoDAL);
await todoBLL.init();
//user
const userDAL = new UserMongoData(db);
await userDAL.init();
const userBLL = new UserBLLBase(userDAL);
await userBLL.init();
//address
const addressDAL = new AddressMongoData(db)
await addressDAL.init()
const addressBLL = new AddressBLLBase(addressDAL)
await addressBLL.init()
/***************************************************/
const app = express();
app.disable("x-powered-by");
app.use(express.json());
app.use(cors());
app.use("/api/todo/", NewTodoAPI(todoBLL));
app.use("/api/user/", NewUserAPI(userBLL));
app.use("/api/address", NewAddressAPI(addressBLL))
/***************************************************/
app.listen(process.env.PORT, () => {
console.log("Server listen on " + process.env.PORT);
})
}
main().catch(err => console.log(err))<file_sep>/backend/src/todo/todo.model.ts
import { TodoNS } from "./todo";
import { Db } from "mongodb";
import { FromMongoMany , FromMongoOne, MongoModel, ToMongoData } from "../../lib/mongodb";
export class TodoMongoData implements TodoNS.DAL {
constructor(private db : Db) { }
private col_todo = this.db.collection<MongoModel<TodoNS.Todo>>("todo");
async init() { }
async ListTodo() {
const docs = await this.col_todo.find().toArray();
return FromMongoMany<TodoNS.Todo>(docs);
}
async GetTodo(id : string) {
const doc = await this.col_todo.findOne({_id : id});
return FromMongoOne<TodoNS.Todo>(doc);
}
async CreateTodo(todo : TodoNS.Todo) {
try {
const doc = ToMongoData(todo);
await this.col_todo.insertOne(doc);
} catch (err) {
throw err;
}
}
async UpdateTodo(todo : TodoNS.Todo) {
await this.col_todo.updateOne({_id : todo.id }, { $set : todo });
}
async DeleteTodo(id : string) {
await this.col_todo.deleteOne({ _id : id });
}
}<file_sep>/src/store/reducers/takeCareSlice.js
import { createSlice } from '@reduxjs/toolkit';
import { fbLink } from '../../constances/fakeDataFBLink';
//// tạo slice
const takeCareSlice = createSlice({
name: 'users',
initialState: {
data: fbLink,
},
reducers: {
addLink: (state, action) => {
state.data.unshift({
id: Math.floor(Math.random() * 1000 + 1),
fb: action.payload,
status: 0
});
},
},
});
//// Tạo reducer/////
const takeCareReducer = takeCareSlice.reducer;
//// Selector /////
export const takeCareSelector = (state) => state.takeCareReducer.data;
/// export actions
export const {addLink} = takeCareSlice.actions
//// export reducer cho index.js ////
export default takeCareReducer;
<file_sep>/src/components/registerForm/userFormComp/InputTypeText.js
import React from 'react';
import TextField from '@mui/material/TextField';
import { Controller, useFormContext } from 'react-hook-form';
const InputTypeText = ({ name, label, oldValue }) => {
const {
control,
trigger,
formState: { errors },
} = useFormContext();
return (
<Controller
name={name}
control={control}
defaultValue={oldValue}
render={({ field }) => {
return (
<TextField
{...field}
type="text"
fullWidth={true}
label={<strong>{label}</strong>}
error={!!errors[name]}
helperText={errors[name]?.message}
variant="standard"
margin="dense"
onKeyUp={async () => {
await trigger([name]);
}}
/>
);
}}
/>
);
};
export default InputTypeText;
<file_sep>/src/modules/activeUsers/ActiveUsers.js
import React from "react";
import "./activeUsers.css";
import { HomeOutlined } from "@material-ui/icons";
function ActiveUsers() {
return (
<div className="activeUsers">
<div className="activeUsersTitle">
<HomeOutlined className="activeUsersIconTitle" /> / Phê duyệt thành viên
</div>
</div>
);
}
export default ActiveUsers;
<file_sep>/backend/lib/createUserCode.ts
const convertNum = (num: number): string => (num > 0 && num < 10 ? `0${num}` : `${num}`);
export const createUserCode = (): string =>{
const t = new Date()
const yyyy = t.getFullYear()
const mm = t.getMonth() + 1
const dd = t.getDate()
const h = t.getHours()
const m = t.getMinutes()
const s = t.getSeconds()
return `${convertNum(yyyy)}${convertNum(mm)}${convertNum(dd)}${convertNum(h)}${convertNum(m)}${convertNum(s)}`
}<file_sep>/src/modules/user/userUpdate/UserUpdate.js
import React, { useEffect } from 'react';
import './userUpdate.css';
import { HomeOutlined } from '@material-ui/icons';
import { Link, useParams } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
import {
userInfoSelector,
getInfo,
} from '../../../store/reducers/userInfoSlice';
import UserForm from '../../../components/registerForm/UserForm';
const UserUpdate = () => {
// get user will update
const { id } = useParams();
const dispatch = useDispatch();
useEffect(() => {
dispatch(getInfo(id));
}, [dispatch, id]);
///
const userInfo = useSelector(userInfoSelector);
return (
<div className="userUpdated">
<div className="userUpdatedTitle">
<HomeOutlined className="userUpdateIconTitle" /> / Chỉnh sửa thông tin
học viên
</div>
{userInfo.code === id && <UserForm data={userInfo} />}
</div>
);
};
export default UserUpdate;
<file_sep>/src/constances/fakeData.js
export const Uni = [
{
n: 'Đại học Bách Khoa Hà Nội',
v: 'Đại học Bách Khoa Hà Nội',
},
{
n: 'Đại học Kinh Tế Quốc Dân',
v: 'Đại học Kinh Tế Quốc Dân',
},
{
n: 'Đại học Quốc Gia Hà Nội',
v: 'Đại học Quốc Gia Hà Nội',
},
{
n: 'Đại học Công Nghiệp Hà Nội',
v: 'Đại học Công Nghiệp Hà Nội',
},
{
n: 'Đại học Ngoại Thương',
v: 'Đại học Ngoại Thương',
},
{
n: 'Đại học Thương Mại',
v: 'Đại học Thương Mại',
},
];
export const Majors = [
{
n: 'Công Nghệ Thông Tin',
v: 'Công Nghệ Thông Tin',
},
{
n: 'Kĩ thuật phần mềm',
v: 'Kĩ thuật phần mềm',
},
{
n: 'Khoa học máy tính',
v: 'Khoa học máy tính',
},
{
n: 'Hệ thống thông tin',
v: 'Hệ thống thông tin',
},
];
<file_sep>/backend/lib/mongodb.ts
import { MongoClient } from "mongodb";
export async function Connect(url : string) : Promise<MongoClient> {
const client = await MongoClient.connect(url);
return client;
}
export type MongoModel<T> = Pick<T, Exclude<keyof T, 'id'>> & { _id: string };
export function FromMongoOne<T>(obj : MongoModel<T>) : T {
if (!obj) {
return null;
}
const doc = {} as T;
for (const [k, v] of Object.entries(obj)) {
if (k === "_id") {
doc["id"] = v;
} else {
doc[k] = v;
}
}
return doc;
}
export function FromMongoMany<T>(arr : Array<MongoModel<T>>) : T[] {
if(!arr) {
return [];
}
const newArr = arr.map(el => FromMongoOne(el));
return newArr;
}
export function ToMongoData(obj : object) {
if(!obj) {
return null;
}
let doc = {} as any;
for (const [k, v] of Object.entries(obj)) {
if (k === "id") {
doc["_id"] = v;
} else {
doc[k] = v;
}
}
return doc;
}
<file_sep>/src/modules/takeCare/TakeCare.js
import React from 'react';
import './TakeCare.css';
import { HomeOutlined } from '@material-ui/icons';
import { InputForm } from './InputForm';
import { DataGrid } from '@material-ui/data-grid';
import { useSelector, useDispatch } from 'react-redux';
import { takeCareSelector } from '../../store/reducers/takeCareSlice';
const TakeCare = () => {
const rows = useSelector(takeCareSelector);
const dispatch = useDispatch();
const columns = [
{
field: 'fb',
headerName: 'Link Facebook',
width: 500,
},
];
return (
<div className="takeCare">
<div className="takeCareTitle">
<HomeOutlined className="takeCareIcon" /> / Chăm sóc khách hàng
</div>
<InputForm />
<div style={{ height: 500, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
pageSize={10}
rowsPerPageOptions={[7]}
/>
</div>
</div>
);
};
export default TakeCare;
<file_sep>/backend/src/address/address.ts
import rand from "../../lib/rand";
export namespace AddressNS {
export interface Address {
id : string
name : string
type : Type
parent_id : string
ctime: number
mtime: number
}
export enum Type {
Province= "province",
District= "district",
Ward= "ward",
}
export interface CreateAddressParams {
name : string
type : Type
parent_id : string
}
export interface FilterAddress {
type: string,
parent_id ?:string
}
export interface BLL {
ListAddress(filter: FilterAddress): Promise<Address[]>
GetAddress(name: string): Promise<Address>
}
export interface DAL {
ListAddress(filter: any): Promise<Address[]>
GetAddress(name: string): Promise<Address>
}
export const Generator = {
NewAddressId : () => rand.alphabet(12)
}
export const Errors = {
ErrNotFound : "Not found"
}
}
<file_sep>/backend/src/user/user.business.ts
import { UserNS } from "./user";
export class UserBLLBase implements UserNS.BLL {
constructor(private dal : UserNS.DAL) { }
async init() { }
////////// User BLL ////////////
async ListUser() {
const users = await this.dal.ListUser();
// const viewUsers : UserNS.View_user[] = []3
// for(let i = users.length-1; i>=0; i--){
// const viewUser = await this.GetUser(users[i].code)
// viewUsers.push(viewUser)
// }
// return viewUsers;
const viewUsers = Promise.all( users.map( async user => {
const contacts = await this.ListContact({ref_id: user.code})
return {...user, contacts}
}))
return (await viewUsers).reverse()
}
async GetUser(code: string){
const user = await this.dal.GetUser(code)
const contact = await this.ListContact({ref_id: code})
const viewUser: UserNS.ViewUser ={
...user,
contacts: [...contact]
}
return viewUser
}
async CreateUser(params: UserNS.CreateUserParams){
const user: UserNS.User = {
id: UserNS.Generator.NewUserId(),
code: UserNS.Generator.NewUserCode() as string,
fullName: params.fullName,
gender: params.gender,
birthday: params.birthday,
university: params.university,
majors: params.majors,
CCCD: params.CCCD,
skills: params.skills,
ctime : Date.now(),
mtime : Date.now()
}
await this.dal.CreateUser(user)
return user;
}
async UpdateUser(code: string, params: UserNS.UpdateUserParams){
const user = await this.GetUser(code)
for(let key in params){
user[key] = params[key]
}
user.mtime = Date.now()
await this.dal.UpdateUser(user)
return user
}
async DeleteUser(code: string){
const user = await this.GetUser(code)
await this.dal.DeleteUser(code)
await this.dal.DeleteContact(code)
return user
}
////////// Contact BLL ////////////
async ListContact(filter: any){
const docs = this.dal.ListContact(filter)
return docs
}
async GetContact(code: string){
const user = this.dal.GetContact(code)
return user
}
async CreateContact(params: UserNS.CreateContactParams){
const contact: UserNS.Contact = {
id: UserNS.Generator.NewContactId(),
ref: "user",
ref_id: params.ref_id,
phone: params.phone,
address: params.address,
email: params.email,
facebook: params.facebook,
ctime: Date.now(),
mtime: Date.now()
}
await this.dal.CreateContact(contact)
return contact
}
async UpdateContact(code: string, params: UserNS.UpdateContactParams){
const contact = await this.GetContact(code)
for(let key in params){
contact[key] = params[key]
}
contact.mtime = Date.now()
await this.dal.UpdateContact(contact)
return contact
}
async DeleteContact(code: string){
const contact = this.GetContact(code)
await this.dal.DeleteContact(code)
return contact
}
}<file_sep>/backend/src/address/address.api.ts
import * as express from "express";
import { AddressNS } from "./address";
import { HttpParamValidators, HttpStatusCodes } from "../../lib/http";
export function NewAddressAPI(addressBLL: AddressNS.BLL) {
const router = express.Router();
router.use(express.json());
const type_values = Object.values(AddressNS.Type);
router.get("/address/list", async(req, res)=>{
const filter : AddressNS.FilterAddress = {
type: HttpParamValidators.MustBeOneOf(req, res, req.query, "type", type_values)
}
if(req.query.parent_id )
filter.parent_id = HttpParamValidators.MustBeString(req, res, req.query, "parent_id", 6)
const docs = await addressBLL.ListAddress(filter)
res.json(docs)
})
router.get("/address/get", async(req, res)=>{
const name = HttpParamValidators.MustBeString(req, res, req.query, "name", 6)
const doc = await addressBLL.GetAddress(name)
if (!doc) {
return res.status(HttpStatusCodes.NotFound).json(AddressNS.Errors.ErrNotFound)
}
res.json(doc)
})
return router;
}<file_sep>/backend/src/address/address.business.ts
import e = require("express");
import { AddressNS } from "./address";
export class AddressBLLBase implements AddressNS.BLL {
constructor(private dal : AddressNS.DAL) { }
async init() { }
async ListAddress(filter: AddressNS.FilterAddress){
const docs = await this.dal.ListAddress(filter)
const HN = docs.filter(el => el.name ==="Thành phố Hà Nội")
const HCM = docs.filter(el => el.name ==="Thành phố Hồ Chí Minh")
return [...HN, ...HCM, ...docs.filter(el=>{if(el.name !=="Thành phố Hà Nội" && el.name !=="Thành phố Hồ Chí Minh") return el})]
}
async GetAddress(name: string){
const doc = await this.dal.GetAddress(name)
return doc
}
}<file_sep>/backend/src/user/user.ts
import rand from "../../lib/rand";
import {createUserCode} from '../../lib/createUserCode'
export namespace UserNS {
export interface User {
id : string;
code: string;
fullName: string;
gender: Gender;
birthday: string;
university: string;
majors: string;
CCCD: string;
skills: string[];
ctime : number;
mtime : number;
}
export interface Contact {
id: string;
ref: string,
ref_id: string,
phone: string;
address: userAddress;
email: string;
facebook: string;
ctime : number;
mtime : number;
}
export interface userAddress {
province: string,
district: string,
ward: string,
detail: string
}
export enum Gender {
male = "male",
female = "female"
}
export interface CreateUserParams {
fullName: string;
gender: Gender;
birthday: string;
university: string;
majors: string;
CCCD: string;
skills: string[];
}
export interface UpdateUserParams {
fullName? : string;
gender? : Gender;
birthday? : string;
university? : string;
majors? : string;
CCCD? : string;
skills? : string[];
}
export interface CreateContactParams {
ref_id: string,
phone: string;
address: userAddress;
email: string;
facebook: string
}
export interface UpdateContactParams {
phone? : string;
address? : userAddress;
email? : string;
facebook? : string;
}
export interface ViewUser extends User{
contacts: Contact[]
}
export interface BLL {
//user bll
ListUser() : Promise<ViewUser[]>;
GetUser(code : string) : Promise<ViewUser>;
CreateUser(params : CreateUserParams) : Promise<User>;
UpdateUser(code : string, params : UpdateUserParams) : Promise<User>;
DeleteUser(code : string) : Promise<User>;
//contact bll
ListContact(filter: any) : Promise<Contact[]>;
GetContact(code: string): Promise<Contact>
CreateContact(params: CreateContactParams): Promise<Contact>
UpdateContact(code: string, params: UpdateContactParams): Promise<Contact>
DeleteContact(code: string): Promise<Contact>
}
export interface DAL {
//user dal
ListUser(): Promise<User[]>;
GetUser(code: string): Promise<User>;
CreateUser(user: User): Promise<void>;
UpdateUser(user: User): Promise<void>;
DeleteUser(code: string): Promise<void>;
//contact dal
ListContact(filter: any): Promise<Contact[]>;
GetContact(code: string): Promise<Contact>
CreateContact(contact: Contact): Promise<void>
UpdateContact(contact: Contact): Promise<void>
DeleteContact(code: string): Promise<void>;
}
export const Generator = {
NewUserId : () => rand.uppercase(12),
NewUserCode : () => createUserCode(),
NewContactId : () => rand.uppercase(10),
}
export const Errors = {
ErrUserNotFound : "User not found",
ErrContactNotFound : "Contact not found"
}
}
<file_sep>/src/store/reducers/userContactSlice.js
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import axios from "axios";
//// get contact
export const getContact = createAsyncThunk("users/userContact", async (id) => {
const response = await axios.get(
`http://localhost:4000/api/user/contact/get?code=${id}`
);
return response.data;
console.log(response.data);
});
const userContactSlice = createSlice({
name: "userContact",
initialState: {
userContactState: [],
},
///// xử lý reducers
extraReducers: {
//// get contact
[getContact.pending]: (state, action) => {
console.log("Fetching users from backend");
},
[getContact.fulfilled]: (state, action) => {
console.log("done");
state.userContactState = action.payload;
},
[getContact.rejected]: (state, action) => {
console.log("false");
},
},
});
const userContactReducer = userContactSlice.reducer;
//// Selector /////
export const userContactSelector = (state) =>
state.userContactReducer.userContactState;
//// export reducer cho index.js ////
export default userContactReducer;
<file_sep>/backend/lib/http.ts
export const enum HttpStatusCodes {
BadRequest = 400,
Unauthorized = 401,
NotFound = 404,
MethodNotAllowed = 405,
}
export const HttpParamValidators = {
MustBeString(req, res, obj: any, key: string, min = 1, max = 512) {
const v = obj[key];
if (typeof v !== "string") {
res.status(HttpStatusCodes.BadRequest).json(`${key} must be string`);
res.end();
}
if (v.length < min) {
res.status(HttpStatusCodes.BadRequest).json(`${key} must be at least ${min} characters`);
res.end();
}
if (v.length > max) {
res.status(HttpStatusCodes.BadRequest).json(`${key} must be shorter than ${max} characters`);
res.end();
}
return v;
},
MustBeOneOf<T>(req, res, obj: any, key: string, values: T[] = []): T {
const value = obj[key];
for (const v of values) {
if (v === value) {
return v;
}
}
res.status(HttpStatusCodes.BadRequest).json(`${key} must be one of ${values.join(',')}`);
res.end();
},
}
<file_sep>/backend/src/todo/todo.api.ts
import * as express from "express";
import { TodoNS } from "./todo";
import { HttpParamValidators, HttpStatusCodes } from "../../lib/http";
export function NewTodoAPI(todoBLL: TodoNS.BLL) {
const router = express.Router();
router.use(express.json());
router.get("/todo/list", async (req, res) => {
const docs = await todoBLL.ListTodo();
res.json(docs);
})
router.get("/todo/get", async (req, res) => {
const id = HttpParamValidators.MustBeString(req, res, req.query, "id", 6);
const doc = await todoBLL.GetTodo(id);
if (!doc) {
return res.status(HttpStatusCodes.NotFound).json(TodoNS.Errors.ErrTodoNotFound)
}
return res.json(doc);
})
router.post("/todo/create", async (req, res) => {
const params: TodoNS.CreateTodoParams = {
name: HttpParamValidators.MustBeString(req, res, req.body, "name", 2),
title: HttpParamValidators.MustBeString(req, res, req.body, "title", 2),
}
const todo = await todoBLL.CreateTodo(params);
return res.json(todo);
})
router.post("/todo/update", async (req, res) => {
const id = HttpParamValidators.MustBeString(req, res, req.query, "id", 6);
const params: TodoNS.UpdateTodoParams = {};
if (req.body.name) {
params.name = HttpParamValidators.MustBeString(req, res, req.body, "name", 2);
}
if (req.body.title) {
params.title = HttpParamValidators.MustBeString(req, res, req.body, "title", 2);
}
const doc = await todoBLL.UpdateTodo(id, params);
return res.json(doc);
})
router.post("/todo/delete", async (req, res) => {
const id = HttpParamValidators.MustBeString(req, res, req.query, "id", 6);
const doc = await todoBLL.DeleteTodo(id);
return res.json(doc);
})
return router;
}<file_sep>/backend/src/config.ts
const log = console.log;
console.log = function (...args) {
args.unshift(new Date());
log.apply(console ,args);
}
<file_sep>/backend/lib/rand.ts
const CHARSET = {
UPSERCASE: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
ALPHABET: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
NUMBER: '0123456789'
}
function randomString(length: number, chars: string) {
const result = [];
const len = chars.length;
for (let i = length; i > 0; --i) {
result[i] = chars[Math.floor(Math.random() * len)];
}
return result.join('');
}
const uppercase = (l = 8) => randomString(l, CHARSET.UPSERCASE);
const alphabet = (l = 8) => randomString(l, CHARSET.ALPHABET);
const number = (l = 8) => randomString(l, CHARSET.NUMBER);
export default {
uppercase, alphabet, number,
}<file_sep>/src/store/reducers/userAddressSlice.js
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import axios from "axios";
/// get province
export const getProvince = createAsyncThunk(
"users/userAddressProvince",
async () => {
const response = await axios.get(
`http://localhost:4000/api/address/address/list?type=province`
);
return response.data;
}
);
export const getDistrict = createAsyncThunk(
"users/userAddressDistrict",
async (id) => {
const response = await axios.get(
`http://localhost:4000/api/address/address/list?type=district&parent_id=${id}`
);
return response.data;
}
);
export const getWard = createAsyncThunk("users/userAddressWard", async (id) => {
const response = await axios.get(
`http://localhost:4000/api/address/address/list?type=ward&parent_id=${id}`
);
return response.data;
});
const userAddressSlice = createSlice({
name: "userAddress",
initialState: {
userAddressState: {
province: [],
district: [],
ward: [],
},
},
///// xử lý reducers
extraReducers: {
//// get province
[getProvince.pending]: (state, action) => {
console.log("fetching province");
},
[getProvince.fulfilled]: (state, action) => {
console.log("done");
state.userAddressState.province = action.payload;
},
[getProvince.rejected]: (state, action) => {
console.log("false");
},
//// get district
[getDistrict.pending]: (state, action) => {
console.log("fetching province");
},
[getDistrict.fulfilled]: (state, action) => {
console.log("done");
state.userAddressState.district = action.payload;
},
[getDistrict.rejected]: (state, action) => {
console.log("false");
},
//// get ward
[getWard.pending]: (state, action) => {
console.log("fetching province");
},
[getWard.fulfilled]: (state, action) => {
console.log("done");
state.userAddressState.ward = action.payload;
},
[getWard.rejected]: (state, action) => {
console.log("false");
},
},
});
const userAddressReducer = userAddressSlice.reducer;
//// Selector /////
export const userAddressSelector = (state) =>
state.userAddressReducer.userAddressState;
//// export reducer cho index.js ////
export default userAddressReducer;
<file_sep>/src/modules/dashboard/Dashboard.js
import React from "react";
import "./dashboard.css";
import { HomeOutlined } from "@material-ui/icons";
function Dashboard() {
return (
<div className="dashboard">
<div className="dashboardTitle">
<HomeOutlined className="dashboardIcon" /> / Trang chủ quản trị
</div>
<div className="dashboardWrapperCard">
<div className="dashboardCard">
<div className="dashboardCardItem">
<div className="dashboardCardIcon">
<img src="data:image/svg+xml;base64,<KEY> />
</div>
<div className="dashboardCardContainer">
<div className="dashboardCardContent">254 members</div>
<div className="dashboardCardTitle">Tổng số thành viên</div>
</div>
</div>
<div className="dashboardCardItem">
<div className="dashboardCardIcon">
<img src="data:image/svg+xml;base64,<KEY>" />{" "}
</div>
<div className="dashboardCardContainer">
<div className="dashboardCardContent">5 classes</div>
<div className="dashboardCardTitle">Tổng số lớp học</div>
</div>
</div>
<div className="dashboardCardItem">
<div className="dashboardCardIcon">
<img src="data:image/svg+xml;base64,<KEY>" />{" "}
</div>
<div className="dashboardCardContainer">
<div className="dashboardCardContent">30 members</div>
<div className="dashboardCardTitle">Số thành viên mới</div>
</div>
</div>
</div>
</div>
</div>
);
}
export default Dashboard;
| 484138b6c425f9b38df5e6ab53dd6555649889f6 | [
"JavaScript",
"TypeScript"
] | 38 | JavaScript | dohd2201/classroom-management | 4c783322314f374e73ad6dbe5a1c67f0a9eb2061 | 954f098945fc78456109d8c1fccf3255fae31174 |
refs/heads/master | <file_sep><?php
namespace app\admin\model;
use think\Model;
class Article extends Model
{
public function gettextAttr($value,$data){
$text = strip_tags($data['editorValue']);
return $text;
}
}
<file_sep><?php
namespace app\admin\model;
use think\Model;
class Index61 extends Model
{
public function getimagesAttr($value,$data){
$images = "<img src='/static/picture/{$data['img']}' height='40px'>";
return $images;
}
}
<file_sep><?php
namespace app\index\controller;
use think\Controller;
use app\admin\model\Webinfo;
use app\admin\model\Article;
class Index extends Controller
{
//首页呈现
public function index()
{
$webinfo = Webinfo::find();
$index1 = db('index1')->where('id',1)->value('desc');
$index2 = db('index2')->where('id',1)->value('logopath');
$index3 = db('index3')->where('id',1)->find();
$index4 = db('index4')->select();
$index5 = db('index5')->select();
$index6 = db('index6')->select();
$index61 = db('index61')->order('time desc')->select();
$index7 = db('index7')->find();
$index8 = db('index8')->find();
$article = Article::order('time desc')->limit(4)->select();
//基本信息
$this->assign("webtitle",$webinfo->webtitle);
$this->assign("webkeywords",$webinfo->webkeywords);
$this->assign("webdesc",$webinfo->webdesc);
//首页一层
$this->assign("index1",$index1);
$this->assign("index2",$index2);
$this->assign("banner1",$index3['banner1']);
$this->assign("banner2",$index3['banner2']);
$this->assign("banner3",$index3['banner3']);
$this->assign("banner4",$index3['banner4']);
$this->assign("index4",$index4);
$this->assign("index5",$index5);
$this->assign("index6",$index6);
$this->assign("index61",$index61);
$this->assign("index7",$index7);
$this->assign("index8",$index8);
$this->assign("article",$article);
return view();
}
//文章页面
//首页呈现
public function article()
{
$webinfo = Webinfo::find();
$index1 = db('index1')->where('id',1)->value('desc');
$index2 = db('index2')->where('id',1)->value('logopath');
$navimg = db('index2')->where('id',2)->value('logopath');
$index3 = db('index3')->where('id',1)->find();
$index8 = db('index8')->find();
$article = Article::order('time desc')->paginate(5);
$list = Article::order('time desc')->limit(8)->select();
//基本信息
$this->assign("webtitle",$webinfo->webtitle);
$this->assign("webkeywords",$webinfo->webkeywords);
$this->assign("webdesc",$webinfo->webdesc);
//首页一层
$this->assign("index1",$index1);
$this->assign("index2",$index2);
$this->assign("navimg",$navimg);
$this->assign("banner1",$index3['banner1']);
$this->assign("banner2",$index3['banner2']);
$this->assign("banner3",$index3['banner3']);
$this->assign("banner4",$index3['banner4']);
$this->assign("index8",$index8);
$this->assign("article",$article);
$this->assign("list",$list);
return view();
}
public function articlelist($id){
$webinfo = Webinfo::find();
$index1 = db('index1')->where('id',1)->value('desc');
$index2 = db('index2')->where('id',1)->value('logopath');
$index3 = db('index3')->where('id',1)->find();
$index8 = db('index8')->find();
$list = db('article')->order('time desc')->limit(8)->select();
$article = db('article')->where('id',$id)->find();
$navimg = db('index2')->where('id',2)->value('logopath');
$this->assign("navimg",$navimg);
//基本信息
$this->assign("webtitle",$webinfo->webtitle);
$this->assign("webkeywords",$webinfo->webkeywords);
$this->assign("webdesc",$webinfo->webdesc);
//首页一层
$this->assign("index1",$index1);
$this->assign("index2",$index2);
$this->assign("banner1",$index3['banner1']);
$this->assign("banner2",$index3['banner2']);
$this->assign("banner3",$index3['banner3']);
$this->assign("banner4",$index3['banner4']);
$this->assign("index8",$index8);
$this->assign("article",$article);
$this->assign("list",$list);
return view();
}
//课程介绍
public function course(){
$webinfo = Webinfo::find();
$index1 = db('index1')->where('id',1)->value('desc');
$index2 = db('index2')->where('id',1)->value('logopath');
$index3 = db('index3')->where('id',1)->find();
$index8 = db('index8')->find();
$course = db('course')->paginate(10);
$list = db('article')->order('time desc')->limit(8)->select();
$navimg = db('index2')->where('id',2)->value('logopath');
$this->assign("navimg",$navimg);
//基本信息
$this->assign("webtitle",$webinfo->webtitle);
$this->assign("webkeywords",$webinfo->webkeywords);
$this->assign("webdesc",$webinfo->webdesc);
//首页一层
$this->assign("index1",$index1);
$this->assign("index2",$index2);
$this->assign("banner1",$index3['banner1']);
$this->assign("banner2",$index3['banner2']);
$this->assign("banner3",$index3['banner3']);
$this->assign("banner4",$index3['banner4']);
$this->assign("index8",$index8);
$this->assign("course",$course);
$this->assign("list",$list);
return view();
}
public function courselist($id){
$webinfo = Webinfo::find();
$index1 = db('index1')->where('id',1)->value('desc');
$index2 = db('index2')->where('id',1)->value('logopath');
$index3 = db('index3')->where('id',1)->find();
$index8 = db('index8')->find();
$list = db('article')->order('time desc')->limit(8)->select();
$course = db('course')->where('id',$id)->find();
$navimg = db('index2')->where('id',2)->value('logopath');
$this->assign("navimg",$navimg);
//基本信息
$this->assign("webtitle",$webinfo->webtitle);
$this->assign("webkeywords",$webinfo->webkeywords);
$this->assign("webdesc",$webinfo->webdesc);
//首页一层
$this->assign("index1",$index1);
$this->assign("index2",$index2);
$this->assign("banner1",$index3['banner1']);
$this->assign("banner2",$index3['banner2']);
$this->assign("banner3",$index3['banner3']);
$this->assign("banner4",$index3['banner4']);
$this->assign("index8",$index8);
$this->assign("course",$course);
$this->assign("list",$list);
return view();
}
}
<file_sep><?php
namespace app\admin\controller;
use think\Controller;
use app\admin\model\Webinfo;
use app\admin\model\Index6;
use app\admin\model\Index61;
use app\admin\model\Article;
use app\admin\model\Course;
class Index extends Controller
{
public function index()
{
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//网站基本信息
public function webinfo(){
if (!session('?admin_id')) {
return view("login");
}
$webinfo = Webinfo::find();
$this->assign("webtitle",$webinfo->webtitle);
$this->assign("webkeywords",$webinfo->webkeywords);
$this->assign("webdesc",$webinfo->webdesc);
return view();
}
//登陆
public function login(){
$username = input('username');
$password = input('<PASSWORD>');
$arr = db('admin')->where('username',$username)->find();
if ($password == $arr['password']) {
session('admin_id', $arr['id']);
echo "OK";
}else{
echo "账号或密码错误";
}
}
//退出
public function loginout(){
session(null);
$this->redirect('/admin');
}
//修改密码
public function updatepass(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//修改密码
public function editpass(){
if (!session('?admin_id')) {
return view("login");
}
$username = input('username');
$oldpassword = input('<PASSWORD>');
$newpassword1 = input('<PASSWORD>');
$newpassword2 = input('<PASSWORD>');
if ($newpassword1 != $newpassword2) {
$this->error('两次密码不一致');
}
$rows = db('admin')->where('username',$username)->where('password',$<PASSWORD>)->find();
if ($rows == null) {
$this->error('账号或密码错误');
}
db('admin')->where('username', $username)->update(['password' => $<PASSWORD>]);
$this->success('更新成功');
}
//网站基本信息修改
public function webinfoedit(){
if (!session('?admin_id')) {
return view("login");
}
$webinfo = new Webinfo;
// 过滤post数组中的非数据表字段数据
$webinfo->save(input(''),['id' => 1]);
$this->success('更新成功');
}
//首页一层
public function index1()
{
if (!session('?admin_id')) {
return view("login");
}
$index1 = db('index1')->where('id',1)->value('desc');
$this->assign("index1",$index1);
return view();
}
//首页一层信息修改
public function index1edit(){
if (!session('?admin_id')) {
return view("login");
}
db('index1')->update(['desc' => input('desc'),'id'=>1]);
$this->success('更新成功');
}
public function index2(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//修改logo
public function index2edit(){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('logo');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
db('index2')->update(['logopath' => $getSaveName,'id'=>1]);
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getSaveName();
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
$this->success('更新成功');
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
public function index3(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//修改轮播
public function index3edit(){
if (!session('?admin_id')) {
return view("login");
}
//分别是哪个ban图
$name = input('name');
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file($name);
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
db('index3')->update([$name => $getSaveName,'id'=>1]);
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getSaveName();
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
$this->success('更新成功');
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
//开班信息
public function index4(){
if (!session('?admin_id')) {
return view("login");
}
$index4 = db('index4')->select();
$this->assign("index4",$index4);
return view();
}
//开班信息修改
public function index4edit(){
if (!session('?admin_id')) {
return view("login");
}
db('index4')->update(input(''));
$this->success('更新成功');
}
//师资力量
public function index5(){
if (!session('?admin_id')) {
return view("login");
}
$index5 = db('index5')->select();
$this->assign("index5",$index5);
return view();
}
//修改教师头像
public function index5edit($id){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('file');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
db('index5')->update(['img' => $getSaveName,'id'=>$id]);
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getSaveName();
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
$str = <<<EOF
{
"code": 0
,"msg": ""
,"data": {
"src": "http://cdn.layui.com/123.jpg"
}
}
EOF;
echo $str;
}
}
//老师信息修改
public function index5edit1(){
if (!session('?admin_id')) {
return view("login");
}
db('index5')->update(['name' => input('name'),'desc' => input('desc'),'id'=>input('id')]);
$this->success('更新成功');
}
//教学风采
public function index61view($page=1,$limit=10){
if (!session('?admin_id')) {
return view("login");
}
$jxfc = Index61::limit(($page-1)*$limit,$limit)->order('time desc')->select();
$jxfc = json_encode($jxfc);
$rows = Index61::count();
$jxfc = '{"code": 0,"msg": "","count": '.$rows.',"data":'.$jxfc.'}';
echo $jxfc;
}
public function index61(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//新增教学风采
public function index61add(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//新增教学风采
public function index61insert(){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('img');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
$data = ['img' => $getSaveName,'beizhu' => input('beizhu'),'time'=>date("Y-m-d"),'id'=>input('id')];
db('index61')->insert($data);
$this->success('新增成功',"/admin/index/index61");
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
//删除教学风采
public function index61del(){
if (!session('?admin_id')) {
return view("login");
}
Index61::destroy(input('id'));
}
//学员单元格编辑
public function index61edit(){
if (!session('?admin_id')) {
return view("login");
}
$id = input('id');
$field = input('field');
$value = input('value');
$user = new index61;
$oldvalue = $user ->find($id)->$field;
//过滤post数组中的非数据表字段数据
$m = $user->save([$field=>$value], ['id' => $id]);
if ($m) {
echo "更新成功";
}else{
echo "更新失败";
}
}
//就业学员
public function index6view($page=1,$limit=10){
if (!session('?admin_id')) {
return view("login");
}
$students = Index6::limit(($page-1)*$limit,$limit)->select();
$rows = Index6::count();
$students = json_encode($students);
$students = '{"code": 0,"msg": "","count": '.$rows.',"data":'.$students.'}';
echo $students;
}
public function index6(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//删除学员
public function index6del(){
if (!session('?admin_id')) {
return view("login");
}
Index6::destroy(input('id'));
}
//学员单元格编辑
public function index6edit(){
if (!session('?admin_id')) {
return view("login");
}
$id = input('id');
$field = input('field');
$value = input('value');
$user = new index6;
$oldvalue = $user ->find($id)->$field;
//过滤post数组中的非数据表字段数据
$m = $user->save([$field=>$value], ['id' => $id]);
if ($m) {
echo "更新成功";
}else{
echo "更新失败";
}
}
//新增学员
public function index6add(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//新增学员
public function index6insert(){
if (!session('?admin_id')) {
return view("login");
}
$user = new Index6;
// 过滤post数组中的非数据表字段数据
$user->save(input(''));
$this->success('新增成功',"/admin/index/index6");
}
//合作企业
public function index7(){
if (!session('?admin_id')) {
return view("login");
}
$index7 = db('index7')->find();
$this->assign("index7",$index7);
return view();
}
//合作企业图片
public function index7edit($id){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('file');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
db('index7')->update(['img' => $getSaveName,'id'=>$id]);
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getSaveName();
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
$str = <<<EOF
{
"code": 0
,"msg": ""
,"data": {
"src": "http://cdn.layui.com/123.jpg"
}
}
EOF;
echo $str;
}
}
//合作企业信息修改
public function index7edit1(){
if (!session('?admin_id')) {
return view("login");
}
db('index7')->update(['desc' => input('desc'),'id'=>1]);
$this->success('更新成功');
}
//底部信息
public function index8(){
if (!session('?admin_id')) {
return view("login");
}
$index8 = db('index8')->find();
$this->assign("index8",$index8);
return view();
}
//二维码
public function index8edit($id){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('file');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
db('index8')->update(['img' => $getSaveName,'id'=>$id]);
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getSaveName();
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
$str = <<<EOF
{
"code": 0
,"msg": ""
,"data": {
"src": "http://cdn.layui.com/123.jpg"
}
}
EOF;
echo $str;
}
}
//底部信息修改
public function index8edit1(){
if (!session('?admin_id')) {
return view("login");
}
db('index8')->update(['address' => input('address'),'beian' => input('beian'),'id'=>1]);
$this->success('更新成功');
}
//添加文章
public function articleadd(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//添加文章
public function articleedit(){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('poster');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
$data = ['poster' => $getSaveName,'title' => input('title'), 'editorValue' => input('editorValue'),'time'=>date("Y-m-d")];
db('article')->insert($data);
$this->success('新增成功',"/admin/index/articlelist");
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
//文章列表
public function articlelistview($page=1,$limit=10){
if (!session('?admin_id')) {
return view("login");
}
$articlelist = Article::limit(($page-1)*$limit,$limit)->order('time desc')->select();
$rows = Article::count();
$articlelist = json_encode($articlelist);
$articlelist = '{"code": 0,"msg": "","count": '.$rows.',"data":'.$articlelist.'}';
echo $articlelist;
}
//删除文章
public function articledel(){
if (!session('?admin_id')) {
return view("login");
}
Article::destroy(input('id'));
}
//文章单元格编辑
public function articleedit1(){
if (!session('?admin_id')) {
return view("login");
}
$id = input('id');
$field = input('field');
$value = input('value');
$user = new Article;
$oldvalue = $user ->find($id)->$field;
//过滤post数组中的非数据表字段数据
$m = $user->save([$field=>$value], ['id' => $id]);
if ($m) {
echo "更新成功";
}else{
echo "更新失败";
}
}
public function articlelist(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//文章更新
public function articleupdate($id){
if (!session('?admin_id')) {
return view("login");
}
$article = db('article')->find($id);
$this->assign("article",$article);
return view();
}
//文章更新
public function articleupdate1(){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
if (request()->file('poster') == null) {
$data = ['title' => input('title'), 'editorValue' => input('editorValue'),'time'=>date("Y-m-d"),'id'=>input('id')];
db('article')->update($data);
$this->success('更新成功',"/admin/index/articlelist");
}else{
$file = request()->file('poster');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
$data = ['poster' => $getSaveName,'title' => input('title'), 'editorValue' => input('editorValue'),'time'=>date("Y-m-d"),'id'=>input('id')];
db('article')->update($data);
$this->success('更新成功',"/admin/index/articlelist");
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
}
//添加课程
public function courseadd(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//添加课程
public function courseedit(){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('poster');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
$data = ['poster' => $getSaveName,'title' => input('title'), 'editorValue' => input('editorValue'),'time'=>date("Y-m-d")];
db('course')->insert($data);
$this->success('新增成功',"/admin/index/courselist");
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
//课程列表
public function courselistview($page=1,$limit=10){
if (!session('?admin_id')) {
return view("login");
}
$courselist = Course::limit(($page-1)*$limit,$limit)->order('time desc')->select();
$rows = Course::count();
$courselist = json_encode($courselist);
$courselist = '{"code": 0,"msg": "","count": '.$rows.',"data":'.$courselist.'}';
echo $courselist;
}
//删除课程
public function coursedel(){
if (!session('?admin_id')) {
return view("login");
}
Course::destroy(input('id'));
}
//文章单元格编辑
public function courseedit1(){
if (!session('?admin_id')) {
return view("login");
}
$id = input('id');
$field = input('field');
$value = input('value');
$user = new Course;
$oldvalue = $user ->find($id)->$field;
//过滤post数组中的非数据表字段数据
$m = $user->save([$field=>$value], ['id' => $id]);
if ($m) {
echo "更新成功";
}else{
echo "更新失败";
}
}
public function courselist(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//课程更新
public function courseupdate($id){
if (!session('?admin_id')) {
return view("login");
}
$course = db('course')->find($id);
$this->assign("course",$course);
return view();
}
//课程更新
public function courseupdate1(){
if (!session('?admin_id')) {
return view("login");
}
if (request()->file('poster') == null) {
// 成功上传后 获取上传信息
$data = ['title' => input('title'), 'editorValue' => input('editorValue'),'time'=>date("Y-m-d"),'id'=>input('id')];
db('course')->update($data);
$this->success('更新成功',"/admin/index/courselist");
}else{
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('poster');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
$data = ['poster' => $getSaveName,'title' => input('title'), 'editorValue' => input('editorValue'),'time'=>date("Y-m-d"),'id'=>input('id')];
db('course')->update($data);
$this->success('更新成功',"/admin/index/courselist");
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
}
public function nav(){
if (!session('?admin_id')) {
return view("login");
}
return view();
}
//修改navimg
public function navimg(){
if (!session('?admin_id')) {
return view("login");
}
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('navimg');
// 移动到框架应用根目录/uploads/ 目录下
$info = $file->move( './static/picture');
if($info){
$getSaveName = str_replace("\\", "/",$info->getSaveName());
// 成功上传后 获取上传信息
db('index2')->update(['logopath' => $getSaveName,'id'=>2]);
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getSaveName();
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
$this->success('更新成功');
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}
}
| d554ed045caa54876fa4523e472c55f56a32d4fb | [
"PHP"
] | 4 | PHP | lurenjia1943/91gongkong | b64191d39540422f74844d29971a514cb94b46a6 | 7a8ec7ee301c270ce3f09eaf43183c798fd2eb3e |
refs/heads/master | <repo_name>killerbees/creep<file_sep>/README.md
# Creep pyGame
This project is a fun introduction to pyGame and game development. It's currently a WIP, pull requests welcome!
## Installation
##### 1. Install Python and pyGame
```bash
apt-get install python-pygame
```
##### 2. Run the game!
```bash
python game.py
```
## Controls
- Left mouse button adds creeps at pointer.
- Mouse button four and five (wheel scroll up/down) changes type added.
- any key quits
## Documentation
>### game.py
>This is just a simple launcher.
>
>
>### Creep.py
> `Creep.py` is the main game code.
>
> `CreepGame` class is the game, the main game loop is in `CreepGame.runGame`.
```python
def runGame(self):
while True:
time_passed = self.clock.tick(self.fps)
self.handleInputEvents()
self.updateCreeps(time_passed)
self.drawEverything()
return
```
>
> Event handlers are hooked up to events in `CreepGame.handleInputEvents`.
>
> `Creep` class is the creep itself, `CreepType` class is for creating types of creeps.
>
>>#### `Creep.update`
>>This is the method called by the game loop to allow the creep to do its stuff, it just moves around.
>
>>#### `Creep.collide`
>>this is the method called from the game loop to handle interactions for every combination of two creeps in the creeps collection. This is where all the proximity and collision behaviour is handled.
>
>### vect2d
> vec2d is useful for vector arithmetic.
## Roadmap
- [x] @killerbees initial commit
- [ ] ...
<file_sep>/game.py
from Creep import CreepGame
game = CreepGame()
game.runGame()
<file_sep>/Creep.py
import sys, pygame
from pygame.sprite import Sprite
from random import randint, choice, uniform
from vec2d import vec2d
import subprocess
import re
class CreepGame():
#some default numbers and initialisations
def __init__(self):
#we need pygame
pygame.init()
#we need a screen
self.screen = self.createScreen()
(w,h)=self.screen.get_size()
#spawnbox is the rectangle that we can create new sprites in
self.spawnBox = pygame.Rect(0,0,w,h) #our spawn box is the whole screen
self.clock = pygame.time.Clock() # clock is for "ticking" the game loop and regulating the fps
self.createCreepTypes() #define the "species"
# set up some default behaviour config for our game
self.bg_color = 0,0,0
self.nCreeps = 30 #min (and starting) number of creeps
self.fps=90 #max FPS
self.creepSeq=0 #sequence number for creep.id's
self.nextType=self.pinkType #initial creep type for the mouse click & wheel actions
# all of our sprites will belong to a pygame group
self.creeps = pygame.sprite.Group()
# create a pygame screen for a window or fullscreen
def createScreen(self):
print 'available resolutions', pygame.display.list_modes(0)
#@todo make this a command line switch
#the next two lines set up full screen options, to run in a window see below
screen_width, screen_height = pygame.display.list_modes(0)[0] # we use the 1st resolution which is the largest, and ought to give us the full multi-monitor
options = pygame.FULLSCREEN | pygame.HWSURFACE | pygame.DOUBLEBUF
#the next two lines set up windowed options - swap these with above to run full screen instead
#screen_width, screen_height = (0,0)
#options=0
#create the screen with the options
screen = pygame.display.set_mode(
(screen_width, screen_height), options)
print "screen created, size is:", screen.get_size()
return screen
#the Game Loop
# @see http://gameprogrammingpatterns.com/game-loop.html
def runGame(self):
while True:
time_passed = self.clock.tick(self.fps) #the game clock
self.handleInputEvents()
self.updateCreeps(time_passed)
self.drawEverything()
return
#when we update the creeps we need to know how much time has passed so that we can plot their new position from their speed and direction
#simples eh? :)
def updateCreeps(self,time_passed):
for creep in self.creeps:
#the next line calls "Collide" for each creep with all the other creeps
# this is the entry to the interaction between creeps
pygame.sprite.spritecollide(creep
, self.creeps
, False
, Creep.collide)
#then we update the creep,
#yes we do this before we've done all the other collides
#yes this will lead to some anomlaous behavour, where order in the list conveys an advantage in conflict
#no, we don't really care!
creep.update(time_passed)
#if they're dying off below the threshold spawn a new one of random type
#@todo make the starting number and the mimium threshold different
if len(self.creeps)<self.nCreeps:
type = choice([self.pinkType, self.blueType, self.greyType])
self.creepAdd(type)
def createCreepTypes(self):
print "creating creeps"
self.pinkType = CreepType()
self.pinkType.type='pink'
self.pinkType.filename='pinkcreep.png'
#self.pinkType.filename='petecreep.png'
self.pinkType.maxhealth=50
self.pinkType.spawnBox=self.spawnBox
self.blueType = CreepType()
self.blueType.type='blue'
self.blueType.filename='bluecreep.png'
self.blueType.maxhealth=50
self.blueType.spawnBox=self.spawnBox
self.greyType = CreepType()
self.greyType.type='grey'
self.greyType.filename='graycreep.png'
self.greyType.maxhealth=50
self.greyType.spawnBox=self.spawnBox
def creepAdd(self,type, pos =None):
self.creepSeq += 1
#give each one a unique name for debugging
id = type.type+"(%s)" % (self.creepSeq)
creep = Creep(type,id,pos)
#add her to the group
self.creeps.add(creep)
#order of creep types to cycle through on the mouse wheel
#@todo there must be a more elegant way to do this.
def cycleNext(self, by):
if by <0:
if self.nextType==self.pinkType:
self.nextType=self.blueType
elif self.nextType==self.blueType:
self.nextType=self.greyType
elif self.nextType==self.greyType:
self.nextType=self.pinkType
if by >0:
if self.nextType==self.pinkType:
self.nextType=self.greyType
elif self.nextType==self.blueType:
self.nextType=self.pinkType
elif self.nextType==self.greyType:
self.nextType=self.blueType
#this is where we register our event listeners
#yes, we're just calling methods
#@todo create proper event listeners
def handleInputEvents(self):
for event in pygame.event.get():
if(event.type == pygame.MOUSEBUTTONDOWN):
if(event.button==4): #wheel rotate
self.cycleNext(-1)
if(event.button==5): #wheel other rotate
self.cycleNext(+1)
if(event.button==1): #left click
self.creepAdd(self.nextType,event.pos)
if(event.type == pygame.KEYDOWN):
sys.exit(0) #quit on any key
if (event.type == pygame.QUIT): #pygame issues a quit event, for e.g. by closing the window
print "quitting"
sys.exit(0)
def drawEverything(self):
#we "blank" the whole display and redraw everything for each cycle of the game loop
#yes, this is possibly not the most efficient way to do it!
self.screen.fill(self.bg_color)
#this is where pygame helps us, it will draw all the sprites in the collection on our screen for us
self.creeps.draw(self.screen)
#blit the pygame screen to the display
pygame.display.flip()
# template for a Creep type
class CreepType(object):
def __init__(self):
self.type=None
self.filename=None
self.maxhealth=100 #100 is a default
def __str__(self):
return "type:"+self.type+" - maxhealth:"+str(self.maxhealth)
class Creep(Sprite):
def __init__(self, type, id, pos=None):
Sprite.__init__(self)
self.id = id
self.type=type
#load some init values from our chosen type
self.maxhealth=self.type.maxhealth
self.health=self.type.maxhealth
self.base_image = pygame.image.load(self.type.filename).convert_alpha()
#self.image will be changed (rotated in this case) base_image doesn't change
self.image = self.base_image
self.rect = self.image.get_rect()
#initial direction is towards the bottom right, it randmomises as soon as they spawn though
#we're using a vector library so we can do vector arithmetic with direction, rotation, speed and time.
self.direction = vec2d(1,1)
# @TODO different max/min speed per type
# speeds are in pixels per millisecond (are they? check..)
self.speedmax = 0.15
self.speedmin = 0.05
self.elapsed_time=0
#initial speed is random within the limits
#@todo replace "magic numbers" with configurable properties
self.curspeed = uniform(0.08,0.2)
#badly named variables, but direction is a vector property
self.direction.length = self.curspeed
if (pos):
#if we specify a starting position it should be for the centre of the sprite
self.rect.center = pos
else:
#otherwise just set random rect x & y somwehere in the spawn box and don't bother doing any arithmetic to find the centre
#yes this might cause glitching of sprites created at the edge
#no I don't care about that yet
self.rect.x = randint(type.spawnBox.x, type.spawnBox.w)
self.rect.y = randint(type.spawnBox.y, type.spawnBox.h)
#the mask is used by pygame to detect collisions
#pygame calculates the mask for us
# I <3 pygame :)
# each sprite has its own mask (rather than a mask per type)
#because the mask changes when the sprite rotates
#(unless its perfectly circular or rotates by exactly its angle of rotational symmetry)
self.mask = pygame.mask.from_surface(self.image)
#this randomises the initial direction
self.rotate(0,360)
def __str__(self):
#output some debugging info
return self.type.type+" creep:"+ self.id+" - health:"+str(self.health)+" - rect:"+str(self.rect)+" - direction:"+str(self.direction)
def update(self,time):
self.elapsed_time += time
# keep the little buggers on the screen...
#@todo make this more elegant
if self.rect.x < self.type.spawnBox.left:
self.rect.x = self.type.spawnBox.left
self.direction.x *= -1
self.rotate()
self.elapsed_time=0
elif self.rect.x > self.type.spawnBox.right-self.rect.w:
self.rect.x = self.type.spawnBox.right-self.rect.w
self.direction.x *= -1
self.rotate()
self.elapsed_time=0
elif self.rect.y < self.type.spawnBox.top:
self.rect.y = self.type.spawnBox.top
self.direction.y *= -1
self.rotate()
self.elapsed_time=0
elif self.rect.y > self.type.spawnBox.bottom-self.rect.h:
self.rect.y = self.type.spawnBox.bottom-self.rect.h
self.direction.y *= -1
self.rotate()
self.elapsed_time=0
# how long since we changed speed or direction?
#@todo make magic numbers into configuration items
# if its longer than a random time between 1/4 to 1/2 of a second since we changed speed or direction
if(self.elapsed_time>randint(250,500)):
#ok, lets mooch about
#reset the clock
self.elapsed_time=0
#change speed, slow down a bit
# acceleration is always in response to proximity to other types (percieved threat)
#@todo "magic number" - get rid
self.curspeed = self.curspeed * uniform(0.5,0.7)
# apply min speed limit, we don't want them to stop
if self.curspeed < self.speedmin:
self.curspeed = self.speedmin
#turn a bit (degrees)
self.rotate(-45,45)
#heal a bit
if self.health <= self.type.maxhealth:
self.health += 0.1
#distance = speed x time, yeah school maths, who'd'a thunk it.
self.direction.length = time * self.curspeed
# http://www.pygame.org/docs/ref/rect.html#pygame.Rect.move_ip
# self.direction is a vector, so you change the distance (above) and it presents as coordinates.
#cool, right?
self.rect.move_ip(self.direction)
# check for collisions and do the collision action
# this represents all the creep interaction behaviour
def collide(creep1, creep2):
#it seems silly to have to check for self-self collisions, pygame could filter this out but hey, I guess its empowering
if creep1.id != creep2.id:
if pygame.sprite.collide_mask(creep1, creep2): #if we actually bump
if(creep1.type != creep2.type and creep1.health<=creep2.health):
#because each collision will be handled twice, with each participant as "creep1"
#we only act when creep 1 is the weaker one
#creep1 turns
creep1.rotate(-30,30)
#creep1 gets hurt
creep1.health -=1
#creep2 looses health from the attack
creep2.health -=0.5
#if creep health is zero it is dead :-/
if creep1.health <= 0:
True
creep1.kill()
if creep2.health <= 0:
True
creep2.kill()
elif creep1.elapsed_time > randint(200, 500):
#at an interval, to mimic a lack of perfect awareness,
#we use Collide to check whether or not creep2 is "near" creep1
#the circle is 15* the diamater of the "size" of creep1
if (pygame.sprite.collide_circle_ratio(15)(creep1,creep2) ):
if creep1.type != creep2.type: #if they're not the same type
if creep1.health>creep2.health: #if creep1 is stronger
creep1.elapsed_time=0
creep2.curspeed = uniform(creep2.curspeed *1.2 , creep2.curspeed*1.3) #creep2 accelerates most because its fleeing
creep1.curspeed = uniform(creep1.curspeed *1.1 , creep1.curspeed*1.2) #creaap1 accelerates to attack
#apply max speed limits
if creep1.curspeed > creep1.speedmax:
creep1.curspeed = creep1.speedmax
if creep2.curspeed > creep2.speedmax:
creep2.curspeed = creep2.speedmax
#figure out the vector between the creep1 & 2
vec= vec2d(creep2.rect.x - creep1.rect.x,creep2.rect.y - creep1.rect.y)
if creep1.health>creep2.health: #if creep1 is stronger
creep1.rotate(creep1.direction.get_angle_between(vec)+randint(-10,10)) #creep1 turns towards creep2 (not perfectly) and the hunt is on!
else:
creep1.rotate(creep1.direction.get_angle_between(vec)-180+randint(-10,10)) #otherwise creep1 turns away!
if (pygame.sprite.collide_circle_ratio(10)(creep1,creep2) and creep1.health>=creep2.health and (creep1.type == creep2.type and creep1.elapsed_time >= 500)):
creep1.elapsed_time=0
vec= vec2d(creep2.rect.x - creep1.rect.x,creep2.rect.y - creep1.rect.y)
#when the creep types are the same, they slow down and turn towards one another
#this is the flocking behaviour
creep1.rotate(creep1.direction.get_angle_between(vec)+randint(-6,6))
creep1.curspeed = uniform(creep1.curspeed *0.7, creep1.curspeed*0.8)
def rotate(self, range_lo = 0, range_hi = None):
if range_hi:
angle = randint(range_lo, range_hi)
else:
angle = range_lo
self.direction.rotate(angle)
#self.direction.length = 1.4
self.image = pygame.transform.rotate(
self.base_image, -self.direction.angle)
self.mask = pygame.mask.from_surface(self.image)
| 50dd132c6512f986143d6fa7114ef9ba41be9224 | [
"Markdown",
"Python"
] | 3 | Markdown | killerbees/creep | 825b56de17c93396d99ab37db08b6ca96dd50db8 | 8be433d9d0bfce60c376d13976a6355a98874053 |
refs/heads/master | <file_sep>import React, { Component } from 'react'
import ColorBox from './ColorBox'
import Navbar from './Navbar';
import PaletteFooter from './PaletteFooter';
import './Pallete.css';
export default class Pallete extends Component {
constructor(props) {
super(props);
this.state = {level: 500, format: 'hex'};
this.changeLevel= this.changeLevel.bind(this);
this.changeFormat= this.changeFormat.bind(this);
}
changeLevel(level){
this.setState({level});
}
changeFormat(format){
this.setState({format});
}
render() {
const {colors, paletteName, emoji, id} = this.props.pallete;
const {level, format} = this.state;
const colorsBoxes = colors[level].map(
color => <ColorBox backgroundColor={color[format]} name={color.name} key={color.id} moreUrl={`/palette/${id}/${color.id}`} hasLink/>
);
return (
<div className='Pallete'>
<Navbar {...this.state} changeLevel={this.changeLevel} changeFormat={this.changeFormat} showingAllColors/>
<div className='Pallete-colors'>
{colorsBoxes}
</div>
<PaletteFooter paletteName={paletteName} emoji={emoji} />
</div>
)
}
}
<file_sep>import chroma from 'chroma-js';
const levels = [50 ,100, 200, 300, 400, 500, 600, 700, 800, 900];
const levelsCount = levels.length;
function generatePallete(starterPallete)
{
const newPalette = {
paletteName: starterPallete.paletteName,
id: starterPallete.id,
emoji: starterPallete.emoji,
colors: {}
}
for (let level of levels) {
newPalette.colors[level] = [];
}
for (let color of starterPallete.colors) {
let scale = getScale(color.color, levelsCount).reverse();
for (let i in scale) {
let rgbColor = chroma(scale[i]).css();
newPalette.colors[levels[i]].push({
name:`${color.name} ${levels[i]}`,
id: color.name.toLowerCase().replace(/ /g, '-'),
hex: scale[i],
rgb: rgbColor,
rgba: rgbColor.replace('rgb','rgba').replace(')',',1.0)')
});
}
}
return newPalette;
}
function getRange(hexaColor)
{
const end = '#fff';
const start = chroma(hexaColor).darken(1.4).hex();
return [start, hexaColor, end];
}
function getScale(hexaColor, numberOfColors)
{
return chroma
.scale(getRange(hexaColor))
.mode('lab')
.colors(numberOfColors);
}
export {generatePallete};<file_sep>import {Route, Switch} from 'react-router-dom';
import './App.css';
import {generatePallete} from './colorHelpers';
import Pallete from './Pallete';
import PalleteList from './PalleteList';
import seedColors from './seedColors';
import SingleColorPalette from './SingleColorPalette';
function App() {
const findPallete = (id) => seedColors.find(pallete => pallete.id === id );
return (
<Switch>
<Route exact path='/' render={(routeParams) => <PalleteList palletes={seedColors} {...routeParams}/>} />
<Route exact path='/palette/:id' render={routeParams => <Pallete pallete={generatePallete(findPallete(routeParams.match.params.id))}/>} />
<Route exact path='/palette/:paletteId/:colorId' render={(routeParams) =><SingleColorPalette palette={generatePallete(findPallete(routeParams.match.params.paletteId))} colorId={routeParams.match.params.colorId}/>} />
</Switch>
);
}
export default App;
| db290dbc9c4d3c8c7e8f891cd610a68d437994dd | [
"JavaScript"
] | 3 | JavaScript | mohammed-elattar/ColorsApp | 1a4cd36a0eac317aa1bb01593ae8e38fb902ed9f | 81314aa36d4b078a3417b0efabe2c77f0de83689 |
refs/heads/master | <file_sep>/**
* GPS Functions
*/
function gpsSuccess( position )
{
alert('ready');
/*
$('[name="review[user_long]"]').val( position.coords.longitude );
$('[name="review[user_lat]"]').val( position.coords.latitude );
*/
/*
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
*/
}
function gpsFailure( error )
{
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
function getPosition()
{
navigator.geolocation.getCurrentPosition(gpsSuccess, gpsFailure);
}
function vibrate( type )
{
var type = type || "default";
switch( type ){
case 'default':
navigator.vibrate([9]);
break;
case 'error':
navigator.vibrate([385,60,125]);
break;
case 'success':
navigator.vibrate([150,60,150,60,150]);
break;
}
}
<file_sep># CIS 2460 Final
## Project
This is an android app, written with Cordova. The title is called LottaNotes and the purpose general purpose is to create a simple CRUD structure that invokes device specific functions. See below for more details.
### Project Requirements
* Must require user input of some form other than menu/link clicking.
> The application takes in data in the form of a user profile and it allows for entry of notes into system in forms.
* Must require a user account system of some sort to differentiate different users using the app on different devices.
> Application has a registration and login process.
* Must be multiple pages, Minimum of 5 pages required.
> Application has 8 total routed pages routed using AngularJS.
* Must be Menu Driven. Style the menu to be attractive. No default styles for whatever CSS/JS framework you are using.
> Styled used [MaterializeCSS](https://materializecss.com/) customized the colors and layouts to extend beyond the default Materialize.
* Must use a MySQL database and be able to store data to, and pull data from it.
> Uses a MySQL database with PHP as the intermediary.
* App must take in and store data from the user in one form or another.
* Data must be reloadable when a user reloads the app
* Data must be editable or parts of it must be editable
* Option to Delete part of the data or all of the data
> As above there are forms in the application that follow the full CRUD cycle.
* Must use both user provided images, as well as images you have created to make the app visually appealing.
> App uses default profile images and allows for the addition of images using the camera
* Must utilize Cordova’s Camera and GPS functions in one way or another.
> The location of where a user was when a note was recorded is built into the app and the ability to take a photo for your user profile is present
* An additional Cordova plug-in not taught in this semester must be added to the app. For help go to the following address and pick an item to add.
* [https://www.tutorialspoint.com/cordova/index.htm](https://www.tutorialspoint.com/cordova/index.htm "Tutorials Point")
> The additional plug-in I chose is the vibration plugin. I created a default touch vibration, an error vibrations, and a success vibration so that the user can differentiate without the need for alerts.
<file_sep>/**
* Create handler for sidemenu navigation system
*/
var nav = document.querySelector('.sidenav');
M.Sidenav.init( nav, { });
nav.querySelectorAll('.sidenav a').forEach(function( ele ){
ele.addEventListener('click', function(){
nav.M_Sidenav.close();
});
});
var pictureSource, destinationType;
document.addEventListener('deviceready', function(){
pictureSource = navigator.camera.pictureSourceType.CAMERA;
destinationType = navigator.camera.DestinationType.DATA_URL;
//destinationType = navigator.camera.DestinationType.FILE_URI;
}, false);
| 62aa7c9e2ee1e8c78b6e408b2b02be8cebb5c8b1 | [
"JavaScript",
"Markdown"
] | 3 | JavaScript | lpshanley/CIS2640-Final | b465e360b0a0d45f29d0df9722d0faa91126fe20 | a92dae5a03877f0a44bc3f593d679fe25fa3be46 |
refs/heads/master | <file_sep>/* mpc_common.c: Common C-code for MPC_SFUN.C and MPCLOOP_ENGINE.C */
/*
Author: <NAME>
Initial function prototype by <NAME> (2001-2002)
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.17 $ $Date: 2009/08/08 01:11:22 $
*/
/* Merge dantzgmp source */
#include "dantzgmp_solver.c"
/* GETRV */
static void getrv(real_T *window, real_T *signal, int_T t1, int_T t2, int_T n, int_T m, int_T len)
{ /* function required for previewing reference and measured disturbance signals
Defines window=signal(1:n,t1+1:t2+1), where [m,t2-t1+1]=size(window)
if signal has enough columns, otherwise repeats the last column
([n,len]=size(signal))
*/
/* Counters */
int_T i,j;
#ifdef DEBUG
printf("t1: %d, t2: %d\n",t1,t2);
#endif
if (t1+1>len) { /* repeats the last one */
/* window=signal(:,len)*ones(1,t2-t1+1); */
for (i=0;i<t2-t1+1;i++) {
for (j=0;j<n;j++) {
window[i*m+j]=signal[n*(len-1)+j];
}
}
}
else if (t2+1>len) {
/* window=[signal(:,t1+1:len),signal(:,len)*ones(1,t2+1-len)]; */
for (i=0;i<len-t1+1;i++) {
for (j=0;j<n;j++) {
window[i*m+j]=signal[n*(t1+i)+j];
}
}
for (i=len-t1;i<t2-t1+1;i++) {
for (j=0;j<n;j++) {
window[i*m+j]=signal[n*(len-1)+j];
}
}
}
else {
/* window=signal(:,t1+1:t2+1); */
for (i=0;i<t2-t1+1;i++) {
for (j=0;j<n;j++) {
window[i*m+j]=signal[n*(t1+i)+j];
}
}
}
#ifdef DEBUG
for (i=0; i<t2-t1+1; i++)
for (j=0; j<m; j++)
printf("window(%d,%d): %5.2f\n",j,i,window[m*i+j]);
#endif
}
<file_sep>/* Include files */
#include "blascompat32.h"
#include "MPC_gamecontroller_LiDAR2_sfun.h"
#include "c1_MPC_gamecontroller_LiDAR2.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "MPC_gamecontroller_LiDAR2_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c1_debug_family_names[8] = { "nargin", "nargout", "direction",
"throttle", "neutral", "kill", "last_state", "steer" };
/* Function Declarations */
static void initialize_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void initialize_params_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void enable_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void disable_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void c1_update_debugger_state_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static const mxArray *get_sim_state_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void set_sim_state_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c1_st);
static void finalize_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void sf_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber);
static const mxArray *c1_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_b_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_c_sf_marshall(void *chartInstanceVoid, void *c1_u);
static void c1_emlrt_marshallIn(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c1_steer, const char_T *c1_name, real_T c1_y[3]);
static uint8_T c1_b_emlrt_marshallIn
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c1_b_is_active_c1_MPC_gamecontroller_LiDAR2, const char_T *c1_name);
static void init_dsm_address_info(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c1_is_active_c1_MPC_gamecontroller_LiDAR2 = 0U;
}
static void initialize_params_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void enable_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c1_update_debugger_state_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
const mxArray *c1_st = NULL;
const mxArray *c1_y = NULL;
int32_T c1_i0;
real_T c1_hoistedGlobal[3];
int32_T c1_i1;
real_T c1_u[3];
const mxArray *c1_b_y = NULL;
uint8_T c1_b_hoistedGlobal;
uint8_T c1_b_u;
const mxArray *c1_c_y = NULL;
real_T (*c1_steer)[3];
c1_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c1_st = NULL;
c1_y = NULL;
sf_mex_assign(&c1_y, sf_mex_createcellarray(2));
for (c1_i0 = 0; c1_i0 < 3; c1_i0 = c1_i0 + 1) {
c1_hoistedGlobal[c1_i0] = (*c1_steer)[c1_i0];
}
for (c1_i1 = 0; c1_i1 < 3; c1_i1 = c1_i1 + 1) {
c1_u[c1_i1] = c1_hoistedGlobal[c1_i1];
}
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_u, 0, 0U, 1U, 0U, 1, 3));
sf_mex_setcell(c1_y, 0, c1_b_y);
c1_b_hoistedGlobal = chartInstance->c1_is_active_c1_MPC_gamecontroller_LiDAR2;
c1_b_u = c1_b_hoistedGlobal;
c1_c_y = NULL;
sf_mex_assign(&c1_c_y, sf_mex_create("y", &c1_b_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c1_y, 1, c1_c_y);
sf_mex_assign(&c1_st, c1_y);
return c1_st;
}
static void set_sim_state_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c1_st)
{
const mxArray *c1_u;
real_T c1_dv0[3];
int32_T c1_i2;
real_T (*c1_steer)[3];
c1_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c1_doneDoubleBufferReInit = TRUE;
c1_u = sf_mex_dup(c1_st);
c1_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 0)),
"steer", c1_dv0);
for (c1_i2 = 0; c1_i2 < 3; c1_i2 = c1_i2 + 1) {
(*c1_steer)[c1_i2] = c1_dv0[c1_i2];
}
chartInstance->c1_is_active_c1_MPC_gamecontroller_LiDAR2 =
c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 1))
, "is_active_c1_MPC_gamecontroller_LiDAR2");
sf_mex_destroy(&c1_u);
c1_update_debugger_state_c1_MPC_gamecontroller_LiDAR2(chartInstance);
sf_mex_destroy(&c1_st);
}
static void finalize_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void sf_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
int32_T c1_i3;
int32_T c1_i4;
int32_T c1_i5;
int32_T c1_previousEvent;
real_T c1_hoistedGlobal;
real_T c1_b_hoistedGlobal;
int32_T c1_i6;
real_T c1_c_hoistedGlobal[3];
boolean_T c1_d_hoistedGlobal;
int32_T c1_i7;
real_T c1_e_hoistedGlobal[3];
real_T c1_direction;
real_T c1_throttle;
int32_T c1_i8;
real_T c1_neutral[3];
boolean_T c1_kill;
int32_T c1_i9;
real_T c1_last_state[3];
uint32_T c1_debug_family_var_map[8];
real_T c1_nargin = 5.0;
real_T c1_nargout = 1.0;
real_T c1_steer[3];
int32_T c1_i10;
int32_T c1_i11;
int32_T c1_i12;
real_T *c1_b_direction;
real_T *c1_b_throttle;
boolean_T *c1_b_kill;
real_T (*c1_b_steer)[3];
real_T (*c1_b_last_state)[3];
real_T (*c1_b_neutral)[3];
c1_b_last_state = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 4);
c1_b_kill = (boolean_T *)ssGetInputPortSignal(chartInstance->S, 3);
c1_b_neutral = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 2);
c1_b_throttle = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c1_b_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c1_b_direction = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0);
_SFD_DATA_RANGE_CHECK(*c1_b_direction, 0U);
for (c1_i3 = 0; c1_i3 < 3; c1_i3 = c1_i3 + 1) {
_SFD_DATA_RANGE_CHECK((*c1_b_steer)[c1_i3], 1U);
}
_SFD_DATA_RANGE_CHECK(*c1_b_throttle, 2U);
for (c1_i4 = 0; c1_i4 < 3; c1_i4 = c1_i4 + 1) {
_SFD_DATA_RANGE_CHECK((*c1_b_neutral)[c1_i4], 3U);
}
_SFD_DATA_RANGE_CHECK((real_T)*c1_b_kill, 4U);
for (c1_i5 = 0; c1_i5 < 3; c1_i5 = c1_i5 + 1) {
_SFD_DATA_RANGE_CHECK((*c1_b_last_state)[c1_i5], 5U);
}
c1_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0);
c1_hoistedGlobal = *c1_b_direction;
c1_b_hoistedGlobal = *c1_b_throttle;
for (c1_i6 = 0; c1_i6 < 3; c1_i6 = c1_i6 + 1) {
c1_c_hoistedGlobal[c1_i6] = (*c1_b_neutral)[c1_i6];
}
c1_d_hoistedGlobal = *c1_b_kill;
for (c1_i7 = 0; c1_i7 < 3; c1_i7 = c1_i7 + 1) {
c1_e_hoistedGlobal[c1_i7] = (*c1_b_last_state)[c1_i7];
}
c1_direction = c1_hoistedGlobal;
c1_throttle = c1_b_hoistedGlobal;
for (c1_i8 = 0; c1_i8 < 3; c1_i8 = c1_i8 + 1) {
c1_neutral[c1_i8] = c1_c_hoistedGlobal[c1_i8];
}
c1_kill = c1_d_hoistedGlobal;
for (c1_i9 = 0; c1_i9 < 3; c1_i9 = c1_i9 + 1) {
c1_last_state[c1_i9] = c1_e_hoistedGlobal[c1_i9];
}
sf_debug_symbol_scope_push_eml(0U, 8U, 8U, c1_debug_family_names,
c1_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c1_nargin, c1_c_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c1_nargout, c1_c_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c1_direction, c1_c_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c1_throttle, c1_c_sf_marshall, 3U);
sf_debug_symbol_scope_add_eml(c1_neutral, c1_sf_marshall, 4U);
sf_debug_symbol_scope_add_eml(&c1_kill, c1_b_sf_marshall, 5U);
sf_debug_symbol_scope_add_eml(c1_last_state, c1_sf_marshall, 6U);
sf_debug_symbol_scope_add_eml(c1_steer, c1_sf_marshall, 7U);
CV_EML_FCN(0, 0);
/* #codegen */
_SFD_EML_CALL(0, 3);
if (CV_EML_IF(0, 0, c1_kill)) {
_SFD_EML_CALL(0, 4);
for (c1_i10 = 0; c1_i10 < 3; c1_i10 = c1_i10 + 1) {
c1_steer[c1_i10] = c1_neutral[c1_i10];
}
} else {
_SFD_EML_CALL(0, 6);
for (c1_i11 = 0; c1_i11 < 3; c1_i11 = c1_i11 + 1) {
c1_steer[c1_i11] = c1_last_state[c1_i11];
}
_SFD_EML_CALL(0, 7);
c1_steer[1] = c1_direction;
_SFD_EML_CALL(0, 8);
c1_steer[2] = c1_throttle;
}
_SFD_EML_CALL(0, -8);
sf_debug_symbol_scope_pop();
for (c1_i12 = 0; c1_i12 < 3; c1_i12 = c1_i12 + 1) {
(*c1_b_steer)[c1_i12] = c1_steer[c1_i12];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0);
_sfEvent_ = c1_previousEvent;
sf_debug_check_for_state_inconsistency
(_MPC_gamecontroller_LiDAR2MachineNumber_, chartInstance->chartNumber,
chartInstance->
instanceNumber);
}
static void compInitSubchartSimstructsFcn_c1_MPC_gamecontroller_LiDAR2
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber)
{
}
static const mxArray *c1_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
const mxArray *c1_y = NULL;
int32_T c1_i13;
real_T c1_b_u[3];
int32_T c1_i14;
real_T c1_c_u[3];
const mxArray *c1_b_y = NULL;
SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c1_y = NULL;
for (c1_i13 = 0; c1_i13 < 3; c1_i13 = c1_i13 + 1) {
c1_b_u[c1_i13] = (*((real_T (*)[3])c1_u))[c1_i13];
}
for (c1_i14 = 0; c1_i14 < 3; c1_i14 = c1_i14 + 1) {
c1_c_u[c1_i14] = c1_b_u[c1_i14];
}
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_c_u, 0, 0U, 1U, 0U, 1, 3));
sf_mex_assign(&c1_y, c1_b_y);
return c1_y;
}
static const mxArray *c1_b_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
const mxArray *c1_y = NULL;
boolean_T c1_b_u;
const mxArray *c1_b_y = NULL;
SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c1_y = NULL;
c1_b_u = *((boolean_T *)c1_u);
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c1_y, c1_b_y);
return c1_y;
}
static const mxArray *c1_c_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
const mxArray *c1_y = NULL;
real_T c1_b_u;
const mxArray *c1_b_y = NULL;
SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c1_y = NULL;
c1_b_u = *((real_T *)c1_u);
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c1_y, c1_b_y);
return c1_y;
}
const mxArray *sf_c1_MPC_gamecontroller_LiDAR2_get_eml_resolved_functions_info
(void)
{
const mxArray *c1_nameCaptureInfo = NULL;
c1_nameCaptureInfo = NULL;
sf_mex_assign(&c1_nameCaptureInfo, sf_mex_create("nameCaptureInfo", NULL, 0,
0U, 1U, 0U, 2, 0, 1));
return c1_nameCaptureInfo;
}
static void c1_emlrt_marshallIn(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c1_steer, const char_T *
c1_name, real_T c1_y[3])
{
real_T c1_dv1[3];
int32_T c1_i15;
sf_mex_import(c1_name, sf_mex_dup(c1_steer), c1_dv1, 1, 0, 0U, 1, 0U, 1, 3);
for (c1_i15 = 0; c1_i15 < 3; c1_i15 = c1_i15 + 1) {
c1_y[c1_i15] = c1_dv1[c1_i15];
}
sf_mex_destroy(&c1_steer);
}
static uint8_T c1_b_emlrt_marshallIn
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c1_b_is_active_c1_MPC_gamecontroller_LiDAR2, const char_T *c1_name)
{
uint8_T c1_y;
uint8_T c1_u0;
sf_mex_import(c1_name, sf_mex_dup(c1_b_is_active_c1_MPC_gamecontroller_LiDAR2),
&c1_u0, 1, 3, 0U, 0, 0U, 0);
c1_y = c1_u0;
sf_mex_destroy(&c1_b_is_active_c1_MPC_gamecontroller_LiDAR2);
return c1_y;
}
static void init_dsm_address_info(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c1_MPC_gamecontroller_LiDAR2_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1142048441U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1744090243U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(3507797465U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3611325734U);
}
mxArray *sf_c1_MPC_gamecontroller_LiDAR2_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(2050016041U);
pr[1] = (double)(330744281U);
pr[2] = (double)(2619954881U);
pr[3] = (double)(3928456335U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,5,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,2,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,2,"type",mxType);
}
mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,3,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(1));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,3,"type",mxType);
}
mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,4,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,4,"type",mxType);
}
mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR2(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x2'type','srcId','name','auxInfo'{{M[1],M[5],T\"steer\",},{M[8],M[0],T\"is_active_c1_MPC_gamecontroller_LiDAR2\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c1_MPC_gamecontroller_LiDAR2_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_MPC_gamecontroller_LiDAR2MachineNumber_,
1,
1,
1,
6,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
1);
sf_debug_set_chart_event_thresholds
(_MPC_gamecontroller_LiDAR2MachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"direction");
_SFD_SET_DATA_PROPS(1,2,0,1,"steer");
_SFD_SET_DATA_PROPS(2,1,1,0,"throttle");
_SFD_SET_DATA_PROPS(3,1,1,0,"neutral");
_SFD_SET_DATA_PROPS(4,1,1,0,"kill");
_SFD_SET_DATA_PROPS(5,1,1,0,"last_state");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,200);
_SFD_CV_INIT_EML_IF(0,0,91,99,120,198);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c1_c_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c1_sf_marshall);
}
_SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c1_c_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c1_sf_marshall);
}
_SFD_SET_DATA_COMPILED_PROPS(4,SF_UINT8,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c1_b_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(5,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c1_sf_marshall);
}
{
real_T *c1_direction;
real_T *c1_throttle;
boolean_T *c1_kill;
real_T (*c1_steer)[3];
real_T (*c1_neutral)[3];
real_T (*c1_last_state)[3];
c1_last_state = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S,
4);
c1_kill = (boolean_T *)ssGetInputPortSignal(chartInstance->S, 3);
c1_neutral = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 2);
c1_throttle = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c1_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c1_direction = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, c1_direction);
_SFD_SET_DATA_VALUE_PTR(1U, *c1_steer);
_SFD_SET_DATA_VALUE_PTR(2U, c1_throttle);
_SFD_SET_DATA_VALUE_PTR(3U, *c1_neutral);
_SFD_SET_DATA_VALUE_PTR(4U, c1_kill);
_SFD_SET_DATA_VALUE_PTR(5U, *c1_last_state);
}
}
} else {
sf_debug_reset_current_state_configuration
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c1_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
chart_debug_initialization(((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
initialize_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_enable_c1_MPC_gamecontroller_LiDAR2(void *chartInstanceVar)
{
enable_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_disable_c1_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
disable_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_gateway_c1_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
sf_c1_MPC_gamecontroller_LiDAR2((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c1_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c1_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c1_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
return sf_internal_get_sim_state_c1_MPC_gamecontroller_LiDAR2(S);
}
static void sf_opaque_set_sim_state_c1_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
sf_internal_set_sim_state_c1_MPC_gamecontroller_LiDAR2(S, st);
}
static void sf_opaque_terminate_c1_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c1_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c1_MPC_gamecontroller_LiDAR2
((SFc1_MPC_gamecontroller_LiDAR2InstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c1_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",1);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",1,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
"MPC_gamecontroller_LiDAR2","MPC_gamecontroller_LiDAR2",1,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 3, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 4, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",1,5);
sf_mark_chart_reusable_outputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",1,1);
}
sf_set_rtw_dwork_info(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",1);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(3030888801U));
ssSetChecksum1(S,(1367534193U));
ssSetChecksum2(S,(2627526701U));
ssSetChecksum3(S,(533223346U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c1_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",1);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c1_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDAR2InstanceStruct *)malloc(sizeof
(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct));
memset(chartInstance, 0, sizeof(SFc1_MPC_gamecontroller_LiDAR2InstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlStart = mdlStart_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c1_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c1_MPC_gamecontroller_LiDAR2_method_dispatcher(SimStruct *S, int_T method,
void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c1_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c1_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c1_MPC_gamecontroller_LiDAR2(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c1_MPC_gamecontroller_LiDAR2_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
<file_sep>/* Include files */
#include "blascompat32.h"
#include "MPC_gamecontroller_LiDAR2_sfun.h"
#include "c2_MPC_gamecontroller_LiDAR2.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "MPC_gamecontroller_LiDAR2_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c2_debug_family_names[14] = { "velocity", "Phi_d", "Phi",
"Psi_d", "Psi", "Vy", "Vx", "nargin", "nargout", "roll", "wheel_speeds", "yaw",
"RRT_state", "MPC_state" };
/* Function Declarations */
static void initialize_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void initialize_params_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void enable_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void disable_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static const mxArray *get_sim_state_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void set_sim_state_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c2_st);
static void finalize_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void sf_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber);
static const mxArray *c2_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_b_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_c_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_d_sf_marshall(void *chartInstanceVoid, void *c2_u);
static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[18]);
static const mxArray *c2_e_sf_marshall(void *chartInstanceVoid, void *c2_u);
static void c2_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c2_MPC_state, const char_T *c2_name, real_T
c2_y[6]);
static void c2_b_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c2_RRT_state, const char_T *c2_name, real_T
c2_y[4]);
static uint8_T c2_c_emlrt_marshallIn
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c2_b_is_active_c2_MPC_gamecontroller_LiDAR2, const char_T *c2_name);
static void init_dsm_address_info(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c2_is_active_c2_MPC_gamecontroller_LiDAR2 = 0U;
}
static void initialize_params_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void enable_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c2_update_debugger_state_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
const mxArray *c2_st = NULL;
const mxArray *c2_y = NULL;
int32_T c2_i0;
real_T c2_hoistedGlobal[6];
int32_T c2_i1;
real_T c2_u[6];
const mxArray *c2_b_y = NULL;
int32_T c2_i2;
real_T c2_b_hoistedGlobal[4];
int32_T c2_i3;
real_T c2_b_u[4];
const mxArray *c2_c_y = NULL;
uint8_T c2_c_hoistedGlobal;
uint8_T c2_c_u;
const mxArray *c2_d_y = NULL;
real_T (*c2_RRT_state)[4];
real_T (*c2_MPC_state)[6];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
c2_st = NULL;
c2_y = NULL;
sf_mex_assign(&c2_y, sf_mex_createcellarray(3));
for (c2_i0 = 0; c2_i0 < 6; c2_i0 = c2_i0 + 1) {
c2_hoistedGlobal[c2_i0] = (*c2_MPC_state)[c2_i0];
}
for (c2_i1 = 0; c2_i1 < 6; c2_i1 = c2_i1 + 1) {
c2_u[c2_i1] = c2_hoistedGlobal[c2_i1];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_u, 0, 0U, 1U, 0U, 1, 6));
sf_mex_setcell(c2_y, 0, c2_b_y);
for (c2_i2 = 0; c2_i2 < 4; c2_i2 = c2_i2 + 1) {
c2_b_hoistedGlobal[c2_i2] = (*c2_RRT_state)[c2_i2];
}
for (c2_i3 = 0; c2_i3 < 4; c2_i3 = c2_i3 + 1) {
c2_b_u[c2_i3] = c2_b_hoistedGlobal[c2_i3];
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", c2_b_u, 0, 0U, 1U, 0U, 1, 4));
sf_mex_setcell(c2_y, 1, c2_c_y);
c2_c_hoistedGlobal = chartInstance->c2_is_active_c2_MPC_gamecontroller_LiDAR2;
c2_c_u = c2_c_hoistedGlobal;
c2_d_y = NULL;
sf_mex_assign(&c2_d_y, sf_mex_create("y", &c2_c_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c2_y, 2, c2_d_y);
sf_mex_assign(&c2_st, c2_y);
return c2_st;
}
static void set_sim_state_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c2_st)
{
const mxArray *c2_u;
real_T c2_dv0[6];
int32_T c2_i4;
real_T c2_dv1[4];
int32_T c2_i5;
real_T (*c2_MPC_state)[6];
real_T (*c2_RRT_state)[4];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c2_doneDoubleBufferReInit = TRUE;
c2_u = sf_mex_dup(c2_st);
c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 0)),
"MPC_state", c2_dv0);
for (c2_i4 = 0; c2_i4 < 6; c2_i4 = c2_i4 + 1) {
(*c2_MPC_state)[c2_i4] = c2_dv0[c2_i4];
}
c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 1)),
"RRT_state", c2_dv1);
for (c2_i5 = 0; c2_i5 < 4; c2_i5 = c2_i5 + 1) {
(*c2_RRT_state)[c2_i5] = c2_dv1[c2_i5];
}
chartInstance->c2_is_active_c2_MPC_gamecontroller_LiDAR2 =
c2_c_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 2))
, "is_active_c2_MPC_gamecontroller_LiDAR2");
sf_mex_destroy(&c2_u);
c2_update_debugger_state_c2_MPC_gamecontroller_LiDAR2(chartInstance);
sf_mex_destroy(&c2_st);
}
static void finalize_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void sf_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
int32_T c2_i6;
int32_T c2_i7;
int32_T c2_i8;
int32_T c2_i9;
int32_T c2_i10;
int32_T c2_previousEvent;
int32_T c2_i11;
real_T c2_hoistedGlobal[2];
int32_T c2_i12;
real_T c2_b_hoistedGlobal[4];
int32_T c2_i13;
real_T c2_c_hoistedGlobal[2];
int32_T c2_i14;
real_T c2_roll[2];
int32_T c2_i15;
real_T c2_wheel_speeds[4];
int32_T c2_i16;
real_T c2_yaw[2];
uint32_T c2_debug_family_var_map[14];
real_T c2_velocity;
real_T c2_Phi_d;
real_T c2_Phi;
real_T c2_Psi_d;
real_T c2_Psi;
real_T c2_Vy;
real_T c2_Vx;
real_T c2_nargin = 3.0;
real_T c2_nargout = 2.0;
real_T c2_RRT_state[4];
real_T c2_MPC_state[6];
real_T c2_A;
real_T c2_x;
real_T c2_b_x;
real_T c2_c_x;
real_T c2_a;
real_T c2_y;
real_T c2_b_y[6];
int32_T c2_i17;
real_T c2_dv2[4];
int32_T c2_i18;
int32_T c2_i19;
int32_T c2_i20;
real_T (*c2_b_RRT_state)[4];
real_T (*c2_b_MPC_state)[6];
real_T (*c2_b_yaw)[2];
real_T (*c2_b_wheel_speeds)[4];
real_T (*c2_b_roll)[2];
c2_b_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_b_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
c2_b_yaw = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
c2_b_wheel_speeds = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 1);
c2_b_roll = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1);
for (c2_i6 = 0; c2_i6 < 2; c2_i6 = c2_i6 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_roll)[c2_i6], 0U);
}
for (c2_i7 = 0; c2_i7 < 4; c2_i7 = c2_i7 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_wheel_speeds)[c2_i7], 1U);
}
for (c2_i8 = 0; c2_i8 < 2; c2_i8 = c2_i8 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_yaw)[c2_i8], 2U);
}
for (c2_i9 = 0; c2_i9 < 4; c2_i9 = c2_i9 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_RRT_state)[c2_i9], 3U);
}
for (c2_i10 = 0; c2_i10 < 6; c2_i10 = c2_i10 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_MPC_state)[c2_i10], 4U);
}
c2_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1);
for (c2_i11 = 0; c2_i11 < 2; c2_i11 = c2_i11 + 1) {
c2_hoistedGlobal[c2_i11] = (*c2_b_roll)[c2_i11];
}
for (c2_i12 = 0; c2_i12 < 4; c2_i12 = c2_i12 + 1) {
c2_b_hoistedGlobal[c2_i12] = (*c2_b_wheel_speeds)[c2_i12];
}
for (c2_i13 = 0; c2_i13 < 2; c2_i13 = c2_i13 + 1) {
c2_c_hoistedGlobal[c2_i13] = (*c2_b_yaw)[c2_i13];
}
for (c2_i14 = 0; c2_i14 < 2; c2_i14 = c2_i14 + 1) {
c2_roll[c2_i14] = c2_hoistedGlobal[c2_i14];
}
for (c2_i15 = 0; c2_i15 < 4; c2_i15 = c2_i15 + 1) {
c2_wheel_speeds[c2_i15] = c2_b_hoistedGlobal[c2_i15];
}
for (c2_i16 = 0; c2_i16 < 2; c2_i16 = c2_i16 + 1) {
c2_yaw[c2_i16] = c2_c_hoistedGlobal[c2_i16];
}
sf_debug_symbol_scope_push_eml(0U, 14U, 14U, c2_debug_family_names,
c2_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c2_velocity, c2_d_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c2_Phi_d, c2_d_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c2_Phi, c2_d_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c2_Psi_d, c2_d_sf_marshall, 3U);
sf_debug_symbol_scope_add_eml(&c2_Psi, c2_d_sf_marshall, 4U);
sf_debug_symbol_scope_add_eml(&c2_Vy, c2_d_sf_marshall, 5U);
sf_debug_symbol_scope_add_eml(&c2_Vx, c2_d_sf_marshall, 6U);
sf_debug_symbol_scope_add_eml(&c2_nargin, c2_d_sf_marshall, 7U);
sf_debug_symbol_scope_add_eml(&c2_nargout, c2_d_sf_marshall, 8U);
sf_debug_symbol_scope_add_eml(c2_roll, c2_c_sf_marshall, 9U);
sf_debug_symbol_scope_add_eml(c2_wheel_speeds, c2_b_sf_marshall, 10U);
sf_debug_symbol_scope_add_eml(c2_yaw, c2_c_sf_marshall, 11U);
sf_debug_symbol_scope_add_eml(c2_RRT_state, c2_b_sf_marshall, 12U);
sf_debug_symbol_scope_add_eml(c2_MPC_state, c2_sf_marshall, 13U);
CV_EML_FCN(0, 0);
/* Updated: May 5th, 2013 */
/* This function takes the scaled data from the IMU and uses it to determine */
/* the vehicle states for the RRT and the MPC. Note that the state of the */
/* vehicle is always [0 0 Yaw V] as the coordinate system is bases on the */
/* postion of the vehicle. */
/* DATA SORTING */
/* Calculate the vehicle velocity from the wheel encoder data. this should */
/* be replaced with a more robust method as this neglects the fact that the */
/* vechicle may be turning as well as wheel slip */
_SFD_EML_CALL(0, 14);
c2_A = ((c2_wheel_speeds[0] + c2_wheel_speeds[1]) + c2_wheel_speeds[2]) +
c2_wheel_speeds[3];
c2_x = c2_A;
c2_b_x = c2_x;
c2_c_x = c2_b_x;
c2_velocity = c2_c_x / 4.0;
_SFD_EML_CALL(0, 17);
c2_Phi_d = c2_roll[0];
/* Roll Rate */
_SFD_EML_CALL(0, 18);
c2_Phi = c2_roll[1];
/* Roll Angle */
_SFD_EML_CALL(0, 19);
c2_Psi_d = c2_yaw[0];
/* Yaw Rate */
_SFD_EML_CALL(0, 20);
c2_Psi = c2_yaw[1];
/* Yaw angle of the road relative to the */
/* centerline of the car */
_SFD_EML_CALL(0, 23);
c2_Vy = c2_velocity;
/* Velocity of the vehicle */
_SFD_EML_CALL(0, 25);
c2_Vx = 0.0;
/* Always 0 as the Coordinates are */
/* determined by the direction of the car */
_SFD_EML_CALL(0, 29);
c2_a = c2_Vy;
c2_y = c2_a * 0.3048780487804878;
c2_b_y[0] = c2_y;
c2_b_y[1] = 0.0;
c2_b_y[2] = c2_Phi_d;
c2_b_y[3] = c2_Phi;
c2_b_y[4] = c2_Psi_d;
c2_b_y[5] = c2_Psi;
for (c2_i17 = 0; c2_i17 < 6; c2_i17 = c2_i17 + 1) {
c2_MPC_state[c2_i17] = c2_b_y[c2_i17];
}
_SFD_EML_CALL(0, 30);
c2_dv2[0] = 0.0;
c2_dv2[1] = 0.0;
c2_dv2[2] = c2_Psi;
c2_dv2[3] = c2_velocity;
for (c2_i18 = 0; c2_i18 < 4; c2_i18 = c2_i18 + 1) {
c2_RRT_state[c2_i18] = c2_dv2[c2_i18];
}
_SFD_EML_CALL(0, -30);
sf_debug_symbol_scope_pop();
for (c2_i19 = 0; c2_i19 < 4; c2_i19 = c2_i19 + 1) {
(*c2_b_RRT_state)[c2_i19] = c2_RRT_state[c2_i19];
}
for (c2_i20 = 0; c2_i20 < 6; c2_i20 = c2_i20 + 1) {
(*c2_b_MPC_state)[c2_i20] = c2_MPC_state[c2_i20];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1);
_sfEvent_ = c2_previousEvent;
sf_debug_check_for_state_inconsistency
(_MPC_gamecontroller_LiDAR2MachineNumber_, chartInstance->chartNumber,
chartInstance->
instanceNumber);
}
static void compInitSubchartSimstructsFcn_c2_MPC_gamecontroller_LiDAR2
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber)
{
}
static const mxArray *c2_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
int32_T c2_i21;
real_T c2_b_u[6];
int32_T c2_i22;
real_T c2_c_u[6];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
for (c2_i21 = 0; c2_i21 < 6; c2_i21 = c2_i21 + 1) {
c2_b_u[c2_i21] = (*((real_T (*)[6])c2_u))[c2_i21];
}
for (c2_i22 = 0; c2_i22 < 6; c2_i22 = c2_i22 + 1) {
c2_c_u[c2_i22] = c2_b_u[c2_i22];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 1, 6));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_b_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
int32_T c2_i23;
real_T c2_b_u[4];
int32_T c2_i24;
real_T c2_c_u[4];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
for (c2_i23 = 0; c2_i23 < 4; c2_i23 = c2_i23 + 1) {
c2_b_u[c2_i23] = (*((real_T (*)[4])c2_u))[c2_i23];
}
for (c2_i24 = 0; c2_i24 < 4; c2_i24 = c2_i24 + 1) {
c2_c_u[c2_i24] = c2_b_u[c2_i24];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 1, 4));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_c_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
int32_T c2_i25;
real_T c2_b_u[2];
int32_T c2_i26;
real_T c2_c_u[2];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
for (c2_i25 = 0; c2_i25 < 2; c2_i25 = c2_i25 + 1) {
c2_b_u[c2_i25] = (*((real_T (*)[2])c2_u))[c2_i25];
}
for (c2_i26 = 0; c2_i26 < 2; c2_i26 = c2_i26 + 1) {
c2_c_u[c2_i26] = c2_b_u[c2_i26];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 1, 2));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_d_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
real_T c2_b_u;
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
c2_b_u = *((real_T *)c2_u);
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
const mxArray *sf_c2_MPC_gamecontroller_LiDAR2_get_eml_resolved_functions_info
(void)
{
const mxArray *c2_nameCaptureInfo = NULL;
c2_ResolvedFunctionInfo c2_info[18];
const mxArray *c2_m0 = NULL;
int32_T c2_i27;
c2_ResolvedFunctionInfo *c2_r0;
c2_nameCaptureInfo = NULL;
c2_info_helper(c2_info);
sf_mex_assign(&c2_m0, sf_mex_createstruct("nameCaptureInfo", 1, 18));
for (c2_i27 = 0; c2_i27 < 18; c2_i27 = c2_i27 + 1) {
c2_r0 = &c2_info[c2_i27];
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->context, 15,
0U, 0U, 0U, 2, 1, strlen(c2_r0->context)), "context",
"nameCaptureInfo", c2_i27);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->name, 15, 0U,
0U, 0U, 2, 1, strlen(c2_r0->name)), "name",
"nameCaptureInfo", c2_i27);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->dominantType,
15, 0U, 0U, 0U, 2, 1, strlen(c2_r0->dominantType)),
"dominantType", "nameCaptureInfo", c2_i27);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->resolved, 15,
0U, 0U, 0U, 2, 1, strlen(c2_r0->resolved)), "resolved"
, "nameCaptureInfo", c2_i27);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileLength,
7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
c2_i27);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTime1, 7,
0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c2_i27
);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTime2, 7,
0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c2_i27
);
}
sf_mex_assign(&c2_nameCaptureInfo, c2_m0);
return c2_nameCaptureInfo;
}
static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[18])
{
c2_info[0].context = "";
c2_info[0].name = "plus";
c2_info[0].dominantType = "double";
c2_info[0].resolved = "[B]plus";
c2_info[0].fileLength = 0U;
c2_info[0].fileTime1 = 0U;
c2_info[0].fileTime2 = 0U;
c2_info[1].context = "";
c2_info[1].name = "mrdivide";
c2_info[1].dominantType = "double";
c2_info[1].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[1].fileLength = 432U;
c2_info[1].fileTime1 = 1277780622U;
c2_info[1].fileTime2 = 0U;
c2_info[2].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[2].name = "nargin";
c2_info[2].dominantType = "";
c2_info[2].resolved = "[B]nargin";
c2_info[2].fileLength = 0U;
c2_info[2].fileTime1 = 0U;
c2_info[2].fileTime2 = 0U;
c2_info[3].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[3].name = "ge";
c2_info[3].dominantType = "double";
c2_info[3].resolved = "[B]ge";
c2_info[3].fileLength = 0U;
c2_info[3].fileTime1 = 0U;
c2_info[3].fileTime2 = 0U;
c2_info[4].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[4].name = "isscalar";
c2_info[4].dominantType = "double";
c2_info[4].resolved = "[B]isscalar";
c2_info[4].fileLength = 0U;
c2_info[4].fileTime1 = 0U;
c2_info[4].fileTime2 = 0U;
c2_info[5].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[5].name = "rdivide";
c2_info[5].dominantType = "double";
c2_info[5].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
c2_info[5].fileLength = 403U;
c2_info[5].fileTime1 = 1245134820U;
c2_info[5].fileTime2 = 0U;
c2_info[6].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
c2_info[6].name = "gt";
c2_info[6].dominantType = "double";
c2_info[6].resolved = "[B]gt";
c2_info[6].fileLength = 0U;
c2_info[6].fileTime1 = 0U;
c2_info[6].fileTime2 = 0U;
c2_info[7].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
c2_info[7].name = "isa";
c2_info[7].dominantType = "double";
c2_info[7].resolved = "[B]isa";
c2_info[7].fileLength = 0U;
c2_info[7].fileTime1 = 0U;
c2_info[7].fileTime2 = 0U;
c2_info[8].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
c2_info[8].name = "eml_div";
c2_info[8].dominantType = "double";
c2_info[8].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
c2_info[8].fileLength = 4918U;
c2_info[8].fileTime1 = 1267095810U;
c2_info[8].fileTime2 = 0U;
c2_info[9].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
c2_info[9].name = "isinteger";
c2_info[9].dominantType = "double";
c2_info[9].resolved = "[B]isinteger";
c2_info[9].fileLength = 0U;
c2_info[9].fileTime1 = 0U;
c2_info[9].fileTime2 = 0U;
c2_info[10].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m!eml_fldiv";
c2_info[10].name = "isreal";
c2_info[10].dominantType = "double";
c2_info[10].resolved = "[B]isreal";
c2_info[10].fileLength = 0U;
c2_info[10].fileTime1 = 0U;
c2_info[10].fileTime2 = 0U;
c2_info[11].context = "";
c2_info[11].name = "mtimes";
c2_info[11].dominantType = "double";
c2_info[11].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[11].fileLength = 3425U;
c2_info[11].fileTime1 = 1251064272U;
c2_info[11].fileTime2 = 0U;
c2_info[12].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[12].name = "strcmp";
c2_info[12].dominantType = "char";
c2_info[12].resolved = "[B]strcmp";
c2_info[12].fileLength = 0U;
c2_info[12].fileTime1 = 0U;
c2_info[12].fileTime2 = 0U;
c2_info[13].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[13].name = "size";
c2_info[13].dominantType = "double";
c2_info[13].resolved = "[B]size";
c2_info[13].fileLength = 0U;
c2_info[13].fileTime1 = 0U;
c2_info[13].fileTime2 = 0U;
c2_info[14].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[14].name = "eq";
c2_info[14].dominantType = "double";
c2_info[14].resolved = "[B]eq";
c2_info[14].fileLength = 0U;
c2_info[14].fileTime1 = 0U;
c2_info[14].fileTime2 = 0U;
c2_info[15].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[15].name = "class";
c2_info[15].dominantType = "double";
c2_info[15].resolved = "[B]class";
c2_info[15].fileLength = 0U;
c2_info[15].fileTime1 = 0U;
c2_info[15].fileTime2 = 0U;
c2_info[16].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[16].name = "not";
c2_info[16].dominantType = "logical";
c2_info[16].resolved = "[B]not";
c2_info[16].fileLength = 0U;
c2_info[16].fileTime1 = 0U;
c2_info[16].fileTime2 = 0U;
c2_info[17].context = "";
c2_info[17].name = "ctranspose";
c2_info[17].dominantType = "double";
c2_info[17].resolved = "[B]ctranspose";
c2_info[17].fileLength = 0U;
c2_info[17].fileTime1 = 0U;
c2_info[17].fileTime2 = 0U;
}
static const mxArray *c2_e_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
boolean_T c2_b_u;
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
c2_b_u = *((boolean_T *)c2_u);
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static void c2_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c2_MPC_state, const
char_T *c2_name, real_T c2_y[6])
{
real_T c2_dv3[6];
int32_T c2_i28;
sf_mex_import(c2_name, sf_mex_dup(c2_MPC_state), c2_dv3, 1, 0, 0U, 1, 0U, 1, 6);
for (c2_i28 = 0; c2_i28 < 6; c2_i28 = c2_i28 + 1) {
c2_y[c2_i28] = c2_dv3[c2_i28];
}
sf_mex_destroy(&c2_MPC_state);
}
static void c2_b_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c2_RRT_state, const
char_T *c2_name, real_T c2_y[4])
{
real_T c2_dv4[4];
int32_T c2_i29;
sf_mex_import(c2_name, sf_mex_dup(c2_RRT_state), c2_dv4, 1, 0, 0U, 1, 0U, 1, 4);
for (c2_i29 = 0; c2_i29 < 4; c2_i29 = c2_i29 + 1) {
c2_y[c2_i29] = c2_dv4[c2_i29];
}
sf_mex_destroy(&c2_RRT_state);
}
static uint8_T c2_c_emlrt_marshallIn
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c2_b_is_active_c2_MPC_gamecontroller_LiDAR2, const char_T *c2_name)
{
uint8_T c2_y;
uint8_T c2_u0;
sf_mex_import(c2_name, sf_mex_dup(c2_b_is_active_c2_MPC_gamecontroller_LiDAR2),
&c2_u0, 1, 3, 0U, 0, 0U, 0);
c2_y = c2_u0;
sf_mex_destroy(&c2_b_is_active_c2_MPC_gamecontroller_LiDAR2);
return c2_y;
}
static void init_dsm_address_info(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c2_MPC_gamecontroller_LiDAR2_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2440176204U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3327541528U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1087786879U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2647905275U);
}
mxArray *sf_c2_MPC_gamecontroller_LiDAR2_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(4009698539U);
pr[1] = (double)(1240194229U);
pr[2] = (double)(2547242664U);
pr[3] = (double)(2186522232U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,3,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(2);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(4);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(2);
pr[1] = (double)(1);
mxSetField(mxData,2,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,2,"type",mxType);
}
mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,2,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(4);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(6);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR2(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x3'type','srcId','name','auxInfo'{{M[1],M[18],T\"MPC_state\",},{M[1],M[10],T\"RRT_state\",},{M[8],M[0],T\"is_active_c2_MPC_gamecontroller_LiDAR2\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 3, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c2_MPC_gamecontroller_LiDAR2_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_MPC_gamecontroller_LiDAR2MachineNumber_,
2,
1,
1,
5,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
1);
sf_debug_set_chart_event_thresholds
(_MPC_gamecontroller_LiDAR2MachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"roll");
_SFD_SET_DATA_PROPS(1,1,1,0,"wheel_speeds");
_SFD_SET_DATA_PROPS(2,1,1,0,"yaw");
_SFD_SET_DATA_PROPS(3,2,0,1,"RRT_state");
_SFD_SET_DATA_PROPS(4,2,0,1,"MPC_state");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,0,0,0,0,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",291,-1,1206);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
{
unsigned int dimVector[1];
dimVector[0]= 2;
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_c_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 4;
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_b_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 2;
_SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_c_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 4;
_SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_b_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 6;
_SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_sf_marshall);
}
{
real_T (*c2_roll)[2];
real_T (*c2_wheel_speeds)[4];
real_T (*c2_yaw)[2];
real_T (*c2_RRT_state)[4];
real_T (*c2_MPC_state)[6];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S,
2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S,
1);
c2_yaw = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
c2_wheel_speeds = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S,
1);
c2_roll = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, *c2_roll);
_SFD_SET_DATA_VALUE_PTR(1U, *c2_wheel_speeds);
_SFD_SET_DATA_VALUE_PTR(2U, *c2_yaw);
_SFD_SET_DATA_VALUE_PTR(3U, *c2_RRT_state);
_SFD_SET_DATA_VALUE_PTR(4U, *c2_MPC_state);
}
}
} else {
sf_debug_reset_current_state_configuration
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c2_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
chart_debug_initialization(((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
initialize_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_enable_c2_MPC_gamecontroller_LiDAR2(void *chartInstanceVar)
{
enable_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_disable_c2_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
disable_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_gateway_c2_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
sf_c2_MPC_gamecontroller_LiDAR2((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c2_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c2_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c2_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
return sf_internal_get_sim_state_c2_MPC_gamecontroller_LiDAR2(S);
}
static void sf_opaque_set_sim_state_c2_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
sf_internal_set_sim_state_c2_MPC_gamecontroller_LiDAR2(S, st);
}
static void sf_opaque_terminate_c2_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c2_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c2_MPC_gamecontroller_LiDAR2
((SFc2_MPC_gamecontroller_LiDAR2InstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c2_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",2);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",2,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
"MPC_gamecontroller_LiDAR2","MPC_gamecontroller_LiDAR2",2,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",2,3);
sf_mark_chart_reusable_outputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",2,2);
}
sf_set_rtw_dwork_info(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",2);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(1486273194U));
ssSetChecksum1(S,(37869009U));
ssSetChecksum2(S,(1537629696U));
ssSetChecksum3(S,(448221435U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c2_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",2);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c2_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDAR2InstanceStruct *)malloc(sizeof
(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct));
memset(chartInstance, 0, sizeof(SFc2_MPC_gamecontroller_LiDAR2InstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlStart = mdlStart_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c2_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c2_MPC_gamecontroller_LiDAR2_method_dispatcher(SimStruct *S, int_T method,
void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c2_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c2_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c2_MPC_gamecontroller_LiDAR2(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c2_MPC_gamecontroller_LiDAR2_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
<file_sep>
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML is auto-generated from an M-file.
To make changes, update the M-file and republish this document.
--><title>MPC Control of a Multi-Input Single-Output System</title><meta name="generator" content="MATLAB 7.10"><meta name="date" content="2010-01-05"><meta name="m-file" content="mpcmiso"><link rel="stylesheet" type="text/css" href="../../../matlab/demos/private/style.css"></head><body><div class="header"><div class="left"><a href="matlab:edit mpcmiso">Open mpcmiso.m in the Editor</a></div><div class="right"><a href="matlab:echodemo mpcmiso">Run in the Command Window</a></div></div><div class="content"><h1>MPC Control of a Multi-Input Single-Output System</h1><!--introduction--><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">MPC Controller Setup</a></li><li><a href="#9">Closed-loop MPC Simulation Using the Command SIM</a></li><li><a href="#14">Closed-Loop MPC Simulation Under Model Mismatch</a></li><li><a href="#15">Softening the Constraints</a></li><li><a href="#19">User-Specified State Estimator</a></li><li><a href="#23">Open-Loop Simulation</a></li><li><a href="#25">Checking Asymptotic Properties</a></li><li><a href="#27">MPC Control Action (Step-by-step Simulation)</a></li><li><a href="#34">Linearization of MPC Controller</a></li><li><a href="#40">Turning Constraints Off</a></li><li><a href="#42">MPC Simulation Using Simulink®</a></li><li><a href="#47">MPC Simulation with Noise</a></li></ul></div><p>This demonstration shows several features of Model Predictive Control Toolbox™ on a test system with one measured output, one manipulated variable, one measured disturbance, and one unmeasured disturbance.</p><h2>MPC Controller Setup<a name="2"></a></h2><p>We start defining the plant to be controlled.</p><pre class="codeinput">sys=ss(tf({1,1,1},{[1 .5 1],[1 1],[.7 .5 1]}),<span class="string">'min'</span>);
</pre><p>Now, setup an MPC controller object.</p><pre class="codeinput">Ts=.2; <span class="comment">% sampling time</span>
model=c2d(sys,Ts); <span class="comment">% prediction model</span>
</pre><p>Define type of input signals: the first signal is a manipulated variable, the second signal is a measured disturbance, the third one is an unmeasured disturbance.</p><pre class="codeinput">model=setmpcsignals(model,<span class="string">'MV'</span>,1,<span class="string">'MD'</span>,2,<span class="string">'UD'</span>,3);
</pre><p>Define the structure of models used by the MPC controller.</p><pre class="codeinput">clear <span class="string">Model</span>
<span class="comment">% Predictive model</span>
Model.Plant=model;
<span class="comment">% Disturbance model: Integrator driven by white noise with variance = 1000</span>
Model.Disturbance=tf(sqrt(1000),[1 0]);
</pre><p>Define prediction and control horizons.</p><pre class="codeinput">p=[]; <span class="comment">% prediction horizon (take default one)</span>
m=3; <span class="comment">% control horizon</span>
</pre><p>Let us assume default value for weights and build the MPC object.</p><pre class="codeinput">MPCobj=mpc(Model,Ts,p,m);
</pre><pre class="codeoutput">-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10.
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
</pre><p>Define constraints on the manipulated variable.</p><pre class="codeinput">MPCobj.MV=struct(<span class="string">'Min'</span>,0,<span class="string">'Max'</span>,1,<span class="string">'RateMin'</span>,-10,<span class="string">'RateMax'</span>,10);
</pre><h2>Closed-loop MPC Simulation Using the Command SIM<a name="9"></a></h2><pre class="codeinput">Tstop=30; <span class="comment">% simulation time</span>
Tf=round(Tstop/Ts); <span class="comment">% number of simulation steps</span>
r=ones(Tf,1); <span class="comment">% reference trajectory</span>
v=[zeros(Tf/3,1);ones(2*Tf/3,1)]; <span class="comment">% measured disturbance trajectory</span>
</pre><p>Run the closed-loop simulation and plot results.</p><pre class="codeinput">close <span class="string">all</span>
sim(MPCobj,Tf,r,v);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><img vspace="5" hspace="5" src="mpcmiso_01.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_02.png" alt=""> <p>We want to specify disturbance and noise signals. In order to do this, we create the MPC simulation object 'SimOptions'.</p><pre class="codeinput">d=[zeros(2*Tf/3,1);-0.5*ones(Tf/3,1)]; <span class="comment">% unmeasured disturbance trajectory</span>
SimOptions=mpcsimopt(MPCobj);
SimOptions.Unmeas=d; <span class="comment">% unmeasured input disturbance</span>
SimOptions.OutputNoise=.001*(rand(Tf,1)-.5); <span class="comment">% output measurement noise</span>
SimOptions.InputNoise=.05*(rand(Tf,1)-.5); <span class="comment">% noise on manipulated variables</span>
</pre><p>Run the closed-loop simulation and save the results to workspace.</p><pre class="codeinput">[y,t,u,xp]=sim(MPCobj,Tf,r,v,SimOptions);
</pre><p>Plot results.</p><pre class="codeinput">close <span class="string">all</span>
subplot(211)
plot(0:Tf-1,y,0:Tf-1,r)
title(<span class="string">'Output'</span>);
grid
subplot(212)
plot(0:Tf-1,u)
title(<span class="string">'Input'</span>);
grid
</pre><img vspace="5" hspace="5" src="mpcmiso_03.png" alt=""> <h2>Closed-Loop MPC Simulation Under Model Mismatch<a name="14"></a></h2><p>We now want to test the robustness of the MPC controller against a model mismatch. Assume the true plant generating the data is the following:</p><pre class="codeinput">simModel=ss(tf({1,1,1},{[1 .8 1],[1 2],[.6 .6 1]}),<span class="string">'min'</span>);
simModel=setmpcsignals(simModel,<span class="string">'MV'</span>,1,<span class="string">'MD'</span>,2,<span class="string">'UD'</span>,3);
simModel=struct(<span class="string">'Plant'</span>,simModel);
simModel.Nominal.Y=0.1; <span class="comment">% The nominal value of the output of the true plant is 0.1</span>
simModel.Nominal.X=-.1*[1 1 1 1 1];
SimOptions.Model=simModel;
SimOptions.plantinit=[0.1 0 -0.1 0 .05]; <span class="comment">% Initial state of the true plant</span>
SimOptions.OutputNoise=[]; <span class="comment">% remove output measurement noise</span>
SimOptions.InputNoise=[]; <span class="comment">% remove noise on manipulated variables</span>
close <span class="string">all</span>
sim(MPCobj,Tf,r,v,SimOptions);
</pre><img vspace="5" hspace="5" src="mpcmiso_04.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_05.png" alt=""> <h2>Softening the Constraints<a name="15"></a></h2><p>Let us now relax the constraints on manipulated variables.</p><pre class="codeinput">MPCobj.MV.MinECR=1;
MPCobj.MV.MaxECR=1;
<span class="comment">% Keep constraints on manipulated variable rates as hard constraints.</span>
MPCobj.MV.RateMinECR=0;
MPCobj.MV.RateMaxECR=0;
</pre><p>Define an output constraint and soften it.</p><pre class="codeinput">MPCobj.OV=struct(<span class="string">'Max'</span>,1.1);
MPCobj.OV.MaxECR=1;
</pre><p>Run a new closed-loop simulation.</p><pre class="codeinput">close <span class="string">all</span>
sim(MPCobj,Tf,r,v);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><img vspace="5" hspace="5" src="mpcmiso_06.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_07.png" alt=""> <p>Input constraints have been slightly violated, output constraints have been quite violated. Let us penalize more output constraints and rerun the simulation.</p><pre class="codeinput">MPCobj.OV.MaxECR=0.001; <span class="comment">% The closer to zero, the harder the constraint</span>
close <span class="string">all</span>
sim(MPCobj,Tf,r,v);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><img vspace="5" hspace="5" src="mpcmiso_08.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_09.png" alt=""> <h2>User-Specified State Estimator<a name="19"></a></h2><p>Model Predictive Control Toolbox™ is using by default a Kalman filter to estimate the state of plant, disturbance, and noise models. We may want to provide our own observer.</p><p>Let us first retrieve the default estimator gain (Kalman gain) and state-space matrices.</p><pre class="codeinput">[M,A1,Cm1]=getestim(MPCobj);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><p>The default observer poles are:</p><pre class="codeinput">e=eig(A1-A1*M*Cm1);
fprintf(<span class="string">'\nDefault observer poles: [%s]\n'</span>,sprintf(<span class="string">'%5.4f '</span>,e));
</pre><pre class="codeoutput">
Default observer poles: [0.5708 0.5708 0.9334 0.9334 0.4967 0.8189 ]
</pre><p>We design now a state estimator for the MPC controller by pole-placement.</p><pre class="codeinput">poles=[.8 .75 .7 .85 .6 .81];
<span class="comment">%poles=3*[.10 .11 .12 .13 .14 .15]; % Fast observer</span>
L=place(A1',Cm1',poles)';
M=A1\L;
setestim(MPCobj,M); <span class="comment">% (the gain M is stored inside the MPC object)</span>
</pre><h2>Open-Loop Simulation<a name="23"></a></h2><p>Testing the behavior of the prediction model in open-loop is easy using method SIM. We must set the 'OpenLoop' flag on, and provide the sequence of manipulated variables that excite the system.</p><pre class="codeinput">SimOptions.OpenLoop=<span class="string">'on'</span>;
SimOptions.MVSignal=sin((0:Tf-1)'/10);
</pre><p>As the reference signal will be ignored, we can avoid specifying it.</p><pre class="codeinput">close <span class="string">all</span>
sim(MPCobj,Tf,[],v,SimOptions);
</pre><img vspace="5" hspace="5" src="mpcmiso_10.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_11.png" alt=""> <h2>Checking Asymptotic Properties<a name="25"></a></h2><p>How can we know if the designed MPC controller will be able to reject constant output disturbances and track constant set-point with zero offsets in steady-state ? We can compute the DC gain from output disturbances to controlled outputs using CLOFFSET.</p><pre class="codeinput">DC=cloffset(MPCobj);
fprintf(<span class="string">'DC gain from output disturbance to output = %5.8f (=%g) \n'</span>,DC,DC);
</pre><pre class="codeoutput">DC gain from output disturbance to output = -0.00000000 (=-2.44249e-015)
</pre><p>A zero gain means that the output will track the desired set-point.</p><h2>MPC Control Action (Step-by-step Simulation)<a name="27"></a></h2><p>We may just want to compute the MPC control action inside our simulation code. Let's see an example.</p><p>First we get the discrete-time state-space matrices of the plant.</p><pre class="codeinput">[A,B,C,D]=ssdata(model);
Tstop=30; <span class="comment">%Simulation time</span>
x=[0 0 0 0 0]'; <span class="comment">% Initial state of the plant</span>
xmpc=mpcstate(MPCobj); <span class="comment">% Initial state of the MPC controller</span>
r=1; <span class="comment">% Output reference trajectory</span>
</pre><p>We store the closed-loop MPC trajectories in arrays YY,UU,XX.</p><pre class="codeinput">YY=[];
UU=[];
XX=[];
</pre><p>Main simulation loop</p><pre class="codeinput"><span class="keyword">for</span> t=0:round(Tstop/Ts)-1,
XX=[XX,x];
<span class="comment">% Define measured disturbance signal</span>
v=0;
<span class="keyword">if</span> t*Ts>=10,
v=1;
<span class="keyword">end</span>
<span class="comment">% Define unmeasured disturbance signal</span>
d=0;
<span class="keyword">if</span> t*Ts>=20,
d=-0.5;
<span class="keyword">end</span>
<span class="comment">% Plant equations: output update (note: no feedthrough from MV to Y, D(:,1)=0)</span>
y=C*x+D(:,2)*v+D(:,3)*d;
YY=[YY,y];
<span class="comment">% Compute MPC law</span>
u=mpcmove(MPCobj,xmpc,y,r,v);
<span class="comment">% Plant equations: state update</span>
x=A*x+B(:,1)*u+B(:,2)*v+B(:,3)*d;
UU=[UU,u];
<span class="keyword">end</span>
</pre><p>Plot results.</p><pre class="codeinput">close <span class="string">all</span>
subplot(211)
plot(0:Ts:Tstop-Ts,YY)
grid
title(<span class="string">'Output'</span>);
subplot(212)
plot(0:Ts:Tstop-Ts,UU)
grid
title(<span class="string">'Input'</span>);
</pre><img vspace="5" hspace="5" src="mpcmiso_12.png" alt=""> <p>If at any time during the simulation we want to check the optimal predicted trajectories, we can use an extended version of MPCMOVE. Assume we want to start from the current state and have a set-point change to 0.5, and assume the measured disturbance has disappeared.</p><pre class="codeinput">r=0.5;
v=0;
[~,Info]=mpcmove(MPCobj,xmpc,y,r,v);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><p>We now extract the optimal predicted trajectories.</p><pre class="codeinput">topt=Info.Topt;
yopt=Info.Yopt;
uopt=Info.Uopt;
close <span class="string">all</span>
subplot(211)
stairs(topt,yopt);
title(<span class="string">'Optimal sequence of predicted outputs'</span>)
grid
subplot(212)
stairs(topt,uopt);
title(<span class="string">'Optimal sequence of manipulated variables'</span>)
grid
xmpc
</pre><pre class="codeoutput">MPCSTATE object with fields
Plant: [-0.0301 0.4886 0.8187 0.0034 -0.3471]
Disturbance: -0.0629
Noise: [1x0 double]
LastMove: 0.3340
</pre><img vspace="5" hspace="5" src="mpcmiso_13.png" alt=""> <h2>Linearization of MPC Controller<a name="34"></a></h2><p>When the constraints are not active, the MPC controller behaves like a linear controller. We can then get the state-space form of the MPC controller.</p><pre class="codeinput">LTIMPC=ss(MPCobj,<span class="string">'rv'</span>);
</pre><p>Get state-space matrices of linearized controller.</p><pre class="codeinput">[AL,BL,CL,DL]=ssdata(LTIMPC);
</pre><p>Simulate linear MPC closed-loop system and compare the linearized MPC controller with the original MPC controller with constraints turned off.</p><pre class="codeinput">MPCobj.MV=[]; <span class="comment">% No input constraints</span>
MPCobj.OV=[]; <span class="comment">% No output constraints</span>
Tstop=5; <span class="comment">%Simulation time</span>
xL=zeros(size(BL,1),1); <span class="comment">% Initial state of linearized MPC controller</span>
x=[0 0 0 0 0]'; <span class="comment">% Initial state of plant</span>
y=0; <span class="comment">% Initial measured output</span>
r=1; <span class="comment">% Output reference set-point</span>
u=0; <span class="comment">% Previous input command</span>
YY=[];
XX=[];
xmpc=mpcstate(MPCobj);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><p>Simulate linear MPC closed-loop system and compare the linearized MPC controller with the original MPC controller with constraints turned off.</p><pre class="codeinput"><span class="keyword">for</span> t=0:round(Tstop/Ts)-1,
YY=[YY,y];
XX=[XX,x];
v=0;
<span class="keyword">if</span> t*Ts>=10,
v=1;
<span class="keyword">end</span>
d=0;
<span class="keyword">if</span> t*Ts>=20,
d=-0.5;
<span class="keyword">end</span>
uold=u;
<span class="comment">% Compute the linear MPC control action</span>
u=CL*xL+DL*[y;r;v];
<span class="comment">% Compare the input move with the one provided by MPCMOVE</span>
uMPC=mpcmove(MPCobj,xmpc,y,r,v);
dispStr(t+1)={sprintf(<span class="string">'t=%5.2f, input move u=%7.4f (u=%7.4f is provided by MPCMOVE)'</span>,t*Ts,u,uMPC)};
<span class="comment">% Update plant equations</span>
x=A*x+B(:,1)*u+B(:,2)*v+B(:,3)*d;
<span class="comment">% Update controller equations</span>
xL=AL*xL+BL*[y;r;v];
<span class="comment">% Update output equations</span>
y=C*x+D(:,1)*u+D(:,2)*v+D(:,3)*d;
<span class="keyword">end</span>
</pre><p>Display results.</p><pre class="codeinput"><span class="keyword">for</span> t=0:round(Tstop/Ts)-1,
disp(dispStr{t+1});
<span class="keyword">end</span>
</pre><pre class="codeoutput">t= 0.00, input move u= 5.2478 (u= 5.2478 is provided by MPCMOVE)
t= 0.20, input move u= 3.0134 (u= 3.0134 is provided by MPCMOVE)
t= 0.40, input move u= 0.2281 (u= 0.2281 is provided by MPCMOVE)
t= 0.60, input move u=-0.9952 (u=-0.9952 is provided by MPCMOVE)
t= 0.80, input move u=-0.8749 (u=-0.8749 is provided by MPCMOVE)
t= 1.00, input move u=-0.2022 (u=-0.2022 is provided by MPCMOVE)
t= 1.20, input move u= 0.4459 (u= 0.4459 is provided by MPCMOVE)
t= 1.40, input move u= 0.8489 (u= 0.8489 is provided by MPCMOVE)
t= 1.60, input move u= 1.0192 (u= 1.0192 is provided by MPCMOVE)
t= 1.80, input move u= 1.0511 (u= 1.0511 is provided by MPCMOVE)
t= 2.00, input move u= 1.0304 (u= 1.0304 is provided by MPCMOVE)
t= 2.20, input move u= 1.0053 (u= 1.0053 is provided by MPCMOVE)
t= 2.40, input move u= 0.9920 (u= 0.9920 is provided by MPCMOVE)
t= 2.60, input move u= 0.9896 (u= 0.9896 is provided by MPCMOVE)
t= 2.80, input move u= 0.9925 (u= 0.9925 is provided by MPCMOVE)
t= 3.00, input move u= 0.9964 (u= 0.9964 is provided by MPCMOVE)
t= 3.20, input move u= 0.9990 (u= 0.9990 is provided by MPCMOVE)
t= 3.40, input move u= 1.0002 (u= 1.0002 is provided by MPCMOVE)
t= 3.60, input move u= 1.0004 (u= 1.0004 is provided by MPCMOVE)
t= 3.80, input move u= 1.0003 (u= 1.0003 is provided by MPCMOVE)
t= 4.00, input move u= 1.0001 (u= 1.0001 is provided by MPCMOVE)
t= 4.20, input move u= 1.0000 (u= 1.0000 is provided by MPCMOVE)
t= 4.40, input move u= 0.9999 (u= 0.9999 is provided by MPCMOVE)
t= 4.60, input move u= 1.0000 (u= 1.0000 is provided by MPCMOVE)
t= 4.80, input move u= 1.0000 (u= 1.0000 is provided by MPCMOVE)
</pre><p>Plot results.</p><pre class="codeinput">close <span class="string">all</span>
plot(0:Ts:Tstop-Ts,YY)
grid
</pre><img vspace="5" hspace="5" src="mpcmiso_14.png" alt=""> <h2>Turning Constraints Off<a name="40"></a></h2><p>Running a closed-loop where all constraints are turned off is easy using SIM. We just specify an option in the SimOptions structure:</p><pre class="codeinput">SimOptions=mpcsimopt(MPCobj);
SimOptions.Constr=<span class="string">'off'</span>; <span class="comment">% Remove all MPC constraints</span>
SimOptions.Unmeas=d; <span class="comment">% unmeasured input disturbance</span>
</pre><p>Run the closed-loop simulation and plot results.</p><pre class="codeinput">close <span class="string">all</span>
sim(MPCobj,Tf,r,v,SimOptions);
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><img vspace="5" hspace="5" src="mpcmiso_15.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_16.png" alt=""> <h2>MPC Simulation Using Simulink®<a name="42"></a></h2><pre class="codeinput"><span class="keyword">if</span> ~mpcchecktoolboxinstalled(<span class="string">'simulink'</span>)
disp(<span class="string">'Simulink(R) is required to run this part of the demo.'</span>)
<span class="keyword">return</span>
<span class="keyword">end</span>
</pre><p>MPC can be also used in a Simulink® diagram. Let us recreate the MPC object.</p><pre class="codeinput">Model.Disturbance=tf(sqrt(1000),[1 0]);
p=[];
m=3;
MPCobj=mpc(Model,Ts,p,m);
MPCobj.MV=struct(<span class="string">'Min'</span>,0,<span class="string">'Max'</span>,1,<span class="string">'RateMin'</span>,-10,<span class="string">'RateMax'</span>,10);
</pre><pre class="codeoutput">-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10.
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
</pre><p>The continuous-time plant to be controlled has the following state-space realization:</p><pre class="codeinput">[A,B,C,D]=ssdata(sys);
</pre><p>Now simulate closed-loop MPC in Simulink®.</p><pre class="codeinput">Tstop=30; <span class="comment">% Simulation time</span>
</pre><p>Run simulation without noise.</p><pre class="codeinput">open_system(<span class="string">'mpc_miso'</span>) <span class="comment">% Open Simulink(R) Model</span>
sim(<span class="string">'mpc_miso'</span>,Tstop); <span class="comment">% Start Simulation</span>
</pre><pre class="codeoutput">-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><img vspace="5" hspace="5" src="mpcmiso_17.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_18.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_19.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_20.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_21.png" alt=""> <h2>MPC Simulation with Noise<a name="47"></a></h2><p>Next, we run a simulation with sinusoidal output noise. Let's say we know that output measurements are affected by a sinusoidal measurement noise of frequency 0.1 Hz. We want to inform the MPC object about this so that state estimates can be improved.</p><pre class="codeinput">omega=2*pi/10;
MPCobj.Model.Noise=0.5*tf(omega^2,[1 0 omega^2]);
<span class="comment">% We also revised the MPC design.</span>
MPCobj.Model.Disturbance=.1; <span class="comment">% Model for unmeasured disturbance = white Gaussian noise with zero mean and variance 0.01</span>
MPCobj.weights=struct(<span class="string">'MV'</span>,0,<span class="string">'MVRate'</span>,0.1,<span class="string">'OV'</span>,.005);
MPCobj.predictionhorizon=40;
MPCobj.controlhorizon=3;
<span class="comment">%Simulation time</span>
Tstop=150;
</pre><p>Run simulation with noise.</p><pre class="codeinput">bdclose(<span class="string">'mpc_miso'</span>);
open_system(<span class="string">'mpc_misonoise'</span>) <span class="comment">% Open new Simulink(R) Model</span>
sim(<span class="string">'mpc_misonoise'</span>,Tstop); <span class="comment">% Start Simulation</span>
</pre><pre class="codeoutput">-->Integrated white noise added on measured output channel #1.
-->A feedthrough channel in NoiseModel was inserted to prevent problems with estimator design.
</pre><img vspace="5" hspace="5" src="mpcmiso_22.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_23.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_24.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_25.png" alt=""> <img vspace="5" hspace="5" src="mpcmiso_26.png" alt=""> <pre class="codeinput">bdclose(<span class="string">'mpc_misonoise'</span>);
</pre><p class="footer">Copyright 1990-2009 The MathWorks, Inc.<br>
Published with MATLAB® 7.10</p><p class="footer" id="trademarks">MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Please see <a href="http://www.mathworks.com/trademarks">www.mathworks.com/trademarks</a> for a list of other trademarks owned by The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective owners.</p></div><!--
##### SOURCE BEGIN #####
%% MPC Control of a Multi-Input Single-Output System
%%
% This demonstration shows several features of Model Predictive Control
% Toolbox(TM) on a test system with one measured output, one manipulated
% variable, one measured disturbance, and one unmeasured disturbance.
%
% Copyright 1990-2009 The MathWorks, Inc.
% $Revision: 1.1.4.13 $ $Date: 2009/09/21 00:04:23 $
%% MPC Controller Setup
% We start defining the plant to be controlled.
sys=ss(tf({1,1,1},{[1 .5 1],[1 1],[.7 .5 1]}),'min');
%%
% Now, setup an MPC controller object.
Ts=.2; % sampling time
model=c2d(sys,Ts); % prediction model
%%
% Define type of input signals: the first signal is a manipulated variable,
% the second signal is a measured disturbance, the third one is an
% unmeasured disturbance.
model=setmpcsignals(model,'MV',1,'MD',2,'UD',3);
%%
% Define the structure of models used by the MPC controller.
clear Model
% Predictive model
Model.Plant=model;
% Disturbance model: Integrator driven by white noise with variance = 1000
Model.Disturbance=tf(sqrt(1000),[1 0]);
%%
% Define prediction and control horizons.
p=[]; % prediction horizon (take default one)
m=3; % control horizon
%%
% Let us assume default value for weights and build the MPC object.
MPCobj=mpc(Model,Ts,p,m);
%%
% Define constraints on the manipulated variable.
MPCobj.MV=struct('Min',0,'Max',1,'RateMin',-10,'RateMax',10);
%% Closed-loop MPC Simulation Using the Command SIM
Tstop=30; % simulation time
Tf=round(Tstop/Ts); % number of simulation steps
r=ones(Tf,1); % reference trajectory
v=[zeros(Tf/3,1);ones(2*Tf/3,1)]; % measured disturbance trajectory
%%
% Run the closed-loop simulation and plot results.
close all
sim(MPCobj,Tf,r,v);
%%
% We want to specify disturbance and noise signals. In order to do this,
% we create the MPC simulation object 'SimOptions'.
d=[zeros(2*Tf/3,1);-0.5*ones(Tf/3,1)]; % unmeasured disturbance trajectory
SimOptions=mpcsimopt(MPCobj);
SimOptions.Unmeas=d; % unmeasured input disturbance
SimOptions.OutputNoise=.001*(rand(Tf,1)-.5); % output measurement noise
SimOptions.InputNoise=.05*(rand(Tf,1)-.5); % noise on manipulated variables
%%
% Run the closed-loop simulation and save the results to workspace.
[y,t,u,xp]=sim(MPCobj,Tf,r,v,SimOptions);
%%
% Plot results.
close all
subplot(211)
plot(0:Tf-1,y,0:Tf-1,r)
title('Output');
grid
subplot(212)
plot(0:Tf-1,u)
title('Input');
grid
%% Closed-Loop MPC Simulation Under Model Mismatch
% We now want to test the robustness of the MPC controller against a model
% mismatch. Assume the true plant generating the data is the following:
simModel=ss(tf({1,1,1},{[1 .8 1],[1 2],[.6 .6 1]}),'min');
simModel=setmpcsignals(simModel,'MV',1,'MD',2,'UD',3);
simModel=struct('Plant',simModel);
simModel.Nominal.Y=0.1; % The nominal value of the output of the true plant is 0.1
simModel.Nominal.X=-.1*[1 1 1 1 1];
SimOptions.Model=simModel;
SimOptions.plantinit=[0.1 0 -0.1 0 .05]; % Initial state of the true plant
SimOptions.OutputNoise=[]; % remove output measurement noise
SimOptions.InputNoise=[]; % remove noise on manipulated variables
close all
sim(MPCobj,Tf,r,v,SimOptions);
%% Softening the Constraints
% Let us now relax the constraints on manipulated variables.
MPCobj.MV.MinECR=1;
MPCobj.MV.MaxECR=1;
% Keep constraints on manipulated variable rates as hard constraints.
MPCobj.MV.RateMinECR=0;
MPCobj.MV.RateMaxECR=0;
%%
% Define an output constraint and soften it.
MPCobj.OV=struct('Max',1.1);
MPCobj.OV.MaxECR=1;
%%
% Run a new closed-loop simulation.
close all
sim(MPCobj,Tf,r,v);
%%
% Input constraints have been slightly violated, output constraints have
% been quite violated. Let us penalize more output constraints and rerun
% the simulation.
MPCobj.OV.MaxECR=0.001; % The closer to zero, the harder the constraint
close all
sim(MPCobj,Tf,r,v);
%% User-Specified State Estimator
% Model Predictive Control Toolbox(TM) is using by default a Kalman filter
% to estimate the state of plant, disturbance, and noise models. We may
% want to provide our own observer.
%%
% Let us first retrieve the default estimator gain (Kalman gain) and
% state-space matrices.
[M,A1,Cm1]=getestim(MPCobj);
%%
% The default observer poles are:
e=eig(A1-A1*M*Cm1);
fprintf('\nDefault observer poles: [%s]\n',sprintf('%5.4f ',e));
%%
% We design now a state estimator for the MPC controller by pole-placement.
poles=[.8 .75 .7 .85 .6 .81];
%poles=3*[.10 .11 .12 .13 .14 .15]; % Fast observer
L=place(A1',Cm1',poles)';
M=A1\L;
setestim(MPCobj,M); % (the gain M is stored inside the MPC object)
%% Open-Loop Simulation
% Testing the behavior of the prediction model in open-loop is easy using
% method SIM. We must set the 'OpenLoop' flag on, and provide the sequence
% of manipulated variables that excite the system.
SimOptions.OpenLoop='on';
SimOptions.MVSignal=sin((0:Tf-1)'/10);
%%
% As the reference signal will be ignored, we can avoid specifying it.
close all
sim(MPCobj,Tf,[],v,SimOptions);
%% Checking Asymptotic Properties
% How can we know if the designed MPC controller will be able to reject
% constant output disturbances and track constant set-point with zero
% offsets in steady-state ? We can compute the DC gain from output
% disturbances to controlled outputs using CLOFFSET.
DC=cloffset(MPCobj);
fprintf('DC gain from output disturbance to output = %5.8f (=%g) \n',DC,DC);
%%
% A zero gain means that the output will track the desired set-point.
%% MPC Control Action (Step-by-step Simulation)
% We may just want to compute the MPC control action inside our simulation
% code. Let's see an example.
%%
% First we get the discrete-time state-space matrices of the plant.
[A,B,C,D]=ssdata(model);
Tstop=30; %Simulation time
x=[0 0 0 0 0]'; % Initial state of the plant
xmpc=mpcstate(MPCobj); % Initial state of the MPC controller
r=1; % Output reference trajectory
%%
% We store the closed-loop MPC trajectories in arrays YY,UU,XX.
YY=[];
UU=[];
XX=[];
%%
% Main simulation loop
for t=0:round(Tstop/Ts)-1,
XX=[XX,x];
% Define measured disturbance signal
v=0;
if t*Ts>=10,
v=1;
end
% Define unmeasured disturbance signal
d=0;
if t*Ts>=20,
d=-0.5;
end
% Plant equations: output update (note: no feedthrough from MV to Y, D(:,1)=0)
y=C*x+D(:,2)*v+D(:,3)*d;
YY=[YY,y];
% Compute MPC law
u=mpcmove(MPCobj,xmpc,y,r,v);
% Plant equations: state update
x=A*x+B(:,1)*u+B(:,2)*v+B(:,3)*d;
UU=[UU,u];
end
%%
% Plot results.
close all
subplot(211)
plot(0:Ts:Tstop-Ts,YY)
grid
title('Output');
subplot(212)
plot(0:Ts:Tstop-Ts,UU)
grid
title('Input');
%%
% If at any time during the simulation we want to check the optimal
% predicted trajectories, we can use an extended version of MPCMOVE.
% Assume we want to start from the current state and have a set-point
% change to 0.5, and assume the measured disturbance has disappeared.
r=0.5;
v=0;
[~,Info]=mpcmove(MPCobj,xmpc,y,r,v);
%%
% We now extract the optimal predicted trajectories.
topt=Info.Topt;
yopt=Info.Yopt;
uopt=Info.Uopt;
close all
subplot(211)
stairs(topt,yopt);
title('Optimal sequence of predicted outputs')
grid
subplot(212)
stairs(topt,uopt);
title('Optimal sequence of manipulated variables')
grid
xmpc
%% Linearization of MPC Controller
% When the constraints are not active, the MPC controller behaves like a
% linear controller. We can then get the state-space form of the MPC
% controller.
LTIMPC=ss(MPCobj,'rv');
%%
% Get state-space matrices of linearized controller.
[AL,BL,CL,DL]=ssdata(LTIMPC);
%%
% Simulate linear MPC closed-loop system and compare the linearized MPC
% controller with the original MPC controller with constraints turned off.
MPCobj.MV=[]; % No input constraints
MPCobj.OV=[]; % No output constraints
Tstop=5; %Simulation time
xL=zeros(size(BL,1),1); % Initial state of linearized MPC controller
x=[0 0 0 0 0]'; % Initial state of plant
y=0; % Initial measured output
r=1; % Output reference set-point
u=0; % Previous input command
YY=[];
XX=[];
xmpc=mpcstate(MPCobj);
%%
% Simulate linear MPC closed-loop system and compare the linearized MPC
% controller with the original MPC controller with constraints turned off.
for t=0:round(Tstop/Ts)-1,
YY=[YY,y];
XX=[XX,x];
v=0;
if t*Ts>=10,
v=1;
end
d=0;
if t*Ts>=20,
d=-0.5;
end
uold=u;
% Compute the linear MPC control action
u=CL*xL+DL*[y;r;v];
% Compare the input move with the one provided by MPCMOVE
uMPC=mpcmove(MPCobj,xmpc,y,r,v);
dispStr(t+1)={sprintf('t=%5.2f, input move u=%7.4f (u=%7.4f is provided by MPCMOVE)',t*Ts,u,uMPC)};
% Update plant equations
x=A*x+B(:,1)*u+B(:,2)*v+B(:,3)*d;
% Update controller equations
xL=AL*xL+BL*[y;r;v];
% Update output equations
y=C*x+D(:,1)*u+D(:,2)*v+D(:,3)*d;
end
%%
% Display results.
for t=0:round(Tstop/Ts)-1,
disp(dispStr{t+1});
end
%%
% Plot results.
close all
plot(0:Ts:Tstop-Ts,YY)
grid
%% Turning Constraints Off
% Running a closed-loop where all constraints are turned off is easy using
% SIM. We just specify an option in the SimOptions structure:
SimOptions=mpcsimopt(MPCobj);
SimOptions.Constr='off'; % Remove all MPC constraints
SimOptions.Unmeas=d; % unmeasured input disturbance
%%
% Run the closed-loop simulation and plot results.
close all
sim(MPCobj,Tf,r,v,SimOptions);
%% MPC Simulation Using Simulink(R)
if ~mpcchecktoolboxinstalled('simulink')
disp('Simulink(R) is required to run this part of the demo.')
return
end
%%
% MPC can be also used in a Simulink(R) diagram. Let us recreate the MPC
% object.
Model.Disturbance=tf(sqrt(1000),[1 0]);
p=[];
m=3;
MPCobj=mpc(Model,Ts,p,m);
MPCobj.MV=struct('Min',0,'Max',1,'RateMin',-10,'RateMax',10);
%%
% The continuous-time plant to be controlled has the following state-space
% realization:
[A,B,C,D]=ssdata(sys);
%%
% Now simulate closed-loop MPC in Simulink(R).
Tstop=30; % Simulation time
%%
% Run simulation without noise.
open_system('mpc_miso') % Open Simulink(R) Model
sim('mpc_miso',Tstop); % Start Simulation
%% MPC Simulation with Noise
% Next, we run a simulation with sinusoidal output noise.
% Let's say we know that output measurements are affected by a sinusoidal
% measurement noise of frequency 0.1 Hz. We want to inform the MPC object
% about this so that state estimates can be improved.
omega=2*pi/10;
MPCobj.Model.Noise=0.5*tf(omega^2,[1 0 omega^2]);
% We also revised the MPC design.
MPCobj.Model.Disturbance=.1; % Model for unmeasured disturbance = white Gaussian noise with zero mean and variance 0.01
MPCobj.weights=struct('MV',0,'MVRate',0.1,'OV',.005);
MPCobj.predictionhorizon=40;
MPCobj.controlhorizon=3;
%Simulation time
Tstop=150;
%%
% Run simulation with noise.
bdclose('mpc_miso');
open_system('mpc_misonoise') % Open new Simulink(R) Model
sim('mpc_misonoise',Tstop); % Start Simulation
%%
bdclose('mpc_misonoise');
displayEndOfDemoMessage(mfilename)
##### SOURCE END #####
--></body></html><file_sep>/* Include files */
#include "RSC_RRT_LiDAR_No_USER_sfun.h"
#include "c2_RSC_RRT_LiDAR_No_USER.h"
#include "c6_RSC_RRT_LiDAR_No_USER.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
int32_T _sfEvent_;
uint32_T _RSC_RRT_LiDAR_No_USERMachineNumber_;
real_T _sfTime_;
/* Function Declarations */
/* Function Definitions */
void RSC_RRT_LiDAR_No_USER_initializer(void)
{
_sfEvent_ = CALL_EVENT;
}
void RSC_RRT_LiDAR_No_USER_terminator(void)
{
}
/* SFunction Glue Code */
unsigned int sf_RSC_RRT_LiDAR_No_USER_method_dispatcher(SimStruct *simstructPtr,
unsigned int chartFileNumber, const char* specsCksum, int_T method, void *data)
{
if (chartFileNumber==2) {
c2_RSC_RRT_LiDAR_No_USER_method_dispatcher(simstructPtr, method, data);
return 1;
}
if (chartFileNumber==6) {
c6_RSC_RRT_LiDAR_No_USER_method_dispatcher(simstructPtr, method, data);
return 1;
}
return 0;
}
unsigned int sf_RSC_RRT_LiDAR_No_USER_process_check_sum_call( int nlhs, mxArray *
plhs[], int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
char commandName[20];
if (nrhs<1 || !mxIsChar(prhs[0]) )
return 0;
/* Possible call to get the checksum */
mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (strcmp(commandName,"sf_get_check_sum"))
return 0;
plhs[0] = mxCreateDoubleMatrix( 1,4,mxREAL);
if (nrhs>1 && mxIsChar(prhs[1])) {
mxGetString(prhs[1], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (!strcmp(commandName,"machine")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1885440617U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3088269943U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2034317993U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1482871022U);
} else if (!strcmp(commandName,"exportedFcn")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0U);
} else if (!strcmp(commandName,"makefile")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3210991694U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2767922078U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2461384843U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3892236483U);
} else if (nrhs==3 && !strcmp(commandName,"chart")) {
unsigned int chartFileNumber;
chartFileNumber = (unsigned int)mxGetScalar(prhs[2]);
switch (chartFileNumber) {
case 2:
{
extern void sf_c2_RSC_RRT_LiDAR_No_USER_get_check_sum(mxArray *plhs[]);
sf_c2_RSC_RRT_LiDAR_No_USER_get_check_sum(plhs);
break;
}
case 6:
{
extern void sf_c6_RSC_RRT_LiDAR_No_USER_get_check_sum(mxArray *plhs[]);
sf_c6_RSC_RRT_LiDAR_No_USER_get_check_sum(plhs);
break;
}
default:
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0.0);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0.0);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0.0);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0.0);
}
} else if (!strcmp(commandName,"target")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3176360410U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1862911626U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(659157607U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1884031890U);
} else {
return 0;
}
} else {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1209066698U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3430049496U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2725894622U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(498615677U);
}
return 1;
#else
return 0;
#endif
}
unsigned int sf_RSC_RRT_LiDAR_No_USER_autoinheritance_info( int nlhs, mxArray *
plhs[], int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
char commandName[32];
if (nrhs<2 || !mxIsChar(prhs[0]) )
return 0;
/* Possible call to get the autoinheritance_info */
mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (strcmp(commandName,"get_autoinheritance_info"))
return 0;
{
unsigned int chartFileNumber;
chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
switch (chartFileNumber) {
case 2:
{
extern mxArray *sf_c2_RSC_RRT_LiDAR_No_USER_get_autoinheritance_info
(void);
plhs[0] = sf_c2_RSC_RRT_LiDAR_No_USER_get_autoinheritance_info();
break;
}
case 6:
{
extern mxArray *sf_c6_RSC_RRT_LiDAR_No_USER_get_autoinheritance_info
(void);
plhs[0] = sf_c6_RSC_RRT_LiDAR_No_USER_get_autoinheritance_info();
break;
}
default:
plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
}
}
return 1;
#else
return 0;
#endif
}
unsigned int sf_RSC_RRT_LiDAR_No_USER_get_eml_resolved_functions_info( int nlhs,
mxArray * plhs[], int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
char commandName[64];
if (nrhs<2 || !mxIsChar(prhs[0]))
return 0;
/* Possible call to get the get_eml_resolved_functions_info */
mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (strcmp(commandName,"get_eml_resolved_functions_info"))
return 0;
{
unsigned int chartFileNumber;
chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
switch (chartFileNumber) {
case 2:
{
extern const mxArray
*sf_c2_RSC_RRT_LiDAR_No_USER_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c2_RSC_RRT_LiDAR_No_USER_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
case 6:
{
extern const mxArray
*sf_c6_RSC_RRT_LiDAR_No_USER_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c6_RSC_RRT_LiDAR_No_USER_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
default:
plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
}
}
return 1;
#else
return 0;
#endif
}
void RSC_RRT_LiDAR_No_USER_debug_initialize(void)
{
_RSC_RRT_LiDAR_No_USERMachineNumber_ = sf_debug_initialize_machine(
"RSC_RRT_LiDAR_No_USER","sfun",0,2,0,0,0);
sf_debug_set_machine_event_thresholds(_RSC_RRT_LiDAR_No_USERMachineNumber_,0,0);
sf_debug_set_machine_data_thresholds(_RSC_RRT_LiDAR_No_USERMachineNumber_,0);
}
void RSC_RRT_LiDAR_No_USER_register_exported_symbols(SimStruct* S)
{
}
<file_sep>/* mpcloop_engine.c: MPC simulation */
/*
Syntax: [u,y,xp,xmpc]=mpcloop_engine(MPCstruct);
Author: <NAME>
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.7 $ $Date: 2009/08/08 01:11:25 $
*/
#include "mpcloop_engine.h"
/* Merge common source */
/*
// MPC_COMMON.C contains the following functions
// dantzg
// getrv
*/
#include "mpc_common.c"
/* MDLOUTPUT */
/* computeOtuputs(const mxArray *S, int_T tid, real_T *lastx, real_T *lastu, real_T *v, real_T *optimalseq, long int *lastt, real_T *md_t, real_T *my_t, real_T *u_out, boolean_T unconstr)*/
static void computeOtuputs(const mxArray *S, int_T tid, real_T *lastx, real_T *lastu,
real_T *v, real_T *optimalseq, long int *lastt, real_T *md_t, real_T *my_t,
real_T *u_out, boolean_T unconstr)
/* Note that tid = current time step.*/
{
static real_T *ref_signal, *md_signal, *yoff, *voff, *myoff, *uoff;
static real_T *M, *Cm, *Dvm;
static int_T q, nvar, nxQP, p, degrees, PTYPE, useslack;
static long int maxiter;
static real_T *Kv, *Mv, *Kx, *Ku1, *Kut, *Kr, *KduINV;
static real_T *Mx, *Mu1, *rhsc0, *rhsa0, *Mlim, *MuKduINV, *TAB, *zmin;
static real_T *wtab;
static real_T *utarget;
static int_T nu, nx, nym, ny, nv;
static boolean_T no_md, no_ref, no_ym;
static boolean_T do_optimization;
static boolean_T ref_from_ws, ref_preview, md_from_ws, md_preview;
static int_T Nref_signal, Nmd_signal;
static boolean_T isemptyKv;
/* Counters */
int_T i,j;
int_T numc;
/* Accumulator */
real_T adder = 0;
real_T cache = 0;
/* Local work variables */
/* mxMalloc is used to allocate memory to these pointers except "tab" */
real_T *r = NULL; /* Reference values extended over pred. hor. */
real_T *ytilde = NULL; /* Measurement update */
real_T *vKv = NULL;
real_T *Mvv = NULL;
real_T *zopt = NULL; /* Optimal sequence */
real_T *zopx = NULL;
real_T *ztemp = NULL;
real_T *rhsc = NULL;
real_T *rhsa = NULL;
real_T *basis = NULL; /* Basis vector for QP */
long int *ib = NULL; /* Index vector for QP */
long int *il = NULL; /* Index vector fo QP */
real_T *duold = NULL;
real_T *tab = NULL; /* Tableau for QP */
int nuc = 0; /* number of unconstrained vars in DANTZGMP */
int iret; /* DANTZGMP return code */
do_optimization=(boolean_T) 1;
/* Get vars from structure S. In MPCLOOP_ENGINE, they are only initialized once,
in MPC_SFUN every time, because there might be multiple blocks in the diagram
sharing the same static variables */
if (tid==0) {
ref_signal=mxGetPr((real_T *)p_ref_signal(S));
Nref_signal=mxGetN(p_ref_signal(S));
md_signal=mxGetPr((real_T *)p_md_signal(S));
Nmd_signal=mxGetN(p_md_signal(S));
yoff=mxGetPr((real_T *)p_yoff(S));
voff=mxGetPr((real_T *)p_voff(S));
myoff=mxGetPr((real_T *)p_myoff(S));
uoff=mxGetPr((real_T *)p_uoff(S));
M=mxGetPr((real_T *)p_M(S));
Cm=mxGetPr((real_T *)p_Cm(S));
Dvm=mxGetPr((real_T *)p_Dvm(S));
Kv=mxGetPr((real_T *)p_Kv(S));
isemptyKv=mxIsEmpty(p_Kv(S));
Mv=mxGetPr((real_T *)p_Mv(S));
Kx=mxGetPr((real_T *)p_Kx(S));
Ku1=mxGetPr((real_T *)p_Ku1(S));
Kut=mxGetPr((real_T *)p_Kut(S));
Kr=mxGetPr((real_T *)p_Kr(S));
KduINV=mxGetPr((real_T *)p_KduINV(S));
Mx=mxGetPr((real_T *)p_Mx(S));
Mu1=mxGetPr((real_T *)p_Mu1(S));
rhsc0=mxGetPr((real_T *)p_rhsc0(S));
rhsa0=mxGetPr((real_T *)p_rhsa0(S));
Mlim=mxGetPr((real_T *)p_Mlim(S));
MuKduINV=mxGetPr((real_T *)p_MuKduINV(S));
TAB=mxGetPr((real_T *)p_TAB(S));
wtab=mxGetPr((real_T *)p_wtab(S));
zmin=mxGetPr((real_T *)p_zmin(S));
utarget=mxGetPr((real_T *)p_utarget(S));
nxQP = (int_T)*mxGetPr(p_nxQP(S)); /* Size of state vector without Noise model states */
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of extended state vector */
nym = (int_T)*mxGetPr(p_nym(S)); /* Size of measured output vector */
ny = (int_T)*mxGetPr(p_ny(S)); /* Size of current ref. vect. */
nv = (int_T)*mxGetPr(p_nv(S)); /* Size of current meas. dist. vect. */
ref_from_ws = (boolean_T) *mxGetPr(p_ref_from_ws(S)); /* reference signal comes from workspace */
ref_preview = (boolean_T) *mxGetPr(p_ref_preview(S)); /* =TRUE means preview is on */
md_from_ws = (boolean_T) *mxGetPr(p_md_from_ws(S)); /* meas. dist. signal comes from workspace */
md_preview = (boolean_T) *mxGetPr(p_md_preview(S)); /* =TRUE means preview is on */
q = mxGetM(p_Mlim(S)); /* Number of constraints in QP problem */
p = (int_T)*mxGetPr(p_p(S)); /* Prediction horizon */
degrees = (int_T)*mxGetPr(p_degrees(S));
PTYPE = (int_T)*mxGetPr(p_PTYPE(S));
maxiter = (int_T) *mxGetPr(p_maxiter(S)); /* Maxiter */
if (PTYPE == SOFTCONSTR)
useslack = 1;
else
useslack = 0;
nvar=degrees+useslack; /* number of optimization variables */
if (unconstr) PTYPE=UNCONSTR; /* remove MPC constraints */
}
#ifdef DEBUG
printf("lastx: [");
for (i=0;i<nx;i++)
printf("%g,",lastx[i]);
printf("]\n");
#endif
r = mxMalloc(p*ny*sizeof(real_T)); /* reference signal vector r from workspace */
if (do_optimization) {
if (!ref_from_ws) { /* ref. signal comes from Simulink diagram */
/* Get output ref. from input port */
for (i=0; i<p; i++) {
for (j=0; j<ny; j++) {
if (no_ref) {
r[j+i*ny] = 0; /* default: r=yoff */
}
else {
/* r[j+i*ny] = ref_t[j]-yoff[j]; */ /*This can never happen! */
;/* do nothing */
}
}
}
}
else { /* Reference signal is contained in ref_signal */
if (!ref_preview) {
getrv(r,ref_signal,*lastt,*lastt,ny,ny,Nref_signal);
/* Repeat over prediction horizon */
for (i=1; i<p; i++) {
for (j=0; j<ny; j++) {
r[j+i*ny] = r[j];
}
}
}
else {
getrv(r,ref_signal,*lastt,*lastt+p-1,ny,ny,Nref_signal);
}
}
#ifdef DEBUG
for (i=0; i<p; i++) {
printf("r(:,%d): [",i);
for (j=0; j<ny; j++)
printf("%5.2f, ",r[ny*i+j]);
printf("]'\n");
}
#endif
/* printf("r: ["); for (i=0;i<ny;i++) printf("%g,",r[i]); printf("]\n"); */
} /* end of if (do_optimization) */
/* Set up measured disturbance vector v from *mdPtrs or from rv (file)
as a one-component vector (even if no optimization is performed,
v is always needed by the state observer) */
if (!md_from_ws) {/* measured disturbance comes from Simulink diagram */
/* Get meas. dist. from input */
for (i=0; i<p+1; i++) {
for (j=0; j<nv-1; j++) {
if (no_md) {
v[j+i*nv] = 0; /* default: md=voff */
}
else {
v[j+i*nv] = md_t[j]-voff[j];
}
}
}
}
else { /* Measured disturbance signal is contained in md_signal */
if (!md_preview) {
getrv(v,md_signal,*lastt,*lastt,nv-1,nv-1,Nmd_signal);
/* Repeat over prediction horizon */
for (i=1; i<p+1; i++) {
for (j=0; j<nv; j++) {
v[j+i*nv] = v[j];
}
}
}
else {
getrv(v,md_signal,*lastt,*lastt+p,nv-1,nv,Nmd_signal);
}
}
#ifdef DEBUG
for (i=0; i<p+1; i++) {
printf("v(:,%d): [",i);
for (j=0; j<nv; j++)
printf("%5.2f, ",v[nv*i+j]);
printf("]'\n");
}
#endif
/* printf("v: ["); for (i=0;i<nv-1;i++) printf("%g,",v[i]); printf("]\n"); */
/* Measurement update of state observer */
/* ytilde=y-myoff-(Cm*xk+Dvm*vk); */
ytilde = mxMalloc(nym*sizeof(real_T));
#ifdef DEBUG
printf("ym[0]=%g\n",*ymPtrs[0]);
#endif
for (i=0; i<nym; i++) {
CLR; /* i.e., adder = 0 */
MVP(Cm, lastx, i, nym, nx);
MVP(Dvm, v, i, nym, nv);
/* printf("adder[%d]: %g\n",i,adder); */
ytilde[i]=my_t[i]-adder;
}
#ifdef DEBUG
printf("ytilde: [");
for (i=0;i<nym;i++)
printf("%g,",ytilde[i]);
printf("]\n");
#endif
/* xk=xk+M*ytilde; % (NOTE: what is called M here is also called M in KALMAN's help file) */
#ifdef DEBUG
printf("lastx[0]=%g\n",lastx[0]);
#endif
for (i=0; i<nx; i++) {
CLR;
MVP(M, ytilde, i, nx, nym);
lastx[i] += adder;
#ifdef DEBUG
printf("Measurement update: x[%d]: %f\n",i,lastx[i]);
#endif
}
/* Now ready for MPC optimization problem
xQP=xk(1:nxQP) only these first nx states are fed back to the QP problem
(i.e., multiplied by the Kx gain)
*/
if (do_optimization) {
#ifdef DEBUG
printf("Starting MPC Optimization Problem ...\n");
#endif
vKv = mxMalloc(degrees*sizeof(real_T));
if (isemptyKv) {
for (j=0; j<degrees; j++) {
vKv[j]=0.0;
}
if(PTYPE != UNCONSTR) {
Mvv = mxMalloc(q*sizeof(real_T)); /* q=number of constraints */
for(i=0; i<q; i++) {
Mvv[i]=0.0;
}
}
}
else {
for (j=0; j<degrees; j++) {
CLR;
MVTP(Kv, v, j, (p+1)*nv);
vKv[j]=adder;
}
if (PTYPE != UNCONSTR) {
/*printf("N(Mv),M(Mv): %d,%d -- nvar: %d, (p+1)*nv: %d\n",mxGetN(p_Mv(S)),mxGetM(p_Mv(S)),q,(p+1)*nv); */
Mvv = mxMalloc(q*sizeof(real_T));
for (i=0; i<q; i++) {
CLR;
MVP(Mv, v, i, q, (p+1)*nv);
Mvv[i]=adder;
}
}
}
/* The equivalent of mpc2.m starts here */
if (PTYPE == UNCONSTR) {
/* Unconstrained problem, compute zopt */
#ifdef DEBUG
printf("UNCONSTRAINED!\n");
#endif
/* zopt=-KduINV*(Kx'*xk+Ku1'*uk1+Kut'*utarget+Kr'*r+vKv'); */
ztemp = mxMalloc(degrees*sizeof(real_T)); /* stores linear term of the cost function */
for (i=0; i<degrees; i++) {
CLR;
MTVP(Kx, lastx, i, nxQP);
/* for (j=0; j<nxQP; j++) {
printf("Kx[%d]: %7.5f, x[%d]: %7.5f\n",j,mxGetPr(p_Kx(S))[j],j,lastx[j]);
} */
MTVP(Ku1, lastu, i, nu);
/*printf("N(Kut),M(Kut): %d,%d -- nvar: %d, p*nu: %d\n",mxGetN(p_Kut(S)),mxGetM(p_Kut(S)),nvar,p*nu); */
MTVP(Kut, utarget, i, p*nu);
/*printf("N(Kr),M(Kr): %d,%d -- nvar: %d, p*ny: %d\n",mxGetN(p_Kr(S)),mxGetM(p_Kr(S)),nvar,p*ny); */
MTVP(Kr, r, i, p*ny);
ztemp[i]=adder+vKv[i];
}
zopt = mxMalloc(degrees*sizeof(real_T));
for (i=0; i<degrees; i++) {
CLR;
MVP(KduINV, ztemp, i, nvar, nvar);
zopt[i] = -adder;
}
}
else {
/* Constrained, must solve QP */
#ifdef DEBUG
printf("CONSTRAINED!\n");
#endif
/* Set up matrices for QP */
/* rhsc=rhsc0+Mlim+Mx*xk+Mu1*uk1+Mvv; */
/* printf("N(rhsc0),M(rhsc0): %d,%d -- 1: %d, q: %d\n",mxGetN(p_rhsc0(S)),mxGetM(p_rhsc0(S)),1,q); */
rhsc = mxMalloc(q*sizeof(real_T));
for (i=0; i<q; i++) {
CLR;
MVP(Mx, lastx, i, q, nxQP);
MVP(Mu1, lastu, i, q, nu);
rhsc[i]=rhsc0[i]+Mlim[i]+Mvv[i]+adder;
}
/* rhsa=rhsa0-[(xk'*Kx+r'*Kr+uk1'*Ku1+vKv+utarget'*Kut),zeros(1,useslack)]'; */
rhsa = mxMalloc(nvar*sizeof(real_T));
rhsa[nvar-1] = 0.0; /* if useslack=1, then last entry of rhsa equals 0, otherwise is rewritten below */
for (j=0; j<degrees; j++) {
CLR;
MVTP(Kx, lastx, j, nxQP);
MVTP(Kr, r, j, p*ny);
MVTP(Ku1, lastu, j, nu);
MVTP(Kut, utarget, j, p*nu);
/* rhsa[j]=mxGetPr(p_rhsa0(S))[j]-(adder+vKv[j]); */
rhsa[j]=rhsa0[j]-(adder+vKv[j]);
}
/* basis=[KduINV*rhsa;rhsc-MuKduINV*rhsa]; */
numc = nvar+q;
basis = mxMalloc(numc*sizeof(real_T));
#ifdef DEBUG
printf("Basis is %d items\n", numc);
#endif
for(i=0; i<nvar; i++) {
CLR;
MVP(KduINV, rhsa, i, nvar, nvar);
basis[i]=adder;
#ifdef DEBUG
printf("B %f\n",basis[i]);
#endif
}
/* printf("N(MuKduINV),M(MuKduINV): %d,%d -- 1: %d, nvar: %d\n",mxGetN(p_MuKduINV(S)),mxGetM(p_MuKduINV(S)),nvar,q); */
for(i=0; i<q; i++) {
CLR;
MVP(MuKduINV, rhsa, i, q, nvar);
basis[i+nvar]=rhsc[i]-adder;
#ifdef DEBUG
printf("B %f\n",basis[i+mxGetM(p_KduINV(S))]);
#endif
}
/* ibi=-[1:nvar+nc]'; */
/* ili=-ibi; */
ib = mxMalloc(numc*sizeof(long int));
il = mxMalloc(numc*sizeof(long int));
for(i=0; i<numc; i++) {
il[i]=i+1;
ib[i]=-il[i];
}
/* Initialize the tableau */
tab = mxMalloc(numc*numc*sizeof(real_T));
memcpy(tab, TAB, numc*numc*sizeof(real_T));
#ifdef DEBUG
printf("Tableau (is it modified?): %f",tab[0]);
#endif
/* Call QP optimizer and check if problem was feasible */
iret = dantzg(tab, &numc, &numc, &nuc, basis, ib, il, &maxiter);
if (iret > 0) {
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (iret > maxiter) {
printf("Warning: maximum number of iterations exceeded, solution is unreliable. Please augment Optimizer.MaxIter.");
}
#endif
/* Feasible, extract the solution */
#ifdef DEBUG
printf("Feasible!\n");
#endif
/*
for j=1:nvar
if il(j) <= 0
zopt(j)=zmin(j);
else
zopt(j)=basis(il(j))+zmin(j);
end
end
*/
zopt = mxMalloc(nvar*sizeof(real_T));
for (i=0; i<nvar; i++) {
#ifdef DEBUG
printf("IL %d\n",il[i]);
#endif
if (il[i] <= 0) {
zopt[i]=zmin[i];
}
else {
zopt[i]=basis[il[i]-1]+zmin[i];
}
#ifdef DEBUG
printf("Zopt %f\n",zopt[i]);
#endif
}
}
else {
/* Unfeasible, recall last optimal sequence
This should never happen
*/
#ifdef DEBUG
printf("Unfeasible!\n");
#endif
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (iret == numc * -3) {
printf("Warning: problems with QP solver -- Unable to delete a variable from basis");
#ifdef DEBUG
printf("basis=[");
for (i=0;i<numc;i++) {
printf("%g",basis[i]);
if (i<numc-1)
printf(",");
}
printf("]\n");
#endif
printf("Using previous optimal sequence ...\n");
}
else {
printf("Warning: QP problem infeasible, using previous optimal sequence ...\n");
}
#endif
/* POSSIBLE OTHER DEFAULT: zopt=0, so that u(t)=last_u+0=last_u */
/* duold=Jm*optimalseq;
zopt=[duold(1+nu:nu*p);zeros(nu,1)]; % shifts
% Rebuilds optimalseq from zopt
%mxFree=find(kron(DUFree(:),ones(nu,1))); % Indices of mxFree moves
mxFree=find(DUFree(:));
epsslack=Inf; % Slack variable for soft output constraints
zopt=zopt(mxFree);
*/
zopx = mxMalloc(nu*p*sizeof(real_T));
zopt = mxMalloc(mxGetM(p_optimalseq(S))*sizeof(real_T));
for (i=0; i<(int_T)mxGetM(p_optimalseq(S)); i++) {
zopt[i]=0.0;
}
duold = mxMalloc(mxGetM(p_Jm(S))*sizeof(real_T));
for (i=0; i<(int_T)mxGetM(p_Jm(S)); i++) {
CLR;
MVP(mxGetPr(p_Jm(S)), optimalseq, i, (int_T)mxGetM(p_Jm(S)), (int_T)mxGetN(p_Jm(S)));
duold[i]=adder;
}
for (i=nu; i<nu*p; i++) {
zopx[i-nu]=duold[i];
}
for (i=nu*(p-1); i<nu*p; i++) {
zopx[i]=0.0;
}
/* Find mxFree moves */
j=0;
for (i=0; i<(int_T)mxGetM(p_DUFree(S)); i++) {
if ((int_T)(mxGetPr(p_DUFree(S))[i]) != 0) {
zopt[j++]=zopx[i];
}
}
}
/* Rebuild optimalseq */
/* printf("%d, %d\n",mxGetM(p_optimalseq(S)),degrees); */
for (i=0; i<degrees; i++) {
optimalseq[i]=zopt[i];
}
}
#ifdef DEBUG
printf("zopt[0] %f\n",zopt[0]);
#endif
/* Compute current input and update lastu */
for (i=0; i<nu; i++){
lastu[i] += zopt[i];
}
} /* End "if (do_optimization) ..." */
else {
/* Returns u=0. */
for (i=0; i<nu; i++) {
lastu[i] = -uoff[i];
}
}
for (i=0; i<nu; i++){
u_out[i] = lastu[i]+uoff[i];
#ifdef DEBUG
printf("Lastu %f\n",lastu[i]);
#endif
}
if (ztemp != NULL) {mxFree(ztemp); ztemp = NULL;}
if (zopx != NULL) {mxFree(zopx); zopx = NULL;}
if (duold != NULL) {mxFree(duold); duold = NULL;}
if (rhsc != NULL) {mxFree(rhsc); rhsc = NULL;}
if (rhsa != NULL) {mxFree(rhsa); rhsa = NULL;}
if (basis != NULL) {mxFree(basis); basis = NULL;}
if (ib != NULL) {mxFree(ib); ib = NULL;}
if (il != NULL) {mxFree(il); il = NULL;}
if (r != NULL) {mxFree(r); r = NULL;}
if (ytilde != NULL) {mxFree(ytilde); ytilde = NULL;}
if (vKv != NULL) {mxFree(vKv); vKv = NULL;}
if (Mvv != NULL) {mxFree(Mvv); Mvv = NULL;}
if (zopt != NULL) {mxFree(zopt); zopt = NULL;}
if (tab != NULL) {mxFree(tab); tab = NULL;}
} /* End of MDL_OUTPUTS */
/* updateObserver(const mxArray *S, int_T tid, real_T *lastx, real_T *lastu, real_T *v, long int *lastt) */
/* MDLUPDATE */
static void updateObserver(const mxArray *S, int_T tid, real_T *lastx, real_T *lastu, real_T *v, long int *lastt)
{
static int_T nu, nx, nv;
static real_T *A, *Bu, *Bv;
real_T *xk = NULL; /* Temporary state update */
int_T i,j;
real_T adder = 0;
#ifdef DEBUG
printf("UPDATE\n");
#endif
/* Initialize vars from structure S */
if (tid==0) {
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of extended state vector */
nv = (int_T)*mxGetPr(p_nv(S)); /* Size of current meas. dist. vect. */
A = mxGetPr((real_T *)p_A(S));
Bu = mxGetPr((real_T *)p_Bu(S));
Bv = mxGetPr((real_T *)p_Bv(S));
}
/* Time update of state observer */
xk = mxMalloc(nx*sizeof(real_T));
for (i=0; i<nx; i++) {
CLR;
MVP(A, lastx, i, nx, nx);
MVP(Bu, lastu, i, nx, nu);
MVP(Bv, v, i, nx, nv);
xk[i]=adder;
#ifdef DEBUG
printf("Time update: xk[%d]: %f\n",i,xk[i]);
#endif
}
memcpy(lastx, xk, nx*sizeof(real_T));
/* update lastt */
*lastt += 1;
#ifdef DEBUG
printf("Lastt: %d\n",*lastt);
#endif
if (xk != NULL) {mxFree(xk); xk = NULL;}
}
static void mpcloop_engine( double *UU, double *YY, double *XP, double *XMPC, const mxArray *S)
{
int i,j;
long int t; /* simulation time */
/* Retrieve some useful constants */
int nu = (int)*mxGetPr(p_nu(S)); /* Size of manipulated input vector */
int nx = (int)*mxGetPr(p_nx(S)); /* Size of state vector */
int ny = (int)*mxGetPr(p_ny(S)); /* Size of output vector*/
int nym = (int)*mxGetPr(p_nym(S)); /* Size of measured output vector*/
int nv = (int)*mxGetPr(p_nv(S)); /* Size of measured disturbance vector*/
int ndp = (int)*mxGetPr(p_ndp(S)); /* Size of unmeasured disturbance vector to simulation model*/
int nxp = (int)*mxGetPr(p_nxp(S)); /* Size of state vector of simulation model*/
/* Define pointers to structure elements (to speed up simulation):*/
real_T *xp0 = mxGetPr(p_xp0(S)); /* initial conditions */
real_T *md_signal = mxGetPr(p_md_signal(S)); /* meas. dist. signal */
real_T *ud_signal = mxGetPr(p_ud_signal(S)); /* unmeas. dist. signal*/
real_T *mn_signal = mxGetPr(p_mn_signal(S)); /* Y meas. noise signal*/
real_T *un_signal = mxGetPr(p_un_signal(S)); /* U noise signal*/
int Nmd = mxGetN(p_md_signal(S));
int Nud = mxGetN(p_ud_signal(S));
int Nmn = mxGetN(p_mn_signal(S));
int Nun = mxGetN(p_un_signal(S));
real_T *Cp = mxGetPr(p_Cp(S));
real_T *Dvp = mxGetPr(p_Dvp(S));
real_T *Ddp = mxGetPr(p_Ddp(S));
real_T *Ap = mxGetPr(p_Ap(S));
real_T *Bup = mxGetPr(p_Bup(S));
real_T *Bvp = mxGetPr(p_Bvp(S));
real_T *Bdp = mxGetPr(p_Bdp(S));
real_T *myindex = mxGetPr(p_myindex(S));
real_T *xpoff = mxGetPr(p_xpoff(S)); /* plant state offset */
real_T *dxpoff = mxGetPr(p_dxpoff(S)); /* plant state derivative/increment offset */
real_T *xoff = mxGetPr(p_xoff(S)); /* state offset of MPC plant model */
real_T *ypoff = mxGetPr(p_ypoff(S)); /* plant y-offset */
int p = (int)*mxGetPr(p_p(S)); /* Prediction horizon */
long int Tf = (long int) *mxGetPr(p_Tf(S));/* Total simulation time*/
boolean_T unconstr = (boolean_T) *mxGetPr(p_unconstr(S)); /* =1 means remove MPC constraints */
boolean_T openloop = (boolean_T) *mxGetPr(p_openloop(S)); /* =1 means do open-loop simulation */
real_T *mv_signal = mxGetPr(p_mv_signal(S)); /* U signal (with offset) for open-loop simulation*/
real_T adder; /* Accumulator*/
real_T *lastx, *lastu, *optimalseq, *v, *y, *r, *u, *ym, *v_t, *d_t, *yn_t, *un_t, *x_t;
long int *lastt;
real_T *deltayoff; /* difference plant-nominal y.offset */
real_T *deltauoff; /* difference plant-nominal u.offset*/
real_T *deltavoff; /* difference plant-nominal v.offset*/
real_T *xaux; /* Temporary storage for state update*/
real_T *vp_t, *up_t;
/*real_T *mv_t;*/
/*#ifdef WAITBAR*/
mxArray *rhs[2]; /* waitbar handle and value. If handle=-1, then no bar is drawn*/
real_T bar_time=0;
/* Set vars for waitbar and counter*/
rhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL); /*fraction of time*/
rhs[1] = p_barhandle(S); /* get pointer to handle from structure*/
/*#endif*/
lastx = mxCalloc(nx,sizeof(real_T));
lastu = mxCalloc(nu,sizeof(real_T));
optimalseq = mxCalloc(mxGetM(p_optimalseq(S)),sizeof(real_T));
v = mxCalloc((p+1)*nv,sizeof(real_T)); /* measured disturbance (sequence) given to MPC (w/out offsets)*/
v_t = mxCalloc(nv,sizeof(real_T)); /* current meas. dist. (with nominal offset)*/
d_t = mxCalloc(ndp,sizeof(real_T)); /* current unmeas. dist.*/
yn_t = mxCalloc(nym,sizeof(real_T)); /* current meas. noise*/
un_t = mxCalloc(nu,sizeof(real_T)); /* current noise on manipulated vars*/
x_t = mxCalloc(nxp,sizeof(real_T)); /* plant state (without offsets)*/
lastt = mxCalloc(1,sizeof(long int));
vp_t = mxCalloc(nv,sizeof(real_T)); /* current meas. dist. (with plant offset)*/
up_t = mxCalloc(nu,sizeof(real_T)); /* current input (with plant offset)*/
xaux = mxCalloc(nxp,sizeof(real_T)); /* temporary storage for state update*/
y = mxCalloc(ny,sizeof(real_T));
r = mxCalloc(ny*p,sizeof(real_T));
u = mxCalloc(nu,sizeof(real_T));
ym = mxCalloc(nym,sizeof(real_T));
deltayoff = mxCalloc(ny,sizeof(real_T));
deltauoff = mxCalloc(nu,sizeof(real_T));
if (nv-1>0) {
deltavoff = mxCalloc(nv-1,sizeof(real_T));
}
/*printf(">>DEBUG 1: OK!!!\n");*/
/* Initialize lastx, lastu, optimalseq, lastt to parameter values*/
memcpy(lastx, mxGetPr(p_lastx(S)), nx*sizeof(real_T));
memcpy(lastu, mxGetPr(p_lastu(S)), nu*sizeof(real_T));
memcpy(optimalseq, mxGetPr(p_optimalseq(S)), mxGetM(p_optimalseq(S))*sizeof(real_T));
memcpy(deltayoff, mxGetPr(p_ypoff(S)), ny*sizeof(real_T));
memcpy(deltauoff, mxGetPr(p_upoff(S)), nu*sizeof(real_T));
if (nv-1>0) {
memcpy(deltavoff, mxGetPr(p_vpoff(S)), (nv-1)*sizeof(real_T));
}
for (i=0;i<ny;i++) {
deltayoff[i]-=mxGetPr(p_yoff(S))[i];
}
for (i=0;i<nu;i++) {
deltauoff[i]-=mxGetPr(p_uoff(S))[i];
}
for (i=0;i<nv-1;i++) {
deltavoff[i]-=mxGetPr(p_voff(S))[i];
}
/*Initial Plant state*/
for (i=0; i<nxp; i++) {
x_t[i]=xp0[i]-xpoff[i];
}
/* additional measured disturbance due to offsets*/
for (i=0; i<p+1; i++) {
v[i*nv+nv-1]=1.0;
}
*lastt=0;
for (t=0; t<Tf; t++) {
for (i=0; i<nxp; i++) { /*save current Plant state*/
XP[t*nxp+i]=x_t[i]+xpoff[i];
}
if (!openloop) {
for (i=0; i<nx; i++) { /*save current MPC state*/
XMPC[t*nx+i]=lastx[i]+xoff[i];
}
}
/* get current disturbance signals*/
getrv(v_t,md_signal,t,t,nv-1,nv-1,Nmd);
getrv(d_t,ud_signal,t,t,ndp,ndp,Nud);
getrv(yn_t,mn_signal,t,t,nym,nym,Nmn);
getrv(un_t,un_signal,t,t,nu,nu,Nun);
/* Compute current output and save it*/
/*DISP_VEC(x_t,nxp,"x_t")*/
/*printf(">>DEBUG: t=%d, v_t[0]=%5.2f\n",t,v_t[0]);*/
for (i=0; i<nv-1; i++) { /* Adjust v-offsets to plant offsets*/
vp_t[i]=v_t[i]+deltavoff[i];
}
for (i=0; i<ny; i++) {
CLR; /* i.e., adder = 0*/
MVP(Cp, x_t, i, ny, nxp);
MVP(Dvp, vp_t, i, ny, nv-1);
MVP(Ddp, d_t, i, ny, ndp);
y[i]=adder;
YY[t*ny+i]=y[i]+ypoff[i]; /*save current output*/
}
/*DISP_VEC(deltayoff,ny,"deltayoff");*/
/*DISP_VEC(y,ny,"y");*/
if (openloop) { /* get current MV signal (with offset)*/
getrv(u,mv_signal,t,t,nu,nu,Nun);
}
else {
for (i=0; i<nym; i++) {
j=(int)(myindex[i])-1;
ym[i]=y[j]+deltayoff[j]+yn_t[i];
}
/* if yoff~=ypoff, ym is offset-mxFree. Otherwise it is affected by*/
/* an offset error due to wrong estimation of output nominal*/
/* operating point*/
/* reference signal (or MV signal) is loaded inside computeOtuputs*/
/* measurement update of state observer + MPC computation*/
computeOtuputs(S,t,lastx,lastu,v,optimalseq,lastt,v_t,ym,u,unconstr);
}
/* Save current input (lastu is already updated by computeOtuputs)*/
/* and add noise*/
/*DISP_VEC(deltauoff,nu,"deltauoff");*/
for (i=0; i<nu; i++) {
/* if (openloop) {*/
up_t[i]=u[i]-mxGetPr(p_uoff(S))[i]+un_t[i]; /*add input noise*/
/* UU[t*nu+i]=u[i]+un_t[i];*/
/* }*/
/* else {*/
/* up_t[i]=u[i]+deltauoff[i]+un_t[i];*/
/* Adjust u-offsets to plant offsets + noise*/
/* Nominal input offset is already included in u[i]*/
/* UU[t*nu+i]=up_t[i];*/
/* }*/
UU[t*nu+i]=up_t[i]+mxGetPr(p_upoff(S))[i];
}
/*DISP_VEC(up_t,nu,"up_t")*/
if (!openloop) {
updateObserver(S,t,lastx,lastu,v_t,lastt); /* time-update of state observer*/
}
/* Plant update*/
/*DISP_MAT(mxGetPr(p_Bup(S)),nxp,nu,"Bup")*/
/*DISP_VEC(x_t,nxp,"x_t(before)")*/
for (i=0; i<nxp; i++) {
CLR; /* i.e., adder = 0*/
MVP(Ap, x_t, i, nxp, nxp);
MVP(Bup, up_t, i, nxp, nu);
/*DISP_ADDER(i)*/
MVP(Bvp, vp_t, i, nxp, nv-1);
MVP(Bdp, d_t, i, nxp, ndp);
xaux[i]=adder+dxpoff[i];
}
/*Update Plant state vector*/
memcpy(x_t,xaux, nxp*sizeof(real_T));
/*DISP_VEC(x_t,nxp,"x_t(after)")*/
/*printf(">>DEBUG: OK!!!\n");*/
/*#ifdef WAITBAR*/
if (*mxGetPr(rhs[1])>-1) {
/* Update progress bar*/
adder=(real_T)(t+1)/Tf;
/*if (adder-bar_time>=.004) */ /*only allows updating waitbar up to 250 times*/
if (adder-bar_time>=.04) { /*only allows updating waitbar up to 25 times*/
/*adder=(real_T)(t+1)/Tf*100;*/
/*if (adder-bar_time>=4) */ /*only allows updating waitbar up to 25 times*/
bar_time=adder;
*mxGetPr(rhs[0])=(double)adder;
mexCallMATLAB(0,NULL, 2, rhs, "waitbar");
/*mexCallMATLAB(0,NULL, 0, NULL, "drawnow");*/
/*mexCallMATLAB(0,NULL, 1, rhs, "mpc_set_bar");*/
/*adder=*mxGetPr(rhs[1]);*/
/*printf("h=%5.2f, t=%d, timebar=%5.5f\n",adder,t,bar_time);*/
/*mexCallMATLAB(0,NULL, 0, NULL, "keyboard");*/
/*mexCallMATLAB(0,NULL, 0,NULL, "global progress_bar");*/
/*mexCallMATLAB(0,NULL, 1, rhs, "progress_bar.setValue");*/
/*printf("%5.2f\n",adder);*/
}
}
/*#endif*/
}
/*Release allocated memory*/
mxFree(lastx);
mxFree(lastu);
mxFree(optimalseq);
mxFree(v);
mxFree(v_t);
mxFree(d_t);
mxFree(yn_t);
mxFree(un_t);
mxFree(x_t);
mxFree(lastt);
mxFree(vp_t);
mxFree(up_t);
mxFree(xaux);
mxFree(y);
mxFree(r);
mxFree(u);
mxFree(ym);
mxFree(deltayoff);
mxFree(deltauoff);
if (nv-1>0) {
mxFree(deltavoff);
}
mxDestroyArray(rhs[0]);
return;
}
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
double *u, *y, *xp, *xmpc;
int Tf = (int)*mxGetPr(p_Tf(MPCstruct_IN));
int nu = (int)*mxGetPr(p_nu(MPCstruct_IN)); /* Size of manipulated input vector*/
int nx = (int)*mxGetPr(p_nx(MPCstruct_IN)); /* Size of state vector*/
int ny = (int)*mxGetPr(p_ny(MPCstruct_IN)); /* Size of output vector*/
int nym = (int)*mxGetPr(p_nym(MPCstruct_IN)); /* Size of measured output vector*/
int nv = (int)*mxGetPr(p_nv(MPCstruct_IN)); /* Size of measured disturbance vector*/
int nxp = (int)*mxGetPr(p_nxp(MPCstruct_IN)); /* Size of state vector of simulation model*/
/* Create a matrix for the return argument: vector dim=#rows, time-steps=#columns*/
U_OUT = mxCreateDoubleMatrix(nu,Tf,mxREAL);
Y_OUT = mxCreateDoubleMatrix(ny,Tf,mxREAL);
XP_OUT = mxCreateDoubleMatrix(nxp,Tf,mxREAL);
XMPC_OUT = mxCreateDoubleMatrix(nx,Tf,mxREAL);
/* Assign pointers to the various parameters*/
u = mxGetPr(U_OUT);
y = mxGetPr(Y_OUT);
xp = mxGetPr(XP_OUT);
xmpc = mxGetPr(XMPC_OUT);
/* Do the actual computations in a subroutine*/
mpcloop_engine(u,y,xp,xmpc,MPCstruct_IN);
/*printf("DEBUG: Type 'return' to continue (probably Matlab will crash !) \n");*/
/*mexCallMATLAB(0,NULL, 0, NULL, "keyboard");*/
return;
}
<file_sep>/* Include files */
#include "MPC_gamecontroller_LiDAR_sfun.h"
#include "c1_MPC_gamecontroller_LiDAR.h"
#include "c2_MPC_gamecontroller_LiDAR.h"
#include "c4_MPC_gamecontroller_LiDAR.h"
#include "c5_MPC_gamecontroller_LiDAR.h"
#include "c6_MPC_gamecontroller_LiDAR.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
int32_T _sfEvent_;
uint32_T _MPC_gamecontroller_LiDARMachineNumber_;
real_T _sfTime_;
/* Function Declarations */
/* Function Definitions */
void MPC_gamecontroller_LiDAR_initializer(void)
{
_sfEvent_ = CALL_EVENT;
}
void MPC_gamecontroller_LiDAR_terminator(void)
{
}
/* SFunction Glue Code */
unsigned int sf_MPC_gamecontroller_LiDAR_method_dispatcher(SimStruct
*simstructPtr, unsigned int chartFileNumber, const char* specsCksum, int_T
method, void *data)
{
if (chartFileNumber==1) {
c1_MPC_gamecontroller_LiDAR_method_dispatcher(simstructPtr, method, data);
return 1;
}
if (chartFileNumber==2) {
c2_MPC_gamecontroller_LiDAR_method_dispatcher(simstructPtr, method, data);
return 1;
}
if (chartFileNumber==4) {
c4_MPC_gamecontroller_LiDAR_method_dispatcher(simstructPtr, method, data);
return 1;
}
if (chartFileNumber==5) {
c5_MPC_gamecontroller_LiDAR_method_dispatcher(simstructPtr, method, data);
return 1;
}
if (chartFileNumber==6) {
c6_MPC_gamecontroller_LiDAR_method_dispatcher(simstructPtr, method, data);
return 1;
}
return 0;
}
unsigned int sf_MPC_gamecontroller_LiDAR_process_check_sum_call( int nlhs,
mxArray * plhs[], int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
char commandName[20];
if (nrhs<1 || !mxIsChar(prhs[0]) )
return 0;
/* Possible call to get the checksum */
mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (strcmp(commandName,"sf_get_check_sum"))
return 0;
plhs[0] = mxCreateDoubleMatrix( 1,4,mxREAL);
if (nrhs>1 && mxIsChar(prhs[1])) {
mxGetString(prhs[1], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (!strcmp(commandName,"machine")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3500102304U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2230322272U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(4076412719U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2413438972U);
} else if (!strcmp(commandName,"exportedFcn")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0U);
} else if (!strcmp(commandName,"makefile")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2808376569U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3811416689U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(149647928U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(524054839U);
} else if (nrhs==3 && !strcmp(commandName,"chart")) {
unsigned int chartFileNumber;
chartFileNumber = (unsigned int)mxGetScalar(prhs[2]);
switch (chartFileNumber) {
case 1:
{
extern void sf_c1_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *
plhs[]);
sf_c1_MPC_gamecontroller_LiDAR_get_check_sum(plhs);
break;
}
case 2:
{
extern void sf_c2_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *
plhs[]);
sf_c2_MPC_gamecontroller_LiDAR_get_check_sum(plhs);
break;
}
case 4:
{
extern void sf_c4_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *
plhs[]);
sf_c4_MPC_gamecontroller_LiDAR_get_check_sum(plhs);
break;
}
case 5:
{
extern void sf_c5_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *
plhs[]);
sf_c5_MPC_gamecontroller_LiDAR_get_check_sum(plhs);
break;
}
case 6:
{
extern void sf_c6_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *
plhs[]);
sf_c6_MPC_gamecontroller_LiDAR_get_check_sum(plhs);
break;
}
default:
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0.0);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0.0);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0.0);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0.0);
}
} else if (!strcmp(commandName,"target")) {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3176360410U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1862911626U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(659157607U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1884031890U);
} else {
return 0;
}
} else {
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1943071481U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3929387417U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1441427973U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(170185419U);
}
return 1;
#else
return 0;
#endif
}
unsigned int sf_MPC_gamecontroller_LiDAR_autoinheritance_info( int nlhs, mxArray
* plhs[], int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
char commandName[32];
if (nrhs<2 || !mxIsChar(prhs[0]) )
return 0;
/* Possible call to get the autoinheritance_info */
mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (strcmp(commandName,"get_autoinheritance_info"))
return 0;
{
unsigned int chartFileNumber;
chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
switch (chartFileNumber) {
case 1:
{
extern mxArray *sf_c1_MPC_gamecontroller_LiDAR_get_autoinheritance_info
(void);
plhs[0] = sf_c1_MPC_gamecontroller_LiDAR_get_autoinheritance_info();
break;
}
case 2:
{
extern mxArray *sf_c2_MPC_gamecontroller_LiDAR_get_autoinheritance_info
(void);
plhs[0] = sf_c2_MPC_gamecontroller_LiDAR_get_autoinheritance_info();
break;
}
case 4:
{
extern mxArray *sf_c4_MPC_gamecontroller_LiDAR_get_autoinheritance_info
(void);
plhs[0] = sf_c4_MPC_gamecontroller_LiDAR_get_autoinheritance_info();
break;
}
case 5:
{
extern mxArray *sf_c5_MPC_gamecontroller_LiDAR_get_autoinheritance_info
(void);
plhs[0] = sf_c5_MPC_gamecontroller_LiDAR_get_autoinheritance_info();
break;
}
case 6:
{
extern mxArray *sf_c6_MPC_gamecontroller_LiDAR_get_autoinheritance_info
(void);
plhs[0] = sf_c6_MPC_gamecontroller_LiDAR_get_autoinheritance_info();
break;
}
default:
plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
}
}
return 1;
#else
return 0;
#endif
}
unsigned int sf_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info( int
nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[] )
{
#ifdef MATLAB_MEX_FILE
char commandName[64];
if (nrhs<2 || !mxIsChar(prhs[0]))
return 0;
/* Possible call to get the get_eml_resolved_functions_info */
mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
if (strcmp(commandName,"get_eml_resolved_functions_info"))
return 0;
{
unsigned int chartFileNumber;
chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
switch (chartFileNumber) {
case 1:
{
extern const mxArray
*sf_c1_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c1_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
case 2:
{
extern const mxArray
*sf_c2_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c2_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
case 4:
{
extern const mxArray
*sf_c4_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c4_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
case 5:
{
extern const mxArray
*sf_c5_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c5_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
case 6:
{
extern const mxArray
*sf_c6_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info(void);
mxArray *persistentMxArray = (mxArray *)
sf_c6_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info();
plhs[0] = mxDuplicateArray(persistentMxArray);
mxDestroyArray(persistentMxArray);
break;
}
default:
plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
}
}
return 1;
#else
return 0;
#endif
}
void MPC_gamecontroller_LiDAR_debug_initialize(void)
{
_MPC_gamecontroller_LiDARMachineNumber_ = sf_debug_initialize_machine(
"MPC_gamecontroller_LiDAR","sfun",0,5,0,0,0);
sf_debug_set_machine_event_thresholds(_MPC_gamecontroller_LiDARMachineNumber_,
0,0);
sf_debug_set_machine_data_thresholds(_MPC_gamecontroller_LiDARMachineNumber_,0);
}
void MPC_gamecontroller_LiDAR_register_exported_symbols(SimStruct* S)
{
}
<file_sep>/* DANTZGMP QP optimizer - Source for generating Mex file */
/*
Author: <NAME>, <NAME>
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.4 $ $Date: 2008/04/28 03:24:22 $
*/
#include "dantzgmp.h"
/* Subroutine */
int dantzg(real_T *a, int *ndim, int *n, int *nuc, real_T *bv, integer *ib, integer *il, integer *maxiter)
{
/* System generated locals */
integer a_dim1, a_offset, i__1;
/* Local variables */
integer ichk, iter;
real_T rmin, test;
integer iout, i, ichki, ic, ir, nt, istand, irtest;
extern int trsimp_(real_T *, int *, integer *, int *, real_T *, integer *, integer *);
integer iad;
real_T val, rat;
int iret=-1;
/* ******************************************* */
/* VERSION MODIFIED 1/88 BY <NAME> */
/* Modified 12/98 by <NAME> for use as MATLAB MEX file */
/* Modified 03/01 by <NAME> to introduce MAXITER */
/* ******************************************* */
/* DANTZIG QUADRATIC PROGRAMMING ALGORITHM. */
/* <NAME> 6/83 */
/* ASSUMES THAT THE INPUT VARIABLES REPRESENT A FEASIBLE INITIAL */
/* BASIS SET. */
/* N NUMBER OF CONSTRAINED VARIABLES (INCLUDING SLACK VARIABLES).*/
/* NUC NUMBER OF UNCONSTRAINED VARIABLES, IF ANY */
/* BV VECTOR OF VALUES OF THE BASIS VARIABLES. THE LAST NUC */
/* ELEMENTS WILL ALWAYS BE KEPT IN THE BASIS AND WILL NOT */
/* BE CHECKED FOR FEASIBILITY. */
/* IB INDEX VECTOR, N ELEMENTS CORRESPONDING TO THE N VARIABLES. */
/* IF IB(I) IS POSITIVE, THE ITH */
/* VARIABLE IS BASIC AND BV(IB(I)) IS ITS CURRENT VALUE. */
/* IF IB(I) IS NEGATIVE, THE ITH VARIABLE IS NON-BASIC */
/* AND -IB(I) IS ITS COLUMN NUMBER IN THE TABLEAU. */
/* IL VECTOR DEFINED AS FOR IB BUT FOR THE N LAGRANGE MULTIPLIERS.*/
/* A THE TABLEAU -- SEE TRSIMP DESCRIPTION. */
/* IRET IF SUCCESSFUL, CONTAINS NUMBER OF ITERATIONS REQUIRED. */
/* OTHER POSSIBLE VALUES ARE: */
/* - I NON-FEASIBLE BV(I) */
/* -2N NO WAY TO ADD A VARIABLE TO BASIS */
/* -3N NO WAY TO DELETE A VARIABLE FROM BASIS */
/* NOTE: THE LAST TWO SHOULD NOT OCCUR AND INDICATE BAD INPUT*/
/* OR A BUG IN THE PROGRAM. */
/* CHECK FEASIBILITY OF THE INITIAL BASIS. */
/* Parameter adjustments */
--il;
--ib;
--bv;
a_dim1 = *ndim;
a_offset = a_dim1 + 1;
a -= a_offset;
/* Function Body */
iter = 1;
nt = *n + *nuc;
i__1 = *n;
for (i = 1; i <= i__1; ++i) {
if (ib[i] < 0 || bv[ib[i]] >= 0.f) {
goto L50;
}
iret = -i;
goto L900;
L50:
;
}
istand = 0;
L100:
/* SEE IF WE ARE AT THE SOLUTION. */
if (istand != 0) {
goto L120;
}
val = 0.f;
iret = iter;
i__1 = *n;
for (i = 1; i <= i__1; ++i) {
if (il[i] < 0) {
goto L110;
}
/* PICK OUT LARGEST NEGATIVE LAGRANGE MULTIPLIER. */
test = bv[il[i]];
if (test >= val) {
goto L110;
}
val = test;
iad = i;
ichk = il[i];
ichki = i + *n;
L110:
;
}
/* IF ALL LAGRANGE MULTIPLIERS WERE NON-NEGATIVE, ALL DONE. */
/* ELSE, SKIP TO MODIFICATION OF BASIS */
if (val >= 0.f) {
iret=iter;
goto L900;
}
ic = -ib[iad];
goto L130;
/* PREVIOUS BASIS WAS NON-STANDARD. MUST MOVE LAGRANGE */
/* MULTIPLIER ISTAND INTO BASIS. */
L120:
iad = istand;
ic = -il[istand - *n];
/* CHECK TO SEE WHAT VARIABLE SHOULD BE REMOVED FROM BASIS. */
L130:
ir = 0;
/* FIND SMALLEST POSITIVE RATIO OF ELIGIBLE BASIS VARIABLE TO */
/* POTENTIAL PIVOT ELEMENT. FIRST TYPE OF ELIGIBLE BASIS VARIABLE
*/
/* ARE THE REGULAR N VARIABLES AND SLACK VARIABLES IN THE BASIS. */
i__1 = *n;
for (i = 1; i <= i__1; ++i) {
irtest = ib[i];
/* NO GOOD IF THIS VARIABLE ISN'T IN BASIS OR RESULTING PIVOT WOULD */
/* BE ZERO. */
if (irtest < 0 || a[irtest + ic * a_dim1] == 0.f) {
goto L150;
}
rat = bv[irtest] / a[irtest + ic * a_dim1];
/* THE FOLLOWING IF STATEMENT WAS MODIFIED 7/88 BY NL RICKER */
/* TO CORRECT A BUG IN CASES WHERE RAT=0. */
if (rat < 0.f || rat == 0.f && a[irtest + ic * a_dim1] < 0.f) {
goto L150;
}
if (ir == 0) {
goto L140;
}
if (rat > rmin) {
goto L150;
}
L140:
rmin = rat;
ir = irtest;
iout = i;
L150:
;
}
/* SECOND POSSIBLITY IS THE LAGRANGE MULTIPLIER OF THE VARIABLE ADDED*/
/* TO THE MOST RECENT STANDARD BASIS. */
if (a[ichk + ic * a_dim1] == 0.f) {
goto L170;
}
rat = bv[ichk] / a[ichk + ic * a_dim1];
if (rat < 0.f) {
goto L170;
}
if (ir == 0) {
goto L160;
}
if (rat > rmin) {
goto L170;
}
L160:
ir = ichk;
iout = ichki;
L170:
if (ir != 0) {
goto L200;
}
iret = *n * -3;
/* printf("** Fatal error in QP solver!\n"); */
goto L900;
L200:
/* SET INDICES AND POINTERS */
if (iout > *n) {
goto L220;
}
ib[iout] = -ic;
goto L230;
L220:
il[iout - *n] = -ic;
L230:
if (iad > *n) {
goto L240;
}
ib[iad] = ir;
goto L250;
L240:
il[iad - *n] = ir;
L250:
/* TRANSFORM THE TABLEAU */
trsimp_(&a[a_offset], ndim, &nt, n, &bv[1], &ir, &ic);
++iter;
if (iter > *maxiter) { /* No solution found within MAXITER iterations */
iret = iter;
goto L900;
}
/* WILL NEXT TABLEAU BE STANDARD? */
istand = 0;
i__1 = *n;
for (i = 1; i <= i__1; ++i) {
/* L260: */
if (ib[i] > 0 && il[i] > 0) {
goto L270;
}
}
goto L280;
L270:
istand = iout + *n;
L280:
goto L100;
L900:
return iret;
} /* dantzg_ */
/* Subroutine */ int trsimp_(real_T *a, int *ndim, integer *m, int *n, real_T *bv, integer *ir, integer *ic)
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2;
/* Local variables */
integer i, j;
real_T ap;
/* TRANSFORM SIMPLEX TABLEAU. SWITCH ONE BASIS VARIABLE FOR ONE */
/* NON-BASIC VARIABLE. */
/* <NAME> 6/83 */
/* A SIMPLEX TABLEAU. ACTUALLY DIMENSIONED FOR NDIM ROWS IN
*/
/* THE CALLING PROGRAM. IN THIS PROCEDURE, ONLY THE A(M,N)
*/
/* SPACE IS USED. */
/* NDIM ACTUAL ROW DIMENSION OF A IN THE CALLING PROGRAM */
/* M NUMBER OF ROWS IN THE TABLEAU */
/* N NUMBER OF COLUMNS IN THE TABLEAU */
/* BV VECTOR OF M BASIS VARIABLE VALUES */
/* IR ROW IN TABLEAU CORRESPONDING TO THE BASIC VARIABLE THAT
*/
/* IS TO BECOME NON-BASIC */
/* IC COLUMN IN TABLEAU CORRESPONDING TO THE NON-BASIC VARIABLE
*/
/* THAT IS TO BECOME BASIC. */
/* FIRST CALCULATE NEW VALUES FOR THE NON-PIVOT ELEMENTS. */
/* Parameter adjustments */
--bv;
a_dim1 = *ndim;
a_offset = a_dim1 + 1;
a -= a_offset;
/* Function Body */
i__1 = *m;
for (i = 1; i <= i__1; ++i) {
if (i == *ir) {
goto L110;
}
ap = a[i + *ic * a_dim1] / a[*ir + *ic * a_dim1];
bv[i] -= bv[*ir] * ap;
i__2 = *n;
for (j = 1; j <= i__2; ++j) {
if (j == *ic) {
goto L100;
}
a[i + j * a_dim1] -= a[*ir + j * a_dim1] * ap;
L100:
;
}
L110:
;
}
/* NOW TRANSFORM THE PIVOT ROW AND PIVOT COLUMN. */
ap = a[*ir + *ic * a_dim1];
i__1 = *m;
for (i = 1; i <= i__1; ++i) {
a[i + *ic * a_dim1] = -a[i + *ic * a_dim1] / ap;
/* L120: */
}
bv[*ir] /= ap;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
a[*ir + j * a_dim1] /= ap;
/* L130: */
}
a[*ir + *ic * a_dim1] = 1.f / ap;
return 0;
} /* trsimp_ */
<file_sep>/* DANTZGMP QP optimizer - Source for generating Mex file */
/*
Author: <NAME>, <NAME>
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.6.7 $ $Date: 2009/08/08 01:11:27 $
*/
/* MATLAB calling format: */
/*
[bas,ib,il,iter,tab]=qpsolver(tabi,basi,ibi,ili,maxiter)
Inputs:
tabi : initial tableau
basi : initial basis
ibi : initial setting of ib
ili : initial setting of il
maxiter : max number of iteration (optional. Default=200)
Outputs:
bas : final basis vector
ib : index vector for the variables -- see examples
il : index vector for the lagrange multipliers -- see examples
iter : iteration counter (if iter>maxiter, then max # iterations was exceeded)
tab : final tableau
*/
#include "math.h"
#include "mex.h"
#include "dantzgmp_solver.c"
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
double *tabi, *basi, *ibi, *ili, *maxiter;
int M, N, rows, cols, iret;
int nuc=0;
int i, j;
int MN = 0;
long len;
mxArray *ptrs[5];
double *bas, *ib, *il, *iter, *tab;
integer *ibint, *ilint;
integer buflen, *maxiterint;
/* Verify correct number of input and output arguments. */
if (nrhs < 4) {
mexErrMsgIdAndTxt("MPC:computation:QPSolverError1","You must supply at least 4 input arguments.\n");
}
tabi = mxGetPr(prhs[0]);
basi = mxGetPr(prhs[1]);
ibi = mxGetPr(prhs[2]);
ili = mxGetPr(prhs[3]);
maxiter = mxGetPr(prhs[4]);
if (nlhs < 3) {
mexErrMsgIdAndTxt("MPC:computation:QPSolverError2","You must supply at least 3 output arguments.\n");
}
/* Error checking on inputs */
/* Checking TABI */
M = mxGetM(prhs[0]);
N = mxGetN(prhs[0]);
if (M <= 0 || N <= 0) {
mexErrMsgIdAndTxt("MPC:computation:QPSolverError3","TABI is empty.\n");
}
/* Checking BASI */
rows = mxGetM(prhs[1]);
cols = mxGetN(prhs[1]);
len = MPCmax(rows,cols);
if (MPCmin(rows,cols) != 1 || len != M) {
mexErrMsgIdAndTxt("MPC:computation:QPSolverError4","BASI must be a vector, length = number of rows in TABI.\n");
}
/* Checking IBI */
rows = mxGetM(prhs[2]);
cols = mxGetN(prhs[2]);
len = MPCmax(rows,cols);
if (MPCmin(rows,cols) != 1 || len != M) {
mexErrMsgIdAndTxt("MPC:computation:QPSolverError5","IBI must be a vector, length = number of rows in TABI.\n");
}
/* Checking ILI */
rows = mxGetM(prhs[3]);
cols = mxGetN(prhs[3]);
len = MPCmax(rows,cols);
if (MPCmin(rows,cols) != 1 || len != M) {
mexErrMsgIdAndTxt("MPC:computation:QPSolverError6","ILI must be a vector, length = number of rows in TABI.\n");
}
/* Allocate space for output variables and define corresponding C pointers */
ptrs[0] = mxCreateDoubleMatrix(M, 1, mxREAL);
bas = mxGetPr(ptrs[0]);
ptrs[1] = mxCreateDoubleMatrix(M, 1, mxREAL);
ib = mxGetPr(ptrs[1]);
ptrs[2] = mxCreateDoubleMatrix(M, 1, mxREAL);
il = mxGetPr(ptrs[2]);
ptrs[3] = mxCreateDoubleMatrix(1, 1, mxREAL);
iter = mxGetPr(ptrs[3]);
ptrs[4] = mxCreateDoubleMatrix(M, N, mxREAL);
tab = mxGetPr(ptrs[4]);
/* We have to convert ib and il from double to integer and vice-versa. */
/* Allocate arrays for storing the integer versions. */
buflen = M * sizeof(*ibint);
ibint = mxMalloc(buflen); /* Pointer to integer version of ib */
ilint = mxMalloc(buflen); /* Pointer to integer version of il */
maxiterint = mxMalloc(sizeof(*maxiterint)); /* Pointer to integer version of maxiterint */
if (nrhs>4) {
*maxiterint = (integer) *maxiter;
}
else {
*maxiterint = 200;
}
/* Initialization */
for (i=0; i<M; i++) {
bas[i] = basi[i];
ibint[i] = (integer) ibi[i];
ilint[i] = (integer) ili[i];
}
for (j=0; j<N; j++) {
for (i=0; i<M; i++) {
tab[MN] = tabi[MN];
MN++;
}
}
/* Call DANTZG for the calculations */
iret = dantzg(tab, &N, &N, &nuc, bas, ibint, ilint, maxiterint);
/* Store number of iterations. */
*iter = (double) iret;
/* Return results to MATLAB. First convert integer versions */
/* of ib and il back to real, then set pointers to outputs. */
for (i=0; i<M; i++) {
ib[i] = (double) ibint[i];
il[i] = (double) ilint[i];
}
for (i=0; i<nlhs; i++) {
plhs[i] = ptrs[i];
}
if (iret == N * -3) {
mexPrintf("Unable to delete a variable from basis\n");
mexPrintf("basis=[");
for (i=0;i<M;i++) {
mexPrintf("%g",bas[i]);
if (i<M-1) {
mexPrintf(",");
}
}
mexPrintf("]\n");
mexErrMsgIdAndTxt("MPC:computation:QPSolverError7","Fatal error in QP solver -- Closed-loop system may be unstable\n");
}
}
<file_sep>
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML is auto-generated from an M-file.
To make changes, update the M-file and republish this document.
--><title>Switching MPC Controllers with Multiple MPC Controllers Block</title><meta name="generator" content="MATLAB 7.10"><meta name="date" content="2010-01-05"><meta name="m-file" content="mpcswitching"><link rel="stylesheet" type="text/css" href="../../../matlab/demos/private/style.css"></head><body><div class="header"><div class="left"><a href="matlab:edit mpcswitching">Open mpcswitching.m in the Editor</a></div><div class="right"><a href="matlab:echodemo mpcswitching">Run in the Command Window</a></div></div><div class="content"><h1>Switching MPC Controllers with Multiple MPC Controllers Block</h1><!--introduction--><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">System Description</a></li><li><a href="#3">Model Parameters</a></li><li><a href="#4">State Space Models</a></li><li><a href="#6">Multi-MPC Control Setup</a></li><li><a href="#11">Simulation with Multiple MPC Controllers Block</a></li><li><a href="#15">Repeat Simulation Using MPC1 Only (Assumes Masses Never in Contact)</a></li><li><a href="#17">Repeat Simulation Using MPC2 Only (Assumes Masses Always in Contact)</a></li></ul></div><p>This demonstration shows how to use an Multiple MPC Controllers block in a multi-controller set-up to achieve a simple nonlinear control scheme.</p><p>Author: <NAME></p><h2>System Description<a name="2"></a></h2><p>The system is composed by two masses M1 and M2 connected to two springs k1 and k2 respectively. The collision is assumed completely inelastic. Mass M1 is pulled by a force F, which is the manipulated variable. The objective is to make mass M1's position y1 track a given reference r.</p><p>The dynamics are twofold: when the masses are detached, M1 moves freely. Otherwise, M1+M2 move together. We assume that only M1 position and a contact sensor are available for feedback. The latter is used to trigger switching the MPC controllers. Note that position and velocity of mass M2 are not controllable.</p><pre> /-----\ k1 ||
F <--- | M1 |----/\/\/\-------------[|| wall
|| | |---/ ||
|| k2 \-/ /----\ ||
wall||]--/\/\/\-------------------| M2 | ||
|| \----/ ||
|| ||
----yeq2------------------ y1 ------ y2 ----------------yeq1----> y axis</pre><p>The model is a simplified version of the model proposed in the following reference:</p><p><NAME>, <NAME>, <NAME>, and <NAME>, "Hybrid modeling and control of a multibody magnetic actuator for automotive applications," in Proc. 46th IEEE® Conf. on Decision and Control, New Orleans, LA, 2007.</p><h2>Model Parameters<a name="3"></a></h2><pre class="codeinput">M1=1; <span class="comment">% mass</span>
M2=5; <span class="comment">% mass</span>
k1=1; <span class="comment">% spring constant</span>
k2=0.1; <span class="comment">% spring constant</span>
b1=0.3; <span class="comment">% friction coefficient</span>
b2=0.8; <span class="comment">% friction coefficient</span>
yeq1=10; <span class="comment">% wall mount position</span>
yeq2=-10; <span class="comment">% wall mount position</span>
</pre><h2>State Space Models<a name="4"></a></h2><p>states: position and velocity of mass M1; manipulated variable: pull force F measured disturbance: a constant value of 1 which provides calibrates spring force to the right value measured output: position of mass M1</p><p>State-space model of M1 when masses are not in contact.</p><pre class="codeinput">A1=[0 1;-k1/M1 -b1/M1];
B1=[0 0;-1/M1 k1*yeq1/M1];
C1=[1 0];
D1=[0 0];
sys1=ss(A1,B1,C1,D1);
sys1=setmpcsignals(sys1,<span class="string">'MD'</span>,2);
</pre><pre class="codeoutput">-->Assuming unspecified input signals are manipulated variables.
</pre><p>State-space model when the two masses are in contact.</p><pre class="codeinput">A2=[0 1;-(k1+k2)/(M1+M2) -(b1+b2)/(M1+M2)];
B2=[0 0;-1/(M1+M2) (k1*yeq1+k2*yeq2)/(M1+M2)];
C2=[1 0];
D2=[0 0];
sys2=ss(A2,B2,C2,D2);
sys2=setmpcsignals(sys2,<span class="string">'MD'</span>,2);
</pre><pre class="codeoutput">-->Assuming unspecified input signals are manipulated variables.
</pre><h2>Multi-MPC Control Setup<a name="6"></a></h2><pre class="codeinput">Ts=0.2; <span class="comment">% sampling time</span>
p=20; <span class="comment">% prediction horizon</span>
m=1; <span class="comment">% control horizon</span>
</pre><p>Define MPC object for mass M1 detached from M2.</p><pre class="codeinput">MPC1=mpc(sys1,Ts,p,m);
MPC1.Weights.OV=1;
</pre><pre class="codeoutput">-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
</pre><p>Define constraints on the manipulated variable.</p><pre class="codeinput">MPC1.MV=struct(<span class="string">'Min'</span>,0,<span class="string">'Max'</span>,Inf,<span class="string">'RateMin'</span>,-1e3,<span class="string">'RateMax'</span>,1e3);
</pre><p>Define MPC object for mass M1 and M2 stuck together.</p><pre class="codeinput">MPC2=mpc(sys2,Ts,p,m);
MPC2.Weights.OV=1;
</pre><pre class="codeoutput">-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
</pre><p>Define constraints on the manipulated variable.</p><pre class="codeinput">MPC2.MV=MPC1.MV;
</pre><h2>Simulation with Multiple MPC Controllers Block<a name="11"></a></h2><pre class="codeinput"><span class="keyword">if</span> ~mpcchecktoolboxinstalled(<span class="string">'simulink'</span>)
disp(<span class="string">'Simulink(R) is required to run this demo.'</span>)
<span class="keyword">return</span>
<span class="keyword">end</span>
</pre><p>Simulate with Multiple MPC Controllers block.</p><pre class="codeinput">Tstop=100; <span class="comment">% Simulation time</span>
y1initial=0; <span class="comment">% Initial positions</span>
y2initial=10;
open_system(<span class="string">'mpc_switching'</span>);
<span class="keyword">if</span> exist(<span class="string">'animationmpc_switchoff'</span>,<span class="string">'var'</span>) && animationmpc_switchoff
set_param(<span class="string">'mpc_switching/Animation'</span>,<span class="string">'OFF'</span>,<span class="string">'true'</span>);
clear <span class="string">animationmpc_switchoff</span>
<span class="keyword">end</span>
</pre><img vspace="5" hspace="5" src="mpcswitching_01.png" alt=""> <pre class="codeinput">disp(<span class="string">'Start simulation by switching control between MPC1 and MPC2 ...'</span>);
set_param(<span class="string">'mpc_switching/signals'</span>,<span class="string">'Open'</span>,<span class="string">'On'</span>);
sim(<span class="string">'mpc_switching'</span>,Tstop);
</pre><pre class="codeoutput">Start simulation by switching control between MPC1 and MPC2 ...
-->Converting model to discrete time.
-->Integrated white noise added on measured output channel #1.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
-->Converting model to discrete time.
-->Integrated white noise added on measured output channel #1.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><img vspace="5" hspace="5" src="mpcswitching_02.png" alt=""> <img vspace="5" hspace="5" src="mpcswitching_03.png" alt=""> <p>Use of two controllers provides good performance under all conditions.</p><h2>Repeat Simulation Using MPC1 Only (Assumes Masses Never in Contact)<a name="15"></a></h2><pre class="codeinput">disp(<span class="string">'Now repeat simulation by using only MPC1 ...'</span>);
disp(<span class="string">'When two masses stick together, control performance deteriorates.'</span>);
MPC2save=MPC2;
MPC2=MPC1;
sim(<span class="string">'mpc_switching'</span>,Tstop);
</pre><pre class="codeoutput">Now repeat simulation by using only MPC1 ...
When two masses stick together, control performance deteriorates.
</pre><img vspace="5" hspace="5" src="mpcswitching_04.png" alt=""> <img vspace="5" hspace="5" src="mpcswitching_05.png" alt=""> <p>In this case, performance degrades whenever the two masses join.</p><h2>Repeat Simulation Using MPC2 Only (Assumes Masses Always in Contact)<a name="17"></a></h2><pre class="codeinput">disp(<span class="string">'Now repeat simulation by using only MPC2 ...'</span>);
disp(<span class="string">'When two masses are detached, control performance deteriorates.'</span>);
MPC1=MPC2save;
MPC2=MPC1;
sim(<span class="string">'mpc_switching'</span>,Tstop);
</pre><pre class="codeoutput">Now repeat simulation by using only MPC2 ...
When two masses are detached, control performance deteriorates.
</pre><img vspace="5" hspace="5" src="mpcswitching_06.png" alt=""> <img vspace="5" hspace="5" src="mpcswitching_07.png" alt=""> <p>In this case, performance degrades when the masses separate, causing the controller to apply excessive force.</p><pre class="codeinput">bdclose(<span class="string">'mpc_switching'</span>)
close(findobj(<span class="string">'Tag'</span>,<span class="string">'mpc_switching_demo'</span>))
</pre><p class="footer">Copyright 1990-2009 The MathWorks, Inc.<br>
Published with MATLAB® 7.10</p><p class="footer" id="trademarks">MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Please see <a href="http://www.mathworks.com/trademarks">www.mathworks.com/trademarks</a> for a list of other trademarks owned by The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective owners.</p></div><!--
##### SOURCE BEGIN #####
%% Switching MPC Controllers with Multiple MPC Controllers Block
%%
% This demonstration shows how to use an Multiple MPC Controllers block in
% a multi-controller set-up to achieve a simple nonlinear control scheme.
%
% Author: <NAME>
% Copyright 1990-2009 The MathWorks, Inc.
% $Revision: 1.1.10.4 $
%% System Description
% The system is composed by two masses M1 and M2 connected to two springs
% k1 and k2 respectively. The collision is assumed completely inelastic.
% Mass M1 is pulled by a force F, which is the manipulated variable. The
% objective is to make mass M1's position y1 track a given reference r.
%
% The dynamics are twofold: when the masses are detached, M1 moves freely.
% Otherwise, M1+M2 move together. We assume that only M1 position and a
% contact sensor are available for feedback. The latter is used to trigger
% switching the MPC controllers. Note that position and velocity of mass M2
% are not controllable.
%
%
% /REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-\ k1 ||
% F <REPLACE_WITH_DASH_DASH- | M1 |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH/\/\/\REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-[|| wall
% || | |REPLACE_WITH_DASH_DASH-/ ||
% || k2 \-/ /REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\ ||
% wall||]REPLACE_WITH_DASH_DASH/\/\/\REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-| M2 | ||
% || \REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH/ ||
% || ||
% REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHyeq2REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH y1 REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH y2 REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHyeq1REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> y axis
%
%
% The model is a simplified version of the model proposed in the following
% reference:
%
% <NAME>, <NAME>, <NAME>, and <NAME>, "Hybrid
% modeling and control of a multibody magnetic actuator for automotive
% applications," in Proc. 46th IEEE(R) Conf. on Decision and Control, New
% Orleans, LA, 2007.
%% Model Parameters
M1=1; % mass
M2=5; % mass
k1=1; % spring constant
k2=0.1; % spring constant
b1=0.3; % friction coefficient
b2=0.8; % friction coefficient
yeq1=10; % wall mount position
yeq2=-10; % wall mount position
%% State Space Models
% states: position and velocity of mass M1;
% manipulated variable: pull force F
% measured disturbance: a constant value of 1 which provides calibrates spring force to the right value
% measured output: position of mass M1
%
% State-space model of M1 when masses are not in contact.
A1=[0 1;-k1/M1 -b1/M1];
B1=[0 0;-1/M1 k1*yeq1/M1];
C1=[1 0];
D1=[0 0];
sys1=ss(A1,B1,C1,D1);
sys1=setmpcsignals(sys1,'MD',2);
%%
% State-space model when the two masses are in contact.
A2=[0 1;-(k1+k2)/(M1+M2) -(b1+b2)/(M1+M2)];
B2=[0 0;-1/(M1+M2) (k1*yeq1+k2*yeq2)/(M1+M2)];
C2=[1 0];
D2=[0 0];
sys2=ss(A2,B2,C2,D2);
sys2=setmpcsignals(sys2,'MD',2);
%% Multi-MPC Control Setup
Ts=0.2; % sampling time
p=20; % prediction horizon
m=1; % control horizon
%%
% Define MPC object for mass M1 detached from M2.
MPC1=mpc(sys1,Ts,p,m);
MPC1.Weights.OV=1;
%%
% Define constraints on the manipulated variable.
MPC1.MV=struct('Min',0,'Max',Inf,'RateMin',-1e3,'RateMax',1e3);
%%
% Define MPC object for mass M1 and M2 stuck together.
MPC2=mpc(sys2,Ts,p,m);
MPC2.Weights.OV=1;
%%
% Define constraints on the manipulated variable.
MPC2.MV=MPC1.MV;
%% Simulation with Multiple MPC Controllers Block
if ~mpcchecktoolboxinstalled('simulink')
disp('Simulink(R) is required to run this demo.')
return
end
%%
% Simulate with Multiple MPC Controllers block.
Tstop=100; % Simulation time
y1initial=0; % Initial positions
y2initial=10;
open_system('mpc_switching');
if exist('animationmpc_switchoff','var') && animationmpc_switchoff
set_param('mpc_switching/Animation','OFF','true');
clear animationmpc_switchoff
end
%%
disp('Start simulation by switching control between MPC1 and MPC2 ...');
set_param('mpc_switching/signals','Open','On');
sim('mpc_switching',Tstop);
%%
% Use of two controllers provides good performance under all conditions.
%% Repeat Simulation Using MPC1 Only (Assumes Masses Never in Contact)
disp('Now repeat simulation by using only MPC1 ...');
disp('When two masses stick together, control performance deteriorates.');
MPC2save=MPC2;
MPC2=MPC1;
sim('mpc_switching',Tstop);
%%
% In this case, performance degrades whenever the two masses join.
%% Repeat Simulation Using MPC2 Only (Assumes Masses Always in Contact)
disp('Now repeat simulation by using only MPC2 ...');
disp('When two masses are detached, control performance deteriorates.');
MPC1=MPC2save;
MPC2=MPC1;
sim('mpc_switching',Tstop);
%%
% In this case, performance degrades when the masses separate, causing
% the controller to apply excessive force.
%%
bdclose('mpc_switching')
close(findobj('Tag','mpc_switching_demo'))
displayEndOfDemoMessage(mfilename)
##### SOURCE END #####
--></body></html><file_sep>/* Include files */
#include "blascompat32.h"
#include "MPC_gamecontroller_LiDAR_sfun.h"
#include "c1_MPC_gamecontroller_LiDAR.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "MPC_gamecontroller_LiDAR_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c1_debug_family_names[8] = { "nargin", "nargout", "direction",
"throttle", "neutral", "kill", "last_state", "steer" };
/* Function Declarations */
static void initialize_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void initialize_params_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void enable_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void disable_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void c1_update_debugger_state_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void set_sim_state_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance, const mxArray
*c1_st);
static void finalize_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void sf_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber);
static const mxArray *c1_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_b_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_c_sf_marshall(void *chartInstanceVoid, void *c1_u);
static void c1_emlrt_marshallIn(SFc1_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c1_steer, const char_T *c1_name, real_T c1_y[3]);
static uint8_T c1_b_emlrt_marshallIn(SFc1_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c1_b_is_active_c1_MPC_gamecontroller_LiDAR,
const char_T *c1_name);
static void init_dsm_address_info(SFc1_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c1_is_active_c1_MPC_gamecontroller_LiDAR = 0U;
}
static void initialize_params_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static void enable_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c1_update_debugger_state_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
const mxArray *c1_st = NULL;
const mxArray *c1_y = NULL;
int32_T c1_i0;
real_T c1_hoistedGlobal[3];
int32_T c1_i1;
real_T c1_u[3];
const mxArray *c1_b_y = NULL;
uint8_T c1_b_hoistedGlobal;
uint8_T c1_b_u;
const mxArray *c1_c_y = NULL;
real_T (*c1_steer)[3];
c1_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c1_st = NULL;
c1_y = NULL;
sf_mex_assign(&c1_y, sf_mex_createcellarray(2));
for (c1_i0 = 0; c1_i0 < 3; c1_i0 = c1_i0 + 1) {
c1_hoistedGlobal[c1_i0] = (*c1_steer)[c1_i0];
}
for (c1_i1 = 0; c1_i1 < 3; c1_i1 = c1_i1 + 1) {
c1_u[c1_i1] = c1_hoistedGlobal[c1_i1];
}
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_u, 0, 0U, 1U, 0U, 1, 3));
sf_mex_setcell(c1_y, 0, c1_b_y);
c1_b_hoistedGlobal = chartInstance->c1_is_active_c1_MPC_gamecontroller_LiDAR;
c1_b_u = c1_b_hoistedGlobal;
c1_c_y = NULL;
sf_mex_assign(&c1_c_y, sf_mex_create("y", &c1_b_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c1_y, 1, c1_c_y);
sf_mex_assign(&c1_st, c1_y);
return c1_st;
}
static void set_sim_state_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance, const mxArray *
c1_st)
{
const mxArray *c1_u;
real_T c1_dv0[3];
int32_T c1_i2;
real_T (*c1_steer)[3];
c1_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c1_doneDoubleBufferReInit = TRUE;
c1_u = sf_mex_dup(c1_st);
c1_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 0)),
"steer", c1_dv0);
for (c1_i2 = 0; c1_i2 < 3; c1_i2 = c1_i2 + 1) {
(*c1_steer)[c1_i2] = c1_dv0[c1_i2];
}
chartInstance->c1_is_active_c1_MPC_gamecontroller_LiDAR =
c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 1)),
"is_active_c1_MPC_gamecontroller_LiDAR");
sf_mex_destroy(&c1_u);
c1_update_debugger_state_c1_MPC_gamecontroller_LiDAR(chartInstance);
sf_mex_destroy(&c1_st);
}
static void finalize_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static void sf_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
int32_T c1_i3;
int32_T c1_i4;
int32_T c1_i5;
int32_T c1_previousEvent;
real_T c1_hoistedGlobal;
real_T c1_b_hoistedGlobal;
int32_T c1_i6;
real_T c1_c_hoistedGlobal[3];
real_T c1_d_hoistedGlobal;
int32_T c1_i7;
real_T c1_e_hoistedGlobal[3];
real_T c1_direction;
real_T c1_throttle;
int32_T c1_i8;
real_T c1_neutral[3];
real_T c1_kill;
int32_T c1_i9;
real_T c1_last_state[3];
uint32_T c1_debug_family_var_map[8];
real_T c1_nargin = 5.0;
real_T c1_nargout = 1.0;
real_T c1_steer[3];
int32_T c1_i10;
int32_T c1_i11;
int32_T c1_i12;
real_T *c1_b_direction;
real_T *c1_b_throttle;
real_T *c1_b_kill;
real_T (*c1_b_steer)[3];
real_T (*c1_b_last_state)[3];
real_T (*c1_b_neutral)[3];
c1_b_last_state = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 4);
c1_b_kill = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
c1_b_neutral = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 2);
c1_b_throttle = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c1_b_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c1_b_direction = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0);
_SFD_DATA_RANGE_CHECK(*c1_b_direction, 0U);
for (c1_i3 = 0; c1_i3 < 3; c1_i3 = c1_i3 + 1) {
_SFD_DATA_RANGE_CHECK((*c1_b_steer)[c1_i3], 1U);
}
_SFD_DATA_RANGE_CHECK(*c1_b_throttle, 2U);
for (c1_i4 = 0; c1_i4 < 3; c1_i4 = c1_i4 + 1) {
_SFD_DATA_RANGE_CHECK((*c1_b_neutral)[c1_i4], 3U);
}
_SFD_DATA_RANGE_CHECK(*c1_b_kill, 4U);
for (c1_i5 = 0; c1_i5 < 3; c1_i5 = c1_i5 + 1) {
_SFD_DATA_RANGE_CHECK((*c1_b_last_state)[c1_i5], 5U);
}
c1_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0);
c1_hoistedGlobal = *c1_b_direction;
c1_b_hoistedGlobal = *c1_b_throttle;
for (c1_i6 = 0; c1_i6 < 3; c1_i6 = c1_i6 + 1) {
c1_c_hoistedGlobal[c1_i6] = (*c1_b_neutral)[c1_i6];
}
c1_d_hoistedGlobal = *c1_b_kill;
for (c1_i7 = 0; c1_i7 < 3; c1_i7 = c1_i7 + 1) {
c1_e_hoistedGlobal[c1_i7] = (*c1_b_last_state)[c1_i7];
}
c1_direction = c1_hoistedGlobal;
c1_throttle = c1_b_hoistedGlobal;
for (c1_i8 = 0; c1_i8 < 3; c1_i8 = c1_i8 + 1) {
c1_neutral[c1_i8] = c1_c_hoistedGlobal[c1_i8];
}
c1_kill = c1_d_hoistedGlobal;
for (c1_i9 = 0; c1_i9 < 3; c1_i9 = c1_i9 + 1) {
c1_last_state[c1_i9] = c1_e_hoistedGlobal[c1_i9];
}
sf_debug_symbol_scope_push_eml(0U, 8U, 8U, c1_debug_family_names,
c1_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c1_nargin, c1_b_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c1_nargout, c1_b_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c1_direction, c1_b_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c1_throttle, c1_b_sf_marshall, 3U);
sf_debug_symbol_scope_add_eml(c1_neutral, c1_sf_marshall, 4U);
sf_debug_symbol_scope_add_eml(&c1_kill, c1_b_sf_marshall, 5U);
sf_debug_symbol_scope_add_eml(c1_last_state, c1_sf_marshall, 6U);
sf_debug_symbol_scope_add_eml(c1_steer, c1_sf_marshall, 7U);
CV_EML_FCN(0, 0);
/* #codegen */
_SFD_EML_CALL(0, 3);
if (CV_EML_IF(0, 0, c1_kill != 0.0) != 0.0) {
_SFD_EML_CALL(0, 4);
for (c1_i10 = 0; c1_i10 < 3; c1_i10 = c1_i10 + 1) {
c1_steer[c1_i10] = c1_neutral[c1_i10];
}
} else {
_SFD_EML_CALL(0, 6);
for (c1_i11 = 0; c1_i11 < 3; c1_i11 = c1_i11 + 1) {
c1_steer[c1_i11] = c1_last_state[c1_i11];
}
_SFD_EML_CALL(0, 7);
c1_steer[1] = c1_direction;
_SFD_EML_CALL(0, 8);
c1_steer[2] = c1_throttle;
}
_SFD_EML_CALL(0, -8);
sf_debug_symbol_scope_pop();
for (c1_i12 = 0; c1_i12 < 3; c1_i12 = c1_i12 + 1) {
(*c1_b_steer)[c1_i12] = c1_steer[c1_i12];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0);
_sfEvent_ = c1_previousEvent;
sf_debug_check_for_state_inconsistency(_MPC_gamecontroller_LiDARMachineNumber_,
chartInstance->chartNumber, chartInstance->
instanceNumber);
}
static void compInitSubchartSimstructsFcn_c1_MPC_gamecontroller_LiDAR
(SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber)
{
}
static const mxArray *c1_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
const mxArray *c1_y = NULL;
int32_T c1_i13;
real_T c1_b_u[3];
int32_T c1_i14;
real_T c1_c_u[3];
const mxArray *c1_b_y = NULL;
SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c1_y = NULL;
for (c1_i13 = 0; c1_i13 < 3; c1_i13 = c1_i13 + 1) {
c1_b_u[c1_i13] = (*((real_T (*)[3])c1_u))[c1_i13];
}
for (c1_i14 = 0; c1_i14 < 3; c1_i14 = c1_i14 + 1) {
c1_c_u[c1_i14] = c1_b_u[c1_i14];
}
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_c_u, 0, 0U, 1U, 0U, 1, 3));
sf_mex_assign(&c1_y, c1_b_y);
return c1_y;
}
static const mxArray *c1_b_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
const mxArray *c1_y = NULL;
real_T c1_b_u;
const mxArray *c1_b_y = NULL;
SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c1_y = NULL;
c1_b_u = *((real_T *)c1_u);
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c1_y, c1_b_y);
return c1_y;
}
const mxArray *sf_c1_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info
(void)
{
const mxArray *c1_nameCaptureInfo = NULL;
c1_nameCaptureInfo = NULL;
sf_mex_assign(&c1_nameCaptureInfo, sf_mex_create("nameCaptureInfo", NULL, 0,
0U, 1U, 0U, 2, 0, 1));
return c1_nameCaptureInfo;
}
static const mxArray *c1_c_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
const mxArray *c1_y = NULL;
boolean_T c1_b_u;
const mxArray *c1_b_y = NULL;
SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c1_y = NULL;
c1_b_u = *((boolean_T *)c1_u);
c1_b_y = NULL;
sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c1_y, c1_b_y);
return c1_y;
}
static void c1_emlrt_marshallIn(SFc1_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c1_steer, const char_T *
c1_name, real_T c1_y[3])
{
real_T c1_dv1[3];
int32_T c1_i15;
sf_mex_import(c1_name, sf_mex_dup(c1_steer), c1_dv1, 1, 0, 0U, 1, 0U, 1, 3);
for (c1_i15 = 0; c1_i15 < 3; c1_i15 = c1_i15 + 1) {
c1_y[c1_i15] = c1_dv1[c1_i15];
}
sf_mex_destroy(&c1_steer);
}
static uint8_T c1_b_emlrt_marshallIn(SFc1_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *
c1_b_is_active_c1_MPC_gamecontroller_LiDAR, const char_T *c1_name)
{
uint8_T c1_y;
uint8_T c1_u0;
sf_mex_import(c1_name, sf_mex_dup(c1_b_is_active_c1_MPC_gamecontroller_LiDAR),
&c1_u0, 1, 3, 0U, 0, 0U, 0);
c1_y = c1_u0;
sf_mex_destroy(&c1_b_is_active_c1_MPC_gamecontroller_LiDAR);
return c1_y;
}
static void init_dsm_address_info(SFc1_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c1_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(158840779U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(4281948038U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(357241725U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1538533989U);
}
mxArray *sf_c1_MPC_gamecontroller_LiDAR_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(2050016041U);
pr[1] = (double)(330744281U);
pr[2] = (double)(2619954881U);
pr[3] = (double)(3928456335U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,5,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,2,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,2,"type",mxType);
}
mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,3,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,3,"type",mxType);
}
mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,4,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,4,"type",mxType);
}
mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x2'type','srcId','name','auxInfo'{{M[1],M[5],T\"steer\",},{M[8],M[0],T\"is_active_c1_MPC_gamecontroller_LiDAR\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c1_MPC_gamecontroller_LiDAR_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDARInstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_MPC_gamecontroller_LiDARMachineNumber_,
1,
1,
1,
6,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation(_MPC_gamecontroller_LiDARMachineNumber_,
chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_MPC_gamecontroller_LiDARMachineNumber_,chartInstance->chartNumber,
1);
sf_debug_set_chart_event_thresholds
(_MPC_gamecontroller_LiDARMachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"direction");
_SFD_SET_DATA_PROPS(1,2,0,1,"steer");
_SFD_SET_DATA_PROPS(2,1,1,0,"throttle");
_SFD_SET_DATA_PROPS(3,1,1,0,"neutral");
_SFD_SET_DATA_PROPS(4,1,1,0,"kill");
_SFD_SET_DATA_PROPS(5,1,1,0,"last_state");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,200);
_SFD_CV_INIT_EML_IF(0,0,91,99,120,198);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c1_b_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c1_sf_marshall);
}
_SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c1_b_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c1_sf_marshall);
}
_SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c1_b_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(5,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c1_sf_marshall);
}
{
real_T *c1_direction;
real_T *c1_throttle;
real_T *c1_kill;
real_T (*c1_steer)[3];
real_T (*c1_neutral)[3];
real_T (*c1_last_state)[3];
c1_last_state = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S,
4);
c1_kill = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
c1_neutral = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 2);
c1_throttle = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c1_steer = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c1_direction = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, c1_direction);
_SFD_SET_DATA_VALUE_PTR(1U, *c1_steer);
_SFD_SET_DATA_VALUE_PTR(2U, c1_throttle);
_SFD_SET_DATA_VALUE_PTR(3U, *c1_neutral);
_SFD_SET_DATA_VALUE_PTR(4U, c1_kill);
_SFD_SET_DATA_VALUE_PTR(5U, *c1_last_state);
}
}
} else {
sf_debug_reset_current_state_configuration
(_MPC_gamecontroller_LiDARMachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c1_MPC_gamecontroller_LiDAR(void
*chartInstanceVar)
{
chart_debug_initialization(((SFc1_MPC_gamecontroller_LiDARInstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
initialize_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
static void sf_opaque_enable_c1_MPC_gamecontroller_LiDAR(void *chartInstanceVar)
{
enable_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
static void sf_opaque_disable_c1_MPC_gamecontroller_LiDAR(void *chartInstanceVar)
{
disable_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
static void sf_opaque_gateway_c1_MPC_gamecontroller_LiDAR(void *chartInstanceVar)
{
sf_c1_MPC_gamecontroller_LiDAR((SFc1_MPC_gamecontroller_LiDARInstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c1_MPC_gamecontroller_LiDAR(SimStruct*
S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c1_MPC_gamecontroller_LiDAR(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c1_MPC_gamecontroller_LiDAR(SimStruct* S)
{
return sf_internal_get_sim_state_c1_MPC_gamecontroller_LiDAR(S);
}
static void sf_opaque_set_sim_state_c1_MPC_gamecontroller_LiDAR(SimStruct* S,
const mxArray *st)
{
sf_internal_set_sim_state_c1_MPC_gamecontroller_LiDAR(S, st);
}
static void sf_opaque_terminate_c1_MPC_gamecontroller_LiDAR(void
*chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc1_MPC_gamecontroller_LiDARInstanceStruct*)
chartInstanceVar)->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c1_MPC_gamecontroller_LiDAR(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c1_MPC_gamecontroller_LiDAR
((SFc1_MPC_gamecontroller_LiDARInstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c1_MPC_gamecontroller_LiDAR(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",1);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",1,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
"MPC_gamecontroller_LiDAR","MPC_gamecontroller_LiDAR",1,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 3, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 4, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",1,5);
sf_mark_chart_reusable_outputs(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",1,1);
}
sf_set_rtw_dwork_info(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",1);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(2145048794U));
ssSetChecksum1(S,(3885803879U));
ssSetChecksum2(S,(3124835691U));
ssSetChecksum3(S,(1138057912U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c1_MPC_gamecontroller_LiDAR(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",1);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c1_MPC_gamecontroller_LiDAR(SimStruct *S)
{
SFc1_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc1_MPC_gamecontroller_LiDARInstanceStruct *)malloc(sizeof
(SFc1_MPC_gamecontroller_LiDARInstanceStruct));
memset(chartInstance, 0, sizeof(SFc1_MPC_gamecontroller_LiDARInstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.mdlStart = mdlStart_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c1_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c1_MPC_gamecontroller_LiDAR_method_dispatcher(SimStruct *S, int_T method,
void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c1_MPC_gamecontroller_LiDAR(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c1_MPC_gamecontroller_LiDAR(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c1_MPC_gamecontroller_LiDAR(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c1_MPC_gamecontroller_LiDAR_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
<file_sep>/* mat_macros.h: MPC Simulink/RTW S-Function - Macros */
/*
Author: <NAME>, <NAME>
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.3 $ $Date: 2008/01/29 15:35:16 $
*/
/* Matrix access macros */
/* Compute i-th term of matrix-by-vector product a*v adding to adder [i.e, a(i,:)*v]
nc: number of columns in a
*/
#define MVP(a, v, i, nr, nc) for (j=0; j < nc; j++) adder += a[i+j*nr] * v[j]
/* Compute i-th term of matrix-by-vector product a'*v adding to adder [i.e, a(:,i)'*v]
nr: number of rows in a
*/
#define MTVP(a, v, i, nr) for (j=0; j < nr; j++) adder += a[j+i*nr] * v[j]
/* Compute i-th term of vector-by-matrix product v'*a adding to adder [i.e, v'*a(:,j)]
nr: number of rows in a (very same thing as MTVP swapping i and j)
*/
#define MVTP(a, v, j, nr) for (i=0; i < nr; i++) adder += a[i+j*nr] * v[i]
/* Misc */
#define CLR adder=0.0
/* Misc Constants */
#define SOFTCONSTR 0 /* Optimization types */
#define HARDCONSTR 1
#define UNCONSTR 2
/* Debugging */
#define DISP_VEC(vec,n,name) printf("%s=[",name); for (i=0;i<n;i++) printf("%g,",vec[i]); printf("]\n");
#define DISP_MAT(mat,n,m,name) printf("%s=[",name); for (i=0;i<n;i++) {for (j=0;j<m;j++) printf("%g,",mat[i+n*j]); printf("\n");} printf("]\n");
#define DISP_ADDER(i) printf("adder[%d]=%g\n",i,adder);
<file_sep>/* Include files */
#include "blascompat32.h"
#include "MPC_gamecontroller_LiDAR2_sfun.h"
#include "c5_MPC_gamecontroller_LiDAR2.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "MPC_gamecontroller_LiDAR2_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c5_debug_family_names[4] = { "nargin", "nargout", "pedal",
"speed" };
/* Function Declarations */
static void initialize_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void initialize_params_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void enable_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void disable_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void c5_update_debugger_state_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static const mxArray *get_sim_state_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void set_sim_state_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c5_st);
static void finalize_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void sf_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c5_machineNumber, uint32_T
c5_chartNumber);
static const mxArray *c5_sf_marshall(void *chartInstanceVoid, void *c5_u);
static const mxArray *c5_b_sf_marshall(void *chartInstanceVoid, void *c5_u);
static real_T c5_emlrt_marshallIn(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c5_speed, const char_T *c5_name);
static uint8_T c5_b_emlrt_marshallIn
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c5_b_is_active_c5_MPC_gamecontroller_LiDAR2, const char_T *c5_name);
static void init_dsm_address_info(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c5_is_active_c5_MPC_gamecontroller_LiDAR2 = 0U;
}
static void initialize_params_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void enable_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c5_update_debugger_state_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
const mxArray *c5_st = NULL;
const mxArray *c5_y = NULL;
real_T c5_hoistedGlobal;
real_T c5_u;
const mxArray *c5_b_y = NULL;
uint8_T c5_b_hoistedGlobal;
uint8_T c5_b_u;
const mxArray *c5_c_y = NULL;
real_T *c5_speed;
c5_speed = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c5_st = NULL;
c5_y = NULL;
sf_mex_assign(&c5_y, sf_mex_createcellarray(2));
c5_hoistedGlobal = *c5_speed;
c5_u = c5_hoistedGlobal;
c5_b_y = NULL;
sf_mex_assign(&c5_b_y, sf_mex_create("y", &c5_u, 0, 0U, 0U, 0U, 0));
sf_mex_setcell(c5_y, 0, c5_b_y);
c5_b_hoistedGlobal = chartInstance->c5_is_active_c5_MPC_gamecontroller_LiDAR2;
c5_b_u = c5_b_hoistedGlobal;
c5_c_y = NULL;
sf_mex_assign(&c5_c_y, sf_mex_create("y", &c5_b_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c5_y, 1, c5_c_y);
sf_mex_assign(&c5_st, c5_y);
return c5_st;
}
static void set_sim_state_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c5_st)
{
const mxArray *c5_u;
real_T *c5_speed;
c5_speed = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c5_doneDoubleBufferReInit = TRUE;
c5_u = sf_mex_dup(c5_st);
*c5_speed = c5_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c5_u,
0)), "speed");
chartInstance->c5_is_active_c5_MPC_gamecontroller_LiDAR2 =
c5_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c5_u, 1))
, "is_active_c5_MPC_gamecontroller_LiDAR2");
sf_mex_destroy(&c5_u);
c5_update_debugger_state_c5_MPC_gamecontroller_LiDAR2(chartInstance);
sf_mex_destroy(&c5_st);
}
static void finalize_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void sf_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
int32_T c5_previousEvent;
real_T c5_hoistedGlobal;
real_T c5_pedal;
uint32_T c5_debug_family_var_map[4];
real_T c5_nargin = 1.0;
real_T c5_nargout = 1.0;
real_T c5_speed;
real_T c5_a;
real_T c5_y;
real_T c5_b_a;
real_T c5_b_y;
real_T *c5_b_pedal;
real_T *c5_b_speed;
c5_b_speed = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c5_b_pedal = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 3);
_SFD_DATA_RANGE_CHECK(*c5_b_pedal, 0U);
_SFD_DATA_RANGE_CHECK(*c5_b_speed, 1U);
c5_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3);
c5_hoistedGlobal = *c5_b_pedal;
c5_pedal = c5_hoistedGlobal;
sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c5_debug_family_names,
c5_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c5_nargin, c5_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c5_nargout, c5_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c5_pedal, c5_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c5_speed, c5_sf_marshall, 3U);
CV_EML_FCN(0, 0);
/* #codegen */
_SFD_EML_CALL(0, 3);
if (CV_EML_IF(0, 0, c5_pedal > 0.0)) {
_SFD_EML_CALL(0, 4);
c5_a = c5_pedal;
c5_y = c5_a * 100.0;
c5_speed = 100.0 - c5_y;
} else {
_SFD_EML_CALL(0, 5);
if (CV_EML_IF(0, 1, c5_pedal < 0.0)) {
_SFD_EML_CALL(0, 6);
c5_b_a = c5_pedal;
c5_b_y = c5_b_a * 155.0;
c5_speed = 100.0 - c5_b_y;
} else {
_SFD_EML_CALL(0, 8);
c5_speed = 100.0;
}
}
_SFD_EML_CALL(0, -8);
sf_debug_symbol_scope_pop();
*c5_b_speed = c5_speed;
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3);
_sfEvent_ = c5_previousEvent;
sf_debug_check_for_state_inconsistency
(_MPC_gamecontroller_LiDAR2MachineNumber_, chartInstance->chartNumber,
chartInstance->
instanceNumber);
}
static void compInitSubchartSimstructsFcn_c5_MPC_gamecontroller_LiDAR2
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c5_machineNumber, uint32_T
c5_chartNumber)
{
}
static const mxArray *c5_sf_marshall(void *chartInstanceVoid, void *c5_u)
{
const mxArray *c5_y = NULL;
real_T c5_b_u;
const mxArray *c5_b_y = NULL;
SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c5_y = NULL;
c5_b_u = *((real_T *)c5_u);
c5_b_y = NULL;
sf_mex_assign(&c5_b_y, sf_mex_create("y", &c5_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c5_y, c5_b_y);
return c5_y;
}
const mxArray *sf_c5_MPC_gamecontroller_LiDAR2_get_eml_resolved_functions_info
(void)
{
const mxArray *c5_nameCaptureInfo = NULL;
c5_ResolvedFunctionInfo c5_info[13];
c5_ResolvedFunctionInfo (*c5_b_info)[13];
const mxArray *c5_m0 = NULL;
int32_T c5_i0;
c5_ResolvedFunctionInfo *c5_r0;
c5_nameCaptureInfo = NULL;
c5_b_info = (c5_ResolvedFunctionInfo (*)[13])c5_info;
(*c5_b_info)[0].context = "";
(*c5_b_info)[0].name = "gt";
(*c5_b_info)[0].dominantType = "double";
(*c5_b_info)[0].resolved = "[B]gt";
(*c5_b_info)[0].fileLength = 0U;
(*c5_b_info)[0].fileTime1 = 0U;
(*c5_b_info)[0].fileTime2 = 0U;
(*c5_b_info)[1].context = "";
(*c5_b_info)[1].name = "mtimes";
(*c5_b_info)[1].dominantType = "double";
(*c5_b_info)[1].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[1].fileLength = 3425U;
(*c5_b_info)[1].fileTime1 = 1251064272U;
(*c5_b_info)[1].fileTime2 = 0U;
(*c5_b_info)[2].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[2].name = "nargin";
(*c5_b_info)[2].dominantType = "";
(*c5_b_info)[2].resolved = "[B]nargin";
(*c5_b_info)[2].fileLength = 0U;
(*c5_b_info)[2].fileTime1 = 0U;
(*c5_b_info)[2].fileTime2 = 0U;
(*c5_b_info)[3].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[3].name = "isa";
(*c5_b_info)[3].dominantType = "double";
(*c5_b_info)[3].resolved = "[B]isa";
(*c5_b_info)[3].fileLength = 0U;
(*c5_b_info)[3].fileTime1 = 0U;
(*c5_b_info)[3].fileTime2 = 0U;
(*c5_b_info)[4].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[4].name = "isinteger";
(*c5_b_info)[4].dominantType = "double";
(*c5_b_info)[4].resolved = "[B]isinteger";
(*c5_b_info)[4].fileLength = 0U;
(*c5_b_info)[4].fileTime1 = 0U;
(*c5_b_info)[4].fileTime2 = 0U;
(*c5_b_info)[5].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[5].name = "isscalar";
(*c5_b_info)[5].dominantType = "double";
(*c5_b_info)[5].resolved = "[B]isscalar";
(*c5_b_info)[5].fileLength = 0U;
(*c5_b_info)[5].fileTime1 = 0U;
(*c5_b_info)[5].fileTime2 = 0U;
(*c5_b_info)[6].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[6].name = "strcmp";
(*c5_b_info)[6].dominantType = "char";
(*c5_b_info)[6].resolved = "[B]strcmp";
(*c5_b_info)[6].fileLength = 0U;
(*c5_b_info)[6].fileTime1 = 0U;
(*c5_b_info)[6].fileTime2 = 0U;
(*c5_b_info)[7].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[7].name = "size";
(*c5_b_info)[7].dominantType = "double";
(*c5_b_info)[7].resolved = "[B]size";
(*c5_b_info)[7].fileLength = 0U;
(*c5_b_info)[7].fileTime1 = 0U;
(*c5_b_info)[7].fileTime2 = 0U;
(*c5_b_info)[8].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[8].name = "eq";
(*c5_b_info)[8].dominantType = "double";
(*c5_b_info)[8].resolved = "[B]eq";
(*c5_b_info)[8].fileLength = 0U;
(*c5_b_info)[8].fileTime1 = 0U;
(*c5_b_info)[8].fileTime2 = 0U;
(*c5_b_info)[9].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[9].name = "class";
(*c5_b_info)[9].dominantType = "double";
(*c5_b_info)[9].resolved = "[B]class";
(*c5_b_info)[9].fileLength = 0U;
(*c5_b_info)[9].fileTime1 = 0U;
(*c5_b_info)[9].fileTime2 = 0U;
(*c5_b_info)[10].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c5_b_info)[10].name = "not";
(*c5_b_info)[10].dominantType = "logical";
(*c5_b_info)[10].resolved = "[B]not";
(*c5_b_info)[10].fileLength = 0U;
(*c5_b_info)[10].fileTime1 = 0U;
(*c5_b_info)[10].fileTime2 = 0U;
(*c5_b_info)[11].context = "";
(*c5_b_info)[11].name = "minus";
(*c5_b_info)[11].dominantType = "double";
(*c5_b_info)[11].resolved = "[B]minus";
(*c5_b_info)[11].fileLength = 0U;
(*c5_b_info)[11].fileTime1 = 0U;
(*c5_b_info)[11].fileTime2 = 0U;
(*c5_b_info)[12].context = "";
(*c5_b_info)[12].name = "lt";
(*c5_b_info)[12].dominantType = "double";
(*c5_b_info)[12].resolved = "[B]lt";
(*c5_b_info)[12].fileLength = 0U;
(*c5_b_info)[12].fileTime1 = 0U;
(*c5_b_info)[12].fileTime2 = 0U;
sf_mex_assign(&c5_m0, sf_mex_createstruct("nameCaptureInfo", 1, 13));
for (c5_i0 = 0; c5_i0 < 13; c5_i0 = c5_i0 + 1) {
c5_r0 = &c5_info[c5_i0];
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", c5_r0->context, 15,
0U, 0U, 0U, 2, 1, strlen(c5_r0->context)), "context",
"nameCaptureInfo", c5_i0);
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", c5_r0->name, 15, 0U,
0U, 0U, 2, 1, strlen(c5_r0->name)), "name",
"nameCaptureInfo", c5_i0);
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", c5_r0->dominantType,
15, 0U, 0U, 0U, 2, 1, strlen(c5_r0->dominantType)),
"dominantType", "nameCaptureInfo", c5_i0);
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", c5_r0->resolved, 15,
0U, 0U, 0U, 2, 1, strlen(c5_r0->resolved)), "resolved"
, "nameCaptureInfo", c5_i0);
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", &c5_r0->fileLength,
7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
c5_i0);
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", &c5_r0->fileTime1, 7,
0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c5_i0);
sf_mex_addfield(c5_m0, sf_mex_create("nameCaptureInfo", &c5_r0->fileTime2, 7,
0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c5_i0);
}
sf_mex_assign(&c5_nameCaptureInfo, c5_m0);
return c5_nameCaptureInfo;
}
static const mxArray *c5_b_sf_marshall(void *chartInstanceVoid, void *c5_u)
{
const mxArray *c5_y = NULL;
boolean_T c5_b_u;
const mxArray *c5_b_y = NULL;
SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c5_y = NULL;
c5_b_u = *((boolean_T *)c5_u);
c5_b_y = NULL;
sf_mex_assign(&c5_b_y, sf_mex_create("y", &c5_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c5_y, c5_b_y);
return c5_y;
}
static real_T c5_emlrt_marshallIn(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c5_speed, const char_T
*c5_name)
{
real_T c5_y;
real_T c5_d0;
sf_mex_import(c5_name, sf_mex_dup(c5_speed), &c5_d0, 1, 0, 0U, 0, 0U, 0);
c5_y = c5_d0;
sf_mex_destroy(&c5_speed);
return c5_y;
}
static uint8_T c5_b_emlrt_marshallIn
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c5_b_is_active_c5_MPC_gamecontroller_LiDAR2, const char_T *c5_name)
{
uint8_T c5_y;
uint8_T c5_u0;
sf_mex_import(c5_name, sf_mex_dup(c5_b_is_active_c5_MPC_gamecontroller_LiDAR2),
&c5_u0, 1, 3, 0U, 0, 0U, 0);
c5_y = c5_u0;
sf_mex_destroy(&c5_b_is_active_c5_MPC_gamecontroller_LiDAR2);
return c5_y;
}
static void init_dsm_address_info(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c5_MPC_gamecontroller_LiDAR2_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2363137499U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3982714885U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1839880024U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3705402793U);
}
mxArray *sf_c5_MPC_gamecontroller_LiDAR2_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(3878608312U);
pr[1] = (double)(1823632075U);
pr[2] = (double)(1297432265U);
pr[3] = (double)(2576131010U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c5_MPC_gamecontroller_LiDAR2(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x2'type','srcId','name','auxInfo'{{M[1],M[5],T\"speed\",},{M[8],M[0],T\"is_active_c5_MPC_gamecontroller_LiDAR2\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c5_MPC_gamecontroller_LiDAR2_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_MPC_gamecontroller_LiDAR2MachineNumber_,
5,
1,
1,
2,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
1);
sf_debug_set_chart_event_thresholds
(_MPC_gamecontroller_LiDAR2MachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"pedal");
_SFD_SET_DATA_PROPS(1,2,0,1,"speed");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,2,0,0,0,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,165);
_SFD_CV_INIT_EML_IF(0,0,49,60,88,164);
_SFD_CV_INIT_EML_IF(0,1,88,103,138,164);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c5_sf_marshall);
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c5_sf_marshall);
{
real_T *c5_pedal;
real_T *c5_speed;
c5_speed = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c5_pedal = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, c5_pedal);
_SFD_SET_DATA_VALUE_PTR(1U, c5_speed);
}
}
} else {
sf_debug_reset_current_state_configuration
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c5_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
chart_debug_initialization(((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
initialize_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_enable_c5_MPC_gamecontroller_LiDAR2(void *chartInstanceVar)
{
enable_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_disable_c5_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
disable_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_gateway_c5_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
sf_c5_MPC_gamecontroller_LiDAR2((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c5_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c5_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c5_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c5_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c5_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
return sf_internal_get_sim_state_c5_MPC_gamecontroller_LiDAR2(S);
}
static void sf_opaque_set_sim_state_c5_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
sf_internal_set_sim_state_c5_MPC_gamecontroller_LiDAR2(S, st);
}
static void sf_opaque_terminate_c5_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c5_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c5_MPC_gamecontroller_LiDAR2
((SFc5_MPC_gamecontroller_LiDAR2InstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c5_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",5);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",5,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
"MPC_gamecontroller_LiDAR2","MPC_gamecontroller_LiDAR2",5,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",5,1);
sf_mark_chart_reusable_outputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",5,1);
}
sf_set_rtw_dwork_info(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",5);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(1575060884U));
ssSetChecksum1(S,(1964687724U));
ssSetChecksum2(S,(3527744074U));
ssSetChecksum3(S,(3454966980U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c5_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",5);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c5_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc5_MPC_gamecontroller_LiDAR2InstanceStruct *)malloc(sizeof
(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct));
memset(chartInstance, 0, sizeof(SFc5_MPC_gamecontroller_LiDAR2InstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlStart = mdlStart_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c5_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c5_MPC_gamecontroller_LiDAR2_method_dispatcher(SimStruct *S, int_T method,
void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c5_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c5_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c5_MPC_gamecontroller_LiDAR2(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c5_MPC_gamecontroller_LiDAR2_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
<file_sep>/* Include files */
#include "blascompat32.h"
#include "RSC_RRT_LiDAR_No_USER_sfun.h"
#include "c6_RSC_RRT_LiDAR_No_USER.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "RSC_RRT_LiDAR_No_USER_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c6_debug_family_names[6] = { "nargin", "nargout", "steer",
"kill", "neutral", "out" };
/* Function Declarations */
static void initialize_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void initialize_params_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void enable_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void disable_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void c6_update_debugger_state_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void set_sim_state_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance, const mxArray *c6_st);
static void finalize_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void sf_c6_RSC_RRT_LiDAR_No_USER(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance);
static void compInitSubchartSimstructsFcn_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c6_machineNumber, uint32_T
c6_chartNumber);
static const mxArray *c6_sf_marshall(void *chartInstanceVoid, void *c6_u);
static const mxArray *c6_b_sf_marshall(void *chartInstanceVoid, void *c6_u);
static const mxArray *c6_c_sf_marshall(void *chartInstanceVoid, void *c6_u);
static void c6_emlrt_marshallIn(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance, const mxArray *c6_out, const char_T *c6_name, real_T c6_y[3]);
static uint8_T c6_b_emlrt_marshallIn(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance, const mxArray *c6_b_is_active_c6_RSC_RRT_LiDAR_No_USER, const
char_T *c6_name);
static void init_dsm_address_info(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c6_is_active_c6_RSC_RRT_LiDAR_No_USER = 0U;
}
static void initialize_params_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
}
static void enable_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c6_update_debugger_state_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
const mxArray *c6_st = NULL;
const mxArray *c6_y = NULL;
int32_T c6_i0;
real_T c6_hoistedGlobal[3];
int32_T c6_i1;
real_T c6_u[3];
const mxArray *c6_b_y = NULL;
uint8_T c6_b_hoistedGlobal;
uint8_T c6_b_u;
const mxArray *c6_c_y = NULL;
real_T (*c6_out)[3];
c6_out = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c6_st = NULL;
c6_y = NULL;
sf_mex_assign(&c6_y, sf_mex_createcellarray(2));
for (c6_i0 = 0; c6_i0 < 3; c6_i0 = c6_i0 + 1) {
c6_hoistedGlobal[c6_i0] = (*c6_out)[c6_i0];
}
for (c6_i1 = 0; c6_i1 < 3; c6_i1 = c6_i1 + 1) {
c6_u[c6_i1] = c6_hoistedGlobal[c6_i1];
}
c6_b_y = NULL;
sf_mex_assign(&c6_b_y, sf_mex_create("y", c6_u, 0, 0U, 1U, 0U, 1, 3));
sf_mex_setcell(c6_y, 0, c6_b_y);
c6_b_hoistedGlobal = chartInstance->c6_is_active_c6_RSC_RRT_LiDAR_No_USER;
c6_b_u = c6_b_hoistedGlobal;
c6_c_y = NULL;
sf_mex_assign(&c6_c_y, sf_mex_create("y", &c6_b_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c6_y, 1, c6_c_y);
sf_mex_assign(&c6_st, c6_y);
return c6_st;
}
static void set_sim_state_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance, const mxArray *c6_st)
{
const mxArray *c6_u;
real_T c6_dv0[3];
int32_T c6_i2;
real_T (*c6_out)[3];
c6_out = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c6_doneDoubleBufferReInit = TRUE;
c6_u = sf_mex_dup(c6_st);
c6_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c6_u, 0)), "out",
c6_dv0);
for (c6_i2 = 0; c6_i2 < 3; c6_i2 = c6_i2 + 1) {
(*c6_out)[c6_i2] = c6_dv0[c6_i2];
}
chartInstance->c6_is_active_c6_RSC_RRT_LiDAR_No_USER = c6_b_emlrt_marshallIn
(chartInstance, sf_mex_dup(sf_mex_getcell(c6_u, 1)),
"is_active_c6_RSC_RRT_LiDAR_No_USER");
sf_mex_destroy(&c6_u);
c6_update_debugger_state_c6_RSC_RRT_LiDAR_No_USER(chartInstance);
sf_mex_destroy(&c6_st);
}
static void finalize_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
}
static void sf_c6_RSC_RRT_LiDAR_No_USER(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance)
{
int32_T c6_i3;
int32_T c6_i4;
int32_T c6_i5;
int32_T c6_previousEvent;
int32_T c6_i6;
real_T c6_hoistedGlobal[3];
real_T c6_b_hoistedGlobal;
int32_T c6_i7;
real_T c6_c_hoistedGlobal[3];
int32_T c6_i8;
real_T c6_steer[3];
real_T c6_kill;
int32_T c6_i9;
real_T c6_neutral[3];
uint32_T c6_debug_family_var_map[6];
real_T c6_nargin = 3.0;
real_T c6_nargout = 1.0;
real_T c6_out[3];
int32_T c6_i10;
int32_T c6_i11;
int32_T c6_i12;
real_T *c6_b_kill;
real_T (*c6_b_out)[3];
real_T (*c6_b_neutral)[3];
real_T (*c6_b_steer)[3];
c6_b_neutral = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 2);
c6_b_out = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c6_b_kill = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c6_b_steer = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1);
for (c6_i3 = 0; c6_i3 < 3; c6_i3 = c6_i3 + 1) {
_SFD_DATA_RANGE_CHECK((*c6_b_steer)[c6_i3], 0U);
}
_SFD_DATA_RANGE_CHECK(*c6_b_kill, 1U);
for (c6_i4 = 0; c6_i4 < 3; c6_i4 = c6_i4 + 1) {
_SFD_DATA_RANGE_CHECK((*c6_b_out)[c6_i4], 2U);
}
for (c6_i5 = 0; c6_i5 < 3; c6_i5 = c6_i5 + 1) {
_SFD_DATA_RANGE_CHECK((*c6_b_neutral)[c6_i5], 3U);
}
c6_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1);
for (c6_i6 = 0; c6_i6 < 3; c6_i6 = c6_i6 + 1) {
c6_hoistedGlobal[c6_i6] = (*c6_b_steer)[c6_i6];
}
c6_b_hoistedGlobal = *c6_b_kill;
for (c6_i7 = 0; c6_i7 < 3; c6_i7 = c6_i7 + 1) {
c6_c_hoistedGlobal[c6_i7] = (*c6_b_neutral)[c6_i7];
}
for (c6_i8 = 0; c6_i8 < 3; c6_i8 = c6_i8 + 1) {
c6_steer[c6_i8] = c6_hoistedGlobal[c6_i8];
}
c6_kill = c6_b_hoistedGlobal;
for (c6_i9 = 0; c6_i9 < 3; c6_i9 = c6_i9 + 1) {
c6_neutral[c6_i9] = c6_c_hoistedGlobal[c6_i9];
}
sf_debug_symbol_scope_push_eml(0U, 6U, 6U, c6_debug_family_names,
c6_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c6_nargin, c6_b_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c6_nargout, c6_b_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(c6_steer, c6_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c6_kill, c6_b_sf_marshall, 3U);
sf_debug_symbol_scope_add_eml(c6_neutral, c6_sf_marshall, 4U);
sf_debug_symbol_scope_add_eml(c6_out, c6_sf_marshall, 5U);
CV_EML_FCN(0, 0);
_SFD_EML_CALL(0, 4);
if (CV_EML_IF(0, 0, c6_kill != 0.0) != 0.0) {
_SFD_EML_CALL(0, 5);
for (c6_i10 = 0; c6_i10 < 3; c6_i10 = c6_i10 + 1) {
c6_out[c6_i10] = c6_neutral[c6_i10];
}
} else {
_SFD_EML_CALL(0, 7);
for (c6_i11 = 0; c6_i11 < 3; c6_i11 = c6_i11 + 1) {
c6_out[c6_i11] = c6_steer[c6_i11];
}
}
/* end */
_SFD_EML_CALL(0, -7);
sf_debug_symbol_scope_pop();
for (c6_i12 = 0; c6_i12 < 3; c6_i12 = c6_i12 + 1) {
(*c6_b_out)[c6_i12] = c6_out[c6_i12];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1);
_sfEvent_ = c6_previousEvent;
sf_debug_check_for_state_inconsistency(_RSC_RRT_LiDAR_No_USERMachineNumber_,
chartInstance->chartNumber, chartInstance->
instanceNumber);
}
static void compInitSubchartSimstructsFcn_c6_RSC_RRT_LiDAR_No_USER
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c6_machineNumber, uint32_T
c6_chartNumber)
{
}
static const mxArray *c6_sf_marshall(void *chartInstanceVoid, void *c6_u)
{
const mxArray *c6_y = NULL;
int32_T c6_i13;
real_T c6_b_u[3];
int32_T c6_i14;
real_T c6_c_u[3];
const mxArray *c6_b_y = NULL;
SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance;
chartInstance = (SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *)chartInstanceVoid;
c6_y = NULL;
for (c6_i13 = 0; c6_i13 < 3; c6_i13 = c6_i13 + 1) {
c6_b_u[c6_i13] = (*((real_T (*)[3])c6_u))[c6_i13];
}
for (c6_i14 = 0; c6_i14 < 3; c6_i14 = c6_i14 + 1) {
c6_c_u[c6_i14] = c6_b_u[c6_i14];
}
c6_b_y = NULL;
sf_mex_assign(&c6_b_y, sf_mex_create("y", c6_c_u, 0, 0U, 1U, 0U, 1, 3));
sf_mex_assign(&c6_y, c6_b_y);
return c6_y;
}
static const mxArray *c6_b_sf_marshall(void *chartInstanceVoid, void *c6_u)
{
const mxArray *c6_y = NULL;
real_T c6_b_u;
const mxArray *c6_b_y = NULL;
SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance;
chartInstance = (SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *)chartInstanceVoid;
c6_y = NULL;
c6_b_u = *((real_T *)c6_u);
c6_b_y = NULL;
sf_mex_assign(&c6_b_y, sf_mex_create("y", &c6_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c6_y, c6_b_y);
return c6_y;
}
const mxArray *sf_c6_RSC_RRT_LiDAR_No_USER_get_eml_resolved_functions_info(void)
{
const mxArray *c6_nameCaptureInfo = NULL;
c6_nameCaptureInfo = NULL;
sf_mex_assign(&c6_nameCaptureInfo, sf_mex_create("nameCaptureInfo", NULL, 0,
0U, 1U, 0U, 2, 0, 1));
return c6_nameCaptureInfo;
}
static const mxArray *c6_c_sf_marshall(void *chartInstanceVoid, void *c6_u)
{
const mxArray *c6_y = NULL;
boolean_T c6_b_u;
const mxArray *c6_b_y = NULL;
SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance;
chartInstance = (SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *)chartInstanceVoid;
c6_y = NULL;
c6_b_u = *((boolean_T *)c6_u);
c6_b_y = NULL;
sf_mex_assign(&c6_b_y, sf_mex_create("y", &c6_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c6_y, c6_b_y);
return c6_y;
}
static void c6_emlrt_marshallIn(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance, const mxArray *c6_out, const char_T *
c6_name, real_T c6_y[3])
{
real_T c6_dv1[3];
int32_T c6_i15;
sf_mex_import(c6_name, sf_mex_dup(c6_out), c6_dv1, 1, 0, 0U, 1, 0U, 1, 3);
for (c6_i15 = 0; c6_i15 < 3; c6_i15 = c6_i15 + 1) {
c6_y[c6_i15] = c6_dv1[c6_i15];
}
sf_mex_destroy(&c6_out);
}
static uint8_T c6_b_emlrt_marshallIn(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance, const mxArray *
c6_b_is_active_c6_RSC_RRT_LiDAR_No_USER, const char_T *c6_name)
{
uint8_T c6_y;
uint8_T c6_u0;
sf_mex_import(c6_name, sf_mex_dup(c6_b_is_active_c6_RSC_RRT_LiDAR_No_USER),
&c6_u0, 1, 3, 0U, 0, 0U, 0);
c6_y = c6_u0;
sf_mex_destroy(&c6_b_is_active_c6_RSC_RRT_LiDAR_No_USER);
return c6_y;
}
static void init_dsm_address_info(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c6_RSC_RRT_LiDAR_No_USER_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(772418397U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1681252635U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2348487989U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1885832167U);
}
mxArray *sf_c6_RSC_RRT_LiDAR_No_USER_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(1548368385U);
pr[1] = (double)(3903179142U);
pr[2] = (double)(2073152806U);
pr[3] = (double)(757545159U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,3,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,2,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,2,"type",mxType);
}
mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(3);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c6_RSC_RRT_LiDAR_No_USER(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x2'type','srcId','name','auxInfo'{{M[1],M[5],T\"out\",},{M[8],M[0],T\"is_active_c6_RSC_RRT_LiDAR_No_USER\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c6_RSC_RRT_LiDAR_No_USER_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance;
chartInstance = (SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_RSC_RRT_LiDAR_No_USERMachineNumber_,
6,
1,
1,
4,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation(_RSC_RRT_LiDAR_No_USERMachineNumber_,
chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_RSC_RRT_LiDAR_No_USERMachineNumber_,chartInstance->chartNumber,1);
sf_debug_set_chart_event_thresholds
(_RSC_RRT_LiDAR_No_USERMachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"steer");
_SFD_SET_DATA_PROPS(1,1,1,0,"kill");
_SFD_SET_DATA_PROPS(2,2,0,1,"out");
_SFD_SET_DATA_PROPS(3,1,1,0,"neutral");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,101);
_SFD_CV_INIT_EML_IF(0,0,46,54,74,99);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c6_sf_marshall);
}
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c6_b_sf_marshall);
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c6_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 3;
_SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c6_sf_marshall);
}
{
real_T *c6_kill;
real_T (*c6_steer)[3];
real_T (*c6_out)[3];
real_T (*c6_neutral)[3];
c6_neutral = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 2);
c6_out = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c6_kill = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
c6_steer = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, *c6_steer);
_SFD_SET_DATA_VALUE_PTR(1U, c6_kill);
_SFD_SET_DATA_VALUE_PTR(2U, *c6_out);
_SFD_SET_DATA_VALUE_PTR(3U, *c6_neutral);
}
}
} else {
sf_debug_reset_current_state_configuration
(_RSC_RRT_LiDAR_No_USERMachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c6_RSC_RRT_LiDAR_No_USER(void *chartInstanceVar)
{
chart_debug_initialization(((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c6_RSC_RRT_LiDAR_No_USER
((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*) chartInstanceVar);
initialize_c6_RSC_RRT_LiDAR_No_USER((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)
chartInstanceVar);
}
static void sf_opaque_enable_c6_RSC_RRT_LiDAR_No_USER(void *chartInstanceVar)
{
enable_c6_RSC_RRT_LiDAR_No_USER((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)
chartInstanceVar);
}
static void sf_opaque_disable_c6_RSC_RRT_LiDAR_No_USER(void *chartInstanceVar)
{
disable_c6_RSC_RRT_LiDAR_No_USER((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)
chartInstanceVar);
}
static void sf_opaque_gateway_c6_RSC_RRT_LiDAR_No_USER(void *chartInstanceVar)
{
sf_c6_RSC_RRT_LiDAR_No_USER((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c6_RSC_RRT_LiDAR_No_USER(SimStruct* S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c6_RSC_RRT_LiDAR_No_USER
((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c6_RSC_RRT_LiDAR_No_USER();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c6_RSC_RRT_LiDAR_No_USER(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c6_RSC_RRT_LiDAR_No_USER();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c6_RSC_RRT_LiDAR_No_USER
((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c6_RSC_RRT_LiDAR_No_USER(SimStruct* S)
{
return sf_internal_get_sim_state_c6_RSC_RRT_LiDAR_No_USER(S);
}
static void sf_opaque_set_sim_state_c6_RSC_RRT_LiDAR_No_USER(SimStruct* S, const
mxArray *st)
{
sf_internal_set_sim_state_c6_RSC_RRT_LiDAR_No_USER(S, st);
}
static void sf_opaque_terminate_c6_RSC_RRT_LiDAR_No_USER(void *chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*) chartInstanceVar)
->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c6_RSC_RRT_LiDAR_No_USER((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)
chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c6_RSC_RRT_LiDAR_No_USER
((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c6_RSC_RRT_LiDAR_No_USER(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c6_RSC_RRT_LiDAR_No_USER
((SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c6_RSC_RRT_LiDAR_No_USER(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"RSC_RRT_LiDAR_No_USER",
"RSC_RRT_LiDAR_No_USER",6);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"RSC_RRT_LiDAR_No_USER",
"RSC_RRT_LiDAR_No_USER",6,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,"RSC_RRT_LiDAR_No_USER",
"RSC_RRT_LiDAR_No_USER",6,"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"RSC_RRT_LiDAR_No_USER",
"RSC_RRT_LiDAR_No_USER",6,3);
sf_mark_chart_reusable_outputs(S,"RSC_RRT_LiDAR_No_USER",
"RSC_RRT_LiDAR_No_USER",6,1);
}
sf_set_rtw_dwork_info(S,"RSC_RRT_LiDAR_No_USER","RSC_RRT_LiDAR_No_USER",6);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(2972566816U));
ssSetChecksum1(S,(2916766193U));
ssSetChecksum2(S,(1940576328U));
ssSetChecksum3(S,(673906248U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c6_RSC_RRT_LiDAR_No_USER(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "RSC_RRT_LiDAR_No_USER", "RSC_RRT_LiDAR_No_USER",
6);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c6_RSC_RRT_LiDAR_No_USER(SimStruct *S)
{
SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *chartInstance;
chartInstance = (SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct *)malloc(sizeof
(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct));
memset(chartInstance, 0, sizeof(SFc6_RSC_RRT_LiDAR_No_USERInstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.mdlStart = mdlStart_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c6_RSC_RRT_LiDAR_No_USER;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c6_RSC_RRT_LiDAR_No_USER_method_dispatcher(SimStruct *S, int_T method, void
*data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c6_RSC_RRT_LiDAR_No_USER(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c6_RSC_RRT_LiDAR_No_USER(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c6_RSC_RRT_LiDAR_No_USER(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c6_RSC_RRT_LiDAR_No_USER_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
<file_sep>/* mpc_sfun.c: Online MPC controller - Simulink/RTW S-Function */
/*
Author: <NAME>
Initial function prototype by <NAME> (2001-2002)
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.19 $ $Date: 2009/11/09 16:28:24 $
*/
#define S_FUNCTION_NAME mpc_sfun
#define S_FUNCTION_LEVEL 2
#include "mpc_sfun.h"
/* Merge common source */
/*
// MPC_COMMON.C contains the following functions
// dantzg
// getrv
*/
#include "mpc_common.c"
/* S-Function callback methods */
static void mdlInitializeSizes (SimStruct *S) /*Initialise the sizes array */
{
int_T TOTALPORTNUMBER = 9;
int_T openloopflag;
/*
// The open-loop behavior is modelled by the state space "open circuit" system
// (no direct feedthrough)
//
// x(k+1) = x(k)
// y(k) = x(k), where x(k),y(k) have dimension nu (=number of MVs)
*/
int_T nu; /* Size of input vector */
int_T nx; /* Size of state vector */
int_T nym;
int_T ny;
int_T nv;
int_T nxQP; /* Size of state vector without Noise model states */
int_T i;
int_T status;
boolean_T no_md; /* no_md=1 means no MD connected */
boolean_T no_ref; /* no_ref=1 means no reference connected */
boolean_T no_ym; /* no_ym=1 means no measured output connected */
boolean_T md_inport; /* md_inport=1 means MD port is enabled */
boolean_T no_mv; /* no_mv=1 means no external MV connected */
boolean_T mv_inport; /* mv_inport=1 means ext.MV port is enabled */
boolean_T lims_inport; /* lims_inport=1 means ports for limits are enabled */
boolean_T no_umin; /* no_umin=1 means no external UMIN signal connected */
boolean_T no_umax; /* no_umax=1 means no external UMAX signal connected */
boolean_T no_ymin; /* no_ymin=1 means no external YMIN signal connected */
boolean_T no_ymax; /* no_ymax=1 means no external YMAX signal connected */
openloopflag = (int_T)*mxGetPr(p_openloopflag(S));
/* printf("%s: openloopflag=%d\n","mdlInitializeSizes",openloopflag); */
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
if (nu==0){
ssSetErrorStatus(S, "MPC Block is empty. Open the MPC designer to create an MPC controller");
return;
}
/* when openloopflag is 0, there is a @mpc object associated with the block */
/* when openloopflag is 1, the block block is forced to one state*/
if (openloopflag==0){
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of state vector */
nym = (int_T)*mxGetPr(p_nym(S));
ny = (int_T)*mxGetPr(p_ny(S));
nv = (int_T)*mxGetPr(p_nv(S));
nxQP = (int_T)*mxGetPr(p_nxQP(S)); /* Size of state vector without Noise model states */
no_md = (boolean_T) *mxGetPr(p_no_md(S)); /* no_md=1 means no MD connected */
no_ref = (boolean_T) *mxGetPr(p_no_ref(S)); /* no_ref=1 means no reference connected */
no_ym = (boolean_T) *mxGetPr(p_no_ym(S)); /* no_ym=1 means no measured output connected */
md_inport = (boolean_T) *mxGetPr(p_md_inport(S)); /* md_inport=1 means no MD signal is enabled */
no_mv = (boolean_T) *mxGetPr(p_no_mv(S)); /* no_mv=1 means no ext. MV connected */
mv_inport = (boolean_T) *mxGetPr(p_mv_inport(S)); /* mv_inport=1 means no ext. MV signal is enabled */
lims_inport = (boolean_T) *mxGetPr(p_lims_inport(S)); /* lims_inport=1 means I/O limits are enabled */
no_umin = (boolean_T) *mxGetPr(p_no_umin(S)); /* no_umin=1 means no external UMIN signal connected */
no_umax = (boolean_T) *mxGetPr(p_no_umax(S)); /* no_umax=1 means no external UMAX signal connected */
no_ymin = (boolean_T) *mxGetPr(p_no_ymin(S)); /* no_ymin=1 means no external YMIN signal connected */
no_ymax = (boolean_T) *mxGetPr(p_no_ymax(S)); /* no_ymax=1 means no external YMAX signal connected */
}
ssSetNumSFcnParams(S, NPARAMS); /* Expected number of parameters */
if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) {
if (ssGetErrorStatus(S) != NULL) {
return; /* Parameter type error */
}
}
else {
ssSetErrorStatus(S, param_MSG);
return; /* Parameter number mismatch */
}
/* No continuous states */
ssSetNumContStates(S, 0);
if (openloopflag==0) {
ssSetNumDiscStates(S, nx+nu); /* register lastx and lastu as states */
}
else {
ssSetNumDiscStates(S, nu); /* open-loop: x(k+1)=x(k), y(k)=x(k), dim(y)=dim(x)=nu */
}
/* Set up # of input ports */
if (!ssSetNumInputPorts(S, TOTALPORTNUMBER)) {
return;
}
/* Set up dimension of input ports */
if (openloopflag==0){
#ifdef DEBUG
printf("%s\n","Closed loop port assignment");
printf("ny=%d, nym=%d, nv=%d, nu=%d\n",ny,nym,nv,nu);
printf("no_ref=%d, no_md=%d, no_ym=%d, md_inport=%d, no_mv=%d, mv_inport=%d\n",no_ref,no_md,no_ym,md_inport,no_mv,mv_inport);
#endif
status = ssSetInputPortVectorDimension(S,0,nym*(1-no_ym)+no_ym);
status = ssSetInputPortVectorDimension(S,1,ny*(1-no_ref)+no_ref);
status = ssSetInputPortVectorDimension(S,2,(nv-1)*(1-no_md)+no_md);
status = ssSetInputPortVectorDimension(S,3,nu*(1-no_mv)+no_mv);
status = ssSetInputPortVectorDimension(S,4,nu*(1-no_umin)+no_umin);
status = ssSetInputPortVectorDimension(S,5,nu*(1-no_umax)+no_umax);
status = ssSetInputPortVectorDimension(S,6,ny*(1-no_ymin)+no_ymin);
status = ssSetInputPortVectorDimension(S,7,ny*(1-no_ymax)+no_ymax);
status = ssSetInputPortVectorDimension(S,8,1);
}
else
{
#ifdef DEBUG
printf("%s\n","Open loop port assignment");
#endif
for (i=0; i<TOTALPORTNUMBER-1; i++) {
status = ssSetInputPortVectorDimension(S,i,DYNAMICALLY_SIZED);
}
status = ssSetInputPortVectorDimension(S,8,1);
}
/* Set up # of output ports */
if (!ssSetNumOutputPorts(S,1)) { /* one output port */
return;
}
/* Set up dimension of output ports */
status = ssSetOutputPortVectorDimension(S, 0, nu);
/* Set up direct feedthrough of input ports */
if (openloopflag==0 ) {
/* printf("%s\n","Direct feed through"); */
/* u depends on current ym, ref, md signals */
for (i=0; i<3; i++) {
ssSetInputPortDirectFeedThrough(S,i,1);
}
/* u does not depend on ext.MV signal */
ssSetInputPortDirectFeedThrough(S,3,0);
/* u depends on current I/O bounds, and switch signal */
for (i=4; i<TOTALPORTNUMBER; i++) {
ssSetInputPortDirectFeedThrough(S,i,1);
}
}
else{
#ifdef DEBUG
printf("%s\n","No direct feed through");
#endif
for (i=0; i<TOTALPORTNUMBER; i++) {
ssSetInputPortDirectFeedThrough(S,i,0);
}
}
/* One sample time */
ssSetNumSampleTimes(S, 1);
/* Number of work dynamic variables */
ssSetNumPWork(S,NPWORK);
ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);
}
static void mdlInitializeSampleTimes(SimStruct *S)
{
real_T ts = (real_T)*mxGetPr(p_Ts(S));
int_T openloopflag = (int_T)*mxGetPr(p_openloopflag(S));
#ifdef DEBUG
printf("%s\n","mdlInitializeSampleTimes");
#endif
/* when openloopflag is 0, there is a @mpc object associated with the block */
/* when openloopflag is 1, the block block is forced to one state*/
if (( openloopflag==0) & (ts > 0)) { /*AB: ts was set as the sampling time only if ts>0 */
ssSetSampleTime(S, 0, ts);
}
else {
ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);
}
ssSetOffsetTime(S, 0, 0.0);
}
#define MDL_INITIALIZE_CONDITIONS
static void mdlInitializeConditions(SimStruct *S)
{
/* NOTE: static variables would be shared by multiple MPC blocks ! */
int_T i;
real_T *states; /* pointer to s-function states, also used if openloopflag=1
When openloopflag=1, there are nu states. Otherwise, nx+nu states.
If RTW is used, then there're no states
*/
real_T *lastx;
real_T *lastu;
real_T *optimalseq;
real_T *v;
long int *lastt;
real_T *tab;
real_T *r;
real_T *ytilde;
real_T *vKv;
real_T *Mvv;
real_T *zopt1;
real_T *zopt2;
real_T *zopt3;
real_T *zopx;
real_T *ztemp;
real_T *rhsc;
real_T *rhsa;
real_T *basis;
long int *ib;
long int *il;
real_T *duold;
real_T *umin;
real_T *umax;
real_T *ymin;
real_T *ymax;
real_T *xk;
real_T *lastx_buf;
real_T *lastu_buf;
/* Retrieve some useful constants */
int_T nu,nx,nv,ny,nym;
int_T PTYPE,p,nvar,degrees,useslack,q,numc;
int_T openloopflag = (int_T)*mxGetPr(p_openloopflag(S));
/* printf("%s\n","mdlInitializeConditions"); */
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of extended state vector */
nv = (int_T)*mxGetPr(p_nv(S)); /* Size of current meas. dist. vect */
ny = (int_T)*mxGetPr(p_ny(S)); /* Size of all outputs */
nym = (int_T)*mxGetPr(p_nym(S)); /* Size of measured outputs */
p = (int_T)*mxGetPr(p_p(S)); /* Prediction horizon */
degrees = (int_T)*mxGetPr(p_degrees(S));
PTYPE = (int_T)*mxGetPr(p_PTYPE(S));
if (PTYPE == SOFTCONSTR)
useslack = 1;
else
useslack = 0;
q = mxGetM(p_Mlim(S));
nvar = degrees+useslack;
numc = nvar + q;
states = ssGetRealDiscStates(S);
/* printf("states: ["); for (i=0;i<nu+nx;i++) printf("%g,",states[i]); printf("]\n"); */
/* when openloopflag is 1, the block block is forced to one state*/
if (openloopflag==1) {
#ifdef DEBUG
printf("%s\n","initializing");
#endif
/* Initialize state vector and return */
/*nu = ssGetOutputPortWidth(S, 0);*/ /* Size of input vector */
for (i=0; i<nu; i++) {
states[i]=0.0;
} /* AB: SHOULDN'T THIS BE THE INPUT OFFSET uoff, */
/* OR EVEN BETTER lastu PASSED FROM THE MASK ? */
/* Yes but if there is no MPC obj we must assume 0 */
#ifdef DEBUG
printf("%s\n","initialized");
#endif
return;
}
/* Initialize lastx, lastu, optimalseq, lastt to parameter values */
lastx = calloc(nx,sizeof(real_T));
lastu = calloc(nu,sizeof(real_T));
optimalseq = calloc(mxGetM(p_optimalseq(S)),sizeof(real_T));
v = calloc((p+1)*nv,sizeof(real_T));
lastt = calloc(1,sizeof(long int));
tab = calloc(numc*numc,sizeof(real_T));
r = calloc(p*ny,sizeof(real_T)); /* reference signal vector r from workspace */
ytilde = calloc(nym,sizeof(real_T));
vKv = calloc(degrees,sizeof(real_T));
Mvv = calloc(q,sizeof(real_T)); /* q=number of constraints */
ztemp = calloc(degrees,sizeof(real_T)); /* stores linear term of the cost function */
zopt1 = calloc(degrees,sizeof(real_T));
rhsc = calloc(q,sizeof(real_T));
umin = calloc(nu,sizeof(real_T)); /* umin */
umax = calloc(nu,sizeof(real_T)); /* umax */
ymin = calloc(ny,sizeof(real_T)); /* ymin */
ymax = calloc(ny,sizeof(real_T)); /* ymax */
rhsa = calloc(nvar,sizeof(real_T));
basis = calloc(numc,sizeof(real_T));
ib = calloc(numc,sizeof(long int));
il = calloc(numc,sizeof(long int));
zopt2 = calloc(nvar,sizeof(real_T));
zopx = calloc(nu*p,sizeof(real_T));
zopt3 = calloc(mxGetM(p_optimalseq(S)),sizeof(real_T));
duold = calloc(mxGetM(p_Jm(S)),sizeof(real_T));
xk = calloc(nx,sizeof(real_T));
lastx_buf = calloc(nx,sizeof(real_T));
lastu_buf = calloc(nu,sizeof(real_T));
memcpy(lastx, mxGetPr(p_lastx(S)), nx*sizeof(real_T));
memcpy(lastu, mxGetPr(p_lastu(S)), nu*sizeof(real_T));
memcpy(optimalseq, mxGetPr(p_optimalseq(S)), mxGetM(p_optimalseq(S))*sizeof(real_T));
for (i=0; i<p+1; i++) {
v[i*nv+nv-1]=1.0; /* additional measured disturbance due to offsets */
}
ssSetPWorkValue(S, w_lastx, lastx);
ssSetPWorkValue(S, w_lastu, lastu);
ssSetPWorkValue(S, w_v, v);
ssSetPWorkValue(S, w_optimalseq, optimalseq);
ssSetPWorkValue(S, w_lastt, lastt);
ssSetPWorkValue(S, w_r, r);
ssSetPWorkValue(S, w_ytilde, ytilde);
ssSetPWorkValue(S, w_vKv, vKv);
ssSetPWorkValue(S, w_Mvv, Mvv);
ssSetPWorkValue(S, w_zopt1, zopt1);
ssSetPWorkValue(S, w_zopt2, zopt2);
ssSetPWorkValue(S, w_zopt3, zopt3);
ssSetPWorkValue(S, w_zopx, zopx);
ssSetPWorkValue(S, w_ztemp, ztemp);
ssSetPWorkValue(S, w_rhsc, rhsc);
ssSetPWorkValue(S, w_rhsa, rhsa);
ssSetPWorkValue(S, w_basis, basis);
ssSetPWorkValue(S, w_ib, ib);
ssSetPWorkValue(S, w_il, il);
ssSetPWorkValue(S, w_duold, duold);
ssSetPWorkValue(S, w_umin, umin);
ssSetPWorkValue(S, w_umax, umax);
ssSetPWorkValue(S, w_ymin, ymin);
ssSetPWorkValue(S, w_ymax, ymax);
ssSetPWorkValue(S, w_xk, xk);
ssSetPWorkValue(S, w_lastx_buf, lastx_buf);
ssSetPWorkValue(S, w_lastu_buf, lastu_buf);
ssSetPWorkValue(S, w_tab, tab);
for (i=0; i<nx; i++) {
states[i]=lastx[i];
}
for (i=0; i<nu; i++) {
states[nx+i]=lastu[i];
}
}
/* MDLOUTPUT */
static void mdlOutputs(SimStruct *S, int_T tid)
/* Note that tid = Task ID */
{
/* NOTE: static variables are shared by multiple MPC blocks ! */
static real_T *ref_signal, *md_signal, *yoff, *voff, *myoff, *uoff;
static real_T *M, *Cm, *Dvm;
static int_T q, nvar, nxQP, p, degrees, PTYPE, useslack;
static long int maxiter;
static real_T *Kv, *Mv, *Kx, *Ku1, *Kut, *Kr, *KduINV;
static real_T *Mx, *Mu1, *rhsc0, *rhsa0, *Mlim, *MuKduINV, *TAB, *zmin;
static real_T *wtab;
static real_T *utarget;
static int_T nu, nx, nym, ny, nv;
static boolean_T no_md, no_ref, no_ym;
static boolean_T do_optimization;
/* Variables for detecting if meas.dist, refs, and user-supplied MVs are connected to MPC block */
static boolean_T md_inport, lims_inport, no_umin, no_umax, no_ymin, no_ymax;
static boolean_T switch_inport, no_switch, is_multiple;
static real_T enable_value;
static boolean_T ref_from_ws, ref_preview, md_from_ws, md_preview;
static int_T Nref_signal, Nmd_signal;
static boolean_T isemptyKv;
/* Counters */
int_T i,j;
int_T h;
int_T numc;
/* Accumulator */
real_T adder = 0;
real_T cache = 0;
/* Local work variables */
real_T *r;
real_T *ytilde;
real_T *vKv;
real_T *Mvv;
real_T *zopt;
real_T *zopx;
real_T *ztemp;
real_T *rhsc;
real_T *rhsa;
real_T *basis;
long int *ib;
long int *il;
real_T *duold;
real_T *tab; /* Tableau for QP */
real_T *umin; /* local copy of umin for time-varying bounds */
real_T *umax; /* local copy of umax for time-varying bounds */
real_T *ymin; /* local copy of ymin for time-varying bounds */
real_T *ymax; /* local copy of ymax for time-varying bounds */
int nuc = 0; /* number of unconstrained vars in DANTZGMP */
int iret; /* DANTZGMP return code */
/* Input and output vectors */
real_T *openloopstates;
#ifndef RT
real_T *discstates;
#endif
real_T *u_out;
real_T *optimalseq;
real_T *v;
long int *lastt;
real_T *lastx;
real_T *lastu;
InputRealPtrsType ymPtrs; /* pointers to input port signals */
InputRealPtrsType refPtrs;
InputRealPtrsType mdPtrs;
InputRealPtrsType uminPtrs;
InputRealPtrsType umaxPtrs;
InputRealPtrsType yminPtrs;
InputRealPtrsType ymaxPtrs;
InputRealPtrsType switchPtrs;
real_T *wlastx;
real_T *wlastu;
int_T openloopflag = (int_T)*mxGetPr(p_openloopflag(S));
#ifdef DEBUG
printf("tid=%d\n",tid);
printf("mdlout\n");
#endif
if (openloopflag==1) {
#ifdef DEBUG
printf("%s","get disc states");
#endif
u_out = ssGetOutputPortRealSignal(S,0);
nu = ssGetOutputPortWidth(S, 0); /* Size of input vector */
openloopstates = ssGetDiscStates(S);
#ifdef DEBUG
printf("%f",openloopstates[0]);
#endif
for (i=0; i<nu; i++) {
u_out[i] = openloopstates[i];
}
return;
}
/* (jgo) Copy 0:nx-1 of the disc states vector to lastx
Copy nx:nx+nu-1 of the disc states vector or last u */
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of extended state vector */
lastx = ssGetPWorkValue(S,w_lastx_buf);
lastu = ssGetPWorkValue(S,w_lastu_buf);
#ifndef RT
discstates = ssGetDiscStates(S);
memcpy(lastx, discstates, nx*sizeof(real_T));
memcpy(lastu, discstates+nx, nu*sizeof(real_T));
#else
memcpy(lastx, ssGetPWorkValue(S,w_lastx), nx*sizeof(real_T));
memcpy(lastu, ssGetPWorkValue(S,w_lastu), nu*sizeof(real_T));
#endif
optimalseq = ssGetPWorkValue(S, w_optimalseq);
v = ssGetPWorkValue(S,w_v);
lastt = ssGetPWorkValue(S,w_lastt);
do_optimization=(boolean_T) 1;
is_multiple = (boolean_T) *mxGetPr(p_is_multiple(S));
/* is_multiple distinguishes between stand-alone and multiple MPC blocks.
is_multiple=1 means block belongs to a set of multiple MPC's.
If is_multiple=1, then all signals are connected to the block, but
MD / LIMS signals are meaningful only if md_inport / lims_inport are
equal to 1 */
/* Determine value of switching signal enabling the optimization (from 1 to N) */
enable_value = (real_T) *mxGetPr(p_enable_value(S));
switch_inport = (boolean_T) *mxGetPr(p_switch_inport(S)); /* switch_inport=TRUE means SWITCH inport exists */
if (switch_inport) {
no_switch = (boolean_T) *mxGetPr(p_no_switch(S)); /* no_switch=TRUE means no SWITCH connected */
if (no_switch) {
/* Don't do any optimization */
do_optimization=(boolean_T) 0;
}
else
{
switchPtrs = ssGetInputPortRealSignalPtrs(S,8); /* get signal from inport #9 */
if (!no_switch) {
/* switching signal exists and is connected */
if (!(*switchPtrs[0]==enable_value))
do_optimization=(boolean_T) 0;
}
}
}
/* Get vars from structure S. They are initialized every time, because there might be multiple blocks in the diagram sharing the same static variables */
ref_signal=mxGetPr((real_T *)p_ref_signal(S));
Nref_signal=mxGetN(p_ref_signal(S));
md_signal=mxGetPr((real_T *)p_md_signal(S));
Nmd_signal=mxGetN(p_md_signal(S));
yoff=mxGetPr((real_T *)p_yoff(S));
voff=mxGetPr((real_T *)p_voff(S));
myoff=mxGetPr((real_T *)p_myoff(S));
uoff=mxGetPr((real_T *)p_uoff(S));
M=mxGetPr((real_T *)p_M(S));
Cm=mxGetPr((real_T *)p_Cm(S));
Dvm=mxGetPr((real_T *)p_Dvm(S));
Kv=mxGetPr((real_T *)p_Kv(S));
isemptyKv=mxIsEmpty(p_Kv(S));
Mv=mxGetPr((real_T *)p_Mv(S));
Kx=mxGetPr((real_T *)p_Kx(S));
Ku1=mxGetPr((real_T *)p_Ku1(S));
Kut=mxGetPr((real_T *)p_Kut(S));
Kr=mxGetPr((real_T *)p_Kr(S));
KduINV=mxGetPr((real_T *)p_KduINV(S));
Mx=mxGetPr((real_T *)p_Mx(S));
Mu1=mxGetPr((real_T *)p_Mu1(S));
rhsc0=mxGetPr((real_T *)p_rhsc0(S));
rhsa0=mxGetPr((real_T *)p_rhsa0(S));
Mlim=mxGetPr((real_T *)p_Mlim(S));
MuKduINV=mxGetPr((real_T *)p_MuKduINV(S));
TAB=mxGetPr((real_T *)p_TAB(S));
wtab=mxGetPr((real_T *)p_wtab(S));
zmin=mxGetPr((real_T *)p_zmin(S));
utarget=mxGetPr((real_T *)p_utarget(S));
nxQP = (int_T)*mxGetPr(p_nxQP(S)); /* Size of state vector without Noise model states */
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of extended state vector */
nym = (int_T)*mxGetPr(p_nym(S)); /* Size of measured output vector */
ny = (int_T)*mxGetPr(p_ny(S)); /* Size of current ref. vect. */
nv = (int_T)*mxGetPr(p_nv(S)); /* Size of current meas. dist. vect. */
md_inport = (boolean_T) *mxGetPr(p_md_inport(S)); /* md_inport=TRUE means MD inport exists */
lims_inport = (boolean_T) *mxGetPr(p_lims_inport(S)); /* lims_inport=TRUE means LIMS inports exist */
no_md = (boolean_T) *mxGetPr(p_no_md(S)); /* no_md=TRUE means no MD connected */
no_ref = (boolean_T) *mxGetPr(p_no_ref(S)); /* no_ref=TRUE means no reference connected */
no_ym = (boolean_T) *mxGetPr(p_no_ym(S)); /* no_ym=TRUE means no meas. output connected */
no_umin = (boolean_T) *mxGetPr(p_no_umin(S)); /* no_umin=TRUE means no UMIN connected */
no_umax = (boolean_T) *mxGetPr(p_no_umax(S)); /* no_umax=TRUE means no UMAX connected */
no_ymin = (boolean_T) *mxGetPr(p_no_ymin(S)); /* no_ymin=TRUE means no YMIN connected */
no_ymax = (boolean_T) *mxGetPr(p_no_ymax(S)); /* no_ymax=TRUE means no YMAX connected */
ref_from_ws = (boolean_T) *mxGetPr(p_ref_from_ws(S)); /* reference signal comes from workspace */
ref_preview = (boolean_T) *mxGetPr(p_ref_preview(S)); /* =TRUE means preview is on */
md_from_ws = (boolean_T) *mxGetPr(p_md_from_ws(S)); /* meas. dist. signal comes from workspace */
md_preview = (boolean_T) *mxGetPr(p_md_preview(S)); /* =TRUE means preview is on */
q = mxGetM(p_Mlim(S)); /* Number of constraints in QP problem */
p = (int_T)*mxGetPr(p_p(S)); /* Prediction horizon */
degrees = (int_T)*mxGetPr(p_degrees(S));
PTYPE = (int_T)*mxGetPr(p_PTYPE(S));
maxiter = (int_T) *mxGetPr(p_maxiter(S)); /* Maxiter */
if (PTYPE == SOFTCONSTR)
useslack = 1;
else
useslack = 0;
nvar=degrees+useslack; /* number of optimization variables */
#ifdef DEBUG
printf("lastx: [");
for (i=0;i<nx;i++)
printf("%g,",lastx[i]);
printf("]\n");
#endif
r = ssGetPWorkValue(S,w_r); /* reference signal vector r from workspace */
/* Retrieve pointers to input and output vectors */
ymPtrs = ssGetInputPortRealSignalPtrs(S,0);
refPtrs = ssGetInputPortRealSignalPtrs(S,1);
mdPtrs = ssGetInputPortRealSignalPtrs(S,2);
uminPtrs = ssGetInputPortRealSignalPtrs(S,4); /* get signal from inport #5 */
umaxPtrs = ssGetInputPortRealSignalPtrs(S,5); /* get signal from inport #6 */
yminPtrs = ssGetInputPortRealSignalPtrs(S,6); /* get signal from inport #7 */
ymaxPtrs = ssGetInputPortRealSignalPtrs(S,7); /* get signal from inport #8 */
u_out = ssGetOutputPortRealSignal(S,0); /* only (S,0), as there's only one output port ...*/
if (do_optimization) {
if (!ref_from_ws) { /* ref. signal comes from Simulink diagram */
/* Get output ref. from input port */
for (i=0; i<p; i++) {
for (j=0; j<ny; j++) {
if (no_ref) {
r[j+i*ny] = 0; /* default: r=yoff */
}
else {
r[j+i*ny] = *refPtrs[j]-yoff[j];
}
}
}
}
else { /* Reference signal is contained in ref_signal */
if (!ref_preview) {
getrv(r,ref_signal,*lastt,*lastt,ny,ny,Nref_signal);
/* Repeat over prediction horizon */
for (i=1; i<p; i++) {
for (j=0; j<ny; j++) {
r[j+i*ny] = r[j];
}
}
}
else {
getrv(r,ref_signal,*lastt,*lastt+p-1,ny,ny,Nref_signal);
}
}
#ifdef DEBUG
for (i=0; i<p; i++) {
printf("r(:,%d): [",i);
for (j=0; j<ny; j++)
printf("%5.2f, ",r[ny*i+j]);
printf("]'\n");
}
#endif
/* printf("r: ["); for (i=0;i<ny;i++) printf("%g,",r[i]); printf("]\n"); */
} /* end of if (do_optimization) */
/* Set up measured disturbance vector v from *mdPtrs or from rv (file)
as a one-component vector (even if no optimization is performed,
v is always needed by the state observer) */
if (!md_from_ws) {/* measured disturbance comes from Simulink diagram */
/* Get meas. dist. from input */
for (i=0; i<p+1; i++) {
for (j=0; j<nv-1; j++) {
if (no_md) {
v[j+i*nv] = 0; /* default: md=voff */
}
else {
v[j+i*nv] = *mdPtrs[j]-voff[j];
}
}
}
}
else { /* Measured disturbance signal is contained in md_signal */
if (!md_preview) {
getrv(v,md_signal,*lastt,*lastt,nv-1,nv-1,Nmd_signal);
/* Repeat over prediction horizon */
for (i=1; i<p+1; i++) {
for (j=0; j<nv; j++) {
v[j+i*nv] = v[j];
}
}
}
else {
getrv(v,md_signal,*lastt,*lastt+p,nv-1,nv,Nmd_signal);
}
}
#ifdef DEBUG
for (i=0; i<p+1; i++) {
printf("v(:,%d): [",i);
for (j=0; j<nv; j++)
printf("%5.2f, ",v[nv*i+j]);
printf("]'\n");
}
#endif
/* printf("v: ["); for (i=0;i<nv-1;i++) printf("%g,",v[i]); printf("]\n"); */
/* Measurement update of state observer */
/* ytilde=y-myoff-(Cm*xk+Dvm*vk); */
ytilde = ssGetPWorkValue(S, w_ytilde);
#ifdef DEBUG
printf("ym[0]=%g\n",*ymPtrs[0]);
#endif
for (i=0; i<nym; i++) {
CLR; /* i.e., adder = 0 */
MVP(Cm, lastx, i, nym, nx);
MVP(Dvm, v, i, nym, nv);
/* printf("adder[%d]: %g\n",i,adder); */
if (no_ym) {
ytilde[i]=0.0-myoff[i]-adder;
}
else {
ytilde[i]=*ymPtrs[i]-myoff[i]-adder;
}
}
#ifdef DEBUG
printf("ytilde: [");
for (i=0;i<nym;i++)
printf("%g,",ytilde[i]);
printf("]\n");
#endif
/* xk=xk+M*ytilde; % (NOTE: what is called M here is also called M in KALMAN's help file) */
#ifdef DEBUG
printf("lastx[0]=%g\n",lastx[0]);
#endif
for (i=0; i<nx; i++) {
CLR;
MVP(M, ytilde, i, nx, nym);
lastx[i] += adder;
#ifdef DEBUG
printf("Measurement update: x[%d]: %f\n",i,lastx[i]);
#endif
}
/* Now ready for MPC optimization problem
xQP=xk(1:nxQP) only these first nx states are fed back to the QP problem
(i.e., multiplied by the Kx gain)
*/
if (do_optimization) {
#ifdef DEBUG
printf("Starting MPC Optimization Problem ...\n");
#endif
vKv = ssGetPWorkValue(S,w_vKv);
if (isemptyKv) {
for (j=0; j<degrees; j++) {
vKv[j]=0.0;
}
if(PTYPE != UNCONSTR) {
Mvv = ssGetPWorkValue(S,w_Mvv);
for(i=0; i<q; i++) {
Mvv[i]=0.0;
}
}
}
else {
for (j=0; j<degrees; j++) {
CLR;
MVTP(Kv, v, j, (p+1)*nv);
vKv[j]=adder;
}
if (PTYPE != UNCONSTR) {
/*printf("N(Mv),M(Mv): %d,%d -- nvar: %d, (p+1)*nv: %d\n",mxGetN(p_Mv(S)),mxGetM(p_Mv(S)),q,(p+1)*nv); */
Mvv = ssGetPWorkValue(S,w_Mvv);
for (i=0; i<q; i++) {
CLR;
MVP(Mv, v, i, q, (p+1)*nv);
Mvv[i]=adder;
}
}
}
/* The equivalent of mpc2.m starts here */
if (PTYPE == UNCONSTR) {
/* Unconstrained problem, compute zopt */
#ifdef DEBUG
printf("UNCONSTRAINED!\n");
#endif
/* zopt=-KduINV*(Kx'*xk+Ku1'*uk1+Kut'*utarget+Kr'*r+vKv'); */
ztemp = ssGetPWorkValue(S,w_ztemp); /* stores linear term of the cost function */
for (i=0; i<degrees; i++) {
CLR;
MTVP(Kx, lastx, i, nxQP);
/* for (j=0; j<nxQP; j++) {
printf("Kx[%d]: %7.5f, x[%d]: %7.5f\n",j,mxGetPr(p_Kx(S))[j],j,lastx[j]);
} */
MTVP(Ku1, lastu, i, nu);
/*printf("N(Kut),M(Kut): %d,%d -- nvar: %d, p*nu: %d\n",mxGetN(p_Kut(S)),mxGetM(p_Kut(S)),nvar,p*nu); */
MTVP(Kut, utarget, i, p*nu);
/*printf("N(Kr),M(Kr): %d,%d -- nvar: %d, p*ny: %d\n",mxGetN(p_Kr(S)),mxGetM(p_Kr(S)),nvar,p*ny); */
MTVP(Kr, r, i, p*ny);
ztemp[i]=adder+vKv[i];
}
zopt = ssGetPWorkValue(S,w_zopt1);
for (i=0; i<degrees; i++) {
CLR;
MVP(KduINV, ztemp, i, nvar, nvar);
zopt[i] = -adder;
}
}
else {
/* Constrained, must solve QP */
#ifdef DEBUG
printf("CONSTRAINED!\n");
#endif
/* Set up matrices for QP */
/* rhsc=rhsc0+Mlim+Mx*xk+Mu1*uk1+Mvv; */
/* printf("N(rhsc0),M(rhsc0): %d,%d -- 1: %d, q: %d\n",mxGetN(p_rhsc0(S)),mxGetM(p_rhsc0(S)),1,q); */
rhsc = ssGetPWorkValue(S,w_rhsc);
for (i=0; i<q; i++) {
CLR;
MVP(Mx, lastx, i, q, nxQP);
MVP(Mu1, lastu, i, q, nu);
rhsc[i]=rhsc0[i]+Mlim[i]+Mvv[i]+adder;
}
/* Handle time varying limits */
if (lims_inport) { /* time varying limits */
if (!no_umin) {
umin = ssGetPWorkValue(S,w_umin); /* umin */
for (j=0; j<nu;j++) {
cache=*uminPtrs[j];
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (utIsInf((double) cache))
printf("Warning: lower bound on input #%d is infinite, results may be unreliable\n",j+1);
#endif
umin[j]=cache-uoff[j];
}
}
if (!no_umax) {
umax = ssGetPWorkValue(S,w_umax); /* umax */
for (j=0; j<nu;j++) {
cache=*umaxPtrs[j];
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (utIsInf((double) cache))
printf("Warning: upper bound on input #%d is infinite, results may be unreliable\n",j+1);
#endif
umax[j]=cache-uoff[j];
}
}
if (!no_ymin) {
ymin = ssGetPWorkValue(S,w_ymin); /* ymin */
for (j=0; j<ny;j++) {
cache=*yminPtrs[j];
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (utIsInf((double) cache))
printf("Warning: lower bound on output #%d is infinite, results may be unreliable\n",j+1);
#endif
ymin[j]=cache-yoff[j];
}
}
if (!no_ymax) {
ymax = ssGetPWorkValue(S,w_ymax); /* ymax */
for (j=0; j<ny;j++) {
cache=*ymaxPtrs[j];
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (utIsInf((double) cache))
printf("Warning: upper bound on output #%d is infinite, results may be unreliable\n",j+1);
#endif
ymax[j]=cache-yoff[j];
}
}
for (i=0; i<q; i++) {
rhsc[i]=rhsc[i]-Mlim[i]; /* remove MPC object's dummy limit */
}
/* Mlim=[ymax(:);-ymin(:);umax(:);-umin(:);dumax;-dumin]; (see MPC_BUILDMAT.M)
Note that ymin,ymax have length p*ny, while umin,umax,dumax,dumin have length of degrees,
as constraints on blocked inputs have been collapsed */
h=0;
if (!no_ymax & !no_ymin) { /* Check that ymin, ymax are consistent and possibly adjust them */
for (j=0; j<ny; j++) {
if (ymax[j] < ymin[j]) {
cache = ymin[j];
ymin[j] = ymax[j];
ymax[j] = cache;
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
printf("Warning: inverting bounds on y%d to [%f,%f]\n",j+1,ymin[j],ymax[j]);
#endif
}
if (ymax[j] <= ymin[j] + CONSTR_TOL) {
ymax[j] += CONSTR_TOL; /* add some tolerance to avoid problems with QP */
}
}
}
if (!no_ymax) { /* Get upper bounds on ouputs from Simulink diagram */
for (i=0; i<p; i++) {
for (j=0; j<ny; j++) {
rhsc[h]=rhsc[h] + ymax[j];
h++;
}
}
}
if (!no_ymin) { /* Get lower bounds on ouputs from Simulink diagram */
for (i=0; i<p; i++) {
for (j=0; j<ny; j++) {
rhsc[h]=rhsc[h] - ymin[j];
h++;
}
}
}
if (!no_umax & !no_umin) { /* Check that umin, umax are consistent and possibly adjust them */
for (j=0; j<nu; j++) {
if (umax[j] < umin[j]) {
cache = umin[j];
umin[j] = umax[j];
umax[j] = cache;
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
printf("Warning: inverting bounds on u%d to [%f,%f]\n",j+1,umin[j],umax[j]);
#endif
}
if (umax[j] <= umin[j] + CONSTR_TOL) {
umax[j] += CONSTR_TOL; /* add some tolerance to avoid problems with QP */
}
}
}
if (!no_umax) { /* Get upper bounds on inputs from Simulink diagram */
for (i=0; i<degrees/nu; i++) {
for (j=0; j<nu; j++) {
rhsc[h]=rhsc[h] + umax[j];
h++;
}
}
}
if (!no_umin) { /* Get lower bounds on inputs from Simulink diagram */
for (i=0; i<degrees/nu; i++) {
for (j=0; j<nu; j++) {
rhsc[h]=rhsc[h] - umin[j];
h++;
}
}
}
/* Restore bounds on delta u */
for (i=h; i<q; i++) {
rhsc[i]=rhsc[i]+Mlim[i]; /* restore MPC object's limits */
}
}
/* rhsa=rhsa0-[(xk'*Kx+r'*Kr+uk1'*Ku1+vKv+utarget'*Kut),zeros(1,useslack)]'; */
rhsa = ssGetPWorkValue(S,w_rhsa);
rhsa[nvar-1] = 0.0; /* if useslack=1, then last entry of rhsa equals 0, otherwise is rewritten below */
for (j=0; j<degrees; j++) {
CLR;
MVTP(Kx, lastx, j, nxQP);
MVTP(Kr, r, j, p*ny);
MVTP(Ku1, lastu, j, nu);
MVTP(Kut, utarget, j, p*nu);
/* rhsa[j]=mxGetPr(p_rhsa0(S))[j]-(adder+vKv[j]); */
rhsa[j]=rhsa0[j]-(adder+vKv[j]);
}
/* basis=[KduINV*rhsa;rhsc-MuKduINV*rhsa]; */
numc = nvar+q;
basis = ssGetPWorkValue(S,w_basis);
#ifdef DEBUG
printf("Basis is %d items\n", numc);
#endif
for(i=0; i<nvar; i++) {
CLR;
MVP(KduINV, rhsa, i, nvar, nvar);
basis[i]=adder;
#ifdef DEBUG
printf("B %f\n",basis[i]);
#endif
}
/* printf("N(MuKduINV),M(MuKduINV): %d,%d -- 1: %d, nvar: %d\n",mxGetN(p_MuKduINV(S)),mxGetM(p_MuKduINV(S)),nvar,q); */
for(i=0; i<q; i++) {
CLR;
MVP(MuKduINV, rhsa, i, q, nvar);
basis[i+nvar]=rhsc[i]-adder;
#ifdef DEBUG
printf("B %f\n",basis[i+mxGetM(p_KduINV(S))]);
#endif
}
/* ibi=-[1:nvar+nc]'; */
/* ili=-ibi; */
ib = ssGetPWorkValue(S,w_ib);
il = ssGetPWorkValue(S,w_il);
for(i=0; i<numc; i++) {
il[i]=i+1;
ib[i]=-il[i];
}
/* Initialize the tableau */
tab = ssGetPWorkValue(S, w_tab);
memcpy(tab, TAB, numc*numc*sizeof(real_T));
#ifdef DEBUG
printf("Tableau (is it modified?): %f",tab[0]);
#endif
/* Call QP optimizer and check if problem was feasible */
iret = dantzg(tab, &numc, &numc, &nuc, basis, ib, il, &maxiter);
if (iret > 0) {
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (iret > maxiter) {
printf("Warning: maximum number of iterations exceeded, solution is unreliable. Please augment Optimizer.MaxIter.");
}
#endif
/* Feasible, extract the solution */
#ifdef DEBUG
printf("Feasible!\n");
#endif
/*
for j=1:nvar
if il(j) <= 0
zopt(j)=zmin(j);
else
zopt(j)=basis(il(j))+zmin(j);
end
end
*/
zopt = ssGetPWorkValue(S,w_zopt2);
for (i=0; i<nvar; i++) {
#ifdef DEBUG
printf("IL %d\n",il[i]);
#endif
if (il[i] <= 0) {
zopt[i]=zmin[i];
}
else {
zopt[i]=basis[il[i]-1]+zmin[i];
}
#ifdef DEBUG
printf("Zopt %f\n",zopt[i]);
#endif
}
}
else {
/* Unfeasible, recall last optimal sequence
This should never happen
*/
#ifdef DEBUG
printf("Unfeasible!\n");
#endif
#ifdef MATLAB_MEX_FILE /* return error messages, unless code is compiled for RTW */
if (iret == numc * -3) {
printf("Warning: problems with QP solver -- Unable to delete a variable from basis");
#ifdef DEBUG
printf("basis=[");
for (i=0;i<numc;i++) {
printf("%g",basis[i]);
if (i<numc-1)
printf(",");
}
printf("]\n");
#endif
printf("Using previous optimal sequence ...\n");
}
else {
printf("Warning: QP problem infeasible, using previous optimal sequence ...\n");
}
#endif
/* POSSIBLE OTHER DEFAULT: zopt=0, so that u(t)=last_u+0=last_u */
/* duold=Jm*optimalseq;
zopt=[duold(1+nu:nu*p);zeros(nu,1)]; % shifts
% Rebuilds optimalseq from zopt
%free=find(kron(DUFree(:),ones(nu,1))); % Indices of free moves
free=find(DUFree(:));
epsslack=Inf; % Slack variable for soft output constraints
zopt=zopt(free);
*/
zopx = ssGetPWorkValue(S,w_zopx);
zopt = ssGetPWorkValue(S,w_zopt3);
for (i=0; i<(int_T)mxGetM(p_optimalseq(S)); i++) {
zopt[i]=0.0;
}
duold = ssGetPWorkValue(S,w_duold);
for (i=0; i<(int_T)mxGetM(p_Jm(S)); i++) {
CLR;
MVP(mxGetPr(p_Jm(S)), optimalseq, i, (int_T)mxGetM(p_Jm(S)), (int_T)mxGetN(p_Jm(S)));
duold[i]=adder;
}
for (i=nu; i<nu*p; i++) {
zopx[i-nu]=duold[i];
}
for (i=nu*(p-1); i<nu*p; i++) {
zopx[i]=0.0;
}
/* Find free moves */
j=0;
for (i=0; i<(int_T)mxGetM(p_DUFree(S)); i++) {
if ((int_T)(mxGetPr(p_DUFree(S))[i]) != 0) {
zopt[j++]=zopx[i];
}
}
}
/* Rebuild optimalseq */
/* printf("%d, %d\n",mxGetM(p_optimalseq(S)),degrees); */
for (i=0; i<degrees; i++) {
optimalseq[i]=zopt[i];
}
/* End of MPC2.M */
}
#ifdef DEBUG
printf("zopt[0] %f\n",zopt[0]);
#endif
/* Compute current input and update lastu */
for (i=0; i<nu; i++){
lastu[i] += zopt[i];
}
} /* End "if (do_optimization) ..." */
else {
/* Returns u=0. */
for (i=0; i<nu; i++) {
lastu[i] = -uoff[i];
}
}
for (i=0; i<nu; i++){
u_out[i] = lastu[i]+uoff[i];
#ifdef DEBUG
printf("Lastu %f\n",lastu[i]);
#endif
}
/* (jgo) Copy the new "state" vector back to the work vector */
wlastx = ssGetPWorkValue(S,w_lastx);
wlastu = ssGetPWorkValue(S,w_lastu);
memcpy(wlastx, lastx, nx*sizeof(real_T));
memcpy(wlastu, lastu, nu*sizeof(real_T));
} /* End of MDL_OUTPUTS */
/* MDLUPDATE */
#define MDL_UPDATE
static void mdlUpdate(SimStruct *S, int_T tid)
{
static int_T nu, nx, nv;
static real_T *A, *Bu, *Bv;
real_T *xk; /* Temporary state update */
real_T *states;
real_T *lastx = ssGetPWorkValue(S,w_lastx);
real_T *lastu = ssGetPWorkValue(S,w_lastu);
real_T *v = ssGetPWorkValue(S,w_v);
long int *lastt = ssGetPWorkValue(S,w_lastt);
int_T openloopflag = (int_T) *mxGetPr(p_openloopflag(S)); /* jgo */
InputRealPtrsType mvPtrs;
static boolean_T no_mv, mv_inport;
static real_T *uoff;
int_T i,j;
real_T adder = 0;
states = ssGetDiscStates(S);
if (openloopflag==1) {
return; /* don't change the state */
}
#ifdef DEBUG
printf("UPDATE\n");
#endif
/* Initialize vars from structure S */
nu = (int_T)*mxGetPr(p_nu(S)); /* Size of input vector */
nx = (int_T)*mxGetPr(p_nx(S)); /* Size of extended state vector */
nv = (int_T)*mxGetPr(p_nv(S)); /* Size of current meas. dist. vect. */
A = mxGetPr((real_T *)p_A(S));
Bu = mxGetPr((real_T *)p_Bu(S));
Bv = mxGetPr((real_T *)p_Bv(S));
no_mv = (boolean_T) *mxGetPr(p_no_mv(S)); /* no_mv=TRUE means no user-supplied MV signals connected */
mv_inport = (boolean_T) *mxGetPr(p_mv_inport(S)); /* mv_inport=TRUE means ext. MV inport exists */
uoff=mxGetPr((real_T *)p_uoff(S));
mvPtrs = ssGetInputPortRealSignalPtrs(S,3); /* get signal from inport #4 */
/* update lastu */
/* If the user supplies his/her own MV signal, then the state observer must be updated
with that signal */
if (mv_inport) { /* The user has supplied a MV signal */
for (j=0; j<nu; j++) {
if (!no_mv) {
lastu[j] = *mvPtrs[j]-uoff[j]; /* otherwise ext_u=MPC's last u */
}
}
/* printf("lastu: ["); for (i=0;i<nu;i++) printf("%g,",lastu[i]); printf("]\n"); */
}
/* update lastx */
xk = ssGetPWorkValue(S,w_xk);
for (i=0; i<nx; i++) {
CLR;
MVP(A, lastx, i, nx, nx);
MVP(Bu, lastu, i, nx, nu);
MVP(Bv, v, i, nx, nv);
xk[i]=adder;
#ifdef DEBUG
printf("Time update: xk[%d]: %f\n",i,xk[i]);
#endif
}
memcpy(lastx, xk, nx*sizeof(real_T));
/* update lastt */
*lastt += 1;
#ifdef DEBUG
printf("Lastt: %d\n",*lastt);
#endif
for (i=0; i<nx; i++) {
states[i]=lastx[i];
}
for (i=0; i<nu; i++) {
states[nx+i]=lastu[i];
}
}
static void mdlTerminate(SimStruct *S)
{
int_T i;
/* Free all work vectors */
for (i = 0; i<ssGetNumPWork(S); i++) {
if (ssGetPWorkValue(S,i) != NULL) {
free(ssGetPWorkValue(S,i));
}
}
#ifdef DEBUG
printf("END\n");
#endif
}
#ifdef MATLAB_MEX_FILE
# define MDL_SET_INPUT_PORT_DIMENSION_INFO
/* Function: mdlSetInputPortDimensionInfo ====================================
* Abstract:
* This routine is called with the candidate dimensions for an input port
* with unknown dimensions. If the proposed dimensions are acceptable, the
* routine should go ahead and set the actual port dimensions.
* If they are unacceptable an error should be generated via
* ssSetErrorStatus.
* Note that any other input or output ports whose dimensions are
* implicitly defined by virtue of knowing the dimensions of the given port
* can also have their dimensions set.
*/
static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo)
{
/* Set input port dimension */
if (!ssSetInputPortDimensionInfo(S, port, dimsInfo)) return;
/* printf("mdlSetInputPortDimensionInfo Status: port(%d) status(%d)\n",port,status); */
} /* end mdlSetInputPortDimensionInfo */
# define MDL_SET_OUTPUT_PORT_DIMENSION_INFO
/* Function: mdlSetOutputPortDimensionInfo ===================================
* Abstract:
* This routine is called with the candidate dimensions for an output port
* with unknown dimensions. If the proposed dimensions are acceptable, the
* routine should go ahead and set the actual port dimensions.
* If they are unacceptable an error should be generated via
* ssSetErrorStatus.
* Note that any other input or output ports whose dimensions are
* implicitly defined by virtue of knowing the dimensions of the given
* port can also have their dimensions set.
*/
static void mdlSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo)
{
if (!ssSetOutputPortDimensionInfo(S, port, dimsInfo)) return;
/* printf("mdlSetOutputPortDimensionInfo Status: port(%d) status(%d)\n",port,status); */
} /* end mdlSetOutputPortDimensionInfo */
# define MDL_SET_DEFAULT_PORT_DIMENSION_INFO
/* Function: mdlSetDefaultPortDimensionInfo ====================================
* This routine is called when Simulink is not able to find dimension
* candidates for ports with unknown dimensions. This function must set the
* dimensions of all ports with unknown dimensions.
*/
static void mdlSetDefaultPortDimensionInfo(SimStruct *S)
{
/* Set input port default dimension */
int_T TOTALPORTNUMBER = 9;
int_T i;
for (i=0; i<TOTALPORTNUMBER; i++) {
if (ssGetInputPortWidth(S, i) == DYNAMICALLY_SIZED) {
if(!ssSetInputPortVectorDimension(S, i, 1)) return;
}
}
} /* end mdlSetDefaultPortDimensionInfo */
#endif /* end of MATLAB_MEX_FILE */
/* Statements Required at the Bottom of S-Functions */
#ifdef MATLAB_MEX_FILE
#include "simulink.c"
#else
#include "cg_sfun.h"
#endif
<file_sep>/* mpc_sfun.h: MPC Simulink/RTW S-Function - Macros */
/*
Author: <NAME>
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.17 $ $Date: 2009/08/08 01:11:24 $
*/
/* Debug messages */
/*
#ifndef DEBUG
#define DEBUG
#endif
*/
/* Standard prologue */
#include <stdlib.h>
#include <math.h>
#include "simstruc.h"
#include "mat_macros.h"
/* Special definition for IsNaN and IsInf */
#define FIEEE_LE 0
#define FIEEE_BE 1
#ifndef CPU_NUM_FORMAT
#if defined(_M_IX86) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__)
#define CPU_NUM_FORMAT FIEEE_LE
#else
#define CPU_NUM_FORMAT FIEEE_BE
#endif /* if defined */
#endif /* if ndef CPU */
#if CPU_NUM_FORMAT==FIEEE_LE
/* Little-endian */
typedef union
{
double value;
struct { uint32_T lw;
uint32_T hw;
} words;
} ieee_double_T;
#elif CPU_NUM_FORMAT==FIEEE_BE
/* Big-endian */
typedef union
{
double value;
struct { uint32_T hw;
uint32_T lw;
} words;
} ieee_double_T;
#endif
/* We are being built using RTW */
#ifdef RT
/* avoid debug messages */
#ifdef DEBUG
#undef DEBUG
#endif
#endif
/* Parameter access macros */
/* Model parameters - Generated by the mpcinit.m initialization routine
Expected to be initialized and stored in the workspace at compile time
The number associated with ssGetSFcnParam corresponds to the order of
the input arguments in MPCLIB.MDL/MPCSFUN. To edit the parameters:
1)Edit MPCLIB.MDL in M-Editor and make sure the list of parameters is
consistent with the above list.
2)Edit MPC_GET_PARAM_SIM.M
*/
/* Model/observer-related parameters */
#define p_Ts(S) ssGetSFcnParam(S,0)
#define p_A(S) ssGetSFcnParam(S,1)
#define p_Cm(S) ssGetSFcnParam(S,2)
#define p_Dvm(S) ssGetSFcnParam(S,3)
#define p_Bu(S) ssGetSFcnParam(S,4)
#define p_Bv(S) ssGetSFcnParam(S,5)
#define p_nu(S) ssGetSFcnParam(S,7)
#define p_nv(S) ssGetSFcnParam(S,8) /* total number of MDs, including the one due to offsets */
#define p_nym(S) ssGetSFcnParam(S,9)
#define p_ny(S) ssGetSFcnParam(S,10)
#define p_nx(S) ssGetSFcnParam(S,11)
#define p_uoff(S) ssGetSFcnParam(S,36)
#define p_yoff(S) ssGetSFcnParam(S,37)
#define p_voff(S) ssGetSFcnParam(S,38)
#define p_myoff(S) ssGetSFcnParam(S,39)
#define p_lastx(S) ssGetSFcnParam(S,31)
#define p_lastu(S) ssGetSFcnParam(S,32)
/* Optimization-related parameters */
#define p_PTYPE(S) ssGetSFcnParam(S,6)
#define p_degrees(S) ssGetSFcnParam(S,12)
#define p_M(S) ssGetSFcnParam(S,13)
#define p_MuKduINV(S) ssGetSFcnParam(S,14)
#define p_KduINV(S) ssGetSFcnParam(S,15)
#define p_Kx(S) ssGetSFcnParam(S,16)
#define p_Ku1(S) ssGetSFcnParam(S,17)
#define p_Kut(S) ssGetSFcnParam(S,18)
#define p_Kr(S) ssGetSFcnParam(S,19)
#define p_Kv(S) ssGetSFcnParam(S,20)
#define p_zmin(S) ssGetSFcnParam(S,21)
#define p_rhsc0(S) ssGetSFcnParam(S,22)
#define p_Mlim(S) ssGetSFcnParam(S,23)
#define p_Mx(S) ssGetSFcnParam(S,24)
#define p_Mu1(S) ssGetSFcnParam(S,25)
#define p_Mv(S) ssGetSFcnParam(S,26)
#define p_rhsa0(S) ssGetSFcnParam(S,27)
#define p_TAB(S) ssGetSFcnParam(S,28)
#define p_optimalseq(S) ssGetSFcnParam(S,29)
#define p_utarget(S) ssGetSFcnParam(S,30)
#define p_p(S) ssGetSFcnParam(S,33)
#define p_Jm(S) ssGetSFcnParam(S,34)
#define p_DUFree(S) ssGetSFcnParam(S,35)
#define p_maxiter(S) ssGetSFcnParam(S,48)
#define p_nxQP(S) ssGetSFcnParam(S,49)
#define p_wtab(S) ssGetSFcnParam(S,55)
/* Parameters related to MD and REFs */
#define p_no_md(S) ssGetSFcnParam(S,40)
#define p_no_ref(S) ssGetSFcnParam(S,41)
#define p_ref_from_ws(S) ssGetSFcnParam(S,42)
#define p_ref_signal(S) ssGetSFcnParam(S,43)
#define p_ref_preview(S) ssGetSFcnParam(S,44)
#define p_md_from_ws(S) ssGetSFcnParam(S,45)
#define p_md_signal(S) ssGetSFcnParam(S,46)
#define p_md_preview(S) ssGetSFcnParam(S,47)
/* Block-related paramteres */
#define p_openloopflag(S) ssGetSFcnParam(S,50) /* jgo */
#define p_md_inport(S) ssGetSFcnParam(S,51)
#define p_no_ym(S) ssGetSFcnParam(S,52)
#define p_mv_inport(S) ssGetSFcnParam(S,53)
#define p_no_mv(S) ssGetSFcnParam(S,54)
#define p_lims_inport(S) ssGetSFcnParam(S,56)
#define p_no_umin(S) ssGetSFcnParam(S,57)
#define p_no_umax(S) ssGetSFcnParam(S,58)
#define p_no_ymin(S) ssGetSFcnParam(S,59)
#define p_no_ymax(S) ssGetSFcnParam(S,60)
#define p_switch_inport(S) ssGetSFcnParam(S,61)
#define p_no_switch(S) ssGetSFcnParam(S,62)
#define p_enable_value(S) ssGetSFcnParam(S,63)
#define p_is_multiple(S) ssGetSFcnParam(S,64)
#define NPARAMS 65 /* Total number of parameters */
#define CONSTR_TOL 1.0e-5 /* tolerance for time-varying I/O constraints. There's always
* at least CONSTR_TOL betwen umin and umax, ymin and ymax */
/* Work variables and state access macros */
#define w_lastx 0
#define w_lastu 1
#define w_v 2
#define w_optimalseq 3
#define w_lastt 4 /* Time-step counter is needed for previewing signals, also needed for recognizing initialization phase in MdlOutputs*/
#define w_r 5 /* buffer */
#define w_ytilde 6 /* buffer */
#define w_vKv 7 /* buffer */
#define w_Mvv 8 /* buffer */
#define w_zopt1 9 /* buffer */
#define w_zopt2 10 /* buffer */
#define w_zopt3 11 /* buffer */
#define w_zopx 12 /* buffer */
#define w_ztemp 13 /* buffer */
#define w_rhsa 14 /* buffer */
#define w_rhsc 15 /* buffer */
#define w_basis 16 /* buffer */
#define w_duold 17 /* buffer */
#define w_ib 18 /* buffer */
#define w_il 19 /* buffer */
#define w_umin 20 /* buffer */
#define w_umax 21 /* buffer */
#define w_ymin 22 /* buffer */
#define w_ymax 23 /* buffer */
#define w_xk 24 /* buffer */
#define w_tab 25 /* buffer */
#define w_lastx_buf 26 /* buffer */
#define w_lastu_buf 27 /* buffer */
#define NPWORK 28
/* Misc Constants */
#define SOFTCONSTR 0 /* Optimization types */
#define HARDCONSTR 1
#define UNCONSTR 2
/* Parameter error message */
#define param_MSG "Parameter number mismatch"
/* IsInf in ANSI C */
boolean_T utIsInf(double a)
{ /* Begin utIsInf */
ieee_double_T tem;
tem.value = a;
return (boolean_T) (((tem.words.hw & 0x7fffffff) == 0x7ff00000) &&\
( tem.words.lw == 0));
}/* End utIsInf */
/* IsNaN in ANSI C */
boolean_T utIsNaN(double a)
{
return (a != a);
}
<file_sep>/* mpcloop_engine.h: MPC Simulink/RTW S-Function - Macros */
/*
Author: <NAME>
Revised by: <NAME>
Copyright 1986-2008 The MathWorks, Inc.
$Revision: 1.1.10.12 $ $Date: 2009/08/08 01:11:26 $
*/
/* Debug messages */
/*
#ifndef DEBUG
#define DEBUG
#endif
*/
/* Standard prologue */
#include <stdlib.h>
#include <math.h>
#include "string.h" /*R.C. added for memcpy function*/
#include "matrix.h"
#include "mat_macros.h"
#include "mex.h" /* In a MEX-file, to use mexPrintf instead of printf. */
/* Input arguments to MEX function */
#define MPCstruct_IN prhs[0]
/* Output Arguments to MEX function */
#define U_OUT plhs[0]
#define Y_OUT plhs[1]
#define XP_OUT plhs[2]
#define XMPC_OUT plhs[3]
/* Parameter access macros */
/* Model parameters - Generated by the mpcloop.m initialization routine */
#define p_Ts(S) mxGetField(S,0,"ts")
#define p_A(S) mxGetField(S,0,"A")
#define p_Cm(S) mxGetField(S,0,"Cm")
#define p_Dvm(S) mxGetField(S,0,"Dvm")
#define p_Bu(S) mxGetField(S,0,"Bu")
#define p_Bv(S) mxGetField(S,0,"Bv")
#define p_PTYPE(S) mxGetField(S,0,"PTYPE")
#define p_nu(S) mxGetField(S,0,"nu")
#define p_nv(S) mxGetField(S,0,"nv") /* total number of MDs, including the one due to offsets */
#define p_nym(S) mxGetField(S,0,"nym")
#define p_ny(S) mxGetField(S,0,"ny")
#define p_nx(S) mxGetField(S,0,"nx")
#define p_degrees(S) mxGetField(S,0,"degrees")
#define p_M(S) mxGetField(S,0,"M")
#define p_MuKduINV(S) mxGetField(S,0,"MuKduINV")
#define p_KduINV(S) mxGetField(S,0,"KduINV")
#define p_Kx(S) mxGetField(S,0,"Kx")
#define p_Ku1(S) mxGetField(S,0,"Ku1")
#define p_Kut(S) mxGetField(S,0,"Kut")
#define p_Kr(S) mxGetField(S,0,"Kr")
#define p_Kv(S) mxGetField(S,0,"Kv")
#define p_zmin(S) mxGetField(S,0,"zmin")
#define p_rhsc0(S) mxGetField(S,0,"rhsc0")
#define p_Mlim(S) mxGetField(S,0,"Mlim")
#define p_Mx(S) mxGetField(S,0,"Mx")
#define p_Mu1(S) mxGetField(S,0,"Mu1")
#define p_Mv(S) mxGetField(S,0,"Mv")
#define p_rhsa0(S) mxGetField(S,0,"rhsa0")
#define p_TAB(S) mxGetField(S,0,"TAB")
#define p_optimalseq(S) mxGetField(S,0,"optimalseq")
#define p_utarget(S) mxGetField(S,0,"utarget")
#define p_lastx(S) mxGetField(S,0,"lastx")
#define p_lastu(S) mxGetField(S,0,"lastu")
#define p_p(S) mxGetField(S,0,"p")
#define p_Jm(S) mxGetField(S,0,"Jm")
#define p_DUFree(S) mxGetField(S,0,"DUFree")
#define p_uoff(S) mxGetField(S,0,"uoff")
#define p_yoff(S) mxGetField(S,0,"yoff")
#define p_voff(S) mxGetField(S,0,"voff")
#define p_myoff(S) mxGetField(S,0,"myoff")
#define p_ref_preview(S) mxGetField(S,0,"ref_preview")
#define p_md_preview(S) mxGetField(S,0,"md_preview")
#define p_maxiter(S) mxGetField(S,0,"maxiter")
#define p_nxQP(S) mxGetField(S,0,"nxQP")
#define p_ref_signal(S) mxGetField(S,0,"ref_signal")
#define p_ref_from_ws(S) mxGetField(S,0,"ref_from_ws") /* only for compatibility with MPC S-Function */
#define p_no_ref(S) mxGetField(S,0,"no_ref") /* only for compatibility with MPC S-Function */
#define p_md_signal(S) mxGetField(S,0,"md_signal")
#define p_md_from_ws(S) mxGetField(S,0,"md_from_ws") /* only for compatibility with MPC S-Function */
#define p_no_md(S) mxGetField(S,0,"no_md") /* only for compatibility with MPC S-Function */
#define p_no_ym(S) mxGetField(S,0,"no_ym") /* only for compatibility with MPC S-Function */
#define p_Tf(S) mxGetField(S,0,"Tf")
#define p_myindex(S) mxGetField(S,0,"myindex")
#define p_xpoff(S) mxGetField(S,0,"xpoff")
#define p_dxpoff(S) mxGetField(S,0,"dxpoff")
#define p_xoff(S) mxGetField(S,0,"xoff")
#define p_Ap(S) mxGetField(S,0,"Ap")
#define p_Bup(S) mxGetField(S,0,"Bup")
#define p_Bvp(S) mxGetField(S,0,"Bvp")
#define p_Bdp(S) mxGetField(S,0,"Bdp")
#define p_Cp(S) mxGetField(S,0,"Cp")
#define p_Dvp(S) mxGetField(S,0,"Dvp")
#define p_Ddp(S) mxGetField(S,0,"Ddp")
#define p_nxp(S) mxGetField(S,0,"nxp")
#define p_xp0(S) mxGetField(S,0,"xp0")
#define p_ndp(S) mxGetField(S,0,"ndp")
#define p_ud_signal(S) mxGetField(S,0,"ud_signal")
#define p_mn_signal(S) mxGetField(S,0,"mn_signal")
#define p_un_signal(S) mxGetField(S,0,"un_signal")
#define p_ypoff(S) mxGetField(S,0,"ypoff")
#define p_upoff(S) mxGetField(S,0,"upoff")
#define p_vpoff(S) mxGetField(S,0,"vpoff")
#define p_barhandle(S) mxGetField(S,0,"barhandle")
#define p_unconstr(S) mxGetField(S,0,"unconstr")
#define p_openloop(S) mxGetField(S,0,"openloop")
#define p_mv_signal(S) mxGetField(S,0,"mv_signal")
#define p_wtab(S) mxGetField(S,0,"wtab")
<file_sep>
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML is auto-generated from an M-file.
To make changes, update the M-file and republish this document.
--><title>MPC Supervisory Control of a Two Stage Thermo-Mechanical Pulping Process</title><meta name="generator" content="MATLAB 7.10"><meta name="date" content="2010-01-05"><meta name="m-file" content="mpctmpdemo"><link rel="stylesheet" type="text/css" href="../../../matlab/demos/private/style.css"></head><body><div class="header"><div class="left"><a href="matlab:edit mpctmpdemo">Open mpctmpdemo.m in the Editor</a></div><div class="right"><a href="matlab:echodemo mpctmpdemo">Run in the Command Window</a></div></div><div class="content"><h1>MPC Supervisory Control of a Two Stage Thermo-Mechanical Pulping Process</h1><!--introduction--><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Plant Description</a></li><li><a href="#3">Modeling of the TMP Plant in Simulink®</a></li><li><a href="#7">Tuning the Controller Using the MPC GUI</a></li><li><a href="#8">Simulating the Design in Simulink®</a></li></ul></div><p>This demo illustrates control of a thermo-mechanical pulping (TMP) application using MPC.</p><h2>Plant Description<a name="2"></a></h2><p>The following diagram shows a typical process arrangement for a two stage TMP operation. Two pressured refiners operate in sequence to produce a mechanical pulp suitable for making newsprint.</p><p>A primary objective of controlling the TMP plant is to regulate the energy applied to the pulp by the electric motors which drive each refiner to derive pulp with good physical properties without incurring excess energy costs.</p><p>A secondary control objective is to regulate the ratio of dry mass flow rate to overall mass flow rate (known as consistency) measured at the outlet of each refiner.</p><p>In practice these objectives amount to regulating the primary and secondary refiner motor loads and the primary and secondary refiner constancies subject to the following output constraints:</p><p>(1) Power on each refiner must be less than maximum rated values rated.</p><p>(2) Maintain the vibration level on the two refiners below a critical level defined to prevent refiner plate clash.</p><p>(3) Limits on measured consistency to prevent blow line plugging and fiber damage.</p><p>Manipulated variables comprise:</p><div><ul><li>set points to the two gap controllers regulating the distance between the refiner plates</li><li>the dilution flow rates to the two refiners</li><li>the rpm of the screw feeder</li></ul></div><p>Physical limits are also imposed on each of these inputs.</p><p><img vspace="5" hspace="5" src="tmpplant.jpg" alt=""> </p><h2>Modeling of the TMP Plant in Simulink®<a name="3"></a></h2><pre class="codeinput"><span class="keyword">if</span> ~mpcchecktoolboxinstalled(<span class="string">'simulink'</span>)
disp(<span class="string">'Simulink(R) is required to run this demo.'</span>)
<span class="keyword">return</span>
<span class="keyword">end</span>
</pre><p>The following Simulink® model represents a TMP plant and an MPC Controller designed for the control objectives described above. The model can be opened with:</p><pre class="codeinput">open_system(<span class="string">'TMPdemo'</span>)
</pre><img vspace="5" hspace="5" src="mpctmpdemo_01.png" alt=""> <p>The MPC controller is represented by an MPC object in the workspace. It can be viewed at the command line as follows:</p><pre class="codeinput">load <span class="string">MPCtmpdemo</span>;
MPC1
</pre><pre class="codeoutput">
MPC object (created on 30-Mar-2004 17:20:31):
---------------------------------------------
Sampling time: 0.5Prediction Horizon: 20Control Horizon: 5
Model:
Plant: [6x5 ss]
Noise: [6x6 ss]
Nominal: [1x1 struct]
Disturbance: []
Output disturbance model: user specified (type "getoutdist(MPC1)" for details)
Details on Plant model:
--------------
5 manipulated variables -->| 7 states |
| |--> 6 measured outputs
0 measured disturbances -->| 5 inputs |
| |--> 0 unmeasured outputs
0 unmeasured disturbances -->| 6 outputs |
--------------
Weights:
ManipulatedVariables: [0 0 0 0 0]
ManipulatedVariablesRate: [0.1000 10 0.1000 10 0.1000]
OutputVariables: [0 10 0 1 10 1]
ECR: 1000000
Constraints:
0 <= Feed rpm (rpm) <= 35, -10 <= Feed rpm/rate (rpm) <= Inf, -Inf <= Pri. vibration <= 1
0 <= Pri. gap set point <= 1, -10 <= Pri. gap set point/rate <= Inf, -Inf <= Pri. consistency <= 0.45
70 <= Pri. dil. flow set point (gpm) <= 250, -10 <= Pri. dil. flow set point/rate (gpm) <= Inf, -Inf <= Sec. vibration <= 1
............... ............... ...............
70 <= Sec. dil flow set point (gpm) <= 250, -10 <= Sec. dil flow set point/rate (gpm) <= Inf, -Inf <= Sec. motor load (MW) <= 9
</pre><p>The controller was built by obtaining a linear plant model from the non-linear TMP Simulink® model using the MPC GUI (accessible from the "Design..." button on the MPC Controller mask) and then tuning the MPC controller from within the MPC GUI.</p><h2>Tuning the Controller Using the MPC GUI<a name="7"></a></h2><p>The controller design parameters can be viewed by opening the MPC GUI from the MPC mask then hitting the "Design..." button. The following window will open:</p><p><img vspace="5" hspace="5" src="mpcgui1.jpg" alt=""> </p><p>Controller weights can be viewed by selecting the controller node representing MPC1 and then selecting the "Weights" tab:</p><p><img vspace="5" hspace="5" src="mpcgui2.jpg" alt=""> </p><p>The effect of design changes can be observed in the GUI by clicking on the "Scenarios" node to create a new Simulation scenario. The following shows the setup for Simulating a setpoint change on the primary refiner motor load from 8 to 9 MW without model mismatch. The results are displayed in separate figure windows:</p><p><img vspace="5" hspace="5" src="mpcgui3.jpg" alt=""> </p><p><img vspace="5" hspace="5" src="idealIn.png" alt=""> </p><p><img vspace="5" hspace="5" src="idealOut.png" alt=""> </p><h2>Simulating the Design in Simulink®<a name="8"></a></h2><p>The controller can be tested on the non-linear plant by running the simulation in Simulink®. Any design changes made in the MPC GUI will automatically be tracked by the MPC mask, so there is no need to export the design back to the workspace. The output of the 3 scopes show the response to an initial set point of:</p><div><ul><li>Primary consistency 0.4</li><li>Primary motor load 8.5 MW</li><li>secondary consistency 0.3</li><li>secondary motor load of 6 MW</li></ul></div><p><img vspace="5" hspace="5" src="mpctmpscopes.jpg" alt=""> </p><pre class="codeinput">bdclose(<span class="string">'tmpdemo'</span>)
</pre><p class="footer">Copyright 2004-2009 The MathWorks, Inc.<br>
Published with MATLAB® 7.10</p><p class="footer" id="trademarks">MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Please see <a href="http://www.mathworks.com/trademarks">www.mathworks.com/trademarks</a> for a list of other trademarks owned by The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective owners.</p></div><!--
##### SOURCE BEGIN #####
%% MPC Supervisory Control of a Two Stage Thermo-Mechanical Pulping Process
%%
% This demo illustrates control of a thermo-mechanical pulping (TMP)
% application using MPC.
%
% Copyright 2004-2009 The MathWorks, Inc.
% $Revision: 1.1.4.10 $ $Date: 2009/09/21 00:04:32 $
%% Plant Description
% The following diagram shows a typical process arrangement for a two
% stage TMP operation. Two pressured refiners operate in sequence to
% produce a mechanical pulp suitable for making newsprint.
%
% A primary objective of controlling the TMP plant is to regulate the
% energy applied to the pulp by the electric motors which drive each
% refiner to derive pulp with good physical properties without incurring
% excess energy costs.
%
% A secondary control objective is to regulate the ratio of dry mass flow
% rate to overall mass flow rate (known as consistency) measured at the
% outlet of each refiner.
%
% In practice these objectives amount to regulating the primary and
% secondary refiner motor loads and the primary and secondary refiner
% constancies subject to the following output constraints:
%
% (1) Power on each refiner must be less than maximum rated values rated.
%
% (2) Maintain the vibration level on the two refiners below a critical
% level defined to prevent refiner plate clash.
%
% (3) Limits on measured consistency to prevent blow line plugging and
% fiber damage.
%
% Manipulated variables comprise:
%
% * set points to the two gap controllers regulating the distance between the refiner plates
% * the dilution flow rates to the two refiners
% * the rpm of the screw feeder
%
% Physical limits are also imposed on each of these inputs.
%
% <<tmpplant.jpg>>
%
%% Modeling of the TMP Plant in Simulink(R)
if ~mpcchecktoolboxinstalled('simulink')
disp('Simulink(R) is required to run this demo.')
return
end
%%
% The following Simulink(R) model represents a TMP plant and an MPC Controller
% designed for the control objectives described above. The model can be
% opened with:
open_system('TMPdemo')
%%
% The MPC controller is represented by an MPC object in the workspace. It
% can be viewed at the command line as follows:
load MPCtmpdemo;
MPC1
%%
% The controller was built by obtaining a linear plant model
% from the non-linear TMP Simulink(R) model using the MPC GUI (accessible from
% the "Design..." button on the MPC Controller mask) and then tuning the
% MPC controller from within the MPC GUI.
%% Tuning the Controller Using the MPC GUI
% The controller design parameters can be viewed by opening the MPC GUI
% from the MPC mask then hitting the "Design..." button. The following window
% will open:
%
% <<mpcgui1.jpg>>
%
% Controller weights can be viewed by selecting the controller node representing
% MPC1 and then selecting the "Weights" tab:
%
% <<mpcgui2.jpg>>
%
% The effect of design changes can be observed in the GUI by clicking on the
% "Scenarios" node to create a new Simulation scenario. The following shows
% the setup for Simulating a setpoint change on the primary refiner motor
% load from 8 to 9 MW without model mismatch. The results are displayed in
% separate figure windows:
%
% <<mpcgui3.jpg>>
%
% <<idealIn.png>>
%
% <<idealOut.png>>
%
%% Simulating the Design in Simulink(R)
% The controller can be tested on the non-linear plant by running the
% simulation in Simulink(R). Any design changes made in the MPC GUI will
% automatically be tracked by the MPC mask, so there is no need to export
% the design back to the workspace. The output of the 3 scopes show
% the response to an initial set point of:
%
% * Primary consistency 0.4
% * Primary motor load 8.5 MW
% * secondary consistency 0.3
% * secondary motor load of 6 MW
%
% <<mpctmpscopes.jpg>>
%
%%
bdclose('tmpdemo')
displayEndOfDemoMessage(mfilename)
##### SOURCE END #####
--></body></html><file_sep>/* Include files */
#include "blascompat32.h"
#include "MPC_gamecontroller_LiDAR_sfun.h"
#include "c2_MPC_gamecontroller_LiDAR.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "MPC_gamecontroller_LiDAR_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c2_debug_family_names[16] = { "Index", "n", "velocity",
"Phi_d", "Phi", "Psi_d", "Psi", "Vy", "Vx", "nargin", "nargout", "roll",
"wheel_speeds", "yaw", "RRT_state", "MPC_state" };
/* Function Declarations */
static void initialize_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void initialize_params_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void enable_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void disable_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void set_sim_state_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance, const mxArray
*c2_st);
static void finalize_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void sf_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void c2_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber);
static const mxArray *c2_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_b_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_c_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_d_sf_marshall(void *chartInstanceVoid, void *c2_u);
static const mxArray *c2_e_sf_marshall(void *chartInstanceVoid, real_T
c2_u_data[4], int32_T c2_u_sizes[1]);
static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[33]);
static const mxArray *c2_f_sf_marshall(void *chartInstanceVoid, void *c2_u);
static void c2_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c2_MPC_state, const char_T *c2_name, real_T
c2_y[6]);
static void c2_b_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c2_RRT_state, const char_T *c2_name, real_T
c2_y[4]);
static uint8_T c2_c_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c2_b_is_active_c2_MPC_gamecontroller_LiDAR,
const char_T *c2_name);
static void init_dsm_address_info(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c2_is_active_c2_MPC_gamecontroller_LiDAR = 0U;
}
static void initialize_params_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static void enable_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c2_update_debugger_state_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
const mxArray *c2_st = NULL;
const mxArray *c2_y = NULL;
int32_T c2_i0;
real_T c2_hoistedGlobal[6];
int32_T c2_i1;
real_T c2_u[6];
const mxArray *c2_b_y = NULL;
int32_T c2_i2;
real_T c2_b_hoistedGlobal[4];
int32_T c2_i3;
real_T c2_b_u[4];
const mxArray *c2_c_y = NULL;
uint8_T c2_c_hoistedGlobal;
uint8_T c2_c_u;
const mxArray *c2_d_y = NULL;
real_T (*c2_RRT_state)[4];
real_T (*c2_MPC_state)[6];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
c2_st = NULL;
c2_y = NULL;
sf_mex_assign(&c2_y, sf_mex_createcellarray(3));
for (c2_i0 = 0; c2_i0 < 6; c2_i0 = c2_i0 + 1) {
c2_hoistedGlobal[c2_i0] = (*c2_MPC_state)[c2_i0];
}
for (c2_i1 = 0; c2_i1 < 6; c2_i1 = c2_i1 + 1) {
c2_u[c2_i1] = c2_hoistedGlobal[c2_i1];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_u, 0, 0U, 1U, 0U, 1, 6));
sf_mex_setcell(c2_y, 0, c2_b_y);
for (c2_i2 = 0; c2_i2 < 4; c2_i2 = c2_i2 + 1) {
c2_b_hoistedGlobal[c2_i2] = (*c2_RRT_state)[c2_i2];
}
for (c2_i3 = 0; c2_i3 < 4; c2_i3 = c2_i3 + 1) {
c2_b_u[c2_i3] = c2_b_hoistedGlobal[c2_i3];
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", c2_b_u, 0, 0U, 1U, 0U, 1, 4));
sf_mex_setcell(c2_y, 1, c2_c_y);
c2_c_hoistedGlobal = chartInstance->c2_is_active_c2_MPC_gamecontroller_LiDAR;
c2_c_u = c2_c_hoistedGlobal;
c2_d_y = NULL;
sf_mex_assign(&c2_d_y, sf_mex_create("y", &c2_c_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c2_y, 2, c2_d_y);
sf_mex_assign(&c2_st, c2_y);
return c2_st;
}
static void set_sim_state_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance, const mxArray *
c2_st)
{
const mxArray *c2_u;
real_T c2_dv0[6];
int32_T c2_i4;
real_T c2_dv1[4];
int32_T c2_i5;
real_T (*c2_MPC_state)[6];
real_T (*c2_RRT_state)[4];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c2_doneDoubleBufferReInit = TRUE;
c2_u = sf_mex_dup(c2_st);
c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 0)),
"MPC_state", c2_dv0);
for (c2_i4 = 0; c2_i4 < 6; c2_i4 = c2_i4 + 1) {
(*c2_MPC_state)[c2_i4] = c2_dv0[c2_i4];
}
c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 1)),
"RRT_state", c2_dv1);
for (c2_i5 = 0; c2_i5 < 4; c2_i5 = c2_i5 + 1) {
(*c2_RRT_state)[c2_i5] = c2_dv1[c2_i5];
}
chartInstance->c2_is_active_c2_MPC_gamecontroller_LiDAR =
c2_c_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 2)),
"is_active_c2_MPC_gamecontroller_LiDAR");
sf_mex_destroy(&c2_u);
c2_update_debugger_state_c2_MPC_gamecontroller_LiDAR(chartInstance);
sf_mex_destroy(&c2_st);
}
static void finalize_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static void sf_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
int32_T c2_i6;
int32_T c2_i7;
int32_T c2_i8;
int32_T c2_i9;
int32_T c2_i10;
int32_T c2_previousEvent;
real_T (*c2_MPC_state)[6];
real_T (*c2_RRT_state)[4];
real_T (*c2_yaw)[2];
real_T (*c2_wheel_speeds)[4];
real_T (*c2_roll)[2];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
c2_yaw = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
c2_wheel_speeds = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 1);
c2_roll = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1);
for (c2_i6 = 0; c2_i6 < 2; c2_i6 = c2_i6 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_roll)[c2_i6], 0U);
}
for (c2_i7 = 0; c2_i7 < 4; c2_i7 = c2_i7 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_wheel_speeds)[c2_i7], 1U);
}
for (c2_i8 = 0; c2_i8 < 2; c2_i8 = c2_i8 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_yaw)[c2_i8], 2U);
}
for (c2_i9 = 0; c2_i9 < 4; c2_i9 = c2_i9 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_RRT_state)[c2_i9], 3U);
}
for (c2_i10 = 0; c2_i10 < 6; c2_i10 = c2_i10 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_MPC_state)[c2_i10], 4U);
}
c2_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
c2_c2_MPC_gamecontroller_LiDAR(chartInstance);
_sfEvent_ = c2_previousEvent;
sf_debug_check_for_state_inconsistency(_MPC_gamecontroller_LiDARMachineNumber_,
chartInstance->chartNumber, chartInstance->
instanceNumber);
}
static void c2_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
int32_T c2_i11;
real_T c2_hoistedGlobal[2];
int32_T c2_i12;
real_T c2_b_hoistedGlobal[4];
int32_T c2_i13;
real_T c2_c_hoistedGlobal[2];
int32_T c2_i14;
real_T c2_roll[2];
int32_T c2_i15;
real_T c2_wheel_speeds[4];
int32_T c2_i16;
real_T c2_yaw[2];
uint32_T c2_debug_family_var_map[16];
static const char *c2_sv0[16] = { "Index", "n", "velocity", "Phi_d", "Phi",
"Psi_d", "Psi", "Vy", "Vx", "nargin", "nargout", "roll"
, "wheel_speeds", "yaw", "RRT_state", "MPC_state" };
int32_T c2_Index_sizes;
real_T c2_Index_data[4];
real_T c2_n;
real_T c2_velocity;
real_T c2_Phi_d;
real_T c2_Phi;
real_T c2_Psi_d;
real_T c2_Psi;
real_T c2_Vy;
real_T c2_Vx;
real_T c2_nargin = 3.0;
real_T c2_nargout = 2.0;
real_T c2_RRT_state[4];
real_T c2_MPC_state[6];
int32_T c2_i17;
boolean_T c2_x[4];
real_T c2_idx;
static int32_T c2_iv0[1] = { 4 };
real_T c2_ii;
real_T c2_b_ii;
boolean_T c2_b0;
boolean_T c2_b1;
boolean_T c2_b2;
int32_T c2_i18;
int32_T c2_tmp_sizes;
int32_T c2_loop_ub;
int32_T c2_i19;
int32_T c2_tmp_data[4];
int32_T c2_b_tmp_sizes[2];
int32_T c2_iv1[2];
int32_T c2_i20;
int32_T c2_i21;
int32_T c2_b_loop_ub;
int32_T c2_i22;
int32_T c2_b_tmp_data[4];
int32_T c2_c_tmp_sizes[2];
int32_T c2_i23;
int32_T c2_i24;
int32_T c2_c_loop_ub;
int32_T c2_i25;
real_T c2_c_tmp_data[4];
int32_T c2_d_loop_ub;
int32_T c2_i26;
int32_T c2_x_sizes;
int32_T c2_e_loop_ub;
int32_T c2_i27;
real_T c2_x_data[4];
real_T c2_s[2];
real_T c2_f_loop_ub;
real_T c2_k;
real_T c2_b_k;
real_T c2_b_n;
real_T c2_A;
real_T c2_b_x;
real_T c2_c_x;
real_T c2_d_x;
real_T c2_a;
real_T c2_y;
real_T c2_b_y[6];
int32_T c2_i28;
real_T c2_dv2[4];
int32_T c2_i29;
int32_T c2_i30;
int32_T c2_i31;
real_T (*c2_b_RRT_state)[4];
real_T (*c2_b_MPC_state)[6];
real_T (*c2_b_yaw)[2];
real_T (*c2_b_wheel_speeds)[4];
real_T (*c2_b_roll)[2];
c2_b_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S, 2);
c2_b_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
c2_b_yaw = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
c2_b_wheel_speeds = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 1);
c2_b_roll = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1);
for (c2_i11 = 0; c2_i11 < 2; c2_i11 = c2_i11 + 1) {
c2_hoistedGlobal[c2_i11] = (*c2_b_roll)[c2_i11];
}
for (c2_i12 = 0; c2_i12 < 4; c2_i12 = c2_i12 + 1) {
c2_b_hoistedGlobal[c2_i12] = (*c2_b_wheel_speeds)[c2_i12];
}
for (c2_i13 = 0; c2_i13 < 2; c2_i13 = c2_i13 + 1) {
c2_c_hoistedGlobal[c2_i13] = (*c2_b_yaw)[c2_i13];
}
for (c2_i14 = 0; c2_i14 < 2; c2_i14 = c2_i14 + 1) {
c2_roll[c2_i14] = c2_hoistedGlobal[c2_i14];
}
for (c2_i15 = 0; c2_i15 < 4; c2_i15 = c2_i15 + 1) {
c2_wheel_speeds[c2_i15] = c2_b_hoistedGlobal[c2_i15];
}
for (c2_i16 = 0; c2_i16 < 2; c2_i16 = c2_i16 + 1) {
c2_yaw[c2_i16] = c2_c_hoistedGlobal[c2_i16];
}
sf_debug_symbol_scope_push_eml(0U, 16U, 16U, c2_sv0, c2_debug_family_var_map);
sf_debug_symbol_scope_add_eml_dyn(c2_Index_data, (const int32_T *)
&c2_Index_sizes, NULL, 0, (void *)c2_e_sf_marshall, 0);
sf_debug_symbol_scope_add_eml(&c2_n, c2_d_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c2_velocity, c2_d_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c2_Phi_d, c2_d_sf_marshall, 3U);
sf_debug_symbol_scope_add_eml(&c2_Phi, c2_d_sf_marshall, 4U);
sf_debug_symbol_scope_add_eml(&c2_Psi_d, c2_d_sf_marshall, 5U);
sf_debug_symbol_scope_add_eml(&c2_Psi, c2_d_sf_marshall, 6U);
sf_debug_symbol_scope_add_eml(&c2_Vy, c2_d_sf_marshall, 7U);
sf_debug_symbol_scope_add_eml(&c2_Vx, c2_d_sf_marshall, 8U);
sf_debug_symbol_scope_add_eml(&c2_nargin, c2_d_sf_marshall, 9U);
sf_debug_symbol_scope_add_eml(&c2_nargout, c2_d_sf_marshall, 10U);
sf_debug_symbol_scope_add_eml(c2_roll, c2_c_sf_marshall, 11U);
sf_debug_symbol_scope_add_eml(c2_wheel_speeds, c2_b_sf_marshall, 12U);
sf_debug_symbol_scope_add_eml(c2_yaw, c2_c_sf_marshall, 13U);
sf_debug_symbol_scope_add_eml(c2_RRT_state, c2_b_sf_marshall, 14U);
sf_debug_symbol_scope_add_eml(c2_MPC_state, c2_sf_marshall, 15U);
CV_EML_FCN(0, 0);
/* Updated: May 5th, 2013 */
/* This function takes the scaled data from the IMU and uses it to determine */
/* the vehicle states for the RRT and the MPC. Note that the state of the */
/* vehicle is always [0 0 Yaw V] as the coordinate system is bases on the */
/* postion of the vehicle. */
/* DATA SORTING */
/* Calculate the vehicle velocity from the wheel encoder data. this should */
/* be replaced with a more robust method as this neglects the fact that the */
/* vechicle may be turning as well as wheel slip */
_SFD_EML_CALL(0, 14);
for (c2_i17 = 0; c2_i17 < 4; c2_i17 = c2_i17 + 1) {
c2_x[c2_i17] = (c2_wheel_speeds[c2_i17] > 17.0);
}
c2_idx = 0.0;
c2_Index_sizes = c2_iv0[0];
c2_ii = 1.0;
label_2:
;
if (c2_ii <= 4.0) {
c2_b_ii = c2_ii;
if (c2_x[(int32_T)c2_b_ii - 1]) {
c2_idx = c2_idx + 1.0;
c2_Index_data[(int32_T)c2_idx - 1] = c2_b_ii;
if (c2_idx >= 4.0) {
goto label_1;
}
}
} else {
goto label_1;
}
c2_ii = c2_ii + 1.0;
goto label_2;
label_1:
;
c2_b0 = (1.0 > c2_idx);
c2_b1 = c2_b0;
c2_b2 = c2_b1;
if (c2_b2) {
c2_i18 = 0;
} else {
c2_i18 = _SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)c2_idx, 1, 4, 0, 0);
}
c2_tmp_sizes = c2_i18;
c2_loop_ub = c2_i18 - 1;
for (c2_i19 = 0; c2_i19 <= c2_loop_ub; c2_i19 = c2_i19 + 1) {
c2_tmp_data[c2_i19] = 1 + c2_i19;
}
c2_b_tmp_sizes[0] = 1;
c2_iv1[0] = 1;
c2_iv1[1] = c2_tmp_sizes;
c2_b_tmp_sizes[1] = c2_iv1[1];
c2_i20 = c2_b_tmp_sizes[0];
c2_i21 = c2_b_tmp_sizes[1];
c2_b_loop_ub = c2_tmp_sizes - 1;
for (c2_i22 = 0; c2_i22 <= c2_b_loop_ub; c2_i22 = c2_i22 + 1) {
c2_b_tmp_data[c2_i22] = c2_tmp_data[c2_i22];
}
sf_debug_vector_vector_index_check(4, 1, 1, c2_b_tmp_sizes[1]);
c2_c_tmp_sizes[0] = 1;
c2_c_tmp_sizes[1] = c2_b_tmp_sizes[1];
c2_i23 = c2_c_tmp_sizes[0];
c2_i24 = c2_c_tmp_sizes[1];
c2_c_loop_ub = c2_b_tmp_sizes[0] * c2_b_tmp_sizes[1] - 1;
for (c2_i25 = 0; c2_i25 <= c2_c_loop_ub; c2_i25 = c2_i25 + 1) {
c2_c_tmp_data[c2_i25] = c2_Index_data[c2_b_tmp_data[c2_i25] - 1];
}
c2_Index_sizes = c2_c_tmp_sizes[1];
c2_d_loop_ub = c2_c_tmp_sizes[1] - 1;
for (c2_i26 = 0; c2_i26 <= c2_d_loop_ub; c2_i26 = c2_i26 + 1) {
c2_Index_data[c2_i26] = c2_c_tmp_data[c2_i26];
}
c2_n = 1.0;
c2_x_sizes = c2_Index_sizes;
c2_e_loop_ub = c2_Index_sizes - 1;
for (c2_i27 = 0; c2_i27 <= c2_e_loop_ub; c2_i27 = c2_i27 + 1) {
c2_x_data[c2_i27] = c2_Index_data[c2_i27];
}
c2_s[0] = (real_T)c2_x_sizes;
c2_s[1] = 1.0;
c2_f_loop_ub = 0.0;
c2_k = 1.0;
label_3:
;
if (c2_k <= 2.0) {
c2_b_k = c2_k;
if (c2_s[(int32_T)c2_b_k - 1] == 0.0) {
c2_f_loop_ub = 0.0;
} else {
if (c2_s[(int32_T)c2_b_k - 1] > c2_f_loop_ub) {
c2_f_loop_ub = c2_s[(int32_T)c2_b_k - 1];
}
c2_k = c2_k + 1.0;
goto label_3;
}
}
c2_b_n = 1.0;
while (c2_b_n <= c2_f_loop_ub) {
c2_n = c2_b_n;
CV_EML_FOR(0, 0, 1);
_SFD_EML_CALL(0, 16);
c2_wheel_speeds[(int32_T)c2_Index_data[_SFD_EML_ARRAY_BOUNDS_CHECK("Index",
(int32_T)c2_n, 1, c2_Index_sizes, 1, 0) - 1] - 1] = 15.0;
c2_b_n = c2_b_n + 1.0;
sf_mex_listen_for_ctrl_c(chartInstance->S);
}
CV_EML_FOR(0, 0, 0);
_SFD_EML_CALL(0, 19);
c2_A = ((c2_wheel_speeds[0] + c2_wheel_speeds[1]) + c2_wheel_speeds[2]) +
c2_wheel_speeds[3];
c2_b_x = c2_A;
c2_c_x = c2_b_x;
c2_d_x = c2_c_x;
c2_velocity = c2_d_x / 4.0;
_SFD_EML_CALL(0, 22);
c2_Phi_d = c2_roll[0];
/* Roll Rate */
_SFD_EML_CALL(0, 23);
c2_Phi = c2_roll[1];
/* Roll Angle */
_SFD_EML_CALL(0, 24);
c2_Psi_d = c2_yaw[0];
/* Yaw Rate */
_SFD_EML_CALL(0, 25);
c2_Psi = c2_yaw[1];
/* Yaw angle of the road relative to the */
/* centerline of the car */
_SFD_EML_CALL(0, 28);
c2_Vy = c2_velocity;
/* Velocity of the vehicle */
_SFD_EML_CALL(0, 30);
c2_Vx = 0.0;
/* Always 0 as the Coordinates are */
/* determined by the direction of the car */
_SFD_EML_CALL(0, 34);
c2_a = c2_Vy;
c2_y = c2_a * 0.3048780487804878;
c2_b_y[0] = c2_y;
c2_b_y[1] = 0.0;
c2_b_y[2] = c2_Phi_d;
c2_b_y[3] = c2_Phi;
c2_b_y[4] = c2_Psi_d;
c2_b_y[5] = c2_Psi;
for (c2_i28 = 0; c2_i28 < 6; c2_i28 = c2_i28 + 1) {
c2_MPC_state[c2_i28] = c2_b_y[c2_i28];
}
_SFD_EML_CALL(0, 35);
c2_dv2[0] = 0.0;
c2_dv2[1] = 0.0;
c2_dv2[2] = c2_Psi;
c2_dv2[3] = c2_velocity;
for (c2_i29 = 0; c2_i29 < 4; c2_i29 = c2_i29 + 1) {
c2_RRT_state[c2_i29] = c2_dv2[c2_i29];
}
_SFD_EML_CALL(0, -35);
sf_debug_symbol_scope_pop();
for (c2_i30 = 0; c2_i30 < 4; c2_i30 = c2_i30 + 1) {
(*c2_b_RRT_state)[c2_i30] = c2_RRT_state[c2_i30];
}
for (c2_i31 = 0; c2_i31 < 6; c2_i31 = c2_i31 + 1) {
(*c2_b_MPC_state)[c2_i31] = c2_MPC_state[c2_i31];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1);
}
static void compInitSubchartSimstructsFcn_c2_MPC_gamecontroller_LiDAR
(SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber)
{
}
static const mxArray *c2_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
int32_T c2_i32;
real_T c2_b_u[6];
int32_T c2_i33;
real_T c2_c_u[6];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
for (c2_i32 = 0; c2_i32 < 6; c2_i32 = c2_i32 + 1) {
c2_b_u[c2_i32] = (*((real_T (*)[6])c2_u))[c2_i32];
}
for (c2_i33 = 0; c2_i33 < 6; c2_i33 = c2_i33 + 1) {
c2_c_u[c2_i33] = c2_b_u[c2_i33];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 1, 6));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_b_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
int32_T c2_i34;
real_T c2_b_u[4];
int32_T c2_i35;
real_T c2_c_u[4];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
for (c2_i34 = 0; c2_i34 < 4; c2_i34 = c2_i34 + 1) {
c2_b_u[c2_i34] = (*((real_T (*)[4])c2_u))[c2_i34];
}
for (c2_i35 = 0; c2_i35 < 4; c2_i35 = c2_i35 + 1) {
c2_c_u[c2_i35] = c2_b_u[c2_i35];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 1, 4));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_c_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
int32_T c2_i36;
real_T c2_b_u[2];
int32_T c2_i37;
real_T c2_c_u[2];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
for (c2_i36 = 0; c2_i36 < 2; c2_i36 = c2_i36 + 1) {
c2_b_u[c2_i36] = (*((real_T (*)[2])c2_u))[c2_i36];
}
for (c2_i37 = 0; c2_i37 < 2; c2_i37 = c2_i37 + 1) {
c2_c_u[c2_i37] = c2_b_u[c2_i37];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 1, 2));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_d_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
real_T c2_b_u;
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
c2_b_u = *((real_T *)c2_u);
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static const mxArray *c2_e_sf_marshall(void *chartInstanceVoid, real_T
c2_u_data[4], int32_T c2_u_sizes[1])
{
const mxArray *c2_y = NULL;
int32_T c2_b_u_sizes;
int32_T c2_loop_ub;
int32_T c2_i38;
real_T c2_b_u_data[4];
int32_T c2_c_u_sizes;
int32_T c2_b_loop_ub;
int32_T c2_i39;
real_T c2_c_u_data[4];
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
c2_b_u_sizes = c2_u_sizes[0];
c2_loop_ub = c2_u_sizes[0] - 1;
for (c2_i38 = 0; c2_i38 <= c2_loop_ub; c2_i38 = c2_i38 + 1) {
c2_b_u_data[c2_i38] = c2_u_data[c2_i38];
}
c2_c_u_sizes = c2_b_u_sizes;
c2_b_loop_ub = c2_b_u_sizes - 1;
for (c2_i39 = 0; c2_i39 <= c2_b_loop_ub; c2_i39 = c2_i39 + 1) {
c2_c_u_data[c2_i39] = c2_b_u_data[c2_i39];
}
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_c_u_data, 0, 0U, 1U, 0U, 1,
c2_c_u_sizes));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
const mxArray *sf_c2_MPC_gamecontroller_LiDAR_get_eml_resolved_functions_info
(void)
{
const mxArray *c2_nameCaptureInfo = NULL;
c2_ResolvedFunctionInfo c2_info[33];
const mxArray *c2_m0 = NULL;
int32_T c2_i40;
c2_ResolvedFunctionInfo *c2_r0;
c2_nameCaptureInfo = NULL;
c2_info_helper(c2_info);
sf_mex_assign(&c2_m0, sf_mex_createstruct("nameCaptureInfo", 1, 33));
for (c2_i40 = 0; c2_i40 < 33; c2_i40 = c2_i40 + 1) {
c2_r0 = &c2_info[c2_i40];
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->context, 15,
0U, 0U, 0U, 2, 1, strlen(c2_r0->context)), "context",
"nameCaptureInfo", c2_i40);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->name, 15, 0U,
0U, 0U, 2, 1, strlen(c2_r0->name)), "name",
"nameCaptureInfo", c2_i40);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->dominantType,
15, 0U, 0U, 0U, 2, 1, strlen(c2_r0->dominantType)),
"dominantType", "nameCaptureInfo", c2_i40);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->resolved, 15,
0U, 0U, 0U, 2, 1, strlen(c2_r0->resolved)), "resolved"
, "nameCaptureInfo", c2_i40);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileLength,
7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
c2_i40);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTime1, 7,
0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c2_i40
);
sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTime2, 7,
0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c2_i40
);
}
sf_mex_assign(&c2_nameCaptureInfo, c2_m0);
return c2_nameCaptureInfo;
}
static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[33])
{
c2_info[0].context = "";
c2_info[0].name = "gt";
c2_info[0].dominantType = "double";
c2_info[0].resolved = "[B]gt";
c2_info[0].fileLength = 0U;
c2_info[0].fileTime1 = 0U;
c2_info[0].fileTime2 = 0U;
c2_info[1].context = "";
c2_info[1].name = "find";
c2_info[1].dominantType = "logical";
c2_info[1].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[1].fileLength = 7812U;
c2_info[1].fileTime1 = 1258659396U;
c2_info[1].fileTime2 = 0U;
c2_info[2].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[2].name = "nargin";
c2_info[2].dominantType = "";
c2_info[2].resolved = "[B]nargin";
c2_info[2].fileLength = 0U;
c2_info[2].fileTime1 = 0U;
c2_info[2].fileTime2 = 0U;
c2_info[3].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[3].name = "eml_scalar_eg";
c2_info[3].dominantType = "logical";
c2_info[3].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
c2_info[3].fileLength = 3068U;
c2_info[3].fileTime1 = 1240294410U;
c2_info[3].fileTime2 = 0U;
c2_info[4].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!any_enums";
c2_info[4].name = "false";
c2_info[4].dominantType = "";
c2_info[4].resolved = "[B]false";
c2_info[4].fileLength = 0U;
c2_info[4].fileTime1 = 0U;
c2_info[4].fileTime2 = 0U;
c2_info[5].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
c2_info[5].name = "isstruct";
c2_info[5].dominantType = "logical";
c2_info[5].resolved = "[B]isstruct";
c2_info[5].fileLength = 0U;
c2_info[5].fileTime1 = 0U;
c2_info[5].fileTime2 = 0U;
c2_info[6].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
c2_info[6].name = "isa";
c2_info[6].dominantType = "char";
c2_info[6].resolved = "[B]isa";
c2_info[6].fileLength = 0U;
c2_info[6].fileTime1 = 0U;
c2_info[6].fileTime2 = 0U;
c2_info[7].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
c2_info[7].name = "eq";
c2_info[7].dominantType = "double";
c2_info[7].resolved = "[B]eq";
c2_info[7].fileLength = 0U;
c2_info[7].fileTime1 = 0U;
c2_info[7].fileTime2 = 0U;
c2_info[8].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
c2_info[8].name = "class";
c2_info[8].dominantType = "logical";
c2_info[8].resolved = "[B]class";
c2_info[8].fileLength = 0U;
c2_info[8].fileTime1 = 0U;
c2_info[8].fileTime2 = 0U;
c2_info[9].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
c2_info[9].name = "cast";
c2_info[9].dominantType = "double";
c2_info[9].resolved = "[B]cast";
c2_info[9].fileLength = 0U;
c2_info[9].fileTime1 = 0U;
c2_info[9].fileTime2 = 0U;
c2_info[10].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!allreal";
c2_info[10].name = "isreal";
c2_info[10].dominantType = "logical";
c2_info[10].resolved = "[B]isreal";
c2_info[10].fileLength = 0U;
c2_info[10].fileTime1 = 0U;
c2_info[10].fileTime2 = 0U;
c2_info[11].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[11].name = "le";
c2_info[11].dominantType = "double";
c2_info[11].resolved = "[B]le";
c2_info[11].fileLength = 0U;
c2_info[11].fileTime1 = 0U;
c2_info[11].fileTime2 = 0U;
c2_info[12].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[12].name = "assert";
c2_info[12].dominantType = "logical";
c2_info[12].resolved = "[B]assert";
c2_info[12].fileLength = 0U;
c2_info[12].fileTime1 = 0U;
c2_info[12].fileTime2 = 0U;
c2_info[13].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[13].name = "true";
c2_info[13].dominantType = "";
c2_info[13].resolved = "[B]true";
c2_info[13].fileLength = 0U;
c2_info[13].fileTime1 = 0U;
c2_info[13].fileTime2 = 0U;
c2_info[14].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[14].name = "isempty";
c2_info[14].dominantType = "logical";
c2_info[14].resolved = "[B]isempty";
c2_info[14].fileLength = 0U;
c2_info[14].fileTime1 = 0U;
c2_info[14].fileTime2 = 0U;
c2_info[15].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[15].name = "isscalar";
c2_info[15].dominantType = "logical";
c2_info[15].resolved = "[B]isscalar";
c2_info[15].fileLength = 0U;
c2_info[15].fileTime1 = 0U;
c2_info[15].fileTime2 = 0U;
c2_info[16].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[16].name = "isvector";
c2_info[16].dominantType = "logical";
c2_info[16].resolved = "[B]isvector";
c2_info[16].fileLength = 0U;
c2_info[16].fileTime1 = 0U;
c2_info[16].fileTime2 = 0U;
c2_info[17].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[17].name = "size";
c2_info[17].dominantType = "double";
c2_info[17].resolved = "[B]size";
c2_info[17].fileLength = 0U;
c2_info[17].fileTime1 = 0U;
c2_info[17].fileTime2 = 0U;
c2_info[18].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[18].name = "not";
c2_info[18].dominantType = "logical";
c2_info[18].resolved = "[B]not";
c2_info[18].fileLength = 0U;
c2_info[18].fileTime1 = 0U;
c2_info[18].fileTime2 = 0U;
c2_info[19].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[19].name = "ne";
c2_info[19].dominantType = "double";
c2_info[19].resolved = "[B]ne";
c2_info[19].fileLength = 0U;
c2_info[19].fileTime1 = 0U;
c2_info[19].fileTime2 = 0U;
c2_info[20].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[20].name = "zeros";
c2_info[20].dominantType = "double";
c2_info[20].resolved = "[B]zeros";
c2_info[20].fileLength = 0U;
c2_info[20].fileTime1 = 0U;
c2_info[20].fileTime2 = 0U;
c2_info[21].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[21].name = "nargout";
c2_info[21].dominantType = "";
c2_info[21].resolved = "[B]nargout";
c2_info[21].fileLength = 0U;
c2_info[21].fileTime1 = 0U;
c2_info[21].fileTime2 = 0U;
c2_info[22].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[22].name = "islogical";
c2_info[22].dominantType = "logical";
c2_info[22].resolved = "[B]islogical";
c2_info[22].fileLength = 0U;
c2_info[22].fileTime1 = 0U;
c2_info[22].fileTime2 = 0U;
c2_info[23].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[23].name = "plus";
c2_info[23].dominantType = "double";
c2_info[23].resolved = "[B]plus";
c2_info[23].fileLength = 0U;
c2_info[23].fileTime1 = 0U;
c2_info[23].fileTime2 = 0U;
c2_info[24].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/find.m";
c2_info[24].name = "ge";
c2_info[24].dominantType = "double";
c2_info[24].resolved = "[B]ge";
c2_info[24].fileLength = 0U;
c2_info[24].fileTime1 = 0U;
c2_info[24].fileTime2 = 0U;
c2_info[25].context = "";
c2_info[25].name = "length";
c2_info[25].dominantType = "double";
c2_info[25].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/length.m";
c2_info[25].fileLength = 326U;
c2_info[25].fileTime1 = 1226609674U;
c2_info[25].fileTime2 = 0U;
c2_info[26].context = "";
c2_info[26].name = "mrdivide";
c2_info[26].dominantType = "double";
c2_info[26].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[26].fileLength = 432U;
c2_info[26].fileTime1 = 1277780622U;
c2_info[26].fileTime2 = 0U;
c2_info[27].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
c2_info[27].name = "rdivide";
c2_info[27].dominantType = "double";
c2_info[27].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
c2_info[27].fileLength = 403U;
c2_info[27].fileTime1 = 1245134820U;
c2_info[27].fileTime2 = 0U;
c2_info[28].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
c2_info[28].name = "eml_div";
c2_info[28].dominantType = "double";
c2_info[28].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
c2_info[28].fileLength = 4918U;
c2_info[28].fileTime1 = 1267095810U;
c2_info[28].fileTime2 = 0U;
c2_info[29].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
c2_info[29].name = "isinteger";
c2_info[29].dominantType = "double";
c2_info[29].resolved = "[B]isinteger";
c2_info[29].fileLength = 0U;
c2_info[29].fileTime1 = 0U;
c2_info[29].fileTime2 = 0U;
c2_info[30].context = "";
c2_info[30].name = "mtimes";
c2_info[30].dominantType = "double";
c2_info[30].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[30].fileLength = 3425U;
c2_info[30].fileTime1 = 1251064272U;
c2_info[30].fileTime2 = 0U;
c2_info[31].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
c2_info[31].name = "strcmp";
c2_info[31].dominantType = "char";
c2_info[31].resolved = "[B]strcmp";
c2_info[31].fileLength = 0U;
c2_info[31].fileTime1 = 0U;
c2_info[31].fileTime2 = 0U;
c2_info[32].context = "";
c2_info[32].name = "ctranspose";
c2_info[32].dominantType = "double";
c2_info[32].resolved = "[B]ctranspose";
c2_info[32].fileLength = 0U;
c2_info[32].fileTime1 = 0U;
c2_info[32].fileTime2 = 0U;
}
static const mxArray *c2_f_sf_marshall(void *chartInstanceVoid, void *c2_u)
{
const mxArray *c2_y = NULL;
boolean_T c2_b_u;
const mxArray *c2_b_y = NULL;
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
chartInstanceVoid;
c2_y = NULL;
c2_b_u = *((boolean_T *)c2_u);
c2_b_y = NULL;
sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c2_y, c2_b_y);
return c2_y;
}
static void c2_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c2_MPC_state, const
char_T *c2_name, real_T c2_y[6])
{
real_T c2_dv3[6];
int32_T c2_i41;
sf_mex_import(c2_name, sf_mex_dup(c2_MPC_state), c2_dv3, 1, 0, 0U, 1, 0U, 1, 6);
for (c2_i41 = 0; c2_i41 < 6; c2_i41 = c2_i41 + 1) {
c2_y[c2_i41] = c2_dv3[c2_i41];
}
sf_mex_destroy(&c2_MPC_state);
}
static void c2_b_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *c2_RRT_state, const
char_T *c2_name, real_T c2_y[4])
{
real_T c2_dv4[4];
int32_T c2_i42;
sf_mex_import(c2_name, sf_mex_dup(c2_RRT_state), c2_dv4, 1, 0, 0U, 1, 0U, 1, 4);
for (c2_i42 = 0; c2_i42 < 4; c2_i42 = c2_i42 + 1) {
c2_y[c2_i42] = c2_dv4[c2_i42];
}
sf_mex_destroy(&c2_RRT_state);
}
static uint8_T c2_c_emlrt_marshallIn(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance, const mxArray *
c2_b_is_active_c2_MPC_gamecontroller_LiDAR, const char_T *c2_name)
{
uint8_T c2_y;
uint8_T c2_u0;
sf_mex_import(c2_name, sf_mex_dup(c2_b_is_active_c2_MPC_gamecontroller_LiDAR),
&c2_u0, 1, 3, 0U, 0, 0U, 0);
c2_y = c2_u0;
sf_mex_destroy(&c2_b_is_active_c2_MPC_gamecontroller_LiDAR);
return c2_y;
}
static void init_dsm_address_info(SFc2_MPC_gamecontroller_LiDARInstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c2_MPC_gamecontroller_LiDAR_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(961783825U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1784625791U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2067923064U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(803780004U);
}
mxArray *sf_c2_MPC_gamecontroller_LiDAR_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(2045356484U);
pr[1] = (double)(1768060715U);
pr[2] = (double)(361565832U);
pr[3] = (double)(442554772U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,3,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(2);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(4);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(2);
pr[1] = (double)(1);
mxSetField(mxData,2,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,2,"type",mxType);
}
mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,2,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(4);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(6);
pr[1] = (double)(1);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x3'type','srcId','name','auxInfo'{{M[1],M[18],T\"MPC_state\",},{M[1],M[10],T\"RRT_state\",},{M[8],M[0],T\"is_active_c2_MPC_gamecontroller_LiDAR\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 3, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c2_MPC_gamecontroller_LiDAR_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_MPC_gamecontroller_LiDARMachineNumber_,
2,
1,
1,
5,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation(_MPC_gamecontroller_LiDARMachineNumber_,
chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_MPC_gamecontroller_LiDARMachineNumber_,chartInstance->chartNumber,
1);
sf_debug_set_chart_event_thresholds
(_MPC_gamecontroller_LiDARMachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"roll");
_SFD_SET_DATA_PROPS(1,1,1,0,"wheel_speeds");
_SFD_SET_DATA_PROPS(2,1,1,0,"yaw");
_SFD_SET_DATA_PROPS(3,2,0,1,"RRT_state");
_SFD_SET_DATA_PROPS(4,2,0,1,"MPC_state");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,0,0,0,1,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",291,-1,1299);
_SFD_CV_INIT_EML_FOR(0,0,588,612,648);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
{
unsigned int dimVector[1];
dimVector[0]= 2;
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_c_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 4;
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_b_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 2;
_SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_c_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 4;
_SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_b_sf_marshall);
}
{
unsigned int dimVector[1];
dimVector[0]= 6;
_SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_sf_marshall);
}
{
real_T (*c2_roll)[2];
real_T (*c2_wheel_speeds)[4];
real_T (*c2_yaw)[2];
real_T (*c2_RRT_state)[4];
real_T (*c2_MPC_state)[6];
c2_MPC_state = (real_T (*)[6])ssGetOutputPortSignal(chartInstance->S,
2);
c2_RRT_state = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S,
1);
c2_yaw = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
c2_wheel_speeds = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S,
1);
c2_roll = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, *c2_roll);
_SFD_SET_DATA_VALUE_PTR(1U, *c2_wheel_speeds);
_SFD_SET_DATA_VALUE_PTR(2U, *c2_yaw);
_SFD_SET_DATA_VALUE_PTR(3U, *c2_RRT_state);
_SFD_SET_DATA_VALUE_PTR(4U, *c2_MPC_state);
}
}
} else {
sf_debug_reset_current_state_configuration
(_MPC_gamecontroller_LiDARMachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c2_MPC_gamecontroller_LiDAR(void
*chartInstanceVar)
{
chart_debug_initialization(((SFc2_MPC_gamecontroller_LiDARInstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
initialize_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
static void sf_opaque_enable_c2_MPC_gamecontroller_LiDAR(void *chartInstanceVar)
{
enable_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
static void sf_opaque_disable_c2_MPC_gamecontroller_LiDAR(void *chartInstanceVar)
{
disable_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
static void sf_opaque_gateway_c2_MPC_gamecontroller_LiDAR(void *chartInstanceVar)
{
sf_c2_MPC_gamecontroller_LiDAR((SFc2_MPC_gamecontroller_LiDARInstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c2_MPC_gamecontroller_LiDAR(SimStruct*
S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c2_MPC_gamecontroller_LiDAR(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c2_MPC_gamecontroller_LiDAR(SimStruct* S)
{
return sf_internal_get_sim_state_c2_MPC_gamecontroller_LiDAR(S);
}
static void sf_opaque_set_sim_state_c2_MPC_gamecontroller_LiDAR(SimStruct* S,
const mxArray *st)
{
sf_internal_set_sim_state_c2_MPC_gamecontroller_LiDAR(S, st);
}
static void sf_opaque_terminate_c2_MPC_gamecontroller_LiDAR(void
*chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc2_MPC_gamecontroller_LiDARInstanceStruct*)
chartInstanceVar)->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c2_MPC_gamecontroller_LiDAR(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c2_MPC_gamecontroller_LiDAR
((SFc2_MPC_gamecontroller_LiDARInstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c2_MPC_gamecontroller_LiDAR(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",2);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",2,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
"MPC_gamecontroller_LiDAR","MPC_gamecontroller_LiDAR",2,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",2,3);
sf_mark_chart_reusable_outputs(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",2,2);
}
sf_set_rtw_dwork_info(S,"MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",2);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(1580377956U));
ssSetChecksum1(S,(3772912223U));
ssSetChecksum2(S,(58546010U));
ssSetChecksum3(S,(2684414240U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c2_MPC_gamecontroller_LiDAR(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MPC_gamecontroller_LiDAR",
"MPC_gamecontroller_LiDAR",2);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c2_MPC_gamecontroller_LiDAR(SimStruct *S)
{
SFc2_MPC_gamecontroller_LiDARInstanceStruct *chartInstance;
chartInstance = (SFc2_MPC_gamecontroller_LiDARInstanceStruct *)malloc(sizeof
(SFc2_MPC_gamecontroller_LiDARInstanceStruct));
memset(chartInstance, 0, sizeof(SFc2_MPC_gamecontroller_LiDARInstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.mdlStart = mdlStart_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c2_MPC_gamecontroller_LiDAR;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c2_MPC_gamecontroller_LiDAR_method_dispatcher(SimStruct *S, int_T method,
void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c2_MPC_gamecontroller_LiDAR(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c2_MPC_gamecontroller_LiDAR(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c2_MPC_gamecontroller_LiDAR(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c2_MPC_gamecontroller_LiDAR_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
<file_sep>
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML is auto-generated from an M-file.
To make changes, update the M-file and republish this document.
--><title>MPC Control of a DC Servomotor</title><meta name="generator" content="MATLAB 7.10"><meta name="date" content="2010-01-05"><meta name="m-file" content="mpcmotor"><link rel="stylesheet" type="text/css" href="../../../matlab/demos/private/style.css"></head><body><div class="header"><div class="left"><a href="matlab:edit mpcmotor">Open mpcmotor.m in the Editor</a></div><div class="right"><a href="matlab:echodemo mpcmotor">Run in the Command Window</a></div></div><div class="content"><h1>MPC Control of a DC Servomotor</h1><!--introduction--><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Define the parameters of the DC-servo motor [1].</a></li><li><a href="#3">MPC Controller Setup</a></li><li><a href="#6">Simulation Using SIM</a></li><li><a href="#8">Simulation Using Simulink®</a></li></ul></div><p>This demonstration shows how to design an MPC controller to control a DC servomechanism under voltage and shaft torque constraints [1].</p><p>Reference</p><p>[1] <NAME> and <NAME>, ``Fulfilling hard constraints in uncertain linear systems by reference managing,'' Automatica, vol. 34, no. 4, pp. 451-461, 1998.</p><h2>Define the parameters of the DC-servo motor [1].<a name="2"></a></h2><pre class="codeinput">mpcmotormodel
</pre><h2>MPC Controller Setup<a name="3"></a></h2><pre class="codeinput">clear <span class="string">ManipulatedVariables</span> <span class="string">OutputVariables</span>
</pre><p>Define MPC object fields.</p><pre class="codeinput">ManipulatedVariables=struct(<span class="string">'Min'</span>,umin,<span class="string">'Max'</span>,umax,<span class="string">'Units'</span>,<span class="string">'V'</span>);
OutputVariables(1)=struct(<span class="string">'Min'</span>,-Inf,<span class="string">'Max'</span>,Inf,<span class="string">'Units'</span>,<span class="string">'rad'</span>);
OutputVariables(2)=struct(<span class="string">'Min'</span>,Vmin,<span class="string">'Max'</span>,Vmax,<span class="string">'Units'</span>,<span class="string">'Nm'</span>);
Weights=struct(<span class="string">'Input'</span>,uweight,<span class="string">'InputRate'</span>,duweight,<span class="string">'Output'</span>,yweight);
clear <span class="string">Model</span>
Model.Plant=sys;
Model.Plant.OutputGroup={1 <span class="string">'Measured'</span>;2 <span class="string">'Unmeasured'</span>};
PredictionHorizon=10;
ControlHorizon=2;
</pre><p>Create MPC object in workspace.</p><pre class="codeinput">ServoMPC=mpc(Model,Ts,PredictionHorizon,ControlHorizon);
ServoMPC.Weights=Weights;
ServoMPC.ManipulatedVariables=ManipulatedVariables;
ServoMPC.OutputVariables=OutputVariables;
</pre><pre class="codeoutput">-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
for output(s) y1 and zero weight for output(s) y2
</pre><h2>Simulation Using SIM<a name="6"></a></h2><pre class="codeinput">disp(<span class="string">'Now simulating nominal closed-loop behavior'</span>);
Tf=round(Tstop/Ts);
r=pi*ones(Tf,2);
[y1,t1,u1,xp1,xmpc1]=sim(ServoMPC,Tf,r);
</pre><pre class="codeoutput">Now simulating nominal closed-loop behavior
-->Converting model to discrete time.
-->MPC problem is constrained and "ManipulatedVariables.RateMin" is not completely specified or has infinite values.
Setting values to -10 to prevent numerical problems in QP.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
</pre><p>Plot results.</p><pre class="codeinput">subplot(311)
stairs(t1,y1(:,1));
hold <span class="string">on</span>
stairs(t1,r(:,1));
hold <span class="string">off</span>
title(<span class="string">'Angular Position'</span>)
subplot(312)
stairs(t1,u1);
title(<span class="string">'Voltage'</span>)
subplot(313)
stairs(t1,y1(:,2));
title(<span class="string">'Torque'</span>)
</pre><img vspace="5" hspace="5" src="mpcmotor_01.png" alt=""> <h2>Simulation Using Simulink®<a name="8"></a></h2><pre class="codeinput"><span class="keyword">if</span> ~mpcchecktoolboxinstalled(<span class="string">'simulink'</span>)
disp(<span class="string">'Simulink(R) is required to run this part of the demo.'</span>)
<span class="keyword">return</span>
<span class="keyword">end</span>
</pre><p>Run simulation.</p><pre class="codeinput">open_system(<span class="string">'mpc_motor'</span>)
sim(<span class="string">'mpc_motor'</span>,Tstop);
</pre><img vspace="5" hspace="5" src="mpcmotor_02.png" alt=""> <img vspace="5" hspace="5" src="mpcmotor_03.png" alt=""> <img vspace="5" hspace="5" src="mpcmotor_04.png" alt=""> <img vspace="5" hspace="5" src="mpcmotor_05.png" alt=""> <pre class="codeinput">bdclose(<span class="string">'mpc_motor'</span>)
</pre><p class="footer">Copyright 1990-2009 The MathWorks, Inc.<br>
Published with MATLAB® 7.10</p><p class="footer" id="trademarks">MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Please see <a href="http://www.mathworks.com/trademarks">www.mathworks.com/trademarks</a> for a list of other trademarks owned by The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective owners.</p></div><!--
##### SOURCE BEGIN #####
%% MPC Control of a DC Servomotor
%%
% This demonstration shows how to design an MPC controller to control a
% DC servomechanism under voltage and shaft torque constraints [1].
%
% Reference
%
% [1] <NAME> and <NAME>, ``Fulfilling hard constraints in uncertain
% linear systems by reference managing,'' Automatica, vol. 34, no. 4,
% pp. 451-461, 1998.
%
% Copyright 1990-2009 The MathWorks, Inc.
% $Revision: 1.1.8.9 $ $Date: 2009/09/21 00:04:24 $
%% Define the parameters of the DC-servo motor [1].
mpcmotormodel
%% MPC Controller Setup
clear ManipulatedVariables OutputVariables
%%
% Define MPC object fields.
ManipulatedVariables=struct('Min',umin,'Max',umax,'Units','V');
OutputVariables(1)=struct('Min',-Inf,'Max',Inf,'Units','rad');
OutputVariables(2)=struct('Min',Vmin,'Max',Vmax,'Units','Nm');
Weights=struct('Input',uweight,'InputRate',duweight,'Output',yweight);
clear Model
Model.Plant=sys;
Model.Plant.OutputGroup={1 'Measured';2 'Unmeasured'};
PredictionHorizon=10;
ControlHorizon=2;
%%
% Create MPC object in workspace.
ServoMPC=mpc(Model,Ts,PredictionHorizon,ControlHorizon);
ServoMPC.Weights=Weights;
ServoMPC.ManipulatedVariables=ManipulatedVariables;
ServoMPC.OutputVariables=OutputVariables;
%% Simulation Using SIM
disp('Now simulating nominal closed-loop behavior');
Tf=round(Tstop/Ts);
r=pi*ones(Tf,2);
[y1,t1,u1,xp1,xmpc1]=sim(ServoMPC,Tf,r);
%%
% Plot results.
subplot(311)
stairs(t1,y1(:,1));
hold on
stairs(t1,r(:,1));
hold off
title('Angular Position')
subplot(312)
stairs(t1,u1);
title('Voltage')
subplot(313)
stairs(t1,y1(:,2));
title('Torque')
%% Simulation Using Simulink(R)
if ~mpcchecktoolboxinstalled('simulink')
disp('Simulink(R) is required to run this part of the demo.')
return
end
%%
% Run simulation.
open_system('mpc_motor')
sim('mpc_motor',Tstop);
%%
bdclose('mpc_motor')
displayEndOfDemoMessage(mfilename)
##### SOURCE END #####
--></body></html><file_sep>
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML is auto-generated from an M-file.
To make changes, update the M-file and republish this document.
--><title>MPC Control Design Using a Linearized Plant Model</title><meta name="generator" content="MATLAB 7.10"><meta name="date" content="2010-01-05"><meta name="m-file" content="mpclinearization"><link rel="stylesheet" type="text/css" href="../../../matlab/demos/private/style.css"></head><body><div class="header"><div class="left">mpclinearization.mdl</div><div class="right"><a href="matlab:mpclinearization">Open this model</a></div></div><div class="content"><h1>MPC Control Design Using a Linearized Plant Model</h1><p>This demo opens the Model Predictive Control Design Tool to tune an MPC controller for a nonlinear plant in Simulink®. If Simulink® Control Design™ is installed, the MPC internal model will be obtained from linearization of the plant model.</p><img vspace="5" hspace="5" src="mpclinearization_01.png" alt=""> <p class="footer"><br>
Published with MATLAB® 7.10</p><p class="footer" id="trademarks">MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Please see <a href="http://www.mathworks.com/trademarks">www.mathworks.com/trademarks</a> for a list of other trademarks owned by The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective owners.</p></div><!--
##### SOURCE BEGIN #####
%% MPC Control Design Using a Linearized Plant Model
%
% This demo opens the Model Predictive Control Design Tool to tune an MPC controller for a nonlinear plant in Simulink(R). If Simulink(R) Control Design(TM) is installed, the MPC internal model will be obtained from linearization of the plant model.
clear all
close all
bdclose all
%%
open_system('mpclinearization')
evalc('sim(''mpclinearization'')');
%%
clear all
close all
bdclose all
##### SOURCE END #####
--></body></html><file_sep>/* Include files */
#include "blascompat32.h"
#include "MPC_gamecontroller_LiDAR2_sfun.h"
#include "c4_MPC_gamecontroller_LiDAR2.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "MPC_gamecontroller_LiDAR2_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
/* Variable Declarations */
/* Variable Definitions */
static const char *c4_debug_family_names[4] = { "nargin", "nargout", "angler",
"turnangle" };
/* Function Declarations */
static void initialize_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void initialize_params_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void enable_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void disable_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void c4_update_debugger_state_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static const mxArray *get_sim_state_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void set_sim_state_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c4_st);
static void finalize_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void sf_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c4_machineNumber, uint32_T
c4_chartNumber);
static const mxArray *c4_sf_marshall(void *chartInstanceVoid, void *c4_u);
static const mxArray *c4_b_sf_marshall(void *chartInstanceVoid, void *c4_u);
static real_T c4_emlrt_marshallIn(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c4_turnangle, const char_T *c4_name);
static uint8_T c4_b_emlrt_marshallIn
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray
*c4_b_is_active_c4_MPC_gamecontroller_LiDAR2, const char_T *c4_name);
static void init_dsm_address_info(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
chartInstance->c4_is_active_c4_MPC_gamecontroller_LiDAR2 = 0U;
}
static void initialize_params_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void enable_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void disable_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
_sfTime_ = (real_T)ssGetT(chartInstance->S);
}
static void c4_update_debugger_state_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static const mxArray *get_sim_state_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
const mxArray *c4_st = NULL;
const mxArray *c4_y = NULL;
real_T c4_hoistedGlobal;
real_T c4_u;
const mxArray *c4_b_y = NULL;
uint8_T c4_b_hoistedGlobal;
uint8_T c4_b_u;
const mxArray *c4_c_y = NULL;
real_T *c4_turnangle;
c4_turnangle = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c4_st = NULL;
c4_y = NULL;
sf_mex_assign(&c4_y, sf_mex_createcellarray(2));
c4_hoistedGlobal = *c4_turnangle;
c4_u = c4_hoistedGlobal;
c4_b_y = NULL;
sf_mex_assign(&c4_b_y, sf_mex_create("y", &c4_u, 0, 0U, 0U, 0U, 0));
sf_mex_setcell(c4_y, 0, c4_b_y);
c4_b_hoistedGlobal = chartInstance->c4_is_active_c4_MPC_gamecontroller_LiDAR2;
c4_b_u = c4_b_hoistedGlobal;
c4_c_y = NULL;
sf_mex_assign(&c4_c_y, sf_mex_create("y", &c4_b_u, 3, 0U, 0U, 0U, 0));
sf_mex_setcell(c4_y, 1, c4_c_y);
sf_mex_assign(&c4_st, c4_y);
return c4_st;
}
static void set_sim_state_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c4_st)
{
const mxArray *c4_u;
real_T *c4_turnangle;
c4_turnangle = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
chartInstance->c4_doneDoubleBufferReInit = TRUE;
c4_u = sf_mex_dup(c4_st);
*c4_turnangle = c4_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell
(c4_u, 0)), "turnangle");
chartInstance->c4_is_active_c4_MPC_gamecontroller_LiDAR2 =
c4_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c4_u, 1))
, "is_active_c4_MPC_gamecontroller_LiDAR2");
sf_mex_destroy(&c4_u);
c4_update_debugger_state_c4_MPC_gamecontroller_LiDAR2(chartInstance);
sf_mex_destroy(&c4_st);
}
static void finalize_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void sf_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
int32_T c4_previousEvent;
real_T c4_hoistedGlobal;
real_T c4_angler;
uint32_T c4_debug_family_var_map[4];
real_T c4_nargin = 1.0;
real_T c4_nargout = 1.0;
real_T c4_turnangle;
real_T c4_a;
real_T c4_y;
real_T c4_b_a;
real_T c4_b_y;
real_T *c4_b_angler;
real_T *c4_b_turnangle;
c4_b_turnangle = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c4_b_angler = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2);
_SFD_DATA_RANGE_CHECK(*c4_b_angler, 0U);
_SFD_DATA_RANGE_CHECK(*c4_b_turnangle, 1U);
c4_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2);
c4_hoistedGlobal = *c4_b_angler;
c4_angler = c4_hoistedGlobal;
sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c4_debug_family_names,
c4_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c4_nargin, c4_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c4_nargout, c4_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c4_angler, c4_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c4_turnangle, c4_sf_marshall, 3U);
CV_EML_FCN(0, 0);
/* #codegen */
_SFD_EML_CALL(0, 3);
if (CV_EML_IF(0, 0, c4_angler > 0.0)) {
_SFD_EML_CALL(0, 4);
c4_a = c4_angler;
c4_y = c4_a * 155.0;
c4_turnangle = 100.0 + c4_y;
} else {
_SFD_EML_CALL(0, 5);
if (CV_EML_IF(0, 1, c4_angler < 0.0)) {
_SFD_EML_CALL(0, 6);
c4_b_a = c4_angler;
c4_b_y = c4_b_a * 100.0;
c4_turnangle = 100.0 + c4_b_y;
} else {
_SFD_EML_CALL(0, 8);
c4_turnangle = 100.0;
}
}
_SFD_EML_CALL(0, -8);
sf_debug_symbol_scope_pop();
*c4_b_turnangle = c4_turnangle;
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2);
_sfEvent_ = c4_previousEvent;
sf_debug_check_for_state_inconsistency
(_MPC_gamecontroller_LiDAR2MachineNumber_, chartInstance->chartNumber,
chartInstance->
instanceNumber);
}
static void compInitSubchartSimstructsFcn_c4_MPC_gamecontroller_LiDAR2
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance)
{
}
static void init_script_number_translation(uint32_T c4_machineNumber, uint32_T
c4_chartNumber)
{
}
static const mxArray *c4_sf_marshall(void *chartInstanceVoid, void *c4_u)
{
const mxArray *c4_y = NULL;
real_T c4_b_u;
const mxArray *c4_b_y = NULL;
SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c4_y = NULL;
c4_b_u = *((real_T *)c4_u);
c4_b_y = NULL;
sf_mex_assign(&c4_b_y, sf_mex_create("y", &c4_b_u, 0, 0U, 0U, 0U, 0));
sf_mex_assign(&c4_y, c4_b_y);
return c4_y;
}
const mxArray *sf_c4_MPC_gamecontroller_LiDAR2_get_eml_resolved_functions_info
(void)
{
const mxArray *c4_nameCaptureInfo = NULL;
c4_ResolvedFunctionInfo c4_info[14];
c4_ResolvedFunctionInfo (*c4_b_info)[14];
const mxArray *c4_m0 = NULL;
int32_T c4_i0;
c4_ResolvedFunctionInfo *c4_r0;
c4_nameCaptureInfo = NULL;
c4_b_info = (c4_ResolvedFunctionInfo (*)[14])c4_info;
(*c4_b_info)[0].context = "";
(*c4_b_info)[0].name = "gt";
(*c4_b_info)[0].dominantType = "double";
(*c4_b_info)[0].resolved = "[B]gt";
(*c4_b_info)[0].fileLength = 0U;
(*c4_b_info)[0].fileTime1 = 0U;
(*c4_b_info)[0].fileTime2 = 0U;
(*c4_b_info)[1].context = "";
(*c4_b_info)[1].name = "minus";
(*c4_b_info)[1].dominantType = "double";
(*c4_b_info)[1].resolved = "[B]minus";
(*c4_b_info)[1].fileLength = 0U;
(*c4_b_info)[1].fileTime1 = 0U;
(*c4_b_info)[1].fileTime2 = 0U;
(*c4_b_info)[2].context = "";
(*c4_b_info)[2].name = "mtimes";
(*c4_b_info)[2].dominantType = "double";
(*c4_b_info)[2].resolved =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[2].fileLength = 3425U;
(*c4_b_info)[2].fileTime1 = 1251064272U;
(*c4_b_info)[2].fileTime2 = 0U;
(*c4_b_info)[3].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[3].name = "nargin";
(*c4_b_info)[3].dominantType = "";
(*c4_b_info)[3].resolved = "[B]nargin";
(*c4_b_info)[3].fileLength = 0U;
(*c4_b_info)[3].fileTime1 = 0U;
(*c4_b_info)[3].fileTime2 = 0U;
(*c4_b_info)[4].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[4].name = "isa";
(*c4_b_info)[4].dominantType = "double";
(*c4_b_info)[4].resolved = "[B]isa";
(*c4_b_info)[4].fileLength = 0U;
(*c4_b_info)[4].fileTime1 = 0U;
(*c4_b_info)[4].fileTime2 = 0U;
(*c4_b_info)[5].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[5].name = "isinteger";
(*c4_b_info)[5].dominantType = "double";
(*c4_b_info)[5].resolved = "[B]isinteger";
(*c4_b_info)[5].fileLength = 0U;
(*c4_b_info)[5].fileTime1 = 0U;
(*c4_b_info)[5].fileTime2 = 0U;
(*c4_b_info)[6].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[6].name = "isscalar";
(*c4_b_info)[6].dominantType = "double";
(*c4_b_info)[6].resolved = "[B]isscalar";
(*c4_b_info)[6].fileLength = 0U;
(*c4_b_info)[6].fileTime1 = 0U;
(*c4_b_info)[6].fileTime2 = 0U;
(*c4_b_info)[7].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[7].name = "strcmp";
(*c4_b_info)[7].dominantType = "char";
(*c4_b_info)[7].resolved = "[B]strcmp";
(*c4_b_info)[7].fileLength = 0U;
(*c4_b_info)[7].fileTime1 = 0U;
(*c4_b_info)[7].fileTime2 = 0U;
(*c4_b_info)[8].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[8].name = "size";
(*c4_b_info)[8].dominantType = "double";
(*c4_b_info)[8].resolved = "[B]size";
(*c4_b_info)[8].fileLength = 0U;
(*c4_b_info)[8].fileTime1 = 0U;
(*c4_b_info)[8].fileTime2 = 0U;
(*c4_b_info)[9].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[9].name = "eq";
(*c4_b_info)[9].dominantType = "double";
(*c4_b_info)[9].resolved = "[B]eq";
(*c4_b_info)[9].fileLength = 0U;
(*c4_b_info)[9].fileTime1 = 0U;
(*c4_b_info)[9].fileTime2 = 0U;
(*c4_b_info)[10].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[10].name = "class";
(*c4_b_info)[10].dominantType = "double";
(*c4_b_info)[10].resolved = "[B]class";
(*c4_b_info)[10].fileLength = 0U;
(*c4_b_info)[10].fileTime1 = 0U;
(*c4_b_info)[10].fileTime2 = 0U;
(*c4_b_info)[11].context =
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
(*c4_b_info)[11].name = "not";
(*c4_b_info)[11].dominantType = "logical";
(*c4_b_info)[11].resolved = "[B]not";
(*c4_b_info)[11].fileLength = 0U;
(*c4_b_info)[11].fileTime1 = 0U;
(*c4_b_info)[11].fileTime2 = 0U;
(*c4_b_info)[12].context = "";
(*c4_b_info)[12].name = "plus";
(*c4_b_info)[12].dominantType = "double";
(*c4_b_info)[12].resolved = "[B]plus";
(*c4_b_info)[12].fileLength = 0U;
(*c4_b_info)[12].fileTime1 = 0U;
(*c4_b_info)[12].fileTime2 = 0U;
(*c4_b_info)[13].context = "";
(*c4_b_info)[13].name = "lt";
(*c4_b_info)[13].dominantType = "double";
(*c4_b_info)[13].resolved = "[B]lt";
(*c4_b_info)[13].fileLength = 0U;
(*c4_b_info)[13].fileTime1 = 0U;
(*c4_b_info)[13].fileTime2 = 0U;
sf_mex_assign(&c4_m0, sf_mex_createstruct("nameCaptureInfo", 1, 14));
for (c4_i0 = 0; c4_i0 < 14; c4_i0 = c4_i0 + 1) {
c4_r0 = &c4_info[c4_i0];
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->context, 15,
0U, 0U, 0U, 2, 1, strlen(c4_r0->context)), "context",
"nameCaptureInfo", c4_i0);
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->name, 15, 0U,
0U, 0U, 2, 1, strlen(c4_r0->name)), "name",
"nameCaptureInfo", c4_i0);
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->dominantType,
15, 0U, 0U, 0U, 2, 1, strlen(c4_r0->dominantType)),
"dominantType", "nameCaptureInfo", c4_i0);
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->resolved, 15,
0U, 0U, 0U, 2, 1, strlen(c4_r0->resolved)), "resolved"
, "nameCaptureInfo", c4_i0);
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", &c4_r0->fileLength,
7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
c4_i0);
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", &c4_r0->fileTime1, 7,
0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c4_i0);
sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", &c4_r0->fileTime2, 7,
0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c4_i0);
}
sf_mex_assign(&c4_nameCaptureInfo, c4_m0);
return c4_nameCaptureInfo;
}
static const mxArray *c4_b_sf_marshall(void *chartInstanceVoid, void *c4_u)
{
const mxArray *c4_y = NULL;
boolean_T c4_b_u;
const mxArray *c4_b_y = NULL;
SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *)
chartInstanceVoid;
c4_y = NULL;
c4_b_u = *((boolean_T *)c4_u);
c4_b_y = NULL;
sf_mex_assign(&c4_b_y, sf_mex_create("y", &c4_b_u, 11, 0U, 0U, 0U, 0));
sf_mex_assign(&c4_y, c4_b_y);
return c4_y;
}
static real_T c4_emlrt_marshallIn(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance, const mxArray *c4_turnangle, const
char_T *c4_name)
{
real_T c4_y;
real_T c4_d0;
sf_mex_import(c4_name, sf_mex_dup(c4_turnangle), &c4_d0, 1, 0, 0U, 0, 0U, 0);
c4_y = c4_d0;
sf_mex_destroy(&c4_turnangle);
return c4_y;
}
static uint8_T c4_b_emlrt_marshallIn
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance, const mxArray *
c4_b_is_active_c4_MPC_gamecontroller_LiDAR2, const char_T *c4_name)
{
uint8_T c4_y;
uint8_T c4_u0;
sf_mex_import(c4_name, sf_mex_dup(c4_b_is_active_c4_MPC_gamecontroller_LiDAR2),
&c4_u0, 1, 3, 0U, 0, 0U, 0);
c4_y = c4_u0;
sf_mex_destroy(&c4_b_is_active_c4_MPC_gamecontroller_LiDAR2);
return c4_y;
}
static void init_dsm_address_info(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct
*chartInstance)
{
}
/* SFunction Glue Code */
void sf_c4_MPC_gamecontroller_LiDAR2_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1782909447U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3058006903U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2635247593U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3281816815U);
}
mxArray *sf_c4_MPC_gamecontroller_LiDAR2_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
double *pr = mxGetPr(mxChecksum);
pr[0] = (double)(3721112673U);
pr[1] = (double)(2305067683U);
pr[2] = (double)(2622996367U);
pr[3] = (double)(130636722U);
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
return(mxAutoinheritanceInfo);
}
static mxArray *sf_get_sim_state_info_c4_MPC_gamecontroller_LiDAR2(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x2'type','srcId','name','auxInfo'{{M[1],M[5],T\"turnangle\",},{M[8],M[0],T\"is_active_c4_MPC_gamecontroller_LiDAR2\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c4_MPC_gamecontroller_LiDAR2_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *)
((ChartInfoStruct *)(ssGetUserData(S)))->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(_MPC_gamecontroller_LiDAR2MachineNumber_,
4,
1,
1,
2,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
ssGetPath(S),
(void *)S);
if (chartAlreadyPresent==0) {
/* this is the first instance */
init_script_number_translation
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber);
sf_debug_set_chart_disable_implicit_casting
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
1);
sf_debug_set_chart_event_thresholds
(_MPC_gamecontroller_LiDAR2MachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"angler");
_SFD_SET_DATA_PROPS(1,2,0,1,"turnangle");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of EML Model Coverage */
_SFD_CV_INIT_EML(0,1,2,0,0,0,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,182);
_SFD_CV_INIT_EML_IF(0,0,51,63,102,181);
_SFD_CV_INIT_EML_IF(0,1,102,118,151,181);
_SFD_TRANS_COV_WTS(0,0,0,1,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(0,
0,NULL,NULL,
0,NULL,NULL,
1,NULL,NULL,
0,NULL,NULL);
}
_SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c4_sf_marshall);
_SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c4_sf_marshall);
{
real_T *c4_angler;
real_T *c4_turnangle;
c4_turnangle = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
c4_angler = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
_SFD_SET_DATA_VALUE_PTR(0U, c4_angler);
_SFD_SET_DATA_VALUE_PTR(1U, c4_turnangle);
}
}
} else {
sf_debug_reset_current_state_configuration
(_MPC_gamecontroller_LiDAR2MachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static void sf_opaque_initialize_c4_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
chart_debug_initialization(((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
initialize_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_enable_c4_MPC_gamecontroller_LiDAR2(void *chartInstanceVar)
{
enable_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_disable_c4_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
disable_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
static void sf_opaque_gateway_c4_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
sf_c4_MPC_gamecontroller_LiDAR2((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar);
}
static mxArray* sf_internal_get_sim_state_c4_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_raw2high");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = (mxArray*) get_sim_state_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
prhs[3] = sf_get_sim_state_info_c4_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
}
return plhs[0];
}
static void sf_internal_set_sim_state_c4_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
mxArray *plhs[1] = { NULL };
mxArray *prhs[4];
int mxError = 0;
prhs[0] = mxCreateString("chart_simctx_high2raw");
prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
prhs[2] = mxDuplicateArray(st); /* high level simctx */
prhs[3] = (mxArray*) sf_get_sim_state_info_c4_MPC_gamecontroller_LiDAR2();/* state var info */
mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
mxDestroyArray(prhs[0]);
mxDestroyArray(prhs[1]);
mxDestroyArray(prhs[2]);
mxDestroyArray(prhs[3]);
if (mxError || plhs[0] == NULL) {
sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
}
set_sim_state_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*)chartInfo->chartInstance,
mxDuplicateArray(plhs[0]));
mxDestroyArray(plhs[0]);
}
static mxArray* sf_opaque_get_sim_state_c4_MPC_gamecontroller_LiDAR2(SimStruct*
S)
{
return sf_internal_get_sim_state_c4_MPC_gamecontroller_LiDAR2(S);
}
static void sf_opaque_set_sim_state_c4_MPC_gamecontroller_LiDAR2(SimStruct* S,
const mxArray *st)
{
sf_internal_set_sim_state_c4_MPC_gamecontroller_LiDAR2(S, st);
}
static void sf_opaque_terminate_c4_MPC_gamecontroller_LiDAR2(void
*chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*)
chartInstanceVar)->S;
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
}
finalize_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
free((void *)chartInstanceVar);
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
compInitSubchartSimstructsFcn_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c4_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c4_MPC_gamecontroller_LiDAR2
((SFc4_MPC_gamecontroller_LiDAR2InstanceStruct*)(((ChartInfoStruct *)
ssGetUserData(S))->chartInstance));
}
}
static void mdlSetWorkWidths_c4_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",4);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",4,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
"MPC_gamecontroller_LiDAR2","MPC_gamecontroller_LiDAR2",4,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",4,1);
sf_mark_chart_reusable_outputs(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",4,1);
}
sf_set_rtw_dwork_info(S,"MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",4);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(2904717035U));
ssSetChecksum1(S,(4284428096U));
ssSetChecksum2(S,(4221278222U));
ssSetChecksum3(S,(2307567712U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c4_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MPC_gamecontroller_LiDAR2",
"MPC_gamecontroller_LiDAR2",4);
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c4_MPC_gamecontroller_LiDAR2(SimStruct *S)
{
SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *chartInstance;
chartInstance = (SFc4_MPC_gamecontroller_LiDAR2InstanceStruct *)malloc(sizeof
(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct));
memset(chartInstance, 0, sizeof(SFc4_MPC_gamecontroller_LiDAR2InstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlStart = mdlStart_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c4_MPC_gamecontroller_LiDAR2;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->S = S;
ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c4_MPC_gamecontroller_LiDAR2_method_dispatcher(SimStruct *S, int_T method,
void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c4_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c4_MPC_gamecontroller_LiDAR2(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c4_MPC_gamecontroller_LiDAR2(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c4_MPC_gamecontroller_LiDAR2_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
| 5c4950cc41a97a1e1edcc689726cd0b1006d376c | [
"C",
"HTML"
] | 22 | C | Cal-Poly-SSIV/RRT-Stevens-2014 | 3b083b0d9d69304c5a599504e1a71cb38f4085ef | 62ebace3a32e127af55ebd9a9918b3d6767cfd13 |
refs/heads/master | <repo_name>Tondii/python-knn-algorithm<file_sep>/knn.py
import operator
import scipy.spatial as sp
import pandas as pd
import numpy as np
import unittest as ut
data = pd.read_csv('data/iris.data.learn')
learnData = data.values
data = pd.read_csv('data/iris.data.test')
testData = data.values
class kNN:
def __init__(self, k, learnData):
self.k = k
self.learnData = learnData
def predict(self, trainData):
labels = []
for i in range(len(trainData)):
distances = []
neighbors = []
for j in range(len(self.learnData)):
distance = sp.distance.euclidean(self.learnData[j][0:3],trainData[i][0:3])
distances.append((self.learnData[j],distance))
distances.sort(key=operator.itemgetter(1))
for m in range(self.k):
neighbors.append(distances[m][0])
labels2 = {}
for i in range(len(neighbors)):
label = neighbors[i][-1]
if label in labels2:
labels2[label] += 1
else:
labels2[label] = 1
sortedLabels = sorted(labels2.__iter__(),key=operator.itemgetter(1))
labels.append(sortedLabels[0])
return labels
def score(self,trainData,labels):
recognized = 0
for i in range(len(trainData)):
data = trainData[i]
if data[4] == labels[i]:
recognized+=1
return recognized
class dataBuffer:
def __init__(self):
return None
def process(self, path):
dataBuff = pd.read_csv(path, header=None)
array = np.array(dataBuff)
return array
def deleteLabels(self,array):
array2 = []
for item in array:
array2.append(item[0:len(item)-1])
return np.array(array2)
class test_kNN(ut.TestCase):
def test(self):
test1 = ['Iris-setosa', 'Iris-setosa', 'Iris-setosa', 'Iris-versicolor', 'Iris-versicolor', 'Iris-versicolor', 'Iris-versicolor', 'Iris-versicolor', 'Iris-versicolor', 'Iris-virginica', 'Iris-virginica', 'Iris-virginica', 'Iris-virginica', 'Iris-versicolor', 'Iris-virginica']
expect = 13
testin = kNN(3, learnData)
result = testin.score(testData, test1)
self.assertEqual(expect, result)
data = dataBuffer()
learnData = data.process('data/iris.data.learn')
testData = data.process('data/iris.data.test')
test1 = data.deleteLabels(testData)
kNN = kNN(5,learnData)
labelskNN= kNN.predict(test1)
print("Final score: ",kNN.score(testData, labelskNN))
print("Accuracy: ",(kNN.score(testData, labelskNN)/len(testData))*100)
| 809bed45d39791b80b4bb81860ae65f69cc32d74 | [
"Python"
] | 1 | Python | Tondii/python-knn-algorithm | a4f2738ce4b2844c4e2e28947fa206a7fcf9e7d3 | 3c99ba9fd66da78069b6e1c665adceee546a1721 |
refs/heads/master | <repo_name>asynclearningio/face-cards-code<file_sep>/src/App.js
import logo from './logo.svg';
import './App.css';
import { Component } from 'react';
import { CardList } from './components/card-list/card-list.component';
class App extends Component {
constructor() {
super();
this.state = {
persons: [],
searchField: ''
};
}
async componentDidMount() {
const response = await fetch('https://jsonplaceholder.typicode.com/users');
const persons = await response.json();
this.setState({ persons: persons});
}
render() {
const { persons, searchField } = this.state;
const filteredPersons = persons.filter(person => person.name.toLowerCase().includes(searchField.toLowerCase()))
return (
<div className="App">
<input type="search" placeholder="search persons" onChange={e => {
this.setState({ searchField: e.target.value }, () => console.log(this.state));
}} />
<CardList persons={filteredPersons} />
</div>
);
}
}
export default App;
| f4164d24d756b1e226fa7b8b0288bcd586c2e5f0 | [
"JavaScript"
] | 1 | JavaScript | asynclearningio/face-cards-code | 84fe3cf05813f32228a532c0df6a9e695e8dab30 | f3e76a8b25d07f18144e7577611b5aee73cdda57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.