Displays a mapping project.

@param identifier identifier of the {@link MappingProject}
@param model the model
@return View name for a single mapping project
486267
@GetMapping("/mappingproject/{id}")
  public String viewMappingProject(@PathVariable("id") String identifier, Model model) {
    MappingProject project = mappingService.getMappingProject(identifier);
    MappingTarget mappingTarget = project.getMappingTargets().get(0);
    String target = mappingTarget.getName();
    model.addAttribute("entityTypes", getNewSources(mappingTarget));
    model.addAttribute(
        "compatibleTargetEntities",
        mappingService.getCompatibleEntityTypes(mappingTarget.getTarget()).collect(toList()));
    model.addAttribute("selectedTarget", target);
    model.addAttribute("mappingProject", project);
    model.addAttribute("attributeTagMap", getTagsForAttribute(target, project));
    model.addAttribute(
        "packages",
        dataService
            .getMeta()
            .getPackages()
            .stream()
            .filter(p -> !isSystemPackage(p))
            .collect(toList()));
    return VIEW_SINGLE_MAPPING_PROJECT;
  }
919808
public static String getProjectName( File inputDefFile)
    {
    String projectName = null;
    if( inputDefFile != null)
      {
      String inputBase = FilenameUtils.getBaseName( inputDefFile.getName());

      projectName =
        inputBase.toLowerCase().endsWith( "-input")
        ? inputBase.substring( 0, inputBase.length() - "-input".length())
        : inputBase;
      }

    return projectName;
    }
1250168
private void addModel(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, Scanner scanner) {
        File pomXmlFile = project.getFile();
        FileDescriptor mavenPomXmlDescriptor = scanner.scan(pomXmlFile, pomXmlFile.getAbsolutePath(), MavenScope.PROJECT);
        projectDescriptor.setModel(mavenPomXmlDescriptor);
        // Effective model
        MavenPomDescriptor effectiveModelDescriptor = scanner.getContext().getStore().create(MavenPomDescriptor.class);
        Model model = new EffectiveModel(project.getModel());
        scanner.getContext().push(MavenPomDescriptor.class, effectiveModelDescriptor);
        scanner.scan(model, pomXmlFile.getAbsolutePath(), MavenScope.PROJECT);
        scanner.getContext().pop(MavenPomDescriptor.class);
        projectDescriptor.setEffectiveModel(effectiveModelDescriptor);
    }
764392
protected Label newAddTabButtonLabel(final String id, final IModel<String> model)
	{
		return ComponentFactory.newLabel(id, model);
	}
1101418
public static List<String> getVisibleServerLayerIds(MapModel mapModel) {
		List<String> layerIds = new ArrayList<String>();
		for (VectorLayer layer : mapModel.getVectorLayers()) {
			if (layer.isShowing()) {
				layerIds.add(layer.getServerLayerId());
			}
		}
		return layerIds;
	}
315360
public Iterable<HibernateConfigurationFileModel> findAllByApplication(final ProjectModel application)
    {
        List<HibernateConfigurationFileModel> results = new ArrayList<>();

        for (HibernateConfigurationFileModel model : findAll())
        {
            Set<ProjectModel> modelApplications = ProjectTraversalCache.getApplicationsForProject(getGraphContext(), model.getProjectModel());
            if (modelApplications.contains(application))
                results.add(model);
        }
        return results;
    }
302297
public static <T> Label newLabel(final String id, final String forId, final IModel<T> model)
	{
		final Label label = new Label(id, model);
		label.add(new AttributeAppender("for", Model.of(forId), " "));
		label.setOutputMarkupId(true);
		return label;
	}
800649
@PostMapping("/advancedmappingeditor")
  public String advancedMappingEditor(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String sourceAttribute,
      @RequestParam String algorithm,
      Model model) {
    MappingProject project = mappingService.getMappingProject(mappingProjectId);
    MappingTarget mappingTarget = project.getMappingTarget(target);
    EntityMapping entityMapping = mappingTarget.getMappingForSource(source);
    AttributeMapping attributeMapping = entityMapping.getAttributeMapping(targetAttribute);

    model.addAttribute("mappingProject", project);
    model.addAttribute("entityMapping", entityMapping);
    model.addAttribute("attributeMapping", attributeMapping);

    // set variables for the target column in the mapping editor
    Attribute targetAttr = dataService.getEntityType(target).getAttribute(targetAttribute);

    Stream<Entity> targetAttributeEntities;
    String targetAttributeIdAttribute = null;
    String targetAttributeLabelAttribute = null;

    if (EntityTypeUtils.isReferenceType(targetAttr)) {
      targetAttributeEntities =
          dataService.findAll(
              dataService
                  .getEntityType(target)
                  .getAttribute(targetAttribute)
                  .getRefEntity()
                  .getId());

      targetAttributeIdAttribute =
          dataService
              .getEntityType(target)
              .getAttribute(targetAttribute)
              .getRefEntity()
              .getIdAttribute()
              .getName();

      targetAttributeLabelAttribute =
          dataService
              .getEntityType(target)
              .getAttribute(targetAttribute)
              .getRefEntity()
              .getLabelAttribute()
              .getName();
    } else {
      targetAttributeEntities = dataService.findAll(dataService.getEntityType(target).getId());
      targetAttributeIdAttribute = dataService.getEntityType(target).getIdAttribute().getName();
      targetAttributeLabelAttribute =
          dataService.getEntityType(target).getLabelAttribute().getName();
    }

    model.addAttribute(
        "targetAttributeEntities", (Iterable<Entity>) targetAttributeEntities::iterator);
    model.addAttribute("targetAttributeIdAttribute", targetAttributeIdAttribute);
    model.addAttribute("targetAttributeLabelAttribute", targetAttributeLabelAttribute);

    // set variables for the source column in the mapping editor
    Attribute sourceAttr = dataService.getEntityType(source).getAttribute(sourceAttribute);

    Stream<Entity> sourceAttributeEntities;
    String sourceAttributeIdAttribute = null;
    String sourceAttributeLabelAttribute = null;

    if (EntityTypeUtils.isReferenceType(sourceAttr)) {
      sourceAttributeEntities =
          dataService.findAll(
              dataService
                  .getEntityType(source)
                  .getAttribute(sourceAttribute)
                  .getRefEntity()
                  .getId());

      sourceAttributeIdAttribute =
          dataService
              .getEntityType(source)
              .getAttribute(sourceAttribute)
              .getRefEntity()
              .getIdAttribute()
              .getName();

      sourceAttributeLabelAttribute =
          dataService
              .getEntityType(source)
              .getAttribute(sourceAttribute)
              .getRefEntity()
              .getLabelAttribute()
              .getName();
    } else {
      sourceAttributeEntities = dataService.findAll(dataService.getEntityType(source).getId());
      sourceAttributeIdAttribute = dataService.getEntityType(source).getIdAttribute().getName();
      sourceAttributeLabelAttribute =
          dataService.getEntityType(source).getLabelAttribute().getName();
    }

    List<Entity> sourceAttributeEntityList = sourceAttributeEntities.collect(toList());

    model.addAttribute("sourceAttributeEntities", sourceAttributeEntityList);
    model.addAttribute("numberOfSourceAttributes", sourceAttributeEntityList.size());
    model.addAttribute("sourceAttributeIdAttribute", sourceAttributeIdAttribute);
    model.addAttribute("sourceAttributeLabelAttribute", sourceAttributeLabelAttribute);

    // Check if the selected source attribute is isAggregatable
    Attribute sourceAttributeAttribute =
        dataService.getEntityType(source).getAttribute(sourceAttribute);
    if (sourceAttributeAttribute.isAggregatable()) {
      AggregateResult aggregate =
          dataService.aggregate(
              source,
              new AggregateQueryImpl().attrX(sourceAttributeAttribute).query(new QueryImpl<>()));
      List<Long> aggregateCounts = new ArrayList<>();
      for (List<Long> count : aggregate.getMatrix()) {
        aggregateCounts.add(count.get(0));
      }
      model.addAttribute("aggregates", aggregateCounts);
    }

    model.addAttribute("target", target);
    model.addAttribute("source", source);
    model.addAttribute(
        "targetAttribute", dataService.getEntityType(target).getAttribute(targetAttribute));
    model.addAttribute(
        "sourceAttribute", dataService.getEntityType(source).getAttribute(sourceAttribute));

    CategoryMapping<String, String> categoryMapping = null;
    if (algorithm == null) {
      algorithm = attributeMapping.getAlgorithm();
    }
    try {
      categoryMapping = create(algorithm);
    } catch (Exception ignore) {
    }

    if (categoryMapping == null) {
      categoryMapping = createEmpty(sourceAttribute);
    }
    model.addAttribute("categoryMapping", categoryMapping);

    return VIEW_CATEGORY_MAPPING_EDITOR;
  }
