Subversion Repositories SmartDukaan

Rev

Rev 37164 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37164 Rev 37181
Line 1... Line 1...
1
package com.spice.profitmandi.dao.enumuration.dtr;
1
package com.spice.profitmandi.dao.enumuration.dtr;
2
 
2
 
3
/**
3
/**
4
 * Agenda types tracked as lifecycle instances (user.agenda_instance.agenda_type).
4
 * Agenda types tracked as lifecycle instances (user.agenda_instance.agenda_type).
5
 * Mirrors {@link VisitAgenda} 1:1 (same names, same labels). Five have AUTO rules
5
 * Mirrors {@link VisitAgenda} 1:1 (same names, same labels). Types with an AUTO
6
 * (LOW_INVESTMENT, LOW_SALES, LOW_PURCHASE, CREDIT_DUES, REVIVAL — the last
6
 * rule are populated by the nightly cron ONLY — planners cannot assign them
7
 * mirrors fofo_store.activation_type); all are manual-pickable on Assign Visit.
7
 * manually; only the non-auto types are manual-assignable on Assign Visit.
8
 */
8
 */
9
public enum AgendaType {
9
public enum AgendaType {
10
    LOW_INVESTMENT("Low investment"),
10
    LOW_INVESTMENT("Low investment", true),
11
    LOW_SALES("Low sales"),
11
    LOW_SALES("Low sales", true),
12
    LOW_PURCHASE("Low purchase"),
12
    LOW_PURCHASE("Low purchase", true),
13
    BRAND_ADDITION("Brand addition"),
13
    BRAND_ADDITION("Brand addition", false),
14
    CREDIT_DUES("Credit dues"),
14
    CREDIT_DUES("Credit dues", true),
15
    SYSTEM_TRAINING("System training"),
15
    SYSTEM_TRAINING("System training", false),
16
    REVIVAL("Revival"),
16
    REVIVAL("Revival", true),
17
    NEW_STOCK_PAYMENT("New Stock Payment");
17
    NEW_STOCK_PAYMENT("New Stock Payment", false);
18
 
18
 
19
    private final String label;
19
    private final String label;
-
 
20
    private final boolean hasAutoRule;
20
 
21
 
21
    AgendaType(String label) {
22
    AgendaType(String label, boolean hasAutoRule) {
22
        this.label = label;
23
        this.label = label;
-
 
24
        this.hasAutoRule = hasAutoRule;
23
    }
25
    }
24
 
26
 
25
    public String getLabel() {
27
    public String getLabel() {
26
        return label;
28
        return label;
27
    }
29
    }
28
 
30
 
-
 
31
    public boolean hasAutoRule() {
-
 
32
        return hasAutoRule;
-
 
33
    }
-
 
34
 
-
 
35
    public boolean isManualAssignable() {
-
 
36
        return !hasAutoRule;
-
 
37
    }
-
 
38
 
-
 
39
    public static java.util.List<String> manualAssignableLabels() {
-
 
40
        java.util.List<String> out = new java.util.ArrayList<>();
-
 
41
        for (AgendaType t : values()) {
-
 
42
            if (t.isManualAssignable()) out.add(t.label);
-
 
43
        }
-
 
44
        return out;
-
 
45
    }
-
 
46
 
29
    public static AgendaType fromLabel(String label) {
47
    public static AgendaType fromLabel(String label) {
30
        if (label == null) return null;
48
        if (label == null) return null;
31
        for (AgendaType t : values()) {
49
        for (AgendaType t : values()) {
32
            if (t.label.equalsIgnoreCase(label.trim())) return t;
50
            if (t.label.equalsIgnoreCase(label.trim())) return t;
33
        }
51
        }