Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#define _CRT_SECURE_NO_WARNINGS

#include <ict/ict_userservice.h>
#include <tccore/tcaehelper.h>
#include <user_exits/aiws_ext.h>
#include <tc/preferences.h>
#include <ss/ss_errors.h>
#include <tccore/custom.h>
#include <itk/mem.h>
#include <tc/tc.h>
#include <user_exits/user_exits.h>
#include <tccore/method.h>
#include <tc/emh.h>
#include <epm/epm.h>
#include <tccore/tctype.h>
#include <tccore/item.h>
#include <epm/epm.h>
#include <tccore/workspaceobject.h>
#include<ae/dataset.h>
#define AE_reference_size_c 32

EPM_decision_t EPM_check_PhysicalFileValidation(EPM_rule_message_t msg)


{
int status;
char * userName;
EPM_decision_t decision = EPM_nogo;
tag_t dataset;
AE_reference_type_t reference_type;
tag_t referenced_object;
char reference_name[AE_reference_size_c + 1];
//MyTeamcenter.pdf "PDF_Reference"

status = AE_find_dataset("doc_pdf",&dataset);
if (dataset != NULLTAG)
{
printf("dataset has been found\n");
decision = EPM_go;
}
if (dataset == NULLTAG)
{
printf("dataset has not been found\n");
decision = EPM_nogo;
}

strcpy(reference_name, "PDF_Reference");
status = AE_ask_dataset_named_ref(dataset, reference_name , &reference_type,
&referenced_object);
if (status == ITK_ok)
{
if (referenced_object != NULLTAG)
{
printf("Dataset Contains Physical Files\n");
decision = EPM_go;
}
if (referenced_object == NULLTAG)
{
printf("There is no Physical File Attached to Dataset\n");
decision = EPM_nogo;
}
}
else
printf("AE_ask_dataset_named_ref not working");

return decision;
}
extern "C" int RH_PhysicalFileValidation_register_custom_handlers(int *decision,
va_list args) {
int rcode = ITK_ok;
*decision = ALL_CUSTOMIZATIONS;
rcode = EPM_register_rule_handler("RH_PhysicalFileValidation", "This is to
check Physical File Validation", EPM_check_PhysicalFileValidation);
printf("Registering start\n");
if (rcode == ITK_ok)
fprintf(stdout, "RH_PhysicalFileValidation successfully registered!\
n");
else
fprintf(stdout, "WARNING - RH_PhysicalFileValidation NOT registered!\
n");
return rcode;
}
extern "C" DLLAPI int RH_PhysicalFileValidation_register_callbacks() {
CUSTOM_register_exit("RH_PhysicalFileValidation",
"USER_gs_shell_init_module",
(CUSTOM_EXIT_ftn_t)RH_PhysicalFileValidation_register_custom_handlers);
return (ITK_ok);
}

You might also like