BrightSide Workbench Full Report + Source Code
org.turro.alliance.client.model.PublishChallengeVM Class Reference

Public Member Functions

void init (@ExecutionArgParam("challenge") Challenge challenge)
 
boolean isNeedsSave ()
 
void setNeedsSave (boolean needsSave)
 
void add ()
 
void save ()
 
void delete (@BindingParam("category") AxChallengeCategory category)
 
List< AxChallengeCategorygetModel ()
 
WsServer getServer ()
 
void setServer (WsServer server)
 
Jsons getCategories (AxChallengeCategory pc)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 46 of file PublishChallengeVM.java.

Member Function Documentation

◆ add()

void org.turro.alliance.client.model.PublishChallengeVM.add ( )

Definition at line 68 of file PublishChallengeVM.java.

68  {
69  if(server != null && !inModel(server)) {
70  AxChallengeCategory pc = new AxChallengeCategory();
71  pc.setServerDomain(server.getServerDomain());
72  pc.setChallenge(challenge);
73  model.add(pc);
74  needsSave = true;
75  } else {
76  Toasts.message(I_.get("Already in model"));
77  }
78  }
String getServerDomain()
Definition: WsServer.java:52
Here is the call graph for this function:

◆ delete()

void org.turro.alliance.client.model.PublishChallengeVM.delete ( @BindingParam("category") AxChallengeCategory  category)

Definition at line 95 of file PublishChallengeVM.java.

95  {
96  deletions.add(category);
97  model.removeIf(pc -> pc.getServerDomain().equals(category.getServerDomain()));
98  needsSave = true;
99  }

◆ getCategories()

Jsons org.turro.alliance.client.model.PublishChallengeVM.getCategories ( AxChallengeCategory  pc)

Definition at line 134 of file PublishChallengeVM.java.

134  {
135  return Servers.getData(WsServer.from(pc.getServerDomain(), AxServer.SERVER_SERVICE), AxConstants.TALENT_CATEGORIES);
136  }
Here is the call graph for this function:

◆ getModel()

List<AxChallengeCategory> org.turro.alliance.client.model.PublishChallengeVM.getModel ( )

Definition at line 108 of file PublishChallengeVM.java.

108  {
109  if(model == null) {
110  model = SqlClause.select("pc").from("AxChallengeCategory pc")
111  .where().equal("pc.challengeId", String.valueOf(challenge.getId()))
112  .dao(new AlliancePU())
113  .resultList(AxChallengeCategory.class);
114  }
115  return model;
116  }
Here is the call graph for this function:

◆ getServer()

WsServer org.turro.alliance.client.model.PublishChallengeVM.getServer ( )

Definition at line 126 of file PublishChallengeVM.java.

126  {
127  return server;
128  }

◆ init()

void org.turro.alliance.client.model.PublishChallengeVM.init ( @ExecutionArgParam("challenge") Challenge  challenge)

Definition at line 51 of file PublishChallengeVM.java.

51  {
52  if(challenge != null) this.challenge = challenge;
53  if(this.challenge == null) {
54  this.challenge = (Challenge) Executions.getCurrent().getAttribute("challenge");
55  }
56  }

◆ isNeedsSave()

boolean org.turro.alliance.client.model.PublishChallengeVM.isNeedsSave ( )

Definition at line 58 of file PublishChallengeVM.java.

58  {
59  return needsSave;
60  }

◆ save()

void org.turro.alliance.client.model.PublishChallengeVM.save ( )

Definition at line 82 of file PublishChallengeVM.java.

82  {
83  Dao dao = new AlliancePU();
84  model.stream().filter(pc -> pc.isEmpty())
85  .forEach(pc -> dao.deleteEntity(pc));
86  model.removeIf(pc -> pc.isEmpty());
87  dao.saveEntities(model);
88  dao.deleteCollection(deletions);
89  deletions.clear();
90  needsSave = false;
91  }
Here is the call graph for this function:

◆ setNeedsSave()

void org.turro.alliance.client.model.PublishChallengeVM.setNeedsSave ( boolean  needsSave)

Definition at line 62 of file PublishChallengeVM.java.

62  {
63  this.needsSave = needsSave;
64  }

◆ setServer()

void org.turro.alliance.client.model.PublishChallengeVM.setServer ( WsServer  server)

Definition at line 130 of file PublishChallengeVM.java.

130  {
131  this.server = server;
132  }

The documentation for this class was generated from the following file: