Skip to main content
1-Visitor
March 11, 2025
Question

Set Revision API is failing to set same Revision for Manufacturing View Part and Design part.

  • March 11, 2025
  • 2 replies
  • 467 views

As per the original post

 

Hi Randy,

can you explain me how you modified the  getControlBranchesOf() method to add SearchConditions to limit the controlbranches to the same viewId?

Your support can be very helpful for me.

Thanks in advance

Luigi

2 replies

20-Turquoise
March 11, 2025

@lnoviello-2 wrote:

Hi Randy,

can you explain me how you modified the  getControlBranchesOf() method to add SearchConditions to limit the controlbranches to the same viewId?

Your support can be very helpful for me.

Thanks in advance

Luigi


	/**
	 * Modified over PTC's ootb to search for Control Branches with the same view id
	 * as the object we are changing the revision on.
	 * 
	 * @param paramVersioned
	 * @return
	 * @throws WTException
	 * @throws VersionControlException
	 */
	private static QueryResult getControlBranchesOf(Versioned paramVersioned) throws WTException, VersionControlException {
		QuerySpec querySpec = new QuerySpec(ControlBranch.class);
		querySpec.appendWhere((WhereExpression) VersionControlHelper.getSearchCondition(ControlBranch.class, paramVersioned.getMaster()), ARRAY_OF_ZERO);

		// This if statement is added to the ootb PTC code.
		if (paramVersioned instanceof ViewManageable) {
			ViewManageable viewManaged = (ViewManageable) paramVersioned;
			if (ViewHelper.getView(viewManaged) != null) {
				// we have a view so add condition to search for same view
				SearchCondition sameView = new SearchCondition(ControlBranch.class, "viewId", SearchCondition.EQUAL, ViewHelper.getView(viewManaged).getPersistInfo().getObjectIdentifier().getId());
				querySpec.appendAnd();
				querySpec.appendWhere(sameView, ARRAY_OF_ZERO);
			}
		}

		return PersistenceServerHelper.manager.query(querySpec);
	}
Community Moderator
April 20, 2025

Hi @lnoviello-2,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag