use of org.apache.cayenne.map.QueryDescriptor in project cayenne by apache.
the class ProcedureQueryView method setEntity.
void setEntity(ObjEntity entity) {
QueryDescriptor query = mediator.getCurrentQuery();
if (query != null && QueryDescriptor.PROCEDURE_QUERY.equals(query.getType())) {
((ProcedureQueryDescriptor) query).setResultEntityName(entity != null ? entity.getName() : null);
mediator.fireQueryEvent(new QueryEvent(this, query));
}
}
use of org.apache.cayenne.map.QueryDescriptor in project cayenne by apache.
the class RootSelectionHandler method actionPerformed.
public void actionPerformed(ActionEvent ae) {
QueryDescriptor query = queryTab.getQuery();
if (query != null) {
Entity root = (Entity) queryTab.getQueryRoot().getModel().getSelectedItem();
if (root != null) {
query.setRoot(root);
if (needChangeName) {
// not changed by user
/*
* Doing auto name change, following CAY-888 #2
*/
String newPrefix = root.getName() + "Query";
newName = newPrefix;
DataMap map = queryTab.getMediator().getCurrentDataMap();
long postfix = 1;
while (map.getQueryDescriptor(newName) != null) {
newName = newPrefix + (postfix++);
}
queryTab.getNameField().setText(newName);
}
}
}
}
use of org.apache.cayenne.map.QueryDescriptor in project cayenne by apache.
the class RootSelectionHandler method focusGained.
public void focusGained(FocusEvent e) {
// reset new name tracking
newName = null;
QueryDescriptor query = queryTab.getQuery();
if (query != null) {
needChangeName = hasDefaultName(query);
} else {
needChangeName = false;
}
}
use of org.apache.cayenne.map.QueryDescriptor in project cayenne by apache.
the class SQLTemplateMainTab method setQueryComment.
private void setQueryComment(String text) {
QueryDescriptor query = getQuery();
if (query == null) {
return;
}
ObjectInfo.putToMetaData(mediator.getApplication().getMetaData(), query, ObjectInfo.COMMENT, text);
mediator.fireQueryEvent(new QueryEvent(this, query));
}
use of org.apache.cayenne.map.QueryDescriptor in project cayenne by apache.
the class SQLTemplateMainTab method setEntity.
void setEntity(ObjEntity entity) {
QueryDescriptor template = getQuery();
if (template != null) {
// in case of null entity, set root to DataMap
Object root = entity != null ? entity : mediator.getCurrentDataMap();
template.setRoot(root);
mediator.fireQueryEvent(new QueryEvent(this, template));
}
}
Aggregations