Package com.tll.common.model

Examples of com.tll.common.model.Model$ChangesPredicate


   * Stubs an address
   * @param num
   * @return new instance
   */
  public static Model stubAddress(int num) {
    final Model address = stubModel(TestEntityType.ADDRESS, null, false, null);
    address.set(new StringPropertyValue("emailAddress", new PropertyMetadata(PropertyType.STRING, false, false, 32),
        "email" + num + "@domain.com"));
    address.set(new StringPropertyValue("firstName", new PropertyMetadata(PropertyType.STRING, false, false, 32),
        "firstname " + num));
    address.set(new StringPropertyValue("lastName", new PropertyMetadata(PropertyType.STRING, false, true, 32),
        "lastname " + num));
    address.set(new CharacterPropertyValue("mi", new PropertyMetadata(PropertyType.CHAR, false, false, 1), 'm'));
    address.set(new StringPropertyValue("address1", new PropertyMetadata(PropertyType.STRING, false, true, 32),
        "address1 " + num));
    address.set(new StringPropertyValue("address2", new PropertyMetadata(PropertyType.STRING, false, false, 32),
        "address2 " + num));
    address.set(new StringPropertyValue("city", new PropertyMetadata(PropertyType.STRING, false, true, 32), "city "
        + num));
    address.set(new StringPropertyValue("province", new PropertyMetadata(PropertyType.STRING, false, true, 32),
        "province " + num));
    address.set(new StringPropertyValue("postalCode", new PropertyMetadata(PropertyType.STRING, false, true, 32),
        "zip " + num));
    address.set(new StringPropertyValue("country", new PropertyMetadata(PropertyType.STRING, false, true, 32),
        "country " + num));

    // test boolean prop types..
    address.set(new BooleanPropertyValue("boolean", new PropertyMetadata(PropertyType.BOOL, false, true, -1),
        Boolean.TRUE));

    // test float prop types..
    address.set(new DoublePropertyValue("float", new PropertyMetadata(PropertyType.FLOAT, false, true, 8), 33.33d));

    // test double prop types..
    address.set(new DoublePropertyValue("double", new PropertyMetadata(PropertyType.DOUBLE, false, true, 8), 44.44d));

    return address;
  }
View Full Code Here


  /**
   * Stubs a currency model
   * @return new instance
   */
  public static Model stubCurrency() {
    final Model m = stubModel(TestEntityType.CURRENCY, null, false, null);
    m.set(new StringPropertyValue("iso4217", new PropertyMetadata(PropertyType.STRING, false, true, 8), "usd"));
    m.set(new StringPropertyValue("symbol", new PropertyMetadata(PropertyType.STRING, false, true, 8), "$"));
    m.set(new DoublePropertyValue("usdExchangeRage", new PropertyMetadata(PropertyType.DOUBLE, false, true, -1), 1d));
    return m;
  }
View Full Code Here

  /**
   * Stubs payment info
   * @return new Model representing payment info
   */
  public static Model stubPaymentInfo() {
    final Model m = stubModel(TestEntityType.PAYMENT_INFO, null, false, null);
    m.set(new StringPropertyValue("paymentData_bankAccountNo", new PropertyMetadata(PropertyType.STRING, false, false,
        16), "0005543"));
    m.set(new StringPropertyValue("paymentData_bankName", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "bank name"));
    m.set(new StringPropertyValue("paymentData_bankRoutingNo", new PropertyMetadata(PropertyType.STRING, false, false,
        16), "77777"));
    m.set(new EnumPropertyValue("paymentData_ccType", new PropertyMetadata(PropertyType.ENUM, false, false, 16),
        CreditCardType.VISA));
    m.set(new StringPropertyValue("paymentData_ccNum", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "4111111111111111"));
    m.set(new StringPropertyValue("paymentData_ccCvv2", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "834"));
    m.set(new IntPropertyValue("paymentData_ccExpMonth", new PropertyMetadata(PropertyType.INT, false, false, 16), 8));
    m
    .set(new IntPropertyValue("paymentData_ccExpYear", new PropertyMetadata(PropertyType.INT, false, false, 16),
        2012));
    m.set(new StringPropertyValue("paymentData_ccName", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "cc name"));
    m.set(new StringPropertyValue("paymentData_ccAddress1",
        new PropertyMetadata(PropertyType.STRING, false, false, 16), "88 Broadway"));
    m.set(new StringPropertyValue("paymentData_ccAddress2",
        new PropertyMetadata(PropertyType.STRING, false, false, 16), "#32"));
    m.set(new StringPropertyValue("paymentData_ccCity", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "Sacramento"));
    m.set(new StringPropertyValue("paymentData_ccState", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "CA"));
    m.set(new StringPropertyValue("paymentData_ccZip", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "99885"));
    m.set(new StringPropertyValue("paymentData_ccCountry", new PropertyMetadata(PropertyType.STRING, false, false, 16),
    "us"));

    return m;
  }
