Commit 5c0cc697 authored by hanson.yao's avatar hanson.yao

convert wtPart

parent 9e6ecfe2
This diff is collapsed.
......@@ -30,6 +30,7 @@ import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Hashtable;
public class PartUtil implements RemoteAccess {
private static Logger logger = LogR.getLogger(PartUtil.class.getName());
......@@ -70,14 +71,6 @@ public class PartUtil implements RemoteAccess {
if (queryResult.hasMoreElements()) {
part = (WTPart) queryResult.nextElement();
}
if(part!=null){
System.out.println("--------Part info-----");
System.out.println("----partNumber-----"+part.getNumber());
System.out.println("----creatorName-----"+part.getCreatorName());
System.out.println("----------------------");
}
} finally {
SessionServerHelper.manager.setAccessEnforced(enforce);
}
......@@ -91,7 +84,6 @@ public class PartUtil implements RemoteAccess {
}
public static WTPart createPart(String number, String name, HashMap attributes, WTContainerRef containerRef) {
try {
if (!RemoteMethodServer.ServerFlag) {
......@@ -314,8 +306,7 @@ public class PartUtil implements RemoteAccess {
return (TypeIdentifier) RemoteMethodServer.getDefault().invoke("getWTObjectSubType", PartUtil.class.getName(), null, new Class[]{WTObject.class}, new Object[]{obj});
} else {
// wt.doc.WTDocument|org.saacc.MEETINGSUGGESTION
TypeIdentifier typeIdentifier = TypedUtility.getTypeIdentifier(obj);
return typeIdentifier;
return TypedUtility.getTypeIdentifier(obj);
}
} catch (Exception e) {
e.printStackTrace();
......@@ -323,10 +314,10 @@ public class PartUtil implements RemoteAccess {
return null;
}
public static void main(String[] args) throws InvocationTargetException, RemoteException {
if (!RemoteMethodServer.ServerFlag) {
RemoteMethodServer.getDefault().invoke("getLatestPartByNumber", PartUtil.class.getName(), null, new Class[]{String.class}, new Object[]{args[0]});
}
public static void main(String[] args) throws WTException, InvocationTargetException, RemoteException {
WTPart part = getPartByNumberAndView(args[0], args[1], false);
System.out.println("part number====>" + part.getNumber());
Hashtable hashtable = IBAHelper.getAllIBAValues(part);
System.out.println("hashtable====>" + hashtable);
}
}
package com.yonde.part.service;
import com.yonde.common.DateTimeUtil;
import com.yonde.common.IBAHelper;
import com.yonde.common.PartUtil;
import com.yonde.part.vo.DxPart;
import org.springframework.stereotype.Service;
......@@ -13,16 +14,22 @@ import wt.type.ClientTypedUtility;
import wt.util.WTException;
import wt.vc.wip.WorkInProgressHelper;
import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException;
import java.util.Hashtable;
import java.util.Locale;
@Service
public class PartService {
public static DxPart getPartByNumber(String number, String view) throws WTException, RemoteException {
public static DxPart getPartByNumber(String number, String view) throws WTException, RemoteException, InvocationTargetException {
System.out.println("-----getPartByNumber----");
boolean accessControlled = false;
DxPart dxPart = new DxPart();
WTPart wtPart = PartUtil.getPartByNumberAndView(number, view, accessControlled);
System.out.println("-----getPartByNumber----a");
Hashtable hashtable = IBAHelper.getAllIBAValues(wtPart);
System.out.println("-----getPartByNumber----b");
if (wtPart != null) {
WTUser creat = ((WTUser) wtPart.getCreator().getObject());
dxPart.setCreator(String.format("%s(%s)", creat.getFullName(), creat.getName()));
......@@ -40,9 +47,9 @@ public class PartService {
System.out.println("-----getPartByNumber----5");
dxPart.setState(wtPart.getState().getState().getDisplay(Locale.SIMPLIFIED_CHINESE));
String wtType= ClientTypedUtility.getExternalTypeIdentifier(wtPart);
wtType=wtType.substring(wtType.lastIndexOf(".")+1,wtType.length());
System.out.println("--------wtType------"+wtType);
String wtType = ClientTypedUtility.getExternalTypeIdentifier(wtPart);
wtType = wtType.substring(wtType.lastIndexOf("|") + 1);
System.out.println("--------wtType------" + wtType);
// dxPart.setSubTypeName(PartUtil.getWTObjectSubType(wtPart).getTypename());
dxPart.setDefaultUnit(wtPart.getDefaultUnit().getDisplay(Locale.SIMPLIFIED_CHINESE));
dxPart.setMasterId(new ReferenceFactory().getReferenceString(ObjectReference.newObjectReference((wtPart.getMaster().getPersistInfo().getObjectIdentifier()))));
......@@ -70,9 +77,7 @@ public class PartService {
}
dxPart.setVersion(wtPart.getVersionIdentifier().getValue());
dxPart.setIteration(wtPart.getIterationIdentifier().getValue());
//dxPart.setSubTypeDisplayName(TypedUtility.getTypeIdentifier(wtPart).getTypename());
dxPart.setDynamicAttrs(hashtable);
}
return dxPart;
}
......
......@@ -36,8 +36,6 @@ public class DxPart implements Serializable {
//todo dynamicAttrs subTypeDisplayName 无法获取
private Map<String, Object> dynamicAttrs;
private String subTypeDisplayName;
public DxPart() {
}
......@@ -90,14 +88,6 @@ public class DxPart implements Serializable {
this.subTypeName = subTypeName;
}
public String getSubTypeDisplayName() {
return subTypeDisplayName;
}
public void setSubTypeDisplayName(String subTypeDisplayName) {
this.subTypeDisplayName = subTypeDisplayName;
}
public Map<String, Object> getDynamicAttrs() {
return dynamicAttrs;
}
......@@ -202,7 +192,6 @@ public class DxPart implements Serializable {
this.checkOuted = checkOuted;
}
public String getMasterId() {
return masterId;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment