PageRenderTime 210ms CodeModel.GetById 60ms app.highlight 98ms RepoModel.GetById 43ms app.codeStats 0ms

/src/mpv5/db/objects/Item.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 839 lines | 536 code | 92 blank | 211 comment | 56 complexity | d43f24f91e1fd6001ee136c5951e70d0 MD5 | raw file
  1/*
  2 *  This file is part of YaBS.
  3 *
  4 *      YaBS is free software: you can redistribute it and/or modify
  5 *      it under the terms of the GNU General Public License as published by
  6 *      the Free Software Foundation, either version 3 of the License, or
  7 *      (at your option) any later version.
  8 *
  9 *      YaBS is distributed in the hope that it will be useful,
 10 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 *      GNU General Public License for more details.
 13 *
 14 *      You should have received a copy of the GNU General Public License
 15 *      along with YaBS.  If not, see <http://www.gnu.org/licenses/>.
 16 */
 17package mpv5.db.objects;
 18
 19import enoa.handler.TableHandler;
 20import enoa.handler.TemplateHandler;
 21import java.awt.Color;
 22import java.math.BigDecimal;
 23import java.text.DateFormat;
 24import java.text.SimpleDateFormat;
 25import java.util.ArrayList;
 26import java.util.Collections;
 27import java.util.Date;
 28import java.util.HashMap;
 29import java.util.List;
 30import java.util.Locale;
 31import javax.swing.JComponent;
 32import mpv5.YabsViewProxy;
 33import mpv5.db.common.Context;
 34import mpv5.db.common.DatabaseObject;
 35import mpv5.db.common.Formattable;
 36import mpv5.db.common.NodataFoundException;
 37import mpv5.db.common.Templateable;
 38import mpv5.globals.GlobalSettings;
 39import mpv5.globals.Messages;
 40import mpv5.handler.FormatHandler;
 41import mpv5.handler.MPEnum;
 42import mpv5.logging.Log;
 43import mpv5.ui.panels.ItemPanel;
 44import mpv5.utils.export.Export;
 45import mpv5.utils.images.MPIcon;
 46import mpv5.utils.jobs.Job;
 47import mpv5.utils.numberformat.FormatNumber;
 48import mpv5.utils.text.TypeConversion;
 49
 50/**
 51 *
 52 *
 53 */
 54public class Item extends DatabaseObject implements Formattable, Templateable {
 55
 56    private static final long serialVersionUID = 1L;
 57
 58    /**
 59     * Returns a localized string representation of the given item status
 60     *
 61     * @param status
 62     * @return
 63     */
 64    public static String getStatusString(int status) {
 65        switch (status) {
 66            case (STATUS_QUEUED):
 67                return Messages.STATUS_QUEUED.toString();
 68            case (STATUS_IN_PROGRESS):
 69                return Messages.STATUS_IN_PROGRESS.toString();
 70            case (STATUS_PAUSED):
 71                return Messages.STATUS_PAUSED.toString();
 72            case (STATUS_FINISHED):
 73                return Messages.STATUS_FINISHED.toString();
 74            case (STATUS_PAID):
 75                return Messages.STATUS_PAID.toString();
 76            case (STATUS_CANCELLED):
 77                return Messages.STATUS_CANCELLED.toString();
 78        }
 79        return Messages.NA.toString();
 80    }
 81
 82    /**
 83     * Returns all possible status messages
 84     *
 85     * @return
 86     */
 87    public static MPEnum[] getStatusStrings() {
 88        MPEnum[] en = new MPEnum[6];
 89        en[0] = new MPEnum() {
 90
 91            @Override
 92            public Integer getId() {
 93                return new Integer(STATUS_QUEUED);
 94            }
 95
 96            @Override
 97            public String getName() {
 98                return getStatusString(getId());
 99            }
100        };
101        en[1] = new MPEnum() {
102
103            @Override
104            public Integer getId() {
105                return new Integer(STATUS_IN_PROGRESS);
106            }
107
108            @Override
109            public String getName() {
110                return getStatusString(getId());
111            }
112        };
113        en[2] = new MPEnum() {
114
115            @Override
116            public Integer getId() {
117                return new Integer(STATUS_PAUSED);
118            }
119
120            @Override
121            public String getName() {
122                return getStatusString(getId());
123            }
124        };
125        en[3] = new MPEnum() {
126
127            @Override
128            public Integer getId() {
129                return new Integer(STATUS_FINISHED);
130            }
131
132            @Override
133            public String getName() {
134                return getStatusString(getId());
135            }
136        };
137        en[4] = new MPEnum() {
138
139            @Override
140            public Integer getId() {
141                return new Integer(STATUS_PAID);
142            }
143
144            @Override
145            public String getName() {
146                return getStatusString(getId());
147            }
148        };
149        en[5] = new MPEnum() {
150
151            @Override
152            public Integer getId() {
153                return new Integer(STATUS_CANCELLED);
154            }
155
156            @Override
157            public String getName() {
158                return getStatusString(getId());
159            }
160        };
161        return en;
162    }
163
164    /**
165     * Returns a localized string represenation of the given item type
166     *
167     * @param type
168     * @return
169     */
170    public static String getTypeString(int type) {
171        switch (type) {
172            case (TYPE_BILL):
173                return Messages.TYPE_BILL.toString();
174            case (TYPE_OFFER):
175                return Messages.TYPE_OFFER.toString();
176            case (TYPE_ORDER):
177                return Messages.TYPE_ORDER.toString();
178//            case (TYPE_DELIVERY_NOTE):
179//                return Messages.TYPE_DELIVERY.toString();
180//            case (TYPE_ORDER_CONFIRMATION):
181//                return Messages.TYPE_CONFIRMATION.toString();
182        }
183        return "";
184    }
185
186    public static MPEnum[] getItemEnum() {
187        MPEnum[] en = new MPEnum[4];
188        en[0] = new MPEnum() {
189
190            @Override
191            public Integer getId() {
192                return new Integer(-1);
193            }
194
195            @Override
196            public String getName() {
197                return Messages.ALL.toString();
198            }
199        };
200        en[1] = new MPEnum() {
201
202            @Override
203            public Integer getId() {
204                return new Integer(TYPE_BILL);
205            }
206
207            @Override
208            public String getName() {
209                return getTypeString(TYPE_BILL);
210            }
211        };
212        en[2] = new MPEnum() {
213
214            @Override
215            public Integer getId() {
216                return new Integer(TYPE_OFFER);
217            }
218
219            @Override
220            public String getName() {
221                return getTypeString(TYPE_OFFER);
222            }
223        };
224        en[3] = new MPEnum() {
225
226            @Override
227            public Integer getId() {
228                return new Integer(TYPE_ORDER);
229            }
230
231            @Override
232            public String getName() {
233                return getTypeString(TYPE_ORDER);
234            }
235        };
236//        en[4] = new MPEnum() {
237//
238//            @Override
239//            public Integer getId() {
240//                return new Integer(3);
241//            }
242//
243//            @Override
244//            public String getName() {
245//                return getTypeString(3);
246//            }
247//        };
248//        en[5] = new MPEnum() {
249//
250//            @Override
251//            public Integer getId() {
252//                return new Integer(4);
253//            }
254//
255//            @Override
256//            public String getName() {
257//                return getTypeString(4);
258//            }
259//        };        
260        return en;
261    }
262    private int contactsids;
263    private int accountsids;
264    private BigDecimal netvalue = BigDecimal.ZERO;
265    private BigDecimal taxvalue = BigDecimal.ZERO;
266    private BigDecimal discountvalue = BigDecimal.ZERO;
267    private Date datetodo;
268    private Date dateend;
269    private int intreminders;
270    private int intstatus;
271    private int inttype;
272    private String description = "";
273    private String cnumber = "";
274    public static final int STATUS_QUEUED = 0;
275    public static final int STATUS_IN_PROGRESS = 1;
276    public static final int STATUS_PAUSED = 2;
277    public static final int STATUS_FINISHED = 3;
278    public static final int STATUS_PAID = 4;
279    public static final int STATUS_CANCELLED = 5;
280//    public static final int TYPE_BILL = 0;
281//    public static final int TYPE_ORDER = 1;
282//    public static final int TYPE_OFFER = 2;
283//    public static final int TYPE_DELIVERY_NOTE = 3;
284//    public static final int TYPE_ORDER_CONFIRMATION = 4;
285    private FormatHandler formatHandler;
286
287    public Item() {
288        setContext(Context.getItem());
289    }
290
291    /**
292     * @return the contactsids
293     */
294    public int __getContactsids() {
295        return contactsids;
296    }
297
298    /**
299     * @param contactsids the contactsids to set
300     */
301    public void setContactsids(int contactsids) {
302        this.contactsids = contactsids;
303    }
304
305    /**
306     * @return the taxvalue
307     */
308    public BigDecimal __getTaxvalue() {
309        return taxvalue;
310    }
311
312    /**
313     * @param taxvalue the taxvalue to set
314     */
315    public void setTaxvalue(BigDecimal taxvalue) {
316        this.taxvalue = taxvalue;
317    }
318
319    /**
320     * @return the Discountvalue
321     */
322    public BigDecimal __getDiscountvalue() {
323        return discountvalue;
324    }
325
326    /**
327     * @param the discountvalue to set
328     */
329    public void setDiscountvalue(BigDecimal discountvalue) {
330        this.discountvalue = discountvalue;
331    }
332
333    /**
334     * @return the datetodo
335     */
336    public Date __getDatetodo() {
337        return datetodo;
338    }
339
340    /**
341     * @param datetodo the datetodo to set
342     */
343    public void setDatetodo(Date datetodo) {
344        this.datetodo = datetodo;
345    }
346
347    /**
348     * @return the intreminders
349     */
350    public int __getIntreminders() {
351        return intreminders;
352    }
353
354    /**
355     * @param intreminders the intreminders to set
356     */
357    public void setIntreminders(int intreminders) {
358        this.intreminders = intreminders;
359    }
360
361//    /**
362//     * @return the groupname
363//     */
364////    public String __getGroupname() {
365//        return groupname;
366//    }
367//
368//    /**
369//     * @param groupname the groupname to set
370//     */
371//    public void setGroupname(String groupname) {
372//        this.groupname = groupname;
373//    }
374    /**
375     * @return the dateend
376     */
377    public Date __getDateend() {
378        return dateend;
379    }
380
381    /**
382     * @param dateend the dateend to set
383     */
384    public void setDateend(Date dateend) {
385        this.dateend = dateend;
386    }
387
388    @Override
389    public JComponent getView() {
390        ItemPanel p = new ItemPanel(Context.getItem(), __getInttype());
391        return p;
392    }
393
394    /**
395     * @return the defaultaccountsids
396     */
397    public int __getAccountsids() {
398        return accountsids;
399    }
400
401    /**
402     * @param defaultaccountsids the defaultaccountsids to set
403     */
404    public void setAccountsids(int defaultaccountsids) {
405        this.accountsids = defaultaccountsids;
406    }
407
408    /**
409     * @return the description
410     */
411    public String __getDescription() {
412        return description;
413    }
414
415    /**
416     * @param description the description to set
417     */
418    public void setDescription(String description) {
419        this.description = description;
420    }
421
422    /**
423     * <li>QUEUED = 0; <li>IN_PROGRESS= 1; <li>PAUSED = 2; <li>FINNISHED= 3;
424     *
425     * @return the intstatus
426     */
427    public int __getIntstatus() {
428        return intstatus;
429    }
430
431    /**
432     * <li>QUEUED = 0; <li>IN_PROGRESS= 1; <li>PAUSED = 2; <li>FINNISHED= 3;
433     *
434     * @param intstatus the intstatus to set
435     */
436    public void setIntstatus(int intstatus) {
437        this.intstatus = intstatus;
438    }
439
440    /**
441     * <li>TYPE_BILL = 0; <li>TYPE_ORDER = 1; <li>TYPE_OFFER = 2;
442     *
443     * @return the inttype
444     */
445    public int __getInttype() {
446        return inttype;
447    }
448
449    /**
450     * <li>TYPE_BILL = 0; <li>TYPE_ORDER = 1; <li>TYPE_OFFER = 2;
451     *
452     * @param inttype the inttype to set
453     */
454    public void setInttype(int inttype) {
455        this.inttype = inttype;
456    }
457
458    /**
459     * @return the netvalue
460     */
461    public BigDecimal __getNetvalue() {
462        return netvalue;
463    }
464
465    /**
466     * @param netvalue the netvalue to set
467     */
468    public void setNetvalue(BigDecimal netvalue) {
469        this.netvalue = netvalue;
470    }
471
472    @Override
473    public mpv5.utils.images.MPIcon getIcon() {
474        if (__getIntstatus() == STATUS_QUEUED) {
475            return new MPIcon("/mpv5/resources/images/22/kontact_mail.png");
476        } else if (__getIntstatus() == STATUS_IN_PROGRESS) {
477            return new MPIcon("/mpv5/resources/images/22/run.png");
478        } else if (__getIntstatus() == STATUS_PAUSED) {
479            return new MPIcon("/mpv5/resources/images/22/kalarm.png");
480        } else if (__getIntstatus() == STATUS_FINISHED) {
481            return new MPIcon("/mpv5/resources/images/22/knewstuff.png");
482        } else if (__getIntstatus() == STATUS_PAID) {
483            return new MPIcon("/mpv5/resources/images/22/ok.png");
484        } else if (__getIntstatus() == STATUS_CANCELLED) {
485            return new MPIcon("/mpv5/resources/images/22/file_temporary.png");
486        } else {
487            return new MPIcon("/mpv5/resources/images/22/kontact_mail.png");
488        }
489    }
490
491    /**
492     * @return the formatHandler
493     */
494    public synchronized FormatHandler getFormatHandler() {
495        if (formatHandler == null) {
496            formatHandler = new FormatHandler(this);
497        }
498        return formatHandler;
499    }
500
501    @Override
502    public synchronized void ensureUniqueness() {
503        Log.Debug(this, "In ensureUniqueness for " + this.getClass());
504        setCnumber(getFormatHandler().next());
505        setCname(__getCnumber());
506        Log.Debug(this, "ensureUniqueness result: " + __getCnumber());
507    }
508
509    /**
510     * Fetches all related {@link Subitem}s to this {@link Item}<br/> If no
511     * subitems are assigned, returns an empty default list of default subitems
512     *
513     * @return
514     */
515    public SubItem[] getSubitems() {
516        List<DatabaseObject> data = new ArrayList<DatabaseObject>();
517        try {
518            data = DatabaseObject.getReferencedObjects(this, Context.getSubItem(), DatabaseObject.getObject(Context.getSubItem()), false);
519        } catch (NodataFoundException ex) {
520            for (int i = 0; i < 6; i++) {
521                data.add(SubItem.getDefaultItem());
522            }
523        }
524//        SubItem[] t = new SubItem[data.size()];
525//        for (int i = 0; i < data.size(); i++) {
526//            t[i] = (SubItem) data.get(i);
527//        }
528        return data.toArray(new SubItem[]{});
529    }
530
531    /**
532     * @return the cnumber
533     */
534    public String __getCnumber() {
535        return cnumber;
536    }
537
538    /**
539     * @param cnumber the cnumber to set
540     */
541    public void setCnumber(String cnumber) {
542        this.cnumber = cnumber;
543    }
544
545    @Override
546    public HashMap<String, Object> resolveReferences(HashMap<String, Object> map) {
547        resolveValueProperties(map);
548
549        try {
550            if (map.containsKey("intstatus")) {
551                map.put("status", getStatusString(Integer.valueOf(map.get("intstatus").toString())));
552            }
553        } catch (Exception numberFormatException) {
554            //already resolved?
555        }
556
557        try {
558            if (map.containsKey("inttype")) {
559                map.put("type", getTypeString(Integer.valueOf(map.get("inttype").toString())));
560                map.remove("inttype");
561            }
562        } catch (Exception numberFormatException) {
563            //already resolved?
564        }
565
566        if (map.containsKey("defaultaccountsids")) {
567            try {
568                try {
569                    map.put("account", DatabaseObject.getObject(Context.getAccounts(), Integer.valueOf(map.get("defaultaccountsids").toString())));
570                    map.remove("defaultaccountsids");
571                } catch (NodataFoundException ex) {
572                    map.put("account", null);
573                    Log.Debug(this, ex.getMessage());
574                }
575            } catch (NumberFormatException numberFormatException) {
576                //already resolved?
577            }
578        }
579
580        if (map.containsKey("contactsids")) {
581            try {
582                try {
583                    map.put("contact", DatabaseObject.getObject(Context.getContact(), Integer.valueOf(map.get("contactsids").toString())));
584                    map.remove("contactsids");
585                } catch (NodataFoundException ex) {
586                    map.put("contact", null);
587                    Log.Debug(this, ex.getMessage());
588                }
589            } catch (NumberFormatException numberFormatException) {
590                //already resolved?
591            }
592        }
593
594        if (map.containsKey("taxids")) {
595            try {
596                map.put("tax", FormatNumber.formatPercent(Tax.getTaxValue(Integer.valueOf(map.get("taxids").toString()))));
597                map.remove("taxids");
598            } catch (NumberFormatException numberFormatException) {
599                Log.Debug(numberFormatException);
600            }
601        }
602
603        List<SubItem> data;
604        List<String[]> data2;
605        ArrayList<String[]> list = new ArrayList<String[]>();
606
607        try {
608            data = DatabaseObject.getReferencedObjects(this, Context.getSubItem(), new SubItem(), false);
609            Collections.sort(data, SubItem.ORDER_COMPARATOR);
610
611            for (int i = 0; i < data.size(); i++) {
612                SubItem t = data.get(i);
613                list.add(t.toStringArray());
614
615                if (GlobalSettings.getBooleanProperty("org.openyabs.exportproperty.pdftable", false)) {
616                    data2 = t.getValues3();
617                    for (int j = 0; j < data2.size(); j++) {
618                        String[] strings = data2.get(j);
619                        map.put("subitem" + i + "." + strings[0].toLowerCase(), strings[1]);
620                    }
621                }
622            }
623
624            if (GlobalSettings.getBooleanProperty("org.openyabs.exportproperty.hidecountfortext", true)) {
625                int skipcount = 0;
626                for (int i = 0; i < data.size(); i++) {
627                    SubItem t = data.get(i);
628                    if (t.getInttype() == SubItem.TYPE_TEXT) {
629                        skipcount--;
630                        Log.Debug(this, "Skipping text subitem..");
631                    } else {
632                        list.get(i)[0] = String.valueOf(Integer.valueOf(list.get(i)[0]) + skipcount);
633                    }
634                }
635            }
636        } catch (NodataFoundException ex) {
637            Log.Debug(this, ex.getMessage());
638        }
639
640        map.put(TableHandler.KEY_TABLE + "1", list);
641
642        //values
643        map.put("netvalue", FormatNumber.formatDezimal(__getNetvalue()));
644        map.put("taxvalue", FormatNumber.formatDezimal(__getTaxvalue()));
645        map.put("grosvalue", FormatNumber.formatDezimal(__getTaxvalue().add(__getNetvalue())));
646        map.put("discountvalue", FormatNumber.formatDezimal(__getDiscountvalue()));
647
648        map.put("netvaluef", FormatNumber.formatLokalCurrency(__getNetvalue()));
649        map.put("taxvaluef", FormatNumber.formatLokalCurrency(__getTaxvalue()));
650        map.put("grosvaluef", FormatNumber.formatLokalCurrency(__getTaxvalue().add(__getNetvalue())));
651        map.put("discountvaluef", FormatNumber.formatPercent(__getDiscountvalue()));
652
653        Locale l = Locale.getDefault();
654        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("item.date.locale")) {
655            try {
656                l = TypeConversion.stringToLocale(mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("item.date.locale"));
657            } catch (Exception e) {
658            }
659            if (l != null) {
660            } else {
661                Log.Debug(this, "Error while using item.date.locale");
662            }
663        }
664        DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, l);
665        if (mpv5.db.objects.User.getCurrentUser().getProperties().hasProperty("org.openyabs.exportproperty.dateformat")) {
666            String dd = mpv5.db.objects.User.getCurrentUser().getProperties().getProperty("org.openyabs.exportproperty.dateformat");
667            try {
668                df = new SimpleDateFormat(dd, l);
669            } catch (Exception e) {
670                Log.Debug(this, "Error while using default.date.format: " + e);
671            }
672        }
673        map.put("dateend", df.format(__getDateend()));
674        map.put("datetodo", df.format(__getDatetodo()));
675
676        return super.resolveReferences(map);
677    }
678
679    public void defineFormatHandler(FormatHandler handler) {
680        formatHandler = handler;
681    }
682
683    /**
684     * Create a revenue entry out of this item
685     */
686    public void createRevenue() {
687        Revenue r = new Revenue();
688        r.setAccountsids(accountsids);
689        r.setNetvalue(netvalue);
690//        r.setTaxpercentvalue(taxvalue);
691        r.setBrutvalue(netvalue.add(taxvalue).subtract(discountvalue));
692        if (description != null && description.length() > 0) {
693            r.setDescription(description);
694        } else {
695            r.setDescription(Messages.AUTO_GENERATED_VALUE + " " + cnumber);
696        }
697        r.save();
698    }
699
700    @Override
701    public boolean save(boolean silent) {
702        boolean saved = super.save(silent);
703        if (saved) {
704            if (mpv5.db.objects.User.getCurrentUser().getProperty("org.openyabs.property", "autocreatepdf")) {
705                if (TemplateHandler.isLoaded(this)) {
706                    new Job(Export.createFile(this.getFormatHandler().toUserString(), TemplateHandler.loadTemplate(this), this), Export.wait(User.getSaveDir(this))).execute();
707                } else {
708                    YabsViewProxy.instance().addMessage(Messages.NO_TEMPLATE_LOADED + " (" + mpv5.db.objects.User.getCurrentUser() + ")", Color.YELLOW);
709                }
710            }
711            if (mpv5.db.objects.User.getCurrentUser().getProperty("org.openyabs.property", "autocreateodt")) {
712                if (TemplateHandler.isLoaded(this)) {
713                    new Job(Export.sourceFile(this.getFormatHandler().toUserString(), TemplateHandler.loadTemplate(this), this), Export.wait(User.getSaveDir(this))).execute();
714                } else {
715                    YabsViewProxy.instance().addMessage(Messages.NO_TEMPLATE_LOADED + " (" + mpv5.db.objects.User.getCurrentUser() + ")", Color.YELLOW);
716                }
717            }
718        }
719        return saved;
720    }
721
722    @Override
723    public String toString() {
724        try {
725            return ((Contact) getObject(Context.getContact(), contactsids)).__getCname() + "-" + getCname();
726        } catch (NodataFoundException ex) {
727            return super.toString();
728        }
729    }
730
731    @Override
732    public boolean reset() {
733        if (ids > 0) {
734            SubItem[] data = getSubitems();
735            for (int i = 0; i < data.length; i++) {
736                SubItem subItem = data[i];
737                SubItem.removeFromDeletionQueue(subItem.__getIDS());
738            }
739        }
740        return super.reset();
741    }
742
743    /**
744     * Fetches all properties for this item from the db
745     *
746     * @return A (possibly empty) list of {@link ValueProperty}s
747     */
748    public List<ValueProperty> getProperties() {
749        return ValueProperty.getProperties(this);
750    }
751
752    @Override
753    public boolean delete() {
754        SubItem[] it = getSubitems();
755        for (int i = 0; i < it.length; i++) {
756            it[i].delete();
757        }
758        setCnumber(FormatHandler.DELETED_IDENTIFIER + __getCnumber());
759        setCname(__getCnumber());
760        save(true);
761        return super.delete();
762    }
763
764    @Override
765    public boolean undelete() {
766
767        List<DatabaseObject> data = new ArrayList<DatabaseObject>();
768        try {
769            data = DatabaseObject.getReferencedObjects(this, Context.getSubItem(), DatabaseObject.getObject(Context.getSubItem()), true);
770            for (int i = 0; i < data.size(); i++) {
771                data.get(i).undelete();
772            }
773        } catch (NodataFoundException ex) {
774            Log.Debug(this, ex.getMessage());
775        }
776
777        setCnumber(__getCnumber().replaceFirst(FormatHandler.DELETED_IDENTIFIER, ""));
778        setCname(__getCnumber());
779
780        return super.undelete();
781    }
782
783    @Override
784    public int templateType() {
785        return __getInttype();
786    }
787
788    /**
789     *
790     * @return
791     */
792    @Override
793    public int templateGroupIds() {
794        return __getGroupsids();
795    }
796
797    /**
798     * @return the contact
799     */
800    @Persistable(false)/*
801     * is persisting via contactsids
802     */
803
804    public Contact getContact() throws NodataFoundException {
805        return (Contact) getObject(Context.getContact(), contactsids);
806    }
807
808    /**
809     * @param contact the contact to set
810     */
811    @Persistable(false)
812    public void setContact(Contact contact) {
813        setContactsids(contact.__getIDS());
814    }
815
816    /**
817     * @return the account
818     */
819    @Persistable(false)
820    public Account getAccount() throws NodataFoundException {
821        return (Account) getObject(Context.getAccounts(), accountsids);
822    }
823
824    /**
825     * @param account the account to set
826     */
827    @Persistable(false)
828    public void setAccount(Account account) {
829        setAccountsids(account.__getIDS());
830    }
831
832    /**
833     * @return the status
834     */
835    @Persistable(false)
836    public String getStatus() {
837        return getStatusString(intstatus);
838    }
839}