Windchill WTPart WTPartMaster 所有零件操作通用类 PartUtil.java

7.Windchill -- 抓取指定部件的属性 Windchill -- 抓取指定部件的属性 阅读详情

//01. 零件号 返回 WTPart对象
  public static WTPart getWTPartByNumber(String paramString)
    throws WTException
  {
    WTPart localWTPart = null;
    QuerySpec localQuerySpec = null;
    QueryResult localQueryResult = null;
    localQuerySpec = new QuerySpec(WTPartMaster.class);

    SearchCondition localSearchCondition = new SearchCondition(WTPartMaster.class, "number", "LIKE", paramString);
    localQuerySpec.appendSearchCondition(localSearchCondition);
    localQueryResult = PersistenceHelper.manager.find(localQuerySpec);
    if (localQueryResult.hasMoreElements())
    {
      WTPartMaster localWTPartMaster = (WTPartMaster)localQueryResult.nextElement();

      localWTPart = getLatestPartByPartMaster(localWTPartMaster);
    }

    return localWTPart;
  }
//02.零件号  返回 WTPartMaster 对象
  public static WTPartMaster getWTPartMasterByNumber(String paramString)
    throws WTException
  {
    WTPartMaster localWTPartMaster = null;
    QuerySpec localQuerySpec = null;
    QueryResult localQueryResult = null;
    localQuerySpec = new QuerySpec(WTPartMaster.class);

    SearchCondition localSearchCondition = new SearchCondition(WTPartMaster.class, "number", "LIKE", paramString);
    localQuerySpec.appendSearchCondition(localSearchCondition);
    localQueryResult = PersistenceHelper.manager.find(localQuerySpec);
    if (localQueryResult.hasMoreElements())
    {
      localWTPartMaster = (WTPartMaster)localQueryResult.nextElement();
    }

    if (VERBOSE)
      System.out.println(" getWTPartMasterByNumber=" + localWTPartMaster);
    return localWTPartMaster;
  }
//03. 通过WTPartMaster 返回最新版本WTPart对象
  public static WTPart getLatestPartByPartMaster(WTPartMaster paramWTPartMaster)
    throws WTException
  {
    Iterated localIterated = null;
    boolean bool = false;
    LatestConfigSpec localLatestConfigSpec = new LatestConfigSpec();

    QueryResult localQueryResult = ConfigHelper.service.filteredIterationsOf(paramWTPartMaster, localLatestConfigSpec);
    if ((localQueryResult != null) && (localQueryResult.size() <= 0))
    {
      ConfigSpec localConfigSpec = ConfigHelper.service.getDefaultConfigSpecFor(WTPartMaster.class);
      localQueryResult = ConfigHelper.service.filteredIterationsOf(paramWTPartMaster, localConfigSpec);
    }

    while ((localQueryResult.hasMoreElements()) && (!bool))
    {
      localIterated = (Iterated)localQueryResult.nextElement();
      bool = localIterated.isLatestIteration();
    }
    if ((VERBOSE) && (localIterated != null))
      System.out.println("    the latest iteration=" + localIterated.getIdentity());
    return (WTPart)localIterated;
  }
//04.通过WTPartMaster 和 版本    返回 WTPart
  public static WTPart getSpecialPartByMasterAndVersion(WTPartMaster paramWTPartMaster, String paramString)
    throws WTException
  {
    WTPart localWTPart = null;
    String str = "";

    QueryResult localQueryResult = VersionControlHelper.service.allVersionsOf(paramWTPartMaster);
    if ((localQueryResult != null) && (localQueryResult.size() <= 0))
    {
      return null;
    }
    while (localQueryResult.hasMoreElements())
    {
      localWTPart = (WTPart)localQueryResult.nextElement();

      str = VersionControlHelper.getVersionIdentifier(localWTPart).getValue();
      if (str.equalsIgnoreCase(paramString))
        return localWTPart;
    }
    return null;
  }
//05.零件向下所有零件列表
  public static Vector getSubPartListByPart(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector1 = new Vector();

    Vector localVector2 = getFirstLevelSubPartListByPart(paramWTPart, "");

    for (int i = 0; i < localVector2.size(); i++)
    {
      WTPart localWTPart1 = (WTPart)localVector2.elementAt(i);
      if (!ObjectUtil.isPersistableInobjVector(localVector1, localWTPart1)) {
        localVector1.addElement(localWTPart1);
      }
      Vector localVector3 = getSubPartListByPart(localWTPart1);

      for (int j = 0; j < localVector3.size(); j++)
      {
        WTPart localWTPart2 = (WTPart)localVector3.elementAt(j);
        if (ObjectUtil.isPersistableInobjVector(localVector1, localWTPart2))
          continue;
        localVector1.addElement(localWTPart2);
      }
    }

    return localVector1;
  }

  public static Vector getTopPartListByPart(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector1 = new Vector();
    if (paramWTPart == null)
      return null;
    Vector localVector2 = getParentPartListByPart(paramWTPart);
    if ((localVector2 == null) || (localVector2.size() <= 0)) {
      return null;
    }

    for (int i = 0; i < localVector2.size(); i++)
    {
      WTPart localWTPart = (WTPart)localVector2.elementAt(i);

      Vector localVector3 = getParentPartListByPart(localWTPart);
      if ((localVector3 != null) && (localVector3.size() <= 0))
      {
        if (ObjectUtil.isPersistableInobjVector(localVector1, localWTPart))
          continue;
        localVector1.addElement(localWTPart);
      }
      else
      {
        Vector localVector4 = new Vector();
        localVector4 = getTopPartListByPart(localWTPart);
      }

    }

    return localVector1;
  }
//上级零件
  public static Vector getParentPartListByPart(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector = new Vector();
    try
    {
      WTPartMaster localWTPartMaster = (WTPartMaster)paramWTPart.getMaster();
      Object localObject = null;
      QueryResult localQueryResult = StructHelper.service.navigateUsedBy(localWTPartMaster, true);
      while (localQueryResult.hasMoreElements())
      {
        WTPart localWTPart = (WTPart)localQueryResult.nextElement();
        if ((ObjectUtil.isPersistableInobjVector(localVector, localWTPart)) || 
          (localWTPart == null)) continue;
        localVector.addElement(localWTPart);
      }

    }
    catch (WTException localWTException)
    {
      localWTException.printStackTrace();
    }

    return localVector;
  }

  public static String getPartVersionNumber(WTPart paramWTPart)
    throws WTException
  {
    String str = "";
    try
    {
      str = VersionControlHelper.getVersionIdentifier(paramWTPart).getValue();
    }
    catch (VersionControlException localVersionControlException)
    {
      localVersionControlException.printStackTrace();
    }
    return str;
  }
