Skip to content

Commit ced94f2

Browse files
committed
Merge branch 'master' of https://github.com/logicaldoc/community
2 parents 7d347c8 + f95ae25 commit ced94f2

File tree

42 files changed

+964
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+964
-85
lines changed

logicaldoc-core/src/main/java/com/logicaldoc/core/automation/Automation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ public Automation(String logTag, Locale locale, long tenantId) {
142142
*
143143
* @return The complete dictionary to use
144144
*/
145-
@SuppressWarnings({ "rawtypes", "unchecked" })
146145
private Map<String, Object> prepareDictionary(Map<String, Object> clientDictionary) {
147146
if (clientDictionary == null)
148147
clientDictionary = new ConcurrentHashMap<>();
@@ -157,7 +156,7 @@ private Map<String, Object> prepareDictionary(Map<String, Object> clientDictiona
157156
String beanClassName = bd.getBeanClassName();
158157

159158
try {
160-
Class beanClass = Class.forName(beanClassName);
159+
Class<?> beanClass = Class.forName(beanClassName);
161160

162161
String key = beanClass.getSimpleName();
163162
AutomationDictionary annotation = (AutomationDictionary) beanClass

logicaldoc-core/src/test/java/com/logicaldoc/core/AbstractCoreTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private void prepareStore() throws IOException {
7878
}
7979

8080
@Override
81-
public void tearDown() throws SQLException {
81+
public void tearDown() throws IOException, SQLException {
8282
super.tearDown();
8383

8484
FileUtil.delete(rootStoreOne);

logicaldoc-core/src/test/java/com/logicaldoc/core/dashlet/DashletContentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void setUp() throws IOException, SQLException, PluginException {
6060
}
6161

6262
@Override
63-
public void tearDown() throws SQLException {
63+
public void tearDown() throws SQLException, IOException {
6464
super.tearDown();
6565
FileUtil.delete(responseFile);
6666
}

logicaldoc-core/src/test/java/com/logicaldoc/core/searchengine/StandardSearchEngineTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setUp() throws IOException, SQLException, PluginException {
3333

3434
@After
3535
@Override
36-
public void tearDown() throws SQLException {
36+
public void tearDown() throws SQLException, IOException {
3737
testSubject.unlock();
3838
testSubject.close();
3939
super.tearDown();

logicaldoc-core/src/test/java/com/logicaldoc/core/security/SessionManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void setUp() throws IOException, SQLException, PluginException {
7272

7373
@After
7474
@Override
75-
public void tearDown() throws SQLException {
75+
public void tearDown() throws SQLException, IOException {
7676
testSubject.removeListener(this);
7777
testSubject.destroy();
7878
super.tearDown();

logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/Menu.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ public class Menu {
219219

220220
public static final long GOOGLE_CALENDAR = -2081;
221221

222+
public static final long ARTIFICIAL_INTELLIGENCE = 3000;
223+
222224
private static Set<Long> menus = new HashSet<>();
223225

224226
private Menu() {

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/administration/AdminMenu.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.logicaldoc.gui.common.client.Feature;
44
import com.logicaldoc.gui.common.client.Menu;
55
import com.logicaldoc.gui.common.client.i18n.I18N;
6+
import com.logicaldoc.gui.frontend.client.ai.AIMenu;
67
import com.logicaldoc.gui.frontend.client.impex.ImpexMenu;
78
import com.logicaldoc.gui.frontend.client.metadata.MetadataMenu;
89
import com.logicaldoc.gui.frontend.client.reports.ReportsMenu;
@@ -70,6 +71,12 @@ private AdminMenu() {
7071
addSection(toolsSection);
7172
}
7273

74+
if (Feature.visible(Feature.ARTIFICIAL_INTELLIGENCE) && Menu.enabled(Menu.ARTIFICIAL_INTELLIGENCE)) {
75+
SectionStackSection aiSection = new SectionStackSection(I18N.message("artificialintelligence"));
76+
aiSection.setExpanded(false);
77+
aiSection.addItem(new AIMenu());
78+
addSection(aiSection);
79+
}
7380
if (Menu.enabled(Menu.SETTINGS)) {
7481
SectionStackSection settingsSection = new SectionStackSection(I18N.message("settings"));
7582
settingsSection.setExpanded(false);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.logicaldoc.gui.frontend.client.ai;
2+
3+
import com.logicaldoc.gui.common.client.i18n.I18N;
4+
import com.logicaldoc.gui.frontend.client.administration.AdminScreen;
5+
import com.smartgwt.client.types.Overflow;
6+
import com.smartgwt.client.widgets.Button;
7+
import com.smartgwt.client.widgets.layout.VLayout;
8+
9+
/**
10+
* This panel shows the administration of AI aspects
11+
*
12+
* @author Marco Meschieri - LogicalDOC
13+
* @since 9.2
14+
*/
15+
public class AIMenu extends VLayout {
16+
17+
public AIMenu() {
18+
setMargin(10);
19+
setMembersMargin(5);
20+
setOverflow(Overflow.AUTO);
21+
22+
addModelsButton();
23+
}
24+
25+
private void addModelsButton() {
26+
Button templates = new Button(I18N.message("models"));
27+
templates.setWidth100();
28+
templates.setHeight(25);
29+
templates.addClickHandler(templatesClick -> AdminScreen.get().setContent(new ModelsAndSamplersPanel()));
30+
addMember(templates);
31+
}
32+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.logicaldoc.gui.frontend.client.ai;
2+
3+
import com.google.gwt.core.client.GWT;
4+
import com.google.gwt.user.client.rpc.RemoteService;
5+
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
6+
import com.google.gwt.user.client.rpc.ServiceDefTarget;
7+
import com.logicaldoc.gui.common.client.LDRpcRequestBuilder;
8+
import com.logicaldoc.gui.common.client.ServerException;
9+
import com.logicaldoc.gui.frontend.client.ai.sampler.GUISampler;
10+
11+
/**
12+
* The client side stub for the Artificial Intelligence Service. This service
13+
* gives all needed methods to handle templates.
14+
*
15+
* @author Marco Meschieri - LogicalDOC
16+
* @since 9.2
17+
*/
18+
@RemoteServiceRelativePath("ai")
19+
public interface AIService extends RemoteService {
20+
/**
21+
* Deletes a given sampler
22+
*
23+
* @param samplerId identifier of the sampler
24+
*
25+
* @throws ServerException an error happened in the server application
26+
*/
27+
public void deleteSampler(long samplerId) throws ServerException;
28+
29+
/**
30+
* Creates or updates a sampler
31+
*
32+
* @param sampler the sampler to save
33+
*
34+
* @return the saved sampler
35+
*
36+
* @throws ServerException an error happened in the server application
37+
*/
38+
public GUISampler saveSampler(GUISampler sampler) throws ServerException;
39+
40+
/**
41+
* Retrieves a sampler from the data layer
42+
*
43+
* @param samplerId identifier of the sampler
44+
*
45+
* @return the sampler
46+
*
47+
* @throws ServerException an error happened in the server application
48+
*/
49+
public GUISampler getSampler(long samplerId) throws ServerException;
50+
51+
public static class Instance {
52+
private static AIServiceAsync inst;
53+
54+
private Instance() {
55+
}
56+
57+
public static AIServiceAsync get() {
58+
if (inst == null) {
59+
inst = GWT.create(AIService.class);
60+
((ServiceDefTarget) inst).setRpcRequestBuilder(new LDRpcRequestBuilder());
61+
}
62+
return inst;
63+
}
64+
}
65+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.logicaldoc.gui.frontend.client.ai;
2+
3+
import com.google.gwt.user.client.rpc.AsyncCallback;
4+
import com.logicaldoc.gui.frontend.client.ai.sampler.GUISampler;
5+
6+
public interface AIServiceAsync {
7+
8+
void deleteSampler(long samplerId, AsyncCallback<Void> callback);
9+
10+
void saveSampler(GUISampler sampler, AsyncCallback<GUISampler> callback);
11+
12+
void getSampler(long samplerId, AsyncCallback<GUISampler> callback);
13+
}

0 commit comments

Comments
 (0)