@Override public void completeItemController(JavaType itemController, JpaEntityMetadata entityMetadata, ClassOrInterfaceTypeDetails serviceDetails, ClassOrInterfaceTypeDetailsBuilder cidBuilder) { JavaType concurrencyManagerType = new JavaType(SpringletsJavaType.SPRINGLETS_CONCURRENCY_MANAGER.getFullyQualifiedTypeName(), 0, DataType.TYPE, null, Arrays.asList(entityMetadata.getDestination())); cidBuilder.addImplementsType(concurrencyManagerType); }; }
curEntity.getRelationInfos(), "ERROR: In %s controller, @RooDetail: Invalid value '%s': Can't get relation information about '%s' on %s entity", controller, relationField, relName, curEntity.getDestination()); Validate .isTrue( "ERROR: In %s controller, @RooDetail '%s' [%s] has unsupported type (%s) on '%s' entity: should be ONE_TO_MANY or MANY_TO_MANY", controller, relName, relationField, curInfo.cardinality.name(), curEntity.getDestination()); info.add(curInfo);
public List<RelationInfoExtended> getRelationInfoFor(final JpaEntityMetadata entityMetadata, final String path) { Validate.notNull(entityMetadata, "entity metadata is required"); Validate.notBlank(path, "path is required"); List<RelationInfoExtended> infos = new ArrayList<RelationInfoExtended>(); String[] split = StringUtils.split(path, '.'); RelationInfo info = entityMetadata.getRelationInfos().get(split[0]); Validate.notNull(info, "%s.%s not found or not a relation field", entityMetadata.getDestination(), split[0]); ClassOrInterfaceTypeDetails childCid = getTypeLocationService().getTypeDetails(info.childType); JpaEntityMetadata childMetadata = getMetadataService().get(JpaEntityMetadata.createIdentifier(childCid)); infos.add(new RelationInfoExtended(info, entityMetadata, childMetadata)); if (split.length > 1) { infos .addAll(getRelationInfoFor(childMetadata, StringUtils.join(split, '.', 1, split.length))); } return infos; }
/** * Constructs a DetailEntityItem using the fieldName and suffixId * * @param fieldName * the fieldName that represents the relationship * @param suffixId * used to generate field id */ public DetailEntityItem(JpaEntityMetadata childEntityMetadata, ControllerMetadata controllerMetadata, String controllerPath, String detailSuffix, EntityItem rootEntity) { super(childEntityMetadata.getDestination().getSimpleTypeName(), detailSuffix, childEntityMetadata.isReadOnly()); this.level = controllerMetadata.getDetailsFieldInfo().size(); this.rootEntity = rootEntity; this.fieldInfo = controllerMetadata.getLastDetailsInfo(); this.fieldName = fieldInfo.fieldName; this.fieldNameCapitalized = StringUtils.capitalize(fieldName); this.tabLinkCode = null; this.pathString = controllerMetadata.getDetailsPathAsString("-"); this.pathStringFieldNames = controllerMetadata.getDetailsPathAsString("."); this.controllerPath = controllerPath; this.templatePath = StringUtils.removeStart(controllerPath, "/"); this.z = calculateZ(); buildDetailItemId(detailSuffix); }
StringUtils.uncapitalize(entityMetadata.getDestination().getSimpleTypeName()); getNameOfJavaType(entityMetadata.getDestination()), entityItemName, serviceField.getFieldName(), serviceMetadata.getCurrentFindOneMethod().getMethodName(), entityMetadata.getCurrentIndentifierField().getFieldName()); bodyBuilder.appendFormalLine("throw new %s(\"%s not found\");", getNameOfJavaType(SpringletsJavaType.SPRINGLETS_NOT_FOUND_EXCEPTION), entityMetadata .getDestination().getSimpleTypeName()); bodyBuilder.indentRemove(); entityMetadata.getDestination(), parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations);
new RelationInfo(getDestination(), fieldName, addMethod, removeMethod, cardinality, childType, field, mappedBy, relationType); fieldInfosTemporal.put(fieldName, info);
@Override public void completeItemController(JavaType itemController, JpaEntityMetadata entityMetadata, ClassOrInterfaceTypeDetails serviceDetails, ClassOrInterfaceTypeDetailsBuilder cidBuilder) { JavaType concurrencyManagerType = new JavaType(SpringletsJavaType.SPRINGLETS_CONCURRENCY_MANAGER.getFullyQualifiedTypeName(), 0, DataType.TYPE, null, Arrays.asList(entityMetadata.getDestination())); cidBuilder.addImplementsType(concurrencyManagerType); }; }
new RelationInfo(getDestination(), fieldName, addMethod, removeMethod, cardinality, childType, field, mappedBy, relationType); fieldInfosTemporal.put(fieldName, info);