Package org.dmlite.model

Examples of org.dmlite.model.IEntities


                  }
                }
              } else if (arg instanceof EntitiesAction) {
                EntitiesAction action = (EntitiesAction) arg;
                String actionName = action.getName();
                IEntities entities = action.getEntities();
                if (actionName.equals("add")
                    || actionName.equals("remove")
                    || actionName.equals("update")) {
                  IEntities entry = domainModel
                      .getModelMeta().getEntry(entities);
                  if (entry != null) {
                    String entryCode = entry
                        .getConceptConfig()
                        .getEntitiesCode();
                    IPersistentEntities persistentEntities = getPersistentEntry(entryCode);
                    persistentEntities.save();
                  }
                }
              }
            } else if (arg instanceof EntitiesAction) {
              EntitiesAction action = (EntitiesAction) arg;
              String actionName = action.getName();
              IEntities entities = action.getEntities();
              if (actionName.equals("add")
                  || actionName.equals("remove")
                  || actionName.equals("update")) {
                IEntities entry = domainModel.getModelMeta()
                    .getEntry(entities);
                if (entry != null) {
                  String entryCode = entry.getConceptConfig()
                      .getEntitiesCode();
                  IPersistentEntities persistentEntities = getPersistentEntry(entryCode);
                  persistentEntities.save();
                }
              }
View Full Code Here


                    || transactionStatus.equals("undone")) {
                  List<EntitiesAction> entitiesActions = transaction
                      .getEntitiesActions();
                  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);
View Full Code Here

      xmlModelConfig.setDefaultLoadSave("false");
      List<IEntities<?>> db4oEntries = db4oModel.getDomainModel()
          .getEntries();
      for (IEntities<?> db4oEntry : db4oEntries) {
        String entryCode = db4oEntry.getConceptConfig().getCode();
        IEntities xmlEntry = xmlModel.getDomainModel().getEntry(
            entryCode);
        xmlEntry.getErrors().empty();
        for (IEntity db4oEntity : db4oEntry) {
          if (!xmlEntry.add(db4oEntity)) {
            log.info("Add error: " + entryCode + " "
                + db4oEntity.getOid().getUniqueNumber());
          }
        }
        List errors = xmlEntry.getErrors().getErrorList();
        if (errors.size() > 0) {
          OutTester.output(errors, entryCode + " Add Errors");
        }
      }
      xmlModel.save();
View Full Code Here

          .getModelConfig();
      db4oModelConfig.setDefaultLoadSave("false");
      List<IEntities<?>> xmlEntries = xmlModel.getDomainModel().getEntries();
      for (IEntities<?> xmlEntry : xmlEntries) {
        String entryCode = xmlEntry.getConceptConfig().getCode();
        IEntities db4oEntry = db4oModel.getDomainModel().getEntry(
            entryCode);
        db4oEntry.getErrors().empty();
        for (IEntity xmlEntity : xmlEntry) {
          if (!db4oEntry.add(xmlEntity)) {
            log.info("Add error: " + entryCode + " "
                + xmlEntity.getOid().getUniqueNumber());
          }
        }
        List errors = db4oEntry.getErrors().getErrorList();
        if (errors.size() > 0) {
          OutTester.output(errors, entryCode + " Add Errors");
        }
      }
      db4oModel.save();
View Full Code Here

            if (neighborChildConceptConfig != null) {
              String neighborChildClassName = neighborChildConceptConfig
                  .getEntitiesClass();
              IDomainModel domainModel = persistentModel
                  .getDomainModel();
              IEntities neighborChildEntities = domainModel
                  .getModelMeta().createEntities(
                      neighborChildClassName);
              String neighborCode = neighborConfig.getCode();
              String setChildMethodName = "set"
                  + textHandler
View Full Code Here

          NeighborConfig neighborConfig = (NeighborConfig) config;
          if (neighborConfig.getType().equals("child")
              && neighborConfig.isInternal()) {
            String neigborProperty = textHandler
                .firstLetterToLower(neighborConfig.getCode());
            IEntities neighborChildEntities = (IEntities) Reflector
                .getField(entity, neigborProperty);
            if (neighborChildEntities != null) {
              if (!neighborChildEntities.getCollection()
                  .isEmpty()) {
                Element neighborChildElement = element
                    .addElement(neigborProperty);
                XmlEntities neighborChildXmlEntities = new XmlEntities(
                    neighborChildEntities, persistentModel);
View Full Code Here

      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      App app = viewContext.getApp();
     
      IEntities entities = modelContext.getEntities();

      ModelContext entityAddFormModelContext = new ModelContext(
          modelContext);
      entityAddFormModelContext.setAction("add");
      IEntity newEntity = modelContext.getEntity();
View Full Code Here

    final SelectionCriteria criteriaSexe = SelectionCriteria.defineEqualCriteria(
        "sexe", sexe);
    final SelectionCriteria criteriaDiscipline = SelectionCriteria
        .defineEqualCriteria("discipline", discipline);

    IEntities entities;
    try
    {
      entities = this.categories.getEntities(criteriaCode).getEntities(
          criteriaSexe).getEntities(criteriaDiscipline);
    }
    catch (final SelectionException e)
    {
      throw new SystemeException(e);
    }

    return (Categorie) Validate.elementUnique(entities.getCollection());
  }
View Full Code Here

   *         entities (code)
   */
  public boolean isValidatationTypeEntities(IDomainModel domainModel) {
    boolean result = false;
    if (isValidateType() && validationType != null) {
      IEntities validationTypeEntities = domainModel
          .getEntry(validationType);
      if (validationTypeEntities != null) {
        result = true;
      }
    }
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(),
            conceptConfig, entity, "remove")) {
          if (entities.remove(entity)) {
            ViewContext entityUpdateTablePageContext = new ViewContext(
                viewContext);
            setResponsePage(app.getViewMeta().getPage(
                "EntityUpdateTablePage", modelContext,
                entityUpdateTablePageContext));
View Full Code Here

TOP

Related Classes of org.dmlite.model.IEntities

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.