Skip to content

Commit

Permalink
Remove Menu from node
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Jun 18, 2024
1 parent 2226b56 commit 41bd5c2
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
import org.adempiere.core.domains.models.I_AD_Form;
import org.adempiere.core.domains.models.I_AD_Menu;
import org.adempiere.core.domains.models.I_AD_Process;
import org.adempiere.core.domains.models.I_AD_Role;
import org.adempiere.core.domains.models.I_AD_Tree;
import org.adempiere.core.domains.models.I_AD_Window;
import org.adempiere.model.MBrowse;
import org.compiere.model.MClientInfo;
import org.compiere.model.MForm;
import org.compiere.model.MMenu;
import org.compiere.model.MProcess;
import org.compiere.model.MRole;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
import org.compiere.model.MWindow;
Expand Down Expand Up @@ -85,7 +87,6 @@ protected String doIt() throws Exception {

private void exportMenuDefinition() {
exportTree();
exportMenuItemDefinition();
// Old implementation
if (this.getMenuId() > 0) {
addLog("@AD_Menu_ID@");
Expand Down Expand Up @@ -129,6 +130,7 @@ private void exportMenuDefinition() {
}

private void exportTree() {
exportRoleDefinition();
new Query(
getCtx(),
I_AD_Tree.Table_Name,
Expand All @@ -149,6 +151,30 @@ private void exportTree() {
counter.incrementAndGet();
})
;
exportMenuItemDefinition();
}

private void exportRoleDefinition() {
addLog("@AD_Role_ID@");
new Query(
getCtx(),
I_AD_Role.Table_Name,
null,
get_TrxName()
)
.setOnlyActiveRecords(true)
.getIDsAsList()
.forEach(roleId -> {
MRole role = MRole.get(getCtx(), roleId);
QueueLoader.getInstance()
.getQueueManager(ApplicationDictionary.CODE)
.withEntity(role)
.addToQueue()
;
addLog(role.getAD_Role_ID() + " - " + role.getName());
counter.incrementAndGet();
})
;
}

private void exportMenuItemDefinition() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
import org.spin.eca56.util.support.IGenericSender;
import org.spin.eca56.util.support.documents.Browser;
import org.spin.eca56.util.support.documents.Form;
import org.spin.eca56.util.support.documents.Menu;
import org.spin.eca56.util.support.documents.MenuItem;
import org.spin.eca56.util.support.documents.MenuTree;
import org.spin.eca56.util.support.documents.Process;
import org.spin.eca56.util.support.documents.Role;
import org.spin.eca56.util.support.documents.Window;
import org.spin.queue.model.MADQueue;
import org.spin.queue.util.QueueManager;
Expand Down Expand Up @@ -136,6 +136,8 @@ public IGenericDictionaryDocument getDocumentManager(PO entity) {
}
if(tableName.equals(I_AD_Tree.Table_Name)) {
return MenuTree.newInstance().withEntity(entity);
} else if(tableName.equals(I_AD_Role.Table_Name)) {
return Role.newInstance().withClientId(Env.getAD_Client_ID(entity.getCtx())).withEntity(entity);
}
return null;
}
Expand Down Expand Up @@ -173,7 +175,7 @@ public IGenericDictionaryDocument getDocumentManagerByRole(PO entity, String lan
} else if(tableName.equals(I_AD_Window.Table_Name)) {
return null;//Window.newInstance().withLanguage(language).withClientId(Env.getAD_Client_ID(entity.getCtx())).withEntity(entity);
} else if(tableName.equals(I_AD_Menu.Table_Name)) {
return Menu.newInstance().withLanguage(language).withClientId(Env.getAD_Client_ID(entity.getCtx())).withRoleId(roleId).withEntity(entity);
return null;//Menu.newInstance().withLanguage(language).withClientId(Env.getAD_Client_ID(entity.getCtx())).withRoleId(roleId).withEntity(entity);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.compiere.model.PO;
import org.compiere.util.Env;
import org.compiere.util.Util;

/**
* Interface for determinate if is a document to send, note that this is a mapping of values.
Expand Down Expand Up @@ -60,7 +61,9 @@ public Map<String, Object> getValues() {

public void putDocument(Map<String, Object> document) {
// Generic Detail
document.put("language", getLanguage());
if(!Util.isEmpty(getLanguage())) {
document.put("language", getLanguage());
}
if(getClientId() >= 0) {
document.put("client_id", getClientId());
}
Expand Down Expand Up @@ -112,8 +115,9 @@ public String getLanguage() {

private String getIndexValue() {
StringBuffer channel = new StringBuffer(getChannel());

channel.append("_").append(getLanguage());
if(!Util.isEmpty(getLanguage())) {
channel.append("_").append(getLanguage());
}
if(getClientId() >= 0) {
channel.append("_").append(getClientId());
}
Expand Down
219 changes: 0 additions & 219 deletions src/main/java/org/spin/eca56/util/support/documents/Menu.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ private MenuTree() {
public static MenuTree newInstance() {
return new MenuTree();
}

@Override
public String getLanguage() {
return null;
}

@Override
public String getChannel() {
Expand Down
Loading

0 comments on commit 41bd5c2

Please sign in to comment.