View Full Code Here

    // handle indexed field panels
    final ArrayList<Index> tormv = new ArrayList<Index>();
    final ArrayList<Index> toundel = new ArrayList<Index>();
    for(final Index i : indexPanels) {
      i.fieldPanel.getFieldGroup().getErrorHandler().clear(ErrorClassifier.CLIENT);
      final Model im = i.fieldPanel.getModel();
      if(im.isNew()) {
        tormv.add(i);
      }
      else if(im.isMarkedDeleted()) {
        toundel.add(i);
      }
    }
    for(final Index i : tormv) {
      remove(i.index, true);
View Full Code Here

   * @param currentUser the current user
   * @param currentAccount the current account
   * @return Newly created {@link IViewInitializer}.
   */
  public static IViewInitializer resolveViewInitializer(String optionText, Model currentUser, Model currentAccount) {
    final Model crntUserAccount = currentUser.nestedModel("account");

    if(OP_ACCOUNT_DETAIL.getText().equals(optionText)) {
      return new EditViewInitializer(AccountEditView.klas, crntUserAccount);
    }

    final SmbizEntityType crntUserAccountType = (SmbizEntityType) crntUserAccount.getEntityType();

    if(OP_ISPS.getText().equals(optionText)) {
      return new StaticViewInitializer(IspListingView.klas);
    }
    if(OP_MERCHANTS.getText().equals(optionText)) {
View Full Code Here

   * @param type the desired entity type
   * @return A fresh {@link Model} instance
   */
  public static Model assemble(SmbizEntityType type) {
    // default behavior
    final Model m = AuxDataCache.get().getEntityPrototype(type);

    // handle special cases
    if(type == SmbizEntityType.INTERFACE_SWITCH) {
      final Model op = AuxDataCache.get().getEntityPrototype(SmbizEntityType.INTERFACE_OPTION);
      m.relatedMany("options").getModelList().add(op);
    }

    return m;
  }
View Full Code Here

      });
    for(final Class<? extends IEntity> entityClass : entityClasses) {
      final IEntity e = getEntityBeanFactory().getEntityCopy(entityClass, false);
      if(e == null) continue// skip
      Assert.assertNotNull(e);
      final Model model = marshaler.marshalEntity(e, MarshalOptions.UNCONSTRAINED_MARSHALING);

      assert model.getEntityType() != null : "The marshaled entity model's ref type was found null";

      final ModelKey refKey = model.getKey();
      assert refKey != null : "The marshaled entity model's ref key was found null";
      assert refKey.isSet() : "The marshaled entity model's ref key was found un-set";

      Assert.assertNotNull(model);
      final IEntity e2 = marshaler.marshalModel(model, e.entityClass());
View Full Code Here

  public void testAccountMarshaling() throws Exception {
    final Merchant e = getEntityGraph().getEntitiesByType(Merchant.class).iterator().next();
    Assert.assertTrue(e != null && e.getParent() != null && e.getPaymentInfo() != null && e.getPaymentInfo().getPaymentData() != null);

    final MarshalOptions mo = getMarshalOptionsResolver().resolve(SmbizEntityType.MERCHANT);
    final Model m = getMarshaler().marshalEntity(e, mo);

    final Merchant e2 = getMarshaler().marshalModel(m, Merchant.class);

    Assert.assertNotNull(e2.getParent());
    Assert.assertEquals(e, e2);
View Full Code Here

    final PropertyType ptype = prop.getType();
    if(ptype.isModelRef()) {
      // related one
      final TreeItem branch = new TreeItem(getModelRefHtml((IModelRefProperty) prop));
      parent.addItem(branch);
      final Model m = ((IModelRefProperty) prop).getModel();
      if(m != null) {
        for(final IModelProperty nprop : m) {
          addProp(nprop, branch, visited);
        }
      }
View Full Code Here

    }

    final Marshaler entityMarshaller = mec.getMarshaler();
    assert entityMarshaller != null : "No marshaler present";

    final Model user = entityMarshaller.marshalEntity(sac.getUser(), new MarshalOptions(true, 1, null));
    // NOTE: we want a distinct copy of the account here so we separately
    // marshall the account as opposed to grabbing the nested account from the
    // just marshaled user
    final Model account = entityMarshaller.marshalEntity(sac.getUser().getAccount(), MarshalOptions.NON_RELATIONAL);

    status.addMsg("Admin Context retrieved.", MsgLevel.INFO, MsgAttr.STATUS.flag);
    return new AdminContextPayload(status, ac.isDebug(), ac.getEnvironment(), user, account);
  }
View Full Code Here

TOP

Related Classes of com.tll.common.model.Model$ChangesPredicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.