Skip to content
Snippets Groups Projects

feat: Add projectAPI support to EfServices module

2 unresolved threads
Files
13
@@ -11,11 +11,13 @@
**********************************************************************/
package org.eclipsefoundation.efservices.api.models;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.google.auto.value.AutoValue;
@@ -23,6 +25,7 @@ import com.google.auto.value.AutoValue;
/**
* This model contains all user profile data. It is the entity served by the
* profile-api. Used to allow access to current user profile information.
* Provides a method for creating a stubbed bot user.
*/
@AutoValue
@JsonDeserialize(builder = AutoValue_EfUser.Builder.class)
@@ -87,8 +90,39 @@ public abstract class EfUser {
@Nullable
public abstract String getMpcFavoritesUrl();
@Nullable
@JsonIgnore
public abstract Boolean getIsBot();
public abstract Builder toBuilder();
/**
* Create a bot user stub when there is no real Eclipse account for the bot.
*
* @param name the Git user name that was detected to be a bot.
* @param mail The email of the bot.
* @return a stubbed Eclipse user bot object.
*/
public static EfUser createBotStub(String name, String mail) {
return EfUser.builder()
.setUid(0)
.setName(name)
.setMail(mail)
.setEca(Eca.builder().build())
.setIsBot(Boolean.TRUE)
.setPicture("")
.setFirstName("")
.setLastName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setOrg("")
.setJobTitle("bot")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setWorkingGroupsInterests(Collections.emptyList()).build();
}
public static Builder builder() {
return new AutoValue_EfUser.Builder();
}
@@ -145,6 +179,9 @@ public abstract class EfUser {
public abstract Builder setMpcFavoritesUrl(@Nullable String url);
@JsonIgnore
public abstract Builder setIsBot(@Nullable Boolean isBot);
public abstract EfUser build();
}
@@ -157,7 +194,8 @@ public abstract class EfUser {
public abstract boolean getCanContributeSpecProject();
public static Builder builder() {
return new AutoValue_EfUser_Eca.Builder();
return new AutoValue_EfUser_Eca.Builder().setCanContributeSpecProject(Boolean.FALSE)
.setSigned(Boolean.FALSE);
}
@AutoValue.Builder
Loading