I'm trying to use the ClassificationAttributeValueTranslator on an impex. I have some examples with the class ClassificationAttributeTranslator working but can't make this work.
$productCatalog = myCatalog
$classificationCatalog = myClassification
$catalogVersion = catalogversion(catalog(id[default = $productCatalog]), version[default = 'Staged'])[unique = true, default = $productCatalog:Staged]
$clAttrModifiers = system = '$classificationCatalog', version = '1.0', translator = de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator, lang = es
//Q_1001 is the ClassAttributeAssignment ID
$feature1 = #Q_1001 [$clAttrModifiers];
//123012 is the product code and
INSERT_UPDATE Product; code[unique = true]; $feature1; $catalogVersion
; 123012 ; TEST VALUE;
I'm getting this error
INSERT_UPDATE Product;code[unique = true];#Q_1001 [system = 'myClassification', version = '1.0', translator = de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator, lang = es];catalogversion(catalog(id[default = myCatalog]), version[default = 'Staged'])[unique = true, default = myCatalog:Staged];# invalid special value translator class 'de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator' - cannot create due to java.lang.InstantiationException: de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator
,,,,invalid special value translator class 'de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator' - cannot create due to java.lang.InstantiationException: de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator;123012;TEST VALUE;
You have to use de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeTranslator and not de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeValueTranslator
Related
I am trying to create a one-to-one mapping using Pony ORM.
class ApplierIngress(ApplierObjectMapper.db.Entity):
correlation_id = orm.PrimaryKey(str)
ticket_number = orm.Required(str)
username = orm.Required(str)
status = orm.Required(str)
request_date = orm.Required(datetime)
class ApplierResult(ApplierObjectMapper.db.Entity):
correlation_id = orm.Required(ApplierIngress)
result = orm.Required(orm.LongStr)
request_date = orm.Required(datetime)
It throws error while generating the mapping
pony.orm.core.ERDiagramError: Reverse attribute for ApplierResult.correlation_id not found
I want correlation_id in ApplierResult table be the foreign key referencing to correlation_id in ApplierIngress table
Please let me know what am I doing wrong?
As error said you need to specify reverse attribute. Entities is not just Tables.
class ApplierIngress(ApplierObjectMapper.db.Entity):
correlation_id = orm.PrimaryKey(str)
ticket_number = orm.Required(str)
username = orm.Required(str)
status = orm.Required(str)
request_date = orm.Required(datetime)
result_id = orm.Optional('ApplierResult') # this attribute should be added
class ApplierResult(ApplierObjectMapper.db.Entity):
correlation_id = orm.Required(ApplierIngress)
result = orm.Required(orm.LongStr)
request_date = orm.Required(datetime)
Since this class is not yet declared you should use it as string or lambda
result_id = orm.Optional('ApplierResult')
result_id = orm.Optional(lambda: ApplierResult)
See here
How to update all legal entity in stripe through API?
Thanks in advance. When run this, it throws errors like invalid arguments
\Stripe\Stripe::setApiKey("");
$account = \Stripe\Account::retrieve("");
$account->first_name = "555-867-5309";
$account->save();
$acc_details = \Stripe\Account::retrieve('');
$acc_details->legal_entity['first_name'] = 'First Name';
$acc_details->legal_entity['last_name'] = 'Last Name';
$acc_details->legal_entity['dob']['day'] = '04';
$acc_details->legal_entity['dob']['month'] = '05';
$acc_details->legal_entity['dob']['year'] = '1980';
$acc_details->legal_entity['type'] = 'individual';//Either “individual” or “company”
$acc_details->legal_entity['address']['city'] = 'Abbotsford';
$acc_details->legal_entity['address']['country'] = 'CA';
$acc_details->legal_entity['address']['line1'] = '33415 Maclure Rd';
$acc_details->legal_entity['address']['line2'] = '33415 Maclure Rd';
$acc_details->legal_entity['address']['postal_code'] = 'V2S 7W2';
$acc_details->legal_entity['address']['state'] = 'BC';
$acc_details->legal_entity['personal_id_number'] = '056464654';
Can anyone see the mistake in code
def add_kraken_order():
url = 'https://api.kraken.com/0/private/AddOrder'
key = 'PuwrA+0sssssssssNOTREALsssssssssssssssssq5qj'
secret = 'NVZh7FlQBpssNOTREALssssssssssKBwq4CYSSIjspXR6XGg=='
pair = 'XXBTZEUR'
buysell = 'buy'
ordertype = 'limit'
volume = '1'
orderinfo = ('AddOrder', {'pair': pair,'type' : buysell,
'ordertype' : ordertype, 'volume' : volume,})
market='https://api.kraken.com/0/private/AddOrder'
rr=request.post.market(orderinfo)
How it would be possible to generate Excell reports from Play Framework v2.x(Scala). I found there's a Play-Excel module but it supports PlayFramework v1.0. Is there anything suitable for v2.x?
In the end I choose to use Spoiwo. Scala Wrapper for Apache POI. It has a neat starting guide. However, doesn't have an example with PlayFramework.
Here's my quick and dirty hack to generate simple report from case class.
def generateReportXLSX(waybillId: Long) = Action{ implicit request =>
val headerStyle =
CellStyle(fillPattern = CellFill.Solid, fillForegroundColor = Color.DarkGrey, fillBackgroundColor = Color.AquaMarine, font = Font(bold = true))
val listItems: List[Item] = Items.findByWaybillId(waybillId)
val listRows = listItems.map{ item =>
Row().withCellValues(item.id.getOrElse(1), item.itemCode, item.senderName.getOrElse(""))
}
val gettingStartedSheet = Sheet(name = "Накладная ")
.withRows(listRows)
.withColumns(
Column(index = 0, style = CellStyle(font = Font(bold = true)), autoSized = true)
)
gettingStartedSheet.saveAsXlsx("/home/user/dumps/"+waybillId+".xlsx")
Ok.sendFile(new File(("/home/user/dumps/"+waybillId+".xlsx")))
}
Given the following code, is there anyway to get Automapper to do this instead of manually setting the properties? I'm trying to avoid having to do a one to one mapping at Mapper.CreateMap, since I;m constantly adding and removing fields from Contract, and at the moment have to remember to update this method with the changes.
private void MapModelToContract(ContractDto model, Contract contract)
{
contract.Id = model.Id;
contract.ContractDetail.BuyerCornhouseName = model.ContractDetailBuyerCornhouseName;
contract.ContractDetail.CnoCornLtdToBuyer = model.ContractDetailCnoCornLtdToBuyer;
contract.ContractDetail.CnoCornPartToCornLtd = model.ContractDetailCnoCornPartToCornLtd;
contract.ContractDetail.CnoSellerCornLtd = model.ContractDetailCnoSellerCornLtd;
contract.ContractDetail.CnoSellerCornPart = model.ContractDetailCnoSellerCornPart;
contract.ContractDetail.Commission = model.ContractDetailCommission;
contract.ContractDetail.ContractPrice = model.ContractDetailContractPrice;
contract.ContractDetail.SalesPriceToCornLtd = model.ContractDetailSalesPriceToCornLtd;
contract.ContractDetail.ContractedQuantity = model.ContractDetailContractedQuantity;
contract.ContractDetail.CostWarehouseToFob = model.ContractDetailCostWarehouseToFob;
contract.ContractDetail.Date = model.ContractDetailDate;
contract.ContractDetail.DeliveryDate = model.ContractDetailDeliveryDate;
contract.ContractDetail.FinalBuyerName = model.ContractDetailFinalBuyerName;
contract.ContractDetail.FinalSalesPrice = model.ContractDetailFinalSalesPrice;
contract.ContractDetail.Grade = model.ContractDetailGrade;
contract.ContractDetail.Notes = model.ContractDetailNotes;
contract.ContractDetail.PayableQuantity = model.ContractDetailPayableQuantity;
contract.ContractDetail.SalesShipmentPeriod = model.ContractDetailSalesShipmentPeriod;
contract.ContractDetail.SellerName = model.ContractDetailSellerName;
contract.ContractDetail.ToBePaidBy = model.ContractDetailToBePaidBy;
contract.ContractDetail.SalesBasis = model.ContractDetailSalesBasis;
contract.ContractDetail.SalesFreightValue = model.ContractDetailSalesFreightValue;
contract.CurrencyContract.Date = model.CurrencyContractDate;
contract.CurrencyContract.ExchangeRate = model.CurrencyContractExchangeRate;
contract.CurrencyContract.Number = model.CurrencyContractNumber;
contract.CurrencyContract.Value = model.CurrencyContractValue;
contract.CurrencyContract.IsAcc = model.CurrencyContractIsAcc;
contract.CurrencyContract.RepaidOn = model.CurrencyContractRepaidOn;
contract.CurrencyContract.RepaymentDate = model.CurrencyContractRepaymentDate;
contract.Discounts.Reason = model.DiscountsReason;
contract.Discounts.Value = model.DiscountsValue;
contract.DocumentControl.GuaranteeLetterReceived = model.DocumentControlGuaranteeLetterReceived;
contract.DocumentControl.PhotosReceived = model.DocumentControlPhotosReceived;
contract.GoodsStatus.ContainerNumber = model.GoodsStatusContainerNumber;
contract.GoodsStatus.EtaPort = model.GoodsStatusEtaPort;
contract.GoodsStatus.ExpectedDeliveryDate = model.GoodsStatusExpectedDeliveryDate;
contract.GoodsStatus.Port = model.GoodsStatusPort;
contract.GoodsStatus.ShippedStatus = model.GoodsStatusShippedStatus;
contract.GoodsStatus.VesselDeadline = model.GoodsStatusVesselDeadline;
contract.GoodsStatus.VesselName = model.GoodsStatusVesselName;
contract.GoodsStatus.HasSellerConfirmedRelease = model.GoodsStatusHasSellerConfirmedRelease;
contract.GoodsStatus.ReceivedShippingInstructions = model.GoodsStatusReceivedShippingInstructions;
contract.GoodsStatus.Notes = model.GoodsStatusNotes;
contract.NotaFiscalCornPart.Date = model.NotaFiscalCornPartDate;
contract.NotaFiscalCornPart.ExchangeRate = model.NotaFiscalCornPartExchangeRate;
contract.NotaFiscalCornPart.Number = model.NotaFiscalCornPartNumber;
contract.NotaFiscalSeller.Date = model.NotaFiscalSellerDate;
contract.NotaFiscalSeller.GoodsReleased = model.NotaFiscalSellerGoodsReleased;
contract.NotaFiscalSeller.Number = model.NotaFiscalSellerNumber;
contract.TransferToSeller.Date = model.TransferToSellerDate;
contract.TransferToSeller.TransferredFrom = model.ContractDetailBuyerCornhouseName;
contract.TransferToSeller.Value = model.TransferToSellerValue;
contract.CommissionLawyer.IsPaid = model.CommissionLawyerIsPaid;
}
The below mapper works for you.
If the Source (ContractDto) and Destination (Contract) have same property names.
Mapper.CreateMap<ContractDto, Contract>(); // Maps if ContractDto & Contract have same property names
If the Source (ContractDto) and Destination (Contract) have diff property names. Then
Mapper.CreateMap<ContractDto, Contract>()
.ForMember(destination => destination.BuyerCornhouseName, options => options.MapFrom(source => source.ContractDetailBuyerCornhouseName))
.ForMember(destination => destination.CnoCornLtdToBuyer, options => options.MapFrom(source => source.ContractDetailCnoCornLtdToBuyer));
// Explicitly you have specify for other properties also