|
|
|
@ -9,10 +9,7 @@ import de.srsoftware.tools.Mappable; |
|
|
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException; |
|
|
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.util.Currency; |
|
|
|
import java.util.*; |
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.json.JSONException; |
|
|
|
import org.json.JSONException; |
|
|
|
import org.json.JSONObject; |
|
|
|
import org.json.JSONObject; |
|
|
|
@ -23,6 +20,7 @@ public class Company implements Mappable { |
|
|
|
private long lastCustomerNumber; |
|
|
|
private long lastCustomerNumber; |
|
|
|
private int decimals; |
|
|
|
private int decimals; |
|
|
|
private final Set<String> dirtyFields = new HashSet<>(); |
|
|
|
private final Set<String> dirtyFields = new HashSet<>(); |
|
|
|
|
|
|
|
private final Map<Long,UmbrellaUser> members; |
|
|
|
|
|
|
|
|
|
|
|
private Company(long id){ |
|
|
|
private Company(long id){ |
|
|
|
this(id,null,null,null,null,null,null,null,0,2,null,null,null,null); |
|
|
|
this(id,null,null,null,null,null,null,null,0,2,null,null,null,null); |
|
|
|
@ -43,6 +41,7 @@ public class Company implements Mappable { |
|
|
|
this.currency = currency; |
|
|
|
this.currency = currency; |
|
|
|
this.email = email; |
|
|
|
this.email = email; |
|
|
|
this.bankAccount = bankAccount; |
|
|
|
this.bankAccount = bankAccount; |
|
|
|
|
|
|
|
this.members = new HashMap<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String address(){ |
|
|
|
public String address(){ |
|
|
|
@ -98,6 +97,10 @@ public class Company implements Mappable { |
|
|
|
return lastCustomerNumber; |
|
|
|
return lastCustomerNumber; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<Long, UmbrellaUser> members(){ |
|
|
|
|
|
|
|
return members; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String name(){ |
|
|
|
public String name(){ |
|
|
|
return name; |
|
|
|
return name; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -175,6 +178,10 @@ public class Company implements Mappable { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Map<String, Object> toMap() { |
|
|
|
public Map<String, Object> toMap() { |
|
|
|
|
|
|
|
var memberMap = new HashMap<Long,Map<String,Object>>(); |
|
|
|
|
|
|
|
if (members != null) for (var entry : members.entrySet()){ |
|
|
|
|
|
|
|
memberMap.put(entry.getKey(),entry.getValue().toMap()); |
|
|
|
|
|
|
|
} |
|
|
|
return Map.ofEntries( |
|
|
|
return Map.ofEntries( |
|
|
|
entry(ID,id), |
|
|
|
entry(ID,id), |
|
|
|
entry(NAME,name), |
|
|
|
entry(NAME,name), |
|
|
|
@ -189,7 +196,8 @@ public class Company implements Mappable { |
|
|
|
entry(CUSTOMER_NUMBER_PREFIX,emptyIfNull(customerNumberPrefix)), |
|
|
|
entry(CUSTOMER_NUMBER_PREFIX,emptyIfNull(customerNumberPrefix)), |
|
|
|
entry(FIELD_CURRENCY,emptyIfNull(currency)), |
|
|
|
entry(FIELD_CURRENCY,emptyIfNull(currency)), |
|
|
|
entry(EMAIL,emptyIfNull(email)), |
|
|
|
entry(EMAIL,emptyIfNull(email)), |
|
|
|
entry(FIELD_BANK_ACCOUNT,emptyIfNull(bankAccount)) |
|
|
|
entry(FIELD_BANK_ACCOUNT,emptyIfNull(bankAccount)), |
|
|
|
|
|
|
|
entry(MEMBERS,memberMap) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|