TCC

TCC – LRD when it doesn’t exist

As you know the automated process for producing exports relies heavily on the last run date. I’ve always been curious as to what happens when you pull the trigger on one that uses it without a lrd, turns out if there is no lrd file is gives you the last 24 hours and instantiates the lrd. I’ll sleep better tonight knowing this.

Python

Python – Reading CSV as input

One of the more fascinating aspects of python is it’s file manipulation capabilities. I have from time to time needed to process (create) 160 or so new batch files to call warehouse integrations. With proper naming convention in development, this process is handled with 21 lines of python code. Love it!!!

with open('_RecruitingNewExport.csv') as file:
  for line in file:
    line = line.replace("\n", "")
    outputLineTwo = line[:-6]
    with open("Recruiting_"+str(line)+".bat", "w") as file:
        file.write("REM This batch file executes the "+str(line)+" integration\n")        
        file.write("\n")
        file.write("REM Set directories and variables\n")
        file.write("@ECHO OFF\n")
        file.write("cd /d \"%~dp0\"\n")
        file.write("Call Environment.bat\n")
        file.write("TITLE %~nx0 – %TALEO_HOST% – %date% %time%\n")
        file.write("SET timeStamp=%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%-%time:~3,2%-%time:~6,2%\n")
        file.write("SET timeStamp=%timestamp: =0%\n")
        file.write("\n")
        file.write("REM Run the export integration\n")
        file.write("Call core\TCC.bat \"%SCRIPTS_FOLDER%\\CandidateExportScripts\\"+str(line)+"\\"+str(line)+"_cfg.xml\" \"%SCRIPTS_FOLDER%\\CandidateExportScripts\\"\
                   +str(line)+"\\"+str(line)+"_sq.xml\" \"%OUTBOUND_FOLDER%\\"+str(outputLineTwo)+"_%timestamp%.csv\"\n")
        file.write("Exit /B %ERRORLEVEL%\n")
        file.write("\n")
  print()


Taleo Web Services

Taleo SSO Metadata URL

I can’t for the life of me keep track of this so here it is so I know where to look for it.

https://ZONE.taleo.net/smartorg/sp/metadata.jss?target={ENTITY-ID}

https://ZONE.taleo.net/careersection/sp/metadata.jss?target={ENTITY-ID}

Batch

File – Data or No Data

A lot of the work we do for integration is of course automated. Sometimes we have to extract a data set and then use that export as the import to another integration. This is fine and well if there is data but if you have to run it every, let’s say, 5 minutes, there may very well be a situation where there isn’t anything to pick up. The matter is complicated by the fact that even if there isn’t any information there will be a header row.
This file is now completely useless and if left in place it will run through the process and wind up in the archive and produce a results file meaning you have to dig through empty files to try to find what’s going on.
To fix this I came across a batch file that will check the file and delete it if it has only a header row, a further check makes sure that that if any data is there is ignores the file. For your consideration and my reference here is the file that does this.

@echo off
setlocal enableExtensions disableDelayedExpansion

for %%a in ("..\..\data\inbound\*.csv") do (
   call :checkFile "%%~a"
   if errorlevel 1 del %%~a 
   echo File contains no content
)
endlocal
goto :eof


:checkFile
:: %~1   name of the file to check
:: returns 0 if file contains data, else 1 (== header only).

:: if file contains more than one line: data found
for /F "tokens=2 delims=:" %%a in ('find /c /v "" "%~1"') do (
   for /F "delims= " %%b in ("%%~a") do (
      if not 1 == %%~b exit /b 0
   )
)

:: if only line does not start with "Ident", then line contains data
for /F %%a in ('findstr /v "^Ident" "%~1"') do (
   exit /b 0
)

:: header only
exit /b 1
TCC

TCC – Date Certain Step/Status Achieved

I ran into an issue trying to get everyone within the last 24 hours that had achieved a certain step/status combination. The hitch was that they could have been moved out of the target step/status so we have to muck around in the history to get it. As it’s a date you need to make sure the projected value you’re comparing to is a date as well since the last 24 hours is always going to be date time. This did the trick. Remember to pay attention to the value types in sub queries like this.

<quer:filtering xmlns:quer="http://www.taleo.com/ws/integration/query">
	<quer:greaterThan>
		<quer:query projectedClass="Application" alias="sqLocation" preventDuplicates="true" pagingsize="1">
			<quer:projections>
				<quer:projection alias="AnotherDate">
					<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingHistoryItem.CreationDate"/>
				</quer:projection>
			</quer:projections>
			<quer:filterings>
				<quer:filtering>
					<quer:equal>
						<quer:field path="Number"/>
						<quer:field ownerQuery="MainQuery" path="Number"/>
					</quer:equal>
				</quer:filtering>
				<quer:filtering>
					<quer:equal>
						<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Step,Mnemonic"/>
						<quer:string>RequiredStep</quer:string>
					</quer:equal>
				</quer:filtering>
				<quer:filtering>
					<quer:equal>
						<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Status,Mnemonic"/>
						<quer:string>RequiredStatus</quer:string>
					</quer:equal>
				</quer:filtering>
				<quer:filtering>
					<quer:equal>
						<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingHistoryItem.CreationDate"/>
						<quer:query projectedClass="Application" alias="sqMotives" preventDuplicates="true" pagingsize="1">
							<quer:subQueries/>
							<quer:projections>
								<quer:projection>
									<quer:maximum>
										<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingHistoryItem.CreationDate"/>
									</quer:maximum>
								</quer:projection>
							</quer:projections>
							<quer:filterings>
								<quer:filtering>
									<quer:equal>
										<quer:field path="Number"/>
										<quer:field ownerQuery="MainQuery" path="Number"/>
									</quer:equal>
								</quer:filtering>
								<quer:filtering>
									<quer:equal>
										<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Step,Mnemonic"/>
										<quer:string>RequiredStep</quer:string>
									</quer:equal>
								</quer:filtering>
								<quer:filtering>
									<quer:equal>
										<quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Status,Mnemonic"/>
										<quer:string>RequiredStatus</quer:string>
									</quer:equal>
								</quer:filtering>
							</quer:filterings>
						</quer:query>
					</quer:equal>
				</quer:filtering>
			</quer:filterings>
		</quer:query>
		<quer:castAsDate>
			<quer:addDays>
				<quer:date type="now"/>
				<quer:integer>-1</quer:integer>
			</quer:addDays>
		</quer:castAsDate>
	</quer:greaterThan>
</quer:filtering>
PowerShell

PowerShell – Replace in Files

One of the hard parts about working on remote servers is they don’t usually have the proper toolkit to fix things as needed, meaning you have to make the changes in the development workstation, repackage and post, pull, copy, extract and paste in order to get anything done. Fine if it’s the initial load but when you only need to change something in a dozen files or so it can be tedious. So in the spirit of making due with what you have, you can use PowerShell to emulate the replace in file normally invoked from Notepad++ to work around it.
Here is the example:

foreach ($file in Get-ChildItem FileMask*.bat)
{
powershell -Command "(gc $file) -replace 'Text1', 'Text2' | Out-File -encoding UTF8 $file"
}
TCC

TCC – Setting a Select Value Back to ‘Not Specified’

This is a common request I run across. You’ve got a selection list and you need to reset it back to ‘Not Specified’ for whatever reason.
Although I swear I’ve done this before, every time it comes up I’m scratching my head trying to figure out what I did the last time it came up.
As I was looking for help on another issue I ran across Doc ID 2478146.1 on MOS that spells out the ‘correct’ way to do it, leaving it here for my reference: read more »

TCC

TCC – Following a CSW

I’m sure we’ve all had that wonderful fun time trying to figure out what steps and statuses and what order they are supposed to go in. With same named CSW’s and the other craziness it can certainly be frustrating. But there is hope, a properly crafted CSWWorkflow export will reveal all. Simply name a blank file: CSWWorkflowExport_sq.xml
Then add the following code:

<?xml version="1.0" encoding="UTF-8"?>
<quer:query productCode="RC1704" model="http://www.taleo.com/ws/tee800/2009/01" projectedClass="CSWWorkflow" locale="en" mode="CSV" csvheader="true" largegraph="true" preventDuplicates="false" xmlns:quer="http://www.taleo.com/ws/integration/query">
	<quer:subQueries/>
	<quer:projections>
		<quer:projection>
            <quer:field path="Number"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="Mnemonic"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="Name"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="Description"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="Available"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="IsDefault"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Active"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,ConditionalEntryAllowed"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Mandatory"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,NewEntryNotificationNumber"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Restricted"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Sequence"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,Number"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,Mnemonic"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,Name"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,Description"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,Available"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,ShortName"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Active"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,AllConstraintsMustBeValid"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,AutoFlow"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,ConditionnalCompletenessAllowed"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Initial"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,MeetingCompliant"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,NewEntryNotificationNumber"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,QueueAndRouteShortcutNumber"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,RsCSWAskForCommentModeNumber"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,RsCSWAskForMotiveModeNumber"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Sequence"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Status,CSWStatus.Mnemonic"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Status,CSWStatus.Name"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Status,CSWStatus.Description"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Status,CSWStatus.ActiveEventDate"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Status,CSWStatus.Available"/>
        </quer:projection>
		<quer:projection>
            <quer:field path="StepUsage,Step,StatusUsages,Status,CSWStatus.Number"/>
        </quer:projection>
	</quer:projections>
	<quer:projectionFilterings/>
	<quer:filterings/>
	<quer:sortings>
		<quer:sorting ascending="true">
            <quer:field path="Mnemonic"/>
        </quer:sorting>
		<quer:sorting ascending="true">
            <quer:field path="StepUsage,Sequence"/>
        </quer:sorting>
		<quer:sorting ascending="true">
            <quer:field path="StepUsage,Step,StatusUsages,Sequence"/>
        </quer:sorting>
	</quer:sortings>
	<quer:sortingFilterings/>
	<quer:groupings/>
	<quer:joinings/>
</quer:query>
TCC

TCC – Data Dictionaries

These are the last full data dictionaries for Taleo. Unfortunately 15a is the last version available but I’ve honestly rarely, if ever, had to look any further than this documentation.

MySQL

MySQL – New Database > New User

I’m trying to get a little more granular on DB security in Linux and to that end used the MariaDB root user for all LAMP installations is probably not the brightest idea. I’ll try to commit this to memory but until then I’ll follow these steps to create a new database and then a new user with full access to that DB thereby isolating the databases from each other so one breach doesn’t take down the system.

mysql -u root -p

CREATE DATABASE newDatabase;

GRANT ALL PRIVILEGES ON newDatabase.* TO 'newUser'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;

FLUSH PRIVILEGES;