714603
@GetMapping("/attributeMapping")
  public String viewAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      Model model) {
    MappingProject project = mappingService.getMappingProject(mappingProjectId);
    MappingTarget mappingTarget = project.getMappingTarget(target);
    EntityMapping entityMapping = mappingTarget.getMappingForSource(source);
    AttributeMapping attributeMapping = entityMapping.getAttributeMapping(targetAttribute);

    if (attributeMapping == null) {
      attributeMapping = entityMapping.addAttributeMapping(targetAttribute);
    }

    if (attributeMapping.getTargetAttribute().hasRefEntity()) {
      EntityType refEntityType = attributeMapping.getTargetAttribute().getRefEntity();
      Iterable<Entity> refEntities = () -> dataService.findAll(refEntityType.getId()).iterator();
      model.addAttribute("categories", refEntities);
    }

    Multimap<Relation, OntologyTerm> tagsForAttribute =
        ontologyTagService.getTagsForAttribute(
            entityMapping.getTargetEntityType(), attributeMapping.getTargetAttribute());

    model.addAttribute("tags", tagsForAttribute.values());
    model.addAttribute(
        "dataExplorerUri", menuReaderService.findMenuItemPath(DataExplorerController.ID));
    model.addAttribute("mappingProject", project);
    model.addAttribute("entityMapping", entityMapping);
    model.addAttribute(
        "sourceAttributesSize",
        Iterables.size(entityMapping.getSourceEntityType().getAtomicAttributes()));
    model.addAttribute("attributeMapping", attributeMapping);
    model.addAttribute(
        "attributes", newArrayList(dataService.getEntityType(source).getAtomicAttributes()));

    return VIEW_ATTRIBUTE_MAPPING;
  }
1374591
public void render(String templateName, Map<String, Object> model) {
        send(renderToString(templateName, model));
    }
378189
public List<JavaResource> getProjectAnnotations(Project project)
   {
      final List<JavaResource> classes = new ArrayList<>();
      if (project != null)
      {
         project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaAnnotationsSourceVisitor(classes));
      }
      return classes;
   }
819621
@GetMapping("/openid/*")
    protected ModelAndView handleRequestInternal(final HttpServletRequest request,
                                                 final HttpServletResponse response) {
        return new ModelAndView("openIdProviderView",
            CollectionUtils.wrap("openid_server", casProperties.getServer().getPrefix()));
    }
386546
public List<ComponentDto> selectByProjectUuid(String projectUuid, DbSession dbSession) {
    return mapper(dbSession).selectByProjectUuid(projectUuid);
  }
237211
public static ValidationResult validateVariableName(String identifier)
   {
      if (Strings.isNullOrEmpty(identifier))
         return new ValidationResult(ERROR, Messages.notNullOrEmpty(VARIABLE_NAME));
      return validateIdentifier(identifier, IdentifierType.VARIABLE_NAME);
   }
988330
private static void addRetrieveInternalModelId(CtClass clazz) throws NotFoundException,
        CannotCompileException {
        CtField modelIdField = null;
        CtClass temp = clazz;
        while (temp != null) {
            for (CtField field : temp.getDeclaredFields()) {
                if (JavassistUtils.hasAnnotation(field, OpenEngSBModelId.class.getName())) {
                    modelIdField = field;
                    break;
                }
            }
            temp = temp.getSuperclass();
        }
        CtClass[] params = generateClassField();
        CtMethod valueMethod = new CtMethod(cp.get(Object.class.getName()), "retrieveInternalModelId", params, clazz);
        StringBuilder builder = new StringBuilder();
        builder.append(createTrace("Called retrieveInternalModelId"));
        CtMethod idFieldGetter = getFieldGetter(modelIdField, clazz);
        if (modelIdField == null || idFieldGetter == null) {
            builder.append("return null;");
        } else {
            builder.append(String.format("return %s();", idFieldGetter.getName()));
        }
        valueMethod.setBody(createMethodBody(builder.toString()));
        clazz.addMethod(valueMethod);

        CtMethod nameMethod =
            new CtMethod(cp.get(String.class.getName()), "retrieveInternalModelIdName", generateClassField(), clazz);
        if (modelIdField == null) {
            nameMethod.setBody(createMethodBody("return null;"));
        } else {
            nameMethod.setBody(createMethodBody("return \"" + modelIdField.getName() + "\";"));
        }
        clazz.addMethod(nameMethod);
    }
209140
private String getProjectName() {
    String pName = Strings.emptyToNull(projectName);
    if (pName == null) { 
      pName = Strings.emptyToNull(junit4.getProject().getName());
    }
    if (pName == null) {
      pName = "(unnamed project)";      
    }
    return pName;
  }
14201
protected function resolveModelAndIdentifier($model, $identifier)
    {
        $resolve = new ResolveComponentModelIdentifier($model, $identifier);

        return $this->getComponentDataResolver()->resolveComponentData($resolve);
    }