@Override public List<String> getFieldListTypeAllPossibleValues(ShellContext shellContext) { // Get current value of class String currentText = shellContext.getParameters().get("type"); List<String> allPossibleValues = new ArrayList<String>(); // Getting all existing entities Set<ClassOrInterfaceTypeDetails> entitiesInProject = typeLocationService.findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_JPA_ENTITY); for (ClassOrInterfaceTypeDetails entity : entitiesInProject) { String name = replaceTopLevelPackageString(entity, currentText); if (!allPossibleValues.contains(name)) { allPossibleValues.add(name); } } // Getting all existing dtos Set<ClassOrInterfaceTypeDetails> dtosInProject = typeLocationService.findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_DTO); for (ClassOrInterfaceTypeDetails dto : dtosInProject) { String name = replaceTopLevelPackageString(dto, currentText); if (!allPossibleValues.contains(name)) { allPossibleValues.add(name); } } return allPossibleValues; }
@Override public boolean isNullRequiredVisibleForFieldOther(ShellContext shellContext) { String antagonistParam = shellContext.getParameters().get("notNull"); if (antagonistParam != null) { return false; } return true; }
@Override public boolean areDateAndTimeFormatVisibleForFieldDate(ShellContext shellContext) { String dateTimeFormatPattern = shellContext.getParameters().get("dateTimeFormatPattern"); if (dateTimeFormatPattern != null) { return false; } return true; }
@Override public boolean isPastVisibleForFieldDate(ShellContext shellContext) { String past = shellContext.getParameters().get("future"); if (past != null) { return false; } return true; }
@Override public boolean isAssertTrueVisibleForFieldBoolean(ShellContext shellContext) { String param = shellContext.getParameters().get("assertFalse"); if (param != null) { return false; } return true; }
@Override public boolean isDateTimeFormatPatternVisibleForFieldDate(ShellContext shellContext) { String dateFormat = shellContext.getParameters().get("dateFormat"); String timeFormat = shellContext.getParameters().get("timeFormat"); if (dateFormat == null && timeFormat == null) { return true; } return false; }
@Override public boolean isNullRequiredVisibleForFieldNumber(ShellContext shellContext) { // Check if `notNull`is specified String notNullParam = shellContext.getParameters().get("notNull"); if (notNullParam != null) { return false; } // Check if type is primitive String typeValue = shellContext.getParameters().get("type"); if (StringUtils.isNotBlank(typeValue)) { JavaType numberType = getJavaTypeConverter().convertFromText(typeValue, JavaType.class, "java-number"); if (numberType.isPrimitive()) { return false; } } return true; }