Package com.tll.common.model

Examples of com.tll.common.model.ModelKey


    switch(event.getChangeOp()) {
    case ADDED:
      addRow(event.getModel());
      break;
    case UPDATED: {
      final ModelKey mkey = event.getModel().getKey();
      final int rowIndex = getRowIndex(mkey);
      if(rowIndex != -1) {
        assert rowIndex > 0; // header row
        table.applyModeltoUi(rowIndex, event.getModel());
      }
      break;
    }
    case DELETED: {
      final ModelKey modelRef = event.getModelKey();
      final int rowIndex = getRowIndex(modelRef);
      if(rowIndex != -1) {
        assert rowIndex > 0; // header row
        markRowDeleted(rowIndex, true);
      }
View Full Code Here


   * @return The resolved row index or <code>-1</code> if no row matching the
   *         given row key is present in the table.
   */
  int getRowIndex(ModelKey rowKey) {
    for(int i = 0; i < rowDataList.size(); i++) {
      final ModelKey rdlKey = rowDataList.get(i).getKey();
      if(rdlKey.equals(rowKey)) return i + 1; // account for header row
    }
    // can't find
    return -1;
  }
View Full Code Here

   * @param status the status to which messages are posted
   */
  @SuppressWarnings("unchecked")
  protected IEntity loadEntityByPrimaryKey(PrimaryKeySearch search, Status status) {
    try {
      final ModelKey mkey = search.getKey();
      final IEntityType et = mkey.getEntityType();
      final Class<IEntity> ec = (Class<IEntity>) context.getEntityTypeResolver().resolveEntityClass(et);
      final IEntityService<IEntity> svc = getEntityService(et);
      final IEntity e = svc.load(new PrimaryKey(ec, mkey.getId()));
      return e;
    }
    catch(final EntityNotFoundException e) {
      RpcServlet.exceptionToStatus(e, status);
      return null;
View Full Code Here

    final Address a = getEntityBeanFactory().getEntityCopy(Address.class, true);
    final String id = a.getId();
    addEntityToDb(a);

    final PersistServiceDelegate delegate = getDelegate();
    final PrimaryKeySearch search = new PrimaryKeySearch(new ModelKey(TestEntityType.ADDRESS, id, null));
    final LoadRequest<PrimaryKeySearch> request = new LoadRequest<PrimaryKeySearch>(search);
    final ModelPayload p = delegate.load(request);

    assert p != null;
    final Model m = p.getModel();
View Full Code Here

    final Address a = getEntityBeanFactory().getEntityCopy(Address.class, true);
    final String id = a.getId();
    addEntityToDb(a);

    final PersistServiceDelegate delegate = getDelegate();
    final ModelKey origMk = new ModelKey(TestEntityType.ADDRESS, id, null);
    final ModelPayload p = delegate.purge(new PurgeRequest(origMk));
    assert p != null;
    final ModelKey mk = p.getRef();
    assert mk != null && mk.isSet() && mk.equals(origMk);
  }
View Full Code Here

      viewContainer.add(new Label("This is line 3"));
      context.add(viewContainer);

      ViewManager.initialize(viewContainer, 3);

      mk = new ModelKey(TestEntityType.TYPE_A, "77", "Model Name");
    }
View Full Code Here

    switch(event.getChangeOp()) {
    case ADDED:
      addRow(event.getModel());
      break;
    case UPDATED: {
      final ModelKey mkey = event.getModel().getKey();
      final int rowIndex = getRowIndex(mkey);
      if(rowIndex != -1) {
        assert rowIndex > 0; // header row
        updateRow(rowIndex, event.getModel());
      }
      break;
    }
    case DELETED: {
      final ModelKey modelRef = event.getModelKey();
      final int rowIndex = getRowIndex(modelRef);
      if(rowIndex != -1) {
        assert rowIndex > 0; // header row
        markRowDeleted(rowIndex, true);
      }
View Full Code Here

  public static boolean canSetAsCurrent(ModelKey accountRef, ModelKey parentAccountRef) throws IllegalArgumentException {
    if(accountRef == null || !accountRef.isSet()) throw new IllegalArgumentException("Null or unset account ref");
    final AdminContext ac = getAdminContextCmd().getAdminContext();
    final AdminRole role = ac.getUserRole();
    final SmbizEntityType targetAccountType = (SmbizEntityType) accountRef.getEntityType();
    final ModelKey userAcntRef = ac.getUserAccount().getKey();
    assert userAcntRef != null;
    switch(targetAccountType) {
    case ASP:
    case ISP:
      return (role == AdminRole.ASP);
    case MERCHANT:
      switch(role) {
      case ASP:
        return true;
      case ISP:
        // verify the user is parent to the given merchant
        return userAcntRef.equals(parentAccountRef);
      }
    }
    // default
    return false;
  }
View Full Code Here

      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());
      Assert.assertNotNull(e2);
      Assert.assertEquals(e, e2);
View Full Code Here

  }

  @Override
  public String toString() {
    String s = change.toString();
    final ModelKey rk = getModelKey();
    if(rk != null) {
      s += " [ " + rk.toString() + " ]";
    }
    return s;
  }
View Full Code Here

TOP

Related Classes of com.tll.common.model.ModelKey

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.