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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Disable or hide the create PDF action for documents which was enabled by DefaultUIComponentValidator

Akash.S_121
3-Newcomer

Disable or hide the create PDF action for documents which was enabled by DefaultUIComponentValidator

Version: Windchill 12.0

 

Use Case: user need not see the action of createPDF for WtDocuments which are inside one specific folder. user did not able to perform the action. that action was enabled by DefaultUIComponentValidator.


Description:

one of the subfolders, we used for storing all approved documents and Restricted documents. if this action enabled, it allows all users to recreate the PDF without stamps that may cause data changes that to for wt documents.
user need not see the action of createPDF for WtDocuments which are inside one specific folder. user did not able to perform the action. that action was enabled by DefaultUIComponentValidator.

i already created validator but it is not working. i cannot be able to see the logs in method server.
Here is the class example:

private UIValidationResultSet validateMenuEntry(UIValidationKey vkey, UIValidationCriteria vcriteria, Locale locale) throws WTException {

UIValidationResultSet vrs = UIValidationResultSet.newInstance();

WTReference wref = vcriteria.getPageObject();

Persistable object = wref.getObject();

 

log.debug("Validating menu entry for object: " + object);

 

if (object instanceof EPMDocument) {

System.out.println("object is EPM Document");

EPMDocument doc = (EPMDocument) object;

if (doc.getDocType().toString().equalsIgnoreCase(CADDRAWING)) {

System.out.println("object is : : " + doc.getDocType().toString());

vrs.addResult(UIValidationResult.newInstance(vkey, UIValidationStatus.ENABLED));

System.out.println("object is EPM Document-- CreatePDF action was enabled");

}

} else if (object instanceof WTDocument) {

WTDocument doc = (WTDocument) object;

String typeID = TypedUtility.getTypeIdentifier(doc).getTypename();

String containerName = doc.getContainer().getName();

System.out.println("object is ::" + typeID + " , " +containerName);

vrs.addResult(UIValidationResult.newInstance(vkey, UIValidationStatus.DISABLED));

log.debug("Document type: " + typeID);

log.debug("Container name: " + containerName);

 

if ((typeID.equals(EXTERNAL_DOC_TYPE) || INTERNAL_DOC_TYPE.equals(typeID))

&& (GLOBAL_STD_LB.equals(containerName) || BRAKING_ACTUATION.equals(containerName))) {

boolean isLicenseType = ZFPLMObjectHelper.getBooleanAttributeValue(doc, LICENSE_TYPE);

String folderLocation = FolderHelper.getLocation((CabinetBased) doc);

System.out.println("License and folder location is ::" + isLicenseType + " , " +folderLocation);

log.debug("License type: " + isLicenseType);

log.debug("Folder location: " + folderLocation);

 

if (isLicenseType || RESTRICTED_ACCESS_FOLDER.equals(folderLocation)) {

vrs.addResult(UIValidationResult.newInstance(vkey, UIValidationStatus.HIDDEN));

return vrs;

}

}

// Additional check for "Documents with Restricted Access" folder

String folderLocation = FolderHelper.getLocation((CabinetBased) doc);

System.out.println("folderlocation is : " + folderLocation);

if (RESTRICTED_ACCESS_FOLDER.equalsIgnoreCase(folderLocation)) {

System.out.println("Document is in 'Documents with Restricted Access' folder. Disabling action.");

log.debug("Document is in 'Documents with Restricted Access' folder. Disabling action.");

vrs.addResult(UIValidationResult.newInstance(vkey, UIValidationStatus.DISABLED));

return vrs;

}

if (ProceedJobHelper.isAllowedFormat(doc.getFormatName())) {

vrs.addResult(UIValidationResult.newInstance(vkey, UIValidationStatus.ENABLED));

}

}

System.out.println("Proceed Menu Entry is ended...");

return vrs;

 

}

ACCEPTED SOLUTION

Accepted Solutions

Hi @Akash.S_121 

Can you share some screen shot of your action in the menu? With jcadebug enabled?

I would recommend to use &jcaDebug=1 to check if the filter is really defined for the action.

If the filter is not configured properly, you need to check all miss spelling in your definition.

in the actionModel definition if the name of your filter is same as the definition in the service.properties 

and if the service properties contains correct class, and the class is in right location in the folder structure of the server.

If you are sure that it should work, there is some mistake in your general definition. 

check all definition step by step, and check all miss spelling possibilities.  

PetrH

View solution in original post

4 REPLIES 4

Hello @Akash.S_121 

Do you have a question? or you just share a tip how to use validator for an action menu?

Help Center - Defining a New Action

Help Center - Implementing Validation Filters

 

PetrH

I do not know, why the above validator class is not calling. something i did wrong.

service.properties file updated and custom-actions.xml also updated and custom.xconf also updated.

why still this class is not called on UI. something i missed? is there any ways?

Hi @Akash.S_121 

Can you share some screen shot of your action in the menu? With jcadebug enabled?

I would recommend to use &jcaDebug=1 to check if the filter is really defined for the action.

If the filter is not configured properly, you need to check all miss spelling in your definition.

in the actionModel definition if the name of your filter is same as the definition in the service.properties 

and if the service properties contains correct class, and the class is in right location in the folder structure of the server.

If you are sure that it should work, there is some mistake in your general definition. 

check all definition step by step, and check all miss spelling possibilities.  

PetrH

Thank you @HelesicPetr ,

i did all things correct, but i mistyped the validator class location in xconf file that's why this validator is not calling.
now i resolved the issue.
thank you for your points and articles.

Announcements

Top Tags