📄 customermanagesessionbeantestclient1.java
字号:
if (logging) {
log("Calling deleteEmployeeBySns(" + sns + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.deleteEmployeeBySns(sns);
if (logging) {
log("Succeeded: deleteEmployeeBySns(" + sns + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : deleteEmployeeBySns(" + sns + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from deleteEmployeeBySns(" + sns + "): " + returnValue +
".");
}
return returnValue;
}
public String deleteRoleByIds(Long[] ids) {
String returnValue = "";
if (customerManageSession == null) {
System.out.println("Error in deleteRoleByIds(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling deleteRoleByIds(" + ids + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.deleteRoleByIds(ids);
if (logging) {
log("Succeeded: deleteRoleByIds(" + ids + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : deleteRoleByIds(" + ids + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from deleteRoleByIds(" + ids + "): " + returnValue +
".");
}
return returnValue;
}
public String updateEmployeeBySn(Long oldsn, EmployeeObject updateEmployee,
Collection roleMapped) {
String returnValue = "";
if (customerManageSession == null) {
System.out.println("Error in updateEmployeeBySn(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling updateEmployeeBySn(" + oldsn + ", " + updateEmployee + ", " +
roleMapped + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.updateEmployeeBySn(oldsn,
updateEmployee, roleMapped);
if (logging) {
log("Succeeded: updateEmployeeBySn(" + oldsn + ", " + updateEmployee +
", " + roleMapped + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : updateEmployeeBySn(" + oldsn + ", " + updateEmployee +
", " + roleMapped + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from updateEmployeeBySn(" + oldsn + ", " +
updateEmployee + ", " + roleMapped + "): " + returnValue + ".");
}
return returnValue;
}
public String updateRoleById(Long oldid, RoleObject updateRole,
Collection employeeMapped) {
String returnValue = "";
if (customerManageSession == null) {
System.out.println("Error in updateRoleById(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling updateRoleById(" + oldid + ", " + updateRole + ", " +
employeeMapped + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.updateRoleById(oldid, updateRole,
employeeMapped);
if (logging) {
log("Succeeded: updateRoleById(" + oldid + ", " + updateRole + ", " +
employeeMapped + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : updateRoleById(" + oldid + ", " + updateRole + ", " +
employeeMapped + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from updateRoleById(" + oldid + ", " + updateRole +
", " + employeeMapped + "): " + returnValue + ".");
}
return returnValue;
}
public Collection getEmployeesByRoleId(Long roleId) {
Collection returnValue = null;
if (customerManageSession == null) {
System.out.println("Error in getEmployeesByRoleId(): " +
ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling getEmployeesByRoleId(" + roleId + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.getEmployeesByRoleId(roleId);
if (logging) {
log("Succeeded: getEmployeesByRoleId(" + roleId + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : getEmployeesByRoleId(" + roleId + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from getEmployeesByRoleId(" + roleId + "): " +
returnValue + ".");
}
return returnValue;
}
public Collection getRolesByEmployeeId(Long employeeId) {
Collection returnValue = null;
if (customerManageSession == null) {
System.out.println("Error in getRolesByEmployeeId(): " +
ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling getRolesByEmployeeId(" + employeeId + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.getRolesByEmployeeId(employeeId);
if (logging) {
log("Succeeded: getRolesByEmployeeId(" + employeeId + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : getRolesByEmployeeId(" + employeeId + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from getRolesByEmployeeId(" + employeeId + "): " +
returnValue + ".");
}
return returnValue;
}
public Collection[] getRolesMappedAndNotMappedByEmpId(Long employeeId) {
Collection[] returnValue = null;
if (customerManageSession == null) {
System.out.println("Error in getRolesMappedAndNotMappedByEmpId(): " +
ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling getRolesMappedAndNotMappedByEmpId(" + employeeId + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.getRolesMappedAndNotMappedByEmpId(
employeeId);
if (logging) {
log("Succeeded: getRolesMappedAndNotMappedByEmpId(" + employeeId + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : getRolesMappedAndNotMappedByEmpId(" + employeeId + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from getRolesMappedAndNotMappedByEmpId(" + employeeId +
"): " + returnValue + ".");
}
return returnValue;
}
public Collection[] getEmployeesMappedAndNotMappedByRoleId(Long roleId) {
Collection[] returnValue = null;
if (customerManageSession == null) {
System.out.println("Error in getEmployeesMappedAndNotMappedByRoleId(): " +
ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling getEmployeesMappedAndNotMappedByRoleId(" + roleId + ")");
startTime = System.currentTimeMillis();
}
try {
returnValue = customerManageSession.
getEmployeesMappedAndNotMappedByRoleId(roleId);
if (logging) {
log("Succeeded: getEmployeesMappedAndNotMappedByRoleId(" + roleId + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed : getEmployeesMappedAndNotMappedByRoleId(" + roleId + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from getEmployeesMappedAndNotMappedByRoleId(" + roleId +
"): " + returnValue + ".");
}
return returnValue;
}
//----------------------------------------------------------------------------
// Utility Methods
//----------------------------------------------------------------------------
private void log(String message) {
if (message == null) {
System.out.println("-- null");
}
if (message.length() > MAX_OUTPUT_LINE_LENGTH) {
System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH) +
" ...");
}
else {
System.out.println("-- " + message);
}
}
//Main method
public static void main(String[] args) throws RemoteException
{
CustomerManageSessionBeanTestClient1 client = new
CustomerManageSessionBeanTestClient1();
// Use the client object to call one of the Home interface wrappers
// above, to create a Remote interface reference to the bean.
// If the return value is of the Remote interface type, you can use it
// to access the remote interface methods. You can also just use the
// client object to call the Remote interface wrappers.
client.create();
Collection col[] = client.customerManageSession.getRolesMappedAndNotMappedByEmpId(new Long(20041212));
System.out.println("已映射的:");
prt(col[0]);
System.out.println("未映射的:");
prt(col[1]);
}
public static void prt(Collection col)
{
for (Iterator iter = col.iterator(); iter.hasNext(); ) {
RoleObject item = (RoleObject) iter.next();
System.out.println("role name = " + item.getName());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -