Lets discuss something on Artifact Viewer now
This displays a list of artifacts. Artifact is a generic term that represents any entity such as task, object, service group, and service container.
This component has four modes in which to display the artifacts - Icon, List, Detail, and Tiles. You can select a display mode both during runtime and design-time.
The Artifact Viewer component supports the addition of behaviors specific to each artifact type. At runtime, only those options (behaviors) are available for an artifact that are specified for its respective artifact type. This is similar to the behavior of context-menus in Windows, where different context-menu options are displayed for different file types such as folders, .zip files, and .doc files.
I will be now describing the code i used for artifact viewer below :
//The code below refers to client-side plugin. For this, you need to extend type registration JavaScript class. The below code //comprises a JavaScript class where the ArtifactFactoryType JavaScript class is extended by ClaimArtifactFactory.
/** The below code means **/
//Here classname.prototype.methodname is given is equalling to a function which returns taskArtifact.
/* i am confused why prototype is used when i saw it for the first time. i will give u an example of use of it
for example there are names 'John' 'Leela' two words separed by a space.if we need to concat we do in javascript
var parents = ["John", "Leela"];
var children = ["Beckham", "Messi"];
var family = parents.concat(children);
here it is concatenating parents with children and it is calling as string.prototype.concat = function {//which returns concat operation}
or we can write like this .prototype.splitSpaces = function ()
{
// write code for split where spaces required
}
// so from here whenever u use splitSpaces method of type classname of that this would be executed it is as if u are writing //methods inside a class */
function ClaimArtifactFactory() // Here this class is extended by ArtifactFactoryType
{
}
ClaimArtifactFactory.prototype.getType = function () //use of protype explained above
{
/** this method returns type of an artifact **/
//getType is Mandatory.It Returns the type of an artifact.It Must be used to extend the ArtifactFactoryType class.
return "taskArtifact";
}
ClaimArtifactFactory.prototype.addArtifactBehavior = function (iApplicationDefinition)
//iApplicationDefinition type parameter is declared in addArtifactBehavior and it is being returned.
//addArtifactBehavior(applicationDefinition) method adds behavior for an artifact. You can extend the BaseArtifact functionality //the artifact.
/** this method helps to add behavior to each and every artifact **/
{
return new ClaimArtifact(iApplicationDefinition);
}
function ClaimArtifact(applicationDefinition )
{
this.applicationDefinition = applicationDefinition;
this.Artifact(this.applicationDefinition );
}
var user_DN; //creating global variable to use it at various places.
function Form_InitDone(eventObject)
{
////import ArtifactFactoryType into application
application.importType("wcp.library.util.Artifact");
application.importType("wcp.library.util.ArtifactFactoryType");
//extend ArtifactFactoryType
application.inherit(ClaimArtifactFactory, ArtifactFactoryType);
//extend ArtifactFactoryType
application.inherit(ClaimArtifact, Artifact);
var userObject=system.getUser();
user_DN = userObject.organizations[userObject.defaultOrganization].userDN;
//Task Model consists of Runtime webservice getTasksByUser
TaskModel.reset();
var user_name = system.getUser().name;
//Used to display Goodmorning/afternoon/evening in text field
var display = getTime();
if(display >=0 && display <12)rte1.setValue("GoodMorning"+" "+user_name);if(display>=12 && display <16)rte1.setValue("Good Afternoon"+" "+user_name);if(display>=16 && display <24)
rte1.setValue("Good Evening"+" "+user_name);
}
//So we will see all the tasks in the artifact viewer for a user
//this fires on request of model and sets the user_DN as user and checks which UI are attached to it

function TaskModel_OnRequest(eventObject)
{
var req = eventObject.request;
cordys.setNodeText(req,".//*[local-name()='User']",user_DN);
cordys.setNodeText(req,".//*[local-name()='Type']","UI_TASK"); // sets the UserInterface Task
var parameterNode=cordys.selectXMLNode(req,".//*[local-name()='Parameters']/*[local-name()='Parameter']");
//as seen in the image which is soap request we are setting parameter name and value below
parameterNode.setAttribute("name","showOnStartPage");
//setting value of "showonstartpage' for name attribute so that all the tasks related to user are visible
parameterNode.setAttribute("value","true");
//setting value of 'true' for value attribute
}
//this method is fired on response of the model
function TaskModel_OnResponse(eventObject)
{
//response from the taskmodel response we are selecting nodes
var resp = eventObject.response;
var respNodes=cordys.selectXMLNodes(resp,".//*[local-name()='tuple']");
for(var i=0;i
{
var idText = cordys.getNodeText(respNodes[i],".//*[local-name()='id']");
//removing childnodes not to display which are not needed else all these would be shown
if(idText=="cordys_notif_MyInboxTask" || idText=="cordys_notif_ManageParticipantPreferencesTask" || idText=="googlemap_key_manager")
{
respNodes[i].parentNode.removeChild(respNodes[i]);
}
}
//the frame to which to be needed to set is shown below
for(var i=0;i
{
cordys.setNodeText(respNodes[i],".//*[local-name()='frame']","cframe","");
}
//creating an new obj of type getArtifactFactoryType
var ClaimArtifactFactoryObj = claims_artifact.getArtifactFactoryType("ClaimArtifactFactory");
//artifactSchema -is used as schema is mandatory to generate html from the XML nodes passed.
if(system.isIE)
{
//this would be taken based on choice of xml schema to be taken wheter IE or not
ClaimArtifactFactoryObj.artifactSchema = cordys.cloneXMLDocument(artifactIESchema.XMLDocument.documentElement);
}
else
{
//used for multibrowsing code schema is shown below
ClaimArtifactFactoryObj.artifactSchema = artifactNonIESchema.XMLDocument.documentElement;
}
var taskNodes = cordys.selectXMLNodes(resp,".//*[local-name()='LaunchingInfo']")
ClaimArtifactFactoryObj.addArtifacts(taskNodes);
}
function log_out_Click(eventObject) //fires on logout click
{
if(confirm('Are you sure you want to logout?'))
location.href = "/cordys/samlartlogin1.html";
//window.replace(application.select(logout.XMLDocument.documentElement));
}