Package org.dmlite.model

Examples of org.dmlite.model.IEntity


      String conceptClassName = entities.getConceptConfig()
          .getEntityClass();
      for (Iterator i = element.elementIterator(); i.hasNext();) {
        Element childElement = (Element) i.next();
        IDomainModel domainModel = persistentModel.getDomainModel();
        IEntity entity = domainModel.getModelMeta().createEntity(
            conceptClassName);
        XmlEntity xmlEntity = new XmlEntity(entity, persistentModel);
        xmlEntity.load(childElement);
        entities.add((T)xmlEntity.getEntity());
      }
View Full Code Here


                  ObjectContainer db = getDb();
                  for (EntitiesAction action : entitiesActions) {
                    IEntities entities = action
                        .getEntities();
                    String actionName = action.getName();
                    IEntity entity = action.getEntity();
                    if (actionName.equals("add")) {
                      db.set(entity);
                      db.set(entities);
                    } else if (actionName.equals("remove")) {
                      db.set(entities);
                      db.delete(entity);
                    } else if (actionName.equals("update")) {
                      IEntity updateEntity = action
                          .getEntity();
                      db.set(updateEntity);
                    } else if (actionName.equals("attach")) {
                      db.set(entities);
                    } else if (actionName.equals("detach")) {
                      db.set(entities);
                    }
                  }
                  db.commit();
                }
              } else if (arg instanceof EntitiesAction) {
                // domain model session, but no transaction
                EntitiesAction action = (EntitiesAction) arg;
                IEntities entities = action.getEntities();
                String actionName = action.getName();
                IEntity entity = action.getEntity();
                ObjectContainer db = getDb();
                if (actionName.equals("add")) {
                  db.set(entity);
                  db.set(entities);
                } else if (actionName.equals("remove")) {
                  db.set(entities);
                  db.delete(entity);
                } else if (actionName.equals("update")) {
                  IEntity updateEntity = action.getEntity();
                  db.set(updateEntity);
                } else if (actionName.equals("attach")) {
                  db.set(entities);
                } else if (actionName.equals("detach")) {
                  db.set(entities);
                }
                db.commit();
              }
            } else if (arg instanceof EntitiesAction) {
              // no domain model session
              EntitiesAction action = (EntitiesAction) arg;
              IEntities entities = action.getEntities();
              String actionName = action.getName();
              IEntity entity = action.getEntity();
              ObjectContainer db = getDb();
              if (actionName.equals("add")) {
                db.set(entity);
                db.set(entities);
              } else if (actionName.equals("remove")) {
                db.set(entities);
                db.delete(entity);
              } else if (actionName.equals("update")) {
                IEntity updateEntity = action.getEntity();
                db.set(updateEntity);
              } else if (actionName.equals("attach")) {
                db.set(entities);
              } else if (actionName.equals("detach")) {
                db.set(entities);
View Full Code Here

      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      App app = viewContext.getApp();
     
      IEntity entity = modelContext.getEntity();

      ConceptConfig conceptConfig = entity.getConceptConfig();

      List<PropertyNameLabelValuePanelPair> propertyNameLabelValuePanelPairs = new ArrayList<PropertyNameLabelValuePanelPair>();

      ModelContext entityContext = new ModelContext(modelContext);
      entityContext.setEntity(entity);
View Full Code Here

   *            list item (line)
   */
  protected void populateItem(ListItem item) {
    super.populateItem(item);
    try {
      IEntity lookupEntity = (IEntity) item.getModelObject();
     
      ModelContext lookupModelContext = new ModelContext(baseModelContext);
      lookupModelContext.setEntity(lookupEntity);

      ViewContext lookupViewContext = new ViewContext(baseViewContext);
View Full Code Here

    /**
     * What to do when selection changes.
     */
    public void onSelectionChanged() {
      try {
        IEntity lookupEntity = lookupModelContext.getEntity();
        PropertyConfig baseEntityPropertyConfig = baseModelContext
            .getPropertyConfig();
        String action = baseModelContext.getAction();

        if (baseEntityPropertyConfig.isReference()) {
          String neighborCode = baseEntityPropertyConfig
              .getReferenceNeighbor();
          App app = baseViewContext.getApp();
          if (action.equals("add")) {
            IEntity entity = baseModelContext.getEntity();
            entity.setNeighborEntity(neighborCode, lookupEntity);
            ModelContext entityAddFormPageModelContext = new ModelContext(
                baseModelContext);
            entityAddFormPageModelContext
                .setEntities(baseModelContext
                    .getContextEntities());
            entityAddFormPageModelContext.setLookupEntities(null);
            ViewContext entityAddFormPageViewContext = new ViewContext(
                baseViewContext);
            entityAddFormPageViewContext.setUpdate(true);
            setResponsePage(app.getViewMeta().getPage(
                "EntityAddFormPage",
                entityAddFormPageModelContext,
                entityAddFormPageViewContext));
          } else {
            IEntity entity = baseModelContext.getUpdateEntity();
            entity.setNeighborEntity(neighborCode, lookupEntity);
            ModelContext entityEditFormPageModelContext = new ModelContext(
                baseModelContext);
            entityEditFormPageModelContext
                .setEntities(baseModelContext
                    .getContextEntities());
View Full Code Here

      IEntities entities = modelContext.getEntities();

      ModelContext entityAddFormModelContext = new ModelContext(
          modelContext);
      entityAddFormModelContext.setAction("add");
      IEntity newEntity = modelContext.getEntity();
      if (newEntity == null) {
        newEntity = app.getModelMeta().createEntity(entities);
        entityAddFormModelContext.setEntity(newEntity);
      }
View Full Code Here

   * @param item
   *            list item (line)
   */
  protected void populateItem(ListItem item) {
    try {
      IEntity entity = (IEntity) item.getModelObject();
     
      App app = viewContext.getApp();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      String conceptCode = conceptConfig.getCode();

      ModelContext entityModelContext = new ModelContext(modelContext);
      entityModelContext.setEntity(entity);

      List<PropertyNameLabelValuePanelPair> propertyNameLabelValuePanelPairs = new ArrayList<PropertyNameLabelValuePanelPair>();

      // Properties absorbed from parents.
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("parent")
            && neighborConfig.getMax().equals("1")
            && neighborConfig.isAbsorb()) {
          ConceptConfig parentConceptConfig = neighborConfig
              .getNeighborDestinationConceptConfig();
          if (parentConceptConfig != null) {
            if (conceptCode.equals(neighborConfig
                .getContextConceptConfig().getCode())
                && parentConceptConfig.getDisplayType().equals(
                    "slide")) {
              // Do not absorb the context parent properties when
              // the parent is displayed as a slide.
              continue;
            }
            PropertiesConfig parentConceptPropertiesConfig = parentConceptConfig
                .getPropertiesConfig();
            for (IEntity parentPropertyConfigEntity : parentConceptPropertiesConfig) {
              PropertyConfig parentConceptPropertyConfig = (PropertyConfig) parentPropertyConfigEntity;
              if (parentConceptPropertyConfig.isEssential()) {
                IEntity parentEntity = entity
                    .getNeighborEntity(neighborConfig
                        .getCode());
                if (parentEntity != null) {
                  String parentCode = parentEntity
                      .getConceptConfig().getCode();
                  String parentPropertyKey = parentCode
                      + "."
                      + parentConceptPropertyConfig
                          .getCode();
View Full Code Here

    /**
     * Submits a user action.
     */
    protected void onSubmit() {
      IEntities entities = modelContext.getEntities();
      IEntity entity = modelContext.getEntity();
      ConceptConfig conceptConfig = entities.getConceptConfig();
      App app = viewContext.getApp();

      try {
        if (app.isConceptUpdateAllowed(getAppSession(),
View Full Code Here

   *            list item (line)
   */
  protected void populateItem(ListItem item) {
    super.populateItem(item);
    try {
      IEntity entity = (IEntity) item.getModelObject();
     
      final App app = viewContext.getApp();
     
      IEntities entities = modelContext.getEntities();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      String conceptCode = conceptConfig.getCode();

      // Neighbor display links
      List<NeighborNameLabelLinkPair> neighborNameLabelLinkPairs = new ArrayList<NeighborNameLabelLinkPair>();
      NeighborsConfig neighborsConfig = conceptConfig
View Full Code Here

    super(viewContext.getWicketId());
    try {
      final App app = viewContext.getApp();
     
      final IOrderedEntities entities = modelContext.getOrderedEntities();
      final IEntity entity = modelContext.getEntity();   
      ConceptConfig conceptConfig = entity.getConceptConfig();

      Link firstLink = new Link("first") {
        static final long serialVersionUID = 200581L;

        public void onClick() {
          IEntity firstEntity = (IEntity) entities.first();
          ModelContext firstEntityModelContext = new ModelContext(
              modelContext);
          firstEntityModelContext.setEntity(firstEntity);

          ViewContext firstEntityViewContext = new ViewContext(
              viewContext);

          WebPage firstWebPage = app.getViewMeta().getPage(
              "EntityDisplaySlidePage", firstEntityModelContext,
              firstEntityViewContext);
          setResponsePage(firstWebPage);
        }
      };
      add(firstLink);

      Link nextLink = new Link("next") {
        static final long serialVersionUID = 200582L;

        public void onClick() {
          IEntity nextEntity = findNextEntity(entities, entity);

          ModelContext nextEntityModelContext = new ModelContext(
              modelContext);
          nextEntityModelContext.setEntity(nextEntity);

          ViewContext nextEntityViewContext = new ViewContext(
              viewContext);

          WebPage nextWebPage = app.getViewMeta().getPage(
              "EntityDisplaySlidePage", nextEntityModelContext,
              nextEntityViewContext);
          setResponsePage(nextWebPage);
        }
      };
      add(nextLink);

      Link priorLink = new Link("prior") {
        static final long serialVersionUID = 200583L;

        public void onClick() {
          IEntity priorEntity = findPriorEntity(entities, entity);

          ModelContext priorEntityModelContext = new ModelContext(
              modelContext);
          priorEntityModelContext.setEntity(priorEntity);

          ViewContext priorEntityViewContext = new ViewContext(
              viewContext);

          WebPage priorWebPage = app.getViewMeta().getPage(
              "EntityDisplaySlidePage", priorEntityModelContext,
              priorEntityViewContext);
          setResponsePage(priorWebPage);
        }
      };
      add(priorLink);

      Link lastLink = new Link("last") {
        static final long serialVersionUID = 200584L;

        public void onClick() {
          IEntity lastEntity = (IEntity) entities.last();

          ModelContext lastEntityModelContext = new ModelContext(
              modelContext);
          lastEntityModelContext.setEntity(lastEntity);
View Full Code Here

TOP

Related Classes of org.dmlite.model.IEntity

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.