Skip to content

Instantly share code, notes, and snippets.

View mkubala's full-sized avatar

Marcin Kubala mkubala

  • SoftwareMill
  • Kraków, Poland
  • 16:29 (UTC +02:00)
View GitHub Profile
@mkubala
mkubala / gist:3172683
Created July 24, 2012 21:10
entity tree mock
private void stubMeatCuttingTree() {
stubMeatCuttingTreeNode(1L, w_1, 1, "1.", null, Lists.newArrayList(w_1_A_1, w_1_B_1, w_1_C_1, w_1_D_1, w_1_E_1),
prod_cwp, "0,2445", "0,962");
/* ## */stubMeatCuttingTreeNode(2L, w_1_A_1, 1, "1.A.1.", w_1, null, prod_mstk, "0,0808", "1");
/* ## */stubMeatCuttingTreeNode(3L, w_1_B_1, 2, "1.B.1.", w_1, Lists.newArrayList(w_1_B_1_A_1, w_1_B_1_B_1, w_1_B_1_C_1),
prod_kzk, "0,1315", "1,150");
/* ######## */stubMeatCuttingTreeNode(4L, w_1_B_1_A_1, 1, "1.B.1.A.1.", w_1_B_1, null, prod_kbk, "0,6866", "1,531");
/* ######## */stubMeatCuttingTreeNode(5L, w_1_B_1_B_1, 2, "1.B.1.B.1.", w_1_B_1, null, prod_2wol, "0,0896", "0,992");
/* ######## */stubMeatCuttingTreeNode(6L, w_1_B_1_C_1, 3, "1.B.1.C.1.", w_1_B_1, null, prod_ksci, "0,2239", "0,001");
/* ## */stubMeatCuttingTreeNode(7L, w_1_C_1, 3, "1.C.1.", w_1, null, prod_rzbr, "0.2342", "1,227");
marcinkubala:~/perl/qmce$ perl qmce.pl assignmentToShift.xml
public final class AssignmentToShiftFields {
private AssignmentToShiftFields() {}
public static final String START_DATE = "startDate";
public static final String SHIFT = "shift";
public static final String STATE = "state";
@mkubala
mkubala / gist:3337811
Created August 13, 2012 07:33
how to update XML::LibXML on OS X 10.6 Snow Leopard
sudo perl -MCPAN -e shell
> install YAML
> install XML::LibXML
@mkubala
mkubala / gist:3436684
Created August 23, 2012 13:39
przykład użycia GridComponent.setCustomRestriction(..)
public void <nazwa metody>(final ViewDefinitionState view) {
final GridComponent someGrid = (GridComponent) view.getComponentByReference("grid");
final CustomRestriction onlyKowalski = new CustomRestriction() {
@Override
public void addRestriction(final SearchCriteriaBuilder scb) {
scb.add(SearchRestrictions.eq("worker", "Jan Kowalski"));
}
};
someGrid.setCustomRestriction(onlyKowalski);
}
<view ... >
...
<hooks>
...
<beforeRender class="<pakiet i klasa>" method="<nazwa metody>" />
</hooks>
</view>
<component type="lookup" name="product" reference="product"
field="product">
<option ... />
...
</component>
...
123456+65432l
public interface AlgorithmService {
boolean isApplicableFor(final MrpAlgorithm algorothm);
Map<Entity, BigDecimal> perform(final Map<Entity, BigDecimal> productComponentQuantities, final Set<Entity> nonComponents,
           final MrpAlgorithm algorithm, final String type);
}
---------------------------------------------
<component type="grid" ...>
<option type="column" width="100" name="number" fields="product" expression="#product['number']" link="true" />
<option type="column" width="200" name="name" fields="product" expression="#product['name']" link="true" />
<option type="column" width="100" name="quantity" fields="quantity" />
<option type="column" width="70" name="unit" fields="product" expression="#product['unit']" link="false" />
<!-- koniec listy kolumn, pozostałe opcje pominięte -->
</component>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/view"
xsi:schemaLocation="http://schema.qcadoo.org/view http://schema.qcadoo.org/view.xsd"
name="productDetails" modelName="product">
<component type="window" name="window" reference="window">
<ribbon>
<template name="standardFormTemplate" />
</ribbon>
<!-- reszta widoku -->
</component>