Examples of ModelKey


Examples of com.tll.common.model.ModelKey

  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

Examples of com.tll.common.model.ModelKey

      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

Examples of com.tll.common.model.ModelKey

  }

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

Examples of com.tll.common.model.ModelKey

      cmd.execute();
    }
  }

  protected final boolean shouldHandleModelChangeEvent(ModelChangeEvent event) {
    final ModelKey mkey = event.getModelKey();
    if((event.getSource() == this) || (mkey != null && mkey.equals(modelKey))) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of com.tll.common.model.ModelKey

    }
  }

  @Override
  protected final boolean shouldHandleModelChangeEvent(ModelChangeEvent event) {
    final ModelKey mkey = event.getModelKey();
    if((event.getSource() == this) || (mkey != null && mkey.equals(modelKey))) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of com.tll.common.model.ModelKey

    addWidget(parentLink);
  }

  @Override
  public void doInitialization(CustomerListingViewInitializer r) {
    final ModelKey gpar = r.getGrandParentAccountRef();
    if(gpar != null) {
      parentLink.setText(r.getParentAccountRef().getName());
      parentLink.setViewInitializer(new MerchantListingViewInitializer(gpar));
    }
    parentLink.setVisible(gpar != null);
View Full Code Here

Examples of com.tll.common.model.ModelKey

  public IspMain() {
    super();

    final AdminContext ac = SmbizAdmin.getAdminContextCmd().getAdminContext();
    assert ac != null;
    final ModelKey userAccountRef = ac.getUserAccount().getKey();
    assert userAccountRef != null && userAccountRef.isSet();
    addWidget(links);
  }
View Full Code Here

Examples of com.tll.common.model.ModelKey

  class RowHandler extends AbstractRowOptions {

    @Override
    protected Option[] getCustomRowOps(int rowIndex) {
      final ModelKey rowRef = getRowKey(rowIndex);
      if(SmbizAdmin.canSetAsCurrent(rowRef, parentAccountRef)) {
        return new Option[] { App.OPTION_SET_CURRENT };
      }
      return null;
    }
View Full Code Here

Examples of com.tll.common.model.ModelKey

    @Override
    protected void doEditRow(int rowIndex) {
      final Model rowData = getRowData(rowIndex);
      final String cid = rowData.asString("customer.id");
      final ModelKey ck = new ModelKey(SmbizEntityType.CUSTOMER, cid, null);
      ViewManager.get().dispatch(
          new ShowViewRequest(new EditViewInitializer(AccountEditView.klas, ck)));
    }
View Full Code Here

Examples of com.tll.common.model.ModelKey

  class RowHandler extends AbstractRowOptions {

    @Override
    protected Option[] getCustomRowOps(int rowIndex) {
      final ModelKey rowRef = getRowKey(rowIndex);
      if(SmbizAdmin.canSetAsCurrent(rowRef, parentAccountRef)) {
        return new Option[] {
          cListing, App.OPTION_SET_CURRENT };
      }
      return new Option[] { cListing };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.