Skip to content

Commit 25509a2

Browse files
Merge pull request #72 from yuriy-glotanov/2025.1
RELEASE 2025.1
2 parents 70e6b31 + 214f4c1 commit 25509a2

22 files changed

+520
-239
lines changed

src/main/java/su/interference/mgmt/MgmtClass.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 interference
4+
Copyright (c) 2010-2026 interference
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -34,5 +34,5 @@ this software and associated documentation files (the "Software"), to deal in
3434

3535
@Retention(RetentionPolicy.RUNTIME)
3636
public @interface MgmtClass {
37-
37+
boolean allowEdit();
3838
}

src/main/java/su/interference/mgmt/MgmtColumn.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 interference
4+
Copyright (c) 2010-2026 interference
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -36,4 +36,5 @@ this software and associated documentation files (the "Software"), to deal in
3636
public @interface MgmtColumn {
3737
String name();
3838
int width();
39+
boolean table();
3940
}

src/main/java/su/interference/mgmt/MgmtConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 interference
4+
Copyright (c) 2010-2026 interference
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -29,11 +29,11 @@ this software and associated documentation files (the "Software"), to deal in
2929
* @since 1.0
3030
*/
3131

32-
@MgmtClass
32+
@MgmtClass(allowEdit = false)
3333
public class MgmtConfig {
34-
@MgmtColumn(name="Configuration parameter",width=20)
34+
@MgmtColumn(name="Configuration parameter", width=20, table = true)
3535
private final String confParam;
36-
@MgmtColumn(name="Parameter Value",width=80)
36+
@MgmtColumn(name="Parameter Value", width=80, table = true)
3737
private final Object confValue;
3838

3939
public MgmtConfig(String confParam, Object confValue) {

src/main/java/su/interference/mgmt/MgmtContainer.java

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 interference
4+
Copyright (c) 2010-2026 interference
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -34,22 +34,24 @@ this software and associated documentation files (the "Software"), to deal in
3434
*/
3535

3636
public class MgmtContainer {
37-
MgmtColumn mgmtColumn;
38-
MgmtAction mgmtAction;
39-
MgmtLink mgmtLink;
40-
Field field;
41-
Method method;
42-
Class c;
43-
Field idField;
44-
45-
public MgmtContainer(MgmtColumn mgmtColumn, MgmtAction mgmtAction, MgmtLink mgmtLink, Field field, Method method, Class c, Field idField) {
37+
final MgmtColumn mgmtColumn;
38+
final MgmtAction mgmtAction;
39+
final MgmtLink mgmtLink;
40+
final Field field;
41+
final Method method;
42+
final Class c;
43+
final Field idField;
44+
final boolean autoGenerate;
45+
46+
public MgmtContainer(MgmtColumn mgmtColumn, MgmtAction mgmtAction, MgmtLink mgmtLink, Field field, Method method, Class c, Field idField, boolean autoGenerate) {
4647
this.mgmtColumn = mgmtColumn;
4748
this.mgmtAction = mgmtAction;
4849
this.mgmtLink = mgmtLink;
4950
this.field = field;
5051
this.method = method;
5152
this.c = c;
5253
this.idField = idField;
54+
this.autoGenerate = autoGenerate;
5355
}
5456

5557
public MgmtColumn getMgmtColumn() {
@@ -84,21 +86,45 @@ public String getHeader() {
8486
}
8587
}
8688

87-
public String getValue(Object o, String objectId, String sessionId, int pageId) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
89+
public String getValue(Object o, int tableId, String sessionId, int pageId, boolean showMgmtLink, boolean showEditLink) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
8890
if (this.mgmtColumn == null || this.field == null) {
8991
return null;
9092
} else {
9193
String getName = "get" + this.field.getName().substring(0,1).toUpperCase() + this.field.getName().substring(1);
9294
Method m = this.c.getMethod(getName, null);
9395
Object result = m.invoke(o, null);
94-
if (this.mgmtLink != null) {
95-
return "<a href=\"?showtable="+objectId+"&session_id="+sessionId+"&page_id=10\">"+result+"</a>";
96+
if (this.isId() && showEditLink) {
97+
return "<a href=\"?action=edit&table_id="+tableId+"&object_id="+this.getId(o)+"&session_id="+sessionId+"&page_id="+pageId+"\">"+result+"</a>";
98+
} else if (this.mgmtLink != null && showMgmtLink) {
99+
return "<a href=\"?action=showtable&table_id="+this.getId(o)+"&session_id="+sessionId+"&page_id="+pageId+"\">"+result+"</a>";
96100
} else {
97101
return String.valueOf(result);
98102
}
99103
}
100104
}
101105

106+
public String getInsertLink(int tableId, String sessionId, int pageId) {
107+
return "<a href=\"?action=insert&table_id="+tableId+"&session_id="+sessionId+"&page_id="+pageId+"\">Insert new</a>";
108+
}
109+
110+
public String getFormElement(Object o) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
111+
if (this.mgmtColumn == null || this.field == null) {
112+
return null;
113+
} else {
114+
Object result = "";
115+
String disabled = "";
116+
if (o != null) {
117+
String getName = "get" + this.field.getName().substring(0, 1).toUpperCase() + this.field.getName().substring(1);
118+
Method m = this.c.getMethod(getName, null);
119+
result = m.invoke(o, null);
120+
disabled = this.field.equals(this.idField) ? "disabled" : "";
121+
} else {
122+
disabled = this.field.equals(this.idField) && this.autoGenerate ? "disabled" : "";
123+
}
124+
return "<input type=\"text\" size=\"100\" name=\""+this.field.getName()+"\" " + disabled + " value=\""+String.valueOf(result)+"\">\n";
125+
}
126+
}
127+
102128
public String getId(Object o) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
103129
if (this.idField == null) {
104130
return null;
@@ -113,4 +139,12 @@ public String getId(Object o) throws NoSuchMethodException, IllegalAccessExcepti
113139
public boolean isCommand() {
114140
return this.method != null && this.mgmtAction != null;
115141
}
142+
143+
public boolean isId() {
144+
return this.field != null && this.field.equals(this.idField);
145+
}
146+
147+
public boolean isAutoGenerate() {
148+
return autoGenerate;
149+
}
116150
}

src/main/java/su/interference/persistent/Cursor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 head systems, ltd
4+
Copyright (c) 2010-2026 head systems, ltd
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -44,7 +44,7 @@ this software and associated documentation files (the "Software"), to deal in
4444
@Entity
4545
@SystemEntity
4646
@DisableSync
47-
@MgmtClass
47+
@MgmtClass(allowEdit = false)
4848
public class Cursor implements Serializable {
4949
@Transient
5050
public static final int MASTER_TYPE = 1;
@@ -68,25 +68,25 @@ public class Cursor implements Serializable {
6868
@IndexColumn
6969
@GeneratedValue
7070
@DistributedId
71-
@MgmtColumn(name="Cursor Id",width=10)
71+
@MgmtColumn(name="Cursor Id",width=10, table = true)
7272
private long cursorId;
7373
@Column
74-
@MgmtColumn(name="SQL",width=50)
74+
@MgmtColumn(name="SQL",width=50, table = true)
7575
private String sql;
7676
@Column
77-
@MgmtColumn(name="Target Node",width=10)
77+
@MgmtColumn(name="Target Node",width=10, table = true)
7878
private int targetNodeId;
7979
@Column
80-
@MgmtColumn(name="Target Id",width=10)
80+
@MgmtColumn(name="Target Id",width=10, table = true)
8181
private int targetId;
8282
@Column
83-
@MgmtColumn(name="Target Class",width=10)
83+
@MgmtColumn(name="Target Class",width=10, table = true)
8484
private String targetClassName;
8585
@Column
86-
@MgmtColumn(name="Type",width=10)
86+
@MgmtColumn(name="Type",width=10, table = true)
8787
private int type;
8888
@Column
89-
@MgmtColumn(name="State",width=10)
89+
@MgmtColumn(name="State",width=10, table = true)
9090
private int state;
9191

9292
@Transient

src/main/java/su/interference/persistent/DataFile.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 head systems, ltd
4+
Copyright (c) 2010-2026 head systems, ltd
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -50,39 +50,39 @@ this software and associated documentation files (the "Software"), to deal in
5050

5151
@Entity
5252
@SystemEntity
53-
@MgmtClass
53+
@MgmtClass(allowEdit = false)
5454
public class DataFile implements Serializable {
5555

5656
@Column
5757
@Id
5858
@GeneratedValue
5959
@IndexColumn
60-
@MgmtColumn(name="File Id",width=10)
60+
@MgmtColumn(name="File Id",width=10, table = true)
6161
private int fileId;
6262
@Column
6363
@IndexColumn
6464
private int type;
6565
@Column
6666
@IndexColumn
67-
@MgmtColumn(name="Node Id",width=10)
67+
@MgmtColumn(name="Node Id",width=10, table = true)
6868
private int nodeId;
6969
@Column
70-
@MgmtColumn(name="Name",width=70)
70+
@MgmtColumn(name="Name",width=70, table = true)
7171
private String fileName;
7272
@Column
7373
private long fileSize;
7474
@Column
7575
private long fileUsed;
7676
@Column
7777
private int fileExtAmount;
78-
@MgmtColumn(name="Frames allocated",width=20)
78+
@MgmtColumn(name="Frames allocated",width=20, table = true)
7979
@Transient
8080
private int framesCnt;
81-
@MgmtColumn(name="Frames deallocated",width=20)
81+
@MgmtColumn(name="Frames deallocated",width=20, table = true)
8282
@Transient
8383
private int freeFramesCnt;
8484

85-
@MgmtColumn(name="Type",width=20)
85+
@MgmtColumn(name="Type",width=20, table = true)
8686
@Transient
8787
private String dataFileType;
8888
@Transient

src/main/java/su/interference/persistent/FrameData.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 head systems, ltd
4+
Copyright (c) 2010-2026 head systems, ltd
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -51,7 +51,7 @@ this software and associated documentation files (the "Software"), to deal in
5151
@Entity
5252
@SystemEntity
5353
@DisableSync
54-
@MgmtClass
54+
@MgmtClass(allowEdit = false)
5555
public class FrameData implements Serializable, Comparable, FrameApi, FilePartitioned, OnDelete {
5656

5757
@Transient
@@ -65,32 +65,32 @@ public class FrameData implements Serializable, Comparable, FrameApi, FilePartit
6565
@IndexColumn
6666
private volatile int objectId;
6767
@Column
68-
@MgmtColumn(name="File Id",width=10)
68+
@MgmtColumn(name="File Id",width=10, table = true)
6969
private volatile int file;
7070
@Column
71-
@MgmtColumn(name="PTR",width=30)
71+
@MgmtColumn(name="PTR",width=30, table = true)
7272
private volatile long ptr;
7373
@Column
74-
@MgmtColumn(name="Size",width=10)
74+
@MgmtColumn(name="Size",width=10, table = true)
7575
private volatile int size;
7676
@Column
77-
@MgmtColumn(name="Used",width=10)
77+
@MgmtColumn(name="Used",width=10, table = true)
7878
private volatile int used;
7979
@Column
80-
@MgmtColumn(name="Prev File Id",width=10)
80+
@MgmtColumn(name="Prev File Id",width=10, table = true)
8181
private volatile int prevFile;
8282
@Column
83-
@MgmtColumn(name="Prev PTR",width=10)
83+
@MgmtColumn(name="Prev PTR",width=10, table = true)
8484
private volatile long prevFrame;
8585
@Column
86-
@MgmtColumn(name="Next File Id",width=10)
86+
@MgmtColumn(name="Next File Id",width=10, table = true)
8787
private volatile int nextFile;
8888
@Column
89-
@MgmtColumn(name="Next PTR",width=10)
89+
@MgmtColumn(name="Next PTR",width=10, table = true)
9090
private volatile long nextFrame;
9191
@Column
9292
@MapColumn
93-
@MgmtColumn(name="Alloc Id",width=10)
93+
@MgmtColumn(name="Alloc Id",width=10, table = true)
9494
private volatile long allocId; //virtual Id field
9595
@Column
9696
private int frameType;
@@ -103,7 +103,7 @@ public class FrameData implements Serializable, Comparable, FrameApi, FilePartit
103103
@Id
104104
@MapColumn
105105
@Transient
106-
@MgmtColumn(name="Frame Id",width=20)
106+
@MgmtColumn(name="Frame Id",width=20, table = true)
107107
private long frameId; //virtual Id field
108108
@Transient
109109
private final Map<Long, Map<Long, TransFrame>> tcounter = new ConcurrentHashMap<>();

src/main/java/su/interference/persistent/FrameSync.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2025 head systems, ltd
4+
Copyright (c) 2010-2026 head systems, ltd
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -47,19 +47,19 @@ public class FrameSync implements Comparable {
4747
@Id
4848
@IndexColumn
4949
@GeneratedValue
50-
@MgmtColumn(name="Sync Id",width=20)
50+
@MgmtColumn(name="Sync Id", width=20, table = true)
5151
private long syncId;
5252
@Column
53-
@MgmtColumn(name="Alloc Id",width=20)
53+
@MgmtColumn(name="Alloc Id", width=20, table = true)
5454
private long allocId;
5555
@Column
56-
@MgmtColumn(name="Node Id",width=20)
56+
@MgmtColumn(name="Node Id", width=20, table = true)
5757
private int nodeId;
5858
@Column
59-
@MgmtColumn(name="UUID",width=20)
59+
@MgmtColumn(name="UUID", width=20, table = true)
6060
private String syncUUID;
6161
@Column
62-
@MgmtColumn(name="Frame Id",width=20)
62+
@MgmtColumn(name="Frame Id", width=20, table = true)
6363
private long frameId;
6464
@Transient
6565
public static final int CLASS_ID = 15;

0 commit comments

Comments
 (0)