-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from ccims/feature/manual-project-layout
Feature/manual project layout
- Loading branch information
Showing
27 changed files
with
680 additions
and
7 deletions.
There are no files selected for viewing
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
21 changes: 20 additions & 1 deletion
21
core/src/main/kotlin/gropius/dto/input/architecture/UpdateProjectInput.kt
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 |
---|---|---|
@@ -1,6 +1,25 @@ | ||
package gropius.dto.input.architecture | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import com.expediagroup.graphql.generator.execution.OptionalInput | ||
import com.expediagroup.graphql.generator.scalars.ID | ||
import gropius.dto.input.architecture.layout.UpdateLayoutInput | ||
import gropius.dto.input.architecture.layout.UpdateRelationLayoutInput | ||
import gropius.dto.input.architecture.layout.UpdateRelationPartnerLayoutInput | ||
|
||
@GraphQLDescription("Input for the updateProject mutation") | ||
class UpdateProjectInput : UpdateTrackableInput() | ||
class UpdateProjectInput( | ||
@GraphQLDescription("The default view for the project") | ||
val defaultView: OptionalInput<ID?>, | ||
@GraphQLDescription("Defines the new layout of a set of Relations") | ||
override val relationLayouts: OptionalInput<List<UpdateRelationLayoutInput>>, | ||
@GraphQLDescription("Defines the new layout of a set of RelationPartners") | ||
override val relationPartnerLayouts: OptionalInput<List<UpdateRelationPartnerLayoutInput>>, | ||
) : UpdateTrackableInput(), UpdateLayoutInput { | ||
|
||
override fun validate() { | ||
super.validate() | ||
validateLayout() | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
core/src/main/kotlin/gropius/dto/input/architecture/layout/CreateViewInput.kt
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,25 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import com.expediagroup.graphql.generator.execution.OptionalInput | ||
import com.expediagroup.graphql.generator.scalars.ID | ||
import gropius.dto.input.common.CreateNamedNodeInput | ||
|
||
@GraphQLDescription("Input for the createView mutation") | ||
class CreateViewInput( | ||
@GraphQLDescription("Defines the new layout of a set of Relations") | ||
override val relationLayouts: OptionalInput<List<UpdateRelationLayoutInput>>, | ||
@GraphQLDescription("Defines the new layout of a set of RelationPartners") | ||
override val relationPartnerLayouts: OptionalInput<List<UpdateRelationPartnerLayoutInput>>, | ||
@GraphQLDescription("The new filter of the view") | ||
val filterByTemplate: List<ID>, | ||
@GraphQLDescription("The id of the project the view belongs to") | ||
val project: ID | ||
) : CreateNamedNodeInput(), UpdateLayoutInput { | ||
|
||
override fun validate() { | ||
super.validate() | ||
validateLayout() | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
core/src/main/kotlin/gropius/dto/input/architecture/layout/RelationLayoutInput.kt
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,11 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import gropius.dto.input.common.Input | ||
import gropius.model.architecture.layout.Point | ||
|
||
@GraphQLDescription("Input which defines the layout of a Relation") | ||
class RelationLayoutInput( | ||
@GraphQLDescription("List of intermediate points of the relation") | ||
val points: List<Point>, | ||
) : Input() |
11 changes: 11 additions & 0 deletions
11
core/src/main/kotlin/gropius/dto/input/architecture/layout/RelationPartnerLayoutInput.kt
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,11 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import gropius.dto.input.common.Input | ||
import gropius.model.architecture.layout.Point | ||
|
||
@GraphQLDescription("Input which defines the layout of a RelationPartner") | ||
class RelationPartnerLayoutInput( | ||
@GraphQLDescription("The position of the RelationPartner") | ||
val pos: Point | ||
) : Input() |
45 changes: 45 additions & 0 deletions
45
core/src/main/kotlin/gropius/dto/input/architecture/layout/UpdateLayoutInput.kt
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,45 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.execution.OptionalInput | ||
import gropius.dto.input.ifPresent | ||
|
||
/** | ||
* Common input for updating the layout of a Project | ||
*/ | ||
interface UpdateLayoutInput { | ||
|
||
/** | ||
* The layout of the RelationPartners | ||
*/ | ||
val relationPartnerLayouts: OptionalInput<List<UpdateRelationPartnerLayoutInput>> | ||
|
||
/** | ||
* The layout of the Relations | ||
*/ | ||
val relationLayouts: OptionalInput<List<UpdateRelationLayoutInput>> | ||
|
||
/** | ||
* Validates the [relationPartnerLayouts] and [relationLayouts] | ||
* Ensures that there is only one layout per RelationPartner and Relation | ||
*/ | ||
fun validateLayout() { | ||
relationPartnerLayouts.ifPresent { layouts -> | ||
layouts.forEach(UpdateRelationPartnerLayoutInput::validate) | ||
layouts.groupBy { it.relationPartner }.forEach { (id, group) -> | ||
if (group.size > 1) { | ||
throw IllegalArgumentException("Multiple layouts for the same RelationPartner: $id") | ||
} | ||
} | ||
} | ||
relationLayouts.ifPresent { layouts -> | ||
layouts.forEach(UpdateRelationLayoutInput::validate) | ||
layouts.groupBy { it.relation }.forEach { (id, group) -> | ||
if (group.size > 1) { | ||
throw IllegalArgumentException("Multiple layouts for the same Relation: $id") | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
core/src/main/kotlin/gropius/dto/input/architecture/layout/UpdateRelationLayoutInput.kt
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,20 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import com.expediagroup.graphql.generator.scalars.ID | ||
import gropius.dto.input.common.Input | ||
|
||
@GraphQLDescription("Input to update the layout of a Relation") | ||
class UpdateRelationLayoutInput( | ||
@GraphQLDescription("The id of the Relation of which to update the layout") | ||
val relation: ID, | ||
@GraphQLDescription("The new layout of the Relation, or null if the layout should be reset") | ||
val layout: RelationLayoutInput? | ||
) : Input() { | ||
|
||
override fun validate() { | ||
super.validate() | ||
layout?.validate() | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...src/main/kotlin/gropius/dto/input/architecture/layout/UpdateRelationPartnerLayoutInput.kt
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,20 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import com.expediagroup.graphql.generator.scalars.ID | ||
import gropius.dto.input.common.Input | ||
|
||
@GraphQLDescription("Input to update the layout of a RelationPartner") | ||
class UpdateRelationPartnerLayoutInput( | ||
@GraphQLDescription("The id of the RelationPartner of which to update the layout") | ||
val relationPartner: ID, | ||
@GraphQLDescription("The new layout of the RelationPartner, or null if the layout should be reset") | ||
val layout: RelationPartnerLayoutInput? | ||
) : Input() { | ||
|
||
override fun validate() { | ||
super.validate() | ||
layout?.validate() | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
core/src/main/kotlin/gropius/dto/input/architecture/layout/UpdateViewInput.kt
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,23 @@ | ||
package gropius.dto.input.architecture.layout | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import com.expediagroup.graphql.generator.execution.OptionalInput | ||
import com.expediagroup.graphql.generator.scalars.ID | ||
import gropius.dto.input.common.UpdateNamedNodeInput | ||
|
||
@GraphQLDescription("Input for the updateView mutation") | ||
class UpdateViewInput( | ||
@GraphQLDescription("Defines the new layout of a set of Relations") | ||
override val relationLayouts: OptionalInput<List<UpdateRelationLayoutInput>>, | ||
@GraphQLDescription("Defines the new layout of a set of RelationPartners") | ||
override val relationPartnerLayouts: OptionalInput<List<UpdateRelationPartnerLayoutInput>>, | ||
@GraphQLDescription("The new filter of the view") | ||
val filterByTemplate: OptionalInput<List<ID>> | ||
) : UpdateNamedNodeInput(), UpdateLayoutInput { | ||
|
||
override fun validate() { | ||
super.validate() | ||
validateLayout() | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.