July 5, 2012

Posted in Uncategorized at 7:24 am by mrrohit007

<%@

pageimport=“com.maxis.portal.assetmgmt.AssetManagementInterceptor”%>

<%@

pageimport=“com.maxis.bean.domain.AssetEntityProperty”%>

<%@

pageimport=“java.text.SimpleDateFormat”%>

<%@

pageimport=“com.maxis.ecore.bpo.UserManagementBPO”%>

<%@

pageimport=“com.maxis.bean.domain.UserInfo”%>

<%@

pageimport=“com.maxis.bean.domain.AssetTrack”%>

<%@

pageimport=“java.util.Date”%>

<%@

pageimport=“java.util.Comparator”%>

<%@

pageimport=“java.util.Collections”%>

<%@

pageimport=“java.util.Iterator”%>

<%@

pageimport=“java.util.HashMap”%><%@pageimport=“com.maxis.bean.domain.AssetType”%>

<%@

pageimport=“com.maxis.bean.domain.AssetProperty”%>

<%@

pageimport=“com.maxis.bean.domain.AssetEntity”%>

<%@

pageimport=“com.maxis.bean.domain.Asset”%>

<%@

pageimport=“java.util.ArrayList”%>

<%@

pageimport=“net.sf.json.JSONObject”%>

<%@

pageimport=“net.sf.json.JSONArray”%>

<%@

pageimport=“com.maxis.common.util.BeanLocatorFactory”%>

<%@

pageimport=“java.util.List”%>

<%@

pageimport=“com.maxis.global.common.BizCmnFunctions”%>

<%@

pageimport=“com.maxis.portal.assetmgmt.bpo.AssetManagementBPO”%><%

String contextPath = request.getContextPath();

boolean blnShowHistory = false;

String assetId = BizCmnFunctions.checkNull(request.getParameter(

“assetId”));

String items = BizCmnFunctions.checkNull(request.getParameter(

“items”));

String showHistory = BizCmnFunctions.checkNull(request.getParameter(

“blnShowHistory”));

String containerEle = BizCmnFunctions.checkNull(request.getParameter(

“containerEle”));

String style1 =

“background-color:#edebc9;”;

    String style2 =

“background-color:#f6f5e4;”;

    String style3 =

“background-color:#fafaf1;”;

    String style4 =

“border-color:#e5e5b2;”;

    String style5 =

“#e5e5b2”;

    String imageIcon =

“asset/images/defalut.jpg”;

if(showHistory != “”)

blnShowHistory = Boolean.parseBoolean(showHistory);

JSONArray jsonArray =

new JSONArray();

JSONObject jsonObj =

null;

JSONObject mainJsonObj =

new JSONObject();

AssetManagementBPO assetManagementBPO = (AssetManagementBPO)BeanLocatorFactory.getService(

“AssetManagementBPO”);

UserManagementBPO userManagementBPO = (UserManagementBPO)BeanLocatorFactory.getService(

“UserManagementBPO”);

List<Asset> listAssets =

null;

Asset assetObj = assetManagementBPO.getAssetByAssetId(assetId);

if(items.equalsIgnoreCase(“rightItems”)){

listAssets = assetManagementBPO.getAssetChildsByAssetId(assetId);

}

elseif(items.equalsIgnoreCase(“leftItems”)){

listAssets = assetManagementBPO.getAssetParentsByAssetId(assetId);

}

