@@ -85,15 +85,15 @@ public CreateFamilyPayload createFamily(
8585 @ Argument
8686 final CreateFamilyInput input
8787 ) {
88- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
89- if (this .families .findByProjectAndName (project , input .id ()).isPresent ()) {
88+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
89+ if (this .families .findByProjectAndKey (project , input .key ()).isPresent ()) {
9090 throw new DuplicateFamilyException ();
9191 }
9292 final FamilyEntity entity = this .families .save (FamilyEntity .create (
9393 new ObjectId (),
9494 Instant .now (),
9595 project ,
96- input .id (),
96+ input .key (),
9797 input .java ()
9898 ));
9999 return new CreateFamilyPayload (entity );
@@ -105,8 +105,8 @@ public UpdateFamilyPayload updateFamily(
105105 @ Argument
106106 final UpdateFamilyInput input
107107 ) {
108- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
109- FamilyEntity family = this .families .findByProjectAndName (project , input .id ()).orElseThrow (FamilyNotFoundException ::new );
108+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
109+ FamilyEntity family = this .families .findByProjectAndKey (project , input .key ()).orElseThrow (FamilyNotFoundException ::new );
110110 final Java java = input .java ();
111111 if (java != null ) {
112112 family .setJava (java );
@@ -121,8 +121,8 @@ public DeleteFamilyPayload deleteFamily(
121121 @ Argument
122122 final DeleteFamilyInput input
123123 ) {
124- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
125- final FamilyEntity family = this .families .findByProjectAndName (project , input .id ()).orElseThrow (FamilyNotFoundException ::new );
124+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
125+ final FamilyEntity family = this .families .findByProjectAndKey (project , input .key ()).orElseThrow (FamilyNotFoundException ::new );
126126 if (this .versions .findAllByFamily (family ).findAny ().isPresent ()) {
127127 throw new FamilyInUseException ("Cannot delete this family because one or more versions are still associated with it." );
128128 }
@@ -135,17 +135,17 @@ public CreateVersionPayload createVersion(
135135 @ Argument
136136 final CreateVersionInput input
137137 ) {
138- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
139- final FamilyEntity family = this .families .findByProjectAndName (project , input .family ()).orElseThrow (FamilyNotFoundException ::new );
140- if (this .versions .findByProjectAndName (project , input .id ()).isPresent ()) {
138+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
139+ final FamilyEntity family = this .families .findByProjectAndKey (project , input .family ()).orElseThrow (FamilyNotFoundException ::new );
140+ if (this .versions .findByProjectAndKey (project , input .key ()).isPresent ()) {
141141 throw new DuplicateVersionException ();
142142 }
143143 final VersionEntity entity = this .versions .save (VersionEntity .create (
144144 new ObjectId (),
145145 Instant .now (),
146146 project ,
147147 family ,
148- input .id (),
148+ input .key (),
149149 null ,
150150 new Support (SupportStatus .SUPPORTED , null ),
151151 input .java ()
@@ -159,8 +159,8 @@ public UpdateVersionPayload updateVersion(
159159 @ Argument
160160 final UpdateVersionInput input
161161 ) {
162- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
163- VersionEntity version = this .versions .findByProjectAndName (project , input .id ()).orElseThrow (VersionNotFoundException ::new );
162+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
163+ VersionEntity version = this .versions .findByProjectAndKey (project , input .key ()).orElseThrow (VersionNotFoundException ::new );
164164 final Support newSupport = input .support ();
165165 if (newSupport != null ) {
166166 version .setSupport (newSupport );
@@ -176,8 +176,8 @@ public DeleteVersionPayload deleteVersion(
176176 @ Argument
177177 final DeleteVersionInput input
178178 ) {
179- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
180- final VersionEntity version = this .versions .findByProjectAndName (project , input .id ()).orElseThrow (VersionNotFoundException ::new );
179+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
180+ final VersionEntity version = this .versions .findByProjectAndKey (project , input .key ()).orElseThrow (VersionNotFoundException ::new );
181181 if (this .builds .findAllByVersion (version ).findAny ().isPresent ()) {
182182 throw new VersionInUseException ("Cannot delete this version because one or more builds are still associated with it." );
183183 }
@@ -190,16 +190,16 @@ public PromoteBuildPayload promoteBuild(
190190 @ Argument
191191 final PromoteBuildInput input
192192 ) {
193- final ProjectEntity project = this .projects .findByName (input .project ()).orElseThrow (ProjectNotFoundException ::new );
194- VersionEntity version = this .versions .findByProjectAndName (project , input .version ()).orElseThrow (VersionNotFoundException ::new );
195- BuildEntity build = this .builds .findByVersionAndNumber (version , input .id ()).orElseThrow (BuildNotFoundException ::new );
193+ final ProjectEntity project = this .projects .findByKey (input .project ()).orElseThrow (ProjectNotFoundException ::new );
194+ VersionEntity version = this .versions .findByProjectAndKey (project , input .version ()).orElseThrow (VersionNotFoundException ::new );
195+ BuildEntity build = this .builds .findByVersionAndNumber (version , input .number ()).orElseThrow (BuildNotFoundException ::new );
196196
197197 build .setChannel (BuildChannel .RECOMMENDED );
198198 build = this .builds .save (build );
199199
200200 version .setMostRecentPromotedBuild (build );
201201 version = this .versions .save (version );
202202
203- return new PromoteBuildPayload (version );
203+ return new PromoteBuildPayload (version , build );
204204 }
205205}
0 commit comments