//返回版本
  public static String getPartReversionNumber(WTPart paramWTPart)
    throws WTException
  {
    String str = "";
    try
    {
      str = VersionControlHelper.getIterationIdentifier(paramWTPart).getValue();
    }
    catch (VersionControlException localVersionControlException)
    {
      localVersionControlException.printStackTrace();
    }
    return str;
  }

  public static WTPart getPreVersionPart(WTPart paramWTPart)
    throws WTException
  {
    WTPart localWTPart = null;

    String str1 = getPartReversionNumber(paramWTPart);

    String str2 = getPartVersionNumber(paramWTPart);

    int i = 1;
    if (str2.equals("A")) {
      return null;
    }
    try
    {
      QueryResult localQueryResult = VersionControlHelper.service.allVersionsFrom(paramWTPart);
      if (localQueryResult != null) {
        while ((localQueryResult.hasMoreElements()) && (i != 0))
        {
          localWTPart = (WTPart)localQueryResult.nextElement();
          String str3 = VersionControlHelper.getVersionIdentifier(localWTPart).getValue();

          if (str3.equalsIgnoreCase(str2))
          {
            continue;
          }
          i = 0;
        }
      }
    }
    catch (WTException localWTException)
    {
      localWTException.printStackTrace();
    }
    return localWTPart;
  }

  public static Vector getRelatedDocListByPart(WTPart paramWTPart)
    throws WTException
  {
    if (paramWTPart == null)
      return null;
    Vector localVector = new Vector();

    QueryResult localQueryResult = PartDocHelper.service.getAssociatedDocuments(paramWTPart);

    while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
    {
      WTObject localWTObject = (WTObject)localQueryResult.nextElement();
      if ((localWTObject instanceof WTDocument))
        localVector.addElement(localWTObject);
    }
    return localVector;
  }

  public static double getQuantityOfUsagelink(WTPartUsageLink paramWTPartUsageLink)
    throws WTException
  {
    Quantity localQuantity = paramWTPartUsageLink.getQuantity();
    double d = 0.0D;
    if (localQuantity != null)
      d = localQuantity.getAmount();
    return d;
  }

  public static String getUnitOfUsagelink(WTPartUsageLink paramWTPartUsageLink)
    throws WTException
  {
    Quantity localQuantity = paramWTPartUsageLink.getQuantity();
    String str = "ea";
    if (localQuantity != null)
      str = localQuantity.getUnit().toString();
    return str;
  }

  public static String getContainerNameByPart(WTPart paramWTPart)
    throws WTException
  {
    String str = "";
    if (paramWTPart != null)
    {
      WTContainer localWTContainer = paramWTPart.getContainer();
      str = localWTContainer.getName();
    }

    return str;
  }

  public static WTPartUsageLink createUsageLink(WTPart paramWTPart1, WTPart paramWTPart2, long paramLong, String paramString, double paramDouble, boolean paramBoolean)
    throws WTException
  {
    String str = new Long(paramLong).toString();

    if ((paramWTPart1 == null) || (paramWTPart2 == null)) {
      return null;
    }
    WTPartUsageLink localWTPartUsageLink = null;
    Vector localVector = new Vector();
    localVector = getPartUsageLink(paramWTPart1, paramWTPart2, paramString, paramDouble, str);
    if (localVector.size() > 0)
    {
      if (VERBOSE)
        System.out.println("系统中已存在这样的link!!!");
      localWTPartUsageLink = (WTPartUsageLink)localVector.elementAt(0);
      return localWTPartUsageLink;
    }

    if (VERBOSE) {
      System.out.println("创建新的link!!!");
    }

    if (paramBoolean == true) {
      paramWTPart1 = (WTPart)VcUtil.checkoutObject(paramWTPart1);
    }

    WTPartMaster localWTPartMaster = (WTPartMaster)paramWTPart2.getMaster();

    localWTPartUsageLink = WTPartUsageLink.newWTPartUsageLink(paramWTPart1, localWTPartMaster);
    try
    {
      localWTPartUsageLink.setLineNumber(LineNumber.newLineNumber(paramLong));

      localWTPartUsageLink.setQuantity(Quantity.newQuantity(paramDouble, QuantityUnit.toQuantityUnit(paramString)));

      if (paramBoolean == true)
      {
        PersistenceHelper.manager.save(localWTPartUsageLink);
        if (VERBOSE) {
          System.out.println("create usageLink.....");
        }

      }
      else
      {
        Transaction localTransaction = new Transaction();
        try
        {
          localTransaction.start();

          PersistenceServerHelper.manager.lock(paramWTPart1, true);

          System.out.println(" Start Directoy Create......");

          PersistenceServerHelper.manager.insert(localWTPartUsageLink);
          System.out.println(" End Directoy Create......");

          localTransaction.commit();
          localTransaction = null;
        }
        finally
        {
          if (localTransaction != null)
            localTransaction.rollback();
        }
      }
    }
    catch (WTPropertyVetoException localWTPropertyVetoException)
    {
      throw new WTException(localWTPropertyVetoException);
    }

    if (paramBoolean == true) {
      VcUtil.checkinObject(paramWTPart1, "");
    }
    return localWTPartUsageLink;
  }

  public static Vector getPartUsageLinkList(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector = new Vector();
    if (paramWTPart == null) {
      return null;
    }

    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartMasters(paramWTPart);
    while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
    {
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)localQueryResult.nextElement();
      localVector.addElement(localWTPartUsageLink);
    }
    return localVector;
  }

  public static Vector getPartUsageLinkListWithOccurence(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector = new Vector();

    if (paramWTPart == null)
      return null;
    WTPartConfigSpec localWTPartConfigSpec = WTPartHelper.service.findWTPartConfigSpec();

    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartsWithAllOccurrences(paramWTPart, localWTPartConfigSpec);

    while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
    {
      Persistable[] arrayOfPersistable = (Persistable[])localQueryResult.nextElement();
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)arrayOfPersistable[0];
      localVector.addElement(localWTPartUsageLink);
    }
    return localVector;
  }

  public static WTPart renamePart(WTPart paramWTPart, String paramString)
    throws WTException
  {
    if (paramWTPart.getName().equals(paramString))
      return paramWTPart;
    Identified localIdentified = null;
    localIdentified = (Identified)paramWTPart.getMaster();
    WTPartMasterIdentity localWTPartMasterIdentity = (WTPartMasterIdentity)localIdentified.getIdentificationObject();
    try
    {
      localWTPartMasterIdentity.setName(paramString);
      localIdentified = IdentityHelper.service.changeIdentity(localIdentified, localWTPartMasterIdentity);
    }
    catch (WTPropertyVetoException localWTPropertyVetoException)
    {
      throw new WTException(localWTPropertyVetoException);
    }
    return paramWTPart;
  }

  public static WTPart revisePart(WTPart paramWTPart, boolean paramBoolean)
    throws WTException
  {
    if (paramWTPart == null) {
      return null;
    }

    paramWTPart = (WTPart)VcUtil.checkinObject(paramWTPart, "");

    WTPart localWTPart = paramWTPart;
    RevisionControlled localRevisionControlled = null;
    try
    {
      localRevisionControlled = (RevisionControlled)VersionControlHelper.service.newVersion(localWTPart);
    }
    catch (WTPropertyVetoException localWTPropertyVetoException)
    {
      throw new WTException(localWTPropertyVetoException);
    }

    localRevisionControlled = (RevisionControlled)PersistenceHelper.manager.save(localRevisionControlled);

    if (paramBoolean) {
      localRevisionControlled = (RevisionControlled)VcUtil.checkoutObject((WTPart)localRevisionControlled);
    }

    return (WTPart)localRevisionControlled;
  }

  public static WTPartDescribeLink getDescribeLinkBetweenPartAndDoc(WTPart paramWTPart, WTDocument paramWTDocument)
    throws WTException
  {
    if ((paramWTPart == null) || (paramWTDocument == null)) {
      return null;
    }

    Vector localVector = new Vector();

    QueryResult localQueryResult = WTPartHelper.service.getDescribedByWTDocuments(paramWTPart, false);
    if ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
    {
      while (localQueryResult.hasMoreElements())
      {
        WTObject localWTObject = (WTObject)localQueryResult.nextElement();
        localVector.addElement(localWTObject);
      }

    }

    if ((localVector != null) && (localVector.size() > 0))
    {
      for (int i = 0; i < localVector.size(); i++)
      {
        WTPartDescribeLink localWTPartDescribeLink = (WTPartDescribeLink)localVector.elementAt(i);
        WTDocument localWTDocument = (WTDocument)localWTPartDescribeLink.getDescribedBy();

        if (PersistenceHelper.isEquivalent(localWTDocument, paramWTDocument) == true)
          return localWTPartDescribeLink;
      }
    }
    return null;
  }

  public static WTPartReferenceLink getReferenceLinkBetweenPartAndDoc(WTPart paramWTPart, WTDocument paramWTDocument)
    throws WTException
  {
    if ((paramWTPart == null) || (paramWTDocument == null)) {
      return null;
    }

    String str1 = paramWTDocument.getNumber();

    QueryResult localQueryResult = PersistenceHelper.manager.navigate(paramWTPart, "references", WTPartReferenceLink.class, false);
    while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
    {
      WTPartReferenceLink localWTPartReferenceLink = (WTPartReferenceLink)localQueryResult.nextElement();

      WTDocumentMaster localWTDocumentMaster = (WTDocumentMaster)localWTPartReferenceLink.getReferences();

      String str2 = localWTDocumentMaster.getNumber();

      if (str2.compareToIgnoreCase(str1) == 0)
        return localWTPartReferenceLink;
    }
    return null;
  }

  public static boolean isEqualOfTwoUsageLink(WTPartUsageLink paramWTPartUsageLink1, WTPartUsageLink paramWTPartUsageLink2, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, boolean paramBoolean4, boolean paramBoolean5)
    throws WTException
  {
    if ((paramWTPartUsageLink1 == null) || (paramWTPartUsageLink2 == null))
      return false;
    Object localObject1;
    Object localObject2;
    if (paramBoolean1)
    {
      localObject1 = (WTPartMaster)paramWTPartUsageLink1.getObject("uses");

      String str1 = ((WTPartMaster)localObject1).getNumber();

      WTPartMaster localWTPartMaster = (WTPartMaster)paramWTPartUsageLink2.getObject("uses");

      localObject2 = localWTPartMaster.getNumber();

      if (str1.compareToIgnoreCase((String)localObject2) != 0) {
        return false;
      }
    }

    if (paramBoolean2)
    {
      localObject1 = paramWTPartUsageLink1.getLineNumber();
      long l1 = 0L;
      if (localObject1 != null) {
        l1 = ((LineNumber)localObject1).getValue();
      }

      localObject2 = paramWTPartUsageLink2.getLineNumber();
      long l2 = 0L;
      if (localObject2 != null) {
        l2 = ((LineNumber)localObject2).getValue();
      }

      if (l1 != l2) {
        return false;
      }
    }

    if (paramBoolean3)
    {
      localObject1 = paramWTPartUsageLink1.getQuantity().getUnit().toString();

      String str2 = paramWTPartUsageLink2.getQuantity().getUnit().toString();

      System.out.println("需要比较单位");
      System.out.println("qtunit1 =" + (String)localObject1);
      System.out.println("qtunit2 =" + str2);

      if (((String)localObject1).compareToIgnoreCase(str2) != 0) {
        return false;
      }
    }

    if (paramBoolean4)
    {
      double d1 = paramWTPartUsageLink1.getQuantity().getAmount();

      double d2 = paramWTPartUsageLink2.getQuantity().getAmount();

      System.out.println("需要比较数量");
      System.out.println("qtamount1 =" + d1);
      System.out.println("qtamount2 =" + d2);

      if (d1 != d2) {
        return false;
      }
    }

    if (paramBoolean5)
    {
      Vector localVector1 = paramWTPartUsageLink1.getUsesOccurrenceVector();
      if ((localVector1 == null) || (localVector1.size() == 0)) {
        System.out.println("vecOccurence1 is null");
      }
      else
      {
        for (int i = 0; i < localVector1.size(); i++)
        {
          String str3 = ((PartUsesOccurrence)localVector1.elementAt(i)).getUsesName();
          if (VERBOSE) {
            System.out.println("Occurence1:  " + str3);
          }
        }
      }

      Vector localVector2 = paramWTPartUsageLink2.getUsesOccurrenceVector();
      if ((localVector2 == null) || (localVector2.size() == 0)) {
        System.out.println("vecOccurence2 is null");
      }
      else
      {
        for (int j = 0; j < localVector2.size(); j++)
        {
          localObject2 = ((PartUsesOccurrence)localVector2.elementAt(j)).getUsesName();
          if (VERBOSE) {
            System.out.println("Occurence2:  " + (String)localObject2);
          }
        }
      }

      if ((localVector1 == null) && (localVector2 == null)) {
        return true;
      }

      if ((localVector1 != null) && (localVector2 != null))
      {
        return isUsageLinkOccurenceEqual(localVector1, localVector2);
      }

      return false;
    }

    return true;
  }

  public static Vector getAddedLinksOfTwoLinksList(Vector paramVector1, Vector paramVector2, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, boolean paramBoolean4, boolean paramBoolean5)
    throws WTException
  {
    int i = 0;

    Vector localVector = new Vector();

    if ((paramVector2 == null) || (paramVector2.size() == 0)) {
      return null;
    }

    if ((paramVector1 == null) || (paramVector1.size() == 0)) {
      return paramVector2;
    }

    for (int j = 0; j < paramVector2.size(); j++)
    {
      i = 0;

      WTPartUsageLink localWTPartUsageLink1 = (WTPartUsageLink)paramVector2.elementAt(j);

      for (int k = 0; k < paramVector1.size(); k++)
      {
        WTPartUsageLink localWTPartUsageLink2 = (WTPartUsageLink)paramVector1.elementAt(k);

        if (isEqualOfTwoUsageLink(localWTPartUsageLink1, localWTPartUsageLink2, paramBoolean1, paramBoolean2, paramBoolean3, paramBoolean4, paramBoolean5) != true)
          continue;
        i = 1;
        break;
      }

      if (i == 0) {
        localVector.addElement(localWTPartUsageLink1);
      }
    }

    if ((localVector != null) && (localVector.size() > 0))
      return localVector;
    return null;
  }

  public static Vector getRemovedLinksOfTwoLinksList(Vector paramVector1, Vector paramVector2, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, boolean paramBoolean4, boolean paramBoolean5)
    throws WTException
  {
    return getAddedLinksOfTwoLinksList(paramVector2, paramVector1, paramBoolean1, paramBoolean2, paramBoolean3, paramBoolean4, paramBoolean5);
  }

  public static Vector getUpdatedLinksOfTwoLinksList(Vector paramVector1, Vector paramVector2, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3)
    throws WTException
  {
    Vector localVector = new Vector();

    if ((paramVector1 == null) || (paramVector1.size() == 0)) {
      return null;
    }

    if ((paramVector2 == null) || (paramVector2.size() == 0)) {
      return null;
    }

    for (int i = 0; i < paramVector2.size(); i++)
    {
      WTPartUsageLink localWTPartUsageLink1 = (WTPartUsageLink)paramVector2.elementAt(i);

      int j = 0;

      for (int k = 0; k < paramVector1.size(); k++)
      {
        WTPartUsageLink localWTPartUsageLink2 = (WTPartUsageLink)paramVector1.elementAt(k);

        if (isEqualOfTwoUsageLink(localWTPartUsageLink2, localWTPartUsageLink1, paramBoolean1, paramBoolean2, false, false, paramBoolean3) != true)
        {
          continue;
        }
        if (isEqualOfTwoUsageLink(localWTPartUsageLink2, localWTPartUsageLink1, false, false, false, true, false) != true)
          continue;
        j = 1;
        break;
      }

      if (j != 0)
        continue;
      localVector.addElement(localWTPartUsageLink1);
    }

    return localVector;
  }

  public static boolean hasUsageLink(WTPart paramWTPart1, WTPart paramWTPart2)
    throws WTException
  {
    int i = 0;
    Vector localVector = getFirstLevelSubPartListByPart(paramWTPart1, "");
    for (int j = 0; j < localVector.size(); j++)
    {
      if (!localVector.elementAt(j).toString().equals(paramWTPart2.toString()))
        continue;
      i = 1;
      break;
    }

    return i;
  }

  public static Vector getPartUsageLink(WTPart paramWTPart1, WTPart paramWTPart2, String paramString, double paramDouble)
    throws WTException
  {
    Vector localVector = new Vector();
    if ((paramWTPart1 == null) || (paramWTPart2 == null)) {
      return null;
    }

    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartMasters(paramWTPart1);
    if ((localQueryResult != null) && (localQueryResult.size() <= 0)) {
      return null;
    }

    while (localQueryResult.hasMoreElements())
    {
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)localQueryResult.nextElement();
      WTPartMaster localWTPartMaster = (WTPartMaster)localWTPartUsageLink.getUses();
      WTPart localWTPart = getLatestPartByPartMaster(localWTPartMaster);

      String str = getUnitOfUsagelink(localWTPartUsageLink);
      double d = getQuantityOfUsagelink(localWTPartUsageLink);

      if ((localWTPart.getNumber().compareToIgnoreCase(paramWTPart2.getNumber()) == 0) && (str.compareToIgnoreCase(paramString) == 0) && (d == paramDouble)) {
        localVector.addElement(localWTPartUsageLink);
      }
    }
    return localVector;
  }

  public static Vector getPartUsageLink(WTPart paramWTPart1, WTPart paramWTPart2, String paramString1, double paramDouble, String paramString2)
    throws WTException
  {
    Vector localVector = new Vector();
    if ((paramWTPart1 == null) || (paramWTPart2 == null)) {
      return null;
    }

    ConfigSpec localConfigSpec = ConfigHelper.service.getDefaultConfigSpecFor(WTPartMaster.class);
    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartsWithAllOccurrences(paramWTPart1, localConfigSpec);
    if ((localQueryResult != null) && (localQueryResult.size() <= 0)) {
      return null;
    }

    while (localQueryResult.hasMoreElements())
    {
      Persistable[] arrayOfPersistable = (Persistable[])localQueryResult.nextElement();
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)arrayOfPersistable[0];

      WTPartMaster localWTPartMaster = (WTPartMaster)localWTPartUsageLink.getUses();
      WTPart localWTPart = getLatestPartByPartMaster(localWTPartMaster);

      String str1 = getUnitOfUsagelink(localWTPartUsageLink);

      double d = getQuantityOfUsagelink(localWTPartUsageLink);

      LineNumber localLineNumber = localWTPartUsageLink.getLineNumber();
      String str2 = "";
      if (localLineNumber != null) {
        str2 = localLineNumber.toString();
      }

      if ((localWTPart.getNumber().compareToIgnoreCase(paramWTPart2.getNumber()) == 0) && (str1.compareToIgnoreCase(paramString1) == 0) && (d == paramDouble) && (str2.compareToIgnoreCase(paramString2) == 0)) {
        localVector.addElement(localWTPartUsageLink);
      }
    }
    return localVector;
  }

  public static Vector getPartUsageLink(WTPart paramWTPart1, WTPart paramWTPart2, String paramString1, double paramDouble, String paramString2, Vector paramVector)
    throws WTException
  {
    Vector localVector1 = new Vector();
    if ((paramWTPart1 == null) || (paramWTPart2 == null)) {
      return null;
    }

    WTPartConfigSpec localWTPartConfigSpec = WTPartHelper.service.findWTPartConfigSpec();
    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartsWithAllOccurrences(paramWTPart1, localWTPartConfigSpec);
    if ((localQueryResult != null) && (localQueryResult.size() <= 0)) {
      return null;
    }

    while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
    {
      Persistable[] arrayOfPersistable = (Persistable[])localQueryResult.nextElement();
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)arrayOfPersistable[0];

      WTPartMaster localWTPartMaster = (WTPartMaster)localWTPartUsageLink.getObject("uses");
      WTPart localWTPart = getLatestPartByPartMaster(localWTPartMaster);

      String str1 = getUnitOfUsagelink(localWTPartUsageLink);
      double d = getQuantityOfUsagelink(localWTPartUsageLink);

      LineNumber localLineNumber = localWTPartUsageLink.getLineNumber();
      String str2 = "";
      if (localLineNumber != null) {
        str2 = localLineNumber.toString();
      }

      Vector localVector2 = localWTPartUsageLink.getUsesOccurrenceVector();
      int i = 0;
      if (((localVector2 != null) && (paramVector == null)) || (
        (localVector2 == null) && (paramVector != null)))
        continue;
      if ((localVector2 == null) && (paramVector == null))
        i = 1;
      if (isUsageLinkOccurenceEqual(paramVector, localVector2)) {
        i = 1;
      }
      if (i == 0) {
        continue;
      }
      if ((localWTPart.getNumber().compareToIgnoreCase(paramWTPart2.getNumber()) == 0) && (str1.compareToIgnoreCase(paramString1) == 0) && (d == paramDouble) && (str2.compareToIgnoreCase(paramString2) == 0));
      localVector1.addElement(localWTPartUsageLink);
    }

    return localVector1;
  }

  public static int removeUsageLink(WTPart paramWTPart1, WTPart paramWTPart2, long paramLong, String paramString, double paramDouble, Vector paramVector, boolean paramBoolean)
    throws WTException
  {
    int i = 0;

    if ((paramWTPart1 == null) || (paramWTPart2 == null)) {
      return 0;
    }

    if (paramBoolean == true) {
      paramWTPart1 = (WTPart)VcUtil.checkoutObject(paramWTPart1);
    }

    ConfigSpec localConfigSpec = ConfigHelper.service.getDefaultConfigSpecFor(WTPartMaster.class);
    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartsWithAllOccurrences(paramWTPart1, localConfigSpec);

    while (localQueryResult.hasMoreElements())
    {
      Persistable[] arrayOfPersistable = (Persistable[])localQueryResult.nextElement();
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)arrayOfPersistable[0];

      WTPartMaster localWTPartMaster = (WTPartMaster)localWTPartUsageLink.getObject("uses");
      String str1 = localWTPartMaster.getNumber();
      String str2 = paramWTPart2.getNumber();

      if (VERBOSE) {
        System.out.println("pmnumber =" + str1 + "childnumber =" + str2);
      }

      if (str1.compareToIgnoreCase(str2) != 0)
        continue;
      if (VERBOSE)
        System.out.println("removedUsageLinkCount =" + i);
      Object localObject1;
      if (paramLong > 0L)
      {
        localObject1 = localWTPartUsageLink.getLineNumber();
        long l = 0L;
        if (localObject1 != null) {
          l = ((LineNumber)localObject1).getValue();
        }

        if (l != paramLong)
        {
          continue;
        }
      }
      if (paramString.length() != 0)
      {
        localObject1 = localWTPartUsageLink.getQuantity().getUnit().toString();

        if (((String)localObject1).compareToIgnoreCase(paramString) != 0)
        {
          continue;
        }
      }
      if (paramDouble > 0.0D)
      {
        double d = localWTPartUsageLink.getQuantity().getAmount();
        if (d != paramDouble)
          continue;
      }
      Object localObject2;
      if ((paramVector != null) && (paramVector.size() > 0))
      {
        localObject2 = localWTPartUsageLink.getUsesOccurrenceVector();
        if (!isUsageLinkOccurenceEqual(paramVector, (Vector)localObject2)) {
          continue;
        }

      }
      else if (VERBOSE) {
        System.out.println("occurrence is null!");
      }

      if (paramBoolean == true)
      {
        PersistenceHelper.manager.delete(localWTPartUsageLink);
      }
      else
      {
        localObject2 = new Transaction();
        try
        {
          ((Transaction)localObject2).start();

          PersistenceServerHelper.manager.lock(paramWTPart1, true);

          PersistenceServerHelper.manager.remove(localWTPartUsageLink);

          ((Transaction)localObject2).commit();
          localObject2 = null;
        }
        finally
        {
          if (localObject2 != null) {
            ((Transaction)localObject2).rollback();
          }
        }
      }
      i++;
    }

    if (paramBoolean == true) {
      VcUtil.checkinObject(paramWTPart1, "");
    }
    return i;
  }

  public static void outputWTPartUsageLinkList(Vector paramVector)
    throws WTException
  {
    if ((paramVector == null) || (paramVector.size() == 0)) {
      return;
    }

    System.out.println("开始输出相关信息...");
    for (int i = 0; i < paramVector.size(); i++)
    {
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)paramVector.elementAt(i);

      System.out.println("WTPartUsageLink" + (i + 1));

      outputWTPartUsageLinkinfo(localWTPartUsageLink);
    }
  }

  public static WTPart createPart(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, Folder paramFolder, WTContainer paramWTContainer)
    throws WTException
  {
    WTPart localWTPart = null;
    localWTPart = WTPart.newWTPart();
    WTContainerRef localWTContainerRef = WTContainerRef.newWTContainerRef(paramWTContainer);

    String str = EnterpriseHelper.getNumber(localWTPart, localWTContainerRef);

    localWTPart = initializeWTPart(localWTPart, str, paramString1, paramString2, paramString3, paramString4, paramString5, paramFolder, paramWTContainer, null);

    localWTPart = (WTPart)PersistenceHelper.manager.store(localWTPart);

    localWTPart = (WTPart)WorkflowUtil.setLifeCycleState(localWTPart, paramString6);
    return localWTPart;
  }

  public static WTPart createPart(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7, Folder paramFolder, WTContainer paramWTContainer)
    throws WTException
  {
    WTPart localWTPart = null;
    localWTPart = WTPart.newWTPart();

    localWTPart = initializeWTPart(localWTPart, paramString1, paramString2, paramString3, paramString4, paramString5, paramString6, paramFolder, paramWTContainer, null);

    localWTPart = (WTPart)PersistenceHelper.manager.store(localWTPart);

    localWTPart = (WTPart)WorkflowUtil.setLifeCycleState(localWTPart, paramString7);
    return localWTPart;
  }

  private static WTPart initializeWTPart(WTPart paramWTPart, String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, Folder paramFolder, WTContainer paramWTContainer, WTOrganization paramWTOrganization)
    throws WTException
  {
    PartType localPartType = null;
    ViewReference localViewReference = null;
    QuantityUnit localQuantityUnit = null;
    Source localSource = null;
    try
    {
      localPartType = PartType.toPartType(paramString3);
      localQuantityUnit = QuantityUnit.toQuantityUnit(paramString6);
      localSource = Source.toSource(paramString4);
      View localView = ViewHelper.service.getView(paramString5);
      localViewReference = ViewReference.newViewReference(localView);

      paramWTPart.setName(paramString2);
      paramWTPart.setNumber(paramString1);
      paramWTPart.setSource(localSource);
      paramWTPart.setView(localViewReference);
      paramWTPart.setDefaultUnit(localQuantityUnit);
      paramWTPart.setPartType(localPartType);
      paramWTPart.setContainer(paramWTContainer);
      if (paramFolder != null)
      {
        FolderHelper.assignLocation(paramWTPart, paramFolder);
      }
      if (paramWTOrganization != null)
        paramWTPart.setOrganization(paramWTOrganization);
    }
    catch (Exception localException)
    {
      throw new WTException(localException.getLocalizedMessage());
    }
    return paramWTPart;
  }

  public static boolean isPartExist(String paramString)
    throws WTException
  {
    WTPart localWTPart = null;
    localWTPart = getWTPartByNumber(paramString);

    return localWTPart != null;
  }

  public static boolean isEqual(Vector paramVector1, Vector paramVector2)
  {
    if (paramVector1.size() != paramVector2.size()) {
      return false;
    }

    for (int i = 0; i < paramVector1.size(); i++)
    {
      if (paramVector1.elementAt(i).toString() != paramVector2.elementAt(i).toString()) {
        return false;
      }
    }
    return true;
  }

  public static void outputWTPartUsageLinkinfo(WTPartUsageLink paramWTPartUsageLink)
    throws WTException
  {
    if (paramWTPartUsageLink == null) {
      return;
    }

    WTPart localWTPart = (WTPart)paramWTPartUsageLink.getObject("usedBy");
    System.out.println("\tpartparent number: " + localWTPart.getNumber());

    WTPartMaster localWTPartMaster = (WTPartMaster)paramWTPartUsageLink.getObject("uses");
    System.out.println("\tpgetQuantityOfUsagelinkartmaster number: " + localWTPartMaster.getNumber());

    LineNumber localLineNumber = paramWTPartUsageLink.getLineNumber();
    long l = 0L;
    if (localLineNumber != null) {
      l = localLineNumber.getValue();
    }
    System.out.println("\tlinenumber: " + l);

    String str1 = paramWTPartUsageLink.getQuantity().getUnit().toString();
    System.out.println("\tunit: " + str1);

    double d = paramWTPartUsageLink.getQuantity().getAmount();
    System.out.println("\tamount: " + d);

    Vector localVector = paramWTPartUsageLink.getUsesOccurrenceVector();
    if ((localVector == null) || (localVector.size() == 0)) {
      System.out.println("\tvecOccurence is null");
    }
    else
    {
      for (int i = 0; i < localVector.size(); i++)
      {
        String str2 = ((PartUsesOccurrence)localVector.elementAt(i)).getUsesName();
        System.out.println("\tOccurence:  " + str2);
      }
    }
  }

  public static boolean isUsageLinkOccurenceEqual(Vector paramVector1, Vector paramVector2)
  {
    Vector localVector1 = new Vector();
    Vector localVector2 = new Vector();

    if (paramVector1.size() != paramVector2.size()) {
      return false;
    }

    for (int i = 0; i < paramVector1.size(); i++)
    {
      PartUsesOccurrence localPartUsesOccurrence1 = (PartUsesOccurrence)paramVector1.elementAt(i);
      localVector1.add(localPartUsesOccurrence1.getUsesName());

      PartUsesOccurrence localPartUsesOccurrence2 = (PartUsesOccurrence)paramVector2.elementAt(i);
      String str = localPartUsesOccurrence2.getUsesName();

      if (str == null)
      {
        if (VERBOSE)
          System.out.println("str is null...");
        str = "";
      }
      localVector2.add(str);
    }

    localVector1 = StringUtil.sortStringVector(localVector1, true);

    localVector2 = StringUtil.sortStringVector(localVector2, true);

    return isVectorString(localVector1, localVector2);
  }

  public static boolean isVectorString(Vector paramVector1, Vector paramVector2)
  {
    if (paramVector1.size() == paramVector2.size())
    {
      for (int i = 0; i < paramVector1.size(); i++)
      {
        String str1 = (String)paramVector1.elementAt(i);
        String str2 = (String)paramVector2.elementAt(i);

        if (str1.compareTo(str2) != 0) {
          return false;
        }
      }
    }
    return false;
    return true;
  }

  public static Vector getRelatedDocListByPart(WTPart paramWTPart, boolean paramBoolean1, boolean paramBoolean2)
    throws WTException
  {
    if (paramWTPart == null) {
      return null;
    }
    Vector localVector = new Vector();
    QueryResult localQueryResult;
    Object localObject;
    if (paramBoolean1 == true)
    {
      localQueryResult = WTPartHelper.service.getDescribedByWTDocuments(paramWTPart);
      while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
      {
        localObject = (WTObject)localQueryResult.nextElement();
        if ((localObject instanceof WTDocument)) {
          localVector.addElement(localObject);
        }
      }
    }
    if (paramBoolean2 == true)
    {
      localQueryResult = PersistenceHelper.manager.navigate(paramWTPart, "references", WTPartReferenceLink.class, false);
      while ((localQueryResult != null) && (localQueryResult.hasMoreElements()))
      {
        localObject = (WTPartReferenceLink)localQueryResult.nextElement();

        WTDocumentMaster localWTDocumentMaster = (WTDocumentMaster)((WTPartReferenceLink)localObject).getReferences();

        WTDocument localWTDocument = DocUtil.getLatestWTDocument(localWTDocumentMaster);
        localVector.addElement(localWTDocument);
      }
    }
    return (Vector)localVector;
  }

  public static WTPart getWTPartByNumberAndView(String paramString1, String paramString2)
    throws WTException
  {
    WTPartMaster localWTPartMaster = getWTPartMasterByNumber(paramString1);
    if (localWTPartMaster == null) {
      return null;
    }
    return getWTPartByMasterAndView(localWTPartMaster, paramString2);
  }

  public static WTPart getWTPartByMasterAndView(WTPartMaster paramWTPartMaster, String paramString)
    throws WTException
  {
    Object localObject = null;
    View localView = ViewHelper.service.getView(paramString);
    WTPartConfigSpec localWTPartConfigSpec = WTPartHelper.service.findWTPartConfigSpec();
    WTPartStandardConfigSpec localWTPartStandardConfigSpec = localWTPartConfigSpec.getStandard();
    try
    {
      localWTPartStandardConfigSpec.setView(localView);
    }
    catch (WTPropertyVetoException localWTPropertyVetoException)
    {
      throw new WTException(localWTPropertyVetoException);
    }
    QueryResult localQueryResult = ConfigHelper.service.filteredIterationsOf(paramWTPartMaster, localWTPartStandardConfigSpec);
    while (localQueryResult.hasMoreElements())
    {
      WTPart localWTPart = (WTPart)localQueryResult.nextElement();
      ViewReference localViewReference = localWTPart.getView();
      String str = "";
      if (localViewReference != null)
        str = localViewReference.getName();
      if ((str.length() == 0) || (!str.equals(paramString)) || 
        (!localWTPart.isLatestIteration()))
        continue;
      localObject = localWTPart;
    }

    if (localObject == null)
      localObject = getLatestPartByPartMaster(paramWTPartMaster);
    return (WTPart)localObject;
  }

  public static EPMDocument getBuiltEPMDocByPart(WTPart paramWTPart)
    throws WTException
  {
    QueryResult localQueryResult = PersistenceHelper.manager.navigate(paramWTPart, "buildSource", EPMBuildRule.class, true);
    Persistable localPersistable;
    EPMDocument localEPMDocument;
    while (localQueryResult.hasMoreElements())
    {
      localPersistable = (Persistable)localQueryResult.nextElement();
      if (!(localPersistable instanceof EPMDocument))
        continue;
      localEPMDocument = (EPMDocument)localPersistable;
      return localEPMDocument;
    }

    localQueryResult = PersistenceHelper.manager.navigate(paramWTPart, "builtBy", EPMBuildHistory.class, true);
    while (localQueryResult.hasMoreElements())
    {
      localPersistable = (Persistable)localQueryResult.nextElement();
      if (!(localPersistable instanceof EPMDocument))
        continue;
      localEPMDocument = (EPMDocument)localPersistable;
      return localEPMDocument;
    }

    return null;
  }

  public static Vector getRelatedCADListByPart(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector = new Vector();
    if (paramWTPart == null)
    {
      return localVector;
    }

    QueryResult localQueryResult = WTPartHelper.service.getDescribedByDocuments(paramWTPart, true);
    while (localQueryResult.hasMoreElements())
    {
      Object localObject = localQueryResult.nextElement();
      if (!(localObject instanceof EPMDocument))
        continue;
      EPMDocument localEPMDocument1 = (EPMDocument)localObject;
      if (localEPMDocument1 == null)
        continue;
      EPMDocument localEPMDocument2 = EPMUtil.getLatestEPMDocByMaster((EPMDocumentMaster)localEPMDocument1.getMaster());
      localVector.add(localEPMDocument2);
    }

    return localVector;
  }

  public static Vector getActiveCADandReferenceDoc(WTPart paramWTPart, boolean paramBoolean)
    throws WTException
  {
    Vector localVector = new Vector();
    EPMDocument localEPMDocument1 = getBuiltEPMDocByPart(paramWTPart);
    if (localEPMDocument1 != null)
    {
      if (!ObjectUtil.isPersistableInobjVector(localVector, localEPMDocument1))
        localVector.add(localEPMDocument1);
      if (paramBoolean)
      {
        QuerySpec localQuerySpec = new QuerySpec(EPMReferenceLink.class);
        QueryResult localQueryResult = EPMStructureHelper.service.navigateReferencedBy((EPMDocumentMaster)localEPMDocument1.getMaster(), localQuerySpec, true);
        while (localQueryResult.hasMoreElements())
        {
          EPMDocument localEPMDocument2 = (EPMDocument)localQueryResult.nextElement();
          if ((!ObjectUtil.isPersistableInobjVector(localVector, localEPMDocument2)) && (localEPMDocument2.isLatestIteration()))
            localVector.add(localEPMDocument2);
        }
      }
    }
    return localVector;
  }

  public static Vector getPassiveCADandReferenceDoc(WTPart paramWTPart, boolean paramBoolean)
    throws WTException
  {
    Vector localVector = new Vector();
    QueryResult localQueryResult1 = PartDocHelper.service.getAssociatedDocuments(paramWTPart);
    WTObject localWTObject = null;
    EPMDocument localEPMDocument1 = null;
    while (localQueryResult1.hasMoreElements())
    {
      localWTObject = (WTObject)localQueryResult1.nextElement();
      if (!(localWTObject instanceof IteratedDescribeLink))
        continue;
      localEPMDocument1 = (EPMDocument)((IteratedDescribeLink)localWTObject).getDescribedBy();
      if (!ObjectUtil.isPersistableInobjVector(localVector, localEPMDocument1))
        localVector.add(localEPMDocument1);
      if (!paramBoolean)
        continue;
      QuerySpec localQuerySpec = new QuerySpec(EPMReferenceLink.class);
      QueryResult localQueryResult2 = EPMStructureHelper.service.navigateReferencedBy((EPMDocumentMaster)localEPMDocument1.getMaster(), localQuerySpec, true);
      while (localQueryResult2.hasMoreElements())
      {
        EPMDocument localEPMDocument2 = (EPMDocument)localQueryResult2.nextElement();
        if ((!ObjectUtil.isPersistableInobjVector(localVector, localEPMDocument2)) && (localEPMDocument2.isLatestIteration())) {
          localVector.add(localEPMDocument2);
        }
      }
    }

    return localVector;
  }

  public static WTPart getPartByActiveCADDocument(EPMDocument paramEPMDocument)
    throws WTException
  {
    WTPart localWTPart = null;
    QueryResult localQueryResult = PersistenceHelper.manager.navigate(paramEPMDocument, "buildTarget", EPMBuildRule.class, true);
    if ((localQueryResult != null) && (localQueryResult.size() > 0));
    while (localQueryResult.hasMoreElements())
    {
      Persistable localPersistable = (Persistable)localQueryResult.nextElement();
      if (!(localPersistable instanceof WTPart))
        continue;
      localWTPart = (WTPart)localPersistable;

      return getLatestPartByPartMaster((WTPartMaster)localWTPart.getMaster());

      localQueryResult = PersistenceHelper.manager.navigate(paramEPMDocument, "built", EPMBuildHistory.class, true);
      while (localQueryResult.hasMoreElements())
      {
        localPersistable = (Persistable)localQueryResult.nextElement();
        if (!(localPersistable instanceof WTPart))
          continue;
        localWTPart = (WTPart)localPersistable;
        return localWTPart;
      }
    }

    return localWTPart;
  }

  public static void removeFromWorkspace(WTPart paramWTPart)
    throws QueryException, WTException
  {
    String str = paramWTPart.getNumber();
    EPMWorkspace localEPMWorkspace = null;
    QuerySpec localQuerySpec = new QuerySpec(EPMWorkspace.class);
    QueryResult localQueryResult = PersistenceHelper.manager.find(localQuerySpec);
    WTUser localWTUser = (WTUser)SessionHelper.manager.getPrincipalReference().getObject();
    WTPrincipal localWTPrincipal = SessionHelper.manager.getPrincipal();
    SessionHelper.manager.setAdministrator();
    while (localQueryResult.hasMoreElements())
    {
      WTArrayList localWTArrayList = new WTArrayList();
      localEPMWorkspace = (EPMWorkspace)localQueryResult.nextElement();
      WTSet localWTSet = EPMWorkspaceHelper.manager.getObjectsInWorkspace(localEPMWorkspace, WTPart.class);
      Iterator localIterator = localWTSet.persistableIterator();
      while (localIterator.hasNext())
      {
        WTPart localWTPart = (WTPart)localIterator.next();
        if (localWTPart.getNumber().equals(str))
          localWTArrayList.add(localWTPart);
      }
      EPMWorkspaceHelper.manager.removeFromWorkspace(localEPMWorkspace, localWTArrayList);
    }
    SessionHelper.manager.setPrincipal(localWTPrincipal.getName());
  }

  public static Vector getFirstLevelSubPartListByPart(WTPart paramWTPart, String paramString)
    throws WTException
  {
    Vector localVector = new Vector();

    Object localObject1 = new LatestConfigSpec();
    Object localObject3;
    Object localObject4;
    if ((paramString != null) && (paramString.length() > 0))
    {
      localObject2 = ViewHelper.service.getView(paramString);
      localObject3 = WTPartHelper.service.findWTPartConfigSpec();
      localObject4 = ((WTPartConfigSpec)localObject3).getStandard();
      try
      {
        ((WTPartStandardConfigSpec)localObject4).setView((View)localObject2);
      }
      catch (WTPropertyVetoException localWTPropertyVetoException)
      {
        throw new WTException(localWTPropertyVetoException);
      }
      localObject1 = localObject4;
    }
    Object localObject2 = StructHelper.service.navigateUsesToIteration(paramWTPart, WTPartUsageLink.class, false, (ConfigSpec)localObject1);
    while ((localObject2 != null) && (((QueryResult)localObject2).hasMoreElements()))
    {
      localObject3 = (Persistable[])((QueryResult)localObject2).nextElement();

      localObject4 = (WTPartUsageLink)localObject3[0];

      Object localObject5 = localObject3[1];
      WTPart localWTPart = null;
      if ((localObject5 instanceof WTPartMaster))
      {
        localWTPart = getLatestPartByPartMaster((WTPartMaster)localObject5);
      }
      else
        localWTPart = (WTPart)localObject5;
      if ((localWTPart != null) && (!ObjectUtil.isPersistableInobjVector(localVector, localWTPart)))
        localVector.add(localWTPart);
    }
    return (Vector)(Vector)(Vector)(Vector)localVector;
  }

  public static Vector getFirstLevelSubPartListByPart(WTPart paramWTPart)
    throws WTException
  {
    Vector localVector = new Vector();

    Object localObject1 = new LatestConfigSpec();
    String str = "";
    ViewReference localViewReference = paramWTPart.getView();
    if (localViewReference != null)
      str = localViewReference.getName();
    Object localObject3;
    Object localObject4;
    if ((str != null) && (str.length() > 0))
    {
      localObject2 = ViewHelper.service.getView(str);
      localObject3 = WTPartHelper.service.findWTPartConfigSpec();
      localObject4 = ((WTPartConfigSpec)localObject3).getStandard();
      try
      {
        ((WTPartStandardConfigSpec)localObject4).setView((View)localObject2);
      }
      catch (WTPropertyVetoException localWTPropertyVetoException)
      {
        throw new WTException(localWTPropertyVetoException);
      }
      localObject1 = localObject4;
    }
    Object localObject2 = StructHelper.service.navigateUsesToIteration(paramWTPart, WTPartUsageLink.class, false, (ConfigSpec)localObject1);
    while ((localObject2 != null) && (((QueryResult)localObject2).hasMoreElements()))
    {
      localObject3 = (Persistable[])((QueryResult)localObject2).nextElement();

      localObject4 = (WTPartUsageLink)localObject3[0];

      Object localObject5 = localObject3[1];
      WTPart localWTPart = null;
      if ((localObject5 instanceof WTPartMaster))
      {
        localWTPart = getLatestPartByPartMaster((WTPartMaster)localObject5);
      }
      else
        localWTPart = (WTPart)localObject5;
      if ((localWTPart != null) && (!ObjectUtil.isPersistableInobjVector(localVector, localWTPart)))
        localVector.add(localWTPart);
    }
    return (Vector)(Vector)(Vector)(Vector)localVector;
  }

  public static Vector getPartUsageLink(WTPart paramWTPart1, WTPart paramWTPart2)
    throws WTException
  {
    Vector localVector = new Vector();
    if ((paramWTPart1 == null) || (paramWTPart2 == null)) {
      return null;
    }
    QueryResult localQueryResult = WTPartHelper.service.getUsesWTPartMasters(paramWTPart1);
    if ((localQueryResult != null) && (localQueryResult.size() <= 0)) {
      return null;
    }

    while (localQueryResult.hasMoreElements())
    {
      WTPartUsageLink localWTPartUsageLink = (WTPartUsageLink)localQueryResult.nextElement();
      WTPartMaster localWTPartMaster = (WTPartMaster)localWTPartUsageLink.getUses();
      WTPart localWTPart = getLatestPartByPartMaster(localWTPartMaster);
      if (localWTPart.getNumber().equalsIgnoreCase(paramWTPart2.getNumber())) {
        localVector.addElement(localWTPartUsageLink);
      }
    }
    return localVector;
  }

  public static boolean isLatestVersion(WTPart paramWTPart)
    throws WTException
  {
    ConfigSpec localConfigSpec = ConfigHelper.service.getConfigSpecFor(paramWTPart);
    QueryResult localQueryResult = ConfigHelper.service.filteredIterationsOf(paramWTPart.getMaster(), localConfigSpec);
    Iterated localIterated = (Iterated)localQueryResult.nextElement();

    return PersistenceHelper.isEquivalent(localIterated, paramWTPart);
  }

  public static QueryResult getSubPartsAndUsageLinks(WTPart paramWTPart)
    throws WTException
  {
    LatestConfigSpec localLatestConfigSpec = new LatestConfigSpec();
    QueryResult localQueryResult = WTPartHelper.service.getUsesWTParts(paramWTPart, localLatestConfigSpec);
    return localQueryResult;
  }

  public static QueryResult getSubPartsAndUsageLinks(WTPart paramWTPart, String paramString)
    throws WTException
  {
    View localView = null;
    if ((paramString != null) && (paramString.length() > 0))
      localView = ViewHelper.service.getView(paramString);
    WTPartConfigSpec localWTPartConfigSpec = WTPartHelper.service.findWTPartConfigSpec();
    WTPartStandardConfigSpec localWTPartStandardConfigSpec = localWTPartConfigSpec.getStandard();
    try
    {
      localWTPartStandardConfigSpec.setView(localView);
    }
    catch (WTPropertyVetoException localWTPropertyVetoException)
    {
      throw new WTException(localWTPropertyVetoException);
    }
    QueryResult localQueryResult = WTPartHelper.service.getUsesWTParts(paramWTPart, localWTPartStandardConfigSpec);
    return localQueryResult;
  }

  public static Hashtable getSubPartListByPart(WTPart paramWTPart, String paramString, Hashtable paramHashtable)
    throws WTException
  {
    Vector localVector = getFirstLevelSubPartListByPart(paramWTPart, paramString);

    for (int i = 0; i < localVector.size(); i++)
    {
      WTPart localWTPart = (WTPart)localVector.elementAt(i);
      paramHashtable.put(localWTPart.getNumber(), localWTPart);

      paramHashtable = getSubPartListByPart(localWTPart, paramString, paramHashtable);
    }
    return paramHashtable;
  }

  public static Vector getSubPartListByPart(WTPart paramWTPart, String paramString)
    throws WTException
  {
    Hashtable localHashtable = new Hashtable();
    localHashtable = getSubPartListByPart(paramWTPart, paramString, localHashtable);
    Collection localCollection = localHashtable.values();
    return new Vector(localCollection);
  }

  public static void main(String[] paramArrayOfString)
    throws WTException
  {
    ReferenceFactory localReferenceFactory = new ReferenceFactory();
    WTPart localWTPart = (WTPart)localReferenceFactory.getReference("wt.part.WTProduct:80492").getObject();
    System.out.println("part = " + localWTPart.getIdentity());

    Vector localVector = getRelatedDocListByPart(localWTPart);
    System.out.println("docVec = " + localVector.size());

    System.exit(0);
  }

  static
  {
    try
    {
      VERBOSE = WTProperties.getLocalProperties().getProperty("ext.com.part.verbose", false);
    }
    catch (Throwable localThrowable)
    {
      throw new ExceptionInInitializerError(localThrowable);
    }
  }

代码扫描整改-踩过的坑[QueryResult qr = PersistenceHelper.manager.find(qs);] 事情的经过是我在加班优化我们整个项目的技术债务的时候,利用阿里的开源插件对整个项目进行代码扫描,然后吧啦吧啦的就撸起袖子改 在修改过时API的时候,后台扫描出大量如下代码: QueryResult qr = PersistenceHelper.manager.find(qs); 提示改API已经过时,于是我就调整为了 QueryResult qr = PersistenceHelper.manag... 阅读详情

相关推荐

windchill 中根据持久化对象获取相关联的流程_不包含子流程版

public static WfProcess getRelatedProcess(Persistable obj) throws RemoteException, InvocationTargetException, WTException { if (!RemoteMethodServer.ServerFlag) { String method = "getRelatedPro...

Wonly_Wu的博客 1129

Windchill WTPart WTPartMaster 所有零件操作通用类 PartUtil.java

Windchill 零件操作通用类  包含零件的所有操作。欢迎到资源频道下载使用 让偶赚点小分哈。 优快云发帖太坑爹了,代码模式怎么也发不了。 下载地址:http://download.csdn.net/detail/lujingzong/4357128   //01. 零件号 返回 WTPart对象   public static WTPart getWTPartByNumber

Windchill 开发 记事本 7386

Windchill实战-工作流

Windchill 开发实战总结

qq_43939928的博客 1660

修改对象的版本

VersionIdentifier vc = VersionControlHelper      .getVersionIdentifier((Versioned) part);    MultilevelSeries mls = vc.getSeries();    mls.setValueWithoutValidating(version);    VersionIdentifier newV

wangbing6557的专栏 416

Windchill常见开发API

windchill开发,java,主要介绍windchill开发的基础方法

JunWeiJodn的博客 4345

手把手教你用STM32F103的IO口模拟XY2-100协议驱动数字振镜(附Keil O3优化代码)

本文详细介绍了如何使用STM32F103的IO口模拟XY2-100协议驱动数字振镜,包括协议解析、偶校验算法、寄存器级优化及Keil O3编译下的性能调优。通过硬件配置、核心代码实现和优化技巧,帮助开发者实现高速二维偏转控制,适用于工业激光雕刻和精密定位系统。

weixin_42527401的博客 260

java jmaster_Windchill WTPart WTPartMaster 所有零件操作通用类 PartUtil.java

//01. 零件号 返回 WTPart对象public static WTPart getWTPartByNumber(StringparamString)throwsWTException{WTPartlocalWTPart = null;QuerySpeclocalQuerySpec = null;QueryResultlocalQueryResult = null;localQuerySpe...

weixin_26808205的博客 607

特斯拉 Model 3解析(八)全面拆解特斯拉自动驾驶大脑:AP控制器硬核技术解析

算力极限:双FSD = 144 TOPS,专为AI推理优化。存储架构:LPDDR4 + NAND + NOR,保证高速/可靠启动。通信架构:以太网传视频,CAN传控制,TSN保障实时性。感知输入:多路摄像头 + 高速SerDes,满足全景感知。电源设计:功率模块+被动元件海洋,稳定性优先。功能安全:双芯片冗余 + GPS + 紧急呼叫,容错率极高。🎯 在我看来,特斯拉AP控制器就是一台“车载超算”,它在电源设计、存储架构和功能安全上远超一般新势力方案。

weixin_43199439的博客 1439

根据文件编号在电子仓库中查询实体文件

and master.wtdocumentnumber =< 文档编号 >;

ruyi8806的博客 251

别再到处找教程了!Windows下用FFmpeg+Mediamtx+VLC搭建本地RTSP流媒体服务器,保姆级配置流程

本文详细介绍了在Windows系统下使用FFmpeg、Mediamtx和VLC搭建本地RTSP流媒体服务器的完整流程。从环境准备到核心配置,再到推流和拉流的实战技巧,提供了保姆级的避坑指南和优化建议,帮助开发者快速实现稳定的流媒体服务部署。

weixin_42614269的博客 212

Rockchip rv1126平台在gstreamer1中添加OpenCv实现视频流负片的效果

rv1126 gstreamer opencv negetive effect

Aisy_D的专栏 1463

Windchill 二次开发中常用的API方法

windchill 二次开发新手入门api

Windchill 开发 记事本 1万+

19. SAP UI5 应用开发教程之十九 - SAP UI5 数据类型和复杂的数据绑定

通过本教程前面的步骤SAP UI5 初学者教程之十七 - 聚合绑定在 UI5 复合控件中的使用的介绍,我们已经学会了如何在 SAP UI5 里显示列表,如下图所示: 本步骤我们给该列表添加更多的业务数据,比如每张发票的金额。 按照本文的步骤完成的 SAP UI5 应用,列表如下图所示: 可以看到,同前一个步骤相比,现在 Invoices 表格里,每张发票的金额和货币单位已经显示出来了。 为了实现这个效果,本步骤的源代码位于我的 Github 这个文件夹下面: https://github.com/wan

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 3691

在windchill8.0 中如何查詢產品(WTProduct)關聯的所有零件(WTPart)

背景描述:在windchill8.0 中,要查詢產品(WTProduct)關聯的所有零件(WTPart)相關信息解決方法一:wt.vc.config.LatestConfigSpec spec = new LatestConfigSpec();//如果要實現所有版本的查詢,則用:wt.part.WTPartConfigSpec spec = WTPartConfigSpec.newWT

jason9157zb的专栏 1730

触摸芯片RM1015B基本使用方法

RM1015B触摸芯片使用指南:该芯片采用4通道设计(实际使用3通道),通过I2C接口通信(设备地址0x2B)。硬件设计需注意中断/复位引脚复用,需上拉处理。软件配置包括初始化、中断处理和定时器扫描,通过设置各通道阈值(0-300W)调节灵敏度,值越小越灵敏。调试时可调用rm1015B_debug_func()输出波形数据。典型应用场景包括接近检测和手势识别,中断触发后需在8ms内响应。特别注意不同通道的寄存器映射关系及校准流程,确保检测准确性。

云淡风轻 176

基于单片机设计的智能消防排烟窗控制系统_422

随着城市化进程的不断加快,高层建筑、大型商业综合体以及地下空间的数量迅速增加,建筑内部结构日趋复杂,一旦发生火灾,烟雾和有毒气体往往比明火更具威胁性。大量研究表明,在火灾事故中,人员伤亡的主要原因并非直接烧伤,而是由于吸入烟雾及一氧化碳等有毒气体导致窒息。因此,如何在火灾初期快速排烟、降低有害气体浓度,并及时进行预警,成为现代消防系统设计中的关键问题。传统的消防排烟系统多依赖人工操作或简单的联动控制方式,存在响应滞后、自动化程度低、信息反馈不及时等问题。在实际应用中,当火灾发生时,如果不能第一时间开启排烟窗

368

Winchill 获取发布结构子对象WTPart

String oid1="OR:wt.part.WTPart:261597138";         WTPart part=(WTPart)GenericUtil.REF_FACTORY.getReference(oid1).getObject();         out.print(part.getIdentity()+"");         QueryResult qr=WTPar

zjltju1203的博客 1060

KEPServerEX物联网网关(IoT Gateway)REST客户端代理(非原创)

(中文版)资料来源于【OPC-KEPServerEX学习KEPWare交流】905485143群的【455196383】【零下一度】 一。KEPServerEX物联网网关REST客户端代理演示 在KSE中,首先构建一个带有通道/设备/标签的模拟器系统。 例如,下面是三个随机项目。 直接到IoT网关插件,添加新代理。 从类型列表中选择REST Client。 终结点...

-雲飛兄-博客 5805

运行时异常与一般异常有何异同?

Throwable是所有Java程序中错误处理的父类,有两种资类:Error和Exception。    Error:表示由JVM所侦测到的无法预期的错误,由于这是属于JVM层次的严重错误,导致JVM无法继续执行,因此,这是不可捕捉到的,无法采取任何恢复的操作,顶多只能显示错误信息。 Exception:表示可恢复的例外,这是可捕捉到的。 Java提供了两类主要的异常:runtime exc

jeanboy 1198

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Windchill9表结构

Windchill9 表结构: wtpartdescribelink存储着部件和文档的相关关系,在部件的相关文档里能看到彼此,在 文档的相关部件里能看到彼此。 IDA3A5保存部件的ID号,可以在wtpart 表中以ida2a2的值查找部件 IDA3B5保存文档的ID号,可以在Wtdocument表中以ida2a2的值查找部件 在wtdocumentmaster或者w...

墙头草 1237

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

part相关cad对象获取

【代码】part相关cad对象获取。

oZiSeFengYe1的专栏 292

Windchill二次开发实战(12)——修改WTPart的编号和名称

Windchill二次开发实战(12)——更新WTPart的编号和名称 WTPart的编号和名称是公用属性,是WTPartMaster的属性。 如果需要修改,需要用户对某个WTPart所有版本(可能是不同状态)都有修改权限。如果对某一个版本没有修改权限,则会提示权限不足的错误信息。 如果确实业务需要,则需临时设置为管理员去修改。 public boolean updatePartIdentity(WTPart part, String newNumber, String newName) { try {

JonnyZou的博客 2011

关于Windchill中简单的操作(对象的操作,客制化操作)

Windchill10.1中常用的操作   一,操作对象。 1,  根据零件名称/编号得到该零件    wt.clients.prodmgmt.WTPartHelper.findPartByName(name);    wt.clients.prodmgmt.WTPartHelper.findPartByNumber(number); 2,  根据WTPart得到WTPartMaste

SHLCM_DGP的专栏 1万+

Windchill 11 之设置修改者[PersistenceServerHelper.manager.* 与PersistenceHelper.manager.*的区别]

/** * 设置对象的修改者 * @param obj Persistence对象 * @param uref WTPrincipalReference对象 * @throws Exception */ public static void setModifier(Iterated obj, WTPrincipalReference ur...

Wonly_Wu的博客 2566

Windchill 11.0 查询分类特征的默认值

windchill 11.0 查询分类特征的默认值方法。

蜗牛跑的快 608

Windchill中的BOM结构:子部件永远都是最新的

子部件永远都是最新的

ksdj34ksjdkeri的博客 1072
上一篇: java GMT时间转换为CST时间
下一篇: tnsnames.ora 配置 SID
普通网友
博客等级 码龄12年 15粉丝 11原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值