July 11, 2012

Posted in Uncategorized at 10:38 am by mrrohit007

http://download.java.net/maven/2/com/sun/jersey/jersey-archive/1.9-ea04/

Posted in Uncategorized at 9:01 am by mrrohit007

http://www.techienjoy.com/Hibernate-Interview-Questions.php http://www.techienjoy.com/Hibernate-One-to-Many-mapping-example.php

July 5, 2012

Posted in Uncategorized at 1:07 pm by mrrohit007

http://www.dzone.com/articles/when-should-i-use-orm

Posted in Uncategorized at 12:19 pm by mrrohit007

http://www.javabeat.net/2008/07/hibernate-basic-configuration-example/

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());

    }

}

%>

Posted in Uncategorized at 7:24 am by mrrohit007

<%@

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

<%@

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

<%@

pageimport=“java.util.List”%>

<%@

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

<%

AssetManagementBPO assetManagementBPO = (AssetManagementBPO)BeanLocatorFactory.getService(

“AssetManagementBPO”);

UserManagementBPO userManagementBPO = (UserManagementBPO)BeanLocatorFactory.getService(

“UserManagementBPO”);

int expandItems = 0;

boolean blnShowHistory = false;

boolean blnEmptyAsset = false;

boolean blnAssetInProgress  = false;

    String contextPath = request.getContextPath();

    StringBuilder assetDetails =

new StringBuilder();

//default styles if style properties are not present for the particular asset

    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”;

    String assetId = BizCmnFunctions.checkNull(request.getParameter(

“assetId”));

String strExpandItems = BizCmnFunctions.checkNull(request.getParameter(

“expandItems”));

String showHistory = BizCmnFunctions.checkNull(request.getParameter(

“sh”));

if(strExpandItems != “”)

expandItems = Integer.parseInt(strExpandItems);

if(showHistory != “”)

blnShowHistory = Boolean.parseBoolean(showHistory);

if(assetId != “”){

   Asset asset = assetManagementBPO.getAssetByAssetIdHavingDeleteInd(assetId);

if(asset != null){

//checks if asset is being updated

boolean inProgress =  AssetManagementInterceptor.isAssetUpdateInProgress(assetId);

//boolean inProgress =  true;

   String assetLabel =

“”;

   String assetCallBackId = asset.getAssetCallBackId();

//retriving all style properties of Asset which is shown as different layers of asset

   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;’>”);

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+” width=’11px’ height=’11px’ 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>”);

       String width =

“35%”;

       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>”);

   assetDetails.append(

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

   assetDetails.append(

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

   assetDetails.append(

“</td>”);

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

      assetDetails.append(

“<td width=’35%’ 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=’35%’>&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:15px;cursor:pointer;text-decoration:underline;’ title=’show more’ onclick=’showProperties(&quot;”+asset.getAssetId()+“&quot;)’>show more</span>”);

       assetDetails.append(

“</td>”);

   assetDetails.append(

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

   assetDetails.append(

“<img src='”+contextPath+“/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;containerEle_child&quot;)’ />”);

   assetDetails.append(

“</td>”);

       assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

   assetDetails.append(

“</td>”);

       assetDetails.append(

“</tr>”);

//retrieving asset properties to display in read more link

   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{

   blnAssetInProgress =

true;

   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>”);

   }

   assetDetails.append(

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

   }

else{

   blnEmptyAsset =

true;

   assetDetails.append(

“<div class=’divWindow wordwrapText’ style=’border:1px solid #8db2e3′>”);

   assetDetails.append(

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

   assetDetails.append(

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

   assetDetails.append(

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

   assetDetails.append(

“</tr>”);

   assetDetails.append(

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

   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 creation is in progress”);

   assetDetails.append(

“</td>”);

   assetDetails.append(

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

   assetDetails.append(

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

   assetDetails.append(

“</tr>”);

   assetDetails.append(

“</table>”);

   assetDetails.append(

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

}

   }

%>

<%@

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

<%@

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

<%@

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

<%@

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

<%@

pageimport=“java.util.ArrayList”%>

<%@

pageimport=“java.util.HashMap”%>

<%@

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

<%@

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

<%@

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

<%@

pageimport=“java.text.SimpleDateFormat”%>

<%@

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

<%@

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

<

head>

<

title>Dependency Graph</title>

<

styletype=“text/css”>

body table

{

font-family:Arial, Helvetica, sans-serif;

font-size:11px;

color:#003366;

}

.divWindow

{

font-size:11px;

width: 305px;

height:auto;

/*-moz-box-shadow: 3px 3px 3px #d2e5ff;*/

/*-webkit-box-shadow: 3px 3px 3px #d2e5ff;*/

/*box-shadow: 3px 3px 3px #d2e5ff;*/

}

.imgPlusStyle_right

{

float:right;

width:13;

height:13;

cursor:pointer;

}

.imgPlusStyle_left

{

float:left;

width:13;

height:13;

cursor:pointer;

}

.divClears

{

clear:both;

}

.wordwrapText

{

word-wrap: break-word;

}

</

style>

<!– <script type=”text/javascriptsrc=”<%=request.getContextPath()%>/extjs/adapter/ext/ext-base.js”></script>

<script type=”text/javascriptsrc=”

<%=request.getContextPath()%>/extjs/ext-all.js”></script>

–>

<scripttype=“text/javascript”src=<%=request.getContextPath()%>/js/jquery/js/jquery-1.3.2.min.js”></script>

<scripttype=“text/javascript”src=<%=request.getContextPath()%>/js/jquery/js/jquery-ui-1.7.2.custom.min.js”></script>

<scripttype=“text/javascript”src=<%=request.getContextPath()%>/js/jsplumb/jquery.jsPlumb-1.3.7-all-min.js”></script>

<scripttype=“text/javascript”src=<%=request.getContextPath()%>/js/maxis/jquery.json-2.2.min.js”></script>

<scripttype=“text/javascript”>

var progressBar;

var rightTargetIds = new Array();

var historyWinIds = new Array();

var simpleTipIds = new Array();

var assetId = “<%=assetId%>“;

var expandItems = “<%=expandItems%>“;

var assetDetails = “<%=assetDetails.toString()%>“;

var blnShowHistory = “<%=blnShowHistory%>“;

var blnEmptyAsset = “<%=blnEmptyAsset%>“;

var blnAssetInProgress = “<%=blnAssetInProgress%>“;

var contextPath = “<%=contextPath%>“;

var jsPlumbConnInstance;

var color = “<%=style5%>“;

var arrowColors = new Array();

var jsPlumbConnInstanceArr = new Array();

//calls on body load

function pageInit()

{

//expandItems = 12;

//check if asset is created or not

if(blnEmptyAsset == “true”){

$(

“#containerEle”).append(generateDivComponent(assetId,“containerEle”,assetDetails));

checkAsset(assetId);

}

//checks if asset status is beign updated

elseif(blnAssetInProgress == “true”){

$(

“#containerEle”).append(generateDivComponent(assetId,“containerEle”,assetDetails));

checkAssetInProgress(

“”,assetId,blnShowHistory,“containerEle”)

}

elseif(assetId != “” && assetDetails != “”){

$(

“#containerEle”).append(generateDivComponent(assetId,“containerEle”,assetDetails));

if(expandItems >= 2){

expandMultipleItems(assetId,color,

“containerEle_child”);

}

elseif(expandItems == 1){

getRightItems(assetId,color,

“containerEle_child”);

}

if($.browser.msie){

//IE fix

$(

“#containerEle_Parent”).draggable({

cursor:

“move”,

disabled:

false,

addClasses:

false,

drag:

function(event, ui) {

doLayoutVersionHistory();

}

});

}

else{

$(

“#containerEle”).draggable({

cursor:

“move”,

disabled:

false,

addClasses:

false,

stop :

function(event, ui) {

doLayoutVersionHistory();

}

});

}

}

}

//checks if asset is created

function checkAsset(assetId){

jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    data :{

    assetId :assetId,

                items:

“checkAsset”,

                token:

new Date()

                },

                success:

function (result)

                {

if($.trim(result) == “true”){

                window.location.reload();

            }

else{

            window.setTimeout(

“checkAsset(‘”+assetId+“‘)”,1000);

        }

                },

                failure:

function(result){

         }

});

}

//check child/parent assets are being updated

function checkAssetInProgress(id,assetId,blnShowHistory,containerEle){

jQuery.ajax({

url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

“POST”,

    data :{

    assetId :assetId,

items:

“asset”,

blnShowHistory:blnShowHistory,

containerEle:containerEle,

               token:

new Date()

               },

   success:

function(result)

   {

if($.trim(result) == “true”){

   window.setTimeout(

“checkAssetInProgress(‘”+id+“‘,'”+assetId+“‘,”+blnShowHistory+“,'”+containerEle+“‘)”,1000);

   }

else{

var jsonData = jQuery.evalJSON(result);

if(document.getElementById(jsonData.assetId+“_asset”) != null)

   document.getElementById(jsonData.assetId+

“_asset”).innerHTML = jsonData.assetDetails;

if(id != “”){

var connInstance = jsPlumbConnInstanceArr[id];

if(connInstance != undefined){

if(rightTargetIds[id] != undefined && rightTargetIds[id].length > 0 ){

connInstance.repaintEverything();

}

}

   }

   }

   },

failure:

function(result){

  }

});

}

//shows asset properties as tooltip for asset

function showAssetTooltip(id,bgColor,borderColor){

bgColor = bgColor.substring(bgColor.indexOf(

“:”)+1,bgColor.indexOf(“;”));

borderColor = borderColor.substring(borderColor.indexOf(

“:”)+1,borderColor.indexOf(“;”));

var position = $(“#”+id+“_icon”).offset();

var leftPos = position.left;

var topPos = position.top;

var propDiv = document.getElementById(id+“_propertyDiv”);

var simpleTipDiv = document.getElementById(id+“_simpletip”);

if(simpleTipIds[id+“_simpletip”] == undefined)

  simpleTipIds[id+

“_simpletip”] = id+“_simpletip”;

if(simpleTipDiv == null){

  $(

‘<div id=”‘+id+‘_simpletip”></div>’).css({

‘position’: ‘absolute’,

‘display’: ‘none’,

‘top’: topPos+20,

‘left’: leftPos-100,

‘width’:‘293px’,//250

‘height’:‘auto’,

‘border’:borderColor,

‘padding’: ‘5px’,

‘z-index’: ‘8890’,

‘background-color’:bgColor,

‘font-family’:‘Arial, Helvetica, sans-serif’,

‘font-size’:’11px’

        }).appendTo(

“body”).fadeIn(500);

}

if(simpleTipDiv != null && propDiv.innerHTML != “”){

document.getElementById(id+

“_simpletip”).innerHTML = propDiv.innerHTML;

$(

“#”+id+“_simpletip”).css({

top: topPos+20,

        left: leftPos-100

}).show();

}

elseif(simpleTipDiv != null && simpleTipDiv.innerHTML != “”){

$(

“#”+id+“_simpletip”).css({

top: topPos+20,

        left: leftPos-100

}).show();

}

else{

jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    async:

false,

    data :{

    assetId :id,

                items:

“properties”,

                token:

new Date()

                },

                success:

function (result)

                {

var content = $.trim(result);

                document.getElementById(id+

“_simpletip”).innerHTML = content;

                },

                failure:

function (result) {

  }

});

}

    }

//hide asset tooltip

function hideAssetTooltip(id){

if(document.getElementById(id+“_simpletip”) != null)

$(

“#”+id+“_simpletip”).hide();

}

//retrieves history details of asset properties

function showHistory(id){

var assetId = id.substring(0,id.indexOf(“_”));

var spanEle = document.getElementById(id);

spanEle.innerHTML =

“hide history”;

spanEle.title =

“hide history”;

spanEle.onclick =

function(e){

var evt = window.event || e ;//cross browserevent object

hideHistory(id);

};

if(historyWinIds[assetId+“_history”] == undefined)

historyWinIds[assetId+

“_history”] = assetId+“_history”;

var position = $(“#”+id).offset();

var leftPos = position.left;

var topPos = position.top+25;

if(document.getElementById(assetId+“_history”) == null){

$(

‘<div id=”‘+assetId+‘_history”><img id=”‘+assetId+‘_loadImg” src=”‘+contextPath+‘/images/ajax-loader.gif” width=”16″ height=”16″></div>’).css({

‘position’: ‘absolute’,

‘left’:+leftPos+,

‘top’:+topPos+,

‘z-index’: ‘8888’,

‘width’:‘350px’,

‘min-height’:’50px’,

‘max-height’:‘320px’,

‘overflow’:‘auto’

        }).appendTo(

“body”);

jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    async:

false,

    data :{

    assetId :assetId,

                items:

“showHistory”,

                token:

new Date()

                },

                success:

function ( result )

                {

var jsonData = jQuery.evalJSON(result);

      document.getElementById(assetId+

“_history”).innerHTML = jsonData.historyDetails;

                },

                failure:

function (result) {

  }

});

}

else{

  $(

“#”+assetId+“_history”).css({

‘left’:+leftPos+,

‘top’:+topPos+

});

}

  $(

“#”+assetId+“_history”).show( “fold”, {}, 500 );

  }

//hide history details

function hideHistory(id){

var assetId = id.substring(0,id.indexOf(“_”));

var spanEle = document.getElementById(id);

spanEle.innerHTML =

“show history”;

spanEle.title =

“show history”;

spanEle.onclick =

function(e){

var evt = window.event || e ;//cross browserevent object

showHistory(id);

};

$(

“#”+assetId+“_history”).hide( “fold”, {}, 500 );

}

//changes the position of history div when other assets as moved

function doLayoutVersionHistory(){

for(var historyId in historyWinIds){

if(historyWinIds[historyId] != undefined){

var id = historyWinIds[historyId];

var assetId = id.substring(0,id.indexOf(“_”));

if(document.getElementById(id) != null){

var position = $(“#”+assetId+“_sh”).offset();

var leftPos = position.left;

var topPos = position.top+25;

  $(

“#”+id).css({‘left’:+leftPos+,

‘top’:+topPos+});

}

  }

  }

  }

//remove asset history details from DOM

function removeHistory(id){

if(historyWinIds[id+“_history”] != undefined){

if(document.getElementById(id+“_history”) != null){

$(

“#”+id+“_history”).remove();

delete simpleTipIds[id+“_history”];

  }

  }

  }

//remove tooltips from DOM

function removeToolTip(id){

if(simpleTipIds[id+“_simpletip”] != undefined){

if(document.getElementById(id+“_simpletip”) != null){

$(

“#”+simpleTipIds[id+“_simpletip”]).remove();

delete simpleTipIds[id+“_simpletip”];

}

}

}

//shows asset properties

function showProperties(id){

var anchEle = document.getElementById(id+“_showmore”);

  anchEle.innerHTML =

“hide”;

  anchEle.title =

“hide”;

  anchEle.onclick =

function(e){

var evt = window.event || e ;//cross browserevent object

hideProperties(id);

};

if(document.getElementById(id+“_propertyDiv”).innerHTML == “”){

jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    async:

false,

    data :{

    assetId :id,

                items:

“properties”,

                token:

new Date()

                },

                success:

function (result)

                {

                document.getElementById(id+

“_propertyDiv”).innerHTML = result;

                },

                failure:

function (result) {

  }

});

  }

document.getElementById(id+

“_property”).style.display = ‘table-row’;

            $(

“#”+id+“_showmore”).focus();

doLayoutVersionHistory();

repaintConnections();

  }

//hide asset properties

function hideProperties(id){

  document.getElementById(id+

“_property”).style.display = ‘none’;

var anchEle = document.getElementById(id+“_showmore”);

  anchEle.innerHTML =

“show more”;

  anchEle.title =

“show more”;

  anchEle.onclick =

function(e){

var evt = window.event || e ;//cross browserevent object

showProperties(id);

};

$(

“#”+id+“_showmore”).focus();

doLayoutVersionHistory();

repaintConnections();

  }

//repaint every connection when new assets are expanded

function repaintConnections(){

for(var connId in jsPlumbConnInstanceArr){

//alert(“connId >>>”+connId);

var connInstance = jsPlumbConnInstanceArr[connId];

//alert(“connInstance >>>”+connInstance);

if(connInstance != undefined){

if(rightTargetIds[connId] != undefined && rightTargetIds[connId].length > 0 ){

connInstance.repaintEverything();

}

else{

connInstance.reset();

}

}

}

  }

//creates connection between expanded asset with its child/parent assets

function createConnection(id)

{

jsPlumb.ready(

function() {

jsPlumb.Defaults.Container =

‘containerEle’;

    jsPlumbConnInstance = jsPlumb.getInstance();

jsPlumbConnInstance.setRenderMode(jsPlumb.CANVAS);

jsPlumbConnInstanceArr[id] = jsPlumbConnInstance;

var overlays = [[ “Arrow”, { location:1 }, { foldback:0.5, fillStyle:color, width:12 } ]];

var divSrcId = id;

if(arrowColors[divSrcId] != undefined)

color = arrowColors[divSrcId];

var childs = rightTargetIds[id];

if(childs != undefined){

for(var i=0; i<childs.length; i++){

var divDestId = childs[i];

if(divDestId != “” && divDestId != undefined){

var componentSrc = document.getElementById(divSrcId+“_asset”);

var componentDest = document.getElementById(divDestId+“_asset”);

if((componentSrc != null) && (componentDest != null))

{

jsPlumbConnInstance.connect({

source:divSrcId+

“_asset”,

target: divDestId+

“_asset”,

anchors:[

“RightMiddle”,“LeftMiddle”],

paintStyle:{lineWidth:1,strokeStyle:color},

endpoint:

“Blank”,

connector: [

“Bezier”, { curviness:50 } ],

overlays:overlays

});

}

}

}

}

});

}

//creates div in which asset details are shown for selected asset

function generateDivComponent(assetId,containerEle,assetDetails)

  {

var component = document.getElementById(assetId);

if(component == null)

{

var index = 0;

var dmDiv = new Array();

dmDiv[index++] =

“<table id='”+containerEle+“_table’ border=’0′ cellspacing=’0′  >”;

dmDiv[index++] =

“<tr>”;

dmDiv[index++] =

“<td id='”+containerEle+“_parent’>”;

dmDiv[index++] =

“</td>”;

dmDiv[index++] =

“<td id='”+containerEle+“_root’>”;

dmDiv[index++] = assetDetails;

dmDiv[index++] =

“</td>”;

dmDiv[index++] =

“<td id='”+containerEle+“_child’>”;

dmDiv[index++] =

“</td>”;

dmDiv[index++] =

“</tr>”;

dmDiv[index++] =

“</table>”;

return dmDiv.join(“”);

}

}

// expands multiple child assets

function expandMultipleItems(assetId,arrowStyleColor,containerEle)

    {

  arrowColors[assetId] = arrowStyleColor;

  parent.startProgressbar(

“Please wait…”);

  jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    data :{

    assetId :assetId,

                items:

“rightItems”,

                blnShowHistory:blnShowHistory,

                containerEle:containerEle,

                token:

new Date()

                },

                success:

function (result)

                {

                expandFirstLevel(result,assetId,blnShowHistory,containerEle,

true);

                },

                failure:

function (result) {

  }

});

  }

//expands first level child assets

function expandFirstLevel(result,id,blnShowHistory,containerEle,flag)

    {

var imgEle = document.getElementById(id+“_img_plus_right”);

imgEle.src =

“”+contextPath+“/images/minus.png”;

imgEle.title =

“collapse”;

imgEle.alt =

“collapse”;

imgEle.onclick =

function(e){

var evt = window.event || e ;//cross browserevent object

hideRightComp(id,arrowColors[id],containerEle);

};

var jsonData = jQuery.evalJSON(result);

if ((jsonData != null) && (jsonData != “”) && (jsonData != undefined)){

var len = jsonData.dataRoot.length;

if(len == 0){

$(imgEle).hide();

    }

else{

if(containerEle.indexOf(“_parent”) == -1 && document.getElementById(containerEle+“_child”) == null){

var childContainer = “<td id='”+containerEle+“_child’>”;

   childContainer +=

“</td>”;

   $(

“#”+containerEle).after(childContainer);

}

var assetDetails = jsonData.assetDetails;

            $(

“#”+containerEle).append(assetDetails);

for(var i=0; i<len; i++){

var assetId = jsonData.dataRoot[i].assetId;

     arrowColors[assetId] = jsonData.dataRoot[i].leftArrowColor;

var isAssetInProgress = jsonData.dataRoot[i].isAssetInProgress;

if(assetId != id){

var rightTargetArr = rightTargetIds[id];

if(rightTargetArr == undefined)

     rightTargetIds[id] =

new Array(assetId);

else

     rightTargetArr[rightTargetArr.length] = assetId;

     }

if(isAssetInProgress == “true”)

            checkForAssetStatus(id,assetId,blnShowHistory,containerEle,containerEle+

“_child”,flag);

elseif(flag)

            expandSecondLevel(assetId,id,blnShowHistory,containerEle+

“_child”);

            }

if(jsPlumbConnInstanceArr[id] != undefined){

            jsPlumbConnInstanceArr[id].reset();

delete jsPlumbConnInstanceArr[id];

            }

            repaintConnections();

            createConnection(id);

      }

            }

parent.stopProgressbar();

      }

function checkForAssetStatus(id,assetId,blnShowHistory,parentContainerEle,containerEleId,flag){

      jQuery.ajax({

url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

“POST”,

    data :{

    assetId :assetId,

items:

“asset”,

blnShowHistory:blnShowHistory,

containerEle:parentContainerEle,

             token:

new Date()

             },

   success:

function(result)

   {

if($.trim(result) == “true”){

   window.setTimeout(

“checkForAssetStatus(‘”+id+“‘,'”+assetId+“‘,'”+blnShowHistory+“‘,'”+parentContainerEle+“‘,'”+containerEleId+“‘,”+flag+“)”,1000);

   }

else{

var jsonData = jQuery.evalJSON(result);

if(document.getElementById(jsonData.assetId+“_asset”) != null)

   document.getElementById(jsonData.assetId+

“_asset”).innerHTML = jsonData.assetDetails;

if(flag){

   expandSecondLevel(assetId,id,blnShowHistory,containerEleId);

   }

else{

   repaintConnections();

   }

   }

   },

failure:

function(result){

  }

});

  }

//expands second level child assets

function expandSecondLevel(assetId,id,blnShowHistory,containerEle)

      {

  jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    async:

false,

    data :{

    assetId :assetId,

                items:

“rightItems”,

                blnShowHistory:blnShowHistory,

                containerEle:containerEle,

                token:

new Date()

               },

                success:

function (result)

                {

                expandFirstLevel(result,assetId,blnShowHistory,containerEle,

false);

                },

                failure:

function (result) {

  }

});

      }

//retrieves all child assets on expand right bottom expand image

function getRightItems(assetId,arrowStyleColor,containerEle)

   {

   arrowColors[assetId] = arrowStyleColor;

    parent.startProgressbar(

“Please wait…”);

    jQuery.ajax({

    url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

    type:

‘POST’,

    data :{

    assetId :assetId,

                items:

“rightItems”,

                blnShowHistory:blnShowHistory,

                containerEle:containerEle,

                token:

new Date()

                },

                success:

function (result){

                createRightItems(result,assetId,blnShowHistory,containerEle);

                },

                failure:

function (result) {

  }

});

   }

//retrieves all parent assets on expand left bottom expand image

function getLeftItems(assetId,containerEle)

   {

   parent.startProgressbar(

“Please wait…”);

   jQuery.ajax({

            url: ‘

<%=request.getContextPath()%>/asset/DependencyGraph/dependencyData.jsp‘,

            type:

‘POST’,

            data :{

            assetId:assetId,

            items:

“leftItems”,

            blnShowHistory:blnShowHistory,

            containerEle:containerEle,

            token:

new Date()

                },

                success:

function (result){

    createLeftItems(result,assetId,blnShowHistory,containerEle);

                },

                failure:

function (result) {

  }

});

   }

//creates div in which child assets are displayed and connects to its parent

function createRightItems(result,id,blnShowHistory,containerEle)

   {

var imgEle = document.getElementById(id+“_img_plus_right”);

imgEle.src =

“”+contextPath+“/images/minus.png”;

imgEle.title =

“collapse”;

imgEle.alt =

“collapse”;

imgEle.onclick =

function(e){

var evt = window.event || e ;//cross browserevent object

hideRightComp(id,arrowColors[id],containerEle);

};

var index = 0;

var dmDiv = new Array();

var jsonData = jQuery.evalJSON(result);

if ((jsonData != null) && (jsonData != “”) && (jsonData != undefined)){

var len = jsonData.dataRoot.length;

if(len == 0){

$(imgEle).hide();

    }

else{

if(containerEle.indexOf(“_parent”) == -1 && document.getElementById(containerEle+“_child”) == null){

var childContainer = “<td id='”+containerEle+“_child’>”;

   childContainer +=

“</td>”;

   $(

“#”+containerEle).after(childContainer);

}

if(document.getElementById(containerEle).innerHTML != “”){

if(containerEle == “containerEle”)

$(

‘#’+containerEle+‘_root’).children(“:last”).css(‘margin-bottom’,’40px’);

else

 

            $(

‘#’+containerEle).children(“:last”).css(‘margin-bottom’,’40px’);

            }

var assetDetails = jsonData.assetDetails;

if(containerEle == “containerEle”){

       $(

“#”+containerEle+“_root”).append(assetDetails);

            }

else{

       $(

“#”+containerEle).append(assetDetails);

           }

for(var i=0; i<len; i++){

var assetId = jsonData.dataRoot[i].assetId;

var isAssetInProgress = jsonData.dataRoot[i].isAssetInProgress;

if(assetId != id){

var rightTargetArr = rightTargetIds[id];

if(rightTargetArr == undefined)

     rightTargetIds[id] =

new Array(assetId);

else

     rightTargetArr[rightTargetArr.length] = assetId;

     }

if(isAssetInProgress == “true”)

            checkAssetInProgress(id,assetId,blnShowHistory,containerEle);

            }

if(jsPlumbConnInstanceArr[id] != undefined){

            jsPlumbConnInstanceArr[id].reset();

delete jsPlumbConnInstanceArr[id];

            }

            repaintConnections();

            createConnection(id);

var position = $(“#”+id+“_icon”).offset();

window.scrollTo(position.left-10,position.top-200);

doLayoutVersionHistory();

}

            }

parent.stopProgressbar();

      }

//creates div in which parent assets are displayed and connects to is child(s)

function createLeftItems(result,id,blnShowHistory,containerEle)

  {

var imgEle = document.getElementById(id+“_img_plus_left”);

     $(imgEle).hide();

var jsonData = jQuery.evalJSON(result);

if ((jsonData != null) && (jsonData != “”) && (jsonData != undefined)){

var len = jsonData.dataRoot.length;

if(len > 0){

if(containerEle.indexOf(“_child”) == -1 && document.getElementById(containerEle+“_parent”) == null){

var childContainer = “<td id='”+containerEle+“_parent’>”;

   childContainer +=

“</td>”;

   $(

“#”+containerEle).before(childContainer);

}

var assetDetails = jsonData.assetDetails;

if(containerEle == “containerEle”){

       $(

“#”+containerEle+“_root”).append(assetDetails);

       }

else{

       $(

“#”+containerEle).append(assetDetails);

           }

for(var i=0; i<len; i++){

var assetId = jsonData.dataRoot[i].assetId;

     arrowColors[assetId] = jsonData.dataRoot[i].leftArrowColor;

var isAssetInProgress = jsonData.dataRoot[i].isAssetInProgress;

if(assetId != id){

var rightTargetArr = rightTargetIds[assetId];

if(rightTargetArr == undefined)

     rightTargetIds[assetId] =

new Array(id);

else

     rightTargetArr[rightTargetArr.length] = id;

     }

if(isAssetInProgress == “true”)

            checkAssetInProgress(id,assetId,blnShowHistory,containerEle);

if(jsPlumbConnInstanceArr[assetId] != undefined){

           jsPlumbConnInstanceArr[assetId].reset();

delete jsPlumbConnInstanceArr[assetId];

           }

           createConnection(assetId);

            }

            repaintConnections();

var position = $(“#”+id+“_icon”).offset();

    window.scrollTo(position.left-450,position.top-200);

    doLayoutVersionHistory();

    }

        }

parent.stopProgressbar();

     }

//collapse child assets

function hideRightComp(id,arrowColor,containerEle)

{

var imgEle = document.getElementById(id+“_img_plus_right”);

imgEle.src =

“”+contextPath+“/images/plus.png”;

imgEle.title =

“expand”;

imgEle.alt =

“expand”;

imgEle.onclick =

function(e){

var evt = window.event || e ; //cross browserevent object

getRightItems(id,arrowColor,containerEle);

};

detachConnection(id,rightTargetIds);

rightTargetIds[id] =

new Array();

if(jsPlumbConnInstanceArr[id] != undefined){

        jsPlumbConnInstanceArr[id].reset();

delete jsPlumbConnInstanceArr[id];

        }

        repaintConnections();

        createConnection(id);

var position = $(“#”+id+“_icon”).offset();

window.scrollTo(position.left,position.top-200);

doLayoutVersionHistory();

}

//removes all jsPlumb connections on selected asset

function detachConnection(id,destArray)

{

var childItems = destArray[id];

//alert(“childItems >>>>>>>”+childItems);

var flag = false;

if(childItems != undefined){

for(var i=0; i<childItems.length; i++){

   flag =

false;

   inner:

for(var parent in destArray){

if(parent != id){

var childs = destArray[parent];

if(childs != undefined){

for(var j=0; j<childs.length; j++){

if(childItems[i] != “” && childs[j] != “”){

if(childItems[i] == childs[j]){

//alert(“——- FOUND ——-“+childItems[i]);

   flag =

true;

break inner;

   }

   }

   }

   }

   }

   }

if(flag){

   childItems[i] =

“”;

   }

else{

if(document.getElementById(childItems[i]+“_asset”) != null)

   $(

“#”+childItems[i]+“_asset”).remove();

   removeHistory(childItems[i]);

   removeToolTip(childItems[i]);

   detachConnection(childItems[i],destArray);

   destArray[childItems[i]] =

new Array();

   }

   }

}

   destArray[id] =

new Array();

}

//opens gridview metadata for Metadata

function viewTransformationMtdt(id){

parent.parent.openTransformationMtdt(id);

}

//opens view mapping for Map

function viewTransformationMap(id){

parent.parent.openTransformationMap(id);

}

</script>

</head>

<bodyid=“DM_body”onLoad=“pageInit()”onUnload=“jsPlumb.unload();”>

<tableid=‘containerEle_Parent’border=“0”align=“center”width=“100%”height=“100%”style=“padding-top:20px;padding-bottom:20px;padding-left:50px;padding-right:50px;”>

<trheight=“10%”>

<td>&nbsp;</td>

</tr>

<trheight=“60%”>

<tdalign=“center”>

<divid=“containerEle”></div>

</td>

</tr>

<trheight=“30%”>

<td>&nbsp;</td>

</tr>

</table>

</

body>

</

html>

DB script

Posted in Uncategorized at 7:23 am by mrrohit007

USE mst; DESC CUSTOMERS;

CREATE TABLE CUSTOMERS( CUSTOMERID INT NOT NULL, NAME VARCHAR(200), AGE INT, ADDRESS VARCHAR(200), PRIMARY KEY(CUSTOMERID) );

CREATE TABLE CUSTOMERSTRACK( CUSTOMERTRACKID INT NOT NULL, NAME VARCHAR(200), AGE INT, ADDRESS VARCHAR(200), PRIMARY KEY(CUSTOMERTRACKID) );

CREATE TRIGGER `Customers_Track_Insert` AFTER INSERT ON `customers` FOR EACH ROW BEGIN insert into CUSTOMERSTRACK(CUSTOMERTRACKID,NAME,AGE,ADDRESS,CUSTOMERID)  values((select uuid()),NEW.NAME,NEW.AGE,NEW.ADDRESS,NEW.CUSTOMERID) END

GRANT ALL PRIVILEGES ON mst.* TO ‘root’@’localhost’ IDENTIFIED BY ‘root’; GRANT ALL PRIVILEGES ON mst.* TO ‘root’@’%’ WITH GRANT OPTION;

DROP TRIGGER Customers_Track_Insert

ALTER TABLE CUSTOMERSTRACK add CUSTOMERID INT NOT NULL

CREATE TABLE CUSTOMERS1( CUSTOMERID INT NOT NULL, NAME VARCHAR(200), AGE INT, ADDRESS VARCHAR(200), PRIMARY KEY(CUSTOMERID) );

TRUNCATE table CUSTOMERS1

INSERT INTO CUSTOMERS1 VALUES (1, ‘Ramesh’, 32, ‘Ahmedabad’ );

DROP table CUSTOMERS1

UPDATE CUSTOMERS SET NAME=’Ramu’ where NAME=’RAmesh’;

DELETE FROM CUSTOMERS where CUSTOMERID=2;

SELECT * FROM CUSTOMERS WHERE NAME LIKE ‘k%’

SELECT * FROM CUSTOMERS WHERE NAME LIKE ‘%k’

SELECT * FROM CUSTOMERS WHERE NAME LIKE ‘_a%’

SELECT * FROM CUSTOMERS WHERE NAME LIKE ‘R__u’

SELECT * FROM CUSTOMERS GROUP BY AGE ORDER BY AGE DESC

SELECT DISTINCT AGE FROM CUSTOMERS

SELECT * FROM CUSTOMERS WHERE AGE BETWEEN 22 AND 30

CREATE UNIQUE INDEX index_1 ON CUSTOMERS(CUSTOMERID,NAME);

ALTER TABLE CUSTOMERS DROP INDEX index_1

ALTER TABLE customer1 RENAME TO customers

ALTER TABLE customers add SALARY DECIMAL(18,2)

ALTER TABLE customers modify SALARY INT

ALTER TABLE customers drop SALARY

Select * from customers where salary is null

Select * from customers where age <=27

Select * from customers where age in (20,30,22)

Select * from customers where age between 20 and 30

SELECT AGE FROM CUSTOMERS WHERE AGE IN (SELECT AGE FROM CUSTOMERS WHERE AGE > 25);

SELECT AGE FROM CUSTOMERS WHERE AGE IN (SELECT AGE FROM CUSTOMERS WHERE CUSTOMERID > 3);

SELECT AGE FROM CUSTOMERS WHERE EXISTS (SELECT AGE FROM CUSTOMERS WHERE AGE < 20);

SELECT * FROM CUSTOMERS WHERE AGE > ALL (SELECT AGE FROM CUSTOMERS WHERE SALARY > 2000);

SELECT * FROM CUSTOMERS WHERE AGE >= ALL (SELECT AGE FROM CUSTOMERS);

SELECT * FROM CUSTOMERS WHERE AGE > ANY (SELECT AGE FROM CUSTOMERS WHERE SALARY > 2000);

SELECT * FROM CUSTOMERS WHERE AGE > ANY (SELECT AGE FROM CUSTOMERS);

CREATE TABLE CUSTOMER_COPY AS( SELECT NAME,AGE FROM CUSTOMERS )

drop table CUSTOMER_COPY

SELECT * FROM CUSTOMERS where NAME LIKE ‘%a%’ GROUP BY CUSTOMERID HAVING AGE>25

ALTER TABLE CUSTOMERS MODIFY SALARY DECIMAL(18,2) DEFAULT 1000.00

Alter TABLE CUSTOMERS ALTER COLUMN SALARY SET DEFAULT 1000.00

ALTER TABLE CUSTOMERS ALTER COLUMN SALARY DROP DEFAULT

ALTER TABLE CUSTOMERS ADD CONSTRAINT unqConstr UNIQUE(NAME,ADDRESS)

ALTER TABLE CUSTOMERS DROP CONSTRAINT unqConstr

INSERT INTO CUSTOMERS(CUSTOMERID,NAME,AGE,ADDRESS) VALUES (7, ‘test’, 33, ‘Ahmedabad’ );

INSERT INTO CUSTOMERS(CUSTOMERID,NAME,AGE,ADDRESS) VALUES (8, ‘test’, 33, ‘Ahmedabad’ );

ALTER TABLE CUSTOMERS DROP PRIMARY KEY

ALTER TABLE CUSTOMERS ADD CONSTRAINT PK PRIMARY KEY(CUSTOMERID)

ALTER TABLE CUSTOMERSTRACK ADD CONSTRAINT FK FOREIGN KEY(CUSTOMERID) REFERENCES CUSTOMERS(CUSTOMERID)

ALTER TABLE CUSTOMERS ADD CONSTRAINT chk CHECK(AGE>=20)

INSERT INTO CUSTOMERS(CUSTOMERID,NAME,AGE,ADDRESS) VALUES (9, ‘test1’, 17, ‘Ahmedabad’ );

DROP TABLE CUSTOMERSTRACK

CREATE TABLE CUSTOMERSTRACK( CUSTOMERTRACKID INT, NAME VARCHAR(255), AGE INT(3), CUSTOMERID INT, CONSTRAINT PK PRIMARY KEY(CUSTOMERTRACKID), CONSTRAINT FK FOREIGN KEY(CUSTOMERID) REFERENCES CUSTOMERS(CUSTOMERID) );

INSERT INTO CUSTOMERSTRACK values(11,’Ram’,24,1)

INSERT INTO CUSTOMERSTRACK values(12,’SAM’,22,3)

INSERT INTO CUSTOMERSTRACK values(13,’John’,22,3)

INSERT INTO CUSTOMERSTRACK values(14,’Rob’,23,4)

SELECT CUSTOMERS.CUSTOMERID,CUSTOMERS.NAME FROM CUSTOMERS INNER JOIN CUSTOMERSTRACK ON CUSTOMERS.CUSTOMERID=CUSTOMERSTRACK.CUSTOMERID

SELECT CUSTOMERS.CUSTOMERID,CUSTOMERS.NAME FROM CUSTOMERS LEFT JOIN CUSTOMERSTRACK ON CUSTOMERS.CUSTOMERID=CUSTOMERSTRACK.CUSTOMERID

SELECT CUSTOMERS.CUSTOMERID,CUSTOMERS.NAME FROM CUSTOMERS RIGHT JOIN CUSTOMERSTRACK ON CUSTOMERS.CUSTOMERID=CUSTOMERSTRACK.CUSTOMERID

SELECT CUSTOMERS.CUSTOMERID,CUSTOMERS.NAME,CUSTOMERSTRACK.CUSTOMERTRACKID  FROM CUSTOMERS FULL JOIN CUSTOMERSTRACK ON CUSTOMERS.CUSTOMERID=CUSTOMERSTRACK.CUSTOMERID ORDER BY CUSTOMERS.AGE

SELECT AGE,NAME FROM CUSTOMERS UNION SELECT AGE,NAME FROM CUSTOMERSTRACK

CREATE TABLE CUSTOMERS_BACKUP( CUSTOMERID INT NOT NULL, NAME VARCHAR(200), AGE INT, ADDRESS VARCHAR(200), PRIMARY KEY(CUSTOMERID) );

SELECT AGE,NAME INTO CUSTOMERS_BACKUP  FROM CUSTOMERS

ALTER TABLE CUSTOMERS ADD CONSTRAINT chk CHECK(AGE>20)

INSERT INTO CUSTOMERS values(10,’JAck’,10,’Delhi’,2100.00)

INSERT INTO CUSTOMERS values(20,’Sean’,45,’Delhi’,2100.00)

CREATE VIEW CUSTOMER_VIEW AS SELECT NAME FROM CUSTOMERS WHERE AGE>30

SELECT * FROM CUSTOMER_VIEW

UPDATE CUSTOMER_VIEW SET NAME=’Rex’ where NAME=’Sean’;

SELECT NOW(),CURDATE(),CURTIME() SELECT 1 AS BLAH

SELECT UCASE(NAME) as NAME FROM CUSTOMERS

SELECT C1.NAME,C2.AGE,C1.CUSTOMERID FROM CUSTOMERS C1,CUSTOMERS C2

SELECT AGE,NAME FROM CUSTOMERS UNION ALL SELECT AGE,NAME FROM CUSTOMERSTRACK

SELECT AGE,NAME FROM CUSTOMERS INTERSECT SELECT AGE,NAME FROM CUSTOMERSTRACK

DELETE FROM CUSTOMERS WHERE NAME=’Rex’ ROLLBACK;

SELECT * FROM CUSTOMERS

select LAST_INSERT_ID();

SELECT MAX(AGE) FROM CUSTOMERS WHERE AGE NOT IN(SELECT MAX(AGE) FROM CUSTOMERS)

SELECT * FROM CUSTOMERS C1 WHERE 4 in (SELECT COUNT(*) FROM CUSTOMERS C2 WHERE C2.AGE<=C1.AGE)

SELECT COUNT(DISTINCT AGE) AS AGE FROM CUSTOMERS

SELECT * FROM CUSTOMERS ORDER BY NAME DESC

SELECT * FROM CUSTOMERS GROUP BY NAME DESC HAVING SUM(AGE) > 30

SELECT C1.AGE,C2.NAME FROM CUSTOMERS C1,CUSTOMERS C2 WHERE C2.CUSTOMERID = C1.CUSTOMERID

SELECT CHAR(65) SELECT SUBSTRING(‘abx’,1,2) SELECT UPPER(‘abx’) SELECT UCASE(‘abx’)

SELECT * FROM CUSTOMERS LIMIT 0,3

USE STUDENT CREATE TABLE STUDENTDTL( STUDENTID INT NOT NULL, STUDENTNAME VARCHAR(255), CONSTRAINT PK PRIMARY KEY(STUDENTID) );

CREATE TRIGGER STUDENT_DTL_TRACK AFTER UPDATE ON STUDENTDTL FOR EACH ROW BEGIN END

USE MST CREATE TRIGGER CUSTOMERS_TRACK AFTER INSERT ON CUSTOMERS FOR EACH ROW BEGIN INSERT INTO CUSTOMERSTRACK(CUSTOMERTRACKID,NAME,AGE,CUSTOMERID) VALUES((SELECT UUID()),NEW.NAME,NEW.AGE,NEW.CUSTOMERID); END;

DROP TRIGGER CUSTOMERS_TRACK

DELIMITER $$;

DROP TRIGGER `mst`.`CUSTOMERS_TRACK`$$

create trigger `CUSTOMERS_TRACK` AFTER INSERT on `customers` for each row BEGIN INSERT INTO CUSTOMERSTRACK(CUSTOMERTRACKID,NAME,AGE,CUSTOMERID) VALUES((SELECT UUID()),NEW.NAME,NEW.AGE,NEW.CUSTOMERID); END; $$

DELIMITER ;$$

INSERT INTO CUSTOMERS VALUES(22,’Tom’,29,’delhi’,3200.00)

Posted in Uncategorized at 6:53 am by mrrohit007

<

html>

<

head>

<

title>Dependency Graph</title>

<

styletype=“text/css”>

body

{

margin:0;

padding:0;

}

html,

body{

height:100%;

width:100%;

}

#divEle

{

width:100%;

height:100%;

margin:0 auto;

}

.ProgressbarMask

{

width : 100%;

height : 100%;

top : 0px;

left : 0px;

position : absolute;

margin : auto;

background : #0d2d59;

float : left;

filter : alpha(opacity=10);

-moz-opacity:.15;

opacity : .15;

z-index: 1000;

}

</

style>

<

linkrel=“stylesheet”type=“text/css”href=<%=request.getContextPath()%>/template1/css/template1.css”/>

<

linkrel=“stylesheet”type=“text/css”href=<%=request.getContextPath()%>/tiles/exg/js/progressbar/progressbar.css”/>

<

scripttype=“text/javascript”src=<%=request.getContextPath()%>/tiles/exg/js/progressbar/progressbar.js”></script>

<

scripttype=“text/javascript”>

 

function

 

startProgressbar(message)

{

var imagePath = “<%=request.getContextPath()%>/tiles/exg/js/progressbar“;

progressBar =

new Progressbar(document.body,imagePath,message);

progressBar.start();

}

 

function

 

stopProgressbar()

{

if(progressBar != && progressBar != undefined)

{

progressBar.stop();

progressBar =

;

}

}

</

script>

</

head>

<

body>

<

tableborder=“0”align=“center”  cellpadding=“0”cellspacing=“0”  style=“width:100%;height:100%;”>

<tr>

<tdalign=“center”  style=“width:100%;height:100%;”>

<divid=‘divEle’>

<iframeid=“div_Iframe”frameborder=“0”width=“100%”height=“100%”scrolling=“auto”src=<%=request.getContextPath()%>/asset/DependencyGraph/DependencyMapping.jsp?assetId=<%=request.getParameter(“assetId”)%>&expandItems=<%=request.getParameter(“expandItems”)%>&sh=<%=request.getParameter(“sh”)%>></iframe>

</div>

</td>

</tr>

</

table>

<

scripttype=“text/javascript”>

//startProgressbar(“loading”);

</

script>

</

body>

</

html>

Posted in Uncategorized at 6:52 am by mrrohit007

http://www.dotnetuncle.com/SQL/SQL-Interview-Question-Answers-2.aspx http://www.franklinfaces.com/Topic28-81-1.aspx http://www.glassdoor.com/Interview/On-the-basis-of-technical-interview-interviewwer-asked-for-the-technology-where-I-have-interest-knowledge-and-start-que-QTN_286842.htm http://www.glassdoor.com/Interview/sql-interview-questions-SRCH_KT0,3.htm http://java-success.blogspot.com.au/2012/02/database-interview-questions-and.html http://www.mysqltutorial.org/create-the-first-trigger-in-mysql.aspx http://www.ntchosting.com/mysql/grant.html http://www.questpond.com/ http://r4r.co.in/sql/01/tutorial/basics/creating_constraints.shtml http://www.techinterviews.com/sql-interview-questions-and-answers http://www.allapplabs.com/interview_questions/db_interview_questions.htm http://codebetter.com/raymondlewallen/2005/05/09/the-difference-in-truncate-and-delete-in-sql-server/ http://www.freejavaguide.com/sql-interview-questions.htm http://www.fromdual.ch/mysql-limitations http://www.interviewserver.com/2011/11/sql-interview-questions-java-developer.html http://www.java2s.com/Tutorial/SQLServer/0020__Query/ANYandALLOperators.htm http://mysqldatabaseadministration.blogspot.in/2007/04/youtube-and-mysql.html http://serverfault.com/questions/184538/how-to-rollback-a-deleted-table-data http://www.techinterviews.com/master-list-of-java-interview-questions http://www.daniweb.com/software-development/java/threads/34695/about-static-variable http://www.coderanch.com/t/529270/ORM/java/hibernate-dialect-why-we-dialect http://www.javabeat.net/qna/163-list-of-hibernate-sql-dialects/ http://javapapers.com/core-java/explain-the-java-static-modifier/ http://www.jetbrains.com/idea/webhelp/language-injections.html http://www.jguru.com/faq/view.jsp?EID=109909 http://www.tutorialspoint.com/sql/sql-create-database.htm http://javabench.blogspot.in/2012/02/design-patterns-being-used-in-spring.html http://java-success.blogspot.in/2011/10/spring-interview-questions-and-answers.html http://vhariprakash.blogspot.in/2011/03/ariba-interview-questions-and-process.html http://javarevisited.blogspot.in/2012/06/10-interview-questions-on-java-generics.html http://www.javabeat.net/2007/10/life-cycle-management-of-a-spring-bean/ http://www.careerride.com/Spring-bean-lifecycle-in-spring-framework.aspx http://www.mkyong.com/tutorials/struts-tutorials/

Posted in Uncategorized at 6:42 am by mrrohit007

http://www.tutorialspoint.com/hibernate/index.htm