Skip to content

Instantly share code, notes, and snippets.

@dearaujoj
Created July 24, 2012 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dearaujoj/3170516 to your computer and use it in GitHub Desktop.
Save dearaujoj/3170516 to your computer and use it in GitHub Desktop.
Universal importer sample
DECLARE
v_GroupName varchar2(200);
BEGIN
v_GroupName := 'Phantom0B';
Delete From uax_import_instances
Where GroupName = v_GroupName;
Delete From uax_import_properties
Where GroupName = v_GroupName;
/* -----------------------------------------------------
ROOT Directory (Phantom0B)
*/
--- Root Directory Object
Insert into uax_import_instances
Select v_GroupName
,'Phantom0B' -- ID
,'universalDirectory' -- type(Object)
From dual;
Insert into uax_import_properties
Select v_GroupName
,'Phantom0B' -- ID
,'identification', 'name', 'Phantom0B'
From dual
Union
Select v_GroupName
,'Phantom0B' -- ID
,'identification', 'fullName'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B'
From dual
Union
Select v_GroupName
,'Phantom0B' -- ID
,'shell', 'fullPath'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B'
From dual
;
--- Parent Link
Insert into uax_import_instances
Select v_GroupName
,'RootProj_Phantom0B' -- ID
,'parentLink' -- type(link)
From dual;
Insert into uax_import_properties
Select v_GroupName
,'RootProj_Phantom0B' -- ID
,'link','caller','Phantom0B'
From dual
Union
Select v_GroupName
,'RootProj_Phantom0B' -- ID
,'link','callee','%ProjectRoot%'
From dual;
/* -----------------------------------------------------
source file (SourceFile.XML)
*/
--- source file Object
Insert into uax_import_instances
Select v_GroupName
,'SourceFile.XML' -- ID
,'sourceFile' -- type(Object)
From dual;
Insert into uax_import_properties
Select v_GroupName
,'SourceFile.XML' -- ID
,'identification', 'name', 'SourceFile.XML'
From dual
Union
Select v_GroupName
,'SourceFile.XML' -- ID
,'identification', 'fullName'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B\SourceFile.XML'
From dual
Union
Select v_GroupName
,'SourceFile.XML' -- ID
,'shell', 'fullPath'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B\SourceFile.XML'
From dual
Union
Select v_GroupName
,'SourceFile.XML' -- ID
,'bookmark', 'source'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B\SourceFile.XML'
From dual
Union
Select v_GroupName
,'SourceFile.XML' -- ID
,'synchronizable', 'lastModifiedDate'
,'(2012,07,24,12,00,00)'
From dual
Union
Select v_GroupName
,'SourceFile.XML' -- ID
,'POSITIONABLE', 'POSITIONS', 'SourceFile.XML(1,1,223,13)'
From dual
;
--- Parent Link
Insert into uax_import_instances
Select v_GroupName
,'Phantom0B_SourceFile.XML' -- ID
,'parentLink' -- type(link)
From dual;
Insert into uax_import_properties
Select v_GroupName
,'Phantom0B_SourceFile.XML' -- ID
,'link','caller','SourceFile.XML'
From dual
Union
Select v_GroupName
,'Phantom0B_SourceFile.XML' -- ID
,'link','callee','Phantom0B'
From dual;
/* -----------------------------------------------------
Phantom Object (Ghost)
*/
--- Phantom Object
Insert into uax_import_instances
Select v_GroupName
,'Ghost_0B' -- ID
,'Phantom' -- type(Object)
From dual;
Insert into uax_import_properties
Select v_GroupName
,'Ghost_0B' -- ID
,'identification', 'name', 'Ghost_0B'
From dual
Union
Select v_GroupName
,'Ghost_0B' -- ID
,'identification', 'fullName'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B\SourceFile.XML.Ghost_0B'
From dual
Union
Select v_GroupName
,'Ghost_0B' -- ID
,'POSITIONABLE', 'POSITIONS', 'SourceFile.XML(1,1,1,3)'
From dual
Union
Select v_GroupName
,'Ghost_0B' -- ID
,'synchronizable', 'lastModifiedDate'
,'(2012,07,25,20,00,00)'
From dual
Union
Select v_GroupName
,'Ghost_0B' -- ID
,'bookmark', 'source'
,'C:\AnalysisSrc\CASTUI\Phantom\Phantom0B\SourceFile.XML'
From dual
;
--- Parent Link
Insert into uax_import_instances
Select v_GroupName
,'SourceFile.XML_Ghost_0B' -- ID
,'parentLink' -- type(link)
From dual
;
Insert into uax_import_properties
Select v_GroupName
,'SourceFile.XML_Ghost_0B' -- ID
,'link','caller','Ghost_0B'
From dual
Union
Select v_GroupName
,'SourceFile.XML_Ghost_0B' -- ID
,'link','callee','SourceFile.XML'
From dual
;
-- SourceFile.XML Source code with isInSourceLink
Insert into uax_import_instances
Select v_GroupName
,'SourceFile.XML_source' -- ID
,'isInSourceLink' -- type(link)
From dual
;
Insert into uax_import_properties
Select v_GroupName
,'SourceFile.XML_source' -- ID
,'link','caller','SourceFile.XML'
From dual
Union
Select v_GroupName
,'SourceFile.XML_source' -- ID
,'link','callee','SourceFile.XML'
From dual
;
-- Ghost_0B Source code with isInSourceLink
Insert into uax_import_instances
Select v_GroupName
,'SourceFile.XML_source_Ghost_0B' -- ID
,'isInSourceLink' -- type(link)
From dual
;
Insert into uax_import_properties
Select v_GroupName
,'SourceFile.XML_source_Ghost_0B' -- ID
,'link','caller','Ghost_0B'
From dual
Union
Select v_GroupName
,'SourceFile.XML_source_Ghost_0B' -- ID
,'link','callee','SourceFile.XML'
From dual
;
COMMIT;
END;
@dearaujoj
Copy link
Author

Added several modifications according to Universal Importer documentation p. 26 for Code Viewer:

  • The source property in the bookmark category must – for each object - contain the path
    of the file in which the object is defined, i.e. each object must inherit from the bookmark
    category
    .
  • An isInSourceLink link type must exist between each object and the file in which it is
    defined, in particular there must be a link of this type between the file and itself.
  • The POSITIONS property in the POSITIONABLE category must – for each object -
    contain the name of the file in which the object is defined followed by its positions, i.e.
    each object must inherit from the POSITIONABLE category.

@krondor74
Copy link

For isInSourceLink of SourceFile.xml, Insert SQL needs to be fixed.
The ID string is not 'SourceFile.XML_source_Ghost_0B' but 'SourceFile.XML_source'.

And is it correct that both caller and collee has same Object ID?(Source code of SourceFile.xml is not displayed in Enlighten.)

@dearaujoj
Copy link
Author

Yes you are right, bad copy/paste ;-), I have changed the SQL.

As it is written in the documentation there should be a link of this type between the file and itself.

@dearaujoj
Copy link
Author

Added POSITIONABLE property for source file in order to have the code displayed in Code Viewer. Positions had to be adapted according the file length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment