-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#21): further prepare pathway view support
- calculate effective groups
- Loading branch information
1 parent
61629a4
commit 22df287
Showing
5 changed files
with
207 additions
and
4 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...obodiet/manager/editing/recipe/Recipe_effectiveGroupingUsedForFacetDescriptorPathway.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
// Auto-generated by DitA-Tooling | ||
package dita.globodiet.manager.editing.recipe; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.apache.causeway.applib.annotation.MemberSupport; | ||
import org.apache.causeway.applib.annotation.Property; | ||
import org.apache.causeway.applib.annotation.PropertyLayout; | ||
import org.apache.causeway.applib.annotation.Snapshot; | ||
import org.apache.causeway.applib.annotation.Where; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import dita.globodiet.dom.params.classification.RecipeGrouping; | ||
import dita.globodiet.dom.params.recipe_list.Recipe; | ||
import dita.globodiet.manager.services.recipe.RecipeFacetHelperService; | ||
|
||
@Property( | ||
snapshot = Snapshot.EXCLUDED | ||
) | ||
@PropertyLayout( | ||
fieldSetId = "details", | ||
sequence = "90.0", | ||
describedAs = "Indicates the RecipeGroup or RecipeSubgroup, " | ||
+ "that is used to calculate the 'Effective Recipe Descriptors' list.", | ||
hidden = Where.ALL_TABLES | ||
) | ||
@RequiredArgsConstructor | ||
public class Recipe_effectiveGroupingUsedForFacetDescriptorPathway { | ||
|
||
@Inject private RecipeFacetHelperService recipeFacetHelperService; | ||
|
||
private final Recipe mixee; | ||
|
||
@MemberSupport | ||
public RecipeGrouping prop() { | ||
return recipeFacetHelperService.effectiveGroupingUsedForFacetDescriptorPathway(mixee); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...lobodiet/manager/editing/recipe/Recipe_effectiveGroupingUsedForQuantificationPathway.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
// Auto-generated by DitA-Tooling | ||
package dita.globodiet.manager.editing.recipe; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.apache.causeway.applib.annotation.MemberSupport; | ||
import org.apache.causeway.applib.annotation.Property; | ||
import org.apache.causeway.applib.annotation.PropertyLayout; | ||
import org.apache.causeway.applib.annotation.Snapshot; | ||
import org.apache.causeway.applib.annotation.Where; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import dita.globodiet.dom.params.recipe_list.Recipe; | ||
import dita.globodiet.dom.params.recipe_list.RecipeGroup; | ||
import dita.globodiet.manager.services.recipe.RecipeQuantificationHelperService; | ||
|
||
@Property( | ||
snapshot = Snapshot.EXCLUDED | ||
) | ||
@PropertyLayout( | ||
fieldSetId = "details", | ||
sequence = "91.0", | ||
describedAs = "Indicates the RecipeGroup, " | ||
+ "that is used to calculate the 'Effective Quantification' list.", | ||
hidden = Where.ALL_TABLES | ||
) | ||
@RequiredArgsConstructor | ||
public class Recipe_effectiveGroupingUsedForQuantificationPathway { | ||
|
||
@Inject private RecipeQuantificationHelperService recipeQuantificationHelperService; | ||
|
||
private final Recipe mixee; | ||
|
||
@MemberSupport | ||
public RecipeGroup prop() { | ||
return recipeQuantificationHelperService.effectiveGroupingUsedForQuantificationPathway(mixee); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...c/main/java/dita/globodiet/manager/services/recipe/RecipeQuantificationHelperService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package dita.globodiet.manager.services.recipe; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import org.apache.causeway.applib.services.factory.FactoryService; | ||
import org.apache.causeway.commons.functional.Either; | ||
|
||
import lombok.NonNull; | ||
|
||
import dita.globodiet.dom.params.classification.RecipeGrouping; | ||
import dita.globodiet.dom.params.pathway.QuantificationMethodPathwayForRecipe; | ||
import dita.globodiet.dom.params.pathway.QuantificationMethodPathwayForRecipeGroup; | ||
import dita.globodiet.dom.params.recipe_list.Recipe; | ||
import dita.globodiet.dom.params.recipe_list.RecipeDeps.Recipe_dependentQuantificationMethodPathwayForRecipeMappedByRecipe; | ||
import dita.globodiet.dom.params.recipe_list.RecipeGroup; | ||
import dita.globodiet.dom.params.recipe_list.RecipeGroupDeps.RecipeGroup_dependentQuantificationMethodPathwayForRecipeGroupMappedByRecipeGroup; | ||
import dita.globodiet.dom.params.recipe_list.RecipeSubgroup; | ||
import dita.globodiet.manager.services.grouping.GroupingHelperService; | ||
|
||
@Service | ||
public class RecipeQuantificationHelperService { | ||
|
||
@Inject private FactoryService factoryService; | ||
@Inject private GroupingHelperService groupingHelperService; | ||
|
||
public List<QuantificationMethodPathwayForRecipeGroup> effectiveQuantificationMethodPathwayForRecipeClassification( | ||
final @NonNull RecipeGrouping recipeGrouping) { | ||
final @NonNull Either<RecipeGroup, RecipeSubgroup> recipeClassification = recipeGrouping.toEither(); | ||
final List<QuantificationMethodPathwayForRecipeGroup> facetQuantificationMethodForRecipeGroup = | ||
recipeClassification | ||
.fold( | ||
recipeGroup-> | ||
listQuantificationMethodPathwayForRecipeGroup(recipeGroup), | ||
recipeSubgroup-> | ||
listQuantificationMethodPathwayForRecipeGroup( | ||
groupingHelperService.recipeGroup(recipeClassification.rightIfAny()))); | ||
|
||
return facetQuantificationMethodForRecipeGroup; | ||
} | ||
|
||
public RecipeGroup effectiveGroupingUsedForQuantificationPathway(final Recipe recipe) { | ||
var recipeClassification = groupingHelperService.recipeClassification(recipe); | ||
return recipeClassification | ||
.fold( | ||
recipeGroup->recipeGroup, | ||
recipeSubgroup->groupingHelperService.recipeGroup(recipeClassification.rightIfAny())); | ||
} | ||
|
||
public List<QuantificationMethodPathwayForRecipe> listQuantificationMethodPathwayForRecipe(final @NonNull Recipe recipe) { | ||
var mixin = factoryService.mixin(Recipe_dependentQuantificationMethodPathwayForRecipeMappedByRecipe.class, recipe); | ||
return mixin.coll(); | ||
} | ||
|
||
// -- HELPER | ||
|
||
private List<QuantificationMethodPathwayForRecipeGroup> listQuantificationMethodPathwayForRecipeGroup( | ||
final RecipeGroup recipeGroup) { | ||
var mixin = factoryService.mixin( | ||
RecipeGroup_dependentQuantificationMethodPathwayForRecipeGroupMappedByRecipeGroup.class, | ||
recipeGroup); | ||
return mixin.coll(); | ||
} | ||
|
||
} |