@doc hierarchy="GMLDOM">
(c) SAP AG 2003-2006. All rights reserved.
Class DCNode inherit dev:TNode;
metadata vFolders = [
// This entry must be placed first!!
{type:'gml2:BlackBox', name:'#TEXT[XTND_SERVICES]', icon:'#URL[~skin:icons.data-services.gif]', tooltip:'#TEXT[XTOL_SERVICES]'},
{type:'gml2:GlobalEnumeration', name:'#TEXT[XTND_GLOBAL_ELS]', icon:'#URL[~skin:icons.entry_lists_folder.gif]', tooltip:'#TEXT[XTOL_GLOBAL_ELS]'}
];
property isDC = true;
property dcState = "";
property dcVendor = "";
property dcPrefix = "";
property isEmptyDC = "";
property lastSychedTime = "";
//****This property should be remove, it should be taken form the DC state
//I left her since it involve more changes in ManageFreeStryleModelsPanel and FreestyleModelProvider
property isAddToSourceControl="";
constructor(dcProps)
this.supercall(dcProps.urn, dcProps.name, dcProps.hint, dcProps.size, dcProps.mode, dcProps.check, dcProps.icon);
this.initialize(dcProps);
end
method initialize(dcProps)
//If dcProps.state was not set (is undefined), then this.dcState will also be undefined.
//In this case, TNode.setAttributes will not set the value of this attribute...
this.dcState = dcProps.state || this.dcState;
this.dcVendor = dcProps.dcVendor || this.dcVendor;
this.isEmptyDC = dcProps.isEmptyDC || this.isEmptyDC;
this.lastSychedTime = dcProps.lastSychedTime || this.lastSychedTime;
//*****This init should be remove with the property defenition
this.isAddToSourceControl = DCState.isAddToSourceControl(this.dcState);
this.setIcon();
end
override method setIcon()
var mSize = this.compSize;
this.setHint(this.getStatusDispalyStr(this.dcState), (mSize > 0 ? mSize : null));
this.icon = getDCIcon(this.dcState);
end
override method getHint()
return this.hint;
end
override method getDescription()
var stat_description = this.getStatusDispalyStr(this.dcState);
return ( '#TEXT[XFLD_MMP_TYPE]: ' + '#TEXT[XFLD_MMP_DC]' + '
' +
'#TEXT[XFLD_MMP_VENDOR]: ' + this.dcVendor + '
' +
'#TEXT[XFLD_MMP_STATUS]: ' + stat_description +
((this.compSize > 0) ? ('
#TEXT[XFLD_MMP_SIZE]: ' + this.compSize + ' ' + (this.compSize==1 ? '#TEXT[XFLD_MMP_COMPONENT]' : '#TEXT[XFLD_MMP_COMPONENTS]')) : '' ));
end
method getStatusDispalyStr(status)
var result ='';
if (DCState.isAddToSourceControl(status)){
result= "#TEXT[XMSG_DC_IN_SOURCE_CONTROL]";
} else if (DCState.isLocal(status)){
result= "#TEXT[XMSG_DC_IS_LOCAL]";
} else if (DCState.isSynced(status)){
result= this.lastSychedTime ? ("#TEXT[XMSG_DC_LAST_SYNCED] " + this.lastSychedTime) : "#TEXT[XMSG_DC_IS_SYNCED]";
} else if (DCState.isUnSynced (status)){
result = "#TEXT[XMSG_DC_IS_NOT_SYNCED]";
}
return result;
end
override method getChildren(channel, scope, children)
var softwareComp = this.parentnode;
var repository = softwareComp.parentnode;
var location = $ENV.createObject('dev:Location',
'',
'',
repository.serverid,
getSoftwareComponentName(softwareComp.serverid),
getSoftwareComponentVendor(softwareComp.serverid),
this.serverid,
this.dcPrefix,
this.dcVendor);
var retList = children || channel.listModelsInDC(location,true);
var c = null, result = [];
if (retList && scope && scope != "#TEXT[XLST_ALL]") {
var i = 0;
// Create virtual nodes
for (var k in this.Class.metadata.vFolders)
result[i++] = this.buildServicesNode(retList, this.Class.metadata.vFolders[k]);
// -------------------
for (var ind in retList) {
var obj = retList[ind];
if (!obj) continue;
c = CLASS(obj.gmlObjectType);
if (!c) continue;
if (ISA(c, scope)) {
result[i++] = retList[ind];
}
}
}
else result = retList;
return result;
end
method buildServicesNode(res, vFldObj)
// Validating vFldObj is in his corrent form
if (vFldObj && (!vFldObj.type || !vFldObj.name || !vFldObj.icon || !vFldObj.tooltip)) return;
var sn = $ENV.createObject('#NS[DCProperties]');
// Attach parameters below to simulate DC node
sn._gsObjectType = 'dev:ServicesNode';
sn.vFname = vFldObj.name;
sn.dcVendor = this.dcVendor;
sn.dcPrefix = this.dcPrefix;
sn.serverid = this.serverid;
var c = null; var o = null; sn.sChilds = [];
var size = 0;
for (var k in res)
{
o = res[k];
if (!o || (o && !o.gmlObjectType)) {
#LOG[4, 'buildServicesNode failed'];
continue;
}
c = CLASS(o.gmlObjectType);
if (ISA(c, vFldObj.type)) {
sn.sChilds.push(o);
delete res[k];
this.compSize++;
size++;
}
}
sn.size = size;
sn.vFicon = vFldObj.icon;
sn.vFtooltip = vFldObj.tooltip;
sn.vID = 'VFLD_' + vFldObj.type.split(':')[1] + '_' + this.id;
return sn;
end
override method initOneChild(res)
if (res._gsObjectType && res._gsObjectType == 'dev:ServicesNode')
return createNode_SRVFolder(res);
return createNode_Model(res);
end
override method getNodeSupportedOperations()
var softwarwComp = this.parentnode;
var repository = softwarwComp.parentnode;
return {isLocal:repository.isLocal,
isAddToSourceControl:DCState.isAddToSourceControl(this.dcState),
isSynced:DCState.isSynced(this.dcState),
isEmptyDC:this.isEmptyDC
};
end
<@doc>returns the serverid along with the vendor and prefix
override method getServerid()
//return this.dcVendor + "." + this.dcPrefix + "." + this.serverid;
return namespaceFromDC({name:this.serverid,
vendor:this.dcVendor,
prefix:this.dcPrefix});
end
method setState(newState)
if(this.dcState != newState){
this.dcState = newState;
this.setIcon();
}
end
method is_Synced()
return DCState.isSynced(this.dcState)
end
override method canBeRenamed()
return this.isLocal();
end