cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Translate the entire conversation x

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

lnoviello-2
2-Explorer

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

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 2


@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);
	}

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 

Announcements
Top Tags