19 package org.turro.crm.zul.sector;
21 import java.util.Collection;
22 import java.util.Iterator;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.turro.command.Command;
26 import org.turro.command.Context;
27 import org.turro.crm.db.CrmPU;
28 import org.turro.crm.entity.ActivitySector;
29 import org.turro.crm.entity.Customer;
30 import org.turro.elephant.context.ElephantContext;
31 import org.turro.elephant.util.Images;
32 import org.turro.elephant.util.Messages;
33 import org.turro.zkoss.input.MultiLabelBox;
42 private boolean selfSectors =
false;
45 this.customer = customer;
49 this.selfSectors = selfSectors;
89 return new CrmPU().getResultList(
"select distinct a.name from ActivitySector a");
93 protected void addChoice(
final String choice,
final Command command) {
95 if(asl.getName().equalsIgnoreCase(choice)) {
100 "select a from ActivitySector a where a.name = ?",
101 new Object[] { choice });
106 nas =
new CrmPU().saveObject(nas);
112 if(command !=
null) command.execute(
null);
121 if(command !=
null) command.execute(
null);
122 }
catch (Exception ex) {
129 protected void changeChoice(
final String oldChoice, String choice,
final Command command) {
132 public Object execute(Context context) {
134 if(command !=
null) command.execute(
null);
142 Iterator<ActivitySector> it = (selfSectors ?
145 while(it.hasNext()) {
146 if(it.next().getName().equals(oldChoice)) {
148 if(command !=
null)
try {
149 command.execute(
null);
151 }
catch (Exception ex) {
void setName(String name)
Set< ActivitySector > getActivitySectors()
Set< ActivitySector > getCustomerSectors()
String convertToString(ActivitySector label)
void setCustomer(Customer customer)
void changeChoice(final String oldChoice, String choice, final Command command)
void deleteChoice(String oldChoice, Command command)
void setSelfSectors(boolean selfSectors)
Collection< String > getLabelChoices()
Collection< ActivitySector > getCollection()
void addChoice(final String choice, final Command command)
static String logMsg(String msg)
static String getImage(String image)
static Messages confirmAcceptation()
Messages add(String word)
Object getSingleResultOrNull(SqlClause sc)