public bool TryGetBinary(string tcmUri, out IBinary binary) { binary = null; Query findBinary = new Query(); MultimediaCriteria isBinary = new MultimediaCriteria(true); return(false); /* * using (var uri = new Com.Tridion.Util.TCMURI(tcmUri)) * { * using (var sqlBinHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) * { * var binData = sqlBinHome.FindByPrimaryKey(uri.GetPublicationId(), uri.GetItemId()); * var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome(); * Com.Tridion.Util.TCDURI tcdUri = new Com.Tridion.Util.TCDURI(uri); * Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByPrimaryKey(tcdUri); * * if (binData != null) * { * binary = new Binary(this) * { * Url = binaryMeta.GetURLPath(), * LastPublishedDate = DateTime.Now, * Multimedia = null, * VariantId = binData.GetVariantId() * }; * * return true; * } * } * } */ }
public bool TryFindBinary(string url, out IBinary binary) { //string encodedUrl = HttpUtility.UrlPathEncode(url); binary = null; return(false); Query findBinary = new Query(); PublicationURLCriteria urlCriteria = new PublicationURLCriteria(url); MultimediaCriteria isBinary = new MultimediaCriteria(true); Com.Tridion.Broker.Querying.Criteria.Criteria allCriteria = Com.Tridion.Broker.Querying.CriteriaFactory.And(isBinary, isBinary); //Criteria allCriteria = CriteriaFactory.And(isBinary, urlCriteria); //Criteria allCriteria = urlCriteria; //findBinary.Criteria = allCriteria; string[] binaryUri = findBinary.ExecuteQuery(); if (binaryUri.Length == 0) { return(false); } else { ComponentPresentation binaryComponent; return(true); } /* * using (var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome()) * { * Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByURL(PublicationId, encodedUrl); // "/Images/anubis_pecunia160_tcm70-520973.jpg" * if (binaryMeta != null) * { * using (var sqlBinaryHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) * { * Com.Tridion.Data.BinaryData binData = sqlBinaryHome.FindByPrimaryKey(PublicationId, (int)binaryMeta.GetId()); * if (binData != null) * { * binary = new Binary(this) * { * Url = url, * LastPublishedDate = DateTime.Now, * Multimedia = null, * VariantId = binData.GetVariantId() * }; * return true; * } * } * } * return false; * } */ }
public bool TryFindBinary(string url, out IBinary binary) { //string encodedUrl = HttpUtility.UrlPathEncode(url); binary = null; return false; Query findBinary = new Query(); PublicationURLCriteria urlCriteria = new PublicationURLCriteria(url); MultimediaCriteria isBinary = new MultimediaCriteria(true); Com.Tridion.Broker.Querying.Criteria.Criteria allCriteria = Com.Tridion.Broker.Querying.CriteriaFactory.And(isBinary, isBinary); //Criteria allCriteria = CriteriaFactory.And(isBinary, urlCriteria); //Criteria allCriteria = urlCriteria; //findBinary.Criteria = allCriteria; string[] binaryUri = findBinary.ExecuteQuery(); if (binaryUri.Length == 0) { return false; } else { ComponentPresentation binaryComponent ; return true; } /* using (var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome()) { Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByURL(PublicationId, encodedUrl); // "/Images/anubis_pecunia160_tcm70-520973.jpg" if (binaryMeta != null) { using (var sqlBinaryHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) { Com.Tridion.Data.BinaryData binData = sqlBinaryHome.FindByPrimaryKey(PublicationId, (int)binaryMeta.GetId()); if (binData != null) { binary = new Binary(this) { Url = url, LastPublishedDate = DateTime.Now, Multimedia = null, VariantId = binData.GetVariantId() }; return true; } } } return false; } */ }
public bool TryGetBinary(string tcmUri, out IBinary binary) { binary = null; Query findBinary = new Query(); MultimediaCriteria isBinary = new MultimediaCriteria(true); return false; /* using (var uri = new Com.Tridion.Util.TCMURI(tcmUri)) { using (var sqlBinHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) { var binData = sqlBinHome.FindByPrimaryKey(uri.GetPublicationId(), uri.GetItemId()); var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome(); Com.Tridion.Util.TCDURI tcdUri = new Com.Tridion.Util.TCDURI(uri); Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByPrimaryKey(tcdUri); if (binData != null) { binary = new Binary(this) { Url = binaryMeta.GetURLPath(), LastPublishedDate = DateTime.Now, Multimedia = null, VariantId = binData.GetVariantId() }; return true; } } } */ }