首页 > 代码库 > Windchill 设置大版本的代码
Windchill 设置大版本的代码
public static void setVersion(final Versioned versioned, String version) throws WTException { try { if (version == null || version.trim().length() == 0) { // If the version ID string is null then the load file did not // specify it. version = null; if (versioned.getVersionInfo() != null) { // If the object already has a VersionInfo object then // assume it is correct // and no further action is needed. Otherwise, make a // default VersionInfo object. return; } } // Get the version series of the object. MultilevelSeries mls = null; final Mastered master = versioned.getMaster(); if (master != null) { final String masterSeriesName = master.getSeries(); if (masterSeriesName == null) { if (versioned instanceof WTContained && ((WTContained) versioned).getContainer() != null) { // Retrieve the series based on the OIR in effect for // the container and object type/soft type. mls = VersionControlHelper .getVersionIdentifierSeries(versioned); wt.vc.VersionControlServerHelper.changeSeries(master, mls.getUniqueSeriesName()); } } else { // Series name was already set in the master, just use it. mls = MultilevelSeries .newMultilevelSeries(masterSeriesName); } } if (mls == null) { // Unable to get the series from the master, just use the // default series. mls = MultilevelSeries.newMultilevelSeries( "wt.vc.VersionIdentifier", version); } if (version != null) { // Set the revision ID value if it was given in the load file. mls.setValueWithoutValidating(version.trim()); } // Replace the default VID object (if there is one) with the correct // one. VersionIdentifier vid = VersionIdentifier.newVersionIdentifier(mls); VersionControlServerHelper.setVersionIdentifier(versioned, vid, false /* validateIncreasing */); } catch (WTPropertyVetoException e) { LoadServerHelper.printMessage("\nsetVersion: " + e.getMessage()); e.printStackTrace(); throw new WTException(e); } catch (Exception e) { throw new WTException(e); } }
代码由卡卡大神提供,特记录。
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。