elseif(items.equalsIgnoreCase(“showHistory”)){

StringBuilder historyDetails =

new StringBuilder();

AssetEntity assetEntity = assetManagementBPO.getAssetEntityByAssetEntityId(assetObj.getAssetEntityId());

if(assetEntity != null){

style2 = assetEntity.getStyle2();

style5 = assetEntity.getStyle5();

}

StringBuilder tablurStyle  =

new StringBuilder();

  tablurStyle.append(

“border-top-width: 1px;”);

  tablurStyle.append(

“border-top-style: solid;”);

  tablurStyle.append(

“border-top-color: “+style5+“;”);

  tablurStyle.append(

“border-right-width: 1px;”);

  tablurStyle.append(

“border-right-style: solid;”);

  tablurStyle.append(

“border-right-color: “+style5+“;”);

StringBuilder tablurStyleTD =

new StringBuilder();

  tablurStyleTD.append(

“border-bottom-width: 1px;”);

  tablurStyleTD.append(

“border-bottom-style: solid;”);

  tablurStyleTD.append(

“border-bottom-color: “+style5+“;”);

  tablurStyleTD.append(

“border-left-width: 1px;”);

  tablurStyleTD.append(

“border-left-style: solid;”);

  tablurStyleTD.append(

“border-left-color: “+style5+“;”);

   List<Float> versionLst =

new ArrayList<Float>();

   List<AssetTrack> assetTrackLst = assetManagementBPO.getAssetTrackByAssetId(assetId);

   historyDetails.append(

“<table width=’100%’ cellspacing=’0′ cellpadding=’6′ style='”+tablurStyle.toString()+“‘ >”);

if(assetTrackLst != null && assetTrackLst.size() > 0){

   historyDetails.append(

“<tr style='”+style2+“‘>”);

   historyDetails.append(

“<td align=’center’ style='”+tablurStyleTD.toString()+“‘ ><strong>Version</strong></td>”);

   historyDetails.append(

“<td align=’left’ style='”+tablurStyleTD.toString()+“‘ ><strong>Properties</strong></td>”);

   historyDetails.append(

“</tr>”);

for(AssetTrack assetTrack : assetTrackLst){

if(assetTrack != null){

  List<String> porpKeyLst =

new ArrayList<String>();

  List<AssetProperty> assetPropertyLst = assetManagementBPO.getAssetPropertyByAssetTrackId(assetTrack.getAssetTrackId());

if(assetPropertyLst != null){

if(!versionLst.contains(assetTrack.getVersion())){

  historyDetails.append(

“<tr bgcolor=’#ffffff’>”);

  versionLst.add(assetTrack.getVersion());

  historyDetails.append(

“<td align=’left’ valign=’top’ style='”+tablurStyleTD.toString()+“‘ >”);

  historyDetails.append(assetTrack.getVersion());

  historyDetails.append(

“</td>”);

  historyDetails.append(

“<td align=’left’ style='”+tablurStyleTD.toString()+“‘>”);

  historyDetails.append(

“<div style=’width:250px;’>”);

  StringBuffer properties =

new StringBuffer();

for(AssetProperty assetProperty : assetPropertyLst){

  String propKey = assetProperty.getPropertyKey();

  String displayCaption = assetProperty.getDisplayCaption();

if(!porpKeyLst.contains(propKey)){

  porpKeyLst.add(propKey);

  properties.append(

“<strong>”+displayCaption+“: </strong>”);

  properties.append(assetProperty.getValue()+

“,”);

  }

  }

if(properties.lastIndexOf(“,”) > 0)

  historyDetails.append(properties.substring(0,properties.lastIndexOf(

“,”)));

  historyDetails.append(

“</div>”);

  historyDetails.append(

“</td>”);

  historyDetails.append(

“</tr>”);

  }

  }

   }

   }

   }

else{

   historyDetails.append(

“<tr>”);

   historyDetails.append(

“<td align=’center’ width=’200px’ height=’40px’><span>Version history not found</span></td>”);

   historyDetails.append(

“</tr>”);

   }

   historyDetails.append(

“</table>”);

   mainJsonObj.put(

“historyDetails”,historyDetails.toString());

   out.println(mainJsonObj);

}

elseif(items.equalsIgnoreCase(“checkAsset”)){

if(assetObj == null)

out.println(

“false”);

else

 

out.println(

“true”);

}

if(items.equalsIgnoreCase(“rightItems”) || items.equalsIgnoreCase(“leftItems”)){

StringBuilder assetDetails =

new StringBuilder();

if(listAssets != null && listAssets.size() > 0){

Collections.sort(listAssets,

new ListComparator());

for (Asset asset : listAssets ) {

if(asset != null){

   String assetLabel =

“”;

   String assetCallBackId = asset.getAssetCallBackId();

           jsonObj =

new JSONObject();

           jsonObj.put(

“assetId”,asset.getAssetId());

   jsonObj.put(

“isAssetInProgress”,“false”);

          AssetEntity assetEntity = assetManagementBPO.getAssetEntityByAssetEntityId(asset.getAssetEntityId());

if(assetEntity.getStyle1() != null && assetEntity.getStyle2() != null &&

      assetEntity.getStyle3() !=

null && assetEntity.getStyle4() != null &&

      assetEntity.getStyle5() !=

null && assetEntity.getImageIcon() != null){

       style1 = assetEntity.getStyle1();

       style2 = assetEntity.getStyle2();

       style3 = assetEntity.getStyle3();

       style4 = assetEntity.getStyle4();

   style5 = assetEntity.getStyle5();

   imageIcon = assetEntity.getImageIcon();

      }

          assetDetails.append(

“<div id='”+asset.getAssetId()+“_asset’ class=’divWindow wordwrapText’ style='”+style4+“margin-top:6px;margin-bottom:6px;margin-left:50px;margin-right:50px;’>”);

boolean inProgress =  AssetManagementInterceptor.isAssetUpdateInProgress(asset.getAssetId());

//boolean inProgress =  true;

if(!inProgress){

           UserInfo createdUserInfo = userManagementBPO.getUserInfoById(asset.getAuditBean().getCreateById());

           UserInfo modifiedUserInfo =

null;

if(asset.getAuditBean().getModById() != null)

      modifiedUserInfo = userManagementBPO.getUserInfoById(asset.getAuditBean().getModById());

   AssetEntityProperty assetEntityProperty = assetManagementBPO.getAssetEntityPropertyByAssetEntityIdAndCaptionInd(assetEntity.getAssetEntityId());

if(assetEntityProperty != null){

  AssetProperty assetProperty = assetManagementBPO.getAssetPropertyByPropKeyAndAssetId(assetEntityProperty.getPropertyKey(),asset.getAssetId()).get(0);

if(assetProperty != null){

   assetLabel = assetProperty.getValue();

   }

}

if(!assetLabel.equals(“”))

assetLabel = assetLabel+

” – “+assetEntity.getEntityLable();

else

 

   assetLabel = assetEntity.getEntityLable();

   assetDetails.append(

“<table id='”+asset.getAssetId()+“_layout’ width=’100%’ cellspacing=’0′ cellpadding=’6′ border=’0′ >”);

   assetDetails.append(

“<tr style='”+style1+“‘ onmouseover=’showAssetTooltip(&quot;”+asset.getAssetId()+“&quot;,&quot;”+style1+“&quot;,&quot;”+style4+“&quot;)’ onmouseout=’hideAssetTooltip(&quot;”+asset.getAssetId()+“&quot;)’>”);

       assetDetails.append(

“<td valign=’middle’ align=’center’>”);

   assetDetails.append(

“<img id='”+asset.getAssetId()+“_icon’ src=”+contextPath+“/”+imageIcon+” title='”+assetEntity.getEntityLable()+“‘ alt='”+assetEntity.getEntityLable()+“‘ />”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

“<td valign=’middle’ align=’left’>”);

   assetDetails.append(

“<div class=’wordwrapText’ style=’width:250px;overflow:hidden;’ >”+assetLabel+“</div>”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“<tr style='”+style2+“‘>”);

   assetDetails.append(

“<td colspan=’2′>”);

   assetDetails.append(

“<span style=’color:gray;’>Created by </span>”);

   assetDetails.append(

“<span style=’font-weight:bold;’>”+ createdUserInfo.getFirstName()+” “+createdUserInfo.getLastName()+” “+“</span>”);

if(asset.getAuditBean().getCreateDtm() != null && !asset.getAuditBean().getCreateDtm().equals(“”))

   assetDetails.append(

“<span style=’color:gray;font-weight:bold;’>”+ new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”).format(asset.getAuditBean().getCreateDtm()) +” IST”+“</span>”);

   assetDetails.append(

“<br/>”);

if(modifiedUserInfo != null){

   assetDetails.append(

“<span style=’color:gray;’>Modified by </span>”);

   assetDetails.append(

“<span style=’font-weight:bold;’>”+ modifiedUserInfo.getFirstName()+” “+modifiedUserInfo.getLastName()+” “+“</span>”);

if(asset.getAuditBean().getModDtm() != null && !asset.getAuditBean().getModDtm().equals(“”))

   assetDetails.append(

“<span style=’color:gray;font-weight:bold;’>”+new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”).format(asset.getAuditBean().getModDtm())+” IST”+“</span>”);

   }

   assetDetails.append(

“</td>”);

       assetDetails.append(

“</tr>”);

       assetDetails.append(

“<tr style='”+style3+“‘>”);

   assetDetails.append(

“<td colspan=’2′ align=’left’ valign=’middle’>”);

   assetDetails.append(

“<table width=’100%’ border=’0′ cellspacing=’0′ cellpadding=’0′>”);

           assetDetails.append(

“<tr>”);

           String parentContainer =

“”;

   String childContainer =

“”;

if(containerEle.equalsIgnoreCase(“containerEle”)){

    parentContainer = containerEle+

“_parent”;

    childContainer = containerEle+

“_child”;

           }

elseif(containerEle.lastIndexOf(“_child”) > 0){

    parentContainer = containerEle.substring(0,containerEle.lastIndexOf(

“_”));

    childContainer = containerEle+

“_child”;

   }

elseif(containerEle.lastIndexOf(“_parent”) > 0){

    parentContainer = containerEle+

“_parent”;

    childContainer = containerEle.substring(0,containerEle.lastIndexOf(

“_”));

   }

           String width =

“35%”;

   assetDetails.append(

“<td width=’10%’>”);

   assetDetails.append(

“<img src='”+request.getContextPath()+“/images/plus.png’  alt=’expand’ title=’expand’ class=’imgPlusStyle_left’ id='”+asset.getAssetId()+“_img_plus_left’ onclick=’getLeftItems(&quot;”+asset.getAssetId()+“&quot;,&quot;”+parentContainer+“&quot;)’ />”);

   assetDetails.append(

“</td>”);

if(assetEntity.getOpenAssetLnk() != null){

      assetDetails.append(

“<td width=’32%’ align=’right’ valign=’top’>”);

          assetDetails.append(

“<span id='”+assetCallBackId+“‘ style=’cursor:pointer;text-decoration:underline;’ title=’open link’ onclick='”+assetEntity.getOpenAssetLnk()+“‘ >open link</span>”);

          assetDetails.append(

“</td>”);

   }

else{

   assetDetails.append(

“<td width=’32%’>&nbsp;</td>”);

   }

if(blnShowHistory){

   assetDetails.append(

“<td width=’29%’ align=’right’ valign=’top’>”);

       assetDetails.append(

“<span id='”+asset.getAssetId()+“_sh’ class=’show_history’ style=’cursor:pointer;text-decoration:underline;’ title=’show history’ onclick=’showHistory(this.id)’>show history</span>”);

       assetDetails.append(

“</td>”);

   }

else{

   width =

“20%”;

   }

   assetDetails.append(

“<td  width='”+width+“‘ align=’right’ valign=’top’>”);

   assetDetails.append(

“<span id='”+asset.getAssetId()+“_showmore’ style=’margin-right:10px;cursor:pointer;text-decoration:underline;’ title=’read more’ onclick=’showProperties(&quot;”+asset.getAssetId()+“&quot;)’>show more</span>”);

           assetDetails.append(

“</td>”);

   assetDetails.append(

“<td width=’5%’>”);

   assetDetails.append(

“<img src='”+request.getContextPath()+“/images/plus.png’  alt=’expand’ title=’expand’ class=’imgPlusStyle_right’ id='”+asset.getAssetId()+“_img_plus_right’ onclick=’getRightItems(&quot;”+asset.getAssetId()+“&quot;,&quot;”+style5+“&quot;,&quot;”+childContainer+“&quot;)’ />”);

   assetDetails.append(

“</td>”);

           assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

   assetDetails.append(

“</td>”);

           assetDetails.append(

“</tr>”);

              assetDetails.append(

“<tr bgcolor=’#ffffff’ id='”+asset.getAssetId()+“_property’ style=’display:none’>”);

              assetDetails.append(

“<td  colspan=’2′>”);

              assetDetails.append(

“<div id='”+asset.getAssetId()+“_propertyDiv’ style=’width:293px;’>”);

              assetDetails.append(

“</div>”);

              assetDetails.append(

“</td>”);

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

}

else{

   assetDetails.append(

“<table width=’100%’ height=’100%’ cellspacing=’0′ cellpadding=’6′ border=’0′>”);

   assetDetails.append(

“<tr style='”+style1+“‘>”);

   assetDetails.append(

“<td colspan=’2′>&nbsp;</td>”);

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“<tr style='”+style1+“‘>”);

   assetDetails.append(

“<td align=’right’>”);

   assetDetails.append(

“<img src='”+contextPath+“/images/ajax-loader.gif’ width=’16’ height=’16’/>”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

“<td align=’left’>”);

   assetDetails.append(

“Please wait,asset updation is in progress”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

“<tr style='”+style1+“‘>”);

   assetDetails.append(

“<td colspan=’2′>&nbsp;</td>”);

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

   jsonObj.put(

“isAssetInProgress”,“true”);

}

   assetDetails.append(

“<div class=’divClears’></div></div>”);

jsonObj.put(

“leftArrowColor”,style5);

jsonArray.add(jsonObj);

  }

     }

}

mainJsonObj.put(

“dataRoot”,jsonArray);

mainJsonObj.put(

“assetDetails”,assetDetails.toString());

out.println(mainJsonObj);

}

elseif(items.equalsIgnoreCase(“properties”)){

List<AssetEntityProperty> lstAssetEntityProperty = assetManagementBPO.getAssetEntityPropertyByAssetEntityId(assetObj.getAssetEntityId());

StringBuilder assetDetails =

new StringBuilder();

if(lstAssetEntityProperty != null && lstAssetEntityProperty.size() > 0){

   StringBuffer properties =

new StringBuffer();

for(AssetEntityProperty assetEntityProp : lstAssetEntityProperty){

   List<AssetProperty> lstAssetProperty = assetManagementBPO.getAssetPropertyByPropKeyAndAssetId(assetEntityProp.getPropertyKey(),assetObj.getAssetId());

if(lstAssetProperty != null){

   String displayCaption = lstAssetProperty.get(0).getDisplayCaption();

   properties.append(

“<strong>”+displayCaption+“: </strong>”);

   properties.append(lstAssetProperty.get(0).getValue()+

“,”);

   }

   }

if(properties.lastIndexOf(“,”) > 0)

assetDetails.append(properties.substring(0,properties.lastIndexOf(

“,”)));

   }

else

 

   assetDetails.append(

“Properties not found”);

out.println(assetDetails.toString());

}

elseif(items.equalsIgnoreCase(“asset”)){

boolean inProgress =  AssetManagementInterceptor.isAssetUpdateInProgress(assetObj.getAssetId());

// boolean inProgress =  true;

if(inProgress){

      out.println(

“true”);

      }

else{

   String assetLabel =

“”;

   String assetCallBackId = assetObj.getAssetCallBackId();

           StringBuilder assetDetails =

new StringBuilder();

          AssetEntity assetEntity = assetManagementBPO.getAssetEntityByAssetEntityId(assetObj.getAssetEntityId());

if(assetEntity.getStyle1() != null && assetEntity.getStyle2() != null &&

      assetEntity.getStyle3() !=

null && assetEntity.getStyle4() != null &&

      assetEntity.getStyle5() !=

null && assetEntity.getImageIcon() != null){

       style1 = assetEntity.getStyle1();

       style2 = assetEntity.getStyle2();

       style3 = assetEntity.getStyle3();

       style4 = assetEntity.getStyle4();

   style5 = assetEntity.getStyle5();

   imageIcon = assetEntity.getImageIcon();

      }

           UserInfo createdUserInfo = userManagementBPO.getUserInfoById(assetObj.getAuditBean().getCreateById());

           UserInfo modifiedUserInfo =

null;

if(assetObj.getAuditBean().getModById() != null)

      modifiedUserInfo = userManagementBPO.getUserInfoById(assetObj.getAuditBean().getModById());

   AssetEntityProperty assetEntityProperty = assetManagementBPO.getAssetEntityPropertyByAssetEntityIdAndCaptionInd(assetEntity.getAssetEntityId());

if(assetEntityProperty != null){

AssetProperty assetProperty = assetManagementBPO.getAssetPropertyByPropKeyAndAssetId(assetEntityProperty.getPropertyKey(),assetObj.getAssetId()).get(0);

if(assetProperty != null){

   assetLabel = assetProperty.getValue();

   }

}

if(!assetLabel.equals(“”))

assetLabel = assetLabel+

” – “+assetEntity.getEntityLable();

else

 

   assetLabel = assetEntity.getEntityLable();

   assetDetails.append(

“<table id='”+assetObj.getAssetId()+“_layout’ width=’100%’ cellspacing=’0′ cellpadding=’6′ border=’0′ >”);

   assetDetails.append(

“<tr style='”+style1+“‘ onmouseover=’showAssetTooltip(&quot;”+assetObj.getAssetId()+“&quot;,&quot;”+style1+“&quot;,&quot;”+style4+“&quot;)’ onmouseout=’hideAssetTooltip(&quot;”+assetObj.getAssetId()+“&quot;)’>”);

       assetDetails.append(

“<td valign=’middle’ align=’center’>”);

   assetDetails.append(

“<img id='”+assetObj.getAssetId()+“_icon’ src=”+contextPath+“/”+imageIcon+” title='”+assetEntity.getEntityLable()+“‘ alt='”+assetEntity.getEntityLable()+“‘ />”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

“<td valign=’middle’ align=’left’>”);

   assetDetails.append(

“<div class=’wordwrapText’ style=’width:250px;overflow:hidden;’ >”+assetLabel+“</div>”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“<tr style='”+style2+“‘>”);

   assetDetails.append(

“<td colspan=’2′>”);

   assetDetails.append(

“<span style=’color:gray;’>Created by </span>”);

   assetDetails.append(

“<span style=’font-weight:bold;’>”+ createdUserInfo.getFirstName()+” “+createdUserInfo.getLastName()+” “+“</span>”);

if(assetObj.getAuditBean().getCreateDtm() != null && !assetObj.getAuditBean().getCreateDtm().equals(“”))

   assetDetails.append(

“<span style=’color:gray;font-weight:bold;’>”+ new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”).format(assetObj.getAuditBean().getCreateDtm()) +” IST”+“</span>”);

   assetDetails.append(

“<br/>”);

if(modifiedUserInfo != null){

   assetDetails.append(

“<span style=’color:gray;’>Modified by </span>”);

   assetDetails.append(

“<span style=’font-weight:bold;’>”+ modifiedUserInfo.getFirstName()+” “+modifiedUserInfo.getLastName()+” “+“</span>”);

if(assetObj.getAuditBean().getModDtm() != null && !assetObj.getAuditBean().getModDtm().equals(“”))

   assetDetails.append(

“<span style=’color:gray;font-weight:bold;’>”+new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”).format(assetObj.getAuditBean().getModDtm())+” IST”+“</span>”);

   }

   assetDetails.append(

“</td>”);

       assetDetails.append(

“</tr>”);

       assetDetails.append(

“<tr style='”+style3+“‘>”);

   assetDetails.append(

“<td colspan=’2′ align=’left’ valign=’middle’>”);

   assetDetails.append(

“<table width=’100%’ border=’0′ cellspacing=’0′ cellpadding=’0′>”);

           assetDetails.append(

“<tr>”);

           String parentContainer =

“”;

   String childContainer =

“”;

if(containerEle.equalsIgnoreCase(“containerEle”)){

    parentContainer = containerEle+

“_parent”;

    childContainer = containerEle+

“_child”;

           }

elseif(containerEle.lastIndexOf(“_child”) > 0){

    parentContainer = containerEle.substring(0,containerEle.lastIndexOf(

“_”));

    childContainer = containerEle+

“_child”;

   }

elseif(containerEle.lastIndexOf(“_parent”) > 0){

    parentContainer = containerEle+

“_parent”;

    childContainer = containerEle.substring(0,containerEle.lastIndexOf(

“_”));

   }

           String width =

“35%”;

   assetDetails.append(

“<td width=’10%’>”);

   assetDetails.append(

“<img src='”+request.getContextPath()+“/images/plus.png’  alt=’expand’ title=’expand’ class=’imgPlusStyle_left’ id='”+assetObj.getAssetId()+“_img_plus_left’ onclick=’getLeftItems(&quot;”+assetObj.getAssetId()+“&quot;,&quot;”+parentContainer+“&quot;)’ />”);

   assetDetails.append(

“</td>”);

if(assetEntity.getOpenAssetLnk() != null){

      assetDetails.append(

“<td width=’32%’ align=’right’ valign=’top’>”);

          assetDetails.append(

“<span id='”+assetCallBackId+“‘ style=’cursor:pointer;text-decoration:underline;’ title=’open link’ onclick='”+assetEntity.getOpenAssetLnk()+“‘ >open link</span>”);

          assetDetails.append(

“</td>”);

   }

else{

   assetDetails.append(

“<td width=’32%’>&nbsp;</td>”);

   }

if(blnShowHistory){

   assetDetails.append(

“<td width=’29%’ align=’right’ valign=’top’>”);

       assetDetails.append(

“<span id='”+assetObj.getAssetId()+“_sh’ class=’show_history’ style=’cursor:pointer;text-decoration:underline;’ title=’show history’ onclick=’showHistory(this.id)’>show history</span>”);

       assetDetails.append(

“</td>”);

   }

else{

   width =

“20%”;

   }

   assetDetails.append(

“<td  width='”+width+“‘ align=’right’ valign=’top’>”);

   assetDetails.append(

“<span id='”+assetObj.getAssetId()+“_showmore’ style=’margin-right:10px;cursor:pointer;text-decoration:underline;’ title=’read more’ onclick=’showProperties(&quot;”+assetObj.getAssetId()+“&quot;)’>show more</span>”);

           assetDetails.append(

“</td>”);

   assetDetails.append(

“<td width=’5%’>”);

   assetDetails.append(

“<img src='”+request.getContextPath()+“/images/plus.png’  alt=’expand’ title=’expand’ class=’imgPlusStyle_right’ id='”+assetObj.getAssetId()+“_img_plus_right’ onclick=’getRightItems(&quot;”+assetObj.getAssetId()+“&quot;,&quot;”+style5+“&quot;,&quot;”+childContainer+“&quot;)’ />”);

   assetDetails.append(

“</td>”);

           assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

   assetDetails.append(

“</td>”);

           assetDetails.append(

“</tr>”);

           List<AssetEntityProperty> lstAssetEntityProperty = assetManagementBPO.getAssetEntityPropertyByAssetEntityId(assetObj.getAssetEntityId());

             assetDetails.append(

“<tr bgcolor=’#ffffff’ id='”+assetObj.getAssetId()+“_property’ style=’display:none’>”);

if(lstAssetEntityProperty != null && lstAssetEntityProperty.size() > 0){

             StringBuffer properties =

new StringBuffer();

             assetDetails.append(

“<td  colspan=’2′>”);

             assetDetails.append(

“<div id='”+assetObj.getAssetId()+“_propertyDiv’ style=’width:293px;’>”);

for(AssetEntityProperty assetEntityProp : lstAssetEntityProperty){

             List<AssetProperty> lstAssetProperty = assetManagementBPO.getAssetPropertyByPropKeyAndAssetId(assetEntityProp.getPropertyKey(),assetObj.getAssetId());

if(lstAssetProperty != null){

             String displayCaption = lstAssetProperty.get(0).getDisplayCaption();

             properties.append(

“<strong>”+displayCaption+“: </strong>”);

             properties.append(lstAssetProperty.get(0).getValue()+

“,”);

             }

             }

if(properties.lastIndexOf(“,”) > 0)

          assetDetails.append(properties.substring(0,properties.lastIndexOf(

“,”)));

             assetDetails.append(

“</div>”);

              assetDetails.append(

“</td>”);

             }

else

 

             assetDetails.append(

“<td colspan=’2′>Properties not found</td>”);

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

jsonObj =

new JSONObject();

jsonObj.put(

“assetId”,assetObj.getAssetId());

jsonObj.put(

“assetDetails”,assetDetails.toString());

out.println(jsonObj);

      }

}

%>

<%!

 

class

 

ListComparator implements Comparator{

publicint compare(Object obj1, Object obj2) {

Asset asset1 = (Asset)obj1;

Asset asset2 = (Asset)obj2;

if (asset1 == null || asset2 == null)

return -1;

else

return (asset1.getAuditBean().getCreateDtm()).compareTo(asset2.getAuditBean().getCreateDtm());

    }

}

%>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: