⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 communityserverinterfaceimpl.java

📁 网上虚拟社区
💻 JAVA
字号:
import java.rmi.*;
import java.rmi.server.*;
import java.sql.SQLException;
import java.util.*;

public class CommunityServerInterfaceImpl extends UnicastRemoteObject implements CommunityServerInterface{
	private VirtualCommunity thecommunity;

	
	public CommunityServerInterfaceImpl() throws RemoteException{
//		System.out.println("here");
		 thecommunity= new VirtualCommunity();	
	}
	
	public String changemessage(String name,String password,String genere,String[] information)throws RemoteException{
		try{
			String test = null;
			double a = 0;
			if(genere.equals("VirtualPerson"))
				a=0;
			else if(genere.equals("VeditionCompany"))
				a = 1;
			else if(genere.equals("EmpolderCompany"))
				a = 2;
			test = thecommunity.changemessage(name,a, password, information[0], information[1], information[2], information[3]);
			return test;	
		}
		catch(Exception ex){
			System.out.println(ex);
			return null;
		}
	}
	
	public boolean addsoftware(String soft,String description, String needer,double sellingprice) throws RemoteException{
		try{
		  return 	thecommunity.addsoftware(soft,description,needer,sellingprice);//todoOperator
		}
		catch(Exception ex){
			System.out.println(ex);
			return false;
		}
	}
	
	public void settlesoftware(String name,String soft) throws RemoteException{
		try{
				thecommunity.settlesoftware(name, soft);//todoOperator
			}
			catch(Exception ex){
				System.out.println(ex);
			}
		
	}
	
	public void buysoftware(String name,String soft) throws RemoteException{
		try{
			thecommunity.buysoftware(name, soft);//todoOperator
		}
		catch(Exception ex){
			System.out.println(ex);
		}
	}
	
	public void orderdish(String name,String dish,double num) throws RemoteException{
		try{
			thecommunity.orderdish(name, dish);//todoOperator
		}
		catch(Exception ex){
			System.out.println(ex);
		}
	}
	
	public void bid(String name,String soft,double price) throws RemoteException{
		try{
			thecommunity.bid(name, soft,price);
		}
		catch(Exception ex){
			System.out.println(ex);
		}
	}
	public void putin(String name,String soft,String account) throws RemoteException{
		try{
			thecommunity.putin(name, soft,account);
		}
		catch(Exception ex){
			System.out.println(ex);
		}
	}
	
	public String[] findperson(String name,String password,String genere)throws RemoteException{
		try{
			Virtualperson test = null;
			if(genere.equals("VirtualPerson")){					
				test = thecommunity.findperson(name, password);
			}
			else if(genere.equals("VeditionCompany")){
				test = thecommunity.findVedition(name, password);
			}
			else if(genere.equals("EmpolderCompany")){
				test = thecommunity.findEmpolder(name, password);
			}
			String[] a = {test.GetName(),test.GetPassword(),test.GetAddress(),test.GetAccount()};
			return a;
		}
		catch(Exception ex){
			System.out.println(ex);
			return null;
		}
	}
	
	public double findbalance(String No,String pin)throws RemoteException{
		return thecommunity.findBalance(No, pin);
	}
	
	public boolean changepin(String No,String pin,String newpin)throws RemoteException{
		return thecommunity.changepin(No, pin,newpin);
	}
	
	public boolean withdraw(String No,String pin,double num)throws RemoteException{
		return thecommunity.withdraw(No, pin,num);
	}
	
	public boolean deposit(String No,String pin,double num)throws RemoteException{
		return thecommunity.deposit(No, pin,num);
	}
	
	public Vector finddatabase(String table,int a,String name) throws RemoteException{
		try{
		      return thecommunity.finddatabase(table,a,name);
		}
		catch(Exception ex){
			System.out.println(ex);
			return null;
		}
	}
	
	public boolean getpermission(String name,String password,String genere) throws RemoteException{
		try{
			Virtualperson test = null;
			if(genere.equals("VirtualPerson")){					
				test = thecommunity.findperson(name, password);
			}
			else if(genere.equals("VeditionCompany")){
				test = thecommunity.findVedition(name, password);
			}
			else if(genere.equals("EmpolderCompany")){
				test = thecommunity.findEmpolder(name, password);
			}
			else if(genere.equals("Bank")){
				return thecommunity.findAccount(name,password);
			}
			if(test==null){
//				System.out.println("here");
			    return false;
			}
			else 
				return true;
		}
		catch(Exception ex){
			System.out.println(ex);
			return false;
		}
	}
	public boolean addnewmember(String name,String password,String genere,String Address,String Account) throws RemoteException{
		try{
			if(genere.equals("VirtualPerson")){
				return thecommunity.addvirtual(name,password,0,Address,Account);
			}
			else if(genere.equals("VeditionCompany")){
				return thecommunity.addvirtual(name,password,1,Address,Account);
			}
			else if(genere.equals("EmpolderCompany")){
				return thecommunity.addvirtual(name,password,2,Address,Account);
			}
			else 
				return false;
		}
		catch(Exception ex){
			return false;
		}
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -