Skip to content

Commit

Permalink
Migrate build 1.6 from old community site
Browse files Browse the repository at this point in the history
  • Loading branch information
EliJDonahue committed Mar 31, 2017
1 parent 441dbd7 commit 94df39c
Show file tree
Hide file tree
Showing 81 changed files with 4,198 additions and 603 deletions.
Binary file added CodeTree/20x20_tbProgress.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CodeTree/20x20_tbProgress2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CodeTree/20x20_tbProgress3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Documentation/Item Folders Concept v1-4.pdf
Binary file not shown.
Binary file added Documentation/Item Folders Concept v1-6.pdf
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<AML>
<Item type="Method" id="DC91D02A7D5B4C06AD9C5220EAD605EC" action="add">
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA['MethodTemplateName=VBMain;
'
' Context must be item of type file pointiong to an existing physical file in vault
' Content must contain properties:
' filename
'
' custom context attributes
' newFilename
' localVaultPath
' newFilenamePrefix
'
Dim inn As Innovator = Me.getInnovator()
Dim res As Item
Function Main() As Item
'System.Diagnostics.Debugger.Break()
Dim localVaultRoot As String = Me.getAttribute("localVaultPath","")
Dim newFilename As String = Me.getAttribute("newFilename","")
Dim newFilenamePrefix As String = Me.getAttribute("newFilenamePrefix","")
Dim fid As String = Me.getID()
Dim fn As String = Me.getProperty("filename","")
Dim ArasDBName As String = CCO.DB.DatabaseName
'get filePath to filename
Dim vaultedSourceFile As String = buildVaultPathFromFileId(fid,localVaultRoot,ArasDBName) & fn
If Not File.Exists(vaultedSourceFile) Then Return inn.newError("File not found ! (in vault path:'" & vaultedSourceFile & "')")
'create new file item
' remove template keyword in file name - just in case
newFilename = newFilename.Replace("Templ","templ")
newFilename = newFilename.Replace("template ","")
newFilename = newFilename.Replace(" template","")
newFilename = newFilename.Replace(" template ","")
newFilename = newFilename.Replace("template","")
newFilename = newFilename.Replace(" templ","")
newFilename = newFilename.Replace("templ ","")
newFilename = newFilename.Replace(" templ ","")
newFilename = newFilename.Replace("templ","")
newFilename = newFilenamePrefix & newFilename
Dim newFileId As String = inn.getNewID()
Dim vaultNewFile As String = buildVaultPathFromFileId(newFileId,localVaultRoot,ArasDBName) & newFilename
If File.Exists(vaultNewFile) Then Return inn.newError("File already exists ! (in vault path:'" & vaultNewFile & "')")
Dim newFileItem As Item = inn.newItem("File", "add")
newFileItem.setID(newFileId)
newFileItem.setProperty("filename", newFilename)
newFileItem.attachPhysicalFile(vaultedSourceFile)
newFileItem = newFileItem.apply()
Return newFileItem
End Function
'-----------------------------
Private Function buildVaultPathFromFileId (fileId As String,localVaultRoot As String, dbName As String) As String
Dim vaultPath As String = ""
' vaultPath = VSLogic.VSLogic.GetPathFromID(fileId, "\\", False, ArasDBName, localVaultRoot)
Dim treeConfig(2) As Integer
treeConfig(0) = 1
treeConfig(1) = 2
treeConfig(2) = 29
vaultPath = "\\"
vaultPath = vaultPath & fileId.Substring(treeConfig(0)-1,1) & "\\"
vaultPath = vaultPath & fileId.Substring(treeConfig(1)-1,2) & "\\"
vaultPath = vaultPath & fileId.Substring(fileId.length - treeConfig(2),treeConfig(2)) & "\\"
vaultPath = localVaultRoot & dbName & vaultPath
Return vaultPath
End Function
]]></method_code>
<method_type>VB</method_type>
<name>CopyFileToNewFileInVault</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<AML>
<Item type="Method" id="A3C3E5616573473C97786363DFB88AFF" action="add">
<comments>cloned form PE_EnforceSharedFile, but with more generic logic on SourceItem</comments>
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA[Item orItem = this.newOR();
orItem.setProperty("is_shared", "1");
Item sourceItem = this.getPropertyItem("source_id");
if(sourceItem == null)
{
//try to get the source item tope from naming convention of relationship name
//works, if the relationship name starts with source item's name adding " File" at the end.
String srcTypeName = this.getType();
srcTypeName = srcTypeName.Replace(" File","");
sourceItem = this.newItem(srcTypeName, "get");
String source_id = this.getProperty("source_id", "");
if(!String.IsNullOrEmpty(source_id))
{
sourceItem.setProperty("id", source_id);
sourceItem.setPropertyAttribute("id", "condition", "eq");
}
}
else
{
Item tempItem = this.newItem();
tempItem.loadAML(sourceItem.node.OuterXml);
sourceItem = tempItem;
}
sourceItem.setProperty("owned_by_id", Aras.Server.Security.Permissions.Current.IdentitiesList);
sourceItem.setPropertyAttribute("owned_by_id", "condition", "in");
orItem.setPropertyItem("source_id", sourceItem);
return this;]]></method_code>
<method_type>C#</method_type>
<name>EnforceSharedFlagOnFileRels</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<AML>
<Item type="Method" id="A9FA9F336C0949AFA6FBCE416DD5FF85" action="add">
<comments>resolves to current generation items of a given id or list of ids</comments>
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA['Get Latest Released Items of ID
'
' item context must contain
' "type" attribute
' "id" attribute or <id> property
' allows <id> property to contain comma separated list of ids - with single quote text deliminters
' id property attribute must then have "condition"= "in"
'
'
' Can be used with versionable Item Types. 1st step of logic will determine latest released generatins of all
' item ids passed in. 2nd step will do a "get" action for all latest released ids.
'
'NOTE: works also if item type is a Poly Item
'MethodTemplateName=VBMain;
Dim res As Item
Dim inn As Innovator
Function Main() As Item
'System.Diagnostics.Debugger.Break()
Dim itemIds As String = Me.getProperty("id","")
Dim itemType As String = Me.GetType()
if itemIds <> "" and itemIds.indexOf(",") > 0 then
If Me.getPropertyAttribute("id","condition","") <> "in" Then Return Me.getInnovator().newError("In calling context the id condition attribute is missing !")
Else
If itemIds = "" Then itemIds = Me.getID() 'single item id
If itemIds.IndexOf("'") < 0 Then itemIds = "'" & itemIds & "'"
End If
'Step 1 - get list of ids of latest released generations
Dim resIds As String = "##"
Dim tableName As String = "[" & CCO.DB.GenerateTableName(itemType) & "]"
Dim SQLstr As String = "SELECT " & tableName & ".id," & tableName & ".config_id," & tableName & ".generation"
SQLstr = SQLstr & " FROM " & tableName
SQLstr = SQLstr & " WHERE " & tableName & ".config_id IN "
SQLstr = SQLstr & "(SELECT " & tableName & ".config_id FROM " & tableName
SQLstr = SQLstr & " WHERE " & tableName & ".id in (" & itemIds & "))"
SQLstr = SQLstr & " AND " & tableName & ".generation like '%'"
SQLstr = SQLstr & " AND " & tableName & ".is_current='1'"
'order by config and generation DESC is IMPORTANT for next logic !!! do not change
SQLstr = SQLstr & " ORDER BY " & tableName & ".config_id," & tableName & ".generation DESC"
res = Me.getInnovator().applySQL(SQLstr)
Dim i As Integer
Dim listOfConfigIds As String = ""
For i = 0 To res.getItemCount()-1
'only add the id of the first generation found for a config_id (this will be the max generation since ordering is DESC)
If listOfConfigIds.indexOf(res.getItemByIndex(i).getProperty("config_id","")) < 0 Then
resIds = resIds & "," & res.getItemByIndex(i).getProperty("id","")
listOfConfigIds = listOfConfigIds & "," & res.getItemByIndex(i).getProperty("config_id","")
End If
Next i
resIds = resIds.Replace("##,","")
resIds = "'" & resIds.Replace(",","','") & "'"
'Step 2 - get Items of latest released ids
Me.setProperty("id", resIds)
Me.setPropertyAttribute("id","condition","in")
Me.setAction("get")
Return Me.apply()
End Function
]]></method_code>
<method_type>VB</method_type>
<name>Get Current Items By IDs</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<method_code><![CDATA[Dim itemType As String = Me.GetType()
Dim itemId As String = Me.GetID()
Dim tableName As String = itemType.Replace(" ","_")
Dim tableName As String = "[" & CCO.DB.GenerateTableName(itemType) & "]"
Dim SQLstr As String = "SELECT TOP 1 " & tableName & ".id"
SQLstr = SQLstr & " FROM " & tableName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA[Dim itemType As String = Me.GetType()
Dim itemId As String = Me.GetID()
Dim tableName As String = itemType.Replace(" ","_")
Dim tableName As String = "[" & CCO.DB.GenerateTableName(itemType) & "]"
Dim SQLstr As String = "SELECT TOP 1 " & tableName & ".id"
SQLstr = SQLstr & " FROM " & tableName
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<AML>
<Item type="Method" id="D7A825C8DEE14E299A210AD14C029271" action="add">
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA['System.Diagnostics.Debugger.Break()
Dim inn As Innovator = Me.getInnovator()
Dim thisItemType As String = Me.GetType()
Dim arg1ItemPropertyName As String = Me.getAttribute("FilterProperty","")
Dim arg1ItemPropertyValue As String = Me.getAttribute("FilterValue","")
Dim ItemTypeTable As String = "[" & CCO.DB.GenerateTableName(itemType) & "]"
Dim SQLstr As String = "SELECT a.id,a.generation,a.config_id "
SQLstr = SQLstr & "FROM [" & ItemTypeTable & "] As a, "
SQLstr = SQLstr & "(SELECT "
SQLstr = SQLstr & "MAX([" & ItemTypeTable & "].generation) AS maxgen,"
SQLstr = SQLstr & "[" & ItemTypeTable & "].config_id "
SQLstr = SQLstr & "FROM [" & ItemTypeTable & "] "
SQLstr = SQLstr & "WHERE [" & ItemTypeTable & "]." & arg1ItemPropertyName & "='" & arg1ItemPropertyValue & "' "
SQLstr = SQLstr & "GROUP BY [" & ItemTypeTable & "].config_id) AS maxresults "
SQLstr = SQLstr & "WHERE a.generation=maxresults.maxgen "
SQLstr = SQLstr & "AND a.config_id=maxresults.config_id"
Dim res As Item = inn.applySQL(SQLstr)
Return res
]]></method_code>
<method_type>VB</method_type>
<name>Get ItemIDs of MaxGen By Filter</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<AML>
<Item type="Method" id="51AAE5A44D924C99BBE9682768EA7F59" action="add">
<comments>resolves to latest released items of a given id or list of ids</comments>
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA['Get Latest Released Items of ID
'
' item context must contain
' "type" attribute
' "id" attribute or <id> property
' allows <id> property to contain comma separated list of ids - with single quote text deliminters
' id property attribute must then have "condition"= "in"
'
'
' Can be used with versionable Item Types. 1st step of logic will determine latest released generatins of all
' item ids passed in. 2nd step will do a "get" action for all latest released ids.
'
'NOTE: works also if item type is a Poly Item
'MethodTemplateName=VBMain;
Dim res As Item
Dim inn As Innovator
Function Main() As Item
'System.Diagnostics.Debugger.Break()
Dim itemIds As String = Me.getProperty("id","")
Dim itemType As String = Me.GetType()
if itemIds <> "" and itemIds.indexOf(",") > 0 then
If Me.getPropertyAttribute("id","condition","") <> "in" Then Return Me.getInnovator().newError("In calling context the id condition attribute is missing !")
Else
If itemIds = "" Then itemIds = Me.getID() 'single item id
If itemIds.IndexOf("'") < 0 Then itemIds = "'" & itemIds & "'"
End If
'Step 1 - get list of ids of latest released generations
Dim resIds As String = "##"
Dim tableName As String = "[" & CCO.DB.GenerateTableName(itemType) & "]"
Dim SQLstr As String = "SELECT " & tableName & ".id," & tableName & ".config_id," & tableName & ".generation"
SQLstr = SQLstr & " FROM " & tableName
SQLstr = SQLstr & " WHERE " & tableName & ".config_id IN "
SQLstr = SQLstr & "(SELECT " & tableName & ".config_id FROM " & tableName
SQLstr = SQLstr & " WHERE " & tableName & ".id in (" & itemIds & "))"
SQLstr = SQLstr & " AND " & tableName & ".generation like '%'"
SQLstr = SQLstr & " AND " & tableName & ".is_released='1'"
'order by config and generation DESC is IMPORTANT for next logic !!! do not change
SQLstr = SQLstr & " ORDER BY " & tableName & ".config_id," & tableName & ".generation DESC"
res = Me.getInnovator().applySQL(SQLstr)
Dim i As Integer
Dim listOfConfigIds As String = ""
For i = 0 To res.getItemCount()-1
'only add the id of the first generation found for a config_id (this will be the max generation since ordering is DESC)
If listOfConfigIds.indexOf(res.getItemByIndex(i).getProperty("config_id","")) < 0 Then
resIds = resIds & "," & res.getItemByIndex(i).getProperty("id","")
listOfConfigIds = listOfConfigIds & "," & res.getItemByIndex(i).getProperty("config_id","")
End If
Next i
resIds = resIds.Replace("##,","")
resIds = "'" & resIds.Replace(",","','") & "'"
'Step 2 - get Items of latest released ids
Me.setProperty("id", resIds)
Me.setPropertyAttribute("id","condition","in")
Me.setAction("get")
Return Me.apply()
End Function
]]></method_code>
<method_type>VB</method_type>
<name>Get Latest Released Items By IDs</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<AML>
<Item type="Method" id="B3778D5592CC4E368D630672F73CC1DC" action="add">
<comments>reads from VaultServerConfig.xml</comments>
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA['reads the VaultServerConfig.xml file in Aras code tree.
'returns the setting for "LocalPath" (as a string)
'System.Diagnostics.Debugger.Break()
Dim srvPath As String = CCO.Server.Mappath("./innovator.xml")
srvPath = srvPath.Replace("\","/")
Dim srvPathElements As String() = srvPath.split("/")
Dim pathIdx As Integer = srvPathElements.Length -3
srvPath = ""
Dim i As Integer
For i=0 To srvPathElements.Length -4
srvPath = srvPath & srvPathElements(i) & "/"
Next i
Dim vaultConfigFile As String = srvPath & "VaultServerConfig.xml"
' get configuration settings... add error checking
Dim configdoc As XmlDocument = New XmlDocument()
configdoc.Load(vaultConfigFile)
Dim xlocalPath As XmlNodeList = configdoc.GetElementsByTagName("LocalPath")
Dim localPath As String = xlocalPath(0).InnerText
Return Me.getInnovator().newResult(localPath)
]]></method_code>
<method_type>VB</method_type>
<name>GetLocalVaultPath</name>
</Item>
</AML>
Loading

0 comments on commit 94df39c

Please sign in